* Adjust story sort default to desc

This commit is contained in:
zenggang
2022-05-24 09:10:28 +00:00
parent 2bbae04ded
commit 7d5615ffac
7 changed files with 10 additions and 9 deletions
+2 -1
View File
@@ -679,7 +679,7 @@ class execution extends control
* @access public
* @return void
*/
public function story($executionID = 0, $orderBy = 'order_asc', $type = 'all', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1)
public function story($executionID = 0, $orderBy = 'order_desc', $type = 'all', $param = 0, $recTotal = 0, $recPerPage = 50, $pageID = 1)
{
/* Load these models. */
$this->loadModel('story');
@@ -3295,6 +3295,7 @@ class execution extends control
$orderBy = $this->post->orderBy;
$order = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('story')->in($idList)->andWhere('project')->eq($executionID)->orderBy('order_asc')->fetch('order');
if(strpos($orderBy, 'order_desc') !== false) $idList = array_reverse($idList);
foreach($idList as $storyID)
{
$this->dao->update(TABLE_PROJECTSTORY)->set('`order`')->eq($order)->where('story')->eq($storyID)->andWhere('project')->eq($executionID)->exec();
+1 -1
View File
@@ -9,7 +9,7 @@ $(function()
var $target = $(data.element[0]);
$target.hide();
$target.fadeIn(1000);
order = 'order_asc'
order = 'order_desc'
history.pushState({}, 0, createLink('execution', 'story', "executionID=" + executionID + '&orderBy=' + order));
});
});
+2 -2
View File
@@ -46,8 +46,8 @@
<?php
if(common::hasPriv('execution', 'story'))
{
echo html::a($this->createLink('execution', 'story', "executionID=$execution->id&orderBy=order_asc&type=all"), "<span class='text'>{$lang->story->allStories}</span>" . ($type == 'all' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>" : ''), '', "class='btn btn-link" . ($type == 'all' ? " btn-active-text" : '') . "'");
echo html::a($this->createLink('execution', 'story', "executionID=$execution->id&orderBy=order_asc&type=unclosed"), "<span class='text'>{$lang->story->unclosed}</span>" . ($type == 'unclosed' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>" : ''), '', "class='btn btn-link" . ($type == 'unclosed' ? " btn-active-text" : '') . "'");
echo html::a($this->createLink('execution', 'story', "executionID=$execution->id&orderBy=order_desc&type=all"), "<span class='text'>{$lang->story->allStories}</span>" . ($type == 'all' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>" : ''), '', "class='btn btn-link" . ($type == 'all' ? " btn-active-text" : '') . "'");
echo html::a($this->createLink('execution', 'story', "executionID=$execution->id&orderBy=order_desc&type=unclosed"), "<span class='text'>{$lang->story->unclosed}</span>" . ($type == 'unclosed' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>" : ''), '', "class='btn btn-link" . ($type == 'unclosed' ? " btn-active-text" : '') . "'");
}
if(common::hasPriv('execution', 'storykanban')) echo html::a($this->createLink('execution', 'storykanban', "executionID=$execution->id"), "<span class='text'>{$lang->execution->kanban}</span>", '', "class='btn btn-link'");
?>
+2 -2
View File
@@ -375,7 +375,7 @@ class productplan extends control
* @access public
* @return void
*/
public function view($planID = 0, $type = 'story', $orderBy = 'order_asc', $link = 'false', $param = '', $recTotal = 0, $recPerPage = 100, $pageID = 1)
public function view($planID = 0, $type = 'story', $orderBy = 'order_desc', $link = 'false', $param = '', $recTotal = 0, $recPerPage = 100, $pageID = 1)
{
$planID = (int)$planID;
$plan = $this->productplan->getByID($planID, true);
@@ -610,7 +610,7 @@ class productplan extends control
* @access public
* @return void
*/
public function linkStory($planID = 0, $browseType = '', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 100, $pageID = 1)
public function linkStory($planID = 0, $browseType = '', $param = 0, $orderBy = 'order_desc', $recTotal = 0, $recPerPage = 100, $pageID = 1)
{
if(!empty($_POST['stories']))
{
+1 -1
View File
@@ -80,7 +80,7 @@ $(function()
var $target = $(data.element[0]);
$target.hide();
$target.fadeIn(1000);
order = 'order_asc';
order = 'order_desc';
history.pushState({}, 0, createLink('productplan', 'view', "planID=" + planID + '&type=story&orderBy=' + order));
});
});
+1 -1
View File
@@ -206,7 +206,7 @@ class story extends control
setcookie('storyModuleParam', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, true);
$execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch();
$moduleName = $execution->type == 'project' ? 'projectstory' : 'execution';
$param = $execution->type == 'project' ? "projectID=$objectID&productID=$productID" : "executionID=$objectID&orderBy=id_desc&browseType=unclosed";
$param = $execution->type == 'project' ? "projectID=$objectID&productID=$productID" : "executionID=$objectID&orderBy=order_desc&browseType=unclosed";
$response['locate'] = $this->createLink($moduleName, 'story', $param);
}
if($this->app->getViewType() == 'xhtml') $response['locate'] = $this->createLink('story', 'view', "storyID=$storyID", 'html');
+1 -1
View File
@@ -4885,7 +4885,7 @@ class storyModel extends model
/* Merge to get a new sort list. */
$newSortIDList = array_merge($frontStoryIDList, $sortIDList, $behindStoryIDList);
if(strpos($orderBy, 'order_desc')) array_reverse($newSortIDList);
if(strpos($orderBy, 'order_desc') !== false) $newSortIDList = array_reverse($newSortIDList);
/* Loop update the story order of plan. */
$order = 1;