[icinga-checkins] icinga.org: icinga-web/mhein/testing: * Allow selectable text in grids ( fixes #1612)

git at icinga.org git at icinga.org
Tue Aug 23 14:25:32 CEST 2011


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

Author: Marius Hein <marius.hein at netways.de>
Date:   Tue Aug 23 14:25:12 2011 +0200

* Allow selectable text in grids (fixes #1612)

---

 .../Cronks/data/xml/grid/icinga-host-template.xml  |    8 +++++---
 .../data/xml/grid/icinga-service-template.xml      |    6 ++++--
 .../Cronks/lib/js/grid/renderer/ColumnRenderer.js  |   15 +++++++++++----
 pub/styles/icinga.css                              |   20 ++++++++++++++++++++
 4 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/app/modules/Cronks/data/xml/grid/icinga-host-template.xml b/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
index 6ccf0b0..65ea710 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-host-template.xml
@@ -1121,9 +1121,11 @@
                 <parameter name="label">Output</parameter>
                 
                 <parameter name="jsFunc">
-                	<parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
-                	<parameter name="function">truncateText</parameter>
-                 
+                    <parameter>
+                        <parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
+                        <parameter name="function">selectableColumn</parameter>
+                        <parameter name="type">renderer</parameter>
+                    </parameter>
                 </parameter>
                 
             </display>
diff --git a/app/modules/Cronks/data/xml/grid/icinga-service-template.xml b/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
index d3a17ed..689683d 100644
--- a/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
+++ b/app/modules/Cronks/data/xml/grid/icinga-service-template.xml
@@ -1076,8 +1076,10 @@
                 <parameter name="label">Output</parameter>
                 
                 <parameter name="jsFunc">
-                	<parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
-                	<parameter name="function">truncateText</parameter> 
+                    <parameter>
+                        <parameter name="namespace">Cronk.grid.ColumnRenderer</parameter>
+                        <parameter name="function">selectableColumn</parameter> 
+                    </parameter>
                 </parameter>
             </display>
         	
diff --git a/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js b/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
index 746abff..97356e6 100755
--- a/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
+++ b/app/modules/Cronks/lib/js/grid/renderer/ColumnRenderer.js
@@ -40,7 +40,7 @@ Cronk.grid.ColumnRenderer = {
 		return function(value, metaData, record, rowIndex, colIndex, store) {
 			
 			if (value == undefined) {
-				metaData.css = 'x-icinga-grid-data-null';
+				metaData.css += ' x-icinga-grid-data-null';
 				return '(null)';
 			}
 			
@@ -50,14 +50,14 @@ Cronk.grid.ColumnRenderer = {
 	
 	truncateText : function(cfg) {
 		var defaultLength = AppKit.getPrefVal('org.icinga.grid.outputLength') || 70;
-		
+		AppKit.log(cfg);
 		return function(value, metaData, record, rowIndex, colIndex, store) {
 			if(!value) 
 				return "";
 			// skip truncate if html is located at the ouput
 			if(value.match(/<.*?>(.*?)<\/.*?>/g))
 				return value;
-
+            
 			var out = Ext.util.Format.ellipsis(value, (cfg.length || defaultLength));
 			if (out.indexOf('...', (out.length-3)) != -1) {
                 metaData.attr = 'ext:qtip="' + value.replace(/"/g, "'") + '"';
@@ -165,5 +165,12 @@ Cronk.grid.ColumnRenderer = {
 			}
 			return Icinga.StatusData.wrapElement(type, value);
 		}
-	}
+	},
+    
+    selectableColumn : function(cfg) {
+        return function(value, metaData, record, rowIndex, colIndex, store) {
+            metaData.css += ' x-icinga-grid-cell-selectable'
+			return value;
+		}
+    }
 };
diff --git a/pub/styles/icinga.css b/pub/styles/icinga.css
index 71b91e4..7918268 100644
--- a/pub/styles/icinga.css
+++ b/pub/styles/icinga.css
@@ -570,6 +570,26 @@ div#menu {
 
 .icinga-icon-dot { background-image: url(../images/icinga/idot-icon.png) !important; background-repeat: no-repeat; }
 
+/*
+ * To enable global selectable text in grids
+ * just enable these lines of css
+ */
+ 
+/*.x-grid3-row td,
+.x-grid3-summary-row td,
+.x-grid3-cell-text,
+.x-grid3-hd-text,
+.x-grid3-hd,
+.x-grid3-row {
+	-moz-user-select:inherit;
+	-khtml-user-select:text;
+}*/
+
+.x-icinga-grid-cell-selectable .x-grid3-cell-inner {
+	-moz-user-select: all;
+	-khtml-user-select:text;
+}
+
 .x-grid3-header * .icon-16 {
     display:none;
 }





More information about the icinga-checkins mailing list