[ansel] Patch for help

Heath S. Hendrickson heath at outerspaceconsultants.com
Wed May 19 09:35:22 PDT 2004


Heath S. Hendrickson wrote:

> While I realize that this list may not be the most appropriate for 
> this patch, I did it in in the interests of Ansel so I'm posting it 
> here... (that and I'm not subscribed to whatever list the framework 
> falls under).
>
> It's a patch to framework/Help/Help.php that adds three new handlers 
> for handling tables in the help display.
>
> h

Okay, I made a couple small tweaks to the file and added the <th> 
handler.  Mostly I made some style changes to the way the tables were 
displayed (border, coloring, etc.) so that they would be easier to read.

h
-------------- next part --------------
Index: framework/Help/Help.php
===================================================================
RCS file: /usr/local/horde/cvs/framework/Help/Help.php,v
retrieving revision 1.57
diff -u -r1.57 Help.php
--- framework/Help/Help.php	7 Apr 2004 14:43:08 -0000	1.57
+++ framework/Help/Help.php	19 May 2004 16:32:06 -0000
@@ -112,6 +112,10 @@
         'href'     =>  '_hrefHandler',
         'b'        =>  '_bHandler',
         'i'        =>  '_iHandler',
+        'table'    =>  '_tableHandler',
+        'tr'       =>  '_trHandler',
+        'th'       =>  '_thHandler',
+        'td'       =>  '_tdHandler',
     );
 
 
@@ -472,6 +476,70 @@
     }
 
     /**
+     * XML element handler for the <table> tag.
+     *
+     * @access private
+     *
+     * @param boolean $startTag      Boolean indicating whether this instance
+     *                               is a start tag.
+     * @param optional array $attrs  Additional element attributes (Not used).
+     */
+    function _tableHandler($startTag, $attrs = array())
+    {
+        if ($this->_inHelp && $this->_inBlock) {
+            $this->_output .= ($startTag) ? '<table style="border: 1px solid black; padding: 5px;">' : '</table>';
+        }
+    }
+
+    /**
+     * XML element handler for the <tr> tag.
+     *
+     * @access private
+     *
+     * @param boolean $startTag      Boolean indicating whether this instance
+     *                               is a start tag.
+     * @param optional array $attrs  Additional element attributes (Not used).
+     */
+    function _trHandler($startTag, $attrs = array())
+    {
+        if ($this->_inHelp && $this->_inBlock) {
+            $this->_output .= ($startTag) ? '<tr style="border: 1px solid black;">' : '</tr>';
+        }
+    }
+
+    /**
+     * XML element handler for the <th> tag.
+     *
+     * @access private
+     *
+     * @param boolean $startTag      Boolean indicating whether this instance
+     *                               is a start tag.
+     * @param optional array $attrs  Additional element attributes (Not used).
+     */
+    function _thHandler($startTag, $attrs = array())
+    {
+        if ($this->_inHelp && $this->_inBlock) {
+            $this->_output .= ($startTag) ? '<th>' : '</th>';
+        }
+    }
+
+    /**
+     * XML element handler for the <td> tag.
+     *
+     * @access private
+     *
+     * @param boolean $startTag      Boolean indicating whether this instance
+     *                               is a start tag.
+     * @param optional array $attrs  Additional element attributes (Not used).
+     */
+    function _tdHandler($startTag, $attrs = array())
+    {
+        if ($this->_inHelp && $this->_inBlock) {
+            $this->_output .= ($startTag) ? '<td class="header" style="font: 1em normal;">' : '</td>';
+        }
+    }
+
+    /**
      * Includes the JavaScript necessary to create a new pop-up help
      * window.
      *


More information about the ansel mailing list