Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
wangyidong
2017-12-18 10:02:39 +08:00
8 changed files with 431 additions and 351 deletions
+99 -85
View File
@@ -48,7 +48,7 @@ class commonModel extends model
/**
* Set the commpany.
*
* First, search company by the http host. If not found, search by the default domain. Last, use the first as the default.
* First, search company by the http host. If not found, search by the default domain. Last, use the first as the default.
* After get the company, save it to session.
* @access public
* @return void
@@ -72,7 +72,7 @@ class commonModel extends model
/**
* Set the user info.
*
*
* @access public
* @return void
*/
@@ -99,7 +99,7 @@ class commonModel extends model
/**
* Load configs from database and save it to config->system and config->personal.
*
*
* @access public
* @return void
*/
@@ -170,9 +170,9 @@ class commonModel extends model
/**
* Deny access.
*
*
* @access public
* @return void
* @return mixed
*/
public function deny($module, $method)
{
@@ -207,7 +207,7 @@ class commonModel extends model
/**
* Print the run info.
*
*
* @param mixed $startTime the start time.
* @access public
* @return array the run info array.
@@ -223,7 +223,7 @@ class commonModel extends model
/**
* Print top bar.
*
*
* @static
* @access public
* @return void
@@ -293,8 +293,9 @@ class commonModel extends model
/**
* Create menu item link
*
* @param object $menuItemLink
* @param boolean $isTutorialMode
* @param object $menuItem
*
* @static
* @access public
* @return string
*/
@@ -321,6 +322,8 @@ class commonModel extends model
* Print the main menu.
*
* @param string $moduleName
* @param string $methodName
*
* @static
* @access public
* @return void
@@ -383,14 +386,14 @@ class commonModel extends model
if($config->global->flow == 'onlyTask') $searchObject = 'task';
}
echo "<div class='input-group input-group-sm' id='searchbox'>";
echo "<div class='input-group input-group-sm' id='searchbox'>";
echo "<div class='input-group-btn' id='typeSelector'>";
echo "<button type='button' class='btn dropdown-toggle' data-toggle='dropdown'><span id='searchTypeName'>" . $lang->searchObjects[$searchObject] . "</span> <span class='caret'></span></button>";
echo html::hidden('searchType', $searchObject);
echo "<ul class='dropdown-menu'>";
foreach ($lang->searchObjects as $key => $value)
{
echo "<li><a href='javascript:;' data-value='{$key}'>{$value}</a></li>";
echo "<li><a href='javascript:;' data-value='{$key}'>{$value}</a></li>";
}
echo '</ul></div>';
echo html::input('searchQuery', '', "onclick='this.value=\"\"' onkeydown='if(event.keyCode==13) shortcut()' class='form-control' placeholder='" . $lang->searchTips . "'");
@@ -400,8 +403,8 @@ class commonModel extends model
/**
* Print the module menu.
*
* @param string $moduleName
*
* @param string $moduleName
* @static
* @access public
* @return void
@@ -470,9 +473,9 @@ class commonModel extends model
/**
* Print the bread menu.
*
* @param string $moduleName
* @param string $position
*
* @param string $moduleName
* @param string $position
* @static
* @access public
* @return void
@@ -504,7 +507,7 @@ class commonModel extends model
/**
* Print the link for notify file.
*
*
* @static
* @access public
* @return void
@@ -519,8 +522,10 @@ class commonModel extends model
}
/**
* Print QR code Link.
*
* Print QR code Link.
*
* @param string $color
*
* @static
* @access public
* @return void
@@ -537,16 +542,16 @@ class commonModel extends model
/**
* Print the link contains orderBy field.
*
* This method will auto set the orderby param according the params. Fox example, if the order by is desc,
* This method will auto set the orderby param according the params. Fox example, if the order by is desc,
* will be changed to asc.
*
*
* @param string $fieldName the field name to sort by
* @param string $orderBy the order by string
* @param string $vars the vars to be passed
* @param string $label the label of the link
* @param string $module the module name
* @param string $method the method name
* @static
*
* @access public
* @return void
*/
@@ -583,17 +588,21 @@ class commonModel extends model
}
/**
*
* Print link to an modules' methd.
*
* Before printing, check the privilege first. If no privilege, return fasle. Else, print the link, return true.
*
* @param string $module the module name
* @param string $method the method
* @param string $vars vars to be passed
* @param string $label the label of the link
* @param string $target the target of the link
* @param string $misc others
* @param bool $newline
* @param string $module the module name
* @param string $method the method
* @param string $vars vars to be passed
* @param string $label the label of the link
* @param string $target the target of the link
* @param string $misc others
* @param bool $newline
* @param bool $onlyBody
* @param $object
*
* @static
* @access public
* @return bool
@@ -607,7 +616,7 @@ class commonModel extends model
/**
* Print icon of split line.
*
*
* @static
* @access public
* @return void
@@ -619,11 +628,13 @@ class commonModel extends model
/**
* Print icon of comment.
*
* @param string $module
*
* @param string $module
* @param $object
*
* @static
* @access public
* @return void
* @return mixed
*/
public static function printCommentIcon($module, $object = null)
{
@@ -683,7 +694,7 @@ class commonModel extends model
$title = $method;
if($method == 'create' and $icon == 'copy') $method = 'copy';
if(isset($lang->$method) and is_string($lang->$method)) $title = $lang->$method;
if((isset($lang->$module->$method) or $app->loadLang($module)) and isset($lang->$module->$method))
if((isset($lang->$module->$method) or $app->loadLang($module)) and isset($lang->$module->$method))
{
$title = $method == 'report' ? $lang->$module->$method->common : $lang->$module->$method;
}
@@ -759,8 +770,11 @@ class commonModel extends model
/**
* Print backLink and preLink and nextLink.
*
* @param string $backLink
* @param object $preAndNext
* @param string $backLink
* @param object $preAndNext
* @param string $linkTemplate
*
* @static
* @access public
* @return void
*/
@@ -772,7 +786,7 @@ class commonModel extends model
$title = $lang->goback . $lang->backShortcutKey;
echo html::a($backLink, '<i class="icon-goback icon-level-up icon-large icon-rotate-270"></i>', '', "id='back' class='btn' title={$title}");
if(isset($preAndNext->pre) and $preAndNext->pre)
if(isset($preAndNext->pre) and $preAndNext->pre)
{
$id = (isset($_SESSION['testcaseOnlyCondition']) and !$_SESSION['testcaseOnlyCondition'] and $app->getModuleName() == 'testcase' and isset($preAndNext->pre->case)) ? 'case' : 'id';
$title = isset($preAndNext->pre->title) ? $preAndNext->pre->title : $preAndNext->pre->name;
@@ -780,7 +794,7 @@ class commonModel extends model
$link = $linkTemplate ? sprintf($linkTemplate, $preAndNext->pre->$id) : inLink('view', "ID={$preAndNext->pre->$id}");
echo html::a($link, '<i class="icon-pre icon-chevron-left"></i>', '', "id='pre' class='btn' title='{$title}'");
}
if(isset($preAndNext->next) and $preAndNext->next)
if(isset($preAndNext->next) and $preAndNext->next)
{
$id = (isset($_SESSION['testcaseOnlyCondition']) and !$_SESSION['testcaseOnlyCondition'] and $app->getModuleName() == 'testcase' and isset($preAndNext->next->case)) ? 'case' : 'id';
$title = isset($preAndNext->next->title) ? $preAndNext->next->title : $preAndNext->next->name;
@@ -792,7 +806,7 @@ class commonModel extends model
/**
* Create changes of one object.
*
*
* @param mixed $old the old object
* @param mixed $new the new object
* @static
@@ -818,10 +832,10 @@ class commonModel extends model
if($magicQuote) $value = stripslashes($value);
if(isset($old->$key) and $value != stripslashes($old->$key))
{
{
$diff = '';
if(substr_count($value, "\n") > 1 or
substr_count($old->$key, "\n") > 1 or
if(substr_count($value, "\n") > 1 or
substr_count($old->$key, "\n") > 1 or
strpos('name,title,desc,spec,steps,content,digest,verify,report', strtolower($key)) !== false)
{
$diff = commonModel::diff($old->$key, $value);
@@ -834,9 +848,9 @@ class commonModel extends model
/**
* Diff two string. (see phpt)
*
* @param string $text1
* @param string $text2
*
* @param string $text1
* @param string $text2
* @static
* @access public
* @return string
@@ -860,8 +874,8 @@ class commonModel extends model
/**
* Judge Suhosin Setting whether the actual size of post data is large than the setting size.
*
* @param int $countInputVars
*
* @param int $countInputVars
* @static
* @access public
* @return bool
@@ -885,9 +899,9 @@ class commonModel extends model
/**
* Get the previous and next object.
*
*
* @param string $type story|task|bug|case
* @param string $objectID
* @param string $objectID
* @access public
* @return void
*/
@@ -952,9 +966,9 @@ class commonModel extends model
/**
* Save one executed query.
*
* @param string $sql
* @param string $objectType story|task|bug|testcase
*
* @param string $sql
* @param string $objectType story|task|bug|testcase
* @access public
* @return void
*/
@@ -996,10 +1010,10 @@ class commonModel extends model
/**
* Remove duplicate for story, task, bug, case, doc.
*
*
* @param string $type e.g. story task bug case doc.
* @param array|object $data
* @param string $condition
* @param array|object $data
* @param string $condition
* @access public
* @return array
*/
@@ -1033,9 +1047,9 @@ class commonModel extends model
/**
* Append order by.
*
* @param string $orderBy
* @param string $append
*
* @param string $orderBy
* @param string $append
* @access public
* @return string
*/
@@ -1048,9 +1062,9 @@ class commonModel extends model
/**
* Check field exists
*
* @param string $table
* @param string $field
*
* @param string $table
* @param string $field
* @access public
* @return bool
*/
@@ -1071,7 +1085,7 @@ class commonModel extends model
/**
* Check upgrade's status file is ok or not.
*
*
* @access public
* @return void
*/
@@ -1092,7 +1106,7 @@ class commonModel extends model
/**
* Check the user has permission to access this method, if not, locate to the login page or deny page.
*
*
* @access public
* @return void
*/
@@ -1157,11 +1171,11 @@ class commonModel extends model
}
/**
* Check db priv.
*
* @param object $object
* @param string $module
* @param string $method
* Check db priv.
*
* @param object $object
* @param string $module
* @param string $method
* @static
* @access public
* @return void
@@ -1259,7 +1273,7 @@ class commonModel extends model
* we used %s as placeholder. These %s should be setted in one module.
*
* The items of one module's menu may be an string or array. For example, please see module/common/lang.
*
*
* @param string $object the menus of one module
* @param string $key the menu item to be replaced
* @param string $params the params passed to the menu item
@@ -1278,7 +1292,7 @@ class commonModel extends model
$menu->$key->link = vsprintf($menu->$key->link, $params);
$menu->$key = (array)$menu->$key;
}
else
else
{
$menu->$key = vsprintf($menu->$key, $params);
}
@@ -1300,7 +1314,7 @@ class commonModel extends model
/**
* Get the full url of the system.
*
*
* @access public
* @return string
*/
@@ -1323,8 +1337,8 @@ class commonModel extends model
/**
* Convert items to Pinyin.
*
* @param array $items
*
* @param array $items
* @static
* @access public
* @return array
@@ -1365,8 +1379,8 @@ class commonModel extends model
}
/**
* Check an entry.
*
* Check an entry.
*
* @access public
* @return void
*/
@@ -1394,9 +1408,9 @@ class commonModel extends model
}
/**
* Check token of an entry.
*
* @param string $key
* Check token of an entry.
*
* @param string $key
* @access public
* @return void
*/
@@ -1409,9 +1423,9 @@ class commonModel extends model
}
/**
* Response.
*
* @param int $code
* Response.
*
* @param int $code
* @access public
* @return void
*/
@@ -1425,10 +1439,10 @@ class commonModel extends model
}
/**
* Http.
*
* @param string $url
* @param string|array $data
* Http.
*
* @param string $url
* @param string|array $data
* @static
* @access public
* @return string
+1 -1
View File
@@ -13,7 +13,7 @@ if($extHookFiles) foreach($extHookFiles as $extHookFile) include $extHookFile;
?>
<?php if(empty($_GET['onlybody']) or $_GET['onlybody'] != 'yes'):?>
<?php $this->app->loadConfig('sso');?>
<?php
<?php
if(!empty($this->config->sso->redirect)) js::set('ssoRedirect', $this->config->sso->redirect);
?>
<header id='header'>
+61 -55
View File
@@ -14,11 +14,16 @@
class productModel extends model
{
/**
* Set menu.
*
* @param array $products
* @param int $productID
* @param string $extra
*
* Set menu.
*
* @param array $products
* @param int $productID
* @param int $branch
* @param int $module
* @param string $moduleType
* @param string $extra
*
* @access public
* @return void
*/
@@ -53,13 +58,14 @@ class productModel extends model
}
/**
* Create the select code of products.
*
* @param array $products
* @param int $productID
* @param string $currentModule
* @param string $currentMethod
* @param string $extra
* Create the select code of products.
*
* @param array $products
* @param int $productID
* @param string $currentModule
* @param string $currentMethod
* @param string $extra
*
* @access public
* @return string
*/
@@ -115,8 +121,8 @@ class productModel extends model
/**
* Save the product id user last visited to session.
*
* @param int $productID
*
* @param int $productID
* @param array $products
* @access public
* @return int
@@ -148,8 +154,8 @@ class productModel extends model
/**
* Check privilege.
*
* @param int $product
*
* @param int $product
* @access public
* @return bool
*/
@@ -157,7 +163,7 @@ class productModel extends model
{
/* Is admin? */
$account = ',' . $this->app->user->account . ',';
if($this->app->user->admin) return true;
if($this->app->user->admin) return true;
$acls = $this->app->user->rights['acls'];
if(!empty($acls['products']) and !in_array($product->id, $acls['products'])) return false;
@@ -172,8 +178,8 @@ class productModel extends model
/**
* Get product by id.
*
* @param int $productID
*
* @param int $productID
* @access public
* @return object
*/
@@ -188,8 +194,8 @@ class productModel extends model
/**
* Get by idList.
*
* @param array $productIDList
*
* @param array $productIDList
* @access public
* @return array
*/
@@ -200,9 +206,9 @@ class productModel extends model
/**
* Get products.
*
* @param string $status
* @param int $limit
*
* @param string $status
* @param int $limit
* @param int $line
* @access public
* @return array
@@ -227,9 +233,9 @@ class productModel extends model
}
/**
* Get product pairs.
*
* @param string $mode
* Get product pairs.
*
* @param string $mode
* @return array
*/
public function getPairs($mode = '')
@@ -273,7 +279,7 @@ class productModel extends model
/**
* Get grouped products.
*
*
* @access public
* @return void
*/
@@ -284,7 +290,7 @@ class productModel extends model
/**
* Create a product.
*
*
* @access public
* @return int
*/
@@ -325,8 +331,8 @@ class productModel extends model
/**
* Update a product.
*
* @param int $productID
*
* @param int $productID
* @access public
* @return array
*/
@@ -358,7 +364,7 @@ class productModel extends model
/**
* Batch update products.
*
*
* @access public
* @return void
*/
@@ -399,10 +405,10 @@ class productModel extends model
$this->fixOrder();
return $allChanges;
}
/**
* Close product.
*
*
* @param int $productID.
* @access public
* @return void
@@ -520,8 +526,8 @@ class productModel extends model
/**
* Get projects of a product in pairs.
*
* @param int $productID
*
* @param int $productID
* @param string $param all|nodeleted
* @access public
* @return array
@@ -549,8 +555,8 @@ class productModel extends model
/**
* Get roadmap of a proejct
*
* @param int $productID
*
* @param int $productID
* @access public
* @return array
*/
@@ -585,8 +591,8 @@ class productModel extends model
/**
* Get team members of a product from projects.
*
* @param object $product
*
* @param object $product
* @access public
* @return array
*/
@@ -624,9 +630,9 @@ class productModel extends model
}
/**
* Get product stat by id
*
* @param int $productID
* Get product stat by id
*
* @param int $productID
* @access public
* @return object|bool
*/
@@ -737,7 +743,7 @@ class productModel extends model
->where('deleted')->eq(0)
->andWhere('product')->in(array_keys($products))
->groupBy('product')
->fetchPairs();
->fetchPairs();
$unResolved = $this->dao->select('product,count(*) AS count')
->from(TABLE_BUG)
->where('status')->eq('active')
@@ -803,8 +809,8 @@ class productModel extends model
/**
* Get the summary of product's stories.
*
* @param array $stories
*
* @param array $stories
* @access public
* @return string.
*/
@@ -834,9 +840,9 @@ class productModel extends model
/**
* Judge an action is clickable or not.
*
* @param object $product
* @param string $action
*
* @param object $product
* @param string $action
* @access public
* @return void
*/
@@ -851,10 +857,10 @@ class productModel extends model
/**
* Create the link from module,method,extra
*
* @param string $module
* @param string $method
* @param mix $extra
*
* @param string $module
* @param string $method
* @param mix $extra
* @access public
* @return void
*/
@@ -903,7 +909,7 @@ class productModel extends model
/**
* Fix order.
*
*
* @access public
* @return void
*/
@@ -925,7 +931,7 @@ class productModel extends model
* get the latest project of the product.
*
* @param int $productID
* @access public
* @access public
* @return object
*/
public function getLatestProject($productID)
+42 -2
View File
@@ -228,13 +228,39 @@ class productplan extends control
$this->session->set('storyList', $this->app->getURI(true) . '&type=' . 'story');
$this->session->set('bugList', $this->app->getURI(true) . '&type=' . 'bug');
$reSort = false;
if($type == 'story' && strpos($orderBy, 'order') !== false)
{
$orderBy = str_replace('order', 'id', $orderBy);
$reSort = true;
}
/* Append id for secend sort. */
$sort = $this->loadModel('common')->appendOrder($orderBy);
$plan = $this->productplan->getByID($planID, true);
if(!$plan) die(js::error($this->lang->notFound) . js::locate('back'));
$this->commonAction($plan->product, $plan->branch);
$products = $this->product->getPairs();
$products = $this->product->getPairs();
$planStories = $this->loadModel('story')->getPlanStories($planID, 'all', $type == 'story' ? $sort : 'id_desc');
if($reSort)
{
if(!empty($plan->order))
{
$stories = array();
$order = explode(',', $plan->order);
if(strpos($orderBy, 'asc') !== false) $order = array_reverse($order, true);
foreach($order as $id)
{
if(empty($id)) continue;
$stories[$id] = $planStories[$id];
}
$planStories = $stories;
unset($stories);
}
$orderBy = str_replace('id', 'order', $orderBy);
}
$this->loadModel('datatable');
$showModule = !empty($this->config->datatable->productBrowse->showModule) ? $this->config->datatable->productBrowse->showModule : '';
@@ -242,7 +268,7 @@ class productplan extends control
$this->view->title = "PLAN #$plan->id $plan->title/" . $products[$plan->product];
$this->view->position[] = $this->lang->productplan->view;
$this->view->planStories = $this->loadModel('story')->getPlanStories($planID, 'all', $type == 'story' ? $sort : 'id_desc');
$this->view->planStories = $planStories;
$this->view->planBugs = $this->loadModel('bug')->getPlanBugs($planID, 'all', $type == 'bug' ? $sort : 'id_desc');
$this->view->products = $products;
$this->view->summary = $this->product->summary($this->view->planStories);
@@ -277,6 +303,20 @@ class productplan extends control
die(html::select($planName, $plans, '', "class='form-control'"));
}
/**
* Sort story for productplan.
*
* @param int $planID
*
* @access public
* @return bool
*/
public function ajaxStorySort($planID = 0)
{
if(empty($planID)) return true;
$this->dao->update(TABLE_PRODUCTPLAN)->set('`order`')->eq($this->post->storys)->where('id')->eq((int)$planID)->exec();
}
/**
* Link stories.
*
+16 -1
View File
@@ -41,4 +41,19 @@ $(function()
$option.toggleClass('hide', $option.text().toString().toLowerCase().indexOf(val) < 0 && $option.data('key').toString().toLowerCase().indexOf(val) < 0);
});
});
})
$('#storyList').on('sort.sortable', function(e, data)
{
var list = '';
for(i = 0; i < data.list.length; i++) list += $(data.list[i]).attr('data-id') + ',';
console.log(list);
$.post(createLink('productplan', 'ajaxStorySort', 'planID=' + planID), {'storys' : list, 'orderBy' : orderBy}, function()
{
var $target = $(data.element[0]);
$target.hide();
$target.fadeIn(1000);
order = 'order_asc';
history.pushState({}, 0, createLink('productplan', 'view', "planID=" + planID + '&type=story&orderBy=' + order));
});
});
});
+7 -5
View File
@@ -11,8 +11,10 @@
*/
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/sortable.html.php';?>
<?php js::set('confirmUnlinkStory', $lang->productplan->confirmUnlinkStory)?>
<?php js::set('confirmUnlinkBug', $lang->productplan->confirmUnlinkBug)?>
<?php js::set('planID', $plan->id);?>
<div id='titlebar'>
<div class='heading'>
<span class='prefix'><?php echo html::icon($lang->icons['plan']);?> <strong><?php echo $plan->id;?></strong></span>
@@ -102,7 +104,7 @@
<th class='w-50px {sorter:false}'> <?php echo $lang->actions?></th>
</tr>
</thead>
<tbody>
<tbody class='sortable'>
<?php
$totalEstimate = 0.0;
$canBatchUnlink = common::hasPriv('productPlan', 'batchUnlinkStory');
@@ -113,10 +115,10 @@
$viewLink = $this->createLink('story', 'view', "storyID=$story->id");
$totalEstimate += $story->estimate;
?>
<tr class='text-center'>
<tr class='text-center' data-id='<?php echo $story->id;?>'>
<td class='cell-id'>
<?php if($canBatchUnlink or $canBatchChangePlan):?>
<input type='checkbox' name='storyIDList[]' value='<?php echo $story->id;?>'/>
<input type='checkbox' name='storyIDList[]' value='<?php echo $story->id;?>'/>
<?php endif;?>
<?php echo html::a($viewLink, sprintf("%03d", $story->id));?>
</td>
@@ -349,7 +351,7 @@
<tr class='text-center'>
<td class='cell-id'>
<?php if($canBatchUnlink):?>
<input type='checkbox' name='unlinkBugs[]' value='<?php echo $bug->id;?>'/>
<input type='checkbox' name='unlinkBugs[]' value='<?php echo $bug->id;?>'/>
<?php endif;?>
<?php echo html::a($this->createLink('bug', 'view', "bugID=$bug->id"), sprintf("%03d", $bug->id));?>
</td>
@@ -374,7 +376,7 @@
<tr>
<td colspan='7'>
<div class='table-actions clearfix'>
<?php
<?php
if(count($planBugs) and $canBatchUnlink)
{
echo html::selectButton();
+19 -18
View File
@@ -56,11 +56,11 @@ include '../../common/view/chosen.html.php';
.outer > #querybox {margin: -20px -20px 20px; border-top: none; border-bottom: 1px solid #ddd}
#searchform input.date::-webkit-input-placeholder{color: #000000; opacity: 1;}
#searchform input.date::-moz-placeholder{color: #000000; opacity: 1;}
#searchform input.date::-moz-placeholder{color: #000000; opacity: 1;}
#searchform input.date:-ms-input-placeholder{color: #000000; opacity: 1;}
</style>
<script language='Javascript'>
var dtOptions =
var dtOptions =
{
language: '<?php echo $this->app->getClientLang();?>',
weekStart: 1,
@@ -97,8 +97,8 @@ var actionURL = '<?php echo $actionURL;?>';
/**
* Set date field
*
* @param string $query
*
* @param string $query
* @return void
*/
function setDateField(query, fieldNO)
@@ -160,9 +160,9 @@ function setDateField(query, fieldNO)
/**
* When the value of the fields select changed, set the operator and value of the new field.
*
* @param string $obj
* @param int $fieldNO
*
* @param string $obj
* @param int $fieldNO
* @access public
* @return void
*/
@@ -177,7 +177,7 @@ function setField(obj, fieldNO, moduleparams)
if(typeof(params[fieldName]['class']) != undefined && params[fieldName]['class'] == 'date')
{
setDateField($(obj).closest('form').find("#value" + fieldNO), fieldNO);
$(obj).closest('form').find("#value" + fieldNO).addClass('date'); // Shortcut the width of the datepicker to make sure align with others.
$(obj).closest('form').find("#value" + fieldNO).addClass('date'); // Shortcut the width of the datepicker to make sure align with others.
var groupItems = <?php echo $config->search->groupItems?>;
var maxNO = 2 * groupItems;
var nextNO = fieldNO > groupItems ? fieldNO - groupItems + 1 : fieldNO + groupItems;
@@ -207,7 +207,7 @@ function setField(obj, fieldNO, moduleparams)
/**
* Reset forms.
*
*
* @access public
* @return void
*/
@@ -216,12 +216,13 @@ function resetForm(obj)
for(i = 1; i <= groupItems * 2; i ++)
{
$(obj).closest('form').find('#value' + i).val('').trigger('chosen:updated');
$(obj).closest('form').find('#dateValue' + i).val('').attr('placeholder','');
}
}
/**
* Show more fields.
*
*
* @access public
* @return void
*/
@@ -241,7 +242,7 @@ function showmore(obj)
/**
* Show lite search form.
*
*
* @access public
* @return void
*/
@@ -261,8 +262,8 @@ function showlite(obj)
/**
* loadQueries.
*
* @param queryID $queryID
*
* @param queryID $queryID
* @access public
* @return void
*/
@@ -273,8 +274,8 @@ function loadQueries(queryID)
/**
* Execute a query.
*
* @param int $queryID
*
* @param int $queryID
* @access public
* @return void
*/
@@ -286,7 +287,7 @@ function executeQuery(queryID)
/**
* Delete a query.
*
*
* @access public
* @return void
*/
@@ -383,7 +384,7 @@ foreach($fieldParams as $fieldName => $param)
/* Print value. */
echo "<td id='valueBox$fieldNO' style='overflow:visible'>";
if($param['control'] == 'select') echo html::select("value$fieldNO", $param['values'], $formSession["value$fieldNO"], "class='form-control searchSelect chosen'");
if($param['control'] == 'input')
if($param['control'] == 'input')
{
$fieldName = $formSession["field$fieldNO"];
$fieldValue = $formSession["value$fieldNO"];
@@ -467,7 +468,7 @@ foreach($fieldParams as $fieldName => $param)
?>
</table>
</td>
<td class='<?php echo $style == 'simple' ? 'w-80px' : 'w-160px';?>'>
<td class='<?php echo $style == 'simple' ? 'w-80px' : 'w-160px';?>'>
<?php
echo html::hidden('module', $module);
echo html::hidden('actionURL', $actionURL);
+186 -184
View File
@@ -15,9 +15,9 @@ class storyModel extends model
{
/**
* Get a story by id.
*
* @param int $storyID
* @param int $version
*
* @param int $storyID
* @param int $version
* @param bool $setImgSize
* @access public
* @return object|bool
@@ -67,8 +67,8 @@ class storyModel extends model
/**
* Get stories by idList.
*
* @param int|array|string $storyIDList
*
* @param int|array|string $storyIDList
* @access public
* @return array
*/
@@ -84,8 +84,8 @@ class storyModel extends model
/**
* Get story specs.
*
* @param array $storyIdList
*
* @param array $storyIdList
* @access public
* @return array
*/
@@ -98,9 +98,9 @@ class storyModel extends model
}
/**
* Get affected things.
*
* @param object $story
* Get affected things.
*
* @param object $story
* @access public
* @return object
*/
@@ -135,7 +135,7 @@ class storyModel extends model
/**
* Create a story.
*
*
* @access public
* @return int|bool the id of the created story or false when error.
*/
@@ -184,7 +184,7 @@ class storyModel extends model
$data->verify = $story->verify;
$this->dao->insert(TABLE_STORYSPEC)->data($data)->exec();
if($projectID != 0 and $story->status != 'draft')
if($projectID != 0 and $story->status != 'draft')
{
$lastOrder = (int)$this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($projectID)->orderBy('order_desc')->limit(1)->fetch('order');
$this->dao->insert(TABLE_PROJECTSTORY)
@@ -209,7 +209,7 @@ class storyModel extends model
$bug->assignedTo = 'closed';
$bug->assignedDate = $now;
$this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bugID)->exec();
$this->loadModel('action')->create('bug', $bugID, 'ToStory', '', $storyID);
$this->action->create('bug', $bugID, 'Closed');
@@ -218,13 +218,13 @@ class storyModel extends model
->where('objectType')->eq('bug')
->andWhere('objectID')->eq($bugID)
->fetchAll();
if(!empty($files))
{
if(!empty($files))
{
foreach($files as $file)
{
$file->objectType = 'story';
$file->objectID = $storyID;
unset($file->id);
$file->objectID = $storyID;
unset($file->id);
$this->dao->insert(TABLE_FILE)->data($file)->exec();
}
}
@@ -238,7 +238,7 @@ class storyModel extends model
/**
* Create a batch stories.
*
*
* @access public
* @return int|bool the id of the created story or false when error.
*/
@@ -299,7 +299,7 @@ class storyModel extends model
$this->dao->insert(TABLE_STORY)->data($data)->autoCheck()
->batchCheck($this->config->story->create->requiredFields, 'notempty')
->exec();
if(dao::isError())
if(dao::isError())
{
echo js::error(dao::getError());
die(js::reload('parent'));
@@ -327,8 +327,8 @@ class storyModel extends model
if(rename($realPath, $this->file->savePath . $this->file->getSaveName($file['pathname'])))
{
$file['addedBy'] = $this->app->user->account;
$file['addedDate'] = $now;
$file['addedBy'] = $this->app->user->account;
$file['addedDate'] = $now;
$file['objectType'] = 'story';
$file['objectID'] = $storyID;
if(in_array($file['extension'], $this->config->file->imageExtensions))
@@ -359,7 +359,7 @@ class storyModel extends model
/* Remove upload image file and session. */
if(!empty($stories->uploadImage) and $this->session->storyImagesFile)
{
$classFile = $this->app->loadClass('zfile');
$classFile = $this->app->loadClass('zfile');
$file = current($_SESSION['storyImagesFile']);
$realPath = dirname($file['realpath']);
if(is_dir($realPath)) $classFile->removeDir($realPath);
@@ -371,8 +371,8 @@ class storyModel extends model
/**
* Change a story.
*
* @param int $storyID
*
* @param int $storyID
* @access public
* @return array the change of the story.
*/
@@ -447,8 +447,8 @@ class storyModel extends model
/**
* Update a story.
*
* @param int $storyID
*
* @param int $storyID
* @access public
* @return array the changes of the story.
*/
@@ -513,7 +513,7 @@ class storyModel extends model
/**
* Batch update stories.
*
*
* @access public
* @return array.
*/
@@ -539,9 +539,9 @@ class storyModel extends model
if($data->modules[$storyID] == 'ditto') $data->modules[$storyID] = isset($prev['module']) ? $prev['module'] : 0;
if($data->plans[$storyID] == 'ditto') $data->plans[$storyID] = isset($prev['plan']) ? $prev['plan'] : 0;
if($data->sources[$storyID] == 'ditto') $data->sources[$storyID] = isset($prev['source']) ? $prev['source'] : '';
if(isset($data->stages[$storyID]) and ($data->stages[$storyID] == 'ditto')) $data->stages[$storyID] = isset($prev['stage']) ? $prev['stage'] : '';
if(isset($data->closedBys[$storyID]) and ($data->closedBys[$storyID] == 'ditto')) $data->closedBys[$storyID] = isset($prev['closedBy']) ? $prev['closedBy'] : '';
if(isset($data->closedReasons[$storyID]) and ($data->closedReasons[$storyID] == 'ditto')) $data->closedReasons[$storyID] = isset($prev['closedReason']) ? $prev['closedReason'] : '';
if(isset($data->stages[$storyID]) and ($data->stages[$storyID] == 'ditto')) $data->stages[$storyID] = isset($prev['stage']) ? $prev['stage'] : '';
if(isset($data->closedBys[$storyID]) and ($data->closedBys[$storyID] == 'ditto')) $data->closedBys[$storyID] = isset($prev['closedBy']) ? $prev['closedBy'] : '';
if(isset($data->closedReasons[$storyID]) and ($data->closedReasons[$storyID] == 'ditto')) $data->closedReasons[$storyID] = isset($prev['closedReason']) ? $prev['closedReason'] : '';
$prev['pri'] = $data->pris[$storyID];
$prev['branch'] = isset($data->branches[$storyID]) ? $data->branches[$storyID] : 0;
@@ -611,7 +611,7 @@ class storyModel extends model
$this->dao->insert(TABLE_STORYSPEC)->data($data)->exec();
}
if(!dao::isError())
if(!dao::isError())
{
if($story->closedReason == 'done') $this->loadModel('score')->create('story', 'close');
$allChanges[$storyID] = common::createChanges($oldStory, $story);
@@ -628,8 +628,8 @@ class storyModel extends model
/**
* Review a story.
*
* @param int $storyID
*
* @param int $storyID
* @access public
* @return bool
*/
@@ -689,8 +689,8 @@ class storyModel extends model
/**
* Batch review stories.
*
* @param array $storyIDList
*
* @param array $storyIDList
* @access public
* @return array
*/
@@ -733,10 +733,10 @@ class storyModel extends model
}
/**
* Subdivide story
*
* @param int $storyID
* @param array $stories
* Subdivide story
*
* @param int $storyID
* @param array $stories
* @access public
* @return int
*/
@@ -776,8 +776,8 @@ class storyModel extends model
/**
* Close a story.
*
* @param int $storyID
*
* @param int $storyID
* @access public
* @return bool
*/
@@ -798,7 +798,7 @@ class storyModel extends model
->add('closedBy', $this->app->user->account)
->add('assignedTo', 'closed')
->add('assignedDate', $now)
->add('status', 'closed')
->add('status', 'closed')
->removeIF($this->post->closedReason != 'duplicate', 'duplicateStory')
->removeIF($this->post->closedReason != 'subdivided', 'childStories')
->setIF($this->post->closedReason == 'done', 'stage', 'released')
@@ -817,7 +817,7 @@ class storyModel extends model
/**
* Batch close story.
*
*
* @access public
* @return void
*/
@@ -867,7 +867,7 @@ class storyModel extends model
->checkIF($story->closedReason == 'duplicate', 'duplicateStory', 'notempty')
->where('id')->eq($storyID)->exec();
if(!dao::isError())
if(!dao::isError())
{
$allChanges[$storyID] = common::createChanges($oldStory, $story);
}
@@ -912,11 +912,11 @@ class storyModel extends model
/**
* Batch change the plan of story.
*
* @param array $storyIDList
* @param int $planID
*
* @param array $storyIDList
* @param int $planID
* @access public
* @return array
* @return array
*/
public function batchChangePlan($storyIDList, $planID, $oldPlanID = 0)
{
@@ -952,9 +952,9 @@ class storyModel extends model
/**
* Batch change branch.
*
* @param array $storyIDList
* @param int $branchID
*
* @param array $storyIDList
* @param int $branchID
* @access public
* @return void
*/
@@ -980,8 +980,10 @@ class storyModel extends model
/**
* Batch change the stage of story.
*
* @param string $stage
*
* @param $storyIDList
* @param $stage
*
* @access public
* @return array
*/
@@ -1011,7 +1013,7 @@ class storyModel extends model
/**
* Batch assign to.
*
*
* @access public
* @return array
*/
@@ -1041,8 +1043,8 @@ class storyModel extends model
/**
* Activate a story.
*
* @param int $storyID
*
* @param int $storyID
* @access public
* @return bool
*/
@@ -1069,8 +1071,8 @@ class storyModel extends model
/**
* Set stage of a story.
*
* @param int $storyID
*
* @param int $storyID
* @access public
* @return bool
*/
@@ -1162,11 +1164,11 @@ class storyModel extends model
}
/**
* Judge stage according to the devel and test tasks' status.
*
* Judge stage according to the devel and test tasks' status.
*
* 1. one doing devel task, all test tasks waiting, set stage as developing.
* 2. all devel tasks done, all test tasks waiting, set stage as developed.
* 3. one test task doing, set stage as testing.
* 3. one test task doing, set stage as testing.
* 4. all test tasks done, still some devel tasks not done(wait, doing), set stage as testing.
* 5. all test tasks done, all devel tasks done, set stage as tested.
*/
@@ -1175,7 +1177,7 @@ class storyModel extends model
$stage = 'projected';
$testTasks = isset($branchTestTasks[$branch]) ? $branchTestTasks[$branch] : 0;
$develTasks = isset($branchDevelTasks[$branch]) ? $branchDevelTasks[$branch] : 0;
if($statusList['devel']['doing'] > 0 and $statusList['test']['wait'] == $testTasks) $stage = 'developing';
if($statusList['devel']['doing'] > 0 and $statusList['test']['wait'] == $testTasks) $stage = 'developing';
if($statusList['devel']['done'] == $develTasks and $develTasks > 0 and $statusList['test']['wait'] == $testTasks) $stage = 'developed';
if($statusList['test']['doing'] > 0) $stage = 'testing';
if(($statusList['devel']['wait'] > 0 or $statusList['devel']['doing'] > 0) and $statusList['test']['done'] == $testTasks and $testTasks > 0) $stage = 'testing';
@@ -1305,7 +1307,7 @@ class storyModel extends model
/**
* Get stories list of a product.
*
*
* @param int $productID
* @param array|string $moduleIdList
* @param string $status
@@ -1337,12 +1339,12 @@ class storyModel extends model
/**
* Get stories pairs of a product.
*
* @param int $productID
* @param array|string $moduleIdList
* @param string $status
* @param string $order
* @param int $limit
*
* @param int $productID
* @param array|string $moduleIdList
* @param string $status
* @param string $order
* @param int $limit
* @access public
* @return array
*/
@@ -1365,11 +1367,11 @@ class storyModel extends model
/**
* Get stories by assignedTo.
*
* @param int $productID
* @param string $account
* @param string $orderBy
* @param object $pager
*
* @param int $productID
* @param string $account
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
@@ -1380,11 +1382,11 @@ class storyModel extends model
/**
* Get stories by openedBy.
*
* @param int $productID
* @param string $account
* @param string $orderBy
* @param object $pager
*
* @param int $productID
* @param string $account
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
@@ -1395,11 +1397,11 @@ class storyModel extends model
/**
* Get stories by reviewedBy.
*
* @param int $productID
* @param string $account
* @param string $orderBy
* @param object $pager
*
* @param int $productID
* @param string $account
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
@@ -1410,11 +1412,11 @@ class storyModel extends model
/**
* Get stories by closedBy.
*
* @param int $productID
* @param string $account
* @param string $orderBy
* @param object $pager
*
* @param int $productID
* @param string $account
* @param string $orderBy
* @param object $pager
* @return array
*/
public function getByClosedBy($productID, $branch, $modules, $account, $orderBy, $pager)
@@ -1424,11 +1426,11 @@ class storyModel extends model
/**
* Get stories by status.
*
* @param int $productID
* @param string $orderBy
* @param object $pager
* @param string $status
*
* @param int $productID
* @param string $orderBy
* @param object $pager
* @param string $status
* @access public
* @return array
*/
@@ -1456,12 +1458,12 @@ class storyModel extends model
/**
* Get stories by a field.
*
* @param int $productID
* @param string $fieldName
* @param mixed $fieldValue
* @param string $orderBy
* @param object $pager
*
* @param int $productID
* @param string $fieldName
* @param mixed $fieldValue
* @param string $orderBy
* @param object $pager
* @param string $operator equal|include
* @access public
* @return array
@@ -1484,10 +1486,10 @@ class storyModel extends model
/**
* Get to be closed stories.
*
* @param int $productID
* @param string $orderBy
* @param string $pager
*
* @param int $productID
* @param string $orderBy
* @param string $pager
* @access public
* @return array
*/
@@ -1522,7 +1524,7 @@ class storyModel extends model
{
if($projectID != '')
{
$products = $this->loadModel('project')->getProducts($projectID);
$products = $this->loadModel('project')->getProducts($projectID);
}
else
{
@@ -1552,7 +1554,7 @@ class storyModel extends model
foreach($products as $product) $branches[$product->branch] = $product->branch;
unset($branches[0]);
$branches = join(',', $branches);
if($branches) $storyQuery .= " AND `branch`" . helper::dbIN("0,$branches");
if($branches) $storyQuery .= " AND `branch`" . helper::dbIN("0,$branches");
if($this->app->moduleName == 'release' or $this->app->moduleName == 'build')
{
$storyQuery .= " AND `status` NOT IN ('draft')";// Fix bug #990.
@@ -1575,11 +1577,11 @@ class storyModel extends model
/**
* Get stories by a sql.
*
* @param int $productID
* @param string $sql
* @param string $orderBy
* @param object $pager
*
* @param int $productID
* @param string $sql
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
@@ -1614,12 +1616,12 @@ class storyModel extends model
}
return $stories;
}
/**
* Get stories list of a project.
*
* @param int $projectID
* @param string $orderBy
*
* @param int $projectID
* @param string $orderBy
* @access public
* @return array
*/
@@ -1696,9 +1698,9 @@ class storyModel extends model
/**
* Get stories pairs of a project.
*
* @param int $projectID
* @param int $productID
*
* @param int $projectID
* @param int $productID
* @param array|string $moduleIdList
* @param string $type
* @access public
@@ -1766,11 +1768,11 @@ class storyModel extends model
/**
* Get stories of a user.
*
* @param string $account
* @param string $type the query type
* @param string $orderBy
* @param object $pager
*
* @param string $account
* @param string $type the query type
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
@@ -1788,19 +1790,19 @@ class storyModel extends model
->orderBy($orderBy)
->page($pager)
->fetchAll();
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story');
$productIdList = array();
foreach($stories as $story) $productIdList[$story->product] = $story->product;
return $this->mergePlanTitle($productIdList, $stories);
}
/**
* Get story pairs of a user.
*
* @param string $account
* @param string $limit
*
* @param string $account
* @param string $limit
* @access public
* @return array
*/
@@ -1814,11 +1816,11 @@ class storyModel extends model
->limit($limit)
->fetchAll();
}
/**
* Get doing projects' members of a story.
*
* @param int $storyID
*
* @param int $storyID
* @access public
* @return array
*/
@@ -1835,8 +1837,8 @@ class storyModel extends model
/**
* Get version of a story.
*
* @param int $storyID
*
* @param int $storyID
* @access public
* @return int
*/
@@ -1847,7 +1849,7 @@ class storyModel extends model
/**
* Get versions of some stories.
*
*
* @param array|string story id list
* @access public
* @return array
@@ -1859,8 +1861,8 @@ class storyModel extends model
/**
* Get zero case.
*
* @param int $productID
*
* @param int $productID
* @access public
* @return array
*/
@@ -1879,8 +1881,8 @@ class storyModel extends model
/**
* Batch get story stage.
*
* @param array $stories
*
* @param array $stories
* @access public
* @return array
*/
@@ -1893,8 +1895,8 @@ class storyModel extends model
/**
* Check need confirm.
*
* @param array $dataList
*
* @param array $dataList
* @access public
* @return array
*/
@@ -1922,9 +1924,9 @@ class storyModel extends model
}
/**
* Format stories
*
* @param array $stories
* Format stories
*
* @param array $stories
* @param string $type
* @param int $limit
* @access public
@@ -1963,8 +1965,8 @@ class storyModel extends model
/**
* Extract accounts from some stories.
*
* @param array $stories
*
* @param array $stories
* @access public
* @return array
*/
@@ -1983,8 +1985,8 @@ class storyModel extends model
/**
* Extract accounts from a story.
*
* @param object $story
*
* @param object $story
* @access public
* @return array
*/
@@ -2000,8 +2002,8 @@ class storyModel extends model
/**
* Merge the default chart settings and the settings of current chart.
*
* @param string $chartType
*
* @param string $chartType
* @access public
* @return void
*/
@@ -2019,7 +2021,7 @@ class storyModel extends model
}
/**
* Get report data of storys per product
* Get report data of storys per product
*
* @access public
* @return array
@@ -2073,7 +2075,7 @@ class storyModel extends model
}
/**
* Get report data of storys per source
* Get report data of storys per source
*
* @access public
* @return array
@@ -2090,8 +2092,8 @@ class storyModel extends model
}
/**
* Get report data of storys per plan
*
* Get report data of storys per plan
*
* @access public
* @return array
*/
@@ -2107,8 +2109,8 @@ class storyModel extends model
}
/**
* Get report data of storys per status
*
* Get report data of storys per status
*
* @access public
* @return array
*/
@@ -2123,8 +2125,8 @@ class storyModel extends model
}
/**
* Get report data of storys per stage
*
* Get report data of storys per stage
*
* @access public
* @return array
*/
@@ -2139,8 +2141,8 @@ class storyModel extends model
}
/**
* Get report data of storys per pri
*
* Get report data of storys per pri
*
* @access public
* @return array
*/
@@ -2155,8 +2157,8 @@ class storyModel extends model
}
/**
* Get report data of storys per estimate
*
* Get report data of storys per estimate
*
* @access public
* @return array
*/
@@ -2168,8 +2170,8 @@ class storyModel extends model
}
/**
* Get report data of storys per openedBy
*
* Get report data of storys per openedBy
*
* @access public
* @return array
*/
@@ -2185,8 +2187,8 @@ class storyModel extends model
}
/**
* Get report data of storys per assignedTo
*
* Get report data of storys per assignedTo
*
* @access public
* @return array
*/
@@ -2202,8 +2204,8 @@ class storyModel extends model
}
/**
* Get report data of storys per closedReason
*
* Get report data of storys per closedReason
*
* @access public
* @return array
*/
@@ -2218,8 +2220,8 @@ class storyModel extends model
}
/**
* Get report data of storys per change
*
* Get report data of storys per change
*
* @access public
* @return array
*/
@@ -2231,9 +2233,9 @@ class storyModel extends model
}
/**
* Get kanban group data.
*
* @param array $stories
* Get kanban group data.
*
* @param array $stories
* @access public
* @return array
*/
@@ -2247,9 +2249,9 @@ class storyModel extends model
/**
* Adjust the action clickable.
*
* @param object $story
* @param string $action
*
* @param object $story
* @param string $action
* @access public
* @return void
*/
@@ -2267,9 +2269,9 @@ class storyModel extends model
/**
* Merge plan title.
*
* @param int|array $productID
* @param array $stories
*
* @param int|array $productID
* @param array $stories
* @access public
* @return array
*/
@@ -2458,7 +2460,7 @@ class storyModel extends model
/**
* Set report condition.
*
*
* @access public
* @return string
*/
@@ -2478,7 +2480,7 @@ class storyModel extends model
/**
* Check force review for user.
*
*
* @access public
* @return bool
*/
@@ -2491,10 +2493,10 @@ class storyModel extends model
}
/**
* Send mail
*
* @param int $storyID
* @param int $actionID
* Send mail
*
* @param int $storyID
* @param int $actionID
* @access public
* @return void
*/