svn: /web/doc-editor/trunk/js/ui/task/ SaveENFileTask.js SaveFileTask.js SaveLangFileTask.js
[email protected] (Yannick Torres)
| Newsgroups | php.doc.web |
|---|---|
| Message-ID | <[email protected]> |
yannick Mon, 22 Mar 2010 21:41:31 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=296640
Log:
concat the saveLangFile & SaveENFile into the save method : saveFile
Changed paths:
D web/doc-editor/trunk/js/ui/task/SaveENFileTask.js
A + web/doc-editor/trunk/js/ui/task/SaveFileTask.js
(from web/doc-editor/trunk/js/ui/task/SaveLangFileTask.js:r296122)
D web/doc-editor/trunk/js/ui/task/SaveLangFileTask.js
svn-diffs-296640.txt
(text/x-diff, 11.6 KB)
Deleted: web/doc-editor/trunk/js/ui/task/SaveENFileTask.js
===================================================================
--- web/doc-editor/trunk/js/ui/task/SaveENFileTask.js 2010-03-22 21:40:24 UTC (rev 296639)
+++ web/doc-editor/trunk/js/ui/task/SaveENFileTask.js 2010-03-22 21:41:31 UTC (rev 296640)
@@ -1,95 +0,0 @@
-Ext.namespace('ui', 'ui.task');
-
-// config - {prefix, ftype, fid, fpath, fname, storeRecord}
-ui.task.SaveENFileTask = function(config)
-{
- Ext.apply(this, config);
-
- var id_prefix = this.prefix + '-' + this.ftype,
- msg = Ext.MessageBox.wait(_('Saving data...'));
-
- if (PhDOE.userLogin === 'anonymous') {
- msg.hide();
- PhDOE.winForbidden();
- return;
- }
-
- XHR({
- scope : this,
- params : {
- task : 'saveFile',
- filePath : this.fpath,
- fileName : this.fname,
- fileLang : 'en',
- fileContent : Ext.getCmp(this.prefix + '-' + this.ftype +
- '-FILE-' + this.fid).getCode()
- },
-
- success : function(r)
- {
- var o = Ext.util.JSON.decode(r.responseText);
-
- if (this.prefix === 'FNU') {
- // Update our store
- this.storeRecord.set('en_revision', o.revision);
- this.storeRecord.set('needCommitEN', true);
- this.storeRecord.commit();
- }
-
- if (this.prefix === 'FE') {
- // Update our store
- this.storeRecord.set('needcommit', true);
- }
-
- if (this.prefix === 'FNR') {
- // Update our store
- this.storeRecord.set('needcommit', true);
- }
-
- if (this.prefix === 'AF') {
- this.storeRecord.getUI().addClass('modified'); // tree node
- }
-
- // Add this files into storePendingCommit
- ui.component.PendingCommitGrid.getInstance().addRecord(
- o.id, 'en' + this.fpath, this.fname, 'update'
- );
-
- // reset file
- Ext.getCmp(id_prefix + '-FILE-' + this.fid + '-btn-save').disable();
- Ext.getCmp(id_prefix + '-FILE-' + this.fid).isModified = false;
-
- Ext.getCmp(id_prefix + '-PANEL-' + this.fid).setTitle(
- Ext.getCmp(id_prefix + '-PANEL-' + this.fid).permlink +
- Ext.getCmp(id_prefix + '-PANEL-' + this.fid).originTitle
- );
-
- if (this.ftype === 'ALL' || !Ext.getCmp(this.prefix + '-LANG-FILE-' + this.fid).isModified) {
- // reset tab-panel
- Ext.getCmp(this.prefix + '-' + this.fid).setTitle(
- Ext.getCmp(this.prefix + '-' + this.fid).originTitle
- );
- }
-
- // Remove wait msg
- msg.hide();
-
- // Notify
- PhDOE.notify('info', _('Document saved'), String.format(_('Document <br><br><b>{0}</b><br><br> was saved successfully !'), 'en' + this.fpath + this.fname));
-
- },
-
- failure : function(r)
- {
- var o = Ext.util.JSON.decode(r.responseText);
-
- // Remove wait msg
- msg.hide();
- if( o.type ) {
- PhDOE.winForbidden(o.type);
- } else {
- PhDOE.winForbidden();
- }
- }
- });
-};
\ No newline at end of file
Copied: web/doc-editor/trunk/js/ui/task/SaveFileTask.js (from rev 296122, web/doc-editor/trunk/js/ui/task/SaveLangFileTask.js)
===================================================================
--- web/doc-editor/trunk/js/ui/task/SaveFileTask.js (rev 0)
+++ web/doc-editor/trunk/js/ui/task/SaveFileTask.js 2010-03-22 21:41:31 UTC (rev 296640)
@@ -0,0 +1,113 @@
+Ext.namespace('ui', 'ui.task');
+
+// config - {prefix, ftype, fid, fpath, fname, lang, storeRecord}
+ui.task.SaveFileTask = function(config)
+{
+ Ext.apply(this, config);
+
+ var id_prefix = this.prefix + '-' + this.ftype,
+ msg = Ext.MessageBox.wait(_('Saving data...'));
+
+ if (PhDOE.userLogin === 'anonymous') {
+ msg.hide();
+ PhDOE.winForbidden();
+ return;
+ }
+ XHR({
+ scope : this,
+ params : {
+ task : 'saveFile',
+ filePath : this.fpath,
+ fileName : this.fname,
+ fileLang : this.lang,
+ fileContent : Ext.getCmp(this.prefix + '-' + this.ftype +
+ '-FILE-' + this.fid).getCode()
+ },
+ success : function(r)
+ {
+ var o = Ext.util.JSON.decode(r.responseText);
+
+ if (this.prefix === 'FNU') {
+ // Update our store
+ if( this.lang === 'en' ) {
+ this.storeRecord.set('en_revision', o.revision);
+ this.storeRecord.set('needCommitEN', true);
+ } else {
+ this.storeRecord.set('revision', o.en_revision);
+ this.storeRecord.set('needCommitLang', true);
+ this.storeRecord.set('maintainer', o.maintainer);
+ }
+ this.storeRecord.commit();
+ }
+
+ if (this.prefix === 'FE') {
+ // Update our store
+ if( this.lang !== 'en' ) {
+ this.storeRecord.set('maintainer', o.maintainer);
+ }
+ this.storeRecord.set('needcommit', true);
+ this.storeRecord.commit();
+ }
+
+ if (this.prefix === 'FNR') {
+ // Update our store
+ if( this.lang !== 'en' ) {
+ this.storeRecord.set('maintainer', o.maintainer);
+ this.storeRecord.set('reviewed', o.reviewed);
+ }
+ this.storeRecord.set('needcommit', true);
+ this.storeRecord.commit();
+ }
+
+ if (this.prefix === 'AF') {
+ this.storeRecord.getUI().addClass('modified'); // tree node
+ }
+
+ // Add this files into storePendingCommit
+ ui.component.PendingCommitGrid.getInstance().addRecord(
+ o.id, this.lang + this.fpath, this.fname, 'update'
+ );
+
+ // reset file
+ Ext.getCmp(id_prefix + '-FILE-' + this.fid + '-btn-save').disable();
+ Ext.getCmp(id_prefix + '-FILE-' + this.fid).isModified = false;
+
+ Ext.getCmp(id_prefix + '-PANEL-' + this.fid).setTitle(
+ Ext.getCmp(id_prefix + '-PANEL-' + this.fid).permlink +
+ Ext.getCmp(id_prefix + '-PANEL-' + this.fid).originTitle
+ );
+
+ var cmp;
+ if( this.lang === 'en' ) {
+ cmp = Ext.getCmp(this.prefix + '-LANG-FILE-' + this.fid);
+ } else {
+ cmp = Ext.getCmp(this.prefix + '-EN-FILE-' + this.fid);
+ }
+
+ if (this.ftype === 'ALL' || !cmp.isModified) {
+ // reset tab-panel
+ Ext.getCmp(this.prefix + '-' + this.fid).setTitle(
+ Ext.getCmp(this.prefix + '-' + this.fid).originTitle
+ );
+ }
+
+ // Remove wait msg
+ msg.hide();
+
+ // Notify
+ PhDOE.notify('info', _('Document saved'), String.format(_('Document <br><br><b>{0}</b><br><br> was saved successfully !'), this.lang + this.fpath + this.fname));
+ },
+ failure : function(r)
+ {
+ var o = Ext.util.JSON.decode(r.responseText);
+
+ // Remove wait msg
+ msg.hide();
+ if( o.type ) {
+ PhDOE.winForbidden(o.type);
+ } else {
+ PhDOE.winForbidden();
+ }
+ }
+ });
+};
\ No newline at end of file
Deleted: web/doc-editor/trunk/js/ui/task/SaveLangFileTask.js
===================================================================
--- web/doc-editor/trunk/js/ui/task/SaveLangFileTask.js 2010-03-22 21:40:24 UTC (rev 296639)
+++ web/doc-editor/trunk/js/ui/task/SaveLangFileTask.js 2010-03-22 21:41:31 UTC (rev 296640)
@@ -1,96 +0,0 @@
-Ext.namespace('ui', 'ui.task');
-
-// config - {prefix, ftype, fid, fpath, fname, lang, storeRecord}
-ui.task.SaveLangFileTask = function(config)
-{
- Ext.apply(this, config);
-
- if (PhDOE.userLogin === 'anonymous') {
- PhDOE.winForbidden();
- return;
- }
-
- var id_prefix = this.prefix + '-' + this.ftype,
- msg = Ext.MessageBox.wait(_('Saving data...'));
-
- XHR({
- scope : this,
- params : {
- task : 'saveFile',
- filePath : this.fpath,
- fileName : this.fname,
- fileLang : this.lang,
- fileContent : Ext.getCmp(this.prefix + '-' + this.ftype +
- '-FILE-' + this.fid).getCode()
- },
- success : function(r)
- {
- var o = Ext.util.JSON.decode(r.responseText);
-
- if (this.prefix === 'FE') {
- // Update our store
- this.storeRecord.set('needcommit', true);
- this.storeRecord.set('maintainer', o.maintainer);
- this.storeRecord.commit();
- }
-
- if (this.prefix === 'FNU') {
- // Update our store
- this.storeRecord.set('revision', o.en_revision);
- this.storeRecord.set('needCommitLang', true);
- this.storeRecord.set('maintainer', o.maintainer);
- this.storeRecord.commit();
- }
-
- if (this.prefix === 'FNR') {
- // Update our store
- this.storeRecord.set('needcommit', true);
- this.storeRecord.set('maintainer', o.maintainer);
- this.storeRecord.set('reviewed', o.reviewed);
- this.storeRecord.commit();
- }
-
- if (this.prefix === 'AF') {
- this.storeRecord.getUI().addClass('modified'); // tree node
- }
-
- // Add this files into storePendingCommit
- ui.component.PendingCommitGrid.getInstance().addRecord(
- o.id, this.lang + this.fpath, this.fname, 'update'
- );
-
- // reset file
- Ext.getCmp(id_prefix + '-FILE-' + this.fid + '-btn-save').disable();
- Ext.getCmp(id_prefix + '-FILE-' + this.fid).isModified = false;
-
- Ext.getCmp(id_prefix + '-PANEL-' + this.fid).setTitle(
- Ext.getCmp(id_prefix + '-PANEL-' + this.fid).permlink +
- Ext.getCmp(id_prefix + '-PANEL-' + this.fid).originTitle
- );
- if (this.ftype === 'ALL' || !Ext.getCmp(this.prefix + '-EN-FILE-' + this.fid).isModified) {
- // reset tab-panel
- Ext.getCmp(this.prefix + '-' + this.fid).setTitle(
- Ext.getCmp(this.prefix + '-' + this.fid).originTitle
- );
- }
-
- // Remove wait msg
- msg.hide();
-
- // Notify
- PhDOE.notify('info', _('Document saved'), String.format(_('Document <br><br><b>{0}</b><br><br> was saved successfully !'), this.lang + this.fpath + this.fname));
- },
- failure : function(r)
- {
- var o = Ext.util.JSON.decode(r.responseText);
-
- // Remove wait msg
- msg.hide();
- if( o.type ) {
- PhDOE.winForbidden(o.type);
- } else {
- PhDOE.winForbidden();
- }
- }
- });
-};
\ No newline at end of file