From 6ea6c9b96e33f0c6616ff270cc5b81efe216a209 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 20 Jun 2008 04:46:16 -0400
Subject: [PATCH] Simplify step inclusion in controller (index.php)

---
 program/include/html.php |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/program/include/html.php b/program/include/html.php
index e58c2b6..aa9d758 100644
--- a/program/include/html.php
+++ b/program/include/html.php
@@ -32,7 +32,7 @@
     protected $allowed;
     protected $content;
 
-    protected static $common_attrib = array('id','class','style','title','align');
+    public static $common_attrib = array('id','class','style','title','align');
     public static $containers = array('div','span','p','h1','h2','h3','form','textarea');
     public static $lc_tags = true;
 
@@ -371,7 +371,7 @@
         }
 
         // set value attribute
-        $this->attrib['checked'] = ($value && (string)$value == (string)$this->attrib['value']);
+        $this->attrib['checked'] = ((string)$value == (string)$this->attrib['value']);
 
         return parent::show();
     }
@@ -401,7 +401,7 @@
         }
 
         // set value attribute
-        $this->attrib['checked'] = ($value && (string)$value == (string)$this->attrib['value']);
+        $this->attrib['checked'] = ((string)$value == (string)$this->attrib['value']);
 
         return parent::show();
     }
@@ -415,7 +415,7 @@
 class html_textarea extends html
 {
     protected $tagname = 'textarea';
-    protected $allowed_attrib = array('name','rows','cols','wrap');
+    protected $allowed_attrib = array('name','rows','cols','wrap','tabindex');
 
     /**
      * Get HTML code for this object
@@ -441,9 +441,10 @@
             unset($this->attrib['value']);
         }
 
-        if (!empty($value) && !isset($this->attrib['mce_editable'])) {
+        if (!empty($value) && !ereg('mce_editor', $this->attrib['class'])) {
             $value = Q($value, 'strict', false);
         }
+
         return self::tag($this->tagname, $this->attrib, $value, array_merge(self::$common_attrib, $this->allowed_attrib));
     }
 }
@@ -510,8 +511,8 @@
         foreach ($this->options as $option) {
             $attr = array(
                 'value' => $option['value'],
-                'selected' => ((!empty($option['value']) && in_array($option['value'], $select, true)) ||
-            (in_array($option['text'], $select, TRUE))) ? 1 : null);
+                'selected' => (in_array($option['value'], $select, true) ||
+            in_array($option['text'], $select, true)) ? 1 : null);
 
             $this->content .= self::tag('option', $attr, Q($option['text']));
         }
@@ -570,7 +571,7 @@
      * @param array Cell attributes
      * @param string Cell content
      */
-    private function add_header($attr, $cont)
+    public function add_header($attr, $cont)
     {
         if (is_string($attr))
         $attr = array('class' => $attr);
@@ -586,7 +587,7 @@
      *
      * @param array Row attributes
      */
-    private function add_row($attr = array())
+    public function add_row($attr = array())
     {
         $this->rowindex++;
         $this->colindex = 0;
@@ -602,16 +603,18 @@
      * @param array Table attributes
      * @return string The final table HTML code
      */
-    public function show($attr = array())
+    public function show($attrib = null)
     {
-        $this->attrib = array_merge($this->attrib, $attr);
-        $thead = $tbody = "";
+	if (is_array($attrib))
+    	    $this->attrib = array_merge($this->attrib, $attrib);
+        
+	$thead = $tbody = "";
 
         // include <thead>
         if (!empty($this->header)) {
             $rowcontent = '';
             foreach ($this->header as $c => $col) {
-                $rowcontent .= self::tag('th', $col->attrib, $col->content);
+                $rowcontent .= self::tag('td', $col->attrib, $col->content);
             }
             $thead = self::tag('thead', null, self::tag('tr', null, $rowcontent));
         }
@@ -623,7 +626,7 @@
             }
 
             if ($r < $this->rowindex || count($row->cells)) {
-                $tbody .= self::tag('tr', $rows->attrib, $rowcontent);
+                $tbody .= self::tag('tr', $row->attrib, $rowcontent);
             }
         }
 

--
Gitblit v1.9.1