diff --git a/Readme_zh.md b/Readme_zh.md index b655076313..369f9a36f4 100644 --- a/Readme_zh.md +++ b/Readme_zh.md @@ -20,7 +20,7 @@ 5. 灵活的扩展机制,可以保证您不局限于禅道自身的功能。 6. 日趋完善的社区机制,可以获得及时的技术支持和帮助,保证您无后顾之忧。 7. 几乎为零的投入,禅道作为开源软件,其投入几乎为零,相比动辄十几万的商业软件,您选择禅道没有任何风险。 -8. 开发团队已经公司化运作,保证软件的持久发展。我们从04年从事开源软件开发以来,已经坚持了六年。 +8. 开发团队已经公司化运作,保证软件的持久发展。我们从04年从事开源软件开发以来,已经坚持了六年。 五、禅道的功能列表: @@ -29,10 +29,10 @@ 3. 质量管理:包括bug、测试用例、测试任务、测试结果等功能。 4. 文档管理:包括产品文档库、项目文档库、自定义文档库等功能。 5. 事务管理:包括todo管理,我的任务、我的Bug、我的需求、我的项目等个人事务管理功能。 -6. 组织管理:包括部门、用户、分组、权限等功能。 -7. 统计功能:丰富的统计表。 -8. 搜索功能:强大的搜索,帮助您找到相应的数据。 -9. 灵活的扩展机制,几乎可以对禅道的任何地方进行扩展。 +6. 组织管理:包括部门、用户、分组、权限等功能。 +7. 统计功能:丰富的统计表。 +8. 搜索功能:强大的搜索,帮助您找到相应的数据。 +9. 灵活的扩展机制,几乎可以对禅道的任何地方进行扩展。 10. 强大的api机制,方便与其他系统集成。 diff --git a/config/zentaopms.php b/config/zentaopms.php index 1b1ede7a65..8933ef5f0f 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -101,6 +101,9 @@ define('TABLE_DOCCONTENT', '`' . $config->db->prefix . 'doccontent`'); define('TABLE_TESTSUITE', '`' . $config->db->prefix . 'testsuite`'); define('TABLE_SUITECASE', '`' . $config->db->prefix . 'suitecase`'); define('TABLE_TESTREPORT', '`' . $config->db->prefix . 'testreport`'); + +define('TABLE_ENTRY', '`' . $config->db->prefix . 'entry`'); +define('TABLE_WEBHOOK', '`' . $config->db->prefix . 'webhook`'); if(!defined('TABLE_LANG')) define('TABLE_LANG', '`' . $config->db->prefix . 'lang`'); $config->objectTables['product'] = TABLE_PRODUCT; diff --git a/db/update9.5.1.sql b/db/update9.5.1.sql new file mode 100644 index 0000000000..88c7cd1fdb --- /dev/null +++ b/db/update9.5.1.sql @@ -0,0 +1,29 @@ +-- DROP TABLE IF EXISTS `zt_entry`; +CREATE TABLE IF NOT EXISTS `zt_entry` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `code` varchar(20) NOT NULL, + `key` varchar(32) NOT NULL, + `ip` varchar(100) NOT NULL, + `desc` text NOT NULL, + `createdBy` varchar(30) NOT NULL, + `createdDate` datetime NOT NULL, + `editedBy` varchar(30) NOT NULL, + `editedDate` datetime NOT NULL, + PRIMARY KEY `id` (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +-- DROP TABLE IF EXISTS `zt_webhook`; +CREATE TABLE IF NOT EXISTS `zt_webhook` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL, + `url` varchar(255) NOT NULL, + `requestType` enum('post', 'get') NOT NULL DEFAULT 'get', + `params` text NOT NULL, + `desc` text NOT NULL, + `createdBy` varchar(30) NOT NULL, + `createdDate` datetime NOT NULL, + `editedBy` varchar(30) NOT NULL, + `editedDate` datetime NOT NULL, + PRIMARY KEY `id` (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/module/action/model.php b/module/action/model.php index 03f975328c..5f1a54b01d 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -53,7 +53,7 @@ class actionModel extends model /* Get product and project for this object. */ $productAndProject = $this->getProductAndProject($action->objectType, $objectID); $action->product = $productAndProject['product']; - $action->project = $productAndProject['project']; + $action->project = (int)$productAndProject['project']; $this->dao->insert(TABLE_ACTION)->data($action)->autoCheck()->exec(); $actionID = $this->dbh->lastInsertID(); diff --git a/module/bug/config.php b/module/bug/config.php index 5f95ff8482..c9596cd8ac 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -165,7 +165,7 @@ $config->bug->search['params']['lastEditedDate']= array('operator' => '=', $config->bug->search['params']['deadline'] = array('operator' => '=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->bug->datatable = new stdclass(); -$config->bug->datatable->defaultField = array('id', 'severity', 'pri', 'title', 'status', 'openedBy', 'openedDate', 'assignedTo', 'resolvedBy', 'resolution', 'resolvedDate', 'actions'); +$config->bug->datatable->defaultField = array('id', 'severity', 'pri', 'title', 'status', 'openedBy', 'openedDate', 'assignedTo', 'resolvedBy', 'resolution', 'actions'); $config->bug->datatable->fieldList['id']['title'] = 'idAB'; $config->bug->datatable->fieldList['id']['fixed'] = 'left'; @@ -174,7 +174,7 @@ $config->bug->datatable->fieldList['id']['required'] = 'yes'; $config->bug->datatable->fieldList['severity']['title'] = 'severityAB'; $config->bug->datatable->fieldList['severity']['fixed'] = 'left'; -$config->bug->datatable->fieldList['severity']['width'] = '50'; +$config->bug->datatable->fieldList['severity']['width'] = '40'; $config->bug->datatable->fieldList['severity']['required'] = 'no'; $config->bug->datatable->fieldList['pri']['title'] = 'P'; @@ -187,11 +187,26 @@ $config->bug->datatable->fieldList['title']['fixed'] = 'left'; $config->bug->datatable->fieldList['title']['width'] = 'auto'; $config->bug->datatable->fieldList['title']['required'] = 'yes'; +$config->bug->datatable->fieldList['branch']['title'] = 'branch'; +$config->bug->datatable->fieldList['branch']['fixed'] = 'left'; +$config->bug->datatable->fieldList['branch']['width'] = '100'; +$config->bug->datatable->fieldList['branch']['required'] = 'no'; + $config->bug->datatable->fieldList['type']['title'] = 'type'; $config->bug->datatable->fieldList['type']['fixed'] = 'no'; $config->bug->datatable->fieldList['type']['width'] = '90'; $config->bug->datatable->fieldList['type']['required'] = 'no'; +$config->bug->datatable->fieldList['project']['title'] = 'project'; +$config->bug->datatable->fieldList['project']['fixed'] = 'no'; +$config->bug->datatable->fieldList['project']['width'] = '120'; +$config->bug->datatable->fieldList['project']['required'] = 'no'; + +$config->bug->datatable->fieldList['plan']['title'] = 'plan'; +$config->bug->datatable->fieldList['plan']['fixed'] = 'no'; +$config->bug->datatable->fieldList['plan']['width'] = '120'; +$config->bug->datatable->fieldList['plan']['required'] = 'no'; + $config->bug->datatable->fieldList['status']['title'] = 'statusAB'; $config->bug->datatable->fieldList['status']['fixed'] = 'no'; $config->bug->datatable->fieldList['status']['width'] = '80'; @@ -207,6 +222,41 @@ $config->bug->datatable->fieldList['activatedDate']['fixed'] = 'no'; $config->bug->datatable->fieldList['activatedDate']['width'] = '90'; $config->bug->datatable->fieldList['activatedDate']['required'] = 'no'; +$config->bug->datatable->fieldList['story']['title'] = 'story'; +$config->bug->datatable->fieldList['story']['fixed'] = 'no'; +$config->bug->datatable->fieldList['story']['width'] = '120'; +$config->bug->datatable->fieldList['story']['required'] = 'no'; + +$config->bug->datatable->fieldList['task']['title'] = 'task'; +$config->bug->datatable->fieldList['task']['fixed'] = 'no'; +$config->bug->datatable->fieldList['task']['width'] = '120'; +$config->bug->datatable->fieldList['task']['required'] = 'no'; + +$config->bug->datatable->fieldList['keywords']['title'] = 'keywords'; +$config->bug->datatable->fieldList['keywords']['fixed'] = 'no'; +$config->bug->datatable->fieldList['keywords']['width'] = '100'; +$config->bug->datatable->fieldList['keywords']['required'] = 'no'; + +$config->bug->datatable->fieldList['os']['title'] = 'os'; +$config->bug->datatable->fieldList['os']['fixed'] = 'no'; +$config->bug->datatable->fieldList['os']['width'] = '80'; +$config->bug->datatable->fieldList['os']['required'] = 'no'; + +$config->bug->datatable->fieldList['browser']['title'] = 'browser'; +$config->bug->datatable->fieldList['browser']['fixed'] = 'no'; +$config->bug->datatable->fieldList['browser']['width'] = '80'; +$config->bug->datatable->fieldList['browser']['required'] = 'no'; + +$config->bug->datatable->fieldList['found']['title'] = 'found'; +$config->bug->datatable->fieldList['found']['fixed'] = 'no'; +$config->bug->datatable->fieldList['found']['width'] = '80'; +$config->bug->datatable->fieldList['found']['required'] = 'no'; + +$config->bug->datatable->fieldList['mailto']['title'] = 'mailto'; +$config->bug->datatable->fieldList['mailto']['fixed'] = 'no'; +$config->bug->datatable->fieldList['mailto']['width'] = '100'; +$config->bug->datatable->fieldList['mailto']['required'] = 'no'; + $config->bug->datatable->fieldList['openedBy']['title'] = 'openedByAB'; $config->bug->datatable->fieldList['openedBy']['fixed'] = 'no'; $config->bug->datatable->fieldList['openedBy']['width'] = '80'; @@ -267,6 +317,11 @@ $config->bug->datatable->fieldList['closedDate']['fixed'] = 'no'; $config->bug->datatable->fieldList['closedDate']['width'] = '90'; $config->bug->datatable->fieldList['closedDate']['required'] = 'no'; +$config->bug->datatable->fieldList['lastEditedBy']['title'] = 'lastEditedBy'; +$config->bug->datatable->fieldList['lastEditedBy']['fixed'] = 'no'; +$config->bug->datatable->fieldList['lastEditedBy']['width'] = '80'; +$config->bug->datatable->fieldList['lastEditedBy']['required'] = 'no'; + $config->bug->datatable->fieldList['lastEditedDate']['title'] = 'lastEditedDateAB'; $config->bug->datatable->fieldList['lastEditedDate']['fixed'] = 'no'; $config->bug->datatable->fieldList['lastEditedDate']['width'] = '90'; @@ -276,8 +331,3 @@ $config->bug->datatable->fieldList['actions']['title'] = 'actions'; $config->bug->datatable->fieldList['actions']['fixed'] = 'right'; $config->bug->datatable->fieldList['actions']['width'] = '140'; $config->bug->datatable->fieldList['actions']['required'] = 'yes'; - -$config->bug->datatable->fieldList['branch']['title'] = 'branch'; -$config->bug->datatable->fieldList['branch']['fixed'] = 'left'; -$config->bug->datatable->fieldList['branch']['width'] = '100'; -$config->bug->datatable->fieldList['branch']['required'] = 'no'; diff --git a/module/bug/control.php b/module/bug/control.php index 3694f79dba..95ac916703 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -121,6 +121,16 @@ class bug extends control /* Process the openedBuild and resolvedBuild fields. */ $bugs = $this->bug->processBuildForBugs($bugs); + /* Get story and task id list. */ + $storyIdList = $taskIdList = array(); + foreach($bugs as $bug) + { + if($bug->story) $storyIdList[$bug->story] = $bug->story; + if($bug->task) $taskIdList[$bug->task] = $bug->task; + } + $storyList = $storyIdList ? $this->loadModel('story')->getByList($storyIdList) : array(); + $taskList = $taskIdList ? $this->loadModel('task')->getByList($taskIdList) : array(); + /* Build the search form. */ $actionURL = $this->createLink('bug', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID"); $this->config->bug->search['onMenuBar'] = 'yes'; @@ -150,6 +160,10 @@ class bug extends control $this->view->memberPairs = $this->user->getPairs('noletter|nodeleted'); $this->view->branch = $branch; $this->view->branches = $this->loadModel('branch')->getPairs($productID); + $this->view->projects = $projects; + $this->view->plans = $this->loadModel('productplan')->getPairs($productID); + $this->view->stories = $storyList; + $this->view->tasks = $taskList; $this->view->setShowModule = true; $this->display(); diff --git a/module/bug/lang/en.php b/module/bug/lang/en.php index 613c15c005..5d969c580a 100644 --- a/module/bug/lang/en.php +++ b/module/bug/lang/en.php @@ -51,6 +51,7 @@ $lang->bug->resolvedBuild = 'Resolved Build'; $lang->bug->resolvedDate = 'Resolved On'; $lang->bug->resolvedDateAB = 'Resolved On'; $lang->bug->deadline = 'Deadline'; +$lang->bug->plan = 'Plan'; $lang->bug->closedBy = 'Closed By'; $lang->bug->closedDate = 'Closed On'; $lang->bug->duplicateBug = 'Duplicate'; diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index bdca46ec46..6a265b1ca1 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -51,6 +51,7 @@ $lang->bug->resolvedBuild = '解决版本'; $lang->bug->resolvedDate = '解决日期'; $lang->bug->resolvedDateAB = '解决日期'; $lang->bug->deadline = '截止日期'; +$lang->bug->plan = '所属计划'; $lang->bug->closedBy = '由谁关闭'; $lang->bug->closedDate = '关闭日期'; $lang->bug->duplicateBug = '重复ID'; diff --git a/module/bug/model.php b/module/bug/model.php index 0dda750fba..33e52442e6 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2310,7 +2310,7 @@ class bugModel extends model * @access public * @return void */ - public function printCell($col, $bug, $users, $builds, $branches, $modulePairs) + public function printCell($col, $bug, $users, $builds, $branches, $modulePairs, $projects = array(), $plans = array(), $stories = array(), $tasks = array()) { $bugLink = inlink('view', "bugID=$bug->id"); $account = $this->app->user->account; @@ -2349,6 +2349,18 @@ class bugModel extends model case 'branch': echo $branches[$bug->branch]; break; + case 'project': + echo zget($projects, $bug->project, ''); + break; + case 'plan': + echo zget($plans, $bug->plan, ''); + break; + case 'story': + echo zget($stories, $bug->story, ''); + break; + case 'task': + echo zget($tasks, $bug->task, ''); + break; case 'type': echo zget($this->lang->bug->typeList, $bug->type); break; @@ -2361,6 +2373,27 @@ class bugModel extends model case 'activatedDate': echo substr($bug->activatedDate, 5, 11); break; + case 'keywords': + echo $bug->keywords; + break; + case 'os': + echo zget($this->lang->bug->osList, $bug->os); + break; + case 'browser': + echo zget($this->lang->bug->browserList, $bug->browser); + break; + case 'mailto': + $mailto = explode(',', $bug->mailto); + foreach($mailto as $account) + { + $account = trim($account); + if(empty($account)) continue; + echo zget($users, $account) . "  "; + } + break; + case 'found': + echo zget($users, $bug->found); + break; case 'openedBy': echo zget($users, $bug->openedBy); break; @@ -2394,12 +2427,15 @@ class bugModel extends model case 'closedBy': echo zget($users, $bug->closedBy); break; - case 'lastEditedDate': - echo substr($bug->lastEditedDate, 5, 11); - break; case 'closedDate': echo substr($bug->closedDate, 5, 11); break; + case 'lastEditedBy': + echo zget($users, $bug->lastEditedBy); + break; + case 'lastEditedDate': + echo substr($bug->lastEditedDate, 5, 11); + break; case 'actions': $params = "bugID=$bug->id"; common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'search', '', 'iframe', true); diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index d2443e5a5e..a761bba051 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -168,16 +168,37 @@ js::set('branch', $branch); moduleName . ucfirst($this->methodName); $useDatatable = (isset($this->config->datatable->$datatableId->mode) and $this->config->datatable->$datatableId->mode == 'datatable'); - $file2Include = $useDatatable ? dirname(__FILE__) . '/datatabledata.html.php' : dirname(__FILE__) . '/browsedata.html.php'; $vars = "productID=$productID&branch=$branch&browseType=$browseType¶m=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; - include $file2Include; + if($useDatatable) include '../../common/view/datatable.html.php'; + + $setting = $this->datatable->getSetting('bug'); + $widths = $this->datatable->setFixedFieldWidth($setting); + $columns = 0; ?> + ' data-fixed-right-width='' data-custom-menu='true' data-checkbox-name='bugIDList[]'> + + + $value) + { + if($value->show) + { + $this->datatable->printHead($value, $orderBy, $vars); + $columns ++; + } + } + ?> + + + + + + $value) $this->bug->printCell($value, $bug, $users, $builds, $branches, $modulePairs, $projects, $plans, $stories, $tasks);?> + + + - cookie->windowWidth >= $this->config->wideSize ? 13 : 11; - if($browseType == 'needconfirm') $columns = 8; - ?>
diff --git a/module/bug/view/browsedata.html.php b/module/bug/view/browsedata.html.php deleted file mode 100644 index 46c59e165b..0000000000 --- a/module/bug/view/browsedata.html.php +++ /dev/null @@ -1,114 +0,0 @@ - - * @package bug - * @version $Id$ - * @link http://www.zentao.net - */ -?> - - - - - - - - - - - - - - - - - cookie->windowWidth >= $this->config->wideSize):?> - - - - - - - - cookie->windowWidth >= $this->config->wideSize):?> - - - - - - - - - - - id");?> - - - - - - confirmed;?> - - - - - - - - - - cookie->windowWidth >= $this->config->wideSize):?> - - - - - - - - cookie->windowWidth >= $this->config->wideSize):?> - - - - - - - - - diff --git a/module/bug/view/datatabledata.html.php b/module/bug/view/datatabledata.html.php deleted file mode 100644 index ebe823e1ca..0000000000 --- a/module/bug/view/datatabledata.html.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @package bug - * @version $Id$ - * @link http://www.zentao.net - */ -?> -datatable->getSetting('bug'); -$widths = $this->datatable->setFixedFieldWidth($setting); -extract($widths); -?> -
idAB);?> bug->severityAB);?> priAB);?> bug->title);?> bug->statusAB);?> bug->deadline);?>bug->story);?>actions;?>openedByAB);?>bug->openedDateAB);?>assignedToAB);?>bug->resolvedByAB);?>bug->resolutionAB);?>bug->resolvedDateAB);?>actions;?>
- - id));?> - bug->severityList, $bug->severity, $bug->severity);?>'>bug->severityList, $bug->severity, $bug->severity);?>bug->priList, $bug->pri, $bug->pri);?>'>bug->priList, $bug->pri, $bug->pri);?> - [{$lang->bug->confirmedList[$bug->confirmed]}] "; - if($bug->branch)echo "{$branches[$bug->branch]} "; - if($modulePairs and $bug->module)echo "{$modulePairs[$bug->module]} "; - echo html::a($bugLink, $bug->title, null, "style='color: $bug->color'"); - ?> - - needconfirm) - { - echo "({$lang->story->changed} "; - echo html::a($this->createLink('bug', 'confirmStoryChange', "bugID=$bug->id"), $lang->confirm, 'hiddenwin'); - echo ")"; - } - else - { - echo $lang->bug->statusList[$bug->status]; - } - ?> - deadline, 0, 4) > 0) echo substr($bug->deadline, 5, 6)?>createLink('story', 'view', "stoyID=$bug->story"), $bug->storyTitle, '_blank');?>bug->confirmStoryChange = $lang->confirm; common::printIcon('bug', 'confirmStoryChange', "bugID=$bug->id", '', 'list', '', 'hiddenwin')?>openedBy, $bug->openedBy);?>openedDate, 5, 11)?>assignedTo == $this->app->user->account) echo 'class="red"';?>>assignedTo, $bug->assignedTo);?>resolvedBy, $bug->resolvedBy)?>bug->resolutionList, $bug->resolution);?>resolvedDate, 5, 11)?> - id"; - common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'search', '', 'iframe', true); - common::printIcon('bug', 'assignTo', $params, $bug, 'list', '', '', 'iframe', true); - common::printIcon('bug', 'resolve', $params, $bug, 'list', '', '', 'iframe', true); - common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true); - common::printIcon('bug', 'edit', $params, $bug, 'list'); - common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=bugID=$bug->id", $bug, 'list', 'copy'); - ?> -
- - $value) $this->datatable->printHead($value, $orderBy, $vars);?> - - - - - $value) $this->bug->printCell($value, $bug, $users, $builds, $branches, $modulePairs);?> - - - diff --git a/module/common/lang/en.php b/module/common/lang/en.php index 7bfe9b4d5e..c5197e1709 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -341,6 +341,7 @@ $lang->admin->menu->safe = array('link' => 'Security|admin|safe', 'alias' = $lang->admin->menu->cron = array('link' => 'Cron|cron|index', 'subModule' => 'cron'); $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->sso = 'RangerTeam|admin|sso'; $lang->convert = new stdclass(); @@ -353,6 +354,8 @@ $lang->editor = new stdclass(); $lang->mail = new stdclass(); $lang->cron = new stdclass(); $lang->dev = new stdclass(); +$lang->entry = new stdclass(); +$lang->webhook = new stdclass(); $lang->search = new stdclass(); $lang->convert->menu = $lang->admin->menu; @@ -365,6 +368,7 @@ $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->webhook->menu = $lang->admin->menu; /* 菜单分组。*/ $lang->menugroup = new stdclass(); @@ -395,6 +399,8 @@ $lang->menugroup->custom = 'admin'; $lang->menugroup->editor = 'admin'; $lang->menugroup->mail = 'admin'; $lang->menugroup->dev = 'admin'; +$lang->menugroup->entry = 'admin'; +$lang->menugroup->webhook = 'admin'; /* 错误提示信息。*/ $lang->error = new stdclass(); diff --git a/module/common/lang/menuOrder.php b/module/common/lang/menuOrder.php index c1f0c8002d..3ebb7c9c39 100644 --- a/module/common/lang/menuOrder.php +++ b/module/common/lang/menuOrder.php @@ -118,6 +118,8 @@ $lang->admin->menuOrder[35] = 'cron'; $lang->admin->menuOrder[40] = 'backup'; $lang->admin->menuOrder[45] = 'dev'; $lang->admin->menuOrder[50] = 'safe'; +$lang->admin->menuOrder[53] = 'entry'; +$lang->admin->menuOrder[54] = 'webhook'; $lang->admin->menuOrder[55] = 'sso'; $lang->admin->menuOrder[60] = 'trashes'; $lang->convert->menuOrder = $lang->admin->menuOrder; @@ -130,3 +132,5 @@ $lang->custom->menuOrder = $lang->admin->menuOrder; $lang->editor->menuOrder = $lang->admin->menuOrder; $lang->mail->menuOrder = $lang->admin->menuOrder; $lang->dev->menuOrder = $lang->admin->menuOrder; +$lang->entry->menuOrder = $lang->admin->menuOrder; +$lang->webhook->menuOrder = $lang->admin->menuOrder; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 820f8dfda2..b960c80214 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -341,6 +341,7 @@ $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->entry = array('link' => '接口|entry|browse', 'alias' => 'create,edit', 'subModule' => 'entry,webhook'); $lang->admin->menu->sso = '然之集成|admin|sso'; $lang->convert = new stdclass(); @@ -353,6 +354,8 @@ $lang->editor = new stdclass(); $lang->mail = new stdclass(); $lang->cron = new stdclass(); $lang->dev = new stdclass(); +$lang->entry = new stdclass(); +$lang->webhook = new stdclass(); $lang->search = new stdclass(); $lang->convert->menu = $lang->admin->menu; @@ -365,6 +368,8 @@ $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->entry->menu = $lang->admin->menu; +$lang->webhook->menu = $lang->admin->menu; /* 菜单分组。*/ $lang->menugroup = new stdclass(); @@ -395,6 +400,8 @@ $lang->menugroup->custom = 'admin'; $lang->menugroup->editor = 'admin'; $lang->menugroup->mail = 'admin'; $lang->menugroup->dev = 'admin'; +$lang->menugroup->entry = 'admin'; +$lang->menugroup->webhook = 'admin'; /* 错误提示信息。*/ $lang->error = new stdclass(); diff --git a/module/common/model.php b/module/common/model.php index 797fdfdd13..941b993d29 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -817,7 +817,7 @@ class commonModel extends model if(strtolower($key) == 'closeddate' && $value == '') continue; if($magicQuote) $value = stripslashes($value); - if($value != stripslashes($old->$key)) + if(isset($old->$key) and $value != stripslashes($old->$key)) { $diff = ''; if(substr_count($value, "\n") > 1 or diff --git a/module/common/view/datatable.fix.html.php b/module/common/view/datatable.fix.html.php index 31d1f0b871..0d9f8abd03 100644 --- a/module/common/view/datatable.fix.html.php +++ b/module/common/view/datatable.fix.html.php @@ -9,17 +9,19 @@ -
+
custom->saveCustomMenu($menu->value, $menu->module, isset($menu->method) ? $menu->method : ''); @@ -374,11 +374,13 @@ class custom extends control * @access public * @return void */ - public function ajaxRestoreMenu($confirm = 'no') + public function ajaxRestoreMenu($setPublic = 0, $confirm = 'no') { - if($confirm == 'no') die(js::confirm($this->lang->custom->confirmRestore, inlink('ajaxRestoreMenu', "confirm=yes"))); + if($confirm == 'no') die(js::confirm($this->lang->custom->confirmRestore, inlink('ajaxRestoreMenu', "setPublic=$setPublic&confirm=yes"))); - $this->loadModel('setting')->deleteItems("owner={$this->app->user->account}&module=common§ion=customMenu"); + $account = $this->app->user->account; + if($setPublic) $account = 'system'; + $this->loadModel('setting')->deleteItems("owner={$account}&module=common§ion=customMenu"); die(js::reload('parent.parent')); } } diff --git a/module/custom/js/ajaxmenu.js b/module/custom/js/ajaxmenu.js index 5d28e83f53..44655c78a8 100644 --- a/module/custom/js/ajaxmenu.js +++ b/module/custom/js/ajaxmenu.js @@ -217,9 +217,10 @@ $(function() }); }); - postData = $.map(postData, JSON.stringify); + postData = $.map(postData, JSON.stringify); + setPublic = $('#setPublic1').prop('checked') ? 1 : 0; - $.post(createLink('custom', 'ajaxSetMenu'), {menus: postData}, function(data) + $.post(createLink('custom', 'ajaxSetMenu'), {menus: postData, setPublic: setPublic}, function(data) { if(data.result === 'success') window.parent.location.reload() if(data.message) alert(data.message); @@ -242,4 +243,10 @@ $(function() { window.parent.$.closeModal(); }); + + $('#resetMenuBtn').click(function() + { + var setPublic = $('#setPublic1').prop('checked') ? 1 : 0; + hiddenwin.location.href = createLink('custom', 'ajaxRestoreMenu', "public=" + setPublic); + }); }); diff --git a/module/custom/lang/en.php b/module/custom/lang/en.php index 0e45826aab..5fe8a27fe1 100644 --- a/module/custom/lang/en.php +++ b/module/custom/lang/en.php @@ -13,6 +13,7 @@ $lang->custom->owner = 'Owner'; $lang->custom->module = 'Module'; $lang->custom->section = 'Section'; $lang->custom->lang = 'Language'; +$lang->custom->setPublic = 'Set Public'; $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 914abf963f..b443b578a0 100644 --- a/module/custom/lang/zh-cn.php +++ b/module/custom/lang/zh-cn.php @@ -13,6 +13,7 @@ $lang->custom->owner = '所有者'; $lang->custom->module = '模块'; $lang->custom->section = '附加部分'; $lang->custom->lang = '所属语言'; +$lang->custom->setPublic = '设为公共'; $lang->custom->object['story'] = '需求'; $lang->custom->object['task'] = '任务'; diff --git a/module/custom/model.php b/module/custom/model.php index dae69c8b3f..1d10e5b9f8 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -359,6 +359,8 @@ class customModel extends model $account = $this->app->user->account; $settingKey = ''; + $setPublic = $this->post->setPublic; + if($setPublic) $account = 'system'; if(!is_string($menu)) $menu = json_encode($menu); $flow = $this->config->global->flow; diff --git a/module/custom/view/ajaxmenu.html.php b/module/custom/view/ajaxmenu.html.php index 3377f6b564..fdb196964d 100644 --- a/module/custom/view/ajaxmenu.html.php +++ b/module/custom/view/ajaxmenu.html.php @@ -32,9 +32,10 @@
+ $lang->custom->setPublic));?>     - custom->restore, 'hiddenwin', "class='btn'")?> +     custom->menuTip ?>
diff --git a/module/datatable/control.php b/module/datatable/control.php index 227df5fdf5..bfcbd6fea0 100644 --- a/module/datatable/control.php +++ b/module/datatable/control.php @@ -33,6 +33,7 @@ class datatable extends control if(!empty($_POST)) { $account = $this->app->user->account; + if($this->post->global) $account = 'system'; if($account == 'guest') $this->send(array('result' => 'fail', 'target' => $target, 'message' => 'guest.')); $name = $account . '.datatable.' . $this->post->target . '.' . $this->post->name; @@ -52,25 +53,61 @@ class datatable extends control */ public function ajaxCustom($module, $method) { - $account = $this->app->user->account; - $name = 'owner=' . $account . '&module=datatable§ion=' . $module . ucfirst($method) . '&key=cols'; + $target = $module . ucfirst($method); + $mode = isset($this->config->datatable->$target->mode) ? $this->config->datatable->$target->mode : 'table'; + $key = $mode == 'datatable' ? 'cols' : 'tablecols'; + if($module == 'testtask') { $this->loadModel('testcase'); $this->app->loadConfig('testtask'); $this->config->testcase->datatable->defaultField = $this->config->testtask->datatable->defaultField; - $this->config->testcase->datatable->fieldList['assignedTo']['title'] = 'assignedTo'; - $this->config->testcase->datatable->fieldList['assignedTo']['fixed'] = 'no'; - $this->config->testcase->datatable->fieldList['assignedTo']['width'] = '80'; - $this->config->testcase->datatable->fieldList['assignedTo']['required'] = 'no'; - $this->config->testcase->datatable->fieldList['actions']['width'] = '100'; + $this->config->testcase->datatable->fieldList['actions']['width'] = '100'; + } + if($module == 'testcase') + { + $this->loadModel('testcase'); + unset($this->config->testcase->datatable->fieldList['assignedTo']); } - $module = zget($this->config->datatable->moduleAlias, $module, $module); - $this->view->cols = $this->datatable->getFieldList($module); - $this->view->setting = $this->loadModel('setting')->getItem($name); - if(empty($this->view->setting)) $this->view->setting = json_encode($this->config->$module->datatable->defaultField); + $this->view->module = $module; + $this->view->method = $method; + $this->view->mode = $mode; + $module = zget($this->config->datatable->moduleAlias, $module, $module); + $setting = ''; + if(isset($this->config->datatable->$target->$key)) $setting = $this->config->datatable->$target->$key; + if(empty($setting)) + { + $this->loadModel($module); + $setting = json_encode($this->config->$module->datatable->defaultField); + } + + $this->view->cols = $this->datatable->getFieldList($module); + $this->view->setting = $setting; $this->display(); } + + /** + * Ajax reset cols + * + * @param string $module + * @param string $method + * @param string $confirm + * @access public + * @return void + */ + public function ajaxReset($module, $method, $system = 0, $confirm = 'no') + { + if($confirm == 'no') die(js::confirm($this->lang->datatable->confirmReset, inlink('ajaxReset', "module=$module&method=$method&system=$system&confirm=yes"))); + + $account = $this->app->user->account; + $target = $module . ucfirst($method); + $mode = isset($this->config->datatable->$target->mode) ? $this->config->datatable->$target->mode : 'table'; + $key = $mode == 'datatable' ? 'cols' : 'tablecols'; + if($system) $account = 'system'; + + $this->loadModel('setting')->deleteItems("owner=$account&module=datatable§ion=$target&key=$key"); + die(js::reload('parent')); + } } diff --git a/module/datatable/lang/en.php b/module/datatable/lang/en.php index e53e67ac3e..099a89c79e 100644 --- a/module/datatable/lang/en.php +++ b/module/datatable/lang/en.php @@ -4,12 +4,16 @@ $lang->datatable->common = 'Data Table'; $lang->datatable->width = 'Width'; $lang->datatable->show = 'Show'; $lang->datatable->hide = 'Hide'; +$lang->datatable->reset = 'Reset'; $lang->datatable->custom = 'Custom Columns'; $lang->datatable->customTip = 'Check Columns to Display'; $lang->datatable->switchToTable = 'Switch to Table'; $lang->datatable->switchToDatatable = 'Switch to Datatable'; $lang->datatable->required = 'Required'; +$lang->datatable->confirmReset = 'Do you want to restore the default settings?'; +$lang->datatable->setGlobal = 'Global'; +$lang->datatable->resetGlobal = 'Reset Global Default'; $lang->datatable->branch = 'Branch'; $lang->datatable->platform = 'Platform'; diff --git a/module/datatable/lang/zh-cn.php b/module/datatable/lang/zh-cn.php index bfbc7015d9..613343395e 100644 --- a/module/datatable/lang/zh-cn.php +++ b/module/datatable/lang/zh-cn.php @@ -4,12 +4,16 @@ $lang->datatable->common = '数据表格'; $lang->datatable->width = '宽度'; $lang->datatable->show = '显示'; $lang->datatable->hide = '隐藏'; +$lang->datatable->reset = '恢复默认'; $lang->datatable->custom = '自定义列'; $lang->datatable->customTip = '勾选需要显示的列'; $lang->datatable->switchToTable = '切换到简单表格'; $lang->datatable->switchToDatatable = '切换到高级表格'; $lang->datatable->required = '必选'; +$lang->datatable->confirmReset = '是否恢复默认设置?'; +$lang->datatable->setGlobal = '全局'; +$lang->datatable->resetGlobal = '全局恢复默认'; $lang->datatable->branch = '分支'; $lang->datatable->platform = '平台'; diff --git a/module/datatable/model.php b/module/datatable/model.php index 35d9bf5b63..342778e247 100644 --- a/module/datatable/model.php +++ b/module/datatable/model.php @@ -49,9 +49,12 @@ class datatableModel extends model { $datatableId = $module . ucfirst($this->app->getMethodName()); + $mode = isset($this->config->datatable->$datatableId->mode) ? $this->config->datatable->$datatableId->mode : 'table'; + $key = $mode == 'datatable' ? 'cols' : 'tablecols'; + $module = zget($this->config->datatable->moduleAlias, $module, $module); if(!isset($this->config->$module)) $this->loadModel($module); - if(isset($this->config->datatable->$datatableId->cols)) $setting = json_decode($this->config->datatable->$datatableId->cols); + if(isset($this->config->datatable->$datatableId->$key)) $setting = json_decode($this->config->datatable->$datatableId->$key); $fieldList = $this->getFieldList($module); if(empty($setting)) @@ -69,6 +72,7 @@ class datatableModel extends model $set->fixed = $fieldList[$id]['fixed']; $set->title = $fieldList[$id]['title']; $set->sort = isset($fieldList[$id]['sort']) ? $fieldList[$id]['sort'] : 'yes'; + $set->name = isset($fieldList[$id]['name']) ? $fieldList[$id]['name'] : ''; $setting[$key] = $set; } } @@ -120,7 +124,12 @@ class datatableModel extends model $id = $col->id; if($col->show) { - echo "
"; + $fixed = $col->fixed == 'no' ? 'true': 'false'; + $width = is_numeric($col->width) ? "{$col->width}px" : $col->width; + $sorter = (isset($col->sort) and $col->sort == 'no') ? '' : '{sorter:false}'; + $title = isset($col->name) ? "title='$col->name'" : ''; + + echo ""; if($id == 'actions') { echo $this->lang->actions; diff --git a/module/datatable/view/ajaxcustom.html.php b/module/datatable/view/ajaxcustom.html.php index b55daf57ad..37f34fcdcd 100644 --- a/module/datatable/view/ajaxcustom.html.php +++ b/module/datatable/view/ajaxcustom.html.php @@ -12,7 +12,7 @@ ?>