From 8cb615df5fdb1d6756fc9ebe80926f53b62b3e24 Mon Sep 17 00:00:00 2001 From: "Florian Aders (EleRas)" Date: Sat, 12 Feb 2011 15:15:55 +0100 Subject: [PATCH 1/2] Converted customer -> mysql to new formbuilder --- customer_mysql.php | 12 +++++ lib/.gitignore | 1 + .../customer/mysql/formfield.mysql_add.php | 49 ++++++++++++++++++ .../customer/mysql/formfield.mysql_edit.php | 50 +++++++++++++++++++ .../Froxlor/customer/mysql/mysqls_add.tpl | 49 ++++++------------ .../Froxlor/customer/mysql/mysqls_edit.tpl | 48 ++++++------------ 6 files changed, 142 insertions(+), 67 deletions(-) create mode 100644 lib/.gitignore create mode 100644 lib/formfields/customer/mysql/formfield.mysql_add.php create mode 100644 lib/formfields/customer/mysql/formfield.mysql_edit.php diff --git a/customer_mysql.php b/customer_mysql.php index 4e5e56c4..e5b9d16c 100644 --- a/customer_mysql.php +++ b/customer_mysql.php @@ -256,6 +256,12 @@ elseif($page == 'mysqls') $sendinfomail = makeyesno('sendinfomail', '1', '0', '0'); + $mysql_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_add.php'; + $mysql_add_form = htmlform::genHTMLForm($mysql_add_data); + + $title = $mysql_add_data['mysql_add']['title']; + $image = $mysql_add_data['mysql_add']['image']; + eval("echo \"" . getTemplate("mysql/mysqls_add") . "\";"); } } @@ -307,6 +313,12 @@ elseif($page == 'mysqls') } else { + $mysql_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/mysql/formfield.mysql_edit.php'; + $mysql_edit_form = htmlform::genHTMLForm($mysql_edit_data); + + $title = $mysql_edit_data['mysql_edit']['title']; + $image = $mysql_edit_data['mysql_edit']['image']; + eval("echo \"" . getTemplate("mysql/mysqls_edit") . "\";"); } } diff --git a/lib/.gitignore b/lib/.gitignore new file mode 100644 index 00000000..015be9fe --- /dev/null +++ b/lib/.gitignore @@ -0,0 +1 @@ +userdata.inc.php diff --git a/lib/formfields/customer/mysql/formfield.mysql_add.php b/lib/formfields/customer/mysql/formfield.mysql_add.php new file mode 100644 index 00000000..adb166fb --- /dev/null +++ b/lib/formfields/customer/mysql/formfield.mysql_add.php @@ -0,0 +1,49 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Formfields + */ + +return array( + 'mysql_add' => array( + 'title' => $lng['mysql']['database_create'], + 'image' => 'icons/mysql_add.png', + 'sections' => array( + 'section_a' => array( + 'title' => $lng['mysql']['database_create'], + 'image' => 'icons/mysql_add.png', + 'fields' => array( + 'description' => array( + 'label' => $lng['mysql']['databasedescription'], + 'type' => 'text', + ), + 'mysql_server' => array( + 'visible' => (1 < count($sql_root) ? true : false), + 'label' => $lng['mysql']['mysql_server'], + 'type' => 'select', + 'select_var' => $mysql_servers, + ), + 'mysql_password' => array( + 'label' => $lng['login']['password'], + 'type' => 'password', + ), + 'sendinfomail' => array( + 'label' => $lng['customer']['sendinfomail'], + 'type' => 'yesno', + 'yesno_var' => $sendinfomail, + ) + ) + ) + ) + ) +); diff --git a/lib/formfields/customer/mysql/formfield.mysql_edit.php b/lib/formfields/customer/mysql/formfield.mysql_edit.php new file mode 100644 index 00000000..bd812fae --- /dev/null +++ b/lib/formfields/customer/mysql/formfield.mysql_edit.php @@ -0,0 +1,50 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Formfields + */ + +return array( + 'mysql_edit' => array( + 'title' => $lng['mysql']['database_edit'], + 'image' => 'icons/mysql_edit.png', + 'sections' => array( + 'section_a' => array( + 'title' => $lng['mysql']['database_edit'], + 'image' => 'icons/mysql_edit.png', + 'fields' => array( + 'databasename' => array( + 'label' => $lng['mysql']['databasename'], + 'type' => 'label', + 'value' => $result['databasename'], + ), + 'description' => array( + 'label' => $lng['mysql']['databasedescription'], + 'type' => 'text', + 'value' => $result['description'], + ), + 'mysql_server' => array( + 'visible' => (1 < count($sql_root) ? true : false), + 'label' => $lng['mysql']['mysql_server'], + 'type' => 'label', + 'value' => $sql_root[$result['dbserver']]['caption'] + ), + 'mysql_password' => array( + 'label' => $lng['changepassword']['new_password_ifnotempty'], + 'type' => 'password', + ), + ) + ) + ) + ) +); diff --git a/templates/Froxlor/customer/mysql/mysqls_add.tpl b/templates/Froxlor/customer/mysql/mysqls_add.tpl index 309882ce..c1168dae 100644 --- a/templates/Froxlor/customer/mysql/mysqls_add.tpl +++ b/templates/Froxlor/customer/mysql/mysqls_add.tpl @@ -1,43 +1,23 @@ $header -
-
-

