[icinga-checkins] icinga.org: icinga-web/master: * Added tabslider

git at icinga.org git at icinga.org
Wed Jan 5 12:18:18 CET 2011


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Mon Jan  3 17:27:19 2011 +0100

* Added tabslider

---

 app/modules/Cronks/lib/js/Tabhelper.js |   70 +++++++++++++++++++++++++++----
 pub/styles/icinga-icons.css            |    3 +-
 2 files changed, 63 insertions(+), 10 deletions(-)

diff --git a/app/modules/Cronks/lib/js/Tabhelper.js b/app/modules/Cronks/lib/js/Tabhelper.js
index 84f26d3..65dd055 100755
--- a/app/modules/Cronks/lib/js/Tabhelper.js
+++ b/app/modules/Cronks/lib/js/Tabhelper.js
@@ -12,6 +12,8 @@ Cronk.util.CronkTabHelper = Ext.extend(Object, {
 		
 	last_tab: null,
 	
+	sliding_tab: null,
+	
 	init: function(c) {
 		tp = c;
 		
@@ -155,14 +157,53 @@ Cronk.util.CronkTabHelper = Ext.extend(Object, {
 						ctxItem.getUpdater().refresh();
 					}
 				}, {
-					text: _("Save Cronk"),
-					tooltip: _("Save this view as new cronk"),
-					iconCls: 'icinga-icon-star-plus',
-					handler: function() {
-						var cb = Cronk.util.CronkBuilder.getInstance();
-						cb.show(this.getEl());
-						cb.setCurrentCronkId(ctxItem.getId());
-					}
+					text: _("Settings"),
+					menu: [{
+						text: _("Save Cronk"),
+						tooltip: _("Save this view as new cronk"),
+						iconCls: 'icinga-icon-star-plus',
+						handler: function() {
+							var cb = Cronk.util.CronkBuilder.getInstance();
+							cb.show(this.getEl());
+							cb.setCurrentCronkId(ctxItem.getId());
+						}
+					}, {
+						text: _("Tab slider"),
+						checked: false,
+						checkHandler: function(checkItem, checked) {
+							
+							var refresh = AppKit.getPrefVal('org.icinga.grid.refreshTime') || 300;
+							
+							if (checked == true) {
+								
+								if (Ext.isDefined(this.sliderTask)) {
+									AppKit.getTr().stop(this.sliderTask);
+								}
+								
+								this.sliding_tab = this.getTabIndex(ctxItem);
+								
+								this.sliderTask = {
+									run: function() {
+										this.sliding_tab++;		
+										if (this.sliding_tab >= tp.items.getCount()) {
+											this.sliding_tab = 0;
+										}
+										
+										tp.setActiveTab(this.sliding_tab);
+									},
+									interval: (refresh * 1000),
+									scope: this
+								}
+								
+								AppKit.getTr().start(this.sliderTask);
+							}
+							else {
+								AppKit.getTr().stop(this.sliderTask);
+							}
+							
+						},
+						scope: this
+					}]
 				}]
 			});
 		}
@@ -175,7 +216,18 @@ Cronk.util.CronkTabHelper = Ext.extend(Object, {
 		this.contextmenu.showAt(e.getPoint());
 	},
 	
-	renameTab : function() {
+	getTabIndex: function(tab) {
+		var i = -1;
+		tp.items.each(function(item, index, a) {
+			i++;
+			if (item == tab) {
+				return false;
+			}
+		});
+		return i;
+	},
+	
+	enameTab : function() {
 		var msg = Ext.Msg.prompt(_("Enter title"), _("Change title for this tab"), function(btn, text) {
 			
 			if (btn == 'ok' && text) {
diff --git a/pub/styles/icinga-icons.css b/pub/styles/icinga-icons.css
index a3b81df..030c71d 100644
--- a/pub/styles/icinga-icons.css
+++ b/pub/styles/icinga-icons.css
@@ -111,4 +111,5 @@
 .icinga-icon-zoom { background-image: url(../images/icons/magnifier.png) !important; background-repeat: no-repeat; background-position: center center; }
 .icinga-icon-application-task { background-image: url(../images/icons/application-task.png) !important; background-repeat: no-repeat; }
 .icinga-icon-close { background-image: url(../images/icons/cross-circle-frame.png) !important; background-repeat: no-repeat; }
-.icinga-icon-bin { background-image: url(../images/icons/bin.png) !important; background-repeat: no-repeat; }
\ No newline at end of file
+.icinga-icon-bin { background-image: url(../images/icons/bin.png) !important; background-repeat: no-repeat; }
+.icinga-icon-slide-arrow { background-image: url(../images/icons/slide--arrow.png) !important; background-repeat: no-repeat; }
\ No newline at end of file





More information about the icinga-checkins mailing list