Merge branch 'sgm_jira' into 'master'
Sgm jira See merge request easycorp/zentaopms!1804
This commit is contained in:
@@ -320,10 +320,11 @@ class convert extends control
|
||||
*
|
||||
* @param string $method db|file
|
||||
* @param string $dbName
|
||||
* @param int $step
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function mapJira2Zentao($method = 'db', $dbName = '')
|
||||
public function mapJira2Zentao($method = 'db', $dbName = '', $step = 1)
|
||||
{
|
||||
$this->app->loadLang('story');
|
||||
$this->app->loadLang('bug');
|
||||
@@ -331,11 +332,13 @@ class convert extends control
|
||||
|
||||
if($_POST)
|
||||
{
|
||||
$this->session->set('jiraRelation', $_POST);
|
||||
foreach($_POST as $key => $value) $_SESSION['jiraRelation'][$key] = $value;
|
||||
|
||||
$step = $step + 1;
|
||||
$link = $step == 5 ? $this->createLink('convert', 'initJiraUser', "method=$method") : inlink('mapJira2Zentao', "method=$method&dbName=$dbName&step=$step");
|
||||
$response['result'] = 'success';
|
||||
$response['message'] = $this->lang->saveSuccess;
|
||||
$response['locate'] = $this->createLink('convert', 'initJiraUser', "method=$method");
|
||||
$response['locate'] = $link;
|
||||
return print($this->send($response));
|
||||
}
|
||||
|
||||
@@ -362,6 +365,7 @@ class convert extends control
|
||||
$this->view->resolutionList = $resolutionList;
|
||||
$this->view->statusList = $statusList;
|
||||
$this->view->method = $method;
|
||||
$this->view->step = $step;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
.main-header > ul {display: inline-block; padding: 0; margin: 0;}
|
||||
.main-header > ul > li {position: relative;}
|
||||
.main-header > ul > li.active > a {background-color: #1CA5FF; color: #fff}
|
||||
.main-header > ul > li > a {min-width: 120px; padding: 5px 20px; text-align: center; transition: none; color: #838a9d}
|
||||
.main-header > ul > li.active > a:hover,
|
||||
.main-header > ul > li.active > a:focus {background-color: #1CA5FF;}
|
||||
.main-header > ul > li .step-number {display: inline-block; width: 14px; height: 14px; border-radius: 7px; text-align: center; line-height: 12px; border: 1px solid #A6AAB8; color: #A6AAB8; font-size: 12px; font-weight: bold; margin-right: 3px;}
|
||||
.main-header > ul > li + li > a {padding-left: 35px;}
|
||||
.main-header > ul > li + li:before,
|
||||
.main-header > ul > li + li:after {content: ' '; width: 0; height: 0; border-style: solid; border-width: 15px 0 15px 15px; border-color: transparent transparent transparent #a6aab8; position: absolute; left: 0; top: 0;}
|
||||
.main-header > ul > li + li:after {border-left-color: #fff; left: -1px;}
|
||||
.main-header > ul > li.active + li:after {border-left-color: #1ca5ff;}
|
||||
.main-header > ul > li:hover + li:after {border-left-color: #eceef4;}
|
||||
.main-header > ul > li.active:hover + li:after {border-left-color: #1CA5FF;}
|
||||
.nav-primary>li.active>a:hover {color: #fff}
|
||||
.main-header {margin-top: -15px !important;}
|
||||
@@ -116,4 +116,75 @@ $lang->convert->issue->zentao = 'ZenTao';
|
||||
$lang->convert->issue->goto = 'Convert To';
|
||||
|
||||
$lang->convert->jira = new stdclass();
|
||||
$lang->convert->jira->import = 'Import Jira';
|
||||
$lang->convert->jira->method = 'Chose Import Method';
|
||||
$lang->convert->jira->next = 'Next';
|
||||
$lang->convert->jira->importFromDB = 'Import From Database';
|
||||
$lang->convert->jira->importFromFile = 'Import From File';
|
||||
$lang->convert->jira->mapJira2Zentao = 'Map Jira To Zentao';
|
||||
$lang->convert->jira->dbNameNotice = 'Please type jira database';
|
||||
$lang->convert->jira->importNotice = 'Notice: Importing data is risky! Make sure to complete the following steps in sequence before merging.';
|
||||
$lang->convert->jira->dbDesc = '<p>If your Jira uses MySQL database, please choose this way.</p>';
|
||||
$lang->convert->jira->fileDesc = '<p>Choose this method if your Jira uses a non-MySQL database.</p>';
|
||||
$lang->convert->jira->jiraObject = 'Jira Issues';
|
||||
$lang->convert->jira->zentaoObject = 'Zentao Object';
|
||||
$lang->convert->jira->jiraLinkType = 'Jira Relates';
|
||||
$lang->convert->jira->zentaoLinkType = 'Zentao Link Type';
|
||||
$lang->convert->jira->jiraResolution = 'Jira Resolution';
|
||||
$lang->convert->jira->zentaoResolution = 'Zentao Resolution';
|
||||
$lang->convert->jira->zentaoReason = 'Zentao Story Closed Reason';
|
||||
$lang->convert->jira->jiraStatus = 'Jira Issues Status';
|
||||
$lang->convert->jira->storyStatus = 'Zentao Story Status';
|
||||
$lang->convert->jira->storyStage = 'Zentao Story Stage';
|
||||
$lang->convert->jira->bugStatus = 'Zentao Bug Status';
|
||||
$lang->convert->jira->taskStatus = 'Zentao Task Status';
|
||||
$lang->convert->jira->initJiraUser = 'Init Jira User';
|
||||
$lang->convert->jira->importJira = 'Import Jira';
|
||||
$lang->convert->jira->start = 'Start';
|
||||
|
||||
$lang->convert->jira->dbNameEmpty = 'Jira database name cannot be empty!';
|
||||
$lang->convert->jira->invalidDB = 'Invalid database name!';
|
||||
$lang->convert->jira->invalidTable = 'This database is not a Jira database!';
|
||||
$lang->convert->jira->passwordNotice = "<span class='text-red'>Set the default password of Jira users after they are imported into ZenTao. Users can modify the password in ZenTao later.</span>";
|
||||
$lang->convert->jira->groupNotice = "<span class='text-red'>Set the default permission grouping of Jira users after importing into ZenTao.</span>";
|
||||
$lang->convert->jira->passwordDifferent = 'Password do not match!';
|
||||
$lang->convert->jira->passwordEmpty = 'Password can not be empty!';
|
||||
$lang->convert->jira->passwordLess = 'Password must not be less than six characters!';
|
||||
$lang->convert->jira->importSuccessfully = 'Done!';
|
||||
$lang->convert->jira->importResult = "Import <strong class='text-red'>%s</strong> data, <strong class='%scount'>%s</strong> pieces of data processed;";
|
||||
$lang->convert->jira->importing = 'Data is being imported, please do not switch to other pages.';
|
||||
|
||||
$lang->convert->jira->zentaoObjectList[''] = '';
|
||||
$lang->convert->jira->zentaoObjectList['task'] = 'Task';
|
||||
$lang->convert->jira->zentaoObjectList['requirement'] = 'Requirement';
|
||||
$lang->convert->jira->zentaoObjectList['story'] = 'Story';
|
||||
$lang->convert->jira->zentaoObjectList['bug'] = 'Bug';
|
||||
|
||||
$lang->convert->jira->zentaoLinkTypeList['subTaskLink'] = 'Parent-Child Task';
|
||||
$lang->convert->jira->zentaoLinkTypeList['subStoryLink'] = 'Parent-Child Story';
|
||||
$lang->convert->jira->zentaoLinkTypeList['duplicate'] = 'Duplicate';
|
||||
$lang->convert->jira->zentaoLinkTypeList['relates'] = 'Relates';
|
||||
|
||||
$lang->convert->jira->steps[1] = 'Objects';
|
||||
$lang->convert->jira->steps[2] = 'Relates';
|
||||
$lang->convert->jira->steps[3] = 'Resolution';
|
||||
$lang->convert->jira->steps[4] = 'Status';
|
||||
|
||||
$lang->convert->jira->importSteps['db'][1] = 'Backup ZenTao database, backup Jira database.';
|
||||
$lang->convert->jira->importSteps['db'][2] = 'Using ZenTao when importing data will cause performance pressure on the server, please try to ensure that no one is using ZenTao when importing data.';
|
||||
$lang->convert->jira->importSteps['db'][3] = 'Import the Jira database into the Mysql used by ZenTao, the name is distinguished from the ZenTao database.';
|
||||
$lang->convert->jira->importSteps['db'][4] = "Put the Jira <strong class='text-red'> attachments</strong> directory under <strong class='text-red'>%s</strong>, Make sure you have enough disk space on the ZenTao server.";
|
||||
$lang->convert->jira->importSteps['db'][5] = "After the above steps are completed, please enter the Jira database name to proceed to the next step.";
|
||||
|
||||
$lang->convert->jira->importSteps['file'][1] = 'Backup ZenTao database, backup Jira database.';
|
||||
$lang->convert->jira->importSteps['file'][2] = 'Using ZenTao when importing data will cause performance pressure on the server, please try to ensure that no one is using ZenTao when importing data.';
|
||||
$lang->convert->jira->importSteps['file'][3] = "Put the Jira backup file <strong class='text-red'>entities.xml</strong> under <strong class='text-red'>%s</strong>.";
|
||||
$lang->convert->jira->importSteps['file'][4] = "Put the Jira <strong class='text-red'> attachments</strong> directory under <strong class='text-red'>%s</strong>, Make sure you have enough disk space on the ZenTao server.";
|
||||
$lang->convert->jira->importSteps['file'][5] = "After the above steps are completed, click Next.";
|
||||
|
||||
$lang->convert->jira->objectList['user'] = 'User';
|
||||
$lang->convert->jira->objectList['project'] = 'Project';
|
||||
$lang->convert->jira->objectList['issue'] = 'Issue';
|
||||
$lang->convert->jira->objectList['build'] = 'Build';
|
||||
$lang->convert->jira->objectList['issuelink'] = 'Issue Link';
|
||||
$lang->convert->jira->objectList['action'] = 'Action';
|
||||
$lang->convert->jira->objectList['file'] = 'File';
|
||||
|
||||
@@ -120,7 +120,7 @@ $lang->convert->jira->method = '选择导入方式';
|
||||
$lang->convert->jira->next = '下一步';
|
||||
$lang->convert->jira->importFromDB = '从数据库导入';
|
||||
$lang->convert->jira->importFromFile = '从文件导入';
|
||||
$lang->convert->jira->mapJira2Zentao = '设置对应关系';
|
||||
$lang->convert->jira->mapJira2Zentao = '设置Jira与禅道数据对应关系';
|
||||
$lang->convert->jira->dbNameNotice = '请输入Jira数据库名字';
|
||||
$lang->convert->jira->importNotice = '注意:导入数据有风险!请务必确保如下操作步骤依次完成,再进行合并。';
|
||||
$lang->convert->jira->dbDesc = '<p>如果您的Jira使用Mysql数据库, 请选择此方式</p>';
|
||||
@@ -164,6 +164,11 @@ $lang->convert->jira->zentaoLinkTypeList['subStoryLink'] = '父-子需求';
|
||||
$lang->convert->jira->zentaoLinkTypeList['duplicate'] = '重复对象';
|
||||
$lang->convert->jira->zentaoLinkTypeList['relates'] = '互相关联';
|
||||
|
||||
$lang->convert->jira->steps[1] = '对象';
|
||||
$lang->convert->jira->steps[2] = '对象关联关系';
|
||||
$lang->convert->jira->steps[3] = '解决方案';
|
||||
$lang->convert->jira->steps[4] = '状态';
|
||||
|
||||
$lang->convert->jira->importSteps['db'][1] = '备份禅道数据库,备份Jira数据库。';
|
||||
$lang->convert->jira->importSteps['db'][2] = '导入数据时使用禅道会给服务器造成性能压力,请尽量保证导入数据时无人使用禅道。';
|
||||
$lang->convert->jira->importSteps['db'][3] = '将Jira数据库导入到禅道使用的Mysql中,名字和禅道数据库区别开来。';
|
||||
@@ -172,7 +177,7 @@ $lang->convert->jira->importSteps['db'][4] = "将Jira附件目录<strong class
|
||||
$lang->convert->jira->importSteps['db'][5] = "上述步骤完成后,请输入Jira数据库名字进行下一步。";
|
||||
$lang->convert->jira->importSteps['file'][1] = '备份禅道数据库,备份Jira数据库。';
|
||||
$lang->convert->jira->importSteps['file'][2] = '导入数据时使用禅道会给服务器造成性能压力,请尽量保证导入数据时无人使用禅道。';
|
||||
$lang->convert->jira->importSteps['file'][3] = "将Jira的备份文件 <strong class='text-red'>entities.xml</strong> 放到 <strong class='text-red'>%s</strong> 下。";
|
||||
$lang->convert->jira->importSteps['file'][3] = "将Jira的备份文件 <strong class='text-red'>entities.xml</strong> 放到 <strong class='text-red'>%s</strong> 下,并给该目录读写权限。";
|
||||
$lang->convert->jira->importSteps['file'][4] = "将Jira附件目录<strong class='text-red'> attachments</strong> 放到 <strong class='text-red'>%s</strong> 下,确保禅道服务器磁盘空间足够。";
|
||||
$lang->convert->jira->importSteps['file'][5] = "上述步骤完成后,点击下一步。";
|
||||
|
||||
|
||||
+102
-38
@@ -194,11 +194,14 @@ class convertModel extends model
|
||||
*/
|
||||
public function getJiraDataFromFile($module, $lastID = 0, $limit = 0)
|
||||
{
|
||||
$filename = $module;
|
||||
$fileName = $module;
|
||||
if($module == 'build') $filename = 'version';
|
||||
if($module == 'file') $filename = 'fileattachment';
|
||||
|
||||
$xmlContent = file_get_contents($this->app->getTmpRoot() . 'jirafile/' . $filename. '.xml');
|
||||
$filePath = $this->app->getTmpRoot() . 'jirafile/' . $fileName . '.xml';
|
||||
if(!file_exists($filePath)) return array();
|
||||
|
||||
$xmlContent = file_get_contents($filePath);
|
||||
$xmlContent = preg_replace ('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $xmlContent);
|
||||
$parsedXML = simplexml_load_string($xmlContent, SimpleXMLElement::class, LIBXML_NOCDATA);
|
||||
|
||||
@@ -206,20 +209,27 @@ class convertModel extends model
|
||||
$parsedXML = $this->object2Array($parsedXML);
|
||||
foreach($parsedXML as $key => $xmlArray)
|
||||
{
|
||||
if(strtolower($key) != strtolower($filename)) continue;
|
||||
if(strtolower($key) != strtolower($fileName)) continue;
|
||||
foreach($xmlArray as $key => $attributes)
|
||||
{
|
||||
$desc = isset($attributes['description']) ? $attributes['description'] : '';
|
||||
$summary = isset($attributes['summary']) ? $attributes['summary'] : '';
|
||||
$body = isset($attributes['body']) ? $attributes['body'] : '';
|
||||
|
||||
foreach($attributes as $value)
|
||||
if(is_numeric($key))
|
||||
{
|
||||
if(!is_array($value)) continue;
|
||||
if(!empty($desc)) $value['description'] = $desc;
|
||||
if(!empty($summary)) $value['summary'] = $summary;
|
||||
if(!empty($body)) $value['body'] = $body;
|
||||
$dataList[$value['id']] = $value;
|
||||
foreach($attributes as $value)
|
||||
{
|
||||
if(!is_array($value)) continue;
|
||||
if(!empty($desc)) $value['description'] = $desc;
|
||||
if(!empty($summary)) $value['summary'] = $summary;
|
||||
if(!empty($body)) $value['body'] = $body;
|
||||
$dataList[$value['id']] = $value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$dataList[$attributes['id']] = $attributes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -455,13 +465,13 @@ class convertModel extends model
|
||||
break;
|
||||
}
|
||||
|
||||
if($module == 'user') $this->importJiraUser($dataList);
|
||||
if($module == 'project') $this->importJiraProject($dataList);
|
||||
if($module == 'issue') $this->importJiraIssue($dataList);
|
||||
if($module == 'user') $this->importJiraUser($dataList, 'file');
|
||||
if($module == 'project') $this->importJiraProject($dataList, 'file');
|
||||
if($module == 'issue') $this->importJiraIssue($dataList, 'file');
|
||||
if($module == 'build') $this->importJiraBuild($dataList, 'file');
|
||||
if($module == 'issuelink') $this->importJiraIssueLink($dataList);
|
||||
if($module == 'action') $this->importJiraAction($dataList);
|
||||
if($module == 'file') $this->importJiraFile($dataList);
|
||||
if($module == 'issuelink') $this->importJiraIssueLink($dataList, 'file');
|
||||
if($module == 'action') $this->importJiraAction($dataList, 'file');
|
||||
if($module == 'file') $this->importJiraFile($dataList, 'file');
|
||||
|
||||
$offset = $lastID + $limit;
|
||||
return array('type' => $module, 'count' => count($dataList), 'lastID' => $offset);
|
||||
@@ -476,10 +486,11 @@ class convertModel extends model
|
||||
* Import jira user.
|
||||
*
|
||||
* @param object $dataList
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importJiraUser($dataList)
|
||||
public function importJiraUser($dataList, $method = 'db')
|
||||
{
|
||||
$localUsers = $this->dao->dbh($this->dbh)->select('account')->from(TABLE_USER)->where('deleted')->eq('0')->fetchPairs();
|
||||
$userConfig = $this->session->jiraUser;
|
||||
@@ -515,10 +526,11 @@ class convertModel extends model
|
||||
* Import jira project.
|
||||
*
|
||||
* @param object $dataList
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importJiraProject($dataList)
|
||||
public function importJiraProject($dataList, $method = 'db')
|
||||
{
|
||||
global $app;
|
||||
$app->loadConfig('execution');
|
||||
@@ -543,8 +555,8 @@ class convertModel extends model
|
||||
$project->acl = 'open';
|
||||
$project->end = date('Y-m-d', time() + 24 * 3600);
|
||||
|
||||
$project->PM = $this->getJiraAccount($data->LEAD);
|
||||
$project->openedBy = $this->getJiraAccount($data->LEAD);
|
||||
$project->PM = $this->getJiraAccount($data->LEAD, $method);
|
||||
$project->openedBy = $this->getJiraAccount($data->LEAD, $method);
|
||||
$project->openedDate = $now;
|
||||
$project->openedVersion = $this->config->version;
|
||||
|
||||
@@ -667,10 +679,11 @@ class convertModel extends model
|
||||
* Import jira issue.
|
||||
*
|
||||
* @param object $dataList
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importJiraIssue($dataList)
|
||||
public function importJiraIssue($dataList, $method = 'db')
|
||||
{
|
||||
$relations = $this->session->jiraRelation;
|
||||
|
||||
@@ -732,9 +745,9 @@ class convertModel extends model
|
||||
$story->version = 1;
|
||||
$story->stage = $this->convertStage($data->issuestatus);
|
||||
$story->status = $this->convertStatus('story', $data->issuestatus);
|
||||
$story->openedBy = $this->getJiraAccount($data->CREATOR);
|
||||
$story->openedBy = $this->getJiraAccount($data->CREATOR, $method);
|
||||
$story->openedDate = substr($data->CREATED, 0, 19);
|
||||
$story->assignedTo = $this->getJiraAccount($data->ASSIGNEE);
|
||||
$story->assignedTo = $this->getJiraAccount($data->ASSIGNEE, $method);
|
||||
|
||||
if($data->RESOLUTION)
|
||||
{
|
||||
@@ -799,9 +812,9 @@ class convertModel extends model
|
||||
$task->pri = $data->PRIORITY;
|
||||
$task->status = $this->convertStatus('task', $data->issuestatus);
|
||||
$task->desc = $data->DESCRIPTION;
|
||||
$task->openedBy = $this->getJiraAccount($data->CREATOR);
|
||||
$task->openedBy = $this->getJiraAccount($data->CREATOR, $method);
|
||||
$task->openedDate = substr($data->CREATED, 0, 19);
|
||||
$task->assignedTo = $this->getJiraAccount($data->ASSIGNEE);
|
||||
$task->assignedTo = $this->getJiraAccount($data->ASSIGNEE, $method);
|
||||
if($data->RESOLUTION)
|
||||
{
|
||||
$task->closedReason = zget($reasonList, $data->RESOLUTION, '');
|
||||
@@ -841,10 +854,10 @@ class convertModel extends model
|
||||
$bug->pri = $data->PRIORITY;
|
||||
$bug->status = $this->convertStatus('bug', $data->issuestatus);
|
||||
$bug->steps = $data->DESCRIPTION;
|
||||
$bug->openedBy = $this->getJiraAccount($data->CREATOR);
|
||||
$bug->openedBy = $this->getJiraAccount($data->CREATOR, $method);
|
||||
$bug->openedDate = substr($data->CREATED, 0, 19);
|
||||
$bug->openedBuild = 'trunk';
|
||||
$bug->assignedTo = $this->getJiraAccount($data->ASSIGNEE);
|
||||
$bug->assignedTo = $this->getJiraAccount($data->ASSIGNEE, $method);
|
||||
|
||||
if($data->RESOLUTION)
|
||||
{
|
||||
@@ -984,10 +997,11 @@ class convertModel extends model
|
||||
* Import jira issue link.
|
||||
*
|
||||
* @param object $dataList
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importJiraIssueLink($dataList)
|
||||
public function importJiraIssueLink($dataList, $method = 'db')
|
||||
{
|
||||
$issueLinkTypeList = array();
|
||||
$relations = $this->session->jiraRelation;
|
||||
@@ -1107,10 +1121,11 @@ class convertModel extends model
|
||||
* Import jira action.
|
||||
*
|
||||
* @param object $dataList
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importJiraAction($dataList)
|
||||
public function importJiraAction($dataList, $method = 'db')
|
||||
{
|
||||
$issueStories = $this->dao->dbh($this->dbh)->select('AID,BID')->from(JIRA_TMPRELATION)
|
||||
->where('AType')->eq('jstory')
|
||||
@@ -1159,7 +1174,7 @@ class convertModel extends model
|
||||
$action = new stdclass();
|
||||
$action->objectType = $objectType;
|
||||
$action->objectID = $objectID;
|
||||
$action->actor = $this->getJiraAccount($data->AUTHOR);
|
||||
$action->actor = $this->getJiraAccount($data->AUTHOR, $method);
|
||||
$action->action = 'commented';
|
||||
$action->date = substr($data->CREATED, 0, 19);
|
||||
$action->comment = $comment;
|
||||
@@ -1171,10 +1186,11 @@ class convertModel extends model
|
||||
* Import jira file.
|
||||
*
|
||||
* @param object $dataList
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function importJiraFile($dataList)
|
||||
public function importJiraFile($dataList, $method = 'db')
|
||||
{
|
||||
$this->loadModel('file');
|
||||
|
||||
@@ -1225,7 +1241,7 @@ class convertModel extends model
|
||||
$file->size = $fileAttachment->FILESIZE;
|
||||
$file->objectType = $objectType;
|
||||
$file->objectID = $objectID;
|
||||
$file->addedBy = $this->getJiraAccount($fileAttachment->AUTHOR);
|
||||
$file->addedBy = $this->getJiraAccount($fileAttachment->AUTHOR, $method);
|
||||
$file->addedDate = substr($fileAttachment->CREATED, 0, 19);
|
||||
$this->dao->dbh($this->dbh)->insert(TABLE_FILE)->data($file)->exec();
|
||||
|
||||
@@ -1281,14 +1297,61 @@ class convertModel extends model
|
||||
* Get jira account.
|
||||
*
|
||||
* @param string $userKey
|
||||
* @param string $method
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getJiraAccount($userKey)
|
||||
public function getJiraAccount($userKey, $method = 'db')
|
||||
{
|
||||
if(strpos($userKey, 'JIRAUSER') === false) return $userKey;
|
||||
|
||||
return $this->dao->dbh($this->sourceDBH)->select('lower_user_name')->from(JIRA_USER)->where('user_key')->eq($userKey)->fetch('lower_user_name');
|
||||
if($method == 'db')
|
||||
{
|
||||
return $this->dao->dbh($this->sourceDBH)->select('lower_user_name')->from(JIRA_USER)->where('user_key')->eq($userKey)->fetch('lower_user_name');
|
||||
}
|
||||
else
|
||||
{
|
||||
$appUsers = $this->getJiraAppUser();
|
||||
return zget($appUsers, $userKey, $userKey);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get jira app user pairs.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getJiraAppUser()
|
||||
{
|
||||
$xmlContent = file_get_contents($this->app->getTmpRoot() . 'jirafile/applicationuser.xml');
|
||||
$xmlContent = preg_replace ('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $xmlContent);
|
||||
$parsedXML = simplexml_load_string($xmlContent, SimpleXMLElement::class, LIBXML_NOCDATA);
|
||||
|
||||
$pairs = array();
|
||||
$parsedXML = $this->object2Array($parsedXML);
|
||||
foreach($parsedXML as $key => $xmlArray)
|
||||
{
|
||||
if(strtolower($key) != 'applicationuser') continue;
|
||||
foreach($xmlArray as $key => $attributes)
|
||||
{
|
||||
if(is_numeric($key))
|
||||
{
|
||||
foreach($attributes as $value)
|
||||
{
|
||||
if(!is_array($value)) continue;
|
||||
if(!isset($value['userKey'])) continue;
|
||||
$pairs[$value['userKey']] = $value['lowerUserName'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$pairs[$attributes['userKey']] = $attributes['lowerUserName'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $pairs;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1305,8 +1368,8 @@ class convertModel extends model
|
||||
$handle = fopen($file, "r");
|
||||
|
||||
$usingData = array();
|
||||
$headerList = array('<Action', '<Project', '<Status', '<Resolution', '<User', '<Issue', '<ChangeGroup', '<ChangeItem', '<IssueLink', '<IssueLinkType', '<FileAttachment', '<Version', '<IssueType', '<NodeAssociation');
|
||||
$footerList = array('<Action' => '</Action>', '<Project' => '</Project>', '<Status' => '</Status>', '<Resolution' => '</Resolution>', '<User' => '</User>', '<Issue' => '</Issue>', '<ChangeGroup' => '</ChangeGroup>', '<ChangeItem' => '</ChangeItem>', '<IssueLink' => '</IssueLink>', '<IssueLinkType' => '</IssueLinkType>', '<FileAttachment' => '</FileattAchment>', '<Version' => '</Version>', '<IssueType' => '</IssueType>', '<NodeAssociation' => '</NodeAssociation>');
|
||||
$headerList = array('<Action', '<Project', '<Status', '<Resolution', '<User', '<Issue', '<ChangeGroup', '<ChangeItem', '<IssueLink', '<IssueLinkType', '<FileAttachment', '<Version', '<IssueType', '<NodeAssociation', '<ApplicationUser');
|
||||
$footerList = array('<Action' => '</Action>', '<Project' => '</Project>', '<Status' => '</Status>', '<Resolution' => '</Resolution>', '<User' => '</User>', '<Issue' => '</Issue>', '<ChangeGroup' => '</ChangeGroup>', '<ChangeItem' => '</ChangeItem>', '<IssueLink' => '</IssueLink>', '<IssueLinkType' => '</IssueLinkType>', '<FileAttachment' => '</FileattAchment>', '<Version' => '</Version>', '<IssueType' => '</IssueType>', '<NodeAssociation' => '</NodeAssociation>', '<ApplicationUser' => '</ApplicationUser>');
|
||||
|
||||
while(!feof($handle))
|
||||
{
|
||||
@@ -1339,9 +1402,10 @@ class convertModel extends model
|
||||
|
||||
foreach($headerList as $object)
|
||||
{
|
||||
$object = str_replace('<', '', $object);
|
||||
$object = strtolower($object);
|
||||
file_put_contents($filePath . $object . '.xml', '</entity-engine-xml>', FILE_APPEND);
|
||||
$object = str_replace('<', '', $object);
|
||||
$object = strtolower($object);
|
||||
$filename = $filePath . $object . '.xml';
|
||||
if(file_exists($filename)) file_put_contents($filename, '</entity-engine-xml>', FILE_APPEND);
|
||||
}
|
||||
|
||||
fclose($handle);
|
||||
|
||||
@@ -10,13 +10,27 @@
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='main-header'>
|
||||
<h2>
|
||||
<?php echo $lang->convert->jira->mapJira2Zentao;?>
|
||||
</h2>
|
||||
<div id="mainMenu" class="clearfix">
|
||||
<div class="btn-toolbar pull-left">
|
||||
<?php echo html::a("javascript::void(0);", "<span class='text'>" . $lang->convert->jira->mapJira2Zentao . '</span>', '', "class='btn btn-link btn-active-text'");?>
|
||||
</div>
|
||||
</div>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<form class='main-form form-ajax' method='post'>
|
||||
<div class='main-header text-center'>
|
||||
<ul class='nav nav-primary'>
|
||||
<?php foreach($lang->convert->jira->steps as $key => $label):?>
|
||||
<?php $active = $step == $key ? 'class="active"' : '';?>
|
||||
<li <?php echo $active;?>>
|
||||
<a><?php echo $label;?></a>
|
||||
</li>
|
||||
<?php endforeach;?>
|
||||
</ul>
|
||||
<div class='btn-toolbar pull-right'>
|
||||
<?php echo html::submitButton($lang->convert->jira->next);?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($step == 1):?>
|
||||
<table class='table table-form'>
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
@@ -35,6 +49,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<?php endif;?>
|
||||
<?php if($step == 2):?>
|
||||
<table class='table table-form'>
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
@@ -53,6 +69,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<?php endif;?>
|
||||
<?php if($step == 3):?>
|
||||
<table class='table table-form'>
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
@@ -73,6 +91,8 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
<?php endif;?>
|
||||
<?php if($step == 4):?>
|
||||
<table class='table table-form'>
|
||||
<thead>
|
||||
<tr class='text-center'>
|
||||
@@ -95,11 +115,7 @@
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="5" class="text-center form-actions"><?php echo html::submitButton($lang->convert->jira->next);?></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<?php endif;?>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user