diff --git a/extension/lite/story/ext/view/edit.html.php b/extension/lite/story/ext/view/edit.html.php
index bf24a2e266..c45fa148a4 100644
--- a/extension/lite/story/ext/view/edit.html.php
+++ b/extension/lite/story/ext/view/edit.html.php
@@ -80,6 +80,14 @@
status) !== false ? html::textarea('spec', htmlSpecialString($story->spec), "rows='5' class='form-control'") : $story->spec;?>
+
story->comment;?>
diff --git a/module/common/lang/de.php b/module/common/lang/de.php
index d2113a3e89..3de060ef37 100644
--- a/module/common/lang/de.php
+++ b/module/common/lang/de.php
@@ -99,7 +99,8 @@ $lang->collapse = 'Zuklappen';
$lang->saveSuccess = 'Gespeichert';
$lang->importSuccess = 'Gespeichert';
$lang->fail = 'Fehlgeschlagen';
-$lang->addFiles = 'Hinzufügen';
+$lang->addFiles = 'Hinzufügen ';
+$lang->deleteFiles = 'Anhang gelöscht ';
$lang->files = 'Datei ';
$lang->pasteText = 'Einfügen';
$lang->uploadImages = 'Hochladen';
diff --git a/module/common/lang/en.php b/module/common/lang/en.php
index d8390243ce..c4bba1c349 100644
--- a/module/common/lang/en.php
+++ b/module/common/lang/en.php
@@ -99,7 +99,8 @@ $lang->collapse = 'Collapse';
$lang->saveSuccess = 'Saved';
$lang->importSuccess = 'Saved';
$lang->fail = 'Fail';
-$lang->addFiles = 'Added Files';
+$lang->addFiles = 'Added Files ';
+$lang->deleteFiles = 'Deleted Files ';
$lang->files = 'Files ';
$lang->pasteText = 'Multi-line Paste';
$lang->uploadImages = 'Multi-image Upload';
diff --git a/module/common/lang/fr.php b/module/common/lang/fr.php
index 67caf6b5fd..aec37d0a92 100644
--- a/module/common/lang/fr.php
+++ b/module/common/lang/fr.php
@@ -100,6 +100,7 @@ $lang->saveSuccess = 'Sauvegardé';
$lang->importSuccess = 'Sauvé';
$lang->fail = 'Echec';
$lang->addFiles = 'Fichiers ajoutés ';
+$lang->deleteFiles = 'Pièce jointe supprimée ';
$lang->files = 'Fichiers ';
$lang->pasteText = 'Collage Multi-lignes';
$lang->uploadImages = 'Upload Multi-images';
diff --git a/module/common/lang/vi.php b/module/common/lang/vi.php
index b5e9712fd7..0113ca2d00 100644
--- a/module/common/lang/vi.php
+++ b/module/common/lang/vi.php
@@ -78,7 +78,8 @@ $lang->collapse = 'Co lại';
$lang->saveSuccess = 'Đã lưu';
$lang->importSuccess = 'Đã lưu';
$lang->fail = 'Thất bại';
-$lang->addFiles = 'Tập tin đã thêm';
+$lang->addFiles = 'Tập tin đã thêm ';
+$lang->deleteFiles = 'Tháo ảnh ';
$lang->files = 'Files ';
$lang->pasteText = 'Dán nhiều dòng';
$lang->uploadImages = 'Tải lên nhiều ảnh';
diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php
index a27488d59e..8080576b61 100644
--- a/module/common/lang/zh-cn.php
+++ b/module/common/lang/zh-cn.php
@@ -100,6 +100,7 @@ $lang->saveSuccess = '保存成功';
$lang->importSuccess = '导入成功';
$lang->fail = '失败';
$lang->addFiles = '上传了附件 ';
+$lang->deleteFiles = '删除了附件 ';
$lang->files = '附件 ';
$lang->pasteText = '多项录入';
$lang->uploadImages = '多图上传 ';
diff --git a/module/common/model.php b/module/common/model.php
index bae5456a5c..9f8506e07c 100644
--- a/module/common/model.php
+++ b/module/common/model.php
@@ -1457,7 +1457,7 @@ class commonModel extends model
echo "
" . " " . $lang->clientName . "';
diff --git a/module/execution/js/common.js b/module/execution/js/common.js
index 70b25619db..1ede120620 100644
--- a/module/execution/js/common.js
+++ b/module/execution/js/common.js
@@ -63,9 +63,7 @@ function computeWorkDays(currentID)
isBactchEdit = false;
if(currentID)
{
- index = currentID.replace('begins[', '');
- index = index.replace('ends[', '');
- index = index.replace(']', '');
+ index = currentID.replace(/\w*\[|\]/g, '');
if(!isNaN(index)) isBactchEdit = true;
}
diff --git a/module/execution/js/story.js b/module/execution/js/story.js
index 0c84c72723..a4a9458891 100644
--- a/module/execution/js/story.js
+++ b/module/execution/js/story.js
@@ -27,7 +27,7 @@ $(function()
var planID = $('#plan').val();
if(planID)
{
- parent.location.href = createLink('execution', 'importPlanStories', 'executionID=' + executionID + '&planID=' + planID);
+ location.href = createLink('execution', 'importPlanStories', 'executionID=' + executionID + '&planID=' + planID);
}
})
diff --git a/module/execution/lang/de.php b/module/execution/lang/de.php
index d7c4b8a112..853272afe3 100644
--- a/module/execution/lang/de.php
+++ b/module/execution/lang/de.php
@@ -387,8 +387,8 @@ $lang->execution->errorSameProducts = "{$lang->executionCommon} Kann n
$lang->execution->errorSameBranches = "{$lang->executionCommon} cannot be linked to the same branch twice";
$lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s.";
$lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project.";
-$lang->execution->errorLetterProject = "The start time of stage cannot be less than the start time of the project %s.";
-$lang->execution->errorGreaterProject = "The end time of stage cannot be greater than the end time %s of the project.";
+$lang->execution->errorLetterProject = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s.";
+$lang->execution->errorGreaterProject = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project.";
$lang->execution->errorCommonBegin = 'The start date of ' . $lang->executionCommon . ' should be ≥ the start date of project : %s.';
$lang->execution->errorCommonEnd = 'The deadline of ' . $lang->executionCommon . ' should be ≤ the deadline of project : %s.';
$lang->execution->accessDenied = "Zugriff zu {$lang->executionCommon} verweigert!";
diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php
index f9adc1fed0..1a5bb94f77 100644
--- a/module/execution/lang/en.php
+++ b/module/execution/lang/en.php
@@ -387,8 +387,8 @@ $lang->execution->errorSameProducts = "{$lang->executionCommon} cannot
$lang->execution->errorSameBranches = "{$lang->executionCommon} cannot be linked to the same branch twice";
$lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s.";
$lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project.";
-$lang->execution->errorLetterProject = "The start time of stage cannot be less than the start time of the project %s.";
-$lang->execution->errorGreaterProject = "The end time of stage cannot be greater than the end time %s of the project.";
+$lang->execution->errorLetterProject = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s.";
+$lang->execution->errorGreaterProject = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project.";
$lang->execution->errorCommonBegin = 'The start date of ' . $lang->executionCommon . ' should be ≥ the start date of project : %s.';
$lang->execution->errorCommonEnd = 'The deadline of ' . $lang->executionCommon . ' should be ≤ the deadline of project : %s.';
$lang->execution->accessDenied = "Your access to {$lang->executionCommon} is denied!";
diff --git a/module/execution/lang/fr.php b/module/execution/lang/fr.php
index bae0166bcd..068d55bd72 100644
--- a/module/execution/lang/fr.php
+++ b/module/execution/lang/fr.php
@@ -387,8 +387,8 @@ $lang->execution->errorSameProducts = "Ce {$lang->executionCommon} ne
$lang->execution->errorSameBranches = "{$lang->executionCommon} cannot be linked to the same branch twice";
$lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s.";
$lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project.";
-$lang->execution->errorLetterProject = "The start time of stage cannot be less than the start time of the project %s.";
-$lang->execution->errorGreaterProject = "The end time of stage cannot be greater than the end time %s of the project.";
+$lang->execution->errorLetterProject = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s.";
+$lang->execution->errorGreaterProject = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project.";
$lang->execution->errorCommonBegin = 'The start date of ' . $lang->executionCommon . ' should be ≥ the start date of project : %s.';
$lang->execution->errorCommonEnd = 'The deadline of ' . $lang->executionCommon . ' should be ≤ the deadline of project : %s.';
$lang->execution->accessDenied = "Votre accès au {$lang->executionCommon} est refusé ! Désolé.";
diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php
index 9b308c85be..87c8b9fac9 100644
--- a/module/execution/lang/zh-cn.php
+++ b/module/execution/lang/zh-cn.php
@@ -387,8 +387,8 @@ $lang->execution->errorSameProducts = "{$lang->executionCommon}不能
$lang->execution->errorSameBranches = "{$lang->executionCommon}不能关联多个相同的分支。";
$lang->execution->errorBegin = "{$lang->executionCommon}的开始时间不能小于所属项目的开始时间%s。";
$lang->execution->errorEnd = "{$lang->executionCommon}的截止时间不能大于所属项目的结束时间%s。";
-$lang->execution->errorLetterProject = "阶段的计划开始时间不能小于所属项目的计划开始时间%s。";
-$lang->execution->errorGreaterProject = "阶段的计划完成时间不能大于所属项目的计划完成时间%s。";
+$lang->execution->errorLetterProject = "{$lang->executionCommon}的计划开始时间不能小于所属项目的计划开始时间%s。";
+$lang->execution->errorGreaterProject = "{$lang->executionCommon}的计划完成时间不能大于所属项目的计划完成时间%s。";
$lang->execution->errorCommonBegin = $lang->executionCommon . '开始日期应大于等于项目的开始日期:%s。';
$lang->execution->errorCommonEnd = $lang->executionCommon . '截止日期应小于等于项目的截止日期:%s。';
$lang->execution->accessDenied = "您无权访问该{$lang->executionCommon}!";
diff --git a/module/execution/view/batchedit.html.php b/module/execution/view/batchedit.html.php
index b132bc9fbe..00dd365a63 100755
--- a/module/execution/view/batchedit.html.php
+++ b/module/execution/view/batchedit.html.php
@@ -85,7 +85,7 @@
systemMode == 'new' and isset($project) and $project->model == 'scrum'):?>
project, "class='form-control picker-select' data-lastselected='{$executions[$executionID]->project}' onchange='changeProject(this, $executionID, {$executions[$executionID]->project})'");?> |
-
name, "id='names{$executionID}' class='form-control'");?> |
+
name, "class='form-control'");?> |
setCode) or $config->setCode == 1):?>
code, "class='form-control'");?> |
@@ -106,8 +106,8 @@
?>
'>execution->statusList, $executions[$executionID]->status, 'class=form-control');?> |
-
begin, "id='begins{$executionID}' class='form-control form-date' onchange='computeWorkDays(this.id)'");?> |
-
end, "id='ends{$executionID}' class='form-control form-date' onchange='computeWorkDays(this.id)'");?> |
+
begin, "class='form-control form-date' onchange='computeWorkDays(this.id)'");?> |
+
end, "class='form-control form-date' onchange='computeWorkDays(this.id)'");?> |
'> desc, "rows='1' class='form-control autosize'");?> |
'>team, "class='form-control'");?> |
'>
@@ -154,26 +154,22 @@ $('#executionForm').submit(function()
/* Clear all error messages. */
$('input[name^=begins]').each(function()
{
- var beginDateID = $(this).attr('id');
- var endDateID = beginDateID.replace('begins', 'ends');
- $('#help' + beginDateID).remove();
- $('#help' + endDateID).remove();
+ var executionID = $(this).attr('id').replace(/\w*\[|\]/g, '');
+ $('#helpbegins' + executionID).remove();
+ $('#helpends' + executionID).remove();
});
var submitForm = true;
$('input[name^=begins]').each(function()
{
var beginDate = $(this).val();
- var beginDateID = $(this).attr('id');
+ var executionID = $(this).attr('id').replace(/\w*\[|\]/g, '');
- var nameID = beginDateID.replace('begins', 'names');
- var endDateID = beginDateID.replace('begins', 'ends');
- var executionID = beginDateID.replace('begins', '');
- $('#help' + beginDateID).remove();
- $('#help' + endDateID).remove();
+ $('#helpbegins' + executionID).remove();
+ $('#helpends' + executionID).remove();
/* Invalid data is skipped. */
- var nameVal = $('#' + nameID).val()
+ var nameVal = $("[name='names[" + executionID + "]']").val()
if(!nameVal) return;
var projectBeginDate = '0000-00-00';
@@ -199,18 +195,18 @@ $('#executionForm').submit(function()
if(!beginDate)
{
submitForm = false;
- var emptyBeginHtml = ' ' + emptyBegin + ' ';
+ var emptyBeginHtml = '' + emptyBegin + ' ';
$(this).after(emptyBeginHtml);
alert(emptyBegin);
return false;
}
- var endDate = $('#' + endDateID).val();
+ var endDate = $("[name='ends[" + executionID + "]']").val();
if(!endDate)
{
submitForm = false;
- var emptyEndHtml = '' + emptyEnd + ' ';
- $('#' + endDateID).after(emptyEndHtml);
+ var emptyEndHtml = '' + emptyEnd + ' ';
+ $("[name='ends[" + executionID + "]']").after(emptyEndHtml);
alert(emptyEnd);
return false;
}
@@ -218,8 +214,8 @@ $('#executionForm').submit(function()
if(endDate < beginDate)
{
submitForm = false;
- var emptyEndHtml = '' + planFinishSmall + ' ';
- $('#' + endDateID).after(emptyEndHtml);
+ var emptyEndHtml = '' + planFinishSmall + ' ';
+ $("[name='ends[" + executionID + "]']").after(emptyEndHtml);
alert(planFinishSmall);
return false;
}
@@ -228,8 +224,8 @@ $('#executionForm').submit(function()
{
submitForm = false;
var errorBeginTip = errorBegin.replace('%s', projectBeginDate);
- var errorBeginHtml = '' + errorBeginTip + ' ';
- $('#' + beginDateID).after(errorBeginHtml);
+ var errorBeginHtml = '' + errorBeginTip + ' ';
+ $("[name='begins[" + executionID + "]']").after(errorBeginHtml);
alert(errorBeginTip);
return false;
}
@@ -238,8 +234,8 @@ $('#executionForm').submit(function()
{
submitForm = false;
var errorEndTip = errorEnd.replace('%s', projectEndDate);
- var errorEndHtml = '' + errorEndTip + ' ';
- $('#' + endDateID).after(errorEndHtml);
+ var errorEndHtml = '' + errorEndTip + ' ';
+ $("[name='ends[" + executionID + "]']").after(errorEndHtml);
alert(errorEndTip);
return false;
}
diff --git a/module/file/control.php b/module/file/control.php
index c8230031b6..995919bcce 100755
--- a/module/file/control.php
+++ b/module/file/control.php
@@ -306,17 +306,19 @@ class file extends control
* @param string $fieldset
* @param object $object
* @param string $method
+ * @param bool $showDelete
* @access public
* @return void
*/
- public function printFiles($files, $fieldset, $object = null, $method = 'view')
+ public function printFiles($files, $fieldset, $object = null, $method = 'view', $showDelete = true)
{
- $this->view->files = $files;
- $this->view->fieldset = $fieldset;
- $this->view->object = $object;
- $this->view->method = $method;
+ $this->view->files = $files;
+ $this->view->fieldset = $fieldset;
+ $this->view->object = $object;
+ $this->view->method = $method;
+ $this->view->showDelete = $showDelete;
- if($method == 'view') return $this->display('file', 'viewfiles');
+ if(strpos('view,edit', $method) !== false) return $this->display('file', 'viewfiles');
$this->display();
}
diff --git a/module/file/model.php b/module/file/model.php
index 72d4a1d828..22b98a85d7 100755
--- a/module/file/model.php
+++ b/module/file/model.php
@@ -46,8 +46,9 @@ class fileModel extends model
->where('objectType')->eq($objectType)
->andWhere('objectID')->eq((int)$objectID)
->andWhere('extra')->ne('editor')
+ ->beginIF($objectType == 'story' and $extra)->andWhere('extra')->like("%,$extra,%")->fi()
+ ->beginIF($objectType != 'story' and $extra)->andWhere('extra')->eq($extra)->fi()
->andWhere('deleted')->eq('0')
- ->beginIF($extra)->andWhere('extra')->eq($extra)
->orderBy('id')
->fetchAll('id');
@@ -1097,7 +1098,6 @@ class fileModel extends model
{
return $this->dao->select("id,$value")->from(TABLE_FILE)
->where('id')->in($IDs)
- ->andWhere('deleted')->eq('0')
->fetchPairs();
}
@@ -1119,4 +1119,62 @@ class fileModel extends model
$this->dao->update(TABLE_CASE)->set('`fromCaseVersion`')->eq($fromcaseVersion)->where('`fromCaseID`')->eq($file->objectID)->exec();
}
}
+
+ /**
+ * Update version of story files.
+ *
+ * @param int $storyID
+ * @param int $storyVersion
+ * @param array $deleteFiles
+ * @access public
+ * @return void
+ */
+ public function updateStoryFileVersion($storyID, $storyVersion, $deleteFiles = array())
+ {
+ $oldStoryVersion = $storyVersion - 1;
+ $this->dao->dbh($this->dbh)->update(TABLE_FILE)->set("extra = CONCAT(extra, '$storyVersion,')")
+ ->where('objectType')->eq('story')
+ ->andWhere('objectID')->eq($storyID)
+ ->andWhere('extra')->like("%,$oldStoryVersion,%")
+ ->beginIF(!empty($deleteFiles))->andWhere('id')->notin($deleteFiles)->fi()
+ ->exec();
+ }
+
+ /**
+ * Delete story file.
+ *
+ * @param int $storyID
+ * @param int $storyVersion
+ * @param array $deleteFiles
+ * @access public
+ * @return void
+ */
+ public function deleteStoryFile($storyID, $storyVersion, $deleteFiles = array())
+ {
+ $deleteFileList = $this->dao->select('*')->from(TABLE_FILE)
+ ->where('objectType')->eq('story')
+ ->andWhere('objectID')->eq($storyID)
+ ->andWhere('extra')->eq(",$storyVersion,")
+ ->beginIF(!empty($deleteFiles))->andWhere('id')->in($deleteFiles)->fi()
+ ->fetchAll('id');
+
+ if(!empty($deleteFileList))
+ {
+ $this->dao->delete()->from(TABLE_FILE)->where('id')->in(array_keys($deleteFileList))->exec();
+
+ foreach($deleteFileList as $file)
+ {
+ $realPathName = $this->getRealPathName($file->pathname);
+ @unlink($realPathName);
+ }
+ }
+
+ /* When the file is in multiple story versions, 'extra' need delete the version to be deleted. */
+ $this->dao->update(TABLE_FILE)->set("extra = REPLACE(extra, '$storyVersion,', '')")
+ ->where('objectType')->eq('story')
+ ->andWhere('objectID')->eq($storyID)
+ ->andWhere('extra')->like("%,$storyVersion,%")
+ ->beginIF(!empty($deleteFiles))->andWhere('id')->in($deleteFiles)->fi()
+ ->exec();
+ }
}
diff --git a/module/file/view/printfiles.html.php b/module/file/view/printfiles.html.php
index 2c621c7413..ee78a6ecc0 100644
--- a/module/file/view/printfiles.html.php
+++ b/module/file/view/printfiles.html.php
@@ -92,7 +92,7 @@
if(common::hasPriv($objectType, 'edit', $object))
{
echo " ";
- if($method != 'storyChange') common::printLink('file', 'edit', "fileID=$file->id", $lang->file->edit, '', "data-width='400' class='fileAction btn btn-link edit iframe text-primary' title='{$lang->file->edit}'");
+ common::printLink('file', 'edit', "fileID=$file->id", $lang->file->edit, '', "data-width='400' class='fileAction btn btn-link edit iframe text-primary' title='{$lang->file->edit}'");
if(common::hasPriv('file', 'delete')) echo html::a('###', $lang->delete, '', "class='fileAction btn btn-link text-primary' onclick='deleteFile($file->id)' title='$lang->delete'");
echo '';
}
diff --git a/module/file/view/viewfiles.html.php b/module/file/view/viewfiles.html.php
index 164f7e7dbe..a41d89589d 100644
--- a/module/file/view/viewfiles.html.php
+++ b/module/file/view/viewfiles.html.php
@@ -7,6 +7,7 @@
|