From 356a67fa5476dc288c5a9704fdedf3644cedf596 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 24 Jul 2009 06:36:52 -0400
Subject: [PATCH] Improve button capabilities

---
 program/include/rcube_template.php |    2 
 program/js/app.js                  |   61 ++++++++++++++++++------------
 2 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/program/include/rcube_template.php b/program/include/rcube_template.php
index 599f30c..3d894b5 100755
--- a/program/include/rcube_template.php
+++ b/program/include/rcube_template.php
@@ -876,7 +876,7 @@
             $link_attrib = array('href', 'onclick', 'onmouseover', 'onmouseout', 'onmousedown', 'onmouseup', 'target');
         }
         else if ($attrib['type']=='link') {
-            $btn_content = $attrib['label'] ? $attrib['label'] : $attrib['command'];
+            $btn_content = isset($attrib['content']) ? $attrib['content'] : ($attrib['label'] ? $attrib['label'] : $attrib['command']);
             $link_attrib = array('href', 'onclick', 'title', 'id', 'class', 'style', 'tabindex', 'target');
         }
         else if ($attrib['type']=='input') {
diff --git a/program/js/app.js b/program/js/app.js
index c8a8c58..a067926 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -3461,67 +3461,78 @@
 
   // mouse over button
   this.button_over = function(command, id)
-    {
+  {
     var a_buttons = this.buttons[command];
-    var button, img;
+    var button, elm;
 
     if(!a_buttons || !a_buttons.length)
       return false;
 
     for(var n=0; n<a_buttons.length; n++)
-      {
+    {
       button = a_buttons[n];
       if(button.id==id && button.status=='act')
-        {
-        img = document.getElementById(button.id);
-        if (img && button.over)
-          img.src = button.over;
+      {
+        elm = document.getElementById(button.id);
+        if (elm && button.over) {
+          if (button.type == 'image')
+            elm.src = button.over;
+          else
+            elm.className = button.over;
         }
       }
-      
-    };
+    }
+  };
 
   // mouse down on button
   this.button_sel = function(command, id)
-    {
+  {
     var a_buttons = this.buttons[command];
-    var button, img;
+    var button, elm;
 
     if(!a_buttons || !a_buttons.length)
       return;
 
     for(var n=0; n<a_buttons.length; n++)
-      {
+    {
       button = a_buttons[n];
       if(button.id==id && button.status=='act')
-        {
-        img = document.getElementById(button.id);
-        if (img && button.sel)
-          img.src = button.sel;
+      {
+        elm = document.getElementById(button.id);
+        if (elm && button.sel) {
+          if (button.type == 'image')
+            elm.src = button.sel;
+          else
+            elm.className = button.sel;
         }
       }
-    };
+    }
+  };
 
   // mouse out of button
   this.button_out = function(command, id)
-    {
+  {
     var a_buttons = this.buttons[command];
-    var button, img;
+    var button, elm;
 
     if(!a_buttons || !a_buttons.length)
       return;
 
     for(var n=0; n<a_buttons.length; n++)
-      {
+    {
       button = a_buttons[n];
       if(button.id==id && button.status=='act')
-        {
-        img = document.getElementById(button.id);
-        if (img && button.act)
-          img.src = button.act;
+      {
+        elm = document.getElementById(button.id);
+        if (elm && button.act) {
+          if (button.type == 'image')
+            elm.src = button.act;
+          else
+            elm.className = button.act;
         }
       }
-    };
+    }
+  };
 
   // write to the document/window title
   this.set_pagetitle = function(title)

--
Gitblit v1.9.1