- {$lng['mysql']['database_create']}  - {$lng['mysql']['database_create']} -

-
- -
+
+
+

+ {$title}  + {$title} +

+
+ +
- Froxlor - {$lng['mysql']['database_create']} + Froxlor - {$title} - - - - - - - - - - - - - - - - - - - - - + {$mysql_add_form}
{$lng['mysql']['databasedescription']}:
{$lng['mysql']['mysql_server']}:
{$lng['login']['password']}:
{$lng['customer']['sendinfomail']}:{$sendinfomail}
-

+

@@ -45,6 +25,7 @@ $header

-
-
+ +
+
$footer diff --git a/templates/Froxlor/customer/mysql/mysqls_edit.tpl b/templates/Froxlor/customer/mysql/mysqls_edit.tpl index 2a93c9f5..a5426538 100644 --- a/templates/Froxlor/customer/mysql/mysqls_edit.tpl +++ b/templates/Froxlor/customer/mysql/mysqls_edit.tpl @@ -1,50 +1,32 @@ $header -
-
-

- {$lng['mysql']['database_edit']}  - {$lng['mysql']['database_edit']} -

-
- -
+
+
+

+ {$title}  + {$title} +

+
+ +
- Froxlor - {$lng['mysql']['database_edit']} + Froxlor - {$title} - - - - - - - - - - - - - - - - - - - - - + {$mysql_edit_form}
{$lng['mysql']['databasename']}:{$result['databasename']}
{$lng['mysql']['databasedescription']}:
{$lng['mysql']['mysql_server']}:{$sql_root[$result['dbserver']]['caption']}
{$lng['changepassword']['new_password_ifnotempty']}:

+

