* rewrite the ui of product module.

* splite the js.
This commit is contained in:
wangchunsheng
2011-03-01 15:42:22 +00:00
parent df1f674ac1
commit abb0fc44a1
8 changed files with 224 additions and 247 deletions
+1
View File
@@ -142,6 +142,7 @@ class product extends control
$this->view->orderBy = $orderBy;
$this->view->browseType = $browseType;
$this->view->moduleID = $moduleID;
$this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
$this->display();
}
+20
View File
@@ -0,0 +1,20 @@
/* Browse by module. */
function browseByModule()
{
$('#treebox').removeClass('hidden');
$('.divider').removeClass('hidden');
$('#bymoduleTab').addClass('active');
$('#allTab').removeClass('active');
$('#bysearchTab').removeClass('active');
$('#querybox').addClass('hidden');
}
/* By search. */
function search(active)
{
$('#treebox').addClass('hidden');
$('.divider').addClass('hidden');
$('#querybox').removeClass('hidden');
$('#bymoduleTab').removeClass('active');
$('#' + active + 'Tab').removeClass('active');
$('#bysearchTab').addClass('active');
}
+4
View File
@@ -0,0 +1,4 @@
function setWhite(acl)
{
acl == 'custom' ? $('#whitelistBox').removeClass('hidden') : $('#whitelistBox').addClass('hidden');
}
+28 -56
View File
@@ -14,49 +14,34 @@
<?php include '../../common/view/treeview.html.php';?>
<?php include '../../common/view/colorize.html.php';?>
<?php include '../../common/view/table2csv.html.php';?>
<script language='Javascript'>
/* Browse by module. */
function browseByModule()
{
$('#mainbox').addClass('yui-t1');
$('#treebox').removeClass('hidden');
$('#bymoduleTab').addClass('active');
$('#allTab').removeClass('active');
$('#bysearchTab').removeClass('active');
$('#querybox').addClass('hidden');
}
/* By search. */
function search(active)
{
$('#mainbox').removeClass('yui-t1');
$('#treebox').addClass('hidden');
$('#querybox').removeClass('hidden');
$('#bymoduleTab').removeClass('active');
$('#' + active + 'Tab').removeClass('active');
$('#bysearchTab').addClass('active');
}
</script>
<div class='yui-d0'>
<div id='featurebar'>
<div class='f-left'>
<span id='bymoduleTab' onclick='browseByModule()'><a href='#'><?php echo $lang->product->moduleStory;?></a></span>
<span id='allTab'><?php echo html::a($this->createLink('product', 'browse', "productID=$productID&browseType=all&param=0&orderBy=$orderBy&recTotal=0&recPerPage=200"), $lang->product->allStory);?></span>
<span id='bysearchTab' onclick='search("<?php echo $browseType;?>")'><a href='#'><?php echo $lang->product->searchStory;?></a></span>
</div>
<div class='f-right'>
<?php echo html::export2csv($lang->exportCSV, $lang->setFileName);?>
<?php if(common::hasPriv('story', 'create')) echo html::a($this->createLink('story', 'create', "productID=$productID&moduleID=$moduleID"), $lang->story->create); ?>
</div>
<div id='featurebar'>
<div class='f-left'>
<span id='bymoduleTab' onclick='browseByModule()'><a href='#'><?php echo $lang->product->moduleStory;?></a></span>
<span id='allTab'><?php echo html::a($this->createLink('product', 'browse', "productID=$productID&browseType=all&param=0&orderBy=$orderBy&recTotal=0&recPerPage=200"), $lang->product->allStory);?></span>
<span id='bysearchTab' onclick='search("<?php echo $browseType;?>")'><a href='#'><?php echo $lang->product->searchStory;?></a></span>
</div>
<div class='f-right'>
<?php echo html::export2csv($lang->exportCSV, $lang->setFileName);?>
<?php if(common::hasPriv('story', 'create')) echo html::a($this->createLink('story', 'create', "productID=$productID&moduleID=$moduleID"), $lang->story->create); ?>
</div>
<div id='querybox' class='<?php if($browseType !='bysearch') echo 'hidden';?>'><?php echo $searchForm;?></div>
</div>
<div id='querybox' class='<?php if($browseType !='bysearch') echo 'hidden';?>'><?php echo $searchForm;?></div>
<div class='yui-d0 <?php if($browseType == 'bymodule') echo 'yui-t1';?>' id='mainbox'>
<div class="yui-main">
<div class="yui-b">
<table class='cont-lt1'>
<tr valign='top'>
<td class='side <?php echo $treeClass;?>' id='treebox'>
<div class='box-title'><?php echo $productName;?></div>
<div class='box-content'>
<?php echo $moduleTree;?>
<div class='a-right'>
<?php if(common::hasPriv('product', 'edit')) echo html::a($this->createLink('product', 'edit', "productID=$productID"), $lang->edit);?>
<?php if(common::hasPriv('product', 'delete')) echo html::a($this->createLink('product', 'delete', "productID=$productID&confirm=no"), $lang->delete, 'hiddenwin');?>
<?php if(common::hasPriv('tree', 'browse')) echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=story"), $lang->tree->manage);?>
</div>
</div>
</td>
<td class='divider <?php echo $treeClass;?>'></td>
<td>
<table class='table-1 fixed colored tablesorter datatable'>
<thead>
<tr class='colhead'>
@@ -102,22 +87,9 @@ function search(active)
</tbody>
</table>
<?php $pager->show();?>
</div>
</div>
<div class='yui-b <?php if($browseType != 'bymodule') echo 'hidden';?>' id='treebox'>
<div class='box-title'><?php echo $productName;?></div>
<div class='box-content'>
<?php echo $moduleTree;?>
<div class='a-right'>
<?php if(common::hasPriv('product', 'edit')) echo html::a($this->createLink('product', 'edit', "productID=$productID"), $lang->edit);?>
<?php if(common::hasPriv('product', 'delete')) echo html::a($this->createLink('product', 'delete', "productID=$productID&confirm=no"), $lang->delete, 'hiddenwin');?>
<?php if(common::hasPriv('tree', 'browse')) echo html::a($this->createLink('tree', 'browse', "rootID=$productID&view=story"), $lang->tree->manage);?>
</div>
</div>
</div>
</div>
</td>
</tr>
</table>
<script language='javascript'>
$('#module<?php echo $moduleID;?>').addClass('active')
$('#<?php echo $browseType;?>Tab').addClass('active')
+38 -46
View File
@@ -12,50 +12,42 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<script language='Javascript'>
function setWhite(acl)
{
acl == 'custom' ? $('#whitelistBox').removeClass('hidden') : $('#whitelistBox').addClass('hidden');
}
</script>
<div class='yui-d0'>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $lang->product->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->product->name;?></th>
<td><?php echo html::input('name', '', "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', '', "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->PO;?></th>
<td><?php echo html::select('PO', $users, $this->app->user->account, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->QM;?></th>
<td><?php echo html::select('QM', $users, $this->app->user->account, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->RM;?></th>
<td><?php echo html::select('RM', $users, $this->app->user->account, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->desc;?></th>
<td><?php echo html::textarea('desc', '', "rows='8' class='area-1'");?></textarea></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->acl;?></th>
<td><?php echo nl2br(html::radio('acl', $lang->product->aclList, 'open', "onclick='setWhite(this.value);'"));?></td>
</tr>
<tr id='whitelistBox' class='hidden'>
<th class='rowhead'><?php echo $lang->product->whitelist;?></th>
<td><?php echo html::checkbox('whitelist', $groups);?></td>
</tr>
<tr><td colspan='2' class='a-center'><?php echo html::submitButton();?></td></tr>
</table>
</form>
</div>
<form method='post' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $lang->product->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->product->name;?></th>
<td><?php echo html::input('name', '', "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', '', "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->PO;?></th>
<td><?php echo html::select('PO', $users, $this->app->user->account, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->QM;?></th>
<td><?php echo html::select('QM', $users, $this->app->user->account, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->RM;?></th>
<td><?php echo html::select('RM', $users, $this->app->user->account, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->desc;?></th>
<td><?php echo html::textarea('desc', '', "rows='8' class='area-1'");?></textarea></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->acl;?></th>
<td><?php echo nl2br(html::radio('acl', $lang->product->aclList, 'open', "onclick='setWhite(this.value);'"));?></td>
</tr>
<tr id='whitelistBox' class='hidden'>
<th class='rowhead'><?php echo $lang->product->whitelist;?></th>
<td><?php echo html::checkbox('whitelist', $groups);?></td>
</tr>
<tr><td colspan='2' class='a-center'><?php echo html::submitButton();?></td></tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>
+42 -50
View File
@@ -12,54 +12,46 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<script language='Javascript'>
function setWhite(acl)
{
acl == 'custom' ? $('#whitelistBox').removeClass('hidden') : $('#whitelistBox').addClass('hidden');
}
</script>
<div class='yui-d0'>
<form method='post' target='hiddenwin'>
<table align='center' class='table-1'>
<caption><?php echo $lang->product->edit;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->product->name;?></th>
<td><?php echo html::input('name', $product->name, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', $product->code, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->PO;?></th>
<td><?php echo html::select('PO', $users, $product->PO, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->QM;?></th>
<td><?php echo html::select('QM', $users, $product->QM, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->RM;?></th>
<td><?php echo html::select('RM', $users, $product->RM, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->status;?></th>
<td><?php echo html::select('status', $lang->product->statusList, $product->status, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->desc;?></th>
<td><?php echo html::textarea('desc', htmlspecialchars($product->desc), "rows='8' class='area-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->acl;?></th>
<td><?php echo nl2br(html::radio('acl', $lang->product->aclList, $product->acl, "onclick='setWhite(this.value);'"));?></td>
</tr>
<tr id='whitelistBox' <?php if($product->acl != 'custom') echo "class='hidden'";?>>
<th class='rowhead'><?php echo $lang->product->whitelist;?></th>
<td><?php echo html::checkbox('whitelist', $groups, $product->whitelist);?></td>
</tr>
<tr><td colspan='2' class='a-center'><?php echo html::submitButton();?></td></tr>
</table>
</form>
</div>
<form method='post' target='hiddenwin'>
<table align='center' class='table-1'>
<caption><?php echo $lang->product->edit;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->product->name;?></th>
<td><?php echo html::input('name', $product->name, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->code;?></th>
<td><?php echo html::input('code', $product->code, "class='text-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->PO;?></th>
<td><?php echo html::select('PO', $users, $product->PO, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->QM;?></th>
<td><?php echo html::select('QM', $users, $product->QM, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->RM;?></th>
<td><?php echo html::select('RM', $users, $product->RM, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->status;?></th>
<td><?php echo html::select('status', $lang->product->statusList, $product->status, "class='select-3'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->desc;?></th>
<td><?php echo html::textarea('desc', htmlspecialchars($product->desc), "rows='8' class='area-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->acl;?></th>
<td><?php echo nl2br(html::radio('acl', $lang->product->aclList, $product->acl, "onclick='setWhite(this.value);'"));?></td>
</tr>
<tr id='whitelistBox' <?php if($product->acl != 'custom') echo "class='hidden'";?>>
<th class='rowhead'><?php echo $lang->product->whitelist;?></th>
<td><?php echo html::checkbox('whitelist', $groups, $product->whitelist);?></td>
</tr>
<tr><td colspan='2' class='a-center'><?php echo html::submitButton();?></td></tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>
+35 -37
View File
@@ -11,41 +11,39 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<div class='yui-d0'>
<table class='table-6' align='center'>
<caption><?php echo $lang->product->roadmap;?></caption>
<?php
$years = array_keys($roadmaps);
echo '<tr class="f-16px">';
foreach($years as $year)
{
$year = $year == '0000' ? $lang->feature : $year . $lang->year;
echo "<th>$year</th>";
}
echo '</tr>';
echo '<tr valign="top">';
foreach($years as $year)
{
echo '<td class="a-center">';
foreach($roadmaps[$year] as $key => $roadmap)
{
if(isset($roadmap->build))
{
echo "<div class='roadmap release'>";
echo "<p class='f-16px'>" . html::a($this->createLink('release', 'view', "releaseID=$roadmap->id"), $roadmap->name, '_blank') . '</p>' . $roadmap->date;
}
else
{
echo "<div class='roadmap plan'>";
echo "<p class='f-16px'>" . html::a($this->createLink('productplan', 'view', "planID=$roadmap->id"), $roadmap->title, '_blank') . '</p>' . $roadmap->begin . ' ~ ' . $roadmap->end;
}
echo "</div>";
if(isset($roadmaps[$year][$key + 1])) echo "<span class='f-16px'>{$lang->downArrow}</span>";
}
echo '</td>';
}
echo '</tr>';
?>
</table>
</div>
<table class='table-6' align='center'>
<caption><?php echo $lang->product->roadmap;?></caption>
<?php
$years = array_keys($roadmaps);
echo '<tr class="f-16px">';
foreach($years as $year)
{
$year = $year == '0000' ? $lang->feature : $year . $lang->year;
echo "<th>$year</th>";
}
echo '</tr>';
echo '<tr valign="top">';
foreach($years as $year)
{
echo '<td class="a-center">';
foreach($roadmaps[$year] as $key => $roadmap)
{
if(isset($roadmap->build))
{
echo "<div class='roadmap release'>";
echo "<p class='f-16px'>" . html::a($this->createLink('release', 'view', "releaseID=$roadmap->id"), $roadmap->name, '_blank') . '</p>' . $roadmap->date;
}
else
{
echo "<div class='roadmap plan'>";
echo "<p class='f-16px'>" . html::a($this->createLink('productplan', 'view', "planID=$roadmap->id"), $roadmap->title, '_blank') . '</p>' . $roadmap->begin . ' ~ ' . $roadmap->end;
}
echo "</div>";
if(isset($roadmaps[$year][$key + 1])) echo "<span class='f-16px'>{$lang->downArrow}</span>";
}
echo '</td>';
}
echo '</tr>';
?>
</table>
<?php include '../../common/view/footer.html.php';?>
+56 -58
View File
@@ -11,62 +11,60 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<div class='yui-d0'>
<table align='center' class='table-1'>
<caption><?php echo $lang->product->view;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->product->name;?></th>
<td <?php if($product->deleted) echo "class='deleted'";?>><?php echo $product->name;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->code;?></th>
<td><?php echo $product->code;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->PO;?></th>
<td><?php echo $users[$product->PO];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->QM;?></th>
<td><?php echo $users[$product->QM];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->RM;?></th>
<td><?php echo $users[$product->RM];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->status;?></th>
<td><?php echo $lang->product->statusList[$product->status];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->desc;?></th>
<td class='content'><?php echo $product->desc;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->acl;?></th>
<td><?php echo $lang->product->aclList[$product->acl];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->whitelist;?></th>
<td>
<?php
$whitelist = explode(',', $product->whitelist);
foreach($whitelist as $groupID) if(isset($groups[$groupID])) echo $groups[$groupID] . '&nbsp;';
?>
</td>
</tr>
</table>
<div class='a-center f-16px strong'>
<?php
$browseLink = $this->session->productList ? $this->session->productList : inlink('browse', "productID=$product->id");
if(!$product->deleted)
{
common::printLink('product', 'edit', "productID=$product->id", $lang->edit);
common::printLink('product', 'delete', "productID=$product->id", $lang->delete, 'hiddenwin');
}
echo html::a($browseLink, $lang->goback);
?>
</div>
<?php include '../../common/view/action.html.php';?>
</div>
<table align='center' class='table-1'>
<caption><?php echo $lang->product->view;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->product->name;?></th>
<td <?php if($product->deleted) echo "class='deleted'";?>><?php echo $product->name;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->code;?></th>
<td><?php echo $product->code;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->PO;?></th>
<td><?php echo $users[$product->PO];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->QM;?></th>
<td><?php echo $users[$product->QM];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->RM;?></th>
<td><?php echo $users[$product->RM];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->status;?></th>
<td><?php echo $lang->product->statusList[$product->status];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->desc;?></th>
<td class='content'><?php echo $product->desc;?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->acl;?></th>
<td><?php echo $lang->product->aclList[$product->acl];?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->product->whitelist;?></th>
<td>
<?php
$whitelist = explode(',', $product->whitelist);
foreach($whitelist as $groupID) if(isset($groups[$groupID])) echo $groups[$groupID] . '&nbsp;';
?>
</td>
</tr>
</table>
<div class='a-center f-16px strong'>
<?php
$browseLink = $this->session->productList ? $this->session->productList : inlink('browse', "productID=$product->id");
if(!$product->deleted)
{
common::printLink('product', 'edit', "productID=$product->id", $lang->edit);
common::printLink('product', 'delete', "productID=$product->id", $lang->delete, 'hiddenwin');
}
echo html::a($browseLink, $lang->goback);
?>
</div>
<?php include '../../common/view/action.html.php';?>
<?php include '../../common/view/footer.html.php';?>