From b474222ed787b57773ea10244187cb00f92f9cb6 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 28 Mar 2016 10:15:44 +0800 Subject: [PATCH] * code for task #2560. --- db/update8.1.3.sql | 1 + module/tree/lang/en.php | 1 + module/tree/lang/zh-cn.php | 1 + module/tree/model.php | 9 +++++++-- module/tree/view/browse.html.php | 8 +++++--- module/tree/view/browsetask.html.php | 12 +++++++++--- module/tree/view/edit.html.php | 4 ++++ 7 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 db/update8.1.3.sql diff --git a/db/update8.1.3.sql b/db/update8.1.3.sql new file mode 100644 index 0000000000..3c23a07cb4 --- /dev/null +++ b/db/update8.1.3.sql @@ -0,0 +1 @@ +ALTER TABLE `zt_module` ADD `short` varchar(30) COLLATE 'utf8_general_ci' NOT NULL AFTER `owner`; diff --git a/module/tree/lang/en.php b/module/tree/lang/en.php index 1390a2bb5d..0ed711fcd0 100644 --- a/module/tree/lang/en.php +++ b/module/tree/lang/en.php @@ -41,5 +41,6 @@ $lang->tree->parent = 'Parent'; $lang->tree->child = 'Child'; $lang->tree->owner = 'Owner'; $lang->tree->order = 'Order'; +$lang->tree->short = 'Short'; $lang->tree->projectDoc = "{$lang->projectCommon} doc"; $lang->tree->product = $lang->productCommon; diff --git a/module/tree/lang/zh-cn.php b/module/tree/lang/zh-cn.php index dcbf211611..06fd61124f 100644 --- a/module/tree/lang/zh-cn.php +++ b/module/tree/lang/zh-cn.php @@ -41,5 +41,6 @@ $lang->tree->parent = '上级模块'; $lang->tree->child = '子模块'; $lang->tree->owner = '负责人'; $lang->tree->order = '排序'; +$lang->tree->short = '简称'; $lang->tree->projectDoc = "{$lang->projectCommon}文档"; $lang->tree->product = "所属{$lang->productCommon}"; diff --git a/module/tree/model.php b/module/tree/model.php index b475af0e0b..c01b40c153 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1104,7 +1104,10 @@ class treeModel extends model { $this->checkUnique($rootID, $type, $parentModuleID, $childs); $parentModule = $this->getByID($parentModuleID); - $branches = $this->post->branch; + + $data = fixer::input('post')->get(); + $branches = $data->branch; + $shorts = $data->shorts; if($parentModule) { $grade = $parentModule->grade + 1; @@ -1128,6 +1131,7 @@ class treeModel extends model $module->name = strip_tags($moduleName); $module->parent = $parentModuleID; $module->branch = $branches[$moduleID]; + $module->short = $shorts[$moduleID]; $module->grade = $grade; $module->type = $type; $module->order = $this->post->maxOrder + $i * 10; @@ -1139,8 +1143,9 @@ class treeModel extends model } else { + $short = $shorts[$moduleID]; $moduleID = str_replace('id', '', $moduleID); - $this->dao->update(TABLE_MODULE)->set('name')->eq(strip_tags($moduleName))->where('id')->eq($moduleID)->limit(1)->exec(); + $this->dao->update(TABLE_MODULE)->set('name')->eq(strip_tags($moduleName))->set('short')->eq($short)->where('id')->eq($moduleID)->limit(1)->exec(); } } } diff --git a/module/tree/view/browse.html.php b/module/tree/view/browse.html.php index 90b428e989..269dcdd13e 100644 --- a/module/tree/view/browse.html.php +++ b/module/tree/view/browse.html.php @@ -73,17 +73,19 @@ foreach($sons as $sonModule) { if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order; - $disabled = $sonModule->type == $viewType ? '' : 'disabled="true"'; - echo $hasBranch ? "
" : "
"; + $disabled = $sonModule->type == $viewType ? '' : 'disabled'; + echo "
"; echo html::input("modules[id$sonModule->id]", $sonModule->name, 'class="form-control"' . $disabled); if($hasBranch) echo '' . html::select("branch[id$sonModule->id]", $branches, $sonModule->branch, 'class="form-control" disabled'); + echo '' . html::input("shorts[id$sonModule->id]", $sonModule->short, "class='form-control' placeholder='{$lang->tree->short}' style='width:70px' $disabled"); echo '
'; } for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) { echo "
"; - echo html::input("modules[]", '', 'class="form-control"'); + echo html::input("modules[]", '', "class='form-control' placeholder='{$lang->tree->name}'"); if($hasBranch) echo '' . html::select("branch[]", $branches, $branch, 'class="form-control"'); + echo '' . html::input("shorts[]", '', "class='form-control' style='width:50px' placeholder='{$lang->tree->short}'"); echo ""; echo ""; echo '
'; diff --git a/module/tree/view/browsetask.html.php b/module/tree/view/browsetask.html.php index 506a3af6f6..13c8af1760 100644 --- a/module/tree/view/browsetask.html.php +++ b/module/tree/view/browsetask.html.php @@ -67,10 +67,16 @@ foreach($sons as $sonModule) { if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order; - $disabled = $sonModule->type == 'task' ? '' : 'disabled="true"'; - echo '' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=form-control ' . $disabled) . ''; + $disabled = $sonModule->type == 'task' ? '' : 'disabled'; + echo "
" . html::input("modules[id$sonModule->id]", $sonModule->name, "class='form-control' placeholder='{$lang->tree->name}' " . $disabled); + echo "" . html::input("shorts[id$sonModule->id]", $sonModule->short, "class='form-control' placeholder='{$lang->tree->short}' style='width:70px' " . $disabled) . '
'; + } + for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) + { + echo "
" . html::input("modules[]", '', "class='form-control' placeholder='{$lang->tree->name}' " . $disabled); + echo "" . html::input("shorts[]", '', "class='form-control' placeholder='{$lang->tree->short}' style='width:70px' " . $disabled); + echo html::hidden('branch[]', empty($module) ? 0 : $module->branch) . '
'; } - for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '' . html::input("modules[]", '', 'class=form-control') . html::hidden('branch[]', empty($module) ? 0 : $module->branch) . ''; ?> diff --git a/module/tree/view/edit.html.php b/module/tree/view/edit.html.php index fe2cd51a17..2c61975451 100644 --- a/module/tree/view/edit.html.php +++ b/module/tree/view/edit.html.php @@ -46,6 +46,10 @@ $jsRoot = $webRoot . "js/"; owner, "class='form-control chosen'", true);?> + + tree->short;?> + short, "class='form-control'");?> +