0011658: show reload confirmation after config setting changed
authorPhilipp Schüle <p.schuele@metaways.de>
Tue, 1 Mar 2016 16:33:35 +0000 (17:33 +0100)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 7 Mar 2016 11:37:34 +0000 (12:37 +0100)
* moves confirmation message box to common.js
* this could be improved by changing the registry on the fly

https://forge.tine20.org/view.php?id=11658

Change-Id: I49bd95716bb7e4b148b414401f19d54a413f20f2
Reviewed-on: http://gerrit.tine20.com/customers/2836
Tested-by: Philipp Schüle <p.schuele@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Admin/js/config/GridPanel.js
tine20/Admin/js/customfield/GridPanel.js
tine20/Tinebase/js/common.js
tine20/Tinebase/translations/de.po

index 8bb904f..0c5e232 100644 (file)
@@ -184,7 +184,6 @@ Tine.Admin.config.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
         this.supr().initStore.call(this);
 
         this.store.on('beforeload', this.onStoreBeforeload, this);
-
     },
 
     onStoreBeforeload: function(store, options) {
@@ -192,6 +191,25 @@ Tine.Admin.config.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
         options.params.filter.push({'field': 'application_id', 'operator': 'equals', 'value': this.configApp.id})
     },
 
+    /**
+     * called when the store gets updated, e.g. from editgrid
+     *
+     * @param {Ext.data.store} store
+     * @param {Tine.Tinebase.data.Record} record
+     * @param {String} operation
+     */
+    onStoreUpdate: function(store, record, operation) {
+        this.supr().onStoreUpdate.call(this, store, record, operation);
+
+        switch (operation) {
+            case Ext.data.Record.EDIT:
+                // do/check registry reload
+                // TODO do this in parent window?
+                Tine.Tinebase.common.confirmApplicationRestart(true);
+                break;
+        }
+    },
+
     valueRenderer: function(value, metaData, record, rowIndex, colIndex, store) {
         if (record.get('source') == 'DEFAULT') {
             value = Ext.encode(record.get('default'));
@@ -213,7 +231,6 @@ Tine.Admin.config.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
                 value = '...';
                 break;
             default:
-                //value = Ext.encode(value);
                 break;
         }
 
index fbc8eb9..9d90c42 100644 (file)
@@ -122,18 +122,6 @@ Tine.Admin.customfield.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
     },
     
     /**
-     * Confirm application restart
-     */
-    confirmApplicationRestart: function () {
-        Ext.Msg.confirm(this.app.i18n._('Confirm'), this.app.i18n._('Restart application to apply new customfields?'), function (btn) {
-            if (btn == 'yes') {
-                // reload mainscreen to make sure registry gets updated
-                Tine.Tinebase.common.reload();
-            }
-        }, this);
-    },
-    
-    /**
      * on update after edit
      * 
      * @param {String|Tine.Tinebase.data.Record} record
@@ -141,7 +129,7 @@ Tine.Admin.customfield.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
     onUpdateRecord: function (record) {
         Tine.Admin.customfield.GridPanel.superclass.onUpdateRecord.apply(this, arguments);
         
-        this.confirmApplicationRestart();
+        Tine.Tinebase.common.confirmApplicationRestart();
     },
     
     /**
@@ -153,6 +141,6 @@ Tine.Admin.customfield.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
     onAfterDelete: function (ids) {
         Tine.Admin.customfield.GridPanel.superclass.onAfterDelete.apply(this, arguments);
         
-        this.confirmApplicationRestart();
+        Tine.Tinebase.common.confirmApplicationRestart();
     }
 });
index 33f03c8..de3389e 100644 (file)
@@ -816,5 +816,22 @@ Tine.Tinebase.common = {
             return Tine[appName].Model[modelName];
         }
         return modelName;
+    },
+
+    /**
+     * Confirm application restart
+     *
+     * @param Boolean closewindow
+     */
+    confirmApplicationRestart: function (closewindow) {
+        Ext.Msg.confirm(_('Confirm'), _('Restart application to apply new configuration?'), function (btn) {
+            if (btn == 'yes') {
+                // reload mainscreen to make sure registry gets updated
+                Tine.Tinebase.common.reload();
+                if (closewindow) {
+                    window.close();
+                }
+            }
+        }, this);
     }
 };
index 8299cd5..406303b 100644 (file)
@@ -3308,3 +3308,6 @@ msgstr "entfernt"
 #: Record/RecordSetDiff.php:44
 msgid "modified"
 msgstr "geändert"
+
+msgid "Restart application to apply new configuration?"
+msgstr "Möchten Sie die Anwendung zum Anwenden der neuen Konfiguration neu starten?"