* add company column for webapp table.

This commit is contained in:
wangyidong
2012-12-05 01:23:53 +00:00
parent 83efbed6f5
commit fece3b8265
4 changed files with 11 additions and 9 deletions

View File

@@ -9,6 +9,7 @@ UPDATE `zt_action` SET `read` = '1';
CREATE TABLE IF NOT EXISTS `zt_webapp` (
`id` mediumint(9) NOT NULL auto_increment,
`company` mediumint(8) unsigned NOT NULL default '0',
`appid` mediumint(9) NOT NULL,
`module` mediumint(9) NOT NULL,
`name` varchar(100) NOT NULL,

View File

@@ -675,6 +675,7 @@ CREATE TABLE IF NOT EXISTS `zt_userTPL` (
--DROP TABLE IF EXISTS `zt_webapp`;
CREATE TABLE IF NOT EXISTS `zt_webapp` (
`id` mediumint(9) NOT NULL auto_increment,
`company` mediumint(8) unsigned NOT NULL default '0',
`appid` mediumint(9) NOT NULL,
`module` mediumint(9) NOT NULL,
`name` varchar(100) NOT NULL,

View File

@@ -153,7 +153,7 @@ class webapp extends control
{
if($confirm == 'no') die(js::confirm($this->lang->webapp->confirmDelete, inlink('uninstall', "webappID=$webappID&confirm=yes")));
$this->dao->delete()->from(TABLE_WEBAPP)->where('id')->eq($webappID)->exec(false);
$this->dao->delete()->from(TABLE_WEBAPP)->where('id')->eq($webappID)->exec();
die(js::reload('parent'));
}
@@ -166,6 +166,6 @@ class webapp extends control
*/
public function ajaxAddView($webappID)
{
$this->dao->update(TABLE_WEBAPP)->set('views=views+1')->where('id')->eq($webappID)->exec(false);
$this->dao->update(TABLE_WEBAPP)->set('views=views+1')->where('id')->eq($webappID)->exec();
}
}

View File

@@ -163,7 +163,7 @@ class webappModel extends model
{
$webapps = $this->dao->select('*')->from(TABLE_WEBAPP)
->beginIF($module != 0)->where('module')->eq($module)->fi()
->fetchAll($key, false);
->fetchAll($key);
$localIcons = array();
foreach($webapps as $webapp)
{
@@ -192,7 +192,7 @@ class webappModel extends model
*/
public function getLocalAppByID($webappID)
{
return $this->dao->select('*')->from(TABLE_WEBAPP)->where('id')->eq($webappID)->fetch('', false);
return $this->dao->select('*')->from(TABLE_WEBAPP)->where('id')->eq($webappID)->fetch();
}
/**
@@ -219,7 +219,7 @@ class webappModel extends model
$installWebapp->addedBy = $this->app->user->account;
$installWebapp->addedDate = helper::now();
$this->dao->insert(TABLE_WEBAPP)->data($installWebapp, false)->autocheck()->exec(false);
$this->dao->insert(TABLE_WEBAPP)->data($installWebapp)->autocheck()->exec();
return $this->dao->lastInsertID();
}
@@ -233,7 +233,7 @@ class webappModel extends model
public function update($webappID)
{
$data = fixer::input('post')->get();
$this->dao->update(TABLE_WEBAPP)->data($data, false)->where('id')->eq($webappID)->exec(false);
$this->dao->update(TABLE_WEBAPP)->data($data)->where('id')->eq($webappID)->exec();
}
/**
@@ -250,17 +250,17 @@ class webappModel extends model
->add('addedDate', helper::now())
->add('author', $this->app->user->account)
->remove('files')->get();
$this->dao->insert(TABLE_WEBAPP)->data($data, false)
$this->dao->insert(TABLE_WEBAPP)->data($data)
->autocheck()
->batchCheck($this->config->webapp->create->requiredFields, 'notempty')
->exec(false);
->exec();
if(!dao::isError())
{
$webappID = $this->dao->lastInsertID();
if($_FILES)
{
$fileTitle = $this->loadModel('file')->saveUpload('webapp', $webappID);
$this->dao->update(TABLE_WEBAPP)->set('icon')->eq(key($fileTitle))->where('id')->eq($webappID)->exec(false);
$this->dao->update(TABLE_WEBAPP)->set('icon')->eq(key($fileTitle))->where('id')->eq($webappID)->exec();
}
return $webappID;
}