From 04bc6bdd39d67bcf9f63d8af4b067f1fafc06f8a Mon Sep 17 00:00:00 2001 From: anuko Date: Tue, 28 Feb 2017 18:24:44 +0000 Subject: [PATCH] Refactoring - renamed a few things. --- WEB-INF/lib/form/Checkbox.class.php | 2 +- WEB-INF/lib/form/Combobox.class.php | 2 +- WEB-INF/lib/form/DateField.class.php | 2 +- WEB-INF/lib/form/Form.class.php | 2 +- WEB-INF/lib/form/FormElement.class.php | 8 ++++---- WEB-INF/lib/form/Submit.class.php | 2 +- WEB-INF/lib/form/TextField.class.php | 2 +- WEB-INF/templates/footer.tpl | 2 +- cf_custom_fields.php | 2 +- mobile/time.php | 4 ++-- mobile/time_edit.php | 4 ++-- reports.php | 2 +- time.php | 4 ++-- time_edit.php | 4 ++-- 14 files changed, 21 insertions(+), 21 deletions(-) diff --git a/WEB-INF/lib/form/Checkbox.class.php b/WEB-INF/lib/form/Checkbox.class.php index 37189625..6fe7ca18 100644 --- a/WEB-INF/lib/form/Checkbox.class.php +++ b/WEB-INF/lib/form/Checkbox.class.php @@ -61,7 +61,7 @@ class Checkbox extends FormElement { if ($this->mChecked || (($this->value == $this->mOptions) && ($this->value != null))) $html .= " checked=\"true\""; - if (!$this->isEnable()) + if (!$this->isEnabled()) $html .= " disabled=\"disabled\""; $html .= " value=\"".htmlspecialchars($this->mOptions)."\""; diff --git a/WEB-INF/lib/form/Combobox.class.php b/WEB-INF/lib/form/Combobox.class.php index e253e8ec..0a8bf89c 100644 --- a/WEB-INF/lib/form/Combobox.class.php +++ b/WEB-INF/lib/form/Combobox.class.php @@ -84,7 +84,7 @@ class Combobox extends FormElement { if ($this->style!="") $html .= " style=\"$this->style\""; - if (!$this->isEnable()) + if (!$this->isEnabled()) $html .= " disabled"; $html .= ">\n"; diff --git a/WEB-INF/lib/form/DateField.class.php b/WEB-INF/lib/form/DateField.class.php index d2331387..49c23544 100644 --- a/WEB-INF/lib/form/DateField.class.php +++ b/WEB-INF/lib/form/DateField.class.php @@ -83,7 +83,7 @@ class DateField extends TextField { function toStringControl() { - if (!$this->isEnable()) { + if (!$this->isEnabled()) { $html = htmlspecialchars($this->getValue()). "name\" value=\"".htmlspecialchars($this->getValue())."\">\n"; } else { diff --git a/WEB-INF/lib/form/Form.class.php b/WEB-INF/lib/form/Form.class.php index f832b632..2c16f251 100644 --- a/WEB-INF/lib/form/Form.class.php +++ b/WEB-INF/lib/form/Form.class.php @@ -142,7 +142,7 @@ class Form { $el->setFormName($this->name); if (isset($arguments["id"])) $el->setId($arguments["id"]); if (isset($GLOBALS["I18N"])) $el->setLocalization($GLOBALS["I18N"]); - if (isset($arguments["enable"])) $el->setEnable($arguments["enable"]); + if (isset($arguments["enable"])) $el->setEnabled($arguments["enable"]); if (isset($arguments["style"])) $el->setStyle($arguments["style"]); if (isset($arguments["size"])) $el->setSize($arguments["size"]); diff --git a/WEB-INF/lib/form/FormElement.class.php b/WEB-INF/lib/form/FormElement.class.php index fde8b400..20fdb07e 100644 --- a/WEB-INF/lib/form/FormElement.class.php +++ b/WEB-INF/lib/form/FormElement.class.php @@ -38,9 +38,9 @@ class FormElement { var $on_click = ''; // What happens when the control is clicked. var $label = ''; // Optional label for control. var $style = ''; // Control style. - + var $enabled = true; // Whether the control is enabled. + // TODO: refactoring ongoing down from here. - var $mEnabled = true; var $cClassName = "FormElement"; var $mI18n = null; @@ -76,8 +76,8 @@ class FormElement { function setStyle($value) { $this->style = $value; } function getStyle() { return $this->style; } - function setEnable($flag) { $this->mEnabled = $flag; } - function isEnable() { return $this->mEnabled; } + function setEnabled($flag) { $this->enabled = $flag; } + function isEnabled() { return $this->enabled; } function setOnChange($str) { $this->on_change = $str; } function setOnClick($str) { $this->on_click = $str; } diff --git a/WEB-INF/lib/form/Submit.class.php b/WEB-INF/lib/form/Submit.class.php index 236fdb4b..c6c917ed 100644 --- a/WEB-INF/lib/form/Submit.class.php +++ b/WEB-INF/lib/form/Submit.class.php @@ -44,7 +44,7 @@ class Submit extends FormElement { $html = "\n\tname\" id=\"$this->id\""; - if (!$this->isEnable()) { + if (!$this->isEnabled()) { $html .= " disabled=\"true\""; } diff --git a/WEB-INF/lib/form/TextField.class.php b/WEB-INF/lib/form/TextField.class.php index 9107c963..20b7fc6e 100644 --- a/WEB-INF/lib/form/TextField.class.php +++ b/WEB-INF/lib/form/TextField.class.php @@ -42,7 +42,7 @@ class TextField extends FormElement { function getAsPassword() { return $this->mPassword; } function toStringControl() { - if (!$this->isEnable()) { + if (!$this->isEnabled()) { $html = "name\" value=\"".htmlspecialchars($this->getValue())."\" readonly>\n"; } else { diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index ad9a6fd5..e5d8001d 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.10.38.3606 | Copyright © Anuko | +  Anuko Time Tracker 1.10.38.3607 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/cf_custom_fields.php b/cf_custom_fields.php index 18de0605..44efc79b 100644 --- a/cf_custom_fields.php +++ b/cf_custom_fields.php @@ -50,7 +50,7 @@ if ($request->isPost()) { $fields = CustomFields::getFields(); // At this time only one custom field is supported. Disable the Add button if we already have one or more custom fields. if (count($fields) > 0) - $form->getElement('btn_add')->setEnable(false); + $form->getElement('btn_add')->setEnabled(false); } $smarty->assign('forms', array($form->getName()=>$form->toArray())); diff --git a/mobile/time.php b/mobile/time.php index b0c5de11..d812864f 100644 --- a/mobile/time.php +++ b/mobile/time.php @@ -158,8 +158,8 @@ if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type } if (!$user->canManageTeam() && defined('READONLY_START_FINISH') && isTrue(READONLY_START_FINISH)) { // Make the start and finish fields read-only. - $form->getElement('start')->setEnable(false); - $form->getElement('finish')->setEnable(false); + $form->getElement('start')->setEnabled(false); + $form->getElement('finish')->setEnabled(false); } if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type)) $form->addInput(array('type'=>'text','name'=>'duration','value'=>$cl_duration,'onchange'=>"formDisable('duration');")); diff --git a/mobile/time_edit.php b/mobile/time_edit.php index 9e1fc324..d9ebdd76 100644 --- a/mobile/time_edit.php +++ b/mobile/time_edit.php @@ -178,8 +178,8 @@ if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type } if (!$user->canManageTeam() && defined('READONLY_START_FINISH') && isTrue(READONLY_START_FINISH)) { // Make the start and finish fields read-only. - $form->getElement('start')->setEnable(false); - $form->getElement('finish')->setEnable(false); + $form->getElement('start')->setEnabled(false); + $form->getElement('finish')->setEnabled(false); } if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type)) $form->addInput(array('type'=>'text','name'=>'duration','value'=>$cl_duration,'onchange'=>"formDisable('duration');")); diff --git a/reports.php b/reports.php index add2b43f..cc6edcc2 100644 --- a/reports.php +++ b/reports.php @@ -242,7 +242,7 @@ $form->setValueByElement('fav_report_changed',''); // Disable the Delete button when no favorite report is selected. if (!$bean->getAttribute('favorite_report') || ($bean->getAttribute('favorite_report') == -1)) - $form->getElement('btn_delete')->setEnable(false); + $form->getElement('btn_delete')->setEnabled(false); if ($request->isPost()) { if((!$bean->getAttribute('btn_generate') && ($request->getParameter('fav_report_changed')))) { diff --git a/time.php b/time.php index d8889110..b926e224 100644 --- a/time.php +++ b/time.php @@ -190,8 +190,8 @@ if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type } if (!$user->canManageTeam() && defined('READONLY_START_FINISH') && isTrue(READONLY_START_FINISH)) { // Make the start and finish fields read-only. - $form->getElement('start')->setEnable(false); - $form->getElement('finish')->setEnable(false); + $form->getElement('start')->setEnabled(false); + $form->getElement('finish')->setEnabled(false); } if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type)) $form->addInput(array('type'=>'text','name'=>'duration','value'=>$cl_duration,'onchange'=>"formDisable('duration');")); diff --git a/time_edit.php b/time_edit.php index aa204198..c05b0774 100644 --- a/time_edit.php +++ b/time_edit.php @@ -178,8 +178,8 @@ if ((TYPE_START_FINISH == $user->record_type) || (TYPE_ALL == $user->record_type } if (!$user->canManageTeam() && defined('READONLY_START_FINISH') && isTrue(READONLY_START_FINISH)) { // Make the start and finish fields read-only. - $form->getElement('start')->setEnable(false); - $form->getElement('finish')->setEnable(false); + $form->getElement('start')->setEnabled(false); + $form->getElement('finish')->setEnabled(false); } if ((TYPE_DURATION == $user->record_type) || (TYPE_ALL == $user->record_type)) $form->addInput(array('type'=>'text','name'=>'duration','value'=>$cl_duration,'onchange'=>"formDisable('duration');")); -- 2.20.1