Merge branch '15.0.beta3' of https://gitlab.zcorp.cc/easycorp/zentaopms into 15.0.beta3

This commit is contained in:
hufangzhou
2021-04-29 11:30:23 +08:00
12 changed files with 1481 additions and 991 deletions
+6 -5
View File
@@ -58,7 +58,7 @@ zentaoxx:
cd $(XUANPATH); git archive --format=zip --prefix=xuan/ $(XUANVERSION) > xuan.zip
mv $(XUANPATH)/xuan.zip .
unzip xuan.zip
cp xuan/xxb/config/ext/xuanxuan.php zentaoxx/config/ext/
cp xuan/xxb/config/ext/_0_xuanxuan.php zentaoxx/config/ext/
cp -r xuan/xxb/lib/phpaes zentaoxx/lib/
cp -r xuan/xxb/framework/xuanxuan.class.php zentaoxx/framework/
cp -r xuan/xxb/db/*.sql zentaoxx/db/
@@ -78,8 +78,7 @@ zentaoxx:
cp -r xuan/xxb/www/x.php zentaoxx/www/
mkdir zentaoxx/module/action
cp -r xuan/xxb/module/action/ext zentaoxx/module/action
cp -r xuan/xxb/config/ext/xxb.php zentaoxx/config/ext/
cp -r xuan/xxb/config/ext/maps.php zentaoxx/config/ext/
cp -r xuan/xxb/config/ext/_1_maps.php zentaoxx/config/ext/
cp -r xuanxuan/config/* zentaoxx/config/
cp -r xuanxuan/module/* zentaoxx/module/
cp -r xuanxuan/www/* zentaoxx/www/
@@ -87,8 +86,8 @@ zentaoxx:
mkdir zentaoxx/db/
cp zentaoxx/db_bak/upgradexuanxuan*.sql zentaoxx/db_bak/xuanxuan.sql zentaoxx/db/
rm -rf zentaoxx/db_bak/
sed -i 's/XXBVERSION/$(XVERSION)/g' zentaoxx/config/ext/xuanxuan.php
sed -i "/\$$config->xuanxuan->backend /c\\\$$config->xuanxuan->backend = 'zentao';" zentaoxx/config/ext/xuanxuan.php
sed -i 's/XXBVERSION/$(XVERSION)/g' zentaoxx/config/ext/_0_xuanxuan.php
sed -i "/\$$config->xuanxuan->backend /c\\\$$config->xuanxuan->backend = 'zentao';" zentaoxx/config/ext/_0_xuanxuan.php
sed -i 's/site,//' zentaoxx/module/im/model/user.php
sed -i 's/admin, g/g/' zentaoxx/module/im/model/user.php
sed -i '/password = md5/d' zentaoxx/module/im/model/user.php
@@ -120,6 +119,8 @@ zentaoxx:
sed -i 's/helper::jsonEncode(/json_encode(/g' zentaoxx/framework/xuanxuan.class.php
sed -i "s/lang->goback,/lang->goback, '',/g" zentaoxx/module/im/view/debug.html.php
sed -i 's/v\.//g' zentaoxx/module/client/js/checkupgrade.js
sed -i 's/commonModel::getLicensePropertyValue/extCommonModel::getLicensePropertyValue/g' zentaoxx/module/im/control.php
sed -i 's/commonModel::getLicensePropertyValue/extCommonModel::getLicensePropertyValue/g' zentaoxx/module/im/model/conference.php
sed -i 's/xxb_/zt_/g' zentaoxx/db/*.sql
mkdir zentaoxx/tools; cp tools/cn2tw.php zentaoxx/tools; cd zentaoxx/tools; php cn2tw.php
cp tools/en2de.php zentaoxx/tools; cd zentaoxx/tools; php en2de.php ../
+731 -316
View File
File diff suppressed because it is too large Load Diff
+724 -330
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -47,6 +47,8 @@ class gitlab
$infos = array();
foreach($list as $file)
{
if(!isset($file->type)) continue;
$info = new stdClass();
if($file->type == 'blob')
{
+11 -8
View File
@@ -704,15 +704,18 @@ class bug extends control
if($bug->assignedTo == $this->app->user->account) $this->loadModel('action')->read('bug', $bugID);
/* Set menu. */
if($this->app->openApp == 'project') $this->loadModel('project')->setMenu($bug->project);
if($this->app->openApp == 'execution') $this->loadModel('execution')->setMenu($bug->execution);
if($this->app->openApp == 'qa') $this->qa->setMenu($this->products, $bug->product, $bug->branch);
if($this->app->openApp == 'devops')
if(!isonlybody())
{
session_write_close();
$repos = $this->loadModel('repo')->getRepoPairs($bug->project);
$this->repo->setMenu($repos);
$this->lang->navGroup->bug = 'devops';
if($this->app->openApp == 'project') $this->loadModel('project')->setMenu($bug->project);
if($this->app->openApp == 'execution') $this->loadModel('execution')->setMenu($bug->execution);
if($this->app->openApp == 'qa') $this->qa->setMenu($this->products, $bug->product, $bug->branch);
if($this->app->openApp == 'devops')
{
session_write_close();
$repos = $this->loadModel('repo')->getRepoPairs($bug->project);
$this->repo->setMenu($repos);
$this->lang->navGroup->bug = 'devops';
}
}
/* Get product info. */
+1
View File
@@ -26,6 +26,7 @@ class caselibModel extends model
/* Set case lib menu. */
$products =$this->loadModel('product')->getPairs();
if(!empty($products) and $this->session->product) $this->loadModel('qa')->setMenu($products, $this->session->product);
if(empty($products)) $this->loadModel('qa')->setMenu($products, 0);
if($libraries)
{
View File
View File
View File
@@ -0,0 +1,5 @@
<?php
public static function getLicensePropertyValue($propertyName)
{
return false;
}
-331
View File
@@ -1,331 +0,0 @@
<?php
class conference extends model
{
/**
* Get conference by the id of chat.
*
* @param string $chatID
* @access public
* @return object
*/
public function getByChatID($chatID)
{
return $this->dao->select('*')->from(TABLE_IM_CONFERENCE)->where('cgid')->eq($chatID)->fetch();
}
/**
* Get conference by the id of room.
*
* @param string $roomID
* @access public
* @return object
*/
public function getByRoomID($roomID)
{
return $this->dao->select('*')->from(TABLE_IM_CONFERENCE)->where('rid')->eq($roomID)->fetch();
}
/**
* Create or activate a conference.
*
* @param string $chatID
* @param int $userID
* @access public
* @return object
*/
public function create($chatID, $userID)
{
$this->loadModel('owt');
$date = helper::now();
$conference = $this->getByChatID($chatID);
$room = !empty($conference) ? $this->owt->getRoom($conference->rid) : '';
if(!empty($room))
{
if($conference->status == 'open')
{
$conference->participants = $this->addParticipant($chatID, $userID);
$this->saveAction($conference->rid, 'join', $userID);
return $conference;
}
$conference->status = 'open';
$conference->participants = "$userID";
$conference->openedDate = helper::now();
$conference->openedBy = $userID;
$this->dao->update(TABLE_IM_CONFERENCE)
->set('status')->eq($conference->status)
->set('participants')->eq($conference->participants)
->set('openedDate')->eq($conference->openedDate)
->set('openedBy')->eq($conference->openedBy)
->where('id')->eq($conference->id)
->exec();
}
else
{
$roomInfo = $this->owt->createRoom($chatID);
if(empty($roomInfo)) return false;
if(empty($conference))
{
$conference = new stdClass();
$conference->cgid = $chatID;
$conference->rid = $roomInfo->id;
$conference->status = 'open';
$conference->participants = "$userID";
$conference->openedBy = (int)$userID;
$conference->openedDate = $date;
$this->dao->insert(TABLE_IM_CONFERENCE)->data($conference)->exec();
}
else
{
$conference = new stdClass();
$conference->rid = $roomInfo->id;
$conference->status = 'open';
$conference->participants = "$userID";
$conference->openedBy = (int)$userID;
$conference->openedDate = $date;
$this->dao->update(TABLE_IM_CONFERENCE)->data($conference)->where('cgid')->eq($chatID)->exec();
}
}
$this->saveAction($conference->rid, 'create', $userID);
if(dao::isError()) return false;
return $conference;
}
/**
* Close a conference.
*
* @param string $chatID
* @param int $userID
* @access public
* @return boolean
*/
public function close($chatID, $userID)
{
$conference = $this->getByChatID($chatID);
if($conference->status == 'closed') return false;
$this->dao->update(TABLE_IM_CONFERENCE)
->set('status')->eq('closed')
->set('participants')->eq('')
->where('id')->eq($conference->id)
->exec();
$this->saveAction($conference->rid, 'close', $userID);
return !dao::isError();
}
/**
* Add participant into a conference.
*
* @param string $chatID
* @param int $userID
* @access public
* @return string|boolean
*/
public function addParticipant($chatID, $userID)
{
$conference = $this->getByChatID($chatID);
if($conference->status == 'closed') return false;
$participants = explode(',', $conference->participants);
$participants = array_filter($participants);
if(!$this->isUnlimitedParticipants() && count($participants) > 2) return false;
$participants[] = $userID;
$participants = array_unique($participants);
$participants = implode(',', $participants);
$this->dao->update(TABLE_IM_CONFERENCE)
->set('participants')->eq($participants)
->where('id')->eq($conference->id)
->exec();
if(dao::isError()) return false;
return $participants;
}
/**
* Remove participant from a conference.
*
* @param string $chatID
* @param int $userID
* @access public
* @return array|boolean
*/
public function removeParticipant($chatID, $userID)
{
$conference = $this->getByChatID($chatID);
if($conference->participants == '') return false;
$participants = explode(',', $conference->participants);
$participants = array_diff($participants, array($userID));
$participants = implode(',', $participants);
$this->dao->update(TABLE_IM_CONFERENCE)
->set('participants')->eq($participants)
->where('id')->eq($conference->id)
->exec();
if(dao::isError()) return false;
return $participants;
}
/**
* Get conference actions since last close.
*
* @param object $conference
* @access public
* @return boolean
*/
public function getActions($conference)
{
$actions = $this->dao->select('*')->from(TABLE_IM_CONFERENCEACTION)
->where('rid')->eq($conference->rid)
->andWhere('date')->gt($conference->openedDate)
->fetchAll();
if(!empty($actions))
{
foreach($actions as $action)
{
$action->user = (int)$action->user;
$action->date = strtotime($action->date);
}
}
if(dao::isError()) return false;
return $actions;
}
/**
* Save a conference action.
*
* @param string $roomID
* @param string $type
* @param int $userID
* @access public
* @return boolean
*/
public function saveAction($roomID, $type, $userID)
{
$action = new stdClass();
$action->rid = $roomID;
$action->type = $type;
$action->user = $userID;
$action->date = helper::now();
$this->dao->insert(TABLE_IM_CONFERENCEACTION)->data($action)->exec();
if(dao::isError()) return false;
return $action;
}
/**
* Remove user from all related conferences and close if necessary.
*
* @param int $userID
* @access public
* @return void
*/
public function removeUserFromConferences($userID)
{
$userChats = $this->loadModel('im')->chat->getListByUserID($userID);
foreach($userChats as $chat)
{
$chatConference = $this->getByChatID($chat->gid);
if(!empty($chatConference) && $chatConference->status == 'open')
{
$participants = explode(',', $chatConference->participants);
$participants = array_filter($participants);
if(in_array($userID, $participants))
{
if(count($participants) > 1)
{
$this->removeParticipant($chat->gid, $userID);
}
else
{
$this->close($chat->gid, $userID);
}
}
}
}
}
/**
* Clean conference participants and close conference if needed or return the conference.
*
* @param string $chatID
* @param int $userID
* @access public
* @return object|boolean
*/
public function cleanConference($chatID, $userID)
{
$conference = $this->getByChatID($chatID);
if(empty($conference)) return false;
$participants = explode(',', $conference->participants);
$participants = array_filter($participants);
$onlineUsers = array_keys($this->loadModel('im')->user->getList('online'));
$participants = array_intersect($participants, $onlineUsers);
if(count($participants) == 1 && in_array($userID, $participants))
{
$this->close($conference->cgid, $userID);
return false;
}
$participants = implode(',', $participants);
$conference->participants = $participants;
return $conference;
}
/**
* Get open conferences by given chat list.
*
* @param array $chatList
* @param int $userID
* @access public
* @return array
*/
public function getOpenConferencesByChatList($chatList, $userID)
{
$openConferenceList = array();
foreach($chatList as $chat)
{
$chatConference = $this->cleanConference($chat->gid, $userID);
if(!empty($chatConference) && $chatConference->status == 'open')
{
$actions = $this->getActions($chatConference);
$chatConference->actions = empty($actions) ? array() : $actions;
$chatConference->room = $chatConference->rid;
$chatConference->openedBy = (int)$chatConference->openedBy;
$chatConference->openedDate = strtotime($chatConference->openedDate);
unset($chatConference->rid);
$openConferenceList[] = $chatConference;
}
}
return $openConferenceList;
}
/**
* Check if there is participant limit in license.
*
* @access public
* @return string|bool
*/
public function isUnlimitedParticipants()
{
return $this->loadModel('license')->getPropertyValue('unlimitedParticipants');
}
}
@@ -38,7 +38,7 @@ class setting extends control
$os = 'win';
if(strpos(strtolower(PHP_OS), 'win') !== 0) $os = strtolower(PHP_OS);
$this->lang->menu->navGroup = 'admin';
$this->lang->navGroup->im = 'admin';
$this->view->title = $this->lang->im->common;
$this->view->position[] = html::a($this->createLink('admin', 'xuanxuan'), $this->lang->im->common);