Updated HTMLform2 with some tweaks

Signed-off-by: Roman Schmerold (BNoiZe) <bnoize@froxlor.org>
This commit is contained in:
Roman Schmerold (BNoiZe)
2015-02-03 21:32:23 +01:00
parent a5d041926a
commit 4fccc86b03
6 changed files with 26 additions and 8 deletions

View File

@@ -67,7 +67,16 @@ class HTMLform2 {
} else { } else {
$desc = ''; $desc = '';
} }
eval("self::\$_form .= \"" . getTemplate("htmlform/skeleton", "1") . "\";");
switch($fielddata['type']) {
case 'checkbox':
eval("self::\$_form .= \"" . getTemplate("htmlform/skeleton_checkbox", "1") . "\";");
break;
default:
eval("self::\$_form .= \"" . getTemplate("htmlform/skeleton", "1") . "\";");
break;
}
} }
} }
} }
@@ -263,14 +272,14 @@ class HTMLform2 {
$checkboxdata = array( $checkboxdata = array(
//'label' => $lng['admin']['stdsubdomain_add'].'?', //'label' => $lng['admin']['stdsubdomain_add'].'?',
'type' => 'checkbox', 'type' => 'checkbox',
'sublabel' => $lng['customer']['unlimited'], 'label' => $lng['customer']['unlimited'],
'value' => '-1', 'value' => '-1',
'attributes' => array( 'attributes' => array(
'checked' => ($fielddata['value'] == '-1') ? true : false 'checked' => ($fielddata['value'] == '-1') ? true : false
) )
); );
$checkbox = self::_inputCheckbox($fieldname . "_ul", $checkboxdata); $checkbox = self::_inputCheckbox($fieldname . "_ul", $checkboxdata, false);
eval("\$return = \"" . getTemplate("htmlform/textul", "1") . "\";"); eval("\$return = \"" . getTemplate("htmlform/textul", "1") . "\";");
@@ -306,12 +315,12 @@ class HTMLform2 {
* @param array $fielddata (default: array()) * @param array $fielddata (default: array())
* @return void * @return void
*/ */
private static function _inputCheckbox($fieldname, $fielddata = array()) { private static function _inputCheckbox($fieldname, $fielddata = array(), $labelHidden = true) {
$attributes = self::_parseAttributes($fieldname, $fielddata); $attributes = self::_parseAttributes($fieldname, $fielddata);
$attributes['type'] = $fielddata['type']; $attributes['type'] = $fielddata['type'];
$attributes = self::_glueAttributes($attributes); $attributes = self::_glueAttributes($attributes);
$sublabel = $fielddata['sublabel']; $label = $fielddata['label'];
eval("\$return = \"" . getTemplate("htmlform/checkbox", "1") . "\";"); eval("\$return = \"" . getTemplate("htmlform/checkbox", "1") . "\";");
return $return; return $return;
} }

View File

@@ -22,7 +22,8 @@ return array(
'loginname' => array( 'loginname' => array(
'label' => $lng['login']['username'], 'label' => $lng['login']['username'],
'type' => (isset($result['loginname'])) ? 'static' : 'text', 'type' => (isset($result['loginname'])) ? 'static' : 'text',
'mandatory' => true, ), 'mandatory' => true,
),
'deactivated' => array( 'deactivated' => array(
'label' => $lng['admin']['deactivated_user'], 'label' => $lng['admin']['deactivated_user'],
'type' => 'checkbox', 'type' => 'checkbox',

View File

@@ -26,6 +26,7 @@ return array(
'label' => $lng['mysql']['mysql_server'], 'label' => $lng['mysql']['mysql_server'],
'type' => (isset($result)) ? 'select' : 'text', 'type' => (isset($result)) ? 'select' : 'text',
'visible' => (1 < $count_mysqlservers ? true : false), 'visible' => (1 < $count_mysqlservers ? true : false),
), ),
'mysql_password' => array( 'mysql_password' => array(
'label' => $lng['login']['password'], 'label' => $lng['login']['password'],
@@ -39,6 +40,9 @@ return array(
'type' => 'text', 'type' => 'text',
'visible' => (Settings::Get('panel.password_regex') == ''), 'visible' => (Settings::Get('panel.password_regex') == ''),
'value' => generatePassword(), 'value' => generatePassword(),
'attributes' => array(
'readonly' => true
)
), ),
'sendinfomail' => array( 'sendinfomail' => array(
'label' => $lng['customer']['sendinfomail'], 'label' => $lng['customer']['sendinfomail'],

View File

@@ -2,7 +2,7 @@ $header
<article> <article>
<header> <header>
<h2> <h2>
<img src="templates/{$theme}/assets/img/icons/user_edit_big.png" alt="{$title}" />&nbsp; <img src="templates/{$theme}/assets/img/icons/user_edit_big.png" />&nbsp;
{$lng['admin']['customer_edit']} {$lng['admin']['customer_edit']}
</h2> </h2>
</header> </header>

View File

@@ -1 +1 @@
<input {$attributes} />{$sublabel} <label><input {$attributes} /><if $labelHidden == false>{$label}</if></label>

View File

@@ -0,0 +1,4 @@
<tr>
<td><label for="{$fieldname}">{$label}</label><if $desc != ''><br /><small>{$desc}</small></if></td>
<td>{$field}</td>
</tr>