Merge branch 'master' of https://github.com/easysoft/zentaopms
This commit is contained in:
+17
-1
@@ -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)
|
||||
|
||||
@@ -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.");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -21,11 +21,12 @@
|
||||
<h4><?php echo $lang->chat->settings;?></h4>
|
||||
</div>
|
||||
</div>
|
||||
<form method='post' id='ajaxForm' class='form-inline form-ajax'>
|
||||
<form method='post' id='ajaxForm' class='form-ajax'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-120px'><?php echo $lang->chat->turnon;?></th>
|
||||
<td><?php echo $type == 'edit' ? html::radio('turnon', $lang->chat->turnonList, $turnon) : zget($lang->chat->turnonList, $config->xuanxuan->turnon);?></td>
|
||||
<td class='w-p20'><?php echo $type == 'edit' ? html::radio('turnon', $lang->chat->turnonList, $turnon) : zget($lang->chat->turnonList, $config->xuanxuan->turnon);?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->chat->version;?></th>
|
||||
@@ -37,7 +38,8 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->chat->xxdServer;?></th>
|
||||
<td colspan='2'><?php echo $type == 'edit' ? html::input('domain', $domain, "class='form-control'") : $domain;?></td>
|
||||
<td><?php echo $type == 'edit' ? html::input('server', $domain, "class='form-control'") : $domain;?></td>
|
||||
<td><?php if($type == 'edit') echo $lang->chat->xxdServerTip;?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->chat->xxd->ip;?></th>
|
||||
@@ -58,7 +60,7 @@
|
||||
<th><?php echo $lang->chat->xxd->uploadFileSize;?></th>
|
||||
<td>
|
||||
<?php if($type == 'edit'):?>
|
||||
<div class='input-group' style='width: 30%'>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->chat->xxd->max;?></span>
|
||||
<?php echo html::input('uploadFileSize', zget($config->xuanxuan, 'uploadFileSize', 20), "class='form-control' placeholder='{$lang->chat->placeholder->xxd->uploadFileSize}' ");?>
|
||||
<span class='input-group-addon'>M</span>
|
||||
@@ -109,8 +111,8 @@
|
||||
<?php echo html::submitButton();?>
|
||||
<?php echo html::a(helper::createLink('admin', 'xuanxuan'), $lang->goback, '', 'class="btn" style="min-width: 120px"');?>
|
||||
<?php else:?>
|
||||
<?php echo html::a(helper::createLink('admin', 'downloadXXD', 'type=package'), $lang->chat->downloadXXD, '', "class='btn btn-primary download download-package' target='_blank'");?>
|
||||
<?php echo html::a(helper::createLink('admin', 'downloadXXD', 'type=config'), $lang->chat->downloadConfig, '', "class='btn btn-primary download'");?>
|
||||
<?php echo html::a(helper::createLink('admin', 'downloadXXD', 'type=package'), $lang->chat->downloadXXD, 'hiddenwin', "class='btn btn-primary download download-package'");?>
|
||||
<?php echo html::a(helper::createLink('admin', 'downloadXXD', 'type=config'), $lang->chat->downloadConfig, 'hiddenwin', "class='btn btn-primary download'");?>
|
||||
<?php echo html::a(helper::createLink('admin', 'xuanxuan', 'type=edit'), $lang->chat->changeSetting, '', "class='btn'");?>
|
||||
<?php echo html::a('http://www.zentao.net/book/zentaopmshelp/302.html', $lang->chat->help, '_blank', "class='btn'");?>
|
||||
<?php endif;?>
|
||||
|
||||
@@ -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 <strong>11443</strong>.';
|
||||
$lang->chat->xxClientConfirm = 'Click to download new zentao client!';
|
||||
|
||||
@@ -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 = '服务器地址应该以<strong>http://</strong>或<strong>https://</strong>开头。';
|
||||
$lang->chat->xxdPortError = '服务器地址应该包含有效的端口号,默认为<strong>11443</strong>。';
|
||||
$lang->chat->zentaoClient = '新增禅道客户端!';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?php
|
||||
public function loadConfigFromDB()
|
||||
{
|
||||
parent::loadConfigFromDB();
|
||||
if(isset($this->config->system->xuanxuan)) $this->app->mergeConfig($this->config->system->xuanxuan, 'xuanxuan');
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user