* code for task #2560.

This commit is contained in:
wangyidong
2016-03-28 10:15:44 +08:00
parent 4c06f689c4
commit b474222ed7
7 changed files with 28 additions and 8 deletions
+1
View File
@@ -0,0 +1 @@
ALTER TABLE `zt_module` ADD `short` varchar(30) COLLATE 'utf8_general_ci' NOT NULL AFTER `owner`;
+1
View File
@@ -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;
+1
View File
@@ -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}";
+7 -2
View File
@@ -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();
}
}
}
+5 -3
View File
@@ -73,17 +73,19 @@
foreach($sons as $sonModule)
{
if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order;
$disabled = $sonModule->type == $viewType ? '' : 'disabled="true"';
echo $hasBranch ? "<div class='input-group' style='margin-bottom:5px'>" : "<div style='margin-bottom:5px'>";
$disabled = $sonModule->type == $viewType ? '' : 'disabled';
echo "<div class='input-group' style='margin-bottom:5px'>";
echo html::input("modules[id$sonModule->id]", $sonModule->name, 'class="form-control"' . $disabled);
if($hasBranch) echo '<span class="input-group-addon fix-border" style="padding:0px"></span>' . html::select("branch[id$sonModule->id]", $branches, $sonModule->branch, 'class="form-control" disabled');
echo '<span class="input-group-addon fix-border" style="padding:0px"></span>' . html::input("shorts[id$sonModule->id]", $sonModule->short, "class='form-control' placeholder='{$lang->tree->short}' style='width:70px' $disabled");
echo '</div>';
}
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++)
{
echo "<div class='input-group' style='margin-bottom:5px'>";
echo html::input("modules[]", '', 'class="form-control"');
echo html::input("modules[]", '', "class='form-control' placeholder='{$lang->tree->name}'");
if($hasBranch) echo '<span class="input-group-addon fix-border" style="padding:0px"></span>' . html::select("branch[]", $branches, $branch, 'class="form-control"');
echo '<span class="input-group-addon fix-border" style="padding:0px"></span>' . html::input("shorts[]", '', "class='form-control' style='width:50px' placeholder='{$lang->tree->short}'");
echo "<span class='input-group-addon fix-border'><a href='javascript:;' onclick='addItem(this)'><i class='icon icon-plus'></i></a></span>";
echo "<span class='input-group-addon'><a href='javascript:;' onclick='deleteItem(this)'><i class='icon icon-remove'></i></a></span>";
echo '</div>';
+9 -3
View File
@@ -67,10 +67,16 @@
foreach($sons as $sonModule)
{
if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order;
$disabled = $sonModule->type == 'task' ? '' : 'disabled="true"';
echo '<span>' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=form-control ' . $disabled) . '</span>';
$disabled = $sonModule->type == 'task' ? '' : 'disabled';
echo "<div class='input-group' style='margin-bottom:5px;'>" . html::input("modules[id$sonModule->id]", $sonModule->name, "class='form-control' placeholder='{$lang->tree->name}' " . $disabled);
echo "<span class='input-group-addon fix-border' style='padding:0px'></span>" . html::input("shorts[id$sonModule->id]", $sonModule->short, "class='form-control' placeholder='{$lang->tree->short}' style='width:70px' " . $disabled) . '</div>';
}
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++)
{
echo "<div class='input-group' style='margin-bottom:5px;'>" . html::input("modules[]", '', "class='form-control' placeholder='{$lang->tree->name}' " . $disabled);
echo "<span class='input-group-addon fix-border' style='padding:0px'></span>" . html::input("shorts[]", '', "class='form-control' placeholder='{$lang->tree->short}' style='width:70px' " . $disabled);
echo html::hidden('branch[]', empty($module) ? 0 : $module->branch) . '</div>';
}
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '<span>' . html::input("modules[]", '', 'class=form-control') . html::hidden('branch[]', empty($module) ? 0 : $module->branch) . '</span>';
?>
</td>
</tr>
+4
View File
@@ -46,6 +46,10 @@ $jsRoot = $webRoot . "js/";
<td><?php echo html::select('owner', $users, $module->owner, "class='form-control chosen'", true);?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->tree->short;?></th>
<td><?php echo html::input('short', $module->short, "class='form-control'");?></td>
</tr>
<tr>
<td colspan='2' class='text-center'>
<?php echo html::submitButton();?>