[icinga-checkins] icinga.org: icinga-web/master: Class doc, cleanup namespaces and fixed some bugs refs #986

git at icinga.org git at icinga.org
Fri Oct 19 12:19:57 CEST 2012


Module: icinga-web
Branch: master
Commit: ed92b9cf2a075e9923e68d0b7a4268b3c8a57569
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=ed92b9cf2a075e9923e68d0b7a4268b3c8a57569

Author: Marius Hein <marius.hein at netways.de>
Date:   Thu Jul 12 11:29:52 2012 +0200

Class doc, cleanup namespaces and fixed some bugs refs #986

---

 app/modules/Cronks/config/javascript.xml           |    2 +-
 app/modules/Cronks/lib/js/CronkTabpanel.js         |   23 +++++-
 app/modules/Cronks/lib/js/util/CronkOpener.js      |   81 +++++++++++++++++++-
 .../js/{Tabhelper.js => util/CronkTabhelper.js}    |    8 --
 4 files changed, 100 insertions(+), 14 deletions(-)

diff --git a/app/modules/Cronks/config/javascript.xml b/app/modules/Cronks/config/javascript.xml
index bf65595..8c3ec45 100644
--- a/app/modules/Cronks/config/javascript.xml
+++ b/app/modules/Cronks/config/javascript.xml
@@ -14,9 +14,9 @@
             <ae:parameter>%core.module_dir%/Cronks/lib/js/Cronk.js</ae:parameter>
             <ae:parameter>%core.module_dir%/Cronks/lib/js/util/CronkUtil.js</ae:parameter>
             <ae:parameter>%core.module_dir%/Cronks/lib/js/util/CronkOpener.js</ae:parameter>
+            <ae:parameter>%core.module_dir%/Cronks/lib/js/util/CronkTabhelper.js</ae:parameter>
             <ae:parameter>%core.module_dir%/Cronks/lib/js/FilterHandler.js</ae:parameter>
             <ae:parameter>%core.module_dir%/Cronks/lib/js/SlidingTabs.js</ae:parameter>
-            <ae:parameter>%core.module_dir%/Cronks/lib/js/Tabhelper.js</ae:parameter>
             <ae:parameter>%core.module_dir%/Cronks/lib/js/CronkTabpanel.js</ae:parameter>
             <ae:parameter>%core.module_dir%/Cronks/lib/js/rmd160.js</ae:parameter>
             <ae:parameter>%core.module_dir%/Cronks/lib/js/CronkBuilder.js</ae:parameter>
diff --git a/app/modules/Cronks/lib/js/CronkTabpanel.js b/app/modules/Cronks/lib/js/CronkTabpanel.js
index 539c306..da733dd 100644
--- a/app/modules/Cronks/lib/js/CronkTabpanel.js
+++ b/app/modules/Cronks/lib/js/CronkTabpanel.js
@@ -22,10 +22,27 @@
 
 Ext.ns('Cronk.util');
 
+/**
+ * @class Cronk.util.Tabpanel
+ * @extends Ext.ux.panel.DDTabPanel
+ * <p>Tabpanel which holds cronks in, stateful
+ * @param {Object} config The config object
+ * @xtype cronk-control-tabs
+ */
 Cronk.util.Tabpanel = function(config) {
 
     this.stateEvents = ['add', 'remove', 'tabchange', 'titlechange'];
     
+    this.addEvents({
+        /**
+         * @event cronksloaded
+         * Fires if all cronks from state are loadede and the
+         * panel is ready initialized
+         * @param {Cronk.util.Tabpanel}
+         */
+        cronksloaded: true
+    });
+    
     Cronk.util.Tabpanel.superclass.constructor.call(this, config);  
 };
 
@@ -204,8 +221,10 @@ Ext.extend(Cronk.util.Tabpanel, Ext.ux.panel.DDTabPanel, {
                 
                 this.getActiveTab().doLayout();
             }
-                
-                        
+            
+            
+            // Notify that all cronks are initialized
+            this.fireEvent('cronksloaded', this);
         }).defer(5, this);
                 
         return true;
