Merge branch 'master' of git@github.com:easysoft/zentaopms

This commit is contained in:
azhi
2013-07-29 15:42:34 +08:00
26 changed files with 174 additions and 64 deletions
+1 -1
View File
@@ -1 +1 @@
4.2.beta
4.3.beta
+4 -4
View File
@@ -237,7 +237,7 @@ class control
}
$modelClass = class_exists('ext' . $moduleName. 'model') ? 'ext' . $moduleName . 'model' : $moduleName . 'model';
if(!class_exists($modelClass)) $this->app->error(" The model $modelClass not found", __FILE__, __LINE__, $exit = true);
if(!class_exists($modelClass)) $this->app->triggerError(" The model $modelClass not found", __FILE__, __LINE__, $exit = true);
$this->$moduleName = new $modelClass();
$this->dao = $this->$moduleName->dao;
@@ -300,7 +300,7 @@ class control
$extHookFiles = glob($viewExtPath . $this->viewPrefix . $methodName . "*.{$viewType}.hook.php");
$viewFile = file_exists($extViewFile) ? $extViewFile : $mainViewFile;
if(!is_file($viewFile)) $this->app->error("the view file $viewFile not found", __FILE__, __LINE__, $exit = true);
if(!is_file($viewFile)) $this->app->triggerError("the view file $viewFile not found", __FILE__, __LINE__, $exit = true);
if(!empty($extHookFiles)) return array('viewFile' => $viewFile, 'hookFiles' => $extHookFiles);
return $viewFile;
}
@@ -542,14 +542,14 @@ class control
$file2Included = file_exists($actionExtFile) ? $actionExtFile : $moduleControlFile;
/* Load the control file. */
if(!is_file($file2Included)) $this->app->error("The control file $file2Included not found", __FILE__, __LINE__, $exit = true);
if(!is_file($file2Included)) $this->app->triggerError("The control file $file2Included not found", __FILE__, __LINE__, $exit = true);
$currentPWD = getcwd();
chdir(dirname($file2Included));
if($moduleName != $this->moduleName) helper::import($file2Included);
/* Set the name of the class to be called. */
$className = class_exists("my$moduleName") ? "my$moduleName" : $moduleName;
if(!class_exists($className)) $this->app->error(" The class $className not found", __FILE__, __LINE__, $exit = true);
if(!class_exists($className)) $this->app->triggerError(" The class $className not found", __FILE__, __LINE__, $exit = true);
/* Parse the params, create the $module control object. */
if(!is_array($params)) parse_str($params, $params);
+1 -1
View File
@@ -179,7 +179,7 @@ class model
if(!helper::import($modelFile)) return false;
$modelClass = class_exists('ext' . $moduleName. 'model') ? 'ext' . $moduleName . 'model' : $moduleName . 'model';
if(!class_exists($modelClass)) $this->app->error(" The model $modelClass not found", __FILE__, __LINE__, $exit = true);
if(!class_exists($modelClass)) $this->app->triggerError(" The model $modelClass not found", __FILE__, __LINE__, $exit = true);
$this->$moduleName = new $modelClass();
return $this->$moduleName;
+1 -1
View File
@@ -55,7 +55,7 @@ class commonModel extends model
else
{
$company = $this->loadModel('company')->getFirst();
if(!$company) $this->app->error(sprintf($this->lang->error->companyNotFound, $httpHost), __FILE__, __LINE__, $exit = true);
if(!$company) $this->app->triggerError(sprintf($this->lang->error->companyNotFound, $httpHost), __FILE__, __LINE__, $exit = true);
$this->session->set('company', $company);
$this->app->company = $company;
}
+2 -2
View File
@@ -77,7 +77,7 @@ $(document).ready(function()
var contentType = arr[0].split(";")[0].split(":")[1];
html = '<img src="' + result + '" alt="" />';
$.post(createLink('file', 'ajaxEditorImage'), {editor: html}, function(data){cmd.inserthtml(data);});
$.post(createLink('file', 'ajaxPasteImage'), {editor: html}, function(data){cmd.inserthtml(data);});
};
reader.readAsDataURL(file);
@@ -94,7 +94,7 @@ $(document).ready(function()
var html = K(doc.body).html();
if(html.search(/<img src="data:.+;base64,/) > -1)
{
$.post(createLink('file', 'ajaxEditorImage'), {editor: html}, function(data){K(doc.body).html(data);});
$.post(createLink('file', 'ajaxPasteImage'), {editor: html}, function(data){K(doc.body).html(data);});
}
}, 80);
});
+5 -5
View File
@@ -88,7 +88,7 @@ class file extends control
if($mode == 'open')
{
if(file_exists($file->realPath))$this->locate($file->webPath);
$this->app->error("The file you visit $fileID not found.", __FILE__, __LINE__, true);
$this->app->triggerError("The file you visit $fileID not found.", __FILE__, __LINE__, true);
}
else
{
@@ -101,7 +101,7 @@ class file extends control
}
else
{
$this->app->error("The file you visit $fileID not found.", __FILE__, __LINE__, true);
$this->app->triggerError("The file you visit $fileID not found.", __FILE__, __LINE__, true);
}
}
}
@@ -293,16 +293,16 @@ class file extends control
}
/**
* Ajax replace editor image
* Paste image in kindeditor at firefox and chrome.
*
* @access public
* @return void
*/
public function ajaxEditorImage()
public function ajaxPasteImage()
{
if($_POST)
{
$data = $this->file->replaceEditorImage($this->post->editor);
$data = $this->file->pasteImage($this->post->editor);
echo str_replace('\"', '"', $data);
}
}
+9 -8
View File
@@ -237,30 +237,31 @@ class fileModel extends model
}
/**
* Replace editor image
* Paste image in kindeditor at firefox and chrome.
*
* @param string $data
* @access public
* @return string
*/
public function replaceEditorImage($data)
public function pasteImage($data)
{
preg_match_all('/<img src=\\\"(data:image\/(\w+);base64,(.+))\\\" .+ \/>/U', $data, $out);
foreach($out[3] as $id => $base64Image)
ini_set('pcre.backtrack_limit', strlen($data));
preg_match_all('/<img src=\\\"(data:image\/(\S+);base64,(\S+))\\\" .+ \/>/U', $data, $out);
foreach($out[3] as $key => $base64Image)
{
$imageData = base64_decode($base64Image);
$file['extension'] = $out[2][$id];
$file['pathname'] = $this->setPathName($id, $file['extension']);
$file['extension'] = $out[2][$key];
$file['pathname'] = $this->setPathName($key, $file['extension']);
$file['size'] = strlen($imageData);
$file['addedBy'] = $this->app->user->account;
$file['addedDate'] = helper::today();
$file['title'] = 'Paste in editor';
$file['title'] = basename($file['pathname']);
file_put_contents($this->savePath . $file['pathname'], $imageData);
$this->dao->insert(TABLE_FILE)->data($file)->exec();
$data = str_replace($out[1][$id], $this->webPath . $file['pathname'], $data);
$data = str_replace($out[1][$key], $this->webPath . $file['pathname'], $data);
}
return $data;
+6
View File
@@ -185,6 +185,9 @@ $lang->resource->productplan->view = 'view';
$lang->resource->productplan->linkStory = 'linkStory';
$lang->resource->productplan->unlinkStory = 'unlinkStory';
$lang->resource->productplan->batchUnlinkStory = 'batchUnlinkStory';
$lang->resource->productplan->linkBug = 'linkBug';
$lang->resource->productplan->unlinkBug = 'unlinkBug';
$lang->resource->productplan->batchUnlinkBug = 'batchUnlinkBug';
$lang->productplan->methodOrder[5] = 'browse';
$lang->productplan->methodOrder[10] = 'create';
@@ -194,6 +197,9 @@ $lang->productplan->methodOrder[25] = 'view';
$lang->productplan->methodOrder[30] = 'linkStory';
$lang->productplan->methodOrder[35] = 'unlinkStory';
$lang->productplan->methodOrder[40] = 'batchUnlinkStory';
$lang->productplan->methodOrder[45] = 'linkBug';
$lang->productplan->methodOrder[50] = 'unlinkBug';
$lang->productplan->methodOrder[55] = 'batchUnlinkBug';
/* Release. */
$lang->resource->release = new stdclass();
+1 -1
View File
@@ -165,7 +165,7 @@ class mailModel extends model
$this->mta = self::$instance;
$this->mta->CharSet = $this->config->charset;
$funcName = "set{$this->config->mail->mta}";
if(!method_exists($this, $funcName)) $this->app->error("The MTA {$this->config->mail->mta} not supported now.", __FILE__, __LINE__, $exit = true);
if(!method_exists($this, $funcName)) $this->app->triggerError("The MTA {$this->config->mail->mta} not supported now.", __FILE__, __LINE__, $exit = true);
$this->$funcName();
}
+3
View File
@@ -278,6 +278,8 @@ class my extends control
->Where('t1.assignedTo')->eq($this->app->user->account)
->andWhere('t1.status')->ne('done')
->andWhere('t3.status')->ne('done')
->andWhere('t3.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll();
}
elseif($type == 'donebyme')
@@ -286,6 +288,7 @@ class my extends control
->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case = t2.id')
->Where('t1.assignedTo')->eq($this->app->user->account)
->andWhere('t1.status')->eq('done')
->andWhere('t2.deleted')->eq(0)
->orderBy($orderBy)->page($pager)->fetchAll();
}
elseif($type == 'openedbyme')
+10 -9
View File
@@ -143,15 +143,16 @@ class productplan extends control
$plan = $this->productplan->getByID($planID, true);
if(!$plan) die(js::error($this->lang->notFound) . js::locate('back'));
$this->commonAction($plan->product);
$products = $this->product->getPairs();
$this->view->title = "PLAN #$plan->id $plan->title/" . $products[$plan->product];
$this->view->position[] = $this->lang->productplan->view;
$this->view->planStories= $this->loadModel('story')->getPlanStories($planID);
$this->view->products = $products;
$this->view->summary = $this->product->summary($this->view->planStories);
$this->view->plan = $plan;
$this->view->actions = $this->loadModel('action')->getList('productplan', $planID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$products = $this->product->getPairs();
$this->view->title = "PLAN #$plan->id $plan->title/" . $products[$plan->product];
$this->view->position[] = $this->lang->productplan->view;
$this->view->planStories = $this->loadModel('story')->getPlanStories($planID);
$this->view->planBugs = $this->loadModel('bug')->getPlanBugs($planID);
$this->view->products = $products;
$this->view->summary = $this->product->summary($this->view->planStories);
$this->view->plan = $plan;
$this->view->actions = $this->loadModel('action')->getList('productplan', $planID);
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->display();
}
+13 -11
View File
@@ -9,22 +9,26 @@
* @version $Id: en.php 4659 2013-04-17 06:45:08Z chencongzhi520@gmail.com $
* @link http://www.zentao.net
*/
$lang->productplan->common = 'Plan';
$lang->productplan->browse = "Browse";
$lang->productplan->index = "Index";
$lang->productplan->create = "Create";
$lang->productplan->edit = "Edit";
$lang->productplan->delete = "Delete";
$lang->productplan->view = "Info";
$lang->productplan->common = 'Plan';
$lang->productplan->browse = "Browse";
$lang->productplan->index = "Index";
$lang->productplan->create = "Create";
$lang->productplan->edit = "Edit";
$lang->productplan->delete = "Delete";
$lang->productplan->view = "Info";
$lang->productplan->bugSummary = "Total %s bugs in this page";
$lang->productplan->basicInfo = 'Basic Info';
$lang->productplan->batchUnlink = "Batch Remove";
$lang->productplan->linkStory = "Link story";
$lang->productplan->unlinkStory = "Remove story";
$lang->productplan->batchUnlinkStory = "Batch Remove";
$lang->productplan->batchUnlinkStory = "Batch Remove Stories";
$lang->productplan->linkedStories = 'Stories linked';
$lang->productplan->unlinkedStories = 'Stories unlinked';
$lang->productplan->linkBug = "Link bug";
$lang->productplan->unlinkBug = "Remove bug";
$lang->productplan->batchUnlinkBug = "Batch Remove";
$lang->productplan->batchUnlinkBug = "Batch Remove Bugs";
$lang->productplan->linkedBugs = 'Bugs linked';
$lang->productplan->unlinkedBugs = 'Bugs unlinked';
@@ -32,8 +36,6 @@ $lang->productplan->confirmDelete = "Are you sure to delete this plan?";
$lang->productplan->confirmUnlinkStory = "Are you sure to remove this story?";
$lang->productplan->confirmUnlinkBug = "Are you sure to remove this bug?";
$lang->productplan->basicInfo ='Basic Info';
$lang->productplan->id = 'ID';
$lang->productplan->product = 'Product';
$lang->productplan->title = 'Title';
+13 -11
View File
@@ -9,22 +9,26 @@
* @version $Id: zh-cn.php 4659 2013-04-17 06:45:08Z chencongzhi520@gmail.com $
* @link http://www.zentao.net
*/
$lang->productplan->common = '产品计划';
$lang->productplan->browse = "浏览计划";
$lang->productplan->index = "计划列表";
$lang->productplan->create = "创建计划";
$lang->productplan->edit = "编辑计划";
$lang->productplan->delete = "删除计划";
$lang->productplan->view = "计划详情";
$lang->productplan->common = '产品计划';
$lang->productplan->browse = "浏览计划";
$lang->productplan->index = "计划列表";
$lang->productplan->create = "创建计划";
$lang->productplan->edit = "编辑计划";
$lang->productplan->delete = "删除计划";
$lang->productplan->view = "计划详情";
$lang->productplan->bugSummary = "本页共 <strong>%s</strong> 个Bug";
$lang->productplan->basicInfo = '基本信息';
$lang->productplan->batchUnlink = "批量移除";
$lang->productplan->linkStory = "关联需求";
$lang->productplan->unlinkStory = "移除需求";
$lang->productplan->batchUnlinkStory = "批量移除";
$lang->productplan->batchUnlinkStory = "批量移除需求";
$lang->productplan->linkedStories = '已关联需求列表';
$lang->productplan->unlinkedStories = '未关联需求列表';
$lang->productplan->linkBug = "关联Bug";
$lang->productplan->unlinkBug = "移除Bug";
$lang->productplan->batchUnlinkBug = "批量移除";
$lang->productplan->batchUnlinkBug = "批量移除Bug";
$lang->productplan->linkedBugs = '已关联Bug列表';
$lang->productplan->unlinkedBugs = '未关联Bug列表';
@@ -32,8 +36,6 @@ $lang->productplan->confirmDelete = "您确认删除该计划吗?";
$lang->productplan->confirmUnlinkStory = "您确认移除该需求吗?";
$lang->productplan->confirmUnlinkBug = "您确认移除该Bug吗?";
$lang->productplan->basicInfo ='基本信息';
$lang->productplan->id = '编号';
$lang->productplan->product = '产品';
$lang->productplan->title = '名称';
+1 -1
View File
@@ -37,8 +37,8 @@
<td><?php echo $plan->end;?></td>
<td class='a-center'>
<?php
common::printIcon('productplan', 'linkBug', "planID=$plan->id", '', 'list');
common::printIcon('productplan', 'linkStory', "planID=$plan->id", '', 'list');
common::printIcon('productplan', 'linkBug', "planID=$plan->id", '', 'list');
common::printIcon('productplan', 'edit', "planID=$plan->id", '', 'list');
common::printIcon('productplan', 'delete', "planID=$plan->id", '', 'list', '', 'hiddenwin');
?>
+1 -1
View File
@@ -95,7 +95,7 @@
<td colspan='7' class='a-left'>
<?php
echo html::selectAll('linkedBugsForm') . html::selectReverse('linkedBugsForm');
echo html::submitButton($lang->productplan->batchUnlinkBug);
echo html::submitButton($lang->productplan->batchUnlink);
?>
</td>
</tr>
+1 -1
View File
@@ -103,7 +103,7 @@
<td colspan='9' class='a-left'>
<?php
echo html::selectAll('linkedStoriesForm') . html::selectReverse('linkedStoriesForm');
echo html::submitButton($lang->productplan->batchUnlinkStory);
echo html::submitButton($lang->productplan->batchUnlink);
?>
</td>
</tr>
+50 -2
View File
@@ -27,8 +27,8 @@
$browseLink = $this->session->productPlanList ? $this->session->productPlanList : inlink('browse', "planID=$plan->id");
if(!$plan->deleted)
{
common::printIcon('productplan', 'linkBug', "planID=$plan->id");
common::printIcon('productplan', 'linkStory',"planID=$plan->id");
common::printIcon('productplan', 'linkBug', "planID=$plan->id");
common::printIcon('productplan', 'edit', "planID=$plan->id");
common::printIcon('productplan', 'delete', "planID=$plan->id", '', 'button', '', 'hiddenwin');
}
@@ -109,7 +109,7 @@
if(count($planStories) and $canBatchUnlink)
{
echo html::selectAll() . html::selectReverse();
echo html::submitButton($lang->productplan->batchUnlinkStory);
echo html::submitButton($lang->productplan->batchUnlink);
}
?>
</div>
@@ -119,4 +119,52 @@
</tfoot>
</table>
</form>
<form method='post' target='hiddenwin' action="<?php echo inLink('batchUnlinkBug');?>">
<table class='table-1 tablesorter a-center fixed'>
<caption class='caption-tl'><?php echo $plan->title .$lang->colon . $lang->productplan->linkedBugs;?></caption>
<thead>
<tr class='colhead'>
<th class='w-id'> <?php echo $lang->idAB;?></th>
<th class='w-pri'> <?php echo $lang->priAB;?></th>
<th> <?php echo $lang->bug->title;?></th>
<th class='w-user'> <?php echo $lang->openedByAB;?></th>
<th class='w-user'> <?php echo $lang->assignedToAB;?></th>
<th class='w-status'><?php echo $lang->statusAB;?></th>
<th class='w-50px {sorter:false}'><?php echo $lang->actions?></th>
</tr>
</thead>
<tbody>
<?php $canBatchUnlink = common::hasPriv('productPlan', 'batchUnlinkBug');?>
<?php foreach($planBugs as $bug):?>
<tr>
<td class='a-center'>
<?php if($canBatchUnlink):?>
<input class='ml-10px' type='checkbox' name='unlinkBugs[]' value='<?php echo $bug->id;?>'/>
<?php endif;?>
<?php echo html::a($this->createLink('bug', 'view', "bugID=$bug->id"), sprintf("%03d", $bug->id));?>
</td>
<td><span class='<?php echo 'pri' . $bug->pri?>'><?php echo $bug->pri;?></span></td>
<td class='a-left nobr'><?php echo html::a($this->createLink('bug', 'view', "bugID=$bug->id"), $bug->title);?></td>
<td><?php echo $users[$bug->openedBy];?></td>
<td><?php echo $users[$bug->assignedTo];?></td>
<td><?php echo $lang->bug->statusList[$bug->status];?></td>
<td><?php common::printIcon('productplan', 'unlinkBug', "bug=$bug->id", '', 'list', '', 'hiddenwin');?></td>
</tr>
<?php endforeach;?>
</tbody>
<tfoot>
<tr>
<td colspan='7'>
<div class='f-left'>
<?php
echo html::selectAll('linkedBugsForm') . html::selectReverse('linkedBugsForm');
echo html::submitButton($lang->productplan->batchUnlink);
?>
</div>
<div class='f-right'><?php echo sprintf($lang->productplan->bugSummary, count($planStories));?> </div>
</td>
</tr>
</tfoot>
</table>
</form>
<?php include '../../common/view/footer.html.php';?>
+5 -3
View File
@@ -323,12 +323,13 @@ class testcase extends control
/**
* View a test case.
*
* @param int $caseID
* @param int $version
* @param int $caseID
* @param int $version
* @param string $from
* @access public
* @return void
*/
public function view($caseID, $version = 0)
public function view($caseID, $version = 0, $from = 'testcase')
{
$case = $this->testcase->getById($caseID, $version);
if(!$case) die(js::error($this->lang->notFound) . js::locate('back'));
@@ -341,6 +342,7 @@ class testcase extends control
$this->view->position[] = $this->lang->testcase->view;
$this->view->case = $case;
$this->view->from = $from;
$this->view->version = $version ? $version : $case->version;
$this->view->productName = $this->products[$productID];
$this->view->modulePath = $this->tree->getParents($case->module);
+1
View File
@@ -28,6 +28,7 @@ $lang->testcase->lastEditedBy = 'Last edited by';
$lang->testcase->lastEditedDate = 'Last edited date';
$lang->testcase->version = 'Version';
$lang->testcase->result = 'Result';
$lang->testcase->lastRunResult = 'Result';
$lang->testcase->real = 'Real';
$lang->testcase->keywords = 'Keywords';
$lang->testcase->files = 'Files';
+1
View File
@@ -28,6 +28,7 @@ $lang->testcase->lastEditedBy = '最后修改者';
$lang->testcase->lastEditedDate = '最后修改日期';
$lang->testcase->version = '用例版本';
$lang->testcase->result = '测试结果';
$lang->testcase->lastRunResult = '结果';
$lang->testcase->real = '实际情况';
$lang->testcase->keywords = '关键词';
$lang->testcase->files = '附件';
@@ -0,0 +1,38 @@
<?php include '../../common/view/header.lite.html.php';?>
<script>
function setDownloading()
{
if($.browser.opera) return true; // Opera don't support, omit it.
$.cookie('downloading', 0);
time = setInterval("closeWindow()", 300);
return true;
}
function closeWindow()
{
if($.cookie('downloading') == 1 || i >= 30)
{
parent.$.fn.colorbox.close();
$.cookie('downloading', null);
clearInterval(time);
}
i ++;
}
</script>
<form method='post' target='hiddenwin' onsubmit='setDownloading();'>
<table class='table-1 mt-10px'>
<caption><?php echo $lang->testcase->exportTemplet?></caption>
<tr>
<td align='center'>
<?php
echo $lang->testcase->num;
echo html::input('num', '10');
echo html::select('encode', $config->charsets[$this->cookie->lang], 'utf-8');
echo html::submitButton();
?>
</td>
<tr>
</table>
</form>
<?php include '../../common/view/footer.lite.html.php';?>
+1 -1
View File
@@ -174,7 +174,7 @@
<td>
<?php
echo $lang->testcase->statusList[$case->status];
if($case->version > $case->currentVersion)
if($case->version > $case->currentVersion and $from == 'testtask')
{
echo " (<span class='warning'>{$lang->testcase->changed}</span> ";
echo html::a($this->createLink('testcase', 'confirmchange', "caseID=$case->id"), $lang->confirm, 'hiddenwin');
+1 -1
View File
@@ -76,7 +76,7 @@ var moduleID = '<?php echo $moduleID;?>';
<?php printf('%03d', $run->case);?>
</td>
<td><span class='<?php echo 'pri' . $run->pri?>'><?php echo $run->pri?></span></td>
<td class='a-left nobr'><?php echo html::a($this->createLink('testcase', 'view', "caseID=$run->case&version=$run->version"), $run->title, '_blank');?>
<td class='a-left nobr'><?php echo html::a($this->createLink('testcase', 'view', "caseID=$run->case&version=$run->version&from=testtask"), $run->title, '_blank');?>
</td>
<td><?php echo $lang->testcase->typeList[$run->type];?></td>
<td><?php $assignedTo = $users[$run->assignedTo]; echo substr($assignedTo, strpos($assignedTo, ':') + 1);?></td>
+1
View File
@@ -70,3 +70,4 @@ $lang->upgrade->fromVersions['4_0_beta2'] = '4.0 BETA2';
$lang->upgrade->fromVersions['4_0'] = '4.0';
$lang->upgrade->fromVersions['4_0_1'] = '4.0.1';
$lang->upgrade->fromVersions['4_1'] = '4.1';
$lang->upgrade->fromVersions['4_2_beta'] = '4.2.beta';
+1
View File
@@ -71,3 +71,4 @@ $lang->upgrade->fromVersions['4_0_beta2'] = '4.0 BETA2';
$lang->upgrade->fromVersions['4_0'] = '4.0';
$lang->upgrade->fromVersions['4_0_1'] = '4.0.1';
$lang->upgrade->fromVersions['4_1'] = '4.1';
$lang->upgrade->fromVersions['4_2_beta'] = '4.2.beta';
+3
View File
@@ -90,6 +90,9 @@ class upgradeModel extends model
$this->addPriv4_1();
$this->processTaskFinish();
$this->deleteCompany();
case '4_2_beta':
$this->execSQL($this->getUpgradeFile('4.2'));
default: if(!$this->isError()) $this->setting->updateVersion($this->config->version);
}