* rewrite the ui code of tree module.

This commit is contained in:
wangchunsheng
2011-03-02 16:06:05 +00:00
parent ced58072d7
commit c78e275080
4 changed files with 120 additions and 124 deletions
+1
View File
@@ -0,0 +1 @@
body{background:white; overflow:none}
+25
View File
@@ -0,0 +1,25 @@
function syncModule()
{
link = createLink('tree', 'ajaxGetSonModules', 'moduleID=' + $('#productModule').val() + '&rootID=' + rootID);
$.getJSON(link, function(modules)
{
$('.helplink').addClass('hidden');
$.each(modules, function(key, value)
{
moduleName = value;
$('.text-3').each(function()
{
if(this.value == moduleName) modules[key] = null;
if(!this.value) $(this).parent().addClass('hidden');
})
});
$.each(modules, function(key, value)
{
if(value) $('#moduleBox').append("<span><input name=modules[] value=" + value + " style=margin-bottom:5px class=text-3 /><br /><span>");
})
})
}
$(document).ready(function()
{
$("a.iframe").colorbox({width:480, height:240, iframe:true, transition:'none'});
});
+69 -97
View File
@@ -12,102 +12,74 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/treeview.html.php';?>
<script language='javascript'>
var rootID = '<?php echo $rootID;?>';
function syncModule()
{
link = createLink('tree', 'ajaxGetSonModules', 'moduleID=' + $('#productModule').val() + '&rootID=' + rootID);
$.getJSON(link, function(modules)
{
$('.helplink').addClass('hidden');
$.each(modules, function(key, value)
{
moduleName = value;
$('.text-3').each(function()
{
if(this.value == moduleName) modules[key] = null;
if(!this.value) $(this).parent().addClass('hidden');
})
});
$.each(modules, function(key, value)
{
if(value) $('#moduleBox').append("<span><input name=modules[] value=" + value + " style=margin-bottom:5px class=text-3 /><br /><span>");
})
})
}
$(document).ready(function()
{
$("a.iframe").colorbox({width:480, height:320, iframe:true, transition:'none'});
});
</script>
<div class="yui-d0 yui-t3">
<div class="yui-main">
<div class="yui-b">
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'manageChild', "root={$root->id}&viewType=$viewType");?>'>
<table align='center' class='table-1'>
<caption><?php echo $lang->tree->manageChild;?></caption>
<tr>
<td width='10%'>
<nobr>
<?php
echo html::a($this->createLink('tree', 'browse', "root={$root->id}&viewType=$viewType"), $root->name);
echo $lang->arrow;
foreach($parentModules as $module)
{
echo html::a($this->createLink('tree', 'browse', "root={$root->id}&viewType=$viewType&moduleID=$module->id"), $module->name);
echo $lang->arrow;
}
?>
</nobr>
</td>
<td id='moduleBox'>
<?php
if($viewType != 'story' and strpos($viewType, 'doc') === false)
{
echo html::select('productModule', $productModules, '', 'class=select-3');
echo html::commonButton($lang->tree->syncFromProduct, 'onclick=syncModule()');
echo '<br />';
}
$maxOrder = 0;
foreach($sons as $sonModule)
{
if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order;
echo '<span>' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
}
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '<span>' . html::input("modules[]", '', 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
?>
</td>
</tr>
<tr>
<td class='a-center' colspan='3'>
<?php
echo html::submitButton() . html::resetButton();
echo html::hidden('parentModuleID', $currentModuleID);
echo html::hidden('maxOrder', $maxOrder);
?>
<input type='hidden' value='<?php echo $currentModuleID;?>' name='parentModuleID' />
</td>
</tr>
</table>
<script language='javascript'>var rootID = '<?php echo $rootID;?>';</script>
<table class='cont-lt5'>
<tr valign='top'>
<td class='side'>
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'updateOrder', "root={$root->id}&viewType=$viewType");?>'>
<table class='table-1'>
<caption><?php echo $header->title;?></caption>
<tr>
<td>
<div id='main'><?php echo $modules;?></div>
<div class='a-center'>
<?php if(common::hasPriv('tree', 'updateorder')) echo html::submitButton($lang->tree->updateOrder);?>
</div>
</td>
</tr>
</table>
</form>
</div>
</div>
<div class="yui-b">
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'updateOrder', "root={$root->id}&viewType=$viewType");?>'>
<table class='table-1'>
<caption><?php echo $header->title;?></caption>
<tr>
<td>
<div id='main'><?php echo $modules;?></div>
<div class='a-center'>
<?php if(common::hasPriv('tree', 'updateorder')) echo html::submitButton($lang->tree->updateOrder);?>
</div>
</td>
</tr>
</table>
</form>
</div>
</div>
</td>
<td class='divider'></td>
<td>
<form method='post' target='hiddenwin' action='<?php echo $this->createLink('tree', 'manageChild', "root={$root->id}&viewType=$viewType");?>'>
<table align='center' class='table-1'>
<caption><?php echo $lang->tree->manageChild;?></caption>
<tr>
<td width='10%'>
<nobr>
<?php
echo html::a($this->createLink('tree', 'browse', "root={$root->id}&viewType=$viewType"), $root->name);
echo $lang->arrow;
foreach($parentModules as $module)
{
echo html::a($this->createLink('tree', 'browse', "root={$root->id}&viewType=$viewType&moduleID=$module->id"), $module->name);
echo $lang->arrow;
}
?>
</nobr>
</td>
<td id='moduleBox'>
<?php
if($viewType != 'story' and strpos($viewType, 'doc') === false)
{
echo html::select('productModule', $productModules, '', 'class=select-3');
echo html::commonButton($lang->tree->syncFromProduct, 'onclick=syncModule()');
echo '<br />';
}
$maxOrder = 0;
foreach($sons as $sonModule)
{
if($sonModule->order > $maxOrder) $maxOrder = $sonModule->order;
echo '<span>' . html::input("modules[id$sonModule->id]", $sonModule->name, 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
}
for($i = 0; $i < TREE::NEW_CHILD_COUNT ; $i ++) echo '<span>' . html::input("modules[]", '', 'class=text-3 style="margin-bottom:5px"') . '<br /></span>';
?>
</td>
</tr>
<tr>
<td class='a-center' colspan='3'>
<?php
echo html::submitButton() . html::resetButton();
echo html::hidden('parentModuleID', $currentModuleID);
echo html::hidden('maxOrder', $maxOrder);
?>
<input type='hidden' value='<?php echo $currentModuleID;?>' name='parentModuleID' />
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?php include '../../common/view/footer.html.php';?>
+25 -27
View File
@@ -11,30 +11,28 @@
*/
?>
<?php include '../../common/view/header.lite.html.php';?>
<style>body{background:white}</style>
<div id='yui-d0' style='margin-top:20px'>
<form method='post'>
<table class='table-1'>
<caption><?php echo $lang->tree->edit;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->tree->parent;?></th>
<td><?php echo html::select('parent', $optionMenu, $module->parent, "class='select-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->tree->name;?></th>
<td><?php echo html::input('name', $module->name, "class='text-1'");?></td>
</tr>
<?php if($module->type == 'bug'):?>
<tr>
<th class='rowhead'><?php echo $lang->tree->owner;?></th>
<td><?php echo html::select('owner', $users, $module->owner, "class='select-1'");?></td>
</tr>
<?php endif;?>
<tr>
<td colspan='2' class='a-center'>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
</div>
<form method='post' class='mt-10px'>
<table class='table-1'>
<caption><?php echo $lang->tree->edit;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->tree->parent;?></th>
<td><?php echo html::select('parent', $optionMenu, $module->parent, "class='select-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->tree->name;?></th>
<td><?php echo html::input('name', $module->name, "class='text-1'");?></td>
</tr>
<?php if($module->type == 'bug'):?>
<tr>
<th class='rowhead'><?php echo $lang->tree->owner;?></th>
<td><?php echo html::select('owner', $users, $module->owner, "class='select-1'");?></td>
</tr>
<?php endif;?>
<tr>
<td colspan='2' class='a-center'>
<?php echo html::submitButton();?>
</td>
</tr>
</table>
</form>
<?php include '../../common/view/footer.lite.html.php';?>