-
-
+ +
+
$footer From 26aed64bf82f2d4d9c89199fdf451cb4ab266bd0 Mon Sep 17 00:00:00 2001 From: "Florian Aders (EleRas)" Date: Sat, 12 Feb 2011 16:08:05 +0100 Subject: [PATCH 2/2] Converted customer -> ftp to new formbuilder Signed-off-by: Florian Aders (EleRas) --- customer_ftp.php | 14 ++++- .../customer/ftp/formfield.ftp_add.php | 56 ++++++++++++++++++ .../customer/ftp/formfield.ftp_edit.php | 57 +++++++++++++++++++ .../customer/mysql/formfield.mysql_add.php | 4 +- .../customer/mysql/formfield.mysql_edit.php | 4 +- .../Froxlor/customer/ftp/accounts_add.tpl | 51 +++++------------ .../Froxlor/customer/ftp/accounts_edit.tpl | 51 +++++------------ 7 files changed, 158 insertions(+), 79 deletions(-) create mode 100644 lib/formfields/customer/ftp/formfield.ftp_add.php create mode 100644 lib/formfields/customer/ftp/formfield.ftp_edit.php diff --git a/customer_ftp.php b/customer_ftp.php index bc591acf..207fb60d 100644 --- a/customer_ftp.php +++ b/customer_ftp.php @@ -270,6 +270,12 @@ elseif($page == 'accounts') $sendinfomail = makeyesno('sendinfomail', '1', '0', '0'); + $ftp_add_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_add.php'; + $ftp_add_form = htmlform::genHTMLForm($ftp_add_data); + + $title = $ftp_add_data['ftp_add']['title']; + $image = $ftp_add_data['ftp_add']['image']; + eval("echo \"" . getTemplate("ftp/accounts_add") . "\";"); } } @@ -352,7 +358,13 @@ elseif($page == 'accounts') $domains.= makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']); } } - + + $ftp_edit_data = include_once dirname(__FILE__).'/lib/formfields/customer/ftp/formfield.ftp_edit.php'; + $ftp_edit_form = htmlform::genHTMLForm($ftp_edit_data); + + $title = $ftp_edit_data['ftp_edit']['title']; + $image = $ftp_edit_data['ftp_edit']['image']; + eval("echo \"" . getTemplate("ftp/accounts_edit") . "\";"); } } diff --git a/lib/formfields/customer/ftp/formfield.ftp_add.php b/lib/formfields/customer/ftp/formfield.ftp_add.php new file mode 100644 index 00000000..a020cef3 --- /dev/null +++ b/lib/formfields/customer/ftp/formfield.ftp_add.php @@ -0,0 +1,56 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Formfields + */ + +return array( + 'ftp_add' => array( + 'title' => $lng['ftp']['account_add'], + 'image' => 'icons/add_user.png', + 'sections' => array( + 'section_a' => array( + 'title' => $lng['ftp']['account_add'], + 'image' => 'icons/add_user.png', + 'fields' => array( + 'ftp_username' => array( + 'visible' => ($settings['customer']['ftpatdomain'] == '1' ? true : false), + 'label' => $lng['login']['username'], + 'type' => 'text' + ), + 'ftp_domain' => array( + 'visible' => ($settings['customer']['ftpatdomain'] == '1' ? true : false), + 'label' => $lng['domains']['domainname'], + 'type' => 'select', + 'select_var' => (isset($domains) ? $domains : ""), + ), + 'path' => array( + 'label' => $lng['panel']['path'], + 'desc' => ($settings['panel']['pathedit'] != 'Dropdown' ? $lng['panel']['pathDescription'] : null), + 'type' => ($settings['panel']['pathedit'] != 'Dropdown' ? 'text' : 'select'), + 'select_var' => $pathSelect, + ), + 'ftp_password' => array( + 'label' => $lng['login']['password'], + 'type' => 'password', + ), + 'sendinfomail' => array( + 'label' => $lng['customer']['sendinfomail'], + 'type' => 'yesno', + 'yesno_var' => $sendinfomail, + ), + ) + ) + ) + ) +); diff --git a/lib/formfields/customer/ftp/formfield.ftp_edit.php b/lib/formfields/customer/ftp/formfield.ftp_edit.php new file mode 100644 index 00000000..c7054516 --- /dev/null +++ b/lib/formfields/customer/ftp/formfield.ftp_edit.php @@ -0,0 +1,57 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Formfields + */ + +return array( + 'ftp_edit' => array( + 'title' => $lng['ftp']['account_edit'], + 'image' => 'icons/edit_user.png', + 'sections' => array( + 'section_a' => array( + 'title' => $lng['ftp']['account_edit'], + 'image' => 'icons/edit_user.png', + 'fields' => array( + 'username' => array( + 'label' => $lng['login']['username'], + 'type' => 'label', + 'value' => $result['username'], + ), + 'ftp_username' => array( + 'visible' => ($settings['customer']['ftpatdomain'] == '1' ? true : false), + 'label' => $lng['login']['username'], + 'type' => 'text' + ), + 'ftp_domain' => array( + 'visible' => ($settings['customer']['ftpatdomain'] == '1' ? true : false), + 'label' => $lng['domains']['domainname'], + 'type' => 'select', + 'select_var' => (isset($domains) ? $domains : ""), + ), + 'path' => array( + 'label' => $lng['panel']['path'], + 'desc' => ($settings['panel']['pathedit'] != 'Dropdown' ? $lng['panel']['pathDescription'] : NULL), + 'type' => ($settings['panel']['pathedit'] != 'Dropdown' ? 'text' : 'select'), + 'select_var' => $pathSelect + ), + 'ftp_password' => array( + 'label' => $lng['login']['password'], + 'desc' => $lng['ftp']['editpassdescription'], + 'type' => 'password', + ), + ) + ) + ) + ) +); diff --git a/lib/formfields/customer/mysql/formfield.mysql_add.php b/lib/formfields/customer/mysql/formfield.mysql_add.php index adb166fb..efa46b91 100644 --- a/lib/formfields/customer/mysql/formfield.mysql_add.php +++ b/lib/formfields/customer/mysql/formfield.mysql_add.php @@ -17,11 +17,11 @@ return array( 'mysql_add' => array( 'title' => $lng['mysql']['database_create'], - 'image' => 'icons/mysql_add.png', + 'image' => 'icons/add_mysql.png', 'sections' => array( 'section_a' => array( 'title' => $lng['mysql']['database_create'], - 'image' => 'icons/mysql_add.png', + 'image' => 'icons/add_mysql.png', 'fields' => array( 'description' => array( 'label' => $lng['mysql']['databasedescription'], diff --git a/lib/formfields/customer/mysql/formfield.mysql_edit.php b/lib/formfields/customer/mysql/formfield.mysql_edit.php index bd812fae..617a1c03 100644 --- a/lib/formfields/customer/mysql/formfield.mysql_edit.php +++ b/lib/formfields/customer/mysql/formfield.mysql_edit.php @@ -17,11 +17,11 @@ return array( 'mysql_edit' => array( 'title' => $lng['mysql']['database_edit'], - 'image' => 'icons/mysql_edit.png', + 'image' => 'icons/edit_mysql.png', 'sections' => array( 'section_a' => array( 'title' => $lng['mysql']['database_edit'], - 'image' => 'icons/mysql_edit.png', + 'image' => 'icons/edit_mysql.png', 'fields' => array( 'databasename' => array( 'label' => $lng['mysql']['databasename'], diff --git a/templates/Froxlor/customer/ftp/accounts_add.tpl b/templates/Froxlor/customer/ftp/accounts_add.tpl index 3b16c280..92444d4c 100644 --- a/templates/Froxlor/customer/ftp/accounts_add.tpl +++ b/templates/Froxlor/customer/ftp/accounts_add.tpl @@ -1,44 +1,20 @@ $header -
-
-

- {$lng['ftp']['account_add']}  - {$lng['ftp']['account_add']} -

-
- -
+
+
+

+ {$title}  + {$title} +

+
+ +
- Froxlor - {$lng['ftp']['account_add']} + Froxlor - {$title} - - - - - - - - - - - - - - - - - - - - - - - - - + {$ftp_add_form}
{$lng['login']['username']}:
{$lng['domains']['domainname']}:
{$lng['panel']['path']}:
{$lng['panel']['pathDescription']}
{$pathSelect}
{$lng['login']['password']}:
{$lng['customer']['sendinfomail']}:{$sendinfomail}

@@ -49,6 +25,7 @@ $header

-
-
+ +
+
$footer diff --git a/templates/Froxlor/customer/ftp/accounts_edit.tpl b/templates/Froxlor/customer/ftp/accounts_edit.tpl index 336f3956..9b21bc48 100644 --- a/templates/Froxlor/customer/ftp/accounts_edit.tpl +++ b/templates/Froxlor/customer/ftp/accounts_edit.tpl @@ -1,44 +1,20 @@ $header -
-
-

- {$lng['ftp']['account_edit']}  - {$lng['ftp']['account_edit']} -

-
- -
+
+
+

+ {$title}  + {$title} +

+
+ +
- Froxlor - {$lng['ftp']['account_edit']} + Froxlor - {$title} - - - - - - - - - - - - - - - - - - - - - - - - - + {$ftp_edit_form}
{$lng['login']['username']}:{$result['username']}
{$lng['login']['username']}:
{$lng['domains']['domainname']}:
{$lng['panel']['path']}:
{$lng['panel']['pathDescription']}
{$pathSelect}
{$lng['login']['password']}:
{$lng['ftp']['editpassdescription']}

@@ -49,6 +25,7 @@ $header

-
-
+ +
+
$footer