This commit is contained in:
2024-03-26 15:56:31 +08:00
parent 634e8b71ab
commit 0855ae42cd
547 changed files with 94818 additions and 60463 deletions

View File

@ -17,7 +17,6 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
holder.append('<div class="question-cell template-name" style="width:390px;padding-left:10px;"><span></span></div>');
//holder.append('<div class="question-cell template-display" style="width: 280px;"><span></span></div>');
holder.append('<div class="question-cell template-notes" style="width:400px;"></div>');
holder.append('<div class="question-cell template-createdby" style="width:200px;"><span></span></div>');
var funcs = $('<div class="question-cell template-func" style="width:110px;padding-right:20px;"></div>');
holder.append(funcs);
var _this = this;
@ -42,11 +41,9 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
_this.delete();
}).attr('title', GetTextByKey("P_IPT_DELETETEMPLATE", 'Delete Template')));
if (!_this.template.IssueId || _this.template.IssueId == "") {
funcs.append($('<em class="spanbtn iconcopy"></em>').click(function () {
_this.openSaveAs();
}).attr('title', GetTextByKey("P_IPT_SAVEAS", 'Save As')));
}
funcs.append($('<em class="spanbtn iconcopy"></em>').click(function () {
_this.openSaveAs();
}).attr('title', GetTextByKey("P_IPT_SAVEAS", 'Save As')));
}
this.holder = holder;
if (this.template != null) {
@ -69,8 +66,6 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
this.holder.find('.template-display span').attr('title', template.DisplayText);
this.holder.children('.template-notes').html(replaceHtmlText(template.Notes));
this.holder.children('.template-notes').attr('title', replaceHtmlText(template.Notes));
this.holder.find('.template-createdby span').text(template.IssueName);
this.holder.find('.template-createdby span').attr('title', template.IssueName);
};
q.prototype.delete = function () {
var _this = this;
@ -114,6 +109,7 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
dialog.showDialog();
};
var savingas = false;
q.prototype.onSaveAs = function () {
var _this = this;
var name = newnamecontrol.val();
@ -121,10 +117,14 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
showAlert(GetTextByKey("P_IPT_TEMPLATENAMENOTBEEMPTY", 'Template name cannot be empty.'), GetTextByKey("P_IPT_SAVEAS", 'Save As'));
return;
}
if (savingas) return;
savingas = true;
name = htmlencode(name);
var p = JSON.stringify([teamintelligence, _this.template.Id, name]);
inspectionrequest("TemplateSaveAs", htmlencode(p), function (data) {
savingas = false;
if (data !== 'OK')
showAlert(data, GetTextByKey("P_IPT_SAVEAS", 'Save As'));
else if (_this.templatemodule && typeof _this.templatemodule.refresh === "function")
@ -132,6 +132,7 @@ define(['modules/templates/addtemplate', 'common'], function (AddTemplate, Commo
dialog.hideDialog();
}, function (err) {
savingas = false;
showAlert(GetTextByKey("P_IPT_FAILEDTOSAVEAS", 'Failed to save as.'), GetTextByKey("P_IPT_SAVEAS", 'Save As'));
});
};