* rewrite the ui.

* splite the css and js.
This commit is contained in:
wangchunsheng
2011-02-24 14:02:01 +00:00
parent 5812a7e6d7
commit 9cdde4065e
4 changed files with 129 additions and 333 deletions
+1
View File
@@ -199,6 +199,7 @@ class bug extends control
$this->view->productName = $this->products[$productID];
$this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink'));
$this->view->browseType = $browseType;
$this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden';
$this->view->bugs = $bugs;
$this->view->users = $users;
$this->view->pager = $pager;
+5 -16
View File
@@ -1,8 +1,6 @@
<div class='yui-d0 <?php if($browseType == 'bymodule') echo 'yui-t1';?>' id='mainbox'>
<table class='table-1 bd-none'>
<table class='cont-lt1'>
<tr valign='top'>
<td class='bd-none <?php if($browseType != 'bymodule') echo 'hidden';?>' id='treebox'>
<td class='side <?php echo $treeClass;?>' id='treebox'>
<nobr>
<div class='box-title'><?php echo $productName;?></div>
<div class='box-content'>
@@ -13,7 +11,8 @@
</div>
</nobr>
</td>
<td class='bd-none'>
<td class='divider'></td>
<td>
<?php $vars = "productID=$productID&browseType=$browseType&param=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<table class='table-1 colored tablesorter datatable'>
<thead>
@@ -69,14 +68,4 @@
</td>
</tr>
</table>
<script language='javascript'>
$("#<?php echo $browseType;?>Tab").addClass('active');
$("#module<?php echo $moduleID;?>").addClass('active');
if($.browser.msie && Math.floor(parseInt($.browser.version)) == 6)
{
$("#browsecss").attr('href', '');
}
</script>
<iframe frameborder='0' name='hiddenwin' class='<?php $config->debug ? print("debugwin") : print('hiddenwin')?>'></iframe>
</body>
</html>
<?php include '../../common/view/footer.lite.html.php';?>
+42 -70
View File
@@ -15,65 +15,52 @@
<?php include '../../common/view/colorize.html.php';?>
<?php include '../../common/view/table2csv.html.php';?>
<script language='Javascript'>
/* Browse by module. */
function browseByModule(active)
{
$('#mainbox').addClass('yui-t1');
$('#treebox').removeClass('hidden');
$('#bymoduleTab').addClass('active');
$('#querybox').addClass('hidden');
$('#' + active + 'Tab').removeClass('active');
}
/* Search bugs. */
function browseBySearch(active)
{
$('#mainbox').removeClass('yui-t1');
$('#treebox').addClass('hidden');
$('#querybox').removeClass('hidden');
$('#bymoduleTab').removeClass('active');
$('#' + active + 'Tab').removeClass('active');
$('#bysearchTab').addClass('active');
}
$(document).ready(function()
{
$("a.iframe").colorbox({width:640, height:420, iframe:true, transition:'none'});
});
var browseType = '<?php echo $browseType;?>';
var moduleID = '<?php echo $moduleID;?>';
var customed = <?php echo (int)$customed;?>;
</script>
<div class='yui-d0'>
<div id='featurebar'>
<div class='f-left'>
<?php
echo "<span id='bymoduleTab' onclick=\"browseByModule('$browseType')\"><a href='#'>" . $lang->bug->moduleBugs . "</a></span> ";
echo "<span id='assigntomeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=assignToMe&param=0"), $lang->bug->assignToMe) . "</span>";
echo "<span id='openedbymeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=openedByMe&param=0"), $lang->bug->openedByMe) . "</span>";
echo "<span id='resolvedbymeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=resolvedByMe&param=0"), $lang->bug->resolvedByMe) . "</span>";
echo "<span id='assigntonullTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=assignToNull&param=0"), $lang->bug->assignToNull) . "</span>";
echo "<span id='unresolvedTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=unResolved&param=0"), $lang->bug->unResolved) . "</span>";
echo "<span id='longlifebugsTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=longLifeBugs&param=0"), $lang->bug->longLifeBugs) . "</span>";
echo "<span id='postponedbugsTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=postponedBugs&param=0"), $lang->bug->postponedBugs) . "</span>";
echo "<span id='allTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=all&param=0&orderBy=$orderBy&recTotal=0&recPerPage=200"), $lang->bug->allBugs) . "</span>";
echo "<span id='needconfirmTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=needconfirm&param=0"), $lang->bug->needConfirm) . "</span>";
echo "<span id='bysearchTab' onclick=\"browseBySearch('$browseType')\"><a href='#'>{$lang->bug->byQuery}</a></span> ";
?>
</div>
<div class='f-right'>
<?php common::printLink('bug', 'customFields', '', $lang->bug->customFields, '', "class='iframe'"); ?>
<?php echo html::export2csv($lang->exportCSV, $lang->setFileName);?>
<?php common::printLink('bug', 'report', "productID=$productID&browseType=$browseType&moduleID=$moduleID", $lang->bug->report->common); ?>
<?php common::printLink('bug', 'create', "productID=$productID&extra=moduleID=$moduleID", $lang->bug->create); ?>
</div>
<div id='featurebar'>
<div class='f-left'>
<?php
echo "<span id='bymoduleTab' onclick=\"browseByModule('$browseType')\"><a href='#'>" . $lang->bug->moduleBugs . "</a></span> ";
echo "<span id='assigntomeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=assignToMe&param=0"), $lang->bug->assignToMe) . "</span>";
echo "<span id='openedbymeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=openedByMe&param=0"), $lang->bug->openedByMe) . "</span>";
echo "<span id='resolvedbymeTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=resolvedByMe&param=0"), $lang->bug->resolvedByMe) . "</span>";
echo "<span id='assigntonullTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=assignToNull&param=0"), $lang->bug->assignToNull) . "</span>";
echo "<span id='unresolvedTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=unResolved&param=0"), $lang->bug->unResolved) . "</span>";
echo "<span id='longlifebugsTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=longLifeBugs&param=0"), $lang->bug->longLifeBugs) . "</span>";
echo "<span id='postponedbugsTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=postponedBugs&param=0"), $lang->bug->postponedBugs) . "</span>";
echo "<span id='allTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=all&param=0&orderBy=$orderBy&recTotal=0&recPerPage=200"), $lang->bug->allBugs) . "</span>";
echo "<span id='needconfirmTab'>" . html::a($this->createLink('bug', 'browse', "productid=$productID&browseType=needconfirm&param=0"), $lang->bug->needConfirm) . "</span>";
echo "<span id='bysearchTab' onclick=\"browseBySearch('$browseType')\"><a href='#'>{$lang->bug->byQuery}</a></span> ";
?>
</div>
<div class='f-right'>
<?php common::printLink('bug', 'customFields', '', $lang->bug->customFields, '', "class='iframe'"); ?>
<?php echo html::export2csv($lang->exportCSV, $lang->setFileName);?>
<?php common::printLink('bug', 'report', "productID=$productID&browseType=$browseType&moduleID=$moduleID", $lang->bug->report->common); ?>
<?php common::printLink('bug', 'create', "productID=$productID&extra=moduleID=$moduleID", $lang->bug->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>
<?php if($customed){include 'browse.custom.html.php'; exit;}?>
<div class='yui-d0 <?php if($browseType == 'bymodule') echo 'yui-t1';?>' id='mainbox'>
<div class="yui-main">
<div class="yui-b">
<?php $vars = "productID=$productID&browseType=$browseType&param=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<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('tree', 'browse')) echo html::a($this->createLink('tree', 'browse', "productID=$productID&view=bug"), $lang->tree->manage);?>
</div>
</div>
</td>
<td class='divider <?php echo $treeClass;?>'></td>
<td>
<?php $vars = "productID=$productID&browseType=$browseType&param=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; ?>
<table class='table-1 fixed colored tablesorter datatable'>
<thead>
<tr class='colhead'>
@@ -123,22 +110,7 @@ $(document).ready(function()
</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('tree', 'browse')) echo html::a($this->createLink('tree', 'browse', "productID=$productID&view=bug"), $lang->tree->manage);?>
</div>
</div>
</div>
</div>
<script language='javascript'>
$("#<?php echo $browseType;?>Tab").addClass('active');
$("#module<?php echo $moduleID;?>").addClass('active');
</script>
</td>
</tr>
</table>
<?php include '../../common/view/footer.html.php';?>
+81 -247
View File
@@ -14,251 +14,85 @@
<?php include '../../common/view/autocomplete.html.php';?>
<?php include '../../common/view/alert.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<style>
#project, #product {width:200px}
#module, #task {width:400px}
#severity, #browser {width:113px}
#story{width:605px}
#steps{width:100%}
.text-1 {width: 85%}
</style>
<script language='Javascript'>
/**
* Load all fields.
*
* @param int $productID
* @access public
* @return void
*/
function loadAll(productID)
{
$('#taskIdBox').get(0).innerHTML = '<select id="task"></select>'; // Reset the task.
loadModuleMenu(productID);
loadProductStories(productID);
loadProductProjects(productID);
loadProductBuilds(productID);
setAssignedTo();
}
/**
* Load module menu.
*
* @param int $productID
* @access public
* @return void
*/
function loadModuleMenu(productID)
{
link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug');
$('#moduleIdBox').load(link);
}
/**
* Load product stories
*
* @param int $productID
* @access public
* @return void
*/
function loadProductStories(productID)
{
link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID);
$('#storyIdBox').load(link);
}
/**
* Load projects of product.
*
* @param int $productID
* @access public
* @return void
*/
function loadProductProjects(productID)
{
link = createLink('product', 'ajaxGetProjects', 'productID=' + productID);
$('#projectIdBox').load(link);
}
/**
* Load product builds.
*
* @param int $productID
* @access public
* @return void
*/
function loadProductBuilds(productID)
{
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild');
$('#buildBox').load(link);
}
/**
* Load project related bugs and tasks.
*
* @param int $projectID
* @access public
* @return void
*/
function loadProjectRelated(projectID)
{
if(projectID)
{
loadProjectTasks(projectID);
loadProjectStories(projectID);
loadProjectBuilds(projectID);
}
else
{
$('#taskIdBox').get(0).innerHTML = '';
loadProductStories($('#product').get(0).value);
loadProductBuilds($('#product').get(0).value);
}
}
/**
* Load project tasks.
*
* @param int $projectID
* @access public
* @return void
*/
function loadProjectTasks(projectID)
{
link = createLink('task', 'ajaxGetProjectTasks', 'projectID=' + projectID);
$('#taskIdBox').load(link);
}
/**
* Load project stories.
*
* @param int $projectID
* @access public
* @return void
*/
function loadProjectStories(projectID)
{
productID = $('#product').get(0).value;
link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + productID);
$('#storyIdBox').load(link);
}
/**
* Set the assignedTo field.
*
* @access public
* @return void
*/
function setAssignedTo()
{
link = createLink('bug', 'ajaxGetModuleOwner', 'moduleID=' + $('#module').val() + '&productID=' + $('#product').val());
$.get(link, function(owner)
{
$('#assignedTo').val(owner);
});
}
/**
* Load project builds.
*
* @param int $projectID
* @access public
* @return void
*/
function loadProjectBuilds(projectID)
{
link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&varName=openedBuild');
$('#buildBox').load(link);
}
var userList = "<?php echo join(',', array_keys($users));?>".split(',');
$(function() {
$("#mailto").autocomplete(userList, { multiple: true, mustMatch: true});
setAssignedTo();
})
</script>
<div class='yui-d0'>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $lang->bug->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblProductAndModule;?></th>
<td>
<?php echo html::select('product', $products, $productID, "onchange='loadAll(this.value)' class='select-2'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $moduleID, "onchange='setAssignedTo()' class='select-3'");?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblProjectAndTask;?></th>
<td>
<span id='projectIdBox'><?php echo html::select('project', $projects, $projectID, 'onchange=loadProjectRelated(this.value)');?></span>
<span id='taskIdBox'><?php echo html::select('task', $tasks, $taskID);?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblStory;?></th>
<td>
<span id='storyIdBox'><?php echo html::select('story', $stories, $storyID);?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->openedBuild;?></th>
<td>
<span id='buildBox'><?php echo html::select('openedBuild[]', $builds, $buildID, 'size=3 multiple=multiple class=select-3');?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblTypeAndSeverity;?></th>
<td>
<?php echo html::select('type', $lang->bug->typeList, 'codeerror', 'class=select-2');?>
<?php echo html::select('severity', $lang->bug->severityList, '', 'class=select-2');?>
</td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->lblSystemBrowserAndHardware;?></nobr></th>
<td>
<?php echo html::select('os', $lang->bug->osList, $os, 'class=select-2');?>
<?php echo html::select('browser', $lang->bug->browserList, $browser, 'class=select-2');?>
</td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->lblAssignedTo;?></nobr></th>
<td> <?php echo html::select('assignedTo', $users, $assignedTo, 'class=select-3');?></td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->lblMailto;?></nobr></th>
<td> <?php echo html::input('mailto', $mailto, 'class=text-1');?> </td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->title;?></th>
<td><?php echo html::input('title', $title, "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->steps;?></th>
<td>
<table class='w-p100 bd-none'>
<tr class='bd-none' valign='top'>
<td class='w-p85 bd-none padding-zero'><?php echo html::textarea('steps', $steps, "rows='10'");?></td>
<td class='bd-none pl-10px' id='tplBox'><?php echo $this->fetch('bug', 'buildTemplates');?></td>
</tr>
</table>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->keywords;?></th>
<td><?php echo html::input('keywords', $keywords, "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->files;?></th>
<td><?php echo $this->fetch('file', 'buildform', 'fileCount=2&percent=0.85');?></td>
</tr>
<tr>
<td colspan='2' class='a-center'>
<?php echo html::submitButton() . html::resetButton() . html::hidden('case', $caseID);?>
</td>
</tr>
</table>
</form>
</div>
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
<table class='table-1'>
<caption><?php echo $lang->bug->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblProductAndModule;?></th>
<td>
<?php echo html::select('product', $products, $productID, "onchange='loadAll(this.value)' class='select-2'");?>
<span id='moduleIdBox'><?php echo html::select('module', $moduleOptionMenu, $moduleID, "onchange='setAssignedTo()' class='select-3'");?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblProjectAndTask;?></th>
<td>
<span id='projectIdBox'><?php echo html::select('project', $projects, $projectID, 'onchange=loadProjectRelated(this.value)');?></span>
<span id='taskIdBox'><?php echo html::select('task', $tasks, $taskID);?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblStory;?></th>
<td>
<span id='storyIdBox'><?php echo html::select('story', $stories, $storyID);?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->openedBuild;?></th>
<td>
<span id='buildBox'><?php echo html::select('openedBuild[]', $builds, $buildID, 'size=3 multiple=multiple class=select-3');?></span>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->lblTypeAndSeverity;?></th>
<td>
<?php echo html::select('type', $lang->bug->typeList, 'codeerror', 'class=select-2');?>
<?php echo html::select('severity', $lang->bug->severityList, '', 'class=select-2');?>
</td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->lblSystemBrowserAndHardware;?></nobr></th>
<td>
<?php echo html::select('os', $lang->bug->osList, $os, 'class=select-2');?>
<?php echo html::select('browser', $lang->bug->browserList, $browser, 'class=select-2');?>
</td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->lblAssignedTo;?></nobr></th>
<td> <?php echo html::select('assignedTo', $users, $assignedTo, 'class=select-3');?></td>
</tr>
<tr>
<th class='rowhead'><nobr><?php echo $lang->bug->lblMailto;?></nobr></th>
<td> <?php echo html::input('mailto', $mailto, 'class=text-1');?> </td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->title;?></th>
<td><?php echo html::input('title', $title, "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->steps;?></th>
<td>
<table class='w-p100 bd-none'>
<tr class='bd-none' valign='top'>
<td class='w-p85 bd-none padding-zero'><?php echo html::textarea('steps', $steps, "rows='10'");?></td>
<td class='bd-none pl-10px' id='tplBox'><?php echo $this->fetch('bug', 'buildTemplates');?></td>
</tr>
</table>
</td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->keywords;?></th>
<td><?php echo html::input('keywords', $keywords, "class='text-1'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->bug->files;?></th>
<td><?php echo $this->fetch('file', 'buildform', 'fileCount=2&percent=0.85');?></td>
</tr>
<tr>
<td colspan='2' class='a-center'>
<?php echo html::submitButton() . html::resetButton() . html::hidden('case', $caseID);?>
</td>
</tr>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>