svn: /web/doc-editor/trunk/js/ui/component/ FilePanel.js
[email protected] (Yannick Torres)
| Newsgroups | php.doc.web |
|---|---|
| Message-ID | <[email protected]> |
yannick Mon, 22 Mar 2010 21:45:00 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=296644
Log:
switch to saveFile method & activate EN errors check
Changed paths:
U web/doc-editor/trunk/js/ui/component/FilePanel.js
svn-diffs-296644.txt
(text/x-diff, 11.3 KB)
Modified: web/doc-editor/trunk/js/ui/component/FilePanel.js
===================================================================
--- web/doc-editor/trunk/js/ui/component/FilePanel.js 2010-03-22 21:44:06 UTC (rev 296643)
+++ web/doc-editor/trunk/js/ui/component/FilePanel.js 2010-03-22 21:45:00 UTC (rev 296644)
@@ -646,23 +646,39 @@
disabled : true,
handler : function()
{
- if (this.lang === 'en') {
-
- new ui.task.SaveENFileTask({
+ // From "All files" or "Need translate file", we only save the file
+ if (this.prefix === 'AF') {
+ new ui.task.SaveFileTask({
prefix : this.prefix,
ftype : this.ftype,
fid : this.fid,
fpath : this.fpath,
fname : this.fname,
+ lang : this.lang,
storeRecord : this.storeRecord
});
Ext.getCmp(id_prefix + '-FILE-' + this.fid).setOriginalCode();
+ return;
+ }
+ if (this.prefix === 'FNT' ) {
+ new ui.task.SaveTransFileTask({
+ prefix : this.prefix,
+ ftype : this.ftype,
+ fid : this.fid,
+ fpath : this.fpath,
+ fname : this.fname,
+ lang : this.lang,
+ storeRecord : this.storeRecord
+ });
+ Ext.getCmp(id_prefix + '-FILE-' + this.fid).setOriginalCode();
+ return;
+ }
- } else {
+ // We check the conf option : onSaveFile. Can be : ask-me, always or never
+ switch (PhDOE.userConf.onSaveFile) {
- // From "All files" or "Need translate file", we only save the file
- if (this.prefix === 'AF') {
- new ui.task.SaveLangFileTask({
+ case 'always':
+ new ui.task.CheckFileTask({
prefix : this.prefix,
ftype : this.ftype,
fid : this.fid,
@@ -670,12 +686,12 @@
fname : this.fname,
lang : this.lang,
storeRecord : this.storeRecord
- });
+ }); // include SaveFileTask when no err
Ext.getCmp(id_prefix + '-FILE-' + this.fid).setOriginalCode();
- return;
- }
- if (this.prefix === 'FNT' ) {
- new ui.task.SaveTransFileTask({
+ break;
+
+ case 'never':
+ new ui.task.SaveFileTask({
prefix : this.prefix,
ftype : this.ftype,
fid : this.fid,
@@ -685,77 +701,46 @@
storeRecord : this.storeRecord
});
Ext.getCmp(id_prefix + '-FILE-' + this.fid).setOriginalCode();
- return;
- }
+ break;
- // We check the conf option : onSaveLangFile. Can be : ask-me, always or never
- switch (PhDOE.userConf.onSaveLangFile) {
+ case 'ask-me':
+ Ext.MessageBox.show({
+ title : _('Confirm'),
+ msg : _('Do you want to check for error before saving?'),
+ icon : Ext.MessageBox.INFO,
+ buttons : Ext.MessageBox.YESNOCANCEL,
+ scope : this,
+ fn : function (btn)
+ {
+ if (btn === 'no') {
- case 'always':
- new ui.task.CheckFileTask({
- prefix : this.prefix,
- ftype : this.ftype,
- fid : this.fid,
- fpath : this.fpath,
- fname : this.fname,
- lang : this.lang,
- storeRecord : this.storeRecord
- }); // include SaveLangFileTask when no err
- Ext.getCmp(id_prefix + '-FILE-' + this.fid).setOriginalCode();
- break;
+ new ui.task.SaveFileTask({
+ prefix : this.prefix,
+ ftype : this.ftype,
+ fid : this.fid,
+ fpath : this.fpath,
+ fname : this.fname,
+ lang : this.lang,
+ storeRecord : this.storeRecord
+ });
+ Ext.getCmp(id_prefix + '-FILE-' + this.fid).setOriginalCode();
- case 'never':
- 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
- });
- Ext.getCmp(id_prefix + '-FILE-' + this.fid).setOriginalCode();
- break;
+ } else if (btn === 'yes') {
- case 'ask-me':
- Ext.MessageBox.show({
- title : _('Confirm'),
- msg : _('Do you want to check for error before saving?'),
- icon : Ext.MessageBox.INFO,
- buttons : Ext.MessageBox.YESNOCANCEL,
- scope : this,
- fn : function (btn)
- {
- if (btn === 'no') {
-
- 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
- });
- Ext.getCmp(id_prefix + '-FILE-' + this.fid).setOriginalCode();
-
- } else if (btn === 'yes') {
-
- new ui.task.CheckFileTask({
- prefix : this.prefix,
- ftype : this.ftype,
- fid : this.fid,
- fpath : this.fpath,
- fname : this.fname,
- lang : this.lang,
- storeRecord : this.storeRecord
- }); // include SaveLangFileTask when no err
- Ext.getCmp(id_prefix + '-FILE-' + this.fid).setOriginalCode();
- }
+ new ui.task.CheckFileTask({
+ prefix : this.prefix,
+ ftype : this.ftype,
+ fid : this.fid,
+ fpath : this.fpath,
+ fname : this.fname,
+ lang : this.lang,
+ storeRecord : this.storeRecord
+ }); // include SaveFileTask when no err
+ Ext.getCmp(id_prefix + '-FILE-' + this.fid).setOriginalCode();
}
- });
- break;
- }
+ }
+ });
+ break;
}
}
}, {
@@ -859,7 +844,11 @@
);
// Do we need to remove the red mark into the Tab title ?
- if( this.ftype === 'EN' || this.ftype === 'LANG' ) {
+ if(
+ ( this.ftype === 'LANG' && PhDOE.userLang !== 'en' )
+ ||
+ this.ftype === 'EN'
+ ) {
if( (this.ftype === 'EN' && !Ext.getCmp(this.prefix + '-LANG-FILE-' + this.fid).isModified ) ||
(this.ftype === 'LANG' && !Ext.getCmp(this.prefix + '-EN-FILE-' + this.fid).isModified ) ) {