Some more refactoring in Form classes.
authoranuko <support@anuko.com>
Fri, 3 Mar 2017 01:22:44 +0000 (01:22 +0000)
committeranuko <support@anuko.com>
Fri, 3 Mar 2017 01:22:44 +0000 (01:22 +0000)
12 files changed:
WEB-INF/lib/form/Calendar.class.php
WEB-INF/lib/form/Checkbox.class.php
WEB-INF/lib/form/CheckboxGroup.class.php
WEB-INF/lib/form/Combobox.class.php
WEB-INF/lib/form/DateField.class.php
WEB-INF/lib/form/FloatField.class.php
WEB-INF/lib/form/Form.class.php
WEB-INF/lib/form/Hidden.class.php
WEB-INF/lib/form/Submit.class.php
WEB-INF/lib/form/Table.class.php
WEB-INF/lib/form/TextArea.class.php
WEB-INF/templates/footer.tpl

index dbe2998..ab2dcf5 100644 (file)
@@ -44,15 +44,14 @@ class Calendar extends FormElement {
 
     var $controlName = "";
     var $highlight = "time"; // Determines what type of active days to highlight ("time" or "expenses"). 
-    // var $mAllDays       = true;
-    var $class = "Calendar";
 
     function __construct($name) {
-        $this->controlName = $name;
-        $this->mMonthNames = array('January','February','March','April','May','June','July','August','September','October','November','December');
-        $this->mWeekDayShortNames = array('Su','Mo','Tu','We','Th','Fr','Sa');
+      $this->class = 'Calendar';
+      $this->controlName = $name; // TODO: why controlName? Other classes have "name".
+      $this->mMonthNames = array('January','February','March','April','May','June','July','August','September','October','November','December');
+      $this->mWeekDayShortNames = array('Su','Mo','Tu','We','Th','Fr','Sa');
     }
-    
+
     function setHighlight($highlight) {
        if ($highlight && $highlight != 'time')
          $this->highlight = $highlight;
index 4c6a9fd..e3d9cf2 100644 (file)
@@ -31,13 +31,12 @@ import('form.FormElement');
 class Checkbox extends FormElement {
     var $mChecked      = false;
     var $mOptions      = null;
-    var $class = 'Checkbox';
 
-       function __construct($name,$value="")
-       {
-               $this->name = $name;
-               $this->value = $value;
-       }
+  function __construct($name, $value = '') {
+    $this->class = 'Checkbox';
+    $this->name = $name;
+    $this->value = $value;
+  }
 
        function setChecked($value)     { $this->mChecked = $value; }
        function isChecked() { return $this->mChecked; }
index cb7c9f1..f672270 100644 (file)
@@ -33,17 +33,16 @@ class CheckboxGroup extends FormElement {
     var $mOptions      = array();
     var $mLayout       = "V";
     var $mGroupIn      = 1;
-    var $class = 'CheckboxGroup';
     var $mDataKeys     = array();
     var $mDataDeep     = 1;
     var $lSelAll       = "All";
     var $lSelNone      = "None";
 
-       function __construct($name,$value="")
-       {
-               $this->name = $name;
-               $this->value = $value;
-       }
+  function __construct($name, $value = '') {
+    $this->class = 'CheckboxGroup';
+    $this->name = $name;
+    $this->value = $value;
+  }
 
        function setChecked($value)     { $this->mChecked = $value; }
        function isChecked() { return $this->mChecked; }
index ce66739..97c9c50 100644 (file)
@@ -44,13 +44,12 @@ class Combobox extends FormElement {
     var $mCompareOn = "key"; // or "value"
     var $mDataDeep = 1;
     var $mDataKeys = array();
-    var $class = 'Combobox';
 
-       function __construct($name,$value="")
-       {
-               $this->name = $name;
-               $this->value = $value;
-       }
+  function __construct($name, $value = '') {
+    $this->class = 'Combobox';
+    $this->name = $name;
+    $this->value = $value;
+  }
 
        function setMultiple($value)    { $this->mMultiple = $value; }
        function isMultiple() { return $this->mMultiple; }
@@ -111,4 +110,3 @@ class Combobox extends FormElement {
                return $html;
        }
 }
-?>
\ No newline at end of file
index 3906db6..ecfdaf9 100644 (file)
@@ -33,15 +33,14 @@ class DateField extends TextField {
   var $mWeekStartDay = 0;
   var $mDateFormat  = "d/m/Y";
   var $lToday      = "Today";
-
   var $mDateObj;
-  var $class = 'DateField';
 
   var $lCalendarButtons = array('today'=>'Today', 'close'=>'Close');
 
   function __construct($name) {
-    $this->name  = $name;
-    $this->mDateObj  = new DateAndTime();
+    $this->class = 'DateField';
+    $this->name = $name;
+    $this->mDateObj = new DateAndTime();
 
     if (isset($GLOBALS["I18N"])) {
       $this->localize($GLOBALS["I18N"]);
index 6bbfd64..b11f4a1 100644 (file)
 import('form.TextField');
 
 class FloatField extends TextField {
-
   var $mDelimiter = '.';
   var $mFFormat;
-  var $class = 'FloatField';
-
+  
   function __construct($name) {
+    $this->class = 'FloatField';
     $this->name = $name;
   }
 
index 5f82545..704ce7e 100644 (file)
@@ -34,7 +34,6 @@
 // +----------------------------------------------------------------------+
 
 class Form {
-
   var $name = '';          // Form name.
   var $elements = array(); // An array of input controls in form.
 
index e06466e..3693f84 100644 (file)
 // +----------------------------------------------------------------------+
 
 import('form.FormElement');
-       
+
 class Hidden extends FormElement {
-    var $class = 'Hidden';
 
-       function __construct($name,$value="")
-       {
-               $this->name = $name;
-               $this->value = $value;
-       }
+  function __construct($name, $value = '') {
+    $this->class = 'Hidden';
+    $this->name = $name;
+    $this->value = $value;
+  }
+
+  function getHtml() {
+    if ($this->id == '') $this->id = $this->name;
 
-       function getHtml()      {
-           
-           if ($this->id=="") $this->id = $this->name;
-           
-               $html = "\n\t<input";
-               $html .= " type=\"hidden\" name=\"$this->name\" id=\"$this->id\"";
-               
-               $html .= " value=\"".$this->getValue()."\"";
-               $html .= ">";
-               
-               return $html;
-       }
+    $html = "\n\t<input type=\"hidden\" id=\"$this->id\" name=\"$this->name\"";
+    $html.= ' value="'.$this->getValue().'">';
+    return $html;
+  }
 }
index 905b269..91123c5 100644 (file)
 import('form.FormElement');
        
 class Submit extends FormElement {
-       var $class = 'Submit';
 
-       function __construct($name,$value="")
-       {
-               $this->name = $name;
-               $this->value = $value;
-       }
+  function __construct($name, $value = '')
+  {
+    $this->class = 'Submit';
+    $this->name = $name;
+    $this->value = $value;
+  }
 
-       function getHtml() {
+  function getHtml() {
            
            if ($this->id=="") $this->id = $this->name;
            
index 807e2c7..ec3510c 100644 (file)
@@ -41,13 +41,13 @@ class Table extends FormElement {
   var $mBgColor       = '#ffffff';
   var $mBgColorOver   = '#eeeeff';
   var $mWidth         = '';
-  var $class = 'Table';
   var $mTableOptions  = array();
   var $mRowOptions    = array();
   var $mHeaderOptions = array();
   var $mProccessed    = false;
        
   function __construct($name, $value='') {
+    $this->class = 'Table';
     $this->name = $name;
     $this->value = $value;
   }
index ea1009a..66101b9 100644 (file)
@@ -31,14 +31,14 @@ import('form.FormElement');
 class TextArea extends FormElement {
     var $mColumns      = "";
     var $mRows         = "";
-    var $class = 'TextArea';
     var $mOnKeyPress   = "";
 
-       function __construct($name,$value="")
-       {
-               $this->name = $name;
-               $this->value = $value;
-       }
+  function __construct($name, $value = '')
+  {
+    $this->class = 'TextArea';
+    $this->name = $name;
+    $this->value = $value;
+  }
        
        function setColumns($value)     { $this->mColumns = $value;     }
        function getColumns()   { return $this->mColumns; }
index 9f06430..3945875 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.3617 | 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.3618 | 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>