96 lines
3.3 KiB
PHP
96 lines
3.3 KiB
PHP
<?php
|
|
/**
|
|
* The control file of doc module of ZenTaoMS.
|
|
*
|
|
* ZenTaoMS is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* ZenTaoMS is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with ZenTaoMS. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* @copyright Copyright 2009-2010 青岛易软天创网络科技有限公司(www.cnezsoft.com)
|
|
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
|
|
* @package doc
|
|
* @version $Id: control.php 933 2010-07-06 06:53:40Z wwccss $
|
|
* @link http://www.zentaoms.com
|
|
*/
|
|
class doc extends control
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
$this->libs = $this->doc->getLibs();
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
$this->locate(inlink('browse'));
|
|
}
|
|
|
|
/* 浏览某一个产品。*/
|
|
public function browse($libID = 'product', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
|
|
{
|
|
$this->doc->setMenu($this->libs, $libID, 'doc');
|
|
$this->display();
|
|
}
|
|
|
|
/* 新增文档库。*/
|
|
public function createLib()
|
|
{
|
|
if(!empty($_POST))
|
|
{
|
|
$libID = $this->doc->createLib();
|
|
if(dao::isError()) die(js::error(dao::getError()));
|
|
$this->loadModel('action')->create('docLib', $libID, 'Created');
|
|
die(js::locate($this->createLink($this->moduleName, 'browse', "libID=$libID"), 'parent'));
|
|
}
|
|
die($this->display());
|
|
}
|
|
|
|
/* 编辑文档库。*/
|
|
public function editLib($libID)
|
|
{
|
|
if(!empty($_POST))
|
|
{
|
|
$changes = $this->doc->updateLib($libID);
|
|
if(dao::isError()) die(js::error(dao::getError()));
|
|
if($changes)
|
|
{
|
|
$actionID = $this->loadModel('action')->create('docLib', $libID, 'edited');
|
|
$this->action->logHistory($actionID, $changes);
|
|
}
|
|
die(js::locate($this->createLink($this->moduleName, 'browse', "libID=$libID"), 'parent'));
|
|
//die(js::locate(inlink('view', "libID=$libID"), 'parent'));
|
|
}
|
|
|
|
$lib = $this->doc->getLibByID($libID);
|
|
$this->view->libName = empty($lib) ? $libID : $lib->name;
|
|
|
|
die($this->display());
|
|
}
|
|
|
|
/* 删除文档库。*/
|
|
public function deleteLib($libID, $confirm = 'no')
|
|
{
|
|
if($confirm == 'no')
|
|
{
|
|
die(js::confirm($this->lang->doc->confirmDeleteLib, $this->createLink('doc', 'deleteLib', "libID=$libID&confirm=yes")));
|
|
}
|
|
else
|
|
{
|
|
$this->doc->delete(TABLE_DOCLIB, $libID);
|
|
//$this->session->set('doc', ''); // 清除session。
|
|
die(js::locate($this->createLink('doc', 'browse'), 'parent'));
|
|
}
|
|
|
|
}
|
|
|
|
}
|