diff --git a/module/admin/config.php b/module/admin/config.php index a038d55c88..197e7da4e2 100644 --- a/module/admin/config.php +++ b/module/admin/config.php @@ -1,15 +1,15 @@ url = new stdclass(); -$config->url->community = 'http://www.zentao.net'; -$config->url->ask = 'http://www.zentao.net/ask-browse.html'; -$config->url->document = 'http://www.zentao.net/help-book-zentaopmshelp.html'; -$config->url->feedback = 'http://www.zentao.net/forum-board-1074.html'; -$config->url->faq = 'http://www.zentao.net/ask-faq.html'; -$config->url->extension = 'http://www.zentao.net/extension-browse.html'; -$config->url->donation = 'http://www.zentao.net/help-donation.html'; -$config->url->service = 'http://www.cnezsoft.com/article-browse-1078.html'; +$config->url->community = 'https://www.zentao.net'; +$config->url->ask = 'https://www.zentao.net/ask-browse.html'; +$config->url->document = 'https://www.zentao.net/help-book-zentaopmshelp.html'; +$config->url->feedback = 'https://www.zentao.net/forum-board-1074.html'; +$config->url->faq = 'https://www.zentao.net/ask-faq.html'; +$config->url->extension = 'https://www.zentao.net/extension-browse.html'; +$config->url->donation = 'https://www.zentao.net/help-donation.html'; +$config->url->service = 'https://www.cnezsoft.com/article-browse-1078.html'; -$config->admin->apiRoot = 'http://www.zentao.net'; +$config->admin->apiRoot = 'https://www.zentao.net'; $config->admin->log = new stdclass(); $config->admin->log->saveDays = 30; diff --git a/module/admin/model.php b/module/admin/model.php index 12033df39d..430cb24b62 100644 --- a/module/admin/model.php +++ b/module/admin/model.php @@ -13,14 +13,6 @@ setAgent(); - } - - /** - * Set the api agent. - * - * @access public - * @return void - */ - public function setAgent() - { - $this->agent = $this->app->loadClass('snoopy'); - } - /** * Post data form API * @@ -62,9 +31,7 @@ class adminModel extends model */ public function postAPI($url, $formvars = "") { - $this->agent->cookies['lang'] = $this->cookie->lang; - $this->agent->submit($url, $formvars); - return $this->agent->results; + return common::http($url, $formvars); } /** @@ -143,9 +110,7 @@ class adminModel extends model $params[$apiConfig->sessionVar] = $apiConfig->sessionID; $params['k'] = $this->getSignature($params); - $this->agent->cookies['lang'] = $this->cookie->lang; - $this->agent->fetch($apiURL . '?' . http_build_query($params)); - $result = $this->agent->results; + $result = common::http($apiURL . '?' . http_build_query($params)); $result = json_decode($result); return $result; } diff --git a/module/block/model.php b/module/block/model.php index d3017d0beb..1544e1c370 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -157,14 +157,19 @@ class blockModel extends model { $data = array(); - $projects = $this->loadModel('project')->getPairs(); - $products = $this->loadModel('product')->getPairs(); - $data['tasks'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_TASK)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->fetch('count'); $data['bugs'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_BUG)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->fetch('count'); $data['stories'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_STORY)->where('assignedTo')->eq($this->app->user->account)->andWhere('deleted')->eq(0)->fetch('count'); - $data['projects'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_PROJECT)->where('id')->in(array_keys($projects))->andWhere("(status='wait' or status='doing')")->andWhere('deleted')->eq(0)->fetch('count'); - $data['products'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_PRODUCT)->where('status')->ne('closed')->andWhere('id')->in(array_keys($products))->andWhere('deleted')->eq(0)->fetch('count'); + $data['projects'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_PROJECT) + ->where("(status='wait' or status='doing')") + ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects) + ->andWhere('deleted')->eq(0) + ->fetch('count'); + $data['products'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_PRODUCT) + ->where('status')->ne('closed') + ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->products) + ->andWhere('deleted')->eq(0) + ->fetch('count'); $today = date('Y-m-d'); $data['delayTask'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_TASK) @@ -182,8 +187,8 @@ class blockModel extends model ->andWhere('deleted')->eq(0) ->fetch('count'); $data['delayProject'] = (int)$this->dao->select('count(*) AS count')->from(TABLE_PROJECT) - ->where('id')->in(array_keys($projects)) - ->andWhere('status')->in('wait,doing') + ->where('status')->in('wait,doing') + ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects) ->andWhere('end')->lt($today) ->andWhere('deleted')->eq(0) ->fetch('count'); diff --git a/module/bug/config.php b/module/bug/config.php index 9c7e5ed1ef..038135ce14 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -324,5 +324,5 @@ $config->bug->datatable->fieldList['lastEditedDate']['required'] = 'no'; $config->bug->datatable->fieldList['actions']['title'] = 'actions'; $config->bug->datatable->fieldList['actions']['fixed'] = 'right'; -$config->bug->datatable->fieldList['actions']['width'] = '190'; +$config->bug->datatable->fieldList['actions']['width'] = '150'; $config->bug->datatable->fieldList['actions']['required'] = 'yes'; diff --git a/module/bug/model.php b/module/bug/model.php index 89e7bf41df..22f85cac73 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -422,10 +422,9 @@ class bugModel extends model */ public function getPlanBugs($planID, $status = 'all', $orderBy = 'id_desc', $pager = null) { - $projects = $this->loadModel('project')->getPairs('empty|withdelete'); $bugs = $this->dao->select('*')->from(TABLE_BUG) ->where('plan')->eq((int)$planID) - ->andWhere('project')->in(array_keys($projects)) + ->beginIF(!$this->app->user->admin)->andWhere('project')->in($this->app->user->view->projects)->fi() ->beginIF($status != 'all')->andWhere('status')->in($status)->fi() ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll('id'); @@ -1313,10 +1312,9 @@ class bugModel extends model public function getUserBugs($account, $type = 'assignedTo', $orderBy = 'id_desc', $limit = 0, $pager = null) { if(!$this->loadModel('common')->checkField(TABLE_BUG, $type)) return array(); - $projects = $this->loadModel('project')->getPairs('empty|withdelete'); - $bugs = $this->dao->select('*')->from(TABLE_BUG) + $bugs = $this->dao->select('*')->from(TABLE_BUG) ->where('deleted')->eq(0) - ->andWhere('project')->in(array_keys($projects)) + ->beginIF(!$this->app->user->admin)->andWhere('project')->in($this->app->user->view->projects)->fi() ->beginIF($type != 'all')->andWhere("`$type`")->eq($account)->fi() ->orderBy($orderBy) ->beginIF($limit > 0)->limit($limit)->fi() @@ -1459,11 +1457,10 @@ class bugModel extends model */ public function getProductBugPairs($productID) { - $projects = $this->loadModel('project')->getPairs('empty|withdelete'); $bugs = array('' => ''); $data = $this->dao->select('id, title')->from(TABLE_BUG) ->where('product')->eq((int)$productID) - ->andWhere('project')->in(array_keys($projects)) + ->beginIF(!$this->app->user->admin)->andWhere('project')->in($this->app->user->view->projects)->fi() ->andWhere('deleted')->eq(0) ->orderBy('id desc') ->fetchAll(); @@ -2584,9 +2581,17 @@ class bugModel extends model } break; case 'assignedTo': + $btnTextClass = ''; + $assignedToText = !empty($bug->assignedTo) ? zget($users, $bug->assignedTo) : $this->lang->bug->noAssigned; $btnTextClass = 'text-primary'; if($bug->assignedTo == $account) $btnTextClass = 'text-red'; - echo "" . zget($users, $bug->assignedTo) . ""; + + $btnClass = $assignedToText == 'closed' ? ' disabled' : ''; + $btnClass = "iframe btn btn-icon-left btn-sm {$btnClass}"; + $assignToLink = helper::createLink('bug', 'assignTo', "bugID=$bug->id", '', true); + $assignToHtml = html::a($assignToLink, " {$assignedToText}", '', "class='$btnClass'"); + + echo !common::hasPriv('bug', 'assignTo') ? "{$assignedToText}" : $assignToHtml; break; case 'assignedDate': echo substr($bug->assignedDate, 5, 11); @@ -2620,7 +2625,6 @@ class bugModel extends model break; case 'actions': $params = "bugID=$bug->id"; - common::printIcon('bug', 'assignTo', $params, $bug, 'list', '', '', 'iframe', true); common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'confirm', '', 'iframe', true); common::printIcon('bug', 'resolve', $params, $bug, 'list', 'checked', '', 'iframe', true); common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true); diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index 0598ff9c6d..712f2cc29e 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -319,7 +319,7 @@ $params = "bugID=$bug->id"; $copyParams = "productID=$productID&branch=$bug->branch&extras=bugID=$bug->id"; $convertParams = "productID=$productID&branch=$bug->branch&moduleID=0&from=bug&bugID=$bug->id"; ?> -
'+i+'