This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
<?php
|
||||
|
||||
$config->doc->createLib->requiredFields = 'name';
|
||||
$config->doc->editLib->requiredFields = 'name';
|
||||
|
||||
@@ -40,4 +40,56 @@ class doc extends control
|
||||
$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'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -51,5 +51,11 @@ $lang->doc->view = '文档详情';
|
||||
$lang->doc->manageModule = '维护模块';
|
||||
$lang->doc->manageModule = '维护模块';
|
||||
|
||||
$lang->doc->createLib = '创建';
|
||||
$lang->doc->editLib = '编辑';
|
||||
$lang->doc->libName = '文档库名称';
|
||||
|
||||
$lang->doc->systemLibs['product'] = '产品文档库';
|
||||
$lang->doc->systemLibs['project'] = '项目文档库';
|
||||
|
||||
$lang->doc->confirmDeleteLib = " 您确定删除该文档库吗?";
|
||||
|
||||
+36
-3
@@ -40,14 +40,47 @@ class docModel extends model
|
||||
}
|
||||
}
|
||||
|
||||
/* 通过ID获取文档库信息。*/
|
||||
public function getLibById($libID)
|
||||
{
|
||||
return $this->dao->findByID($libID)->from(TABLE_DOCLIB)->fetch();
|
||||
}
|
||||
|
||||
/* 获取文档库列表。*/
|
||||
public function getLibs()
|
||||
{
|
||||
$libs = $this->dao->select('id, name')->from(TABLE_DOCLIB)->fetchPairs();
|
||||
$libs = $this->dao->select('id, name')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->fetchPairs();
|
||||
return $this->lang->doc->systemLibs + $libs;
|
||||
}
|
||||
|
||||
public function getLibById($libID)
|
||||
/* 新增文档库。*/
|
||||
public function createLib()
|
||||
{
|
||||
return $this->dao->select('*')->from(TABLE_DOCLIB)->fetch();
|
||||
/* 处理数据。*/
|
||||
$lib = fixer::input('post')->stripTags('name')->get();
|
||||
$this->dao->insert(TABLE_DOCLIB)
|
||||
->data($lib)
|
||||
->autoCheck()
|
||||
->batchCheck('name', 'notempty')
|
||||
->check('name', 'unique')
|
||||
->exec();
|
||||
return $this->dao->lastInsertID();
|
||||
}
|
||||
|
||||
/* 编辑文档库。*/
|
||||
public function updateLib($libID)
|
||||
{
|
||||
/* 处理数据。*/
|
||||
$libID = (int)$libID;
|
||||
$oldLib = $this->getLibById($libID);
|
||||
$lib = fixer::input('post')->stripTags('name')->get();
|
||||
$this->dao->update(TABLE_DOCLIB)
|
||||
->data($lib)
|
||||
->autoCheck()
|
||||
->batchCheck('name', 'notempty')
|
||||
->check('name', 'unique', "id != $libID")
|
||||
->where('id')->eq($libID)
|
||||
->exec();
|
||||
if(!dao::isError()) return common::createChanges($oldLib, $lib);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* The browse view file of product module of ZenTaoMS.
|
||||
* The browse view 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
|
||||
@@ -46,7 +46,11 @@ function search(active)
|
||||
$('#' + active + 'Tab').removeClass('active');
|
||||
$('#bysearchTab').addClass('active');
|
||||
}
|
||||
|
||||
$(document).ready(function()
|
||||
{
|
||||
$(".right a").colorbox({width:500, height:200, iframe:true, transition:'none'});
|
||||
$("#modulemenu a:contains('<?php echo $lang->doc->editLib;?>')").colorbox({width:500, height:200, iframe:true, transition:'none'});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class='yui-d0'>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* The createlib view 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 Jia Fu <fujia@cnezsoft.com>
|
||||
* @package doc
|
||||
* @version $Id: createlib.html.php 975 2010-07-29 03:30:25Z jajacn@126.com $
|
||||
* @link http://www.zentaoms.com
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<style>body{background:white; margin-top:20px; padding-bottom:0}</style>
|
||||
<div id='yui-d0'>
|
||||
<form method='post'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $lang->doc->createLib;?></caption>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->doc->libName;?></th>
|
||||
<td><?php echo html::input('name', '', "class='text-1'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'>
|
||||
<?php echo html::submitButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* The editlib 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 Jia Fu <fujia@cnezsoft.com>
|
||||
* @package doc
|
||||
* @version $Id: editlib.html.php 975 2010-07-29 03:30:25Z jajacn@126.com $
|
||||
* @link http://www.zentaoms.com
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<style>body{background:white; margin-top:20px; padding-bottom:0}</style>
|
||||
<div id='yui-d0'>
|
||||
<form method='post'>
|
||||
<table class='table-1'>
|
||||
<caption><?php echo $lang->doc->editLib;?></caption>
|
||||
<tr>
|
||||
<th class='rowhead'><?php echo $lang->doc->libName;?></th>
|
||||
<td><?php echo html::input('name', $libName, "class='text-1'");?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='2' class='a-center'>
|
||||
<?php echo html::submitButton();?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
Reference in New Issue
Block a user