diff --git a/config/filter.php b/config/filter.php index 99e4c601cd..ee9d0880b3 100644 --- a/config/filter.php +++ b/config/filter.php @@ -111,6 +111,7 @@ $filter->product->browse->cookie['storyModule'] = 'int'; $filter->product->default->cookie['lastProduct'] = 'int'; $filter->product->default->cookie['preProductID'] = 'int'; $filter->product->index->cookie['preBranch'] = 'int'; +$filter->product->export->cookie['checkedItem'] = 'reg::checked'; $filter->project->default->cookie['lastProject'] = 'int'; $filter->project->default->cookie['projectMode'] = 'code'; @@ -120,6 +121,7 @@ $filter->project->task->cookie['preProjectID'] = 'int'; $filter->project->task->cookie['productBrowseParam'] = 'int'; $filter->project->task->cookie['projectTaskOrder'] = 'reg::orderBy'; $filter->project->task->cookie['windowWidth'] = 'int'; +$filter->project->export->cookie['checkedItem'] = 'reg::checked'; $filter->qa->default->cookie['lastProduct'] = 'int'; $filter->qa->default->cookie['preBranch'] = 'int'; diff --git a/config/zentaopms.php b/config/zentaopms.php index e5dc9271ee..5b0b70f331 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -106,6 +106,7 @@ define('TABLE_ENTRY', '`' . $config->db->prefix . 'entry`'); define('TABLE_WEBHOOK', '`' . $config->db->prefix . 'webhook`'); define('TABLE_WEBHOOKDATAS', '`' . $config->db->prefix . 'webhookdatas`'); define('TABLE_LOG', '`' . $config->db->prefix . 'log`'); +define('TABLE_SCORE', '`' . $config->db->prefix . 'score`'); if(!defined('TABLE_LANG')) define('TABLE_LANG', '`' . $config->db->prefix . 'lang`'); $config->objectTables['product'] = TABLE_PRODUCT; diff --git a/lib/base/pager/pager.class.php b/lib/base/pager/pager.class.php index 0f55d8ccdf..6ab59865a4 100644 --- a/lib/base/pager/pager.class.php +++ b/lib/base/pager/pager.class.php @@ -545,6 +545,7 @@ class basePager vars = vars.replace('_recTotal_', recTotal) vars = vars.replace('_recPerPage_', recPerPage) vars = vars.replace('_pageID_', pageID); + $.get(createLink('score', 'ajax', "method=submitPage")); location.href=createLink('$this->moduleName', '$this->methodName', vars); } diff --git a/module/block/control.php b/module/block/control.php index 2b6c9a5d1d..dbddafe7cb 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -131,6 +131,7 @@ class block extends control $this->dao->delete()->from(TABLE_BLOCK)->where('`id`')->eq($id)->andWhere('account')->eq($this->app->user->account)->andWhere('module')->eq($module)->exec(); } if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); + $this->loadModel('score')->score('block', 'set'); $this->send(array('result' => 'success')); } @@ -157,6 +158,7 @@ class block extends control } if(dao::isError()) $this->send(array('result' => 'fail')); + $this->loadModel('score')->score('block', 'set'); $this->send(array('result' => 'success')); } diff --git a/module/block/model.php b/module/block/model.php index 42ea4fbb4e..4105500cfb 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -50,6 +50,7 @@ class blockModel extends model $data->params = helper::jsonEncode($data->params); $this->dao->replace(TABLE_BLOCK)->data($data)->exec(); + $this->loadModel('score')->score('block', 'set'); } /** diff --git a/module/bug/model.php b/module/bug/model.php index 8aa51a3250..8c47787223 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -85,6 +85,7 @@ class bugModel extends model $bugID = $this->dao->lastInsertID(); $this->file->updateObjectID($this->post->uid, $bugID, 'bug'); $this->file->saveUpload('bug', $bugID); + empty($bug->case) ? $this->loadModel('score')->score('bug', 'create', $bugID) : $this->loadModel('score')->score('bug', 'createFormCase', $bug->case); return array('status' => 'created', 'id' => $bugID); } return false; @@ -199,7 +200,7 @@ class bugModel extends model $this->dao->insert(TABLE_BUG)->data($bug)->autoCheck()->batchCheck($this->config->bug->create->requiredFields, 'notempty')->exec(); $bugID = $this->dao->lastInsertID(); - + $this->loadModel('score')->score('bug', 'create', $bugID); if(!empty($data->uploadImage[$i]) and !empty($file)) { $file['objectType'] = 'bug'; @@ -223,7 +224,7 @@ class bugModel extends model if(is_dir($realPath)) $classFile->removeDir($realPath); unset($_SESSION['bugImagesFile']); } - + $this->loadModel('score')->score('ajax', 'batchCreate'); return $actions; } @@ -654,7 +655,7 @@ class bugModel extends model } } } - + $this->loadModel('score')->score('ajax', 'batchEdit'); return $allChanges; } @@ -758,6 +759,7 @@ class bugModel extends model ->get(); $this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bugID)->exec(); + $this->loadModel('score')->score('bug', 'confirmBug', $oldBug); if(!dao::isError()) return common::createChanges($oldBug, $bug); } @@ -846,7 +848,7 @@ class bugModel extends model ->checkIF($bug->resolution == 'fixed', 'resolvedBuild','notempty') ->where('id')->eq((int)$bugID) ->exec(); - + $this->loadModel('score')->score('bug', 'resolve', $oldBug); /* Link bug to build and release. */ $this->linkBugToBuild($bugID, $bug->resolvedBuild); } @@ -1853,6 +1855,7 @@ class bugModel extends model $condition = "`type`='bug' and account='{$this->app->user->account}'"; $this->dao->insert(TABLE_USERTPL)->data($template)->batchCheck('title, content', 'notempty')->check('title', 'unique', $condition)->exec(); + $this->loadModel('score')->score('bug', 'saveTplModal', $this->dao->lastInsertID()); } /** diff --git a/module/build/model.php b/module/build/model.php index 7215c274c8..b120518b44 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -213,6 +213,7 @@ class buildModel extends model $buildID = $this->dao->lastInsertID(); $this->file->updateObjectID($this->post->uid, $buildID, 'build'); $this->file->saveUpload('build', $buildID); + $this->loadModel('score')->score('build', 'create', $buildID); return $buildID; } } diff --git a/module/common/lang/en.php b/module/common/lang/en.php index b07e0eba33..a9a47cbd8e 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -175,10 +175,14 @@ $lang->my->menu->dynamic = 'Dynamic|my|dynamic|'; $lang->my->menu->profile = array('link' => 'Profile|my|profile', 'alias' => 'editprofile'); $lang->my->menu->changePassword = 'Password|my|changepassword'; $lang->my->menu->manageContacts = 'Contact|my|managecontacts'; +$lang->my->menu->score = array('link' => 'Score|score|browse', 'subModule' => 'score'); $lang->todo = new stdclass(); $lang->todo->menu = $lang->my->menu; +$lang->score = new stdclass(); +$lang->score->menu = $lang->my->menu; + /* 产品视图设置。*/ $lang->product = new stdclass(); $lang->product->menu = new stdclass(); @@ -342,7 +346,6 @@ $lang->admin->menu->cron = array('link' => 'Cron|cron|index', 'subModule' = $lang->admin->menu->trashes = array('link' => 'Recycle|action|trash', 'subModule' => 'action'); $lang->admin->menu->dev = array('link' => 'Develop|dev|api', 'alias' => 'db', 'subModule' => 'dev,editor'); $lang->admin->menu->entry = array('link' => 'API|entry|browse', 'alias' => 'create,edit', 'subModule' => 'entry,webhook'); -$lang->admin->menu->score = array('link' => 'Score|score|browse', 'subModule' => 'score'); $lang->admin->menu->sso = 'RangerTeam|admin|sso'; $lang->convert = new stdclass(); @@ -355,7 +358,6 @@ $lang->editor = new stdclass(); $lang->mail = new stdclass(); $lang->cron = new stdclass(); $lang->dev = new stdclass(); -$lang->score = new stdclass(); $lang->entry = new stdclass(); $lang->webhook = new stdclass(); $lang->search = new stdclass(); @@ -370,7 +372,6 @@ $lang->custom->menu = $lang->admin->menu; $lang->editor->menu = $lang->admin->menu; $lang->mail->menu = $lang->admin->menu; $lang->dev->menu = $lang->admin->menu; -$lang->score->menu = $lang->admin->menu; $lang->entry->menu = $lang->admin->menu; $lang->webhook->menu = $lang->admin->menu; @@ -395,6 +396,7 @@ $lang->menugroup->testreport = 'qa'; $lang->menugroup->people = 'company'; $lang->menugroup->dept = 'company'; $lang->menugroup->todo = 'my'; +$lang->menugroup->score = 'my'; $lang->menugroup->action = 'admin'; $lang->menugroup->backup = 'admin'; $lang->menugroup->cron = 'admin'; @@ -403,7 +405,6 @@ $lang->menugroup->custom = 'admin'; $lang->menugroup->editor = 'admin'; $lang->menugroup->mail = 'admin'; $lang->menugroup->dev = 'admin'; -$lang->menugroup->score = 'admin'; $lang->menugroup->entry = 'admin'; $lang->menugroup->webhook = 'admin'; diff --git a/module/common/lang/menuOrder.php b/module/common/lang/menuOrder.php index 3ebb7c9c39..03dd92422e 100644 --- a/module/common/lang/menuOrder.php +++ b/module/common/lang/menuOrder.php @@ -25,6 +25,7 @@ $lang->my->menuOrder[40] = 'myProject'; $lang->my->menuOrder[45] = 'dynamic'; $lang->my->menuOrder[50] = 'profile'; $lang->my->menuOrder[55] = 'changePassword'; +$lang->my->menuOrder[60] = 'score'; $lang->todo->menuOrder = $lang->my->menuOrder; /* product menu order. */ diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index b00eef0caf..c5c51831e8 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -167,18 +167,22 @@ $lang->my->menu->account = array('link' => 'projectCommon}|my|project|"; $lang->my->menu->dynamic = '动态|my|dynamic|'; $lang->my->menu->profile = array('link' => '档案|my|profile', 'alias' => 'editprofile'); $lang->my->menu->changePassword = '密码|my|changepassword'; $lang->my->menu->manageContacts = '联系人|my|managecontacts'; +$lang->my->menu->score = array('link' => '积分|score|browse', 'subModule' => 'score'); -$lang->todo = new stdclass(); +$lang->todo = new stdclass(); $lang->todo->menu = $lang->my->menu; +$lang->score = new stdclass(); +$lang->score->menu = $lang->my->menu; + /* 产品视图设置。*/ $lang->product = new stdclass(); $lang->product->menu = new stdclass(); @@ -342,7 +346,6 @@ $lang->admin->menu->cron = array('link' => '计划任务|cron|index', 'subM $lang->admin->menu->trashes = array('link' => '回收站|action|trash', 'subModule' => 'action'); $lang->admin->menu->dev = array('link' => '二次开发|dev|api', 'alias' => 'db', 'subModule' => 'dev,editor'); $lang->admin->menu->entry = array('link' => '接口|entry|browse', 'alias' => 'create,edit', 'subModule' => 'entry,webhook'); -$lang->admin->menu->score = array('link' => '积分|score|browse', 'subModule' => 'score'); $lang->admin->menu->sso = '然之集成|admin|sso'; $lang->convert = new stdclass(); @@ -358,7 +361,6 @@ $lang->dev = new stdclass(); $lang->entry = new stdclass(); $lang->webhook = new stdclass(); $lang->search = new stdclass(); -$lang->score = new stdclass(); $lang->convert->menu = $lang->admin->menu; $lang->upgrade->menu = $lang->admin->menu; @@ -370,7 +372,6 @@ $lang->custom->menu = $lang->admin->menu; $lang->editor->menu = $lang->admin->menu; $lang->mail->menu = $lang->admin->menu; $lang->dev->menu = $lang->admin->menu; -$lang->score->menu = $lang->admin->menu; $lang->entry->menu = $lang->admin->menu; $lang->webhook->menu = $lang->admin->menu; @@ -395,6 +396,7 @@ $lang->menugroup->testreport = 'qa'; $lang->menugroup->people = 'company'; $lang->menugroup->dept = 'company'; $lang->menugroup->todo = 'my'; +$lang->menugroup->score = 'my'; $lang->menugroup->action = 'admin'; $lang->menugroup->backup = 'admin'; $lang->menugroup->cron = 'admin'; @@ -403,7 +405,6 @@ $lang->menugroup->custom = 'admin'; $lang->menugroup->editor = 'admin'; $lang->menugroup->mail = 'admin'; $lang->menugroup->dev = 'admin'; -$lang->menugroup->score = 'admin'; $lang->menugroup->entry = 'admin'; $lang->menugroup->webhook = 'admin'; diff --git a/module/common/lang/zh-tw.php b/module/common/lang/zh-tw.php index d05ad0e980..4a68c6a53b 100644 --- a/module/common/lang/zh-tw.php +++ b/module/common/lang/zh-tw.php @@ -175,10 +175,14 @@ $lang->my->menu->dynamic = '動態|my|dynamic|'; $lang->my->menu->profile = array('link' => '檔案|my|profile', 'alias' => 'editprofile'); $lang->my->menu->changePassword = '密碼|my|changepassword'; $lang->my->menu->manageContacts = '聯繫人|my|managecontacts'; +$lang->my->menu->score = array('link' => '積分|score|browse', 'subModule' => 'score'); $lang->todo = new stdclass(); $lang->todo->menu = $lang->my->menu; +$lang->score = new stdclass(); +$lang->scoret->menu = $lang->my->menu; + /* 產品視圖設置。*/ $lang->product = new stdclass(); $lang->product->menu = new stdclass(); @@ -341,7 +345,6 @@ $lang->admin->menu->safe = array('link' => '安全|admin|safe', 'alias' => $lang->admin->menu->cron = array('link' => '計劃任務|cron|index', 'subModule' => 'cron'); $lang->admin->menu->trashes = array('link' => '資源回收筒|action|trash', 'subModule' => 'action'); $lang->admin->menu->dev = array('link' => '二次開發|dev|api', 'alias' => 'db', 'subModule' => 'dev,editor'); -$lang->admin->menu->score = array('link' => '積分|score|browse', 'subModule' => 'score'); $lang->admin->menu->sso = '然之整合|admin|sso'; $lang->convert = new stdclass(); @@ -355,7 +358,6 @@ $lang->mail = new stdclass(); $lang->cron = new stdclass(); $lang->dev = new stdclass(); $lang->search = new stdclass(); -$lang->score = new stdclass(); $lang->convert->menu = $lang->admin->menu; $lang->upgrade->menu = $lang->admin->menu; @@ -367,7 +369,6 @@ $lang->custom->menu = $lang->admin->menu; $lang->editor->menu = $lang->admin->menu; $lang->mail->menu = $lang->admin->menu; $lang->dev->menu = $lang->admin->menu; -$lang->scoret->menu = $lang->admin->menu; /* 菜單分組。*/ $lang->menugroup = new stdclass(); @@ -390,6 +391,7 @@ $lang->menugroup->testreport = 'qa'; $lang->menugroup->people = 'company'; $lang->menugroup->dept = 'company'; $lang->menugroup->todo = 'my'; +$lang->menugroup->score = 'my'; $lang->menugroup->action = 'admin'; $lang->menugroup->backup = 'admin'; $lang->menugroup->cron = 'admin'; @@ -398,7 +400,6 @@ $lang->menugroup->custom = 'admin'; $lang->menugroup->editor = 'admin'; $lang->menugroup->mail = 'admin'; $lang->menugroup->dev = 'admin'; -$lang->menugroup->score = 'admin'; /* 錯誤提示信息。*/ $lang->error = new stdclass(); diff --git a/module/common/model.php b/module/common/model.php index 1f3f0e244f..0fb9910539 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -164,6 +164,7 @@ class commonModel extends model if($module == 'tutorial') return true; if($module == 'block') return true; if($module == 'product' and $method == 'showerrornone') return true; + if($module == 'score' and $method == 'browse') return true; } return false; } @@ -1131,7 +1132,6 @@ class commonModel extends model /* Check is the super admin or not. */ if(!empty($app->user->admin)) return true; - /* If not super admin, check the rights. */ $rights = $app->user->rights['rights']; $acls = $app->user->rights['acls']; diff --git a/module/common/view/datatable.fix.html.php b/module/common/view/datatable.fix.html.php index 0d9f8abd03..bf17d7ad25 100644 --- a/module/common/view/datatable.fix.html.php +++ b/module/common/view/datatable.fix.html.php @@ -49,6 +49,7 @@ $(function() success:function(){if(reload) window.location.reload();}, url: 'createLink('datatable', 'ajaxSave')?>' }); + $.get(createLink('score', 'ajax', "method=switchToDataTable")); }; window.saveDatatableConfig = saveDatatableConfig; }); diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index 11c4861bb0..403292a831 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -1,21 +1,22 @@ custom->common = 'Custom'; -$lang->custom->index = 'Home'; -$lang->custom->set = 'Customize'; -$lang->custom->restore = 'Reset to Default'; -$lang->custom->key = 'Key'; -$lang->custom->value = 'Value'; -$lang->custom->flow = 'Process'; -$lang->custom->working = 'Working'; -$lang->custom->select = 'Select Process'; -$lang->custom->branch = 'Multi Branch'; -$lang->custom->owner = 'Owner'; -$lang->custom->module = 'Module'; -$lang->custom->section = 'Section'; -$lang->custom->lang = 'Language'; -$lang->custom->setPublic = 'Set Public'; -$lang->custom->required = 'Required'; -$lang->custom->score = 'Score'; +$lang->custom->common = 'Custom'; +$lang->custom->index = 'Home'; +$lang->custom->set = 'Customize'; +$lang->custom->restore = 'Reset to Default'; +$lang->custom->key = 'Key'; +$lang->custom->value = 'Value'; +$lang->custom->flow = 'Process'; +$lang->custom->working = 'Working'; +$lang->custom->select = 'Select Process'; +$lang->custom->branch = 'Multi Branch'; +$lang->custom->owner = 'Owner'; +$lang->custom->module = 'Module'; +$lang->custom->section = 'Section'; +$lang->custom->lang = 'Language'; +$lang->custom->setPublic = 'Set Public'; +$lang->custom->required = 'Required'; +$lang->custom->score = 'Score'; +$lang->custom->scoreReset = 'Reset Score'; $lang->custom->object['story'] = 'Story'; $lang->custom->object['task'] = 'Task'; diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php index 724a8eab32..4c9205a2c6 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -1,21 +1,22 @@ custom->common = '自定义'; -$lang->custom->index = '首页'; -$lang->custom->set = '自定义配置'; -$lang->custom->restore = '恢复默认'; -$lang->custom->key = '键'; -$lang->custom->value = '值'; -$lang->custom->flow = '流程'; -$lang->custom->working = '工作方式'; -$lang->custom->select = '请选择流程:'; -$lang->custom->branch = '多分支'; -$lang->custom->owner = '所有者'; -$lang->custom->module = '模块'; -$lang->custom->section = '附加部分'; -$lang->custom->lang = '所属语言'; -$lang->custom->setPublic = '设为公共'; -$lang->custom->required = '必填项'; -$lang->custom->score = '积分'; +$lang->custom->common = '自定义'; +$lang->custom->index = '首页'; +$lang->custom->set = '自定义配置'; +$lang->custom->restore = '恢复默认'; +$lang->custom->key = '键'; +$lang->custom->value = '值'; +$lang->custom->flow = '流程'; +$lang->custom->working = '工作方式'; +$lang->custom->select = '请选择流程:'; +$lang->custom->branch = '多分支'; +$lang->custom->owner = '所有者'; +$lang->custom->module = '模块'; +$lang->custom->section = '附加部分'; +$lang->custom->lang = '所属语言'; +$lang->custom->setPublic = '设为公共'; +$lang->custom->required = '必填项'; +$lang->custom->score = '积分'; +$lang->custom->scoreReset = '重置积分'; $lang->custom->object['story'] = '需求'; $lang->custom->object['task'] = '任务'; diff --git a/module/custom/lang/zh-tw.php b/module/custom/lang/zh-tw.php index 72ee63581c..2558d4505a 100644 --- a/module/custom/lang/zh-tw.php +++ b/module/custom/lang/zh-tw.php @@ -1,19 +1,20 @@ custom->common = '自定義'; -$lang->custom->index = '首頁'; -$lang->custom->set = '自定義配置'; -$lang->custom->restore = '恢復預設'; -$lang->custom->key = '鍵'; -$lang->custom->value = '值'; -$lang->custom->flow = '流程'; -$lang->custom->working = '工作方式'; -$lang->custom->select = '請選擇流程:'; -$lang->custom->branch = '多分支'; -$lang->custom->owner = '所有者'; -$lang->custom->module = '模組'; -$lang->custom->section = '附加部分'; -$lang->custom->lang = '所屬語言'; -$lang->custom->score = '積分'; +$lang->custom->common = '自定義'; +$lang->custom->index = '首頁'; +$lang->custom->set = '自定義配置'; +$lang->custom->restore = '恢復預設'; +$lang->custom->key = '鍵'; +$lang->custom->value = '值'; +$lang->custom->flow = '流程'; +$lang->custom->working = '工作方式'; +$lang->custom->select = '請選擇流程:'; +$lang->custom->branch = '多分支'; +$lang->custom->owner = '所有者'; +$lang->custom->module = '模組'; +$lang->custom->section = '附加部分'; +$lang->custom->lang = '所屬語言'; +$lang->custom->score = '積分'; +$lang->custom->scoreReset = '重置積分'; $lang->custom->object['story'] = '需求'; $lang->custom->object['task'] = '任務'; diff --git a/module/custom/model.php b/module/custom/model.php index 9da99345ac..978859cc16 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -282,12 +282,11 @@ class customModel extends model $allMenu = $module == 'main' ? $lang->menu : (isset($lang->$module->menu) ? $lang->$module->menu : $lang->my->menu); if($module == 'product' and isset($allMenu->branch)) $allMenu->branch = str_replace('@branch@', $lang->custom->branch, $allMenu->branch); if($module != 'main' and isset($lang->menugroup->$module)) $module = $lang->menugroup->$module; - if($module == 'admin' and empty($config->global->score)) unset($allMenu->score); $flowModule = $config->global->flow . '_' . $module; $customMenu = isset($config->customMenu->$flowModule) ? $config->customMenu->$flowModule : array(); if(commonModel::isTutorialMode() && $module === 'main')$customMenu = 'my,product,project,qa,company'; if(!empty($customMenu) && is_string($customMenu) && substr($customMenu, 0, 1) === '[') $customMenu = json_decode($customMenu); - + if($module == 'my' && empty($config->global->score)) unset($allMenu->score); $menu = self::setMenuByConfig($allMenu, $customMenu, $module); return $menu; } @@ -373,6 +372,7 @@ class customModel extends model } $this->loadModel('setting')->setItem($settingKey, $menu); + $this->loadModel('score')->score('ajax', 'customMenu'); } /** diff --git a/module/custom/view/score.html.php b/module/custom/view/score.html.php index 3449b9a501..9b3127bd93 100644 --- a/module/custom/view/score.html.php +++ b/module/custom/view/score.html.php @@ -19,7 +19,7 @@ - + " . $lang->custom->scoreReset, '', "class='btn'");?> diff --git a/module/doc/model.php b/module/doc/model.php index 499aeb7f9e..b453f3976b 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -431,6 +431,7 @@ class docModel extends model $docContent->doc = $docID; $docContent->files = join(',', array_keys($files)); $this->dao->insert(TABLE_DOCCONTENT)->data($docContent)->exec(); + $this->loadModel('score')->score('doc', 'create', $docID); return array('status' => 'new', 'id' => $docID); } return false; diff --git a/module/product/config.php b/module/product/config.php index f0b1a036d8..b47f613d0c 100644 --- a/module/product/config.php +++ b/module/product/config.php @@ -7,6 +7,9 @@ $config->product->customBatchEditFields = 'PO,QD,RD,status,type,desc'; $config->product->custom = new stdclass(); $config->product->custom->batchEditFields = 'PO,QD,RD,status'; +$config->product->list = new stdclass(); +$config->product->list->exportFields = 'id,name,activeStories,changedStories,draftStories,closedStories,plans,releases,bugs,unResolvedBugs,assignToNullBugs'; + global $lang, $app; $app->loadLang('story'); $config->product->search['module'] = 'story'; diff --git a/module/product/control.php b/module/product/control.php index 9b2977fade..67894978b1 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -660,6 +660,55 @@ class product extends control $this->display(); } + /** + * Export product. + * + * @param string $status + * @param string $orderBy + * @access public + * @return void + */ + public function export($status, $orderBy) + { + if($_POST) + { + $productLang = $this->lang->product; + $productConfig = $this->config->product; + + /* Create field lists. */ + $fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $productConfig->list->exportFields); + foreach($fields as $key => $fieldName) + { + $fieldName = trim($fieldName); + $fields[$fieldName] = zget($productLang, $fieldName); + unset($fields[$key]); + } + + $productStats = $this->product->getStats($orderBy, null, $status); + foreach($productStats as $i => $product) + { + $product->activeStories = (int)$product->stories['active']; + $product->changedStories = (int)$product->stories['changed']; + $product->draftStories = (int)$product->stories['draft']; + $product->closedStories = (int)$product->stories['closed']; + $product->unResolvedBugs = (int)$product->unResolved; + $product->assignToNullBugs = (int)$product->assignToNull; + + if($this->post->exportType == 'selected') + { + $checkedItem = $this->cookie->checkedItem; + if(strpos(",$checkedItem,", ",{$product->id},") === false) unset($productStats[$i]); + } + } + + $this->post->set('fields', $fields); + $this->post->set('rows', $productStats); + $this->post->set('kind', 'product'); + $this->fetch('file', 'export2' . $this->post->fileType, $_POST); + } + $this->display(); + } + /** * Doc for compatible. * diff --git a/module/product/lang/en.php b/module/product/lang/en.php index 563b50f988..6d2a7c0556 100644 --- a/module/product/lang/en.php +++ b/module/product/lang/en.php @@ -26,6 +26,7 @@ $lang->product->other = 'Other:'; $lang->product->closed = 'Closed'; $lang->product->updateOrder = 'Ranking'; $lang->product->all = "All {$lang->productCommon}"; +$lang->product->export = "Export"; $lang->product->basicInfo = 'Basic Info'; $lang->product->otherInfo = 'Other Info'; @@ -42,6 +43,13 @@ $lang->product->doc = 'Documents'; $lang->product->project = $lang->projectCommon . 'List'; $lang->product->build = 'Build List'; +$lang->product->activeStories = 'Activated Story'; +$lang->product->changedStories = 'Changed Story'; +$lang->product->draftStories = 'Draft Story'; +$lang->product->closedStories = 'Closed Story'; +$lang->product->unResolvedBugs = 'Unresolved Bug'; +$lang->product->assignToNullBugs = 'No Assigned Bug'; + $lang->product->confirmDelete = " Do you want to delete {$lang->productCommon}?"; $lang->product->errorNoProduct = "{$lang->productCommon} is not created yet!"; diff --git a/module/product/lang/zh-cn.php b/module/product/lang/zh-cn.php index d0be9f125e..a9e87d8f87 100644 --- a/module/product/lang/zh-cn.php +++ b/module/product/lang/zh-cn.php @@ -26,6 +26,7 @@ $lang->product->other = '其他:'; $lang->product->closed = '已关闭'; $lang->product->updateOrder = "排序"; $lang->product->all = "所有{$lang->productCommon}"; +$lang->product->export = "导出"; $lang->product->basicInfo = '基本信息'; $lang->product->otherInfo = '其他信息'; @@ -42,11 +43,19 @@ $lang->product->doc = '文档列表'; $lang->product->project = $lang->projectCommon . '列表'; $lang->product->build = '版本列表'; +$lang->product->activeStories = '激活需求'; +$lang->product->changedStories = '已变更需求'; +$lang->product->draftStories = '草稿需求'; +$lang->product->closedStories = '已关闭需求'; +$lang->product->unResolvedBugs = '未解决Bug'; +$lang->product->assignToNullBugs = '未指派Bug'; + $lang->product->confirmDelete = " 您确定删除该{$lang->productCommon}吗?"; $lang->product->errorNoProduct = "还没有创建{$lang->productCommon}!"; $lang->product->accessDenied = "您无权访问该{$lang->productCommon}"; +$lang->product->id = "编号"; $lang->product->name = "{$lang->productCommon}名称"; $lang->product->code = "{$lang->productCommon}代号"; $lang->product->order = '排序'; diff --git a/module/product/view/all.html.php b/module/product/view/all.html.php index f1cf762c1b..250e5133d0 100644 --- a/module/product/view/all.html.php +++ b/module/product/view/all.html.php @@ -13,6 +13,10 @@
+ createLink('product', 'export', "status=$status&orderBy=$orderBy"); + if(common::hasPriv('product', 'export'))echo html::a($link, " " . $lang->export, '', "class='export btn'"); + ?> createLink('product', 'create'), " " . $lang->product->create,'', "class='btn'") ?>