Update generation of unlimited fields
Signed-off-by: Roman Schmerold (BNoiZe) <bnoize@froxlor.org>
This commit is contained in:
@@ -29,7 +29,7 @@ class HTMLform2 {
|
|||||||
* @param array $data (default: array())
|
* @param array $data (default: array())
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function genHTMLform($formdata = array(), $data = array()) {
|
public static function genHTMLform($formdata = array(), $data = false) {
|
||||||
global $lng, $theme;
|
global $lng, $theme;
|
||||||
self::$_form = '';
|
self::$_form = '';
|
||||||
|
|
||||||
@@ -47,9 +47,9 @@ class HTMLform2 {
|
|||||||
if (isset($fielddata['visible'])) {
|
if (isset($fielddata['visible'])) {
|
||||||
if ($fielddata['visible'] == false) {
|
if ($fielddata['visible'] == false) {
|
||||||
continue;
|
continue;
|
||||||
} elseif ($fielddata['visible'] === 'new' && !empty($data)) {
|
} elseif ($fielddata['visible'] === 'new' && is_array($data)) {
|
||||||
continue;
|
continue;
|
||||||
} elseif ($fielddata['visible'] === 'edit' && empty($data)) {
|
} elseif ($fielddata['visible'] === 'edit' && !is_array($data)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,25 +263,26 @@ class HTMLform2 {
|
|||||||
global $lng;
|
global $lng;
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
$inputdata = $fielddata;
|
$attributes_input = self::_parseAttributes($fieldname, $fielddata);
|
||||||
$inputdata['value'] = ($inputdata['value'] == -1) ? '' : $inputdata['value'];
|
$attributes_input['type'] = "text";
|
||||||
$inputdata['type'] = "text";
|
$attributes_input['value'] = ($fielddata['value'] == '-1') ? '' : $fielddata['value'];
|
||||||
$input = self::_input($fieldname, $inputdata);
|
$attributes_input = self::_glueAttributes($attributes_input);
|
||||||
|
|
||||||
// Checkbox
|
// Checkbox
|
||||||
$checkboxdata = array(
|
$checkboxdata = array(
|
||||||
//'label' => $lng['admin']['stdsubdomain_add'].'?',
|
|
||||||
'type' => 'checkbox',
|
|
||||||
'label' => $lng['customer']['unlimited'],
|
'label' => $lng['customer']['unlimited'],
|
||||||
|
'type' => 'checkbox',
|
||||||
'value' => '-1',
|
'value' => '-1',
|
||||||
'attributes' => array(
|
'attributes' => array(
|
||||||
'checked' => ($fielddata['value'] == '-1') ? true : false
|
'checked' => ($fielddata['value'] == '-1') ? true : false
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$attributes_checkbox = self::_parseAttributes($fieldname . "_ul", $checkboxdata);
|
||||||
|
$attributes_checkbox['type'] = $checkboxdata['type'];
|
||||||
|
$attributes_checkbox = self::_glueAttributes($attributes_checkbox);
|
||||||
|
$label_checkbox = $checkboxdata['label'];
|
||||||
|
|
||||||
$checkbox = self::_inputCheckbox($fieldname . "_ul", $checkboxdata, false);
|
eval("\$return = \"" . getTemplate("htmlform/inputul", "1") . "\";");
|
||||||
|
|
||||||
eval("\$return = \"" . getTemplate("htmlform/textul", "1") . "\";");
|
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|||||||
1
templates/Sparkle/htmlform/inputul.tpl
vendored
Normal file
1
templates/Sparkle/htmlform/inputul.tpl
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<input {$attributes_input} /> <label><input {$attributes_checkbox} />{$label_checkbox}</label>
|
||||||
1
templates/Sparkle/htmlform/textul.tpl
vendored
1
templates/Sparkle/htmlform/textul.tpl
vendored
@@ -1 +0,0 @@
|
|||||||
{$input} {$checkbox}
|
|
||||||
Reference in New Issue
Block a user