diff --git a/module/task/model.php b/module/task/model.php index fe042c3a73..610b2766ef 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -29,12 +29,16 @@ class taskModel extends model ->setDefault('project', (int)$projectID) ->setDefault('estimate, left, story', 0) ->setDefault('status', 'wait') + ->setDefault('estimate',(int)$this->post->estimate) ->setIF($this->post->estimate != false, 'left', $this->post->estimate) ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->setDefault('estStarted', '0000-00-00') ->setDefault('deadline', '0000-00-00') ->setIF(strpos($this->config->task->create->requiredFields, 'estStarted') !== false, 'estStarted', $this->post->estStarted) ->setIF(strpos($this->config->task->create->requiredFields, 'deadline') !== false, 'deadline', $this->post->deadline) + ->setIF($this->post->estimate !== 0, 'estimate', (int)$this->post->estimate) + ->setIF($this->post->consumed !== 0, 'consumed', (int)$this->post->consumed) + ->setIF($this->post->left !== 0, 'left', (int)$this->post->left) ->setDefault('openedBy', $this->app->user->account) ->setDefault('openedDate', helper::now()) ->stripTags($this->config->task->editor->create['id'], $this->config->allowedTags) @@ -578,6 +582,9 @@ class taskModel extends model ->setDefault('story, estimate, left, consumed', 0) ->setDefault('estStarted', '0000-00-00') ->setDefault('deadline', '0000-00-00') + ->setIF($this->post->estimate !== 0, 'estimate', (int)$this->post->estimate) + ->setIF($this->post->consumed !== 0, 'consumed', (int)$this->post->consumed) + ->setIF($this->post->left !== 0, 'left', (int)$this->post->left) ->setIF($oldTask->parent == 0 && $this->post->parent == '', 'parent', 0) ->setIF(strpos($this->config->task->edit->requiredFields, 'estStarted') !== false, 'estStarted', $this->post->estStarted) ->setIF(strpos($this->config->task->edit->requiredFields, 'deadline') !== false, 'deadline', $this->post->deadline) @@ -598,7 +605,7 @@ class taskModel extends model ->setIF($this->post->assignedTo != $oldTask->assignedTo, 'assignedDate', $now) - ->setIF($this->post->status == 'wait' and $this->post->left == $oldTask->left and $this->post->consumed == 0, 'left', $this->post->estimate) + ->setIF($this->post->status == 'wait' and $this->post->left == $oldTask->left and $this->post->consumed == 0 and $this->post->estimate, 'left', $this->post->estimate) ->add('lastEditedBy', $this->app->user->account) ->add('lastEditedDate', $now) @@ -1170,6 +1177,7 @@ class taskModel extends model } $task = fixer::input('post') + ->setIF($this->post->consumed !== 0, 'consumed', (int)$this->post->consumed) ->setDefault('left', 0) ->setDefault('assignedTo', $oldTask->openedBy) ->setDefault('assignedDate', $now) @@ -1229,6 +1237,7 @@ class taskModel extends model } if($task->finishedDate == substr($now, 0, 10)) $task->finishedDate = $now; + $task->consumed = (int)$task->consumed; $this->dao->update(TABLE_TASK)->data($task) ->autoCheck() @@ -1349,6 +1358,7 @@ class taskModel extends model $oldTask = $this->getById($taskID); $task = fixer::input('post') + ->setIF($this->post->left !== 0, 'left', (int)$this->post->left) ->setDefault('left', 0) ->setDefault('status', 'doing') ->setDefault('finishedBy, canceledBy, closedBy, closedReason', '') @@ -1359,6 +1369,12 @@ class taskModel extends model ->remove('comment') ->get(); + if(!is_numeric($task->left)) + { + dao::$errors[] = $this->lang->task->error->estimateNumber; + return false; + } + if(!empty($oldTask->team)) { $this->dao->update(TABLE_TEAM)->set('left')->eq($this->post->left) diff --git a/xuanxuan/module/admin/ext/control/downloadxxd.php b/xuanxuan/module/admin/ext/control/downloadxxd.php index e2f82c9cb2..4a7ee6c908 100644 --- a/xuanxuan/module/admin/ext/control/downloadxxd.php +++ b/xuanxuan/module/admin/ext/control/downloadxxd.php @@ -5,9 +5,13 @@ class admin extends control { if(in_array($type, array('config', 'package'))) { - $setting = $this->config->xuanxuan; + $this->loadModel('chat'); + $server = $this->chat->getServer(); + if(strpos($server, '127.0.0.1') !== false) die(js::alert($this->lang->chat->xxdServerError)); + + $setting = $this->config->xuanxuan; $setting->os = $os; - $this->loadModel('chat')->downloadXXD($setting, $type); + $this->chat->downloadXXD($setting, $type); } die("Params error."); } diff --git a/xuanxuan/module/admin/ext/control/xuanxuan.php b/xuanxuan/module/admin/ext/control/xuanxuan.php index 08a64fd3e2..fade5a15ff 100644 --- a/xuanxuan/module/admin/ext/control/xuanxuan.php +++ b/xuanxuan/module/admin/ext/control/xuanxuan.php @@ -23,10 +23,15 @@ class admin extends control if(empty($setting->sslkey)) $errors['sslkey'] = $this->lang->chat->errorSSLKey; } + if(strpos($setting->server, '127.0.0.1') !== false) $errors[] = $this->lang->chat->xxdServerError; + if(strpos($setting->server, 'https://') !== 0 and strpos($setting->server, 'http://') !== 0) $errors[] = $this->lang->chat->xxdSchemeError; + if(empty($setting->server)) $errors[] = $this->lang->chat->xxdServerEmpty; + if($errors) $this->send(array('result' => 'fail', 'message' => $errors)); - $setting->server = ($setting->isHttps ? 'https' : 'http') . '://' . $setting->domain . ':' . $setting->commonPort; - $result = $this->loadModel('setting')->setItems('system.common.xuanxuan', $setting, 'all'); + + $result = $this->loadModel('setting')->setItems('system.common.xuanxuan', $setting); + $this->setting->setItem('system.mail.domain', $setting->server); if(!$result) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('xuanxuan'))); } @@ -34,19 +39,11 @@ class admin extends control $os = 'win'; if(strpos(strtolower(PHP_OS), 'win') !== 0) $os = strtolower(PHP_OS); - $domain = $this->server->http_host; - if(!empty($this->config->xuanxuan->server)) - { - preg_match('/^(https?:\/\/)?([^\:]+)/i', $this->config->xuanxuan->server, $match); - $domain = $match[2]; - } - - $this->view->title = $this->lang->chat->common; $this->view->adminList = $this->loadModel('user')->getPairs('admin'); $this->view->os = $os . '_' . php_uname('m'); $this->view->type = $type; - $this->view->domain = $domain; + $this->view->domain = $this->loadModel('chat')->getServer(); $this->view->turnon = isset($this->config->xuanxuan->turnon) ? $this->config->xuanxuan->turnon : 1; $this->view->isHttps = $this->config->xuanxuan->isHttps ? $this->config->xuanxuan->isHttps : 0; $this->display(); diff --git a/xuanxuan/module/admin/ext/view/xuanxuan.html.php b/xuanxuan/module/admin/ext/view/xuanxuan.html.php index 0ea81fbd52..cb5974b3cb 100644 --- a/xuanxuan/module/admin/ext/view/xuanxuan.html.php +++ b/xuanxuan/module/admin/ext/view/xuanxuan.html.php @@ -21,11 +21,12 @@

