Some further refactoring in form classes.
authoranuko <support@anuko.com>
Thu, 2 Mar 2017 19:34:46 +0000 (19:34 +0000)
committeranuko <support@anuko.com>
Thu, 2 Mar 2017 19:34:46 +0000 (19:34 +0000)
WEB-INF/lib/form/Form.class.php
WEB-INF/lib/form/TextField.class.php
WEB-INF/lib/form/UploadFile.class.php
WEB-INF/templates/footer.tpl

index 7814877..5f82545 100644 (file)
@@ -79,19 +79,19 @@ class Form {
         if (isset($params['format'])) $el->setFormat($params['format']);
         break;
 
+      case 'textarea':
+        import('form.TextArea');
+        $el = new TextArea($params['name']);
+        if (isset($params['cols'])) $el->setColumns($params['cols']);
+        if (isset($params['rows'])) $el->setRows($params['rows']);
+        if (isset($params['maxlength'])) $el->setMaxLength($params['maxlength']);
+        break;
+
+      case 'checkbox':
+        import('form.Checkbox');
+        $el = new Checkbox($params['name']);
 // TODO: refactoring ongoing down from here.
-               case "textarea":
-                           import('form.TextArea');
-                           $el = new TextArea($params["name"]);
-                           $el->setColumns(@$params["cols"]);
-                           $el->setRows(@$params["rows"]);
-                           if (isset($params["maxlength"])) $el->setMaxLength($params["maxlength"]);
-                           break;
-                           
-                       case "checkbox":
-                           import('form.Checkbox');
-                           $el = new Checkbox($params["name"]);
-                           if (@$params["checked"]) $el->setChecked(true);
+        if (@$params["checked"]) $el->setChecked(true);
                            $el->setData(@$params["data"]);
                            break;
                            
index 45455d0..044b3d6 100644 (file)
 // +----------------------------------------------------------------------+
 
 import('form.FormElement');
-       
+
 class TextField extends FormElement {
 
-       function __construct($name,$value="")
-       {
-            $this->class = 'TextField';
-               $this->name = $name;
-               $this->value = $value;
-       }
+  function __construct($name, $value = '')
+  {
+    $this->class = 'TextField';
+    $this->name = $name;
+    $this->value = $value;
+  }
 
+  // TODO: refactoring ongoing down from here.
        function getHtml() {
                if (!$this->isEnabled()) {
                        $html = "<input name=\"$this->name\" value=\"".htmlspecialchars($this->getValue())."\" readonly>\n";
index eb24259..cfb6712 100644 (file)
 import('form.FormElement');
        
 class UploadFile extends FormElement {
-    var $class = 'UploadFile';
-    var $mMaxSize              = 100000;       // 100kb
+    var $mMaxSize              = 100000;       // 100kb // TODO: refactor this.
 
-       function __construct($name,$value="")
-       {
-               $this->name = $name;
-               $this->value = $value;
-       }
-       
+  function __construct($name, $value = '')
+  {
+    $this->class = 'UploadFile';
+    $this->name = $name;
+    $this->value = $value;
+  }
+
+// TODO: refactoring ongoing down from here.
        function setMaxSize($value)     { $this->mMaxSize = $value;     }
        function getMaxSize()   { return $this->mMaxSize; }
        
index 9b14662..9f06430 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.10.38.3616 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.10.38.3617 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>