Files
web-doc-editor/js/ui/task/CheckFileTask.js
T
Chan Ka Shing fdab95a628 modification/fix:
* fix CodeMirror cannot display the end of vertical scroll [bug in last commit]
  * FilePendingOpen queue is now storing { fpath, fname } object instead of plain array
  * created static reference for singleton components, dependency on phpDoc.xxx are removed and use ui.component.xxx.instance instead
  * created static reference for PingTask, dependency on phpDoc.TaskPing is removed
  * remove .run() in task/*.js
  * fix openning multiple files will stop when some files already opened

main.js cleanup:
  * load configuration task is wrapped in ui/task/LoadConfigTask.js
  * menuMarkupEN & menuMarkupLANG is now wrapped in ui/component/FilePanel.js
  * newTabCheckDoc, newTabBuildStatus, winConf, winAbout is now wrapped in ui/component/MainMenu.js
  * getFile is now wrapped in ui/task/GetFileTask.js
  * confUpdate is now wrapped in ui/task/UpdateConfTask.js
  * winDiff moved into CVSLogGrid.js
  * newTabMailing moved into LocalMailGrid.js
  * newTabBugs moved into BugsGrid.js
  * addToPendingPatch is now wrapped in ui/task/SavePatchTask.js
  * addToPeningCommit moved into PendingCommitGrid.js
2009-06-26 10:29:45 +00:00

77 lines
2.6 KiB
JavaScript

Ext.namespace('ui', 'ui.task');
// config - {prefix, ftype, fid, fpath, fname, lang, storeIdx}
ui.task.CheckFileTask = function(config)
{
Ext.apply(this,config);
Ext.getBody().mask(
'<img src="themes/img/loading.gif" style="vertical-align: middle;" /> ' +
_('Checking for error. Please, wait...')
);
XHR({
scope : this,
url : './php/controller.php',
params : {
task : 'checkFileError',
FilePath : this.fpath,
FileName : this.fname,
FileLang : this.lang,
FileContent : Ext.getCmp(this.prefix + '-' + this.ftype +
'-FILE-' + this.fid).getCode()
},
success : function(response)
{
Ext.getBody().unmask();
var o = Ext.util.JSON.decode(response.responseText);
// If there is some errors, we display this
if (o.error && o.error_first !== '-No error-') {
Ext.getCmp('main-panel').add({
id : 'FE-help-' + this.fid,
title : 'Error in ' + this.fname,
iconCls : 'FilesError',
closable : true,
autoScroll : true,
autoLoad : './error_type.php?dir=' +
this.fpath + '&file=' + this.fname
});
Ext.getCmp('main-panel').setActiveTab('FE-help-' + this.fid);
} else {
// If there is no error, we display an information message
Ext.MessageBox.show({
title : _('Check for errors'),
msg : _('There is no error.'),
buttons : Ext.MessageBox.OK,
icon : Ext.MessageBox.INFO
});
}
// Now, We save LANG File
new ui.task.SaveLangFileTask({
prefix : this.prefix,
ftype : this.ftype,
fid : this.fid,
fpath : this.fpath,
fname : this.fname,
lang : this.lang,
storeRecord : this.storeRecord
});
if (this.prefix === 'FE') {
// We must reload the iframe of error description
Ext.getCmp(this.prefix + '-error-type-' + this.fid).setSrc(
'./error_type.php?dir=' + this.fpath +
'&file=' + this.fname +
'&nocache=' + new Date().getTime()
);
}
}
});
}