[dev] Renderer patch

Eduardo Dominguez lalo at teligens.com
Fri Apr 11 19:17:42 PDT 2003


A small cosmetic change to Renderer that adds <labels> and its 
corresponding id to *some* types. Also, the description now uses its own 
CSS class.
-------------- next part --------------
Index: Renderer.php
===================================================================
RCS file: /repository/horde/lib/Form/Renderer.php,v
retrieving revision 1.49
diff -u -r1.49 Renderer.php
--- Renderer.php	4 Apr 2003 05:51:07 -0000	1.49
+++ Renderer.php	11 Apr 2003 22:40:40 -0000
@@ -225,14 +225,14 @@
         $pre  = $isvalid ? '' : '<span class="form-error">';
         $post = $isvalid ? '' : '<br />' . $message . '</span>';
 ?><tr class="item0" valign="top">
-  <td width="25%" align="left"><?php echo $pre . $req . $var->getHumanName() . $post ?></td>
+  <td width="25%" align="left"><label for="<?php echo $var->getVarName() ?>"><?php echo $pre . $req . $var->getHumanName() . $post ?></label></td>
   <td width="75%"><?php
     }
 
     function _renderVarInputEnd(&$form, &$var, &$vars)
     {
         if ($var->getDescription()) {
-            echo '<br />' . $var->getDescription();
+            echo '<br /><span class="form-field-description">' . $var->getDescription() .'</span>';
         }
 ?></td></tr><?php
     }
@@ -244,22 +244,22 @@
 
     function _renderVarInput_number(&$form, &$var, &$vars, $index = null)
     {
-?><input type="text" size="5" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
+?><input type="text" size="5" id="<?php echo $var->getVarName() ?>" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
     }
 
     function _renderVarInput_int(&$form, &$var, &$vars, $index = null)
     {
-?><input type="text" size="5" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
+?><input type="text" size="5" id="<?php echo $var->getVarName() ?>" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
     }
 
     function _renderVarInput_intlist(&$form, &$var, &$vars, $index = null)
     {
-?><input type="text" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
+?><input type="text" id="<?php echo $var->getVarName() ?>" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
     }
 
     function _renderVarInput_text(&$form, &$var, &$vars, $index = null)
     {
-?><input type="text" size="40" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
+?><input type="text" size="40" id="<?php echo $var->getVarName() ?>" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
     }
 
     function _renderVarInput_file(&$form, &$var, &$vars, $index = null)
@@ -279,12 +279,12 @@
 
     function _renderVarInput_date(&$form, &$var, &$vars, $index = null)
     {
-?><input type="text" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
+?><input type="text" id="<?php echo $var->getVarName() ?>" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
     }
 
     function _renderVarInput_time(&$form, &$var, &$vars, $index = null)
     {
-?><input type="text" size="5" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
+?><input type="text" size="5" id="<?php echo $var->getVarName() ?>" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><?php
     }
 
     function _renderVarInput_monthyear(&$form, &$var, &$vars, $index = null)
@@ -417,7 +417,7 @@
         if (!$wasset) {
             $selected = $var->getDefault();
         }
-?><select multiple="multiple" size="<?php echo $var->type->size ?>" name="<?php echo $var->getVarName() ?>[]">
+?><select multiple="multiple" id="<?php echo $var->getVarName() ?>" size="<?php echo $var->type->size ?>" name="<?php echo $var->getVarName() ?>[]">
   <?php echo $this->_multiSelectOptions($values, $selected) ?>
   </select><?php
     }
@@ -448,7 +448,7 @@
 
     function _renderVarInput_password(&$form, &$var, &$vars, $index = null)
     {
-?><input type="password" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><br /><?php
+?><input type="password" id="<?php echo $var->getVarName() ?>" name="<?php echo $var->getVarName() ?>" value="<?php echo $var->getValue($vars, $index) ?>" /><br /><?php
     }
 
     function _renderVarInput_emailconfirm(&$form, &$var, &$vars, $index = null)
@@ -467,7 +467,7 @@
 
     function _renderVarInput_boolean(&$form, &$var, &$vars, $index = null)
     {
-?><input type="checkbox" name="<?php echo $var->getVarName() ?>"<?php echo $var->getValue($vars, $index) ? ' checked="checked"' : '' ?> /><?php
+?><input type="checkbox" id="<?php echo $var->getVarName() ?>" name="<?php echo $var->getVarName() ?>"<?php echo $var->getValue($vars, $index) ? ' checked="checked"' : '' ?> /><?php
     }
 
     // Implementation specifics -- display variables




More information about the dev mailing list