From 07f5140771388c9e0c8a99b0dd2e5d950bdb173b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 14 Oct 2021 15:16:42 +1100 Subject: moving h-source subdir out. --- admin/Library/Form/Checkbox.php | 41 ++++++++++++++ admin/Library/Form/Entry.php | 45 +++++++++++++++ admin/Library/Form/Form.php | 116 +++++++++++++++++++++++++++++++++++++++ admin/Library/Form/Hidden.php | 23 ++++++++ admin/Library/Form/Html.php | 23 ++++++++ admin/Library/Form/InputText.php | 30 ++++++++++ admin/Library/Form/Password.php | 30 ++++++++++ admin/Library/Form/Radio.php | 30 ++++++++++ admin/Library/Form/Select.php | 30 ++++++++++ admin/Library/Form/Textarea.php | 30 ++++++++++ admin/Library/Form/index.html | 1 + 11 files changed, 399 insertions(+) create mode 100755 admin/Library/Form/Checkbox.php create mode 100755 admin/Library/Form/Entry.php create mode 100755 admin/Library/Form/Form.php create mode 100755 admin/Library/Form/Hidden.php create mode 100644 admin/Library/Form/Html.php create mode 100755 admin/Library/Form/InputText.php create mode 100644 admin/Library/Form/Password.php create mode 100755 admin/Library/Form/Radio.php create mode 100755 admin/Library/Form/Select.php create mode 100755 admin/Library/Form/Textarea.php create mode 100644 admin/Library/Form/index.html (limited to 'admin/Library/Form') diff --git a/admin/Library/Form/Checkbox.php b/admin/Library/Form/Checkbox.php new file mode 100755 index 0000000..5df1917 --- /dev/null +++ b/admin/Library/Form/Checkbox.php @@ -0,0 +1,41 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::checkbox($this->entryName, $value, $this->options, $this->className,$this->idName); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/admin/Library/Form/Entry.php b/admin/Library/Form/Entry.php new file mode 100755 index 0000000..725235a --- /dev/null +++ b/admin/Library/Form/Entry.php @@ -0,0 +1,45 @@ + entry or a radio button). Associative array or comma-divided list. + public $defaultValue = ''; + public $wrap = array(); + public $type = null; //the type of the entry + + //create the label of each entry of the form + public function getLabelTag() + { + $labelTagClass = isset($this->labelClass) ? $this->labelClass : 'entryLabel'; + return isset($this->labelString) ? "\n\t" : null; + } + + //get the class of the entry + public function getEntryClass() + { + return isset($this->entryClass) ? $this->entryClass : 'formEntry'; + } + + public function getWrapElements() + { + $wrap[0] = isset($this->wrap[0]) ? $this->wrap[0] : null; + $wrap[1] = isset($this->wrap[1]) ? $this->wrap[1] : null; + $wrap[2] = isset($this->wrap[2]) ? $this->wrap[2] : null; + return $wrap; + } + + abstract public function render($value = null); + +} diff --git a/admin/Library/Form/Form.php b/admin/Library/Form/Form.php new file mode 100755 index 0000000..00e27d4 --- /dev/null +++ b/admin/Library/Form/Form.php @@ -0,0 +1,116 @@ +'value') + public $method = 'POST'; //the transmission method: POST/GET + + public function __construct($action,$submit = array('generalAction'=>'save'),$method = 'POST') + { + $this->action = $action; //action of the form: controller/action + $this->submit = $submit; + $this->method = $method; + } + + //method to manage the $this->entry associative array + //entryType: the type of the object to be initialized, $entryName: the name of the entry + //$options: the list of options (if the entry is a \n\n"; + } + $htmlForm .= "\n"; + return $htmlForm; + } + +} diff --git a/admin/Library/Form/Hidden.php b/admin/Library/Form/Hidden.php new file mode 100755 index 0000000..fb81b30 --- /dev/null +++ b/admin/Library/Form/Hidden.php @@ -0,0 +1,23 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $returnString = Html_Form::hidden($this->entryName, $value); + return $returnString; + } + +} diff --git a/admin/Library/Form/Html.php b/admin/Library/Form/Html.php new file mode 100644 index 0000000..dce91c6 --- /dev/null +++ b/admin/Library/Form/Html.php @@ -0,0 +1,23 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $returnString = "
\n\t$value\n
\n"; + return $returnString; + } + +} diff --git a/admin/Library/Form/InputText.php b/admin/Library/Form/InputText.php new file mode 100755 index 0000000..fb98336 --- /dev/null +++ b/admin/Library/Form/InputText.php @@ -0,0 +1,30 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::input($this->entryName, $value, $this->className, $this->idName); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/admin/Library/Form/Password.php b/admin/Library/Form/Password.php new file mode 100644 index 0000000..76bc735 --- /dev/null +++ b/admin/Library/Form/Password.php @@ -0,0 +1,30 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::password($this->entryName, null, $this->className); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/admin/Library/Form/Radio.php b/admin/Library/Form/Radio.php new file mode 100755 index 0000000..fb20677 --- /dev/null +++ b/admin/Library/Form/Radio.php @@ -0,0 +1,30 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::radio($this->entryName,$value,$this->options,$this->className, 'after', $this->idName); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/admin/Library/Form/Select.php b/admin/Library/Form/Select.php new file mode 100755 index 0000000..558fd57 --- /dev/null +++ b/admin/Library/Form/Select.php @@ -0,0 +1,30 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::select($this->entryName,$value,$this->options,$this->className, $this->idName); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/admin/Library/Form/Textarea.php b/admin/Library/Form/Textarea.php new file mode 100755 index 0000000..d81cc84 --- /dev/null +++ b/admin/Library/Form/Textarea.php @@ -0,0 +1,30 @@ +entryName = $entryName; + } + + public function render($value = null) + { + $wrap = $this->getWrapElements(); + $returnString = "
\n\t"; + $returnString .= $wrap[0]; + $returnString .= $this->getLabelTag(); + $returnString .= $wrap[1]; + $returnString .= Html_Form::textarea($this->entryName, $value, $this->className, $this->idName); + $returnString .= $wrap[2]; + $returnString .="
\n"; + return $returnString; + } + +} diff --git a/admin/Library/Form/index.html b/admin/Library/Form/index.html new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/admin/Library/Form/index.html @@ -0,0 +1 @@ + -- cgit v1.2.3