Skip to content

Commit e170349

Browse files
committed
Some further refactoring in form classes.
1 parent d2df33e commit e170349

4 files changed

Lines changed: 30 additions & 28 deletions

File tree

WEB-INF/lib/form/Form.class.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,19 @@ function addInput($params) {
7979
if (isset($params['format'])) $el->setFormat($params['format']);
8080
break;
8181

82+
case 'textarea':
83+
import('form.TextArea');
84+
$el = new TextArea($params['name']);
85+
if (isset($params['cols'])) $el->setColumns($params['cols']);
86+
if (isset($params['rows'])) $el->setRows($params['rows']);
87+
if (isset($params['maxlength'])) $el->setMaxLength($params['maxlength']);
88+
break;
89+
90+
case 'checkbox':
91+
import('form.Checkbox');
92+
$el = new Checkbox($params['name']);
8293
// TODO: refactoring ongoing down from here.
83-
case "textarea":
84-
import('form.TextArea');
85-
$el = new TextArea($params["name"]);
86-
$el->setColumns(@$params["cols"]);
87-
$el->setRows(@$params["rows"]);
88-
if (isset($params["maxlength"])) $el->setMaxLength($params["maxlength"]);
89-
break;
90-
91-
case "checkbox":
92-
import('form.Checkbox');
93-
$el = new Checkbox($params["name"]);
94-
if (@$params["checked"]) $el->setChecked(true);
94+
if (@$params["checked"]) $el->setChecked(true);
9595
$el->setData(@$params["data"]);
9696
break;
9797

WEB-INF/lib/form/TextField.class.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@
2727
// +----------------------------------------------------------------------+
2828

2929
import('form.FormElement');
30-
30+
3131
class TextField extends FormElement {
3232

33-
function __construct($name,$value="")
34-
{
35-
$this->class = 'TextField';
36-
$this->name = $name;
37-
$this->value = $value;
38-
}
33+
function __construct($name, $value = '')
34+
{
35+
$this->class = 'TextField';
36+
$this->name = $name;
37+
$this->value = $value;
38+
}
3939

40+
// TODO: refactoring ongoing down from here.
4041
function getHtml() {
4142
if (!$this->isEnabled()) {
4243
$html = "<input name=\"$this->name\" value=\"".htmlspecialchars($this->getValue())."\" readonly>\n";

WEB-INF/lib/form/UploadFile.class.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,16 @@
2929
import('form.FormElement');
3030

3131
class UploadFile extends FormElement {
32-
var $class = 'UploadFile';
33-
var $mMaxSize = 100000; // 100kb
32+
var $mMaxSize = 100000; // 100kb // TODO: refactor this.
3433

35-
function __construct($name,$value="")
36-
{
37-
$this->name = $name;
38-
$this->value = $value;
39-
}
40-
34+
function __construct($name, $value = '')
35+
{
36+
$this->class = 'UploadFile';
37+
$this->name = $name;
38+
$this->value = $value;
39+
}
40+
41+
// TODO: refactoring ongoing down from here.
4142
function setMaxSize($value) { $this->mMaxSize = $value; }
4243
function getMaxSize() { return $this->mMaxSize; }
4344

WEB-INF/templates/footer.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<br>
1313
<table cellspacing="0" cellpadding="4" width="100%" border="0">
1414
<tr>
15-
<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> |
15+
<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> |
1616
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
1717
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
1818
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>

0 commit comments

Comments
 (0)