* code for task#1648.

* add dropmenu to common/view jquery/dropmenu.
This commit is contained in:
azhi
2013-08-02 10:13:49 +08:00
parent 42827590d1
commit 79dfd7851b
14 changed files with 92 additions and 80 deletions

View File

@@ -4,4 +4,3 @@
.confirm0 {color:gray; font-size:9px}
.confirm1 {color:green; font-size:9px}
tfoot .f-left {color:#141414;}
form {position:relative}

View File

@@ -57,8 +57,8 @@ js::set('customed', $customed);
}
?>
<form method='post' action='<?php echo inLink('batchEdit', "productID=$productID");?>'>
<div class='treeSlider'><span>&nbsp;</span></div>
<form method='post' action='<?php echo inLink('batchEdit', "productID=$productID");?>'>
<table class='cont-lt1'>
<tr valign='top'>
<td class='side <?php echo $treeClass;?>' id='treebox'>

View File

@@ -0,0 +1,8 @@
<?php if($extView = $this->getExtViewFile(__FILE__)){include $extView; return helper::cd();}?>
<?php
if($config->debug)
{
css::import($defaultTheme . 'dropmenu.css');
js::import($jsRoot . 'jquery/dropmenu/dropmenu.js');
}
?>

View File

@@ -22,68 +22,6 @@ function changeAction(actionLink, hiddenwin)
$('form').attr('action', actionLink).submit();
}
/**
* Toggle sub menu.
*
* @param string $currentID
* @param string position = 'right' | 'top'
* @param bool entry
* @access public
* @return void
*/
function toggleSubMenu(currentID, position, menuIndex)
{
if(typeof(position) == 'undefined') position = 'right';
if(typeof(menuIndex) == 'undefined') menuIndex = 1;
if(menuIndex)
{
currentMenu = $('#' + currentID).parent().parent().parent().attr('id');
$('#' + currentID + 'Menu').bind('mouseover', function()
{
$('#' + currentMenu).show();
return $('#' + currentID + 'Menu').show()
});
$('#' + currentID).parent().bind('mouseleave', function()
{
return $('#' + currentID + 'Menu').hide()
});
$('#' + currentID + 'Menu').bind('mouseleave', function()
{
return $('#' + currentID + 'Menu').hide()
});
}
var offset = $('#' + currentID).offset();
var topOffset = 0;
var leftOffset = 0;
if(position == 'top')
{
topOffset = offset.top - $('#' + currentID + 'Menu').height() + 'px';
leftOffset = offset.left;
$('#' + currentID + 'Menu').css({top: topOffset, left: leftOffset});
}
if(position == 'right')
{
if(menuIndex == 1)
{
topOffset = offset.top - $('#' + currentID + 'Menu').height() + $('#' + currentID).parent().height() + "px";
leftOffset = offset.left + $('#' + currentID).parent().width();
$('#' + currentID + 'Menu').css({top: topOffset, left: leftOffset});
}
else if(menuIndex == 2)
{
currentMenu = $('#' + currentID).parent().parent().parent().attr('id');
rootID = currentMenu.replace('Menu', '');
topOffset = $('#' + rootID).offset().top - $('#' + currentID + 'Menu').height() + 20;
leftOffset = $('#' + rootID).offset().left + $('#' + rootID).parent().width() + $('#' + currentMenu).width();
$('#' + currentID + 'Menu').css({top: topOffset, left:leftOffset});
}
}
$('#' + currentID + 'Menu').toggle();
}
$(function()
{
if(browseType == 'bysearch') ajaxGetSearchForm();

View File

@@ -13,6 +13,7 @@
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/treeview.html.php';?>
<?php include '../../common/view/colorize.html.php';?>
<?php include '../../common/view/dropmenu.html.php';?>
<script language='Javascript'>
var browseType = '<?php echo $browseType;?>';
</script>
@@ -39,8 +40,8 @@ var browseType = '<?php echo $browseType;?>';
</div>
<div id='querybox' class='<?php if($browseType !='bysearch') echo 'hidden';?>'></div>
<form method='post' id='productStoryForm'>
<div class='treeSlider'><span>&nbsp;</span></div>
<form method='post' id='productStoryForm'>
<table class='cont-lt1'>
<tr valign='top'>
<td class='side <?php echo $treeClass;?>' id='treebox'>

View File

@@ -3,4 +3,4 @@
#sidebar{position:absolute;left:15px;top:185px;width:20px;height:20px;cursor:pointer;background:url(theme/default/images/main/zt-icons.png) -81px -161px;}
#hideButton{cursor:pointer;}
#hideButton span{padding:2px 10px; background:url(theme/default/images/main/zt-icons.png) -100px -161px;}
form { position:relative }
#featurebar .f-right .icon-green-task-import {padding:2px 8px; background:url(theme/default/images/main/zt-icons.png) 0px -82px;}

View File

@@ -21,8 +21,8 @@
var browseType = '<?php echo $browseType;?>';
</script>
<div id='querybox' class='<?php if($browseType != 'bysearch') echo 'hidden';?>'></div>
<form method='post' id='projectTaskForm'>
<div class='treeSlider'><span>&nbsp;</span></div>
<form method='post' id='projectTaskForm'>
<table class='cont-lt2'>
<tr valign='top'>
<td class='side'>

View File

@@ -1,3 +1,4 @@
<?php include '../../common/view/dropmenu.html.php';?>
<div id='featurebar'>
<div class='f-left'>
<?php
@@ -22,9 +23,25 @@
if(!isset($orderBy)) $orderBy = '';
common::printIcon('task', 'report', "project=$projectID&browseType=$browseType");
if($browseType != 'needconfirm') common::printIcon('task', 'export', "projectID=$projectID&orderBy=$orderBy");
echo '<span class="link-button">';
echo html::a("#", "&nbsp;", '', "id='importAction' class='icon-green-task-import' onclick=toggleSubMenu(this.id,'bottom',0) title='{$lang->import}'");
echo html::a("#", $lang->import, '', "id='importAction' onclick=toggleSubMenu(this.id,'bottom',0) title='{$lang->import}'");
echo '</span>';
common::printIcon('task', 'batchCreate', "projectID=$projectID");
common::printIcon('task', 'create', "project=$projectID");
?>
</div>
</div>
<div id='importActionMenu' class='listMenu hidden'>
<ul>
<?php
echo "<li>" . html::a($this->createLink('project', 'importTask', "project=$project->id"), $lang->project->importTask) . "</li>";
echo "<li>" . html::a($this->createLink('project', 'importBug', "projectID=$project->id"), $lang->project->importBug) . "</li>";
?>
</ul>
</div>
<?php foreach(glob(dirname(dirname(__FILE__)) . "/ext/view/featurebar.*.html.hook.php") as $fileName) include_once $fileName; ?>

View File

@@ -17,15 +17,7 @@
<?php js::set('holders', $lang->task->placeholder);?>
<form method='post' enctype='multipart/form-data' id='dataform' class='ajaxForm'>
<table align='center' class='table-1 a-left'>
<caption>
<?php echo $lang->task->create;?>
<div class='f-right'>
<?php
common::printLink('project', 'importTask', "project=$project->id", $lang->project->importTask);
common::printLink('project', 'importBug', "projectID=$project->id", $lang->project->importBug);
?>
</div>
</caption>
<caption><?php echo $lang->task->create;?></caption>
<tr>
<th class='rowhead'><?php echo $lang->task->project;?></th>
<td><?php echo $project->name;?></td>

View File

@@ -1,3 +1,2 @@
.w-220px{width:220px}
#featurebar .f-right .icon-green-testcase-import {padding:2px 8px; background:url(theme/default/images/main/zt-icons.png) 0px -82px;}
form {position:relative}

View File

@@ -38,8 +38,8 @@ js::set('confirmDelete', $lang->testcase->confirmDelete);
</div>
</div>
<div id='querybox' class='<?php if($browseType != 'bysearch') echo 'hidden';?>'></div>
<form id='batchForm' method='post'>
<div class='treeSlider'><span>&nbsp;</span></div>
<form id='batchForm' method='post'>
<table class='cont-lt1'>
<tr valign='top'>
<td class='side <?php echo $treeClass;?>'>

59
www/js/jquery/dropmenu/dropmenu.js vendored Normal file
View File

@@ -0,0 +1,59 @@
function toggleSubMenu(currentID, position, menuIndex)
{
if(typeof(position) == 'undefined') position = 'right';
if(typeof(menuIndex) == 'undefined') menuIndex = 1;
if(menuIndex)
{
currentMenu = $('#' + currentID).parent().parent().parent().attr('id');
$('#' + currentID + 'Menu').bind('mouseover', function()
{
$('#' + currentMenu).show();
return $('#' + currentID + 'Menu').show()
});
$('#' + currentID).parent().bind('mouseleave', function()
{
return $('#' + currentID + 'Menu').hide()
});
$('#' + currentID + 'Menu').bind('mouseleave', function()
{
return $('#' + currentID + 'Menu').hide()
});
}
var offset = $('#' + currentID).offset();
var topOffset = 0;
var leftOffset = 0;
if(position == 'top')
{
topOffset = offset.top - $('#' + currentID + 'Menu').height() + 'px';
leftOffset = offset.left;
$('#' + currentID + 'Menu').css({top: topOffset, left: leftOffset});
}
if(position == 'right')
{
if(menuIndex == 1)
{
topOffset = offset.top - $('#' + currentID + 'Menu').height() + $('#' + currentID).parent().height() + "px";
leftOffset = offset.left + $('#' + currentID).parent().width();
$('#' + currentID + 'Menu').css({top: topOffset, left: leftOffset});
}
else if(menuIndex == 2)
{
currentMenu = $('#' + currentID).parent().parent().parent().attr('id');
rootID = currentMenu.replace('Menu', '');
topOffset = $('#' + rootID).offset().top - $('#' + currentID + 'Menu').height() + 20;
leftOffset = $('#' + rootID).offset().left + $('#' + rootID).parent().width() + $('#' + currentMenu).width();
$('#' + currentID + 'Menu').css({top: topOffset, left:leftOffset});
}
}
if(position == 'bottom')
{
topOffset = offset.top + $('#' + currentID).parent().outerHeight();
leftOffset = offset.left;
$('#' + currentID + 'Menu').css({top: topOffset, left: leftOffset});
}
$('#' + currentID + 'Menu').toggle();
}

View File

@@ -122,4 +122,3 @@
.groupButton input[disabled='disabled'] {background:#eee; color:#ccc}
.listMenu li a.disabled {color:#ccc}
form {position:relative}

View File

@@ -358,7 +358,7 @@ table.tablesorter thead tr .headerSortDown {background-image: url(./images/table
border-left:none;
cursor: pointer;
width: 8px;
left:-16px;
left: 16px;
border-radius:0px 10px 10px 0px
}
.treeSlider span {