chat->settings;?>

-
+ - + + @@ -37,7 +38,8 @@ - + + @@ -58,7 +60,7 @@
chat->turnon;?>chat->turnonList, $turnon) : zget($lang->chat->turnonList, $config->xuanxuan->turnon);?>chat->turnonList, $turnon) : zget($lang->chat->turnonList, $config->xuanxuan->turnon);?>
chat->version;?>
chat->xxdServer;?>chat->xxdServerTip;?>
chat->xxd->ip;?>chat->xxd->uploadFileSize;?> -
+
chat->xxd->max;?> xuanxuan, 'uploadFileSize', 20), "class='form-control' placeholder='{$lang->chat->placeholder->xxd->uploadFileSize}' ");?> M @@ -109,8 +111,8 @@ goback, '', 'class="btn" style="min-width: 120px"');?> - chat->downloadXXD, '', "class='btn btn-primary download download-package' target='_blank'");?> - chat->downloadConfig, '', "class='btn btn-primary download'");?> + chat->downloadXXD, 'hiddenwin', "class='btn btn-primary download download-package'");?> + chat->downloadConfig, 'hiddenwin', "class='btn btn-primary download'");?> chat->changeSetting, '', "class='btn'");?> chat->help, '_blank', "class='btn'");?> diff --git a/xuanxuan/module/chat/ext/lang/en/xuanxuan.php b/xuanxuan/module/chat/ext/lang/en/xuanxuan.php index 3b6d432358..d0683f2afe 100644 --- a/xuanxuan/module/chat/ext/lang/en/xuanxuan.php +++ b/xuanxuan/module/chat/ext/lang/en/xuanxuan.php @@ -31,8 +31,9 @@ $lang->chat->statusList[0] = 'Disable'; $lang->chat->httpsOptions[1] = 'Enable'; $lang->chat->httpsOptions[0] = 'Disable'; -$lang->chat->xxdServerTip = 'XXD server address contains protocol and host and port,such as https://127.0.0.1:11443'; +$lang->chat->xxdServerTip = 'XXD server address contains protocol and host and port,such as http://192.168.1.35 or http://pms.zentao.com. that can not be 127.0.0.1.'; $lang->chat->xxdServerEmpty = 'XXD server address is empty.'; +$lang->chat->xxdServerError = 'XXD server address can not be 127.0.0.1.'; $lang->chat->xxdSchemeError = 'Server address should started with http:// or https://.'; $lang->chat->xxdPortError = 'Server address should contain valid port and the default is 11443.'; $lang->chat->xxClientConfirm = 'Click to download new zentao client!'; diff --git a/xuanxuan/module/chat/ext/lang/zh-cn/xuanxuan.php b/xuanxuan/module/chat/ext/lang/zh-cn/xuanxuan.php index ca7edea3ff..6217092182 100644 --- a/xuanxuan/module/chat/ext/lang/zh-cn/xuanxuan.php +++ b/xuanxuan/module/chat/ext/lang/zh-cn/xuanxuan.php @@ -29,8 +29,9 @@ $lang->chat->createTodo = '创建待办'; $lang->chat->statusList[1] = '启用'; $lang->chat->statusList[0] = '不启用'; -$lang->chat->xxdServerTip = 'XXD服务器地址为完整的协议+地址+端口,示例:https://127.0.0.1:11443。'; +$lang->chat->xxdServerTip = 'XXD服务器地址为完整的协议+地址+端口,示例:http://192.168.1.35 或 http://pms.zentao.com ,不能使用127.0.0.1。'; $lang->chat->xxdServerEmpty = 'XXD服务器地址为空。'; +$lang->chat->xxdServerError = 'XXD服务器地址不能为 127.0.0.1。'; $lang->chat->xxdSchemeError = '服务器地址应该以http://或https://开头。'; $lang->chat->xxdPortError = '服务器地址应该包含有效的端口号,默认为11443。'; $lang->chat->zentaoClient = '新增禅道客户端!'; diff --git a/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php b/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php index ae424d6541..59b02c9c66 100644 --- a/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php +++ b/xuanxuan/module/chat/ext/model/class/xuanxuan.class.php @@ -4,7 +4,6 @@ class xuanxuanChat extends chatModel public function downloadXXD($setting, $type) { $data = new stdClass(); - $data->server = $setting->server; $data->uploadFileSize = $setting->uploadFileSize; $data->isHttps = $setting->isHttps; $data->sslcrt = $setting->sslcrt; @@ -13,12 +12,15 @@ class xuanxuanChat extends chatModel $data->chatPort = $setting->chatPort; $data->commonPort = $setting->commonPort; $data->maxOnlineUser = isset($setting->maxOnlineUser) ? $setting->maxOnlineUser : 0; - $data->host = commonModel::getSysURL() . getWebRoot(); $data->key = $this->config->xuanxuan->key; $data->os = $setting->os; $data->version = $this->config->xuanxuan->version; $data->downloadType = $type; + $server = $this->getServer(); + $data->server = $server; + $data->host = trim($server, '/') . getWebRoot(); + $url = "https://www.chanzhi.org/license-downloadxxd-zentao.html"; $result = common::http($url, $data); @@ -64,23 +66,31 @@ class xuanxuanChat extends chatModel public function getExtensionList($userID) { $entries = array(); - $baseURL = commonModel::getSysURL(); + $baseURL = $this->getServer(); $this->loadModel('user'); $user = $this->dao->select('*')->from(TABLE_USER)->where('id')->eq($userID)->fetch(); $user->admin = strpos($this->app->company->admins, ",{$user->account},") !== false; $user->rights = $this->user->authorize($user->account); $user->groups = $this->user->getGroups($user->account); + $user->view = $this->user->grantUserView($user->account, $user->rights['acls']); $this->session->set('user', $user); $this->app->user = $this->session->user; + $products = explode(',', $this->app->user->view->products); + $projects = explode(',', $this->app->user->view->projects); + $libids = array_keys($this->loadModel('doc')->getLibs('all')); + $productID = isset($products[0]) ? $products[0] : 1; + $projectID = isset($projects[0]) ? $projects[0] : 1; + $libID = isset($libids[0]) ? $libids[0] : 1; + $actions = new stdclass(); - if(common::hasPriv('bug', 'create')) $actions->createBug = array('title' => $this->lang->chat->createBug, 'url' => $baseURL . str_replace('/xuanxuan.php', '/index.php', helper::createLink('bug', 'create', 'product=1', 'xhtml')), 'height' => "600px", 'width' => "800px"); - if(common::hasPriv('doc', 'create')) $actions->createDoc = array('title' => $this->lang->chat->createDoc, 'url' => $baseURL . str_replace('/xuanxuan.php', '/index.php', helper::createLink('doc', 'create', 'lib=1', 'xhtml')), 'height' => "600px", 'width' => "800px"); - if(common::hasPriv('story', 'create')) $actions->createStory = array('title' => $this->lang->chat->createStory, 'url' => $baseURL . str_replace('/xuanxuan.php', '/index.php', helper::createLink('story', 'create', 'product=1', 'xhtml')), 'height' => "600px", 'width' => "800px"); - if(common::hasPriv('task', 'create')) $actions->createTask = array('title' => $this->lang->chat->createTask, 'url' => $baseURL . str_replace('/xuanxuan.php', '/index.php', helper::createLink('task', 'create', 'project=1', 'xhtml')), 'height' => "600px", 'width' => "800px"); - if(common::hasPriv('todo', 'create')) $actions->createTodo = array('title' => $this->lang->chat->createTodo, 'url' => $baseURL . str_replace('/xuanxuan.php', '/index.php', helper::createLink('todo', 'create', '', 'xhtml')), 'height' => "600px", 'width' => "800px"); + if(common::hasPriv('bug', 'create')) $actions->createBug = array('title' => $this->lang->chat->createBug, 'url' => $baseURL . str_replace('/xuanxuan.php', '/index.php', helper::createLink('bug', 'create', "product=$productID", 'xhtml')), 'height' => "600px", 'width' => "800px"); + if(common::hasPriv('doc', 'create')) $actions->createDoc = array('title' => $this->lang->chat->createDoc, 'url' => $baseURL . str_replace('/xuanxuan.php', '/index.php', helper::createLink('doc', 'create', "libID=$libID", 'xhtml')), 'height' => "600px", 'width' => "800px"); + if(common::hasPriv('story', 'create')) $actions->createStory = array('title' => $this->lang->chat->createStory, 'url' => $baseURL . str_replace('/xuanxuan.php', '/index.php', helper::createLink('story', 'create', "product=$productID", 'xhtml')), 'height' => "600px", 'width' => "800px"); + if(common::hasPriv('task', 'create')) $actions->createTask = array('title' => $this->lang->chat->createTask, 'url' => $baseURL . str_replace('/xuanxuan.php', '/index.php', helper::createLink('task', 'create', "project=$projectID", 'xhtml')), 'height' => "600px", 'width' => "800px"); + if(common::hasPriv('todo', 'create')) $actions->createTodo = array('title' => $this->lang->chat->createTodo, 'url' => $baseURL . str_replace('/xuanxuan.php', '/index.php', helper::createLink('todo', 'create', '', 'xhtml')), 'height' => "600px", 'width' => "800px"); $urls = array(); foreach($this->config->chat->cards as $moduleName => $methods) @@ -115,4 +125,13 @@ class xuanxuanChat extends chatModel unset($_SESSION['user']); return $entries; } + + public function getServer() + { + $this->app->loadConfig('mail'); + $server = empty($this->config->mail->domain) ? commonModel::getSysURL() : $this->config->mail->domain; + if(!empty($this->config->xuanxuan->server)) $server = $this->config->xuanxuan->server; + + return $server; + } } diff --git a/xuanxuan/module/chat/ext/model/xuanxuan.php b/xuanxuan/module/chat/ext/model/xuanxuan.php index 65e0404bf7..25a659fbb1 100644 --- a/xuanxuan/module/chat/ext/model/xuanxuan.php +++ b/xuanxuan/module/chat/ext/model/xuanxuan.php @@ -13,3 +13,8 @@ public function sendDownHeader($fileName, $fileType, $content, $fileSize = 0) { return $this->loadExtension('xuanxuan')->sendDownHeader($fileName, $fileType, $content, $fileSize); } + +public function getServer() +{ + return $this->loadExtension('xuanxuan')->getServer(); +} diff --git a/xuanxuan/module/common/ext/model/hook/loadConfigFromDB.xuanxuan.php b/xuanxuan/module/common/ext/model/hook/loadConfigFromDB.xuanxuan.php index e9af2f6c81..a594607c2a 100644 --- a/xuanxuan/module/common/ext/model/hook/loadConfigFromDB.xuanxuan.php +++ b/xuanxuan/module/common/ext/model/hook/loadConfigFromDB.xuanxuan.php @@ -8,8 +8,8 @@ if(empty($xxConfig['key'])) $this->setting->setItem('system.common.xuanxuan.turnon', 1); $this->setting->setItem('system.common.xuanxuan.key', $this->setting->computeSN()); } -if(empty($xxConfig['chatPort'])) $this->setting->setItem('system.common.xuanxuan.chatPort', 11444); -if(empty($xxConfig['commonPort'])) $this->setting->setItem('system.common.xuanxuan.commonPort', 11443); -if(empty($xxConfig['ip'])) $this->setting->setItem('system.common.xuanxuan.ip', '0.0.0.0'); -if(empty($xxConfig['isHttps'])) $this->setting->setItem('system.common.xuanxuan.isHttps', 0); -if(empty($xxConfig['uploadFileSize'])) $this->setting->setItem('system.common.xuanxuan.uploadFileSize', 20); +if(!isset($xxConfig['chatPort'])) $this->setting->setItem('system.common.xuanxuan.chatPort', 11444); +if(!isset($xxConfig['commonPort'])) $this->setting->setItem('system.common.xuanxuan.commonPort', 11443); +if(!isset($xxConfig['ip'])) $this->setting->setItem('system.common.xuanxuan.ip', '0.0.0.0'); +if(!isset($xxConfig['isHttps'])) $this->setting->setItem('system.common.xuanxuan.isHttps', 0); +if(!isset($xxConfig['uploadFileSize'])) $this->setting->setItem('system.common.xuanxuan.uploadFileSize', 20); diff --git a/xuanxuan/module/common/ext/model/xuanxuan.php b/xuanxuan/module/common/ext/model/xuanxuan.php deleted file mode 100644 index 0807095a41..0000000000 --- a/xuanxuan/module/common/ext/model/xuanxuan.php +++ /dev/null @@ -1,6 +0,0 @@ -config->system->xuanxuan)) $this->app->mergeConfig($this->config->system->xuanxuan, 'xuanxuan'); -} diff --git a/xuanxuan/module/entry/ext/control/visit.php b/xuanxuan/module/entry/ext/control/visit.php index 7b0470bb08..15f93f9145 100644 --- a/xuanxuan/module/entry/ext/control/visit.php +++ b/xuanxuan/module/entry/ext/control/visit.php @@ -14,7 +14,8 @@ class entry extends control if(RUN_MODE != 'xuanxuan') die(); $referer = !empty($_GET['referer']) ? $this->get->referer : $referer; - if(empty($referer)) $referer = common::getSysURL() . str_replace('/xuanxuan.php', '/index.php', $this->createLink('my', 'index', '', 'html')); + $server = $this->loadModel('chat')->getServer(); + if(empty($referer)) $referer = $server . str_replace('/xuanxuan.php', '/index.php', $this->createLink('my', 'index', '', 'html')); $output = new stdclass(); $output->module = $this->moduleName; diff --git a/xuanxuan/module/message/ext/model/class/xuanxuan.class.php b/xuanxuan/module/message/ext/model/class/xuanxuan.class.php index 4804d6e314..acf0b7aeef 100644 --- a/xuanxuan/module/message/ext/model/class/xuanxuan.class.php +++ b/xuanxuan/module/message/ext/model/class/xuanxuan.class.php @@ -16,9 +16,10 @@ class xuanxuanMessage extends messageModel $title = $this->app->user->realname . $this->lang->action->label->$actionType . $this->lang->action->objectTypes[$objectType]; $text = $title . ' ' . "[#{$objectID}::{$object->$field}]"; + $server = $this->loadModel('chat')->getServer(); $onlybody = isset($_GET['onlybody']) ? $_GET['onlybody'] : ''; unset($_GET['onlybody']); - $url = common::getSysURL() . helper::createLink($objectType, 'view', "id=$objectID", 'html'); + $url = $server . helper::createLink($objectType, 'view', "id=$objectID", 'html'); $target = ''; if(!empty($object->assignedTo)) $target .= $object->assignedTo; diff --git a/xuanxuan/www/data/xuanxuan/zentao-integrated.zip b/xuanxuan/www/data/xuanxuan/zentao-integrated.zip index ccc89ce0c3..b2fd5461ed 100644 Binary files a/xuanxuan/www/data/xuanxuan/zentao-integrated.zip and b/xuanxuan/www/data/xuanxuan/zentao-integrated.zip differ