diff --git a/app/modules/Cronks/lib/js/util/CronkOpener.js b/app/modules/Cronks/lib/js/util/CronkOpener.js
index a631ab5..f6297f3 100644
--- a/app/modules/Cronks/lib/js/util/CronkOpener.js
+++ b/app/modules/Cronks/lib/js/util/CronkOpener.js
@@ -27,15 +27,47 @@ Ext.ns('Cronk.util');
 (function() {
     "use strict";
     
+    /**
+     * @class Cronk.util.CronkOpener
+     * @extends Ext.util.Observable
+     * <p>This object gets a tabpanel as parameter and parses the url. If
+     * matched for a cronk, create a new cronk and add them to the panel
+     * @param {Object} c configuration object
+     */
     Cronk.util.CronkOpener = Ext.extend(Ext.util.Observable, {
         
+        /**
+         * @cfg {Boolean} autoExecute
+         * Start the chain to check if we can add the cronk from url
+         * If this is false you have to call 
+         * {@link Cronk.util.CronkOpener#canApply} and 
+         * {@link Cronk.util.CronkOpener#execute} manually 
+         * 
+         */
         autoExecute: false,
+        
+        /**
+         * @cfg {Cronk.util.Tabpanel} panel
+         * The panel to work on. Must support the cronksloaded event
+         */
         panel: null,
+        
+        
+        /**
+         * @cfg {String} cronkuid
+         * Cronk UID to open
+         */
         cronkuid: null,
+        
+        /**
+         * @cfg {Boolean} reset
+         * Reset the tabs before we open a new cronk
+         */
         reset: false,
         
         constructor: function(c) {
             this.addEvents({
+                beforeopen: true,
                 open: true
             });
             
@@ -74,23 +106,46 @@ Ext.ns('Cronk.util');
             AppKit.log(this);
         },
         
+        /**
+         * Setter for cronkuid
+         * @param {String} cronkuid
+         */
         setCronkUid: function(cronkuid) {
             this.cronkuid = cronkuid;
         },
         
+        /**
+         * Getter for cronkuid
+         * 
+         * @return {String}
+         */
         getCronkUid: function() {
             return this.cronkuid;
         },
         
+        /**
+         * Setter for reset flag. If the method
+         * is called without argument, the flag will be set
+         * to false
+         * @param {Boolean} flag
+         */
         setReset: function(flag) {
             flag = Boolean(flag) || false;
             this.reset = flag;
         },
         
+        /**
+         * Getter for reset
+         * @return {Boolean}
+         */
         getReset: function() {
-            return this.flag;
+            return this.reset;
         },
         
+        /**
+         * Check if we're ready to add a cronk
+         * @return {Boolean}
+         */
         canApply: function() {
             if (this.getCronkUid() !== null && this.panel) {
                 return true;
@@ -99,6 +154,9 @@ Ext.ns('Cronk.util');
             return false;
         },
         
+        /**
+         * Add the cronk to the panel
+         */
         execute: function() {
             
             var execFunction = function() {
@@ -120,7 +178,12 @@ Ext.ns('Cronk.util');
                         })
                     };
                     
-                    Cronk.util.InterGridUtil.gridFilterLink(cronk, {});
+                    var re = Cronk.util.InterGridUtil.gridFilterLink(cronk, {});
+                    
+                    this.panel.resumeEvents();
+                    
+                    this.fireEvent('open', re);
+                    
                 }
             }
             
@@ -130,7 +193,19 @@ Ext.ns('Cronk.util');
                 scope: this
             };
             
-            AppKit.getTr().start(this.task);
+            this.panel.on('cronksloaded', function() {
+                
+                this.panel.suspendEvents();
+                
+                if (this.getReset() === true) {
+                    // Remove all and suppress events
+                    this.panel.removeAll(true);
+                }
+                
+                if (this.fireEvent('beforeopen') === true) {
+                    AppKit.getTr().start(this.task);
+                }
+            }, this, {single: true});
         }
     });
     
diff --git a/app/modules/Cronks/lib/js/Tabhelper.js b/app/modules/Cronks/lib/js/util/CronkTabhelper.js
similarity index 98%
rename from app/modules/Cronks/lib/js/Tabhelper.js
rename to app/modules/Cronks/lib/js/util/CronkTabhelper.js
index 15dd912..904eb6c 100644
--- a/app/modules/Cronks/lib/js/Tabhelper.js
+++ b/app/modules/Cronks/lib/js/util/CronkTabhelper.js
@@ -22,14 +22,6 @@
 
 Ext.ns('Cronk.util');
 
-Cronk.util.CronkTabHelper = function() {
-    var pub = {};
-    var tp = null;
-    var ctxItem = null;
-    var contextmenu = null;
-    var keyMap = null;
-};
-    
 Cronk.util.CronkTabHelper = Ext.extend(Object, { 
         
     last_tab: null,





More information about the icinga-checkins mailing list