* finish task#1513.

This commit is contained in:
chencongzhi520@gmail.com
2013-07-13 08:28:14 +00:00
parent 4f061e273f
commit d8c016a22e
5 changed files with 267 additions and 20 deletions
+9 -2
View File
@@ -465,10 +465,17 @@ class product extends control
* @access public
* @return void
*/
public function ajaxGetPlans($productID, $planID = 0)
public function ajaxGetPlans($productID, $planID = 0, $dropMenu = false)
{
$plans = $this->loadModel('productplan')->getPairs($productID);
die(html::select('plan', $plans, $planID));
if(!$dropMenu) die(html::select('plan', $plans, $planID));
echo "<ul>";
foreach($plans as $plan)
{
echo "<li><a>" . $plan . "</a></li>";
}
echo "</ul>";
}
/**
+108
View File
@@ -0,0 +1,108 @@
.listMenu
{
position:absolute;
background:#fff;
border: 1px solid rgba(0,0,0,0.2);
border-radius: 6px 6px 6px 6px;
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}
.listMenu ul
{
margin:5px 0px;
}
.listMenu ul li
{
padding:3px 0px;
height:20px;
font-size:14px;
list-style-type:none;
}
.listMenu ul li:hover
{
background:#1AA8D2;
cursor:pointer;
}
.listMenu ul li a
{
padding:0px 20px;
float:left;
clear: both;
color: #333333;
display: block;
font-weight: normal;
line-height: 20px;
white-space: nowrap;
}
.listMenu ul li a[id$='Item']:after
{
border-color: transparent transparent transparent #CCCCCC;
border-style: solid;
border-width: 5px 0 5px 5px;
content: " ";
display: block;
float: right;
height: 0;
margin-right: -10px;
margin-top: 5px;
width: 0;
}
.groupButton
{
display:inline-block;
}
.groupButton > input[type='button'], #allchecker, #reversechecker
{
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #F5F5F5;
background-image: linear-gradient(to bottom, #FFFFFF, #E6E6E6);
background-repeat: repeat-x;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) #B3B3B3;
border-image: none;
border-radius: 4px 4px 4px 4px;
border-style: solid;
border-width: 1px;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
color: #333333;
cursor: pointer;
display: inline-block;
font-size: 14px;
line-height: 20px;
margin-bottom: 0;
padding: 4px 12px;
margin-right:5px;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
}
.groupButton > input[type='button']
{
border-radius: 0px;
}
.groupButton > input[type='button']:first-child
{
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
margin-right: 0;
}
.groupButton > input[type='button'] + input[type='button']
{
box-shadow: 1px 0 0 rgba(255, 255, 255, 0.125) inset, 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05);
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
padding-left: 8px;
padding-right: 8px;
margin-left:-5px;
}
+66
View File
@@ -22,6 +22,72 @@ function changeAction(formName, actionName, actionLink)
$('#' + formName).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 = 'right', 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 - $('#' + currentMenu).height();
leftOffset = $('#' + rootID).offset().left + $('#' + rootID).width() + $('#' + currentMenu).width() + 30;
$('#' + currentID + 'Menu').css({top: topOffset, left:leftOffset});
}
}
$('#' + currentID + 'Menu').toggle();
}
function ajaxShowMenu(currentID, productID)
{
$.get(createLink('product', 'ajaxGetPlans', "productID=" + productID + "&plan=0&showMenu=true"), function(data){ $('#' + currentID + 'Menu').html(data);});
toggleSubMenu(currentID);
}
$(function()
{
if(browseType == 'bysearch') ajaxGetSearchForm();
+75 -18
View File
@@ -17,10 +17,6 @@
</tr>
</thead>
<tbody>
<?php
$canBatchEdit = common::hasPriv('story', 'batchEdit');
$canBatchClose = common::hasPriv('story', 'batchClose') and strtolower($browseType) != 'closedbyme' and strtolower($browseType) != 'closedstory';
?>
<?php foreach($stories as $key => $story):?>
<?php
$viewLink = $this->createLink('story', 'view', "storyID=$story->id");
@@ -28,9 +24,7 @@
?>
<tr class='a-center'>
<td>
<?php if($canBatchEdit or $canBatchClose):?>
<input type='checkbox' name='storyIDList[<?php echo $story->id;?>]' value='<?php echo $story->id;?>' />
<?php endif;?>
<?php if($canView) echo html::a($viewLink, sprintf('%03d', $story->id)); else printf('%03d', $story->id);?>
</td>
<td><span class='<?php echo 'pri' . $lang->story->priList[$story->pri];?>'><?php echo $lang->story->priList[$story->pri]?></span></td>
@@ -62,19 +56,18 @@
<?php
if(count($stories))
{
if($canBatchEdit or $canBatchClose) echo html::selectAll() . html::selectReverse();
if($canBatchEdit)
{
$actionLink = $this->createLink('story', 'batchEdit', "productID=$productID&projectID=0");
echo html::commonButton($lang->edit, "onclick=\"changeAction('productStoryForm', 'batchEdit', '$actionLink')\"");
}
if($canBatchClose)
{
$actionLink = $this->createLink('story', 'batchClose', "productID=$productID&projectID=0");
echo html::commonButton($lang->close, "onclick=\"changeAction('productStoryForm', 'batchClose', '$actionLink')\"");
}
echo html::selectAll() . html::selectReverse();
$canBatchEdit = common::hasPriv('story', 'batchEdit');
$disabled = $canBatchEdit ? '' : 'disabled';
$actionLink = $this->createLink('story', 'batchEdit', "productID=$productID&projectID=0");
echo "<div class='groupButton'>";
echo html::commonButton($lang->edit, "onclick=\"changeAction('productStoryForm', 'batchEdit', '$actionLink')\" $disabled");
echo html::commonButton($lang->more, "onclick=\"toggleSubMenu(this.id, 'top', 0)\" id='moreAction'");
echo "</div>";
}
echo $summary;
?>
</div>
@@ -83,3 +76,67 @@
</tr>
</tfoot>
</table>
<div id='moreActionMenu' class='listMenu hidden'>
<ul>
<?php
$canBatchClose = common::hasPriv('story', 'batchClose') and strtolower($browseType) != 'closedbyme' and strtolower($browseType) != 'closedstory';
$disabled = $canBatchClose ? '' : 'disabled';
$actionLink = $this->createLink('story', 'batchClose', "productID=$productID&projectID=0");
echo "<li>" . html::a('#', $lang->close, '', "onclick=\"changeAction('productStoryForm', 'batchClose', '$actionLink')\" $disabled") . "</li>";
echo "<li>" . html::a('#', $lang->story->review, '', "onmouseover='toggleSubMenu(this.id)' onmouseout='toggleSubMenu(this.id)' id='reviewItem'") . "</li>";
echo "<li>" . html::a('#', $lang->story->planAB, '', "onmouseover='ajaxShowMenu(this.id, $productID)' onmouseout='toggleSubMenu(this.id)' id='planItem'") . "</li>";
echo "<li>" . html::a('#', $lang->story->stageAB, '', "onmouseover='toggleSubMenu(this.id)' onmouseout='toggleSubMenu(this.id)' id='stageItem'") . "</li>";
?>
</ul>
</div>
<div id='reviewItemMenu' class='hidden listMenu'>
<ul>
<?php
unset($lang->story->reviewResultList['']);
unset($lang->story->reviewResultList['revert']);
foreach($lang->story->reviewResultList as $key => $result)
{
$actionLink = $this->createLink('story', 'batchReview', "result=$key");
echo "<li>";
if($key == 'reject')
{
echo html::a('#', $result, '', "onmouseover='toggleSubMenu(this.id, \"right\", 2)' id='rejectItem'");
}
else
{
echo html::a('#', $result, '', "onclick=\"changeAction('productStoryForm', 'batchReview', '$actionLink')\"");
}
echo "</li>";
}
?>
</ul>
</div>
<div id='rejectItemMenu' class='hidden listMenu'>
<ul>
<?php
foreach($lang->story->reasonList as $key => $reason)
{
$actionLink = $this->createLink('story', 'batchReview', "result=reject&reason=$key");
echo "<li>";
echo html::a('#', $reason, '', "onclick=\"changeAction('productStoryForm', 'batchReview', '$actionLink')\"");
echo "</li>";
}
?>
</ul>
</div>
<div id='planItemMenu' class='hidden listMenu'></div>
<div id='stageItemMenu' class='hidden listMenu'>
<ul>
<?php
foreach($lang->story->stageList as $key => $stage)
{
echo "<li><a href='#'>$stage</a></li>";
}
?>
</ul>
</div>
+9
View File
@@ -568,6 +568,15 @@ class story extends control
$this->display();
}
function batchReview($result, $reason = '')
{
$storyIDList = $this->post->storyIDList ? $this->post->storyIDList : die(js::locate($this->session->storyList, 'parent'));
foreach($storyIDList as $storyID)
{
// $this->story->review($storyID);
}
}
/**
* Close a story.
*