+ complete task #298:complete doc module.add type, keywords and digest to doc.change UI when choose different type.

This commit is contained in:
fujia
2010-08-31 08:46:33 +00:00
parent a891420051
commit 764f65edf8
13 changed files with 156 additions and 29 deletions
+8 -5
View File
@@ -250,13 +250,10 @@ class doc extends control
$this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$libID"), $this->libs[$libID]);
$this->view->position[] = $this->lang->doc->create;
$this->view->doc = $doc;
$this->view->libID = $libID;
$this->view->users = $this->user->getPairs('noclosed,nodeleted');
$this->view->title = $doc->title;
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->moduleID = $doc->module;
$this->view->productID = $doc->product;
$this->view->projectID = $doc->project;
$this->display();
}
@@ -267,6 +264,11 @@ class doc extends control
$doc = $this->doc->getById($docID);
if(!$doc) die(js::error($this->lang->notFound) . js::locate('back'));
/* 文档库名称。*/
if($doc->lib == 'product') $lib = $doc->productName;
else if($doc->lib == 'project') $lib = $doc->productName . '/' . $doc->projectName;
else $lib = $doc->libName;
/* 设置菜单。*/
$this->doc->setMenu($this->libs, $doc->lib);
@@ -275,7 +277,8 @@ class doc extends control
$this->view->position[] = html::a($this->createLink('doc', 'browse', "libID=$doc->lib"), $this->libs[$doc->lib]);
$this->view->position[] = $this->lang->doc->create;
$this->view->doc = $doc;
$this->view->doc = $doc;
$this->view->lib = $lib;
$this->view->actions = $this->loadModel('action')->getList('doc', $docID);
$this->view->users = $this->user->getPairs('noclosed,nodeleted');
+4
View File
@@ -60,6 +60,10 @@ $lang->doc->deleteFile = 'Delete file';
$lang->doc->systemLibs['product'] = 'Product doc';
$lang->doc->systemLibs['project'] = 'Project doc';
$lang->doc->types['file'] = 'file';
$lang->doc->types['url'] = 'url';
$lang->doc->types['text'] = 'text';
$lang->doc->confirmDeleteLib = " Are you sure to delete this doc library?";
$lang->doc->confirmDelete = " Are you sure to delete this doc?";
$lang->doc->errorEditSystemDoc = "System doc library needn't edit";
+4
View File
@@ -60,6 +60,10 @@ $lang->doc->deleteFile = 'ファイルを削除';
$lang->doc->systemLibs['product'] = '製品ドキュメント';
$lang->doc->systemLibs['project'] = 'プロジェクトドキュメント';
$lang->doc->types['file'] = 'file';
$lang->doc->types['url'] = 'url';
$lang->doc->types['text'] = 'text';
$lang->doc->confirmDeleteLib = "あなたは、このドキュメントライブラリを削除しますか?";
$lang->doc->confirmDelete = "あなたはこのドキュメントを削除しますか?";
$lang->doc->errorEditSystemDoc = "システムドキュメントライブラリは必要はない編集";
+4
View File
@@ -60,6 +60,10 @@ $lang->doc->deleteFile = '삭제 파일';
$lang->doc->systemLibs['product'] = '제품 박사님';
$lang->doc->systemLibs['project'] = '프로젝트 의사';
$lang->doc->types['file'] = 'file';
$lang->doc->types['url'] = 'url';
$lang->doc->types['text'] = 'text';
$lang->doc->confirmDeleteLib = "당신이 의사 라이브러리를 삭제하시겠습니까?";
$lang->doc->confirmDelete = "당신이 의사를 삭제하시겠습니까?";
$lang->doc->errorEditSystemDoc = "시스템 의사 도서관은 필요 없어 편집";
+4
View File
@@ -60,6 +60,10 @@ $lang->doc->deleteFile = '刪除文件';
$lang->doc->systemLibs['product'] = '产品文档库';
$lang->doc->systemLibs['project'] = '项目文档库';
$lang->doc->types['file'] = 'file';
$lang->doc->types['url'] = 'url';
$lang->doc->types['text'] = 'text';
$lang->doc->confirmDeleteLib = " 您确定删除该文档库吗?";
$lang->doc->confirmDelete = " 您确定删除该文档吗?";
$lang->doc->errorEditSystemDoc = "系统文档库无需修改。";
+4
View File
@@ -60,6 +60,10 @@ $lang->doc->deleteFile = '刪除文件';
$lang->doc->systemLibs['product'] = '產品文檔庫';
$lang->doc->systemLibs['project'] = '項目文檔庫';
$lang->doc->types['file'] = 'file';
$lang->doc->types['url'] = 'url';
$lang->doc->types['text'] = 'text';
$lang->doc->confirmDeleteLib = " 您確定刪除該文檔庫嗎?";
$lang->doc->confirmDelete = " 您確定刪除該文檔嗎?";
$lang->doc->errorEditSystemDoc = "系统文档库不需要修改";
+6 -4
View File
@@ -130,7 +130,8 @@ class docModel extends model
->add('addedBy', $this->app->user->account)
->add('addedDate', $now)
->setDefault('product, project, module', 0)
->specialChars('title') //type, digest, content, keyword
->specialChars('title, digest, content, keywords')
->encodeURL('url')
->cleanInt('product, project, module')
->remove('files, labels')
->get();
@@ -155,10 +156,11 @@ class docModel extends model
$oldDoc = $this->getById($docID);
$now = helper::now();
$doc = fixer::input('post')
->cleanInt('product, project, module')
->specialChars('title')
->cleanInt('module')
->setDefault('module', 0)
->specialChars('title, digest, content, keywords')
->encodeURL('url')
->remove('files, labels')
->setDefault('project,project, module', 0)
->add('editedBy', $this->app->user->account)
->add('editedDate', $now)
->get();
+3 -1
View File
@@ -43,6 +43,7 @@
<?php $vars = "libID=$libID&module=$moduleID&productID=$productID&projectID=$projectID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";?>
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th><?php common::printOrderLink('title', $orderBy, $vars, $lang->doc->title);?></th>
<th class='w-100px'><?php common::printOrderLink('type', $orderBy, $vars, $lang->doc->type);?></th>
<th class='w-100px'><?php common::printOrderLink('addedBy', $orderBy, $vars, $lang->doc->addedBy);?></th>
<th class='w-120px'><?php common::printOrderLink('addedDate', $orderBy, $vars, $lang->doc->addedDate);?></th>
<th class='w-100px {sorter:false}'><?php echo $lang->actions;?></th>
@@ -57,8 +58,9 @@
<tr class='a-center'>
<td><?php if($canView) echo html::a($viewLink, sprintf('%03d', $doc->id)); else printf('%03d', $doc->id);?></td>
<td class='a-left nobr'><nobr><?php echo html::a($viewLink, $doc->title);?></nobr></td>
<td><?php echo $doc->type;?></td>
<td><?php echo $users[$doc->addedBy];?></td>
<td><?php echo $doc->addedDate;?></td>
<td><?php echo date("m-d H:i", strtotime($doc->addedDate));?></td>
<td>
<?php
$vars = "doc={$doc->id}";
+41 -2
View File
@@ -29,6 +29,25 @@ function loadProducts(project)
link = createLink('project', 'ajaxGetProducts', 'projectID=' + project);
$('#productBox').load(link);
}
/* 设置文档类型。*/
function setType(type)
{
if(type == 'url'){
$('#urlBox').show();
$('#fileBox').hide();
$('#contentBox').hide();
}
else if(type == 'text'){
$('#urlBox').hide();
$('#fileBox').hide();
$('#contentBox').show();
}
else{
$('#urlBox').hide();
$('#fileBox').show();
$('#contentBox').hide();
}
}
</script>
<div class='yui-d0'>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
@@ -54,10 +73,30 @@ function loadProducts(project)
<td><?php echo html::select('module', $moduleOptionMenu, $moduleID, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->title;?></th>
<td><?php echo html::input('title', '', "class='text-1'");?></td>
<th class='rowhead'><?php echo $lang->doc->type;?></th>
<td><?php echo html::radio('type', $lang->doc->types, 'file', "onclick=setType(this.value)");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->title;?></th>
<td><?php echo html::input('title', '', "class='text-1'");?></td>
</tr>
<tr id='urlBox' class='hidden'>
<th class='rowhead'><?php echo $lang->doc->url;?></th>
<td><?php echo html::input('url', '', "class='text-1'");?></td>
</tr>
<tr id='contentBox' class='hidden'>
<th class='rowhead'><?php echo $lang->doc->content;?></th>
<td><?php echo html::textarea('content', '', "class='text-1' rows='8'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->keywords;?></th>
<td><?php echo html::input('keywords', '', "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->digest;?></th>
<td><?php echo html::input('digest', '', "class='text-1'");?></td>
</tr>
<tr id='fileBox'>
<th class='rowhead'><?php echo $lang->doc->files;?></th>
<td><?php echo $this->fetch('file', 'buildform', 'fileCount=2');?></td>
</tr>
-2
View File
@@ -40,5 +40,3 @@
</table>
</form>
</div>
</body>
</html>
+44 -3
View File
@@ -23,26 +23,67 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<script language='javascript'>
/* 设置文档类型。*/
var type = '<?php echo $doc->type;?>';
$(document).ready(function()
{
if(type == 'url'){
$('#urlBox').show();
$('#contentBox').hide();
$('#fileBox').hide();
}
else if(type == 'text'){
$('#urlBox').hide();
$('#contentBox').show();
$('#fileBox').hide();
}
else{
$('#urlBox').hide();
$('#contentBox').hide();
$('#fileBox').show();
}
});
</script>
<div class='yui-d0'>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $lang->doc->edit;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->doc->module;?></th>
<td><?php echo html::select('module', $moduleOptionMenu, $moduleID, "class='select-3'");?></td>
<td><?php echo html::select('module', $moduleOptionMenu, $doc->module, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->type;?></th>
<td><?php echo $doc->type;?></td>
</tr>
<th class='rowhead'><?php echo $lang->doc->title;?></th>
<td><?php echo html::input('title', $title, "class='text-1'");?></td>
<td><?php echo html::input('title', $doc->title, "class='text-1'");?></td>
</tr>
<tr id='urlBox' class='hidden'>
<th class='rowhead'><?php echo $lang->doc->url;?></th>
<td><?php echo html::input('url', urldecode($doc->url), "class='text-1'");?></td>
</tr>
<tr id='contentBox' class='hidden'>
<th class='rowhead'><?php echo $lang->doc->content;?></th>
<td><?php echo html::textarea('content', $doc->content, "class='text-1' rows='8'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->keywords;?></th>
<td><?php echo html::input('keywords', $doc->keywords, "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->digest;?></th>
<td><?php echo html::input('digest', $doc->digest, "class='text-1'");?></td>
</tr>
<tr id='fileBox' class='hidden'>
<th class='rowhead'><?php echo $lang->doc->files;?></th>
<td><?php echo $this->fetch('file', 'buildform', 'fileCount=2');?></td>
</tr>
<tr>
<td colspan='2' class='a-center'>
<?php echo html::submitButton() . html::resetButton() . html::hidden('lib', $libID);?>
<?php echo html::hidden('product', $productID) . html::hidden('project', $projectID);?>
<?php echo html::hidden('product', $doc->product) . html::hidden('project', $doc->project);?>
</td>
</tr>
</table>
-2
View File
@@ -40,5 +40,3 @@
</form>
<?php endif;?>
</div>
</body>
</html>
+34 -10
View File
@@ -24,7 +24,16 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../file/view/download.html.php';?>
</style>
<script language='javascript'>
var type = '<?php echo $doc->type;?>';
$(document).ready(function()
{
/* 判断文档类型。*/
if(type == 'url') $('#urlBox').show();
else if(type == 'text') $('#contentBox').show();
else $('#fileBox').show();
});
</script>
<div class='yui-d0'>
<table class='table-1'>
<caption><?php echo $doc->title . $lang->colon . $lang->doc->view;?></caption>
@@ -34,21 +43,36 @@
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->lib;?></th>
<td><?php echo $doc->libName;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->product;?></th>
<td><?php echo $doc->productName;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->project;?></th>
<td><?php echo $doc->projectName;?></td>
<td><?php echo $lib;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->module;?></th>
<td><?php echo $doc->moduleName;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->type;?></th>
<td><?php echo $doc->type;?></td>
</tr>
<th class='rowhead'><?php echo $lang->doc->title;?></th>
<td><?php echo $doc->title;?></td>
</tr>
<tr id='urlBox' class='hidden'>
<th class='rowhead'><?php echo $lang->doc->url;?></th>
<td><?php echo html::a(urldecode($doc->url));?></td>
</tr>
<tr id='contentBox' class='hidden'>
<th class='rowhead'><?php echo $lang->doc->content;?></th>
<td><?php echo nl2br($doc->content);?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->keywords;?></th>
<td><?php echo $doc->keywords;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->doc->digest;?></th>
<td><?php echo $doc->digest;?></td>
</tr>
<tr id='fileBox' class='hidden'>
<th class='rowhead'><?php echo $lang->files;?></th>
<td>
<?php