From 427b25413820eb87e3e519de75bf2a3fa6eb2add Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Mon, 10 Sep 2012 14:06:30 +0300 Subject: [PATCH] refactoring user section: new html formating --- bin/v_list_sys_users | 64 -- web/add/ip/index.php | 2 +- web/add/user/index.php | 1 - web/css/csshover3.htc | 16 +- web/edit/ip/index.php | 2 +- web/edit/user/index.php | 15 - web/inc/main.php | 31 +- web/list/user/index.php | 23 +- web/templates/admin/add_user.html | 198 +++- web/templates/admin/edit_user.html | 287 +++-- web/templates/admin/list_user.html | 448 ++++---- web/templates/admin/menu_add_user.html | 15 - web/templates/admin/menu_edit_user.html | 15 - web/templates/admin/menu_user.html | 43 - web/templates/admin/panel.html | 116 +- web/templates/footer.html | 26 +- web/templates/header.html | 1301 ++++++++++++----------- web/templates/login.html | 2 +- web/templates/user/edit_user.html | 163 ++- web/templates/user/list_user.html | 376 ++++--- web/templates/user/menu_user.html | 10 - web/templates/user/panel.html | 114 +- 22 files changed, 1825 insertions(+), 1443 deletions(-) delete mode 100755 bin/v_list_sys_users delete mode 100644 web/templates/admin/menu_add_user.html delete mode 100644 web/templates/admin/menu_edit_user.html delete mode 100644 web/templates/admin/menu_user.html delete mode 100644 web/templates/user/menu_user.html diff --git a/bin/v_list_sys_users b/bin/v_list_sys_users deleted file mode 100755 index a5f523c9..00000000 --- a/bin/v_list_sys_users +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash -# info: list system users -# options: [format] -# -# The function for obtaining the list of system users. - - -#----------------------------------------------------------# -# Variable&Function # -#----------------------------------------------------------# - -# Argument defenition -format=${1-shell} - -# Includes -source $VESTA/func/main.sh - -# Json function -json_list_users() { - users=$(grep @ /etc/passwd|cut -f 1 -d :) - int_counter=$(echo "$users" | wc -l) - i=1 - echo '[' - for user in $users; do - if [ "$i" -lt "$int_counter" ]; then - echo -e "\t\"$user\"," - else - echo -e "\t\"$user\"" - fi - (( ++i)) - done - echo "]" -} - -# Shell function -shell_list_users() { - if [ -z "$nohead" ]; then - echo "USERS" - echo "----------" - fi - for user in $(grep @ /etc/passwd|cut -f 1 -d :); do - echo "$user" - done -} - - -#----------------------------------------------------------# -# Action # -#----------------------------------------------------------# - -# Listing domains -case $format in - json) json_list_users ;; - plain) nohead=1; shell_list_users ;; - shell) shell_list_users ;; - *) check_args '1' '0' '[format]' ;; -esac - - -#----------------------------------------------------------# -# Vesta # -#----------------------------------------------------------# - -exit diff --git a/web/add/ip/index.php b/web/add/ip/index.php index a4659ed8..0f4207a2 100644 --- a/web/add/ip/index.php +++ b/web/add/ip/index.php @@ -74,7 +74,7 @@ if ($_SESSION['user'] == 'admin') { $interfaces = json_decode(implode('', $output), true); unset($output); - exec (VESTA_CMD."v_list_sys_users 'json'", $output, $return_var); + exec (VESTA_CMD."v_list_users 'json'", $output, $return_var); $users = json_decode(implode('', $output), true); unset($output); diff --git a/web/add/user/index.php b/web/add/user/index.php index b4d0f44e..7fee600e 100644 --- a/web/add/user/index.php +++ b/web/add/user/index.php @@ -87,7 +87,6 @@ if ($_SESSION['user'] == 'admin') { $data = json_decode(implode('', $output), true); unset($output); - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_add_user.html'); include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/add_user.html'); unset($_SESSION['error_msg']); unset($_SESSION['ok_msg']); diff --git a/web/css/csshover3.htc b/web/css/csshover3.htc index 7e5c57b3..1c368895 100644 --- a/web/css/csshover3.htc +++ b/web/css/csshover3.htc @@ -1,12 +1,14 @@ diff --git a/web/edit/ip/index.php b/web/edit/ip/index.php index b780e470..0f2e52fb 100644 --- a/web/edit/ip/index.php +++ b/web/edit/ip/index.php @@ -48,7 +48,7 @@ if ($_SESSION['user'] == 'admin') { $v_status = 'active'; } - exec (VESTA_CMD."v_list_sys_users 'json'", $output, $return_var); + exec (VESTA_CMD."v_list_users 'json'", $output, $return_var); $users = json_decode(implode('', $output), true); unset($output); diff --git a/web/edit/user/index.php b/web/edit/user/index.php index 3468fce8..5c457d41 100644 --- a/web/edit/user/index.php +++ b/web/edit/user/index.php @@ -168,7 +168,6 @@ if ($_SESSION['user'] == 'admin') { $_SESSION['ok_msg'] = "OK: changes has been saved."; } } - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_user.html'); include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/edit_user.html'); unset($_SESSION['error_msg']); unset($_SESSION['ok_msg']); @@ -240,19 +239,6 @@ if ($_SESSION['user'] == 'admin') { unset($output); } - // Change Name - if (($v_fname != $_POST['v_fname']) || ($v_lname != $_POST['v_lname']) && (empty($_SESSION['error_msg']))) { - $v_fname = escapeshellarg($_POST['v_fname']); - $v_lname = escapeshellarg($_POST['v_lname']); - exec (VESTA_CMD."v_change_user_name ".$v_username." ".$v_fname." ".$v_lname, $output, $return_var); - if ($return_var != 0) { - $error = implode('
', $output); - if (empty($error)) $error = 'Error: vesta did not return any output.'; - $_SESSION['error_msg'] = $error; - } - unset($output); - } - // Change NameServers if (($v_ns1 != $_POST['v_ns1']) || ($v_ns2 != $_POST['v_ns2']) || ($v_ns3 != $_POST['v_ns3']) || ($v_ns4 != $_POST['v_ns4']) && (empty($_SESSION['error_msg']))) { $v_ns1 = escapeshellarg($_POST['v_ns1']); @@ -275,7 +261,6 @@ if ($_SESSION['user'] == 'admin') { $_SESSION['ok_msg'] = "OK: changes has been saved."; } } - include($_SERVER['DOCUMENT_ROOT'].'/templates/admin/menu_edit_user.html'); include($_SERVER['DOCUMENT_ROOT'].'/templates/user/edit_user.html'); unset($_SESSION['error_msg']); unset($_SESSION['ok_msg']); diff --git a/web/inc/main.php b/web/inc/main.php index ae9538ac..677a88f9 100644 --- a/web/inc/main.php +++ b/web/inc/main.php @@ -62,17 +62,17 @@ function humanize_usage($usage) { if ( $usage > 1000 ) { $usage = $usage / 1000 ; $usage = number_format($usage, 2); - $usage = $usage." Pb"; + $usage = $usage." pb"; } else { $usage = number_format($usage, 2); - $usage = $usage." Tb"; + $usage = $usage." tb"; } } else { $usage = number_format($usage, 2); - $usage = $usage." Gb"; + $usage = $usage." gb"; } } else { - $usage = $usage." Mb"; + $usage = $usage." mb"; } return $usage; } @@ -114,4 +114,27 @@ function send_email($to,$subject,$mailtext,$from) { mail($to, $subject, $message, $header); } +function display_error_block() { + if (!empty($_SESSION['error_msg'])) { + echo ' + +
+

'; + echo $_SESSION['error_msg']; + echo "

\n
\n"; + unset($_SESSION['error_msg']); + } +} ?> diff --git a/web/list/user/index.php b/web/list/user/index.php index 79dcf385..9e532d76 100644 --- a/web/list/user/index.php +++ b/web/list/user/index.php @@ -1,8 +1,11 @@ -function randomString() { -var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz"; -var string_length = 10; -var randomstring = ''; -for (var i=0; i - - - - - -
- - -
-
- - -
- - - - - - - - - - - - -
Username
- Password generate
-
Email
Package
Frist Name
Last Name
Send login credentials to the user's email address
>
- - - -
-
+ + + + + + + + + +
+ + + + + + + +
+ + +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Username +
+ + Password generate +
+ +
+ Email +
+ + Package +
+ +
+ Frist Name +
+ + Last Name +
+ + Send login credentials to the user's email address +
+ > +
+ + +
+
+
diff --git a/web/templates/admin/edit_user.html b/web/templates/admin/edit_user.html index d3c64c27..4f8ea0a0 100644 --- a/web/templates/admin/edit_user.html +++ b/web/templates/admin/edit_user.html @@ -1,94 +1,199 @@ - - - - - + +
- - - - -
-
- - -
-
- - - - - - - - - - +
Username
- Password generate
Email
Package
Frist Name
Last Name
Default Template
+ + + + +
- Shell - - Default Name Servers - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Username +
+ + Password generate +
+ + Email +
+ + Package +
+ +
+ Frist Name +
+ + Last Name +
+ + Default Template +
+ +
+ Shell +
+ +
+ Default Name Servers +
+ + + +
+ + + + diff --git a/web/templates/admin/list_user.html b/web/templates/admin/list_user.html index eb28bdaa..ea1b7a24 100644 --- a/web/templates/admin/list_user.html +++ b/web/templates/admin/list_user.html @@ -1,194 +1,282 @@ - - $value) { - ++$i; - if ($data[$key]['SUSPENDED'] == 'yes') { - $status = 'suspended'; - $spnd_action = 'unsuspend' ; - } else { - $status = 'active'; - $spnd_action = 'suspend' ; - } - ?> - - - -
- - - - -
">
-
- - - + + + login as"; - } - ?> - - - - -
- logout"; - if (!empty($_SESSION['look_alert'])) { - ?> -
-

You have logged in as user .

-
+ +
+ + + + +
">
+
+ + + + + + + + +
+ logout"; + if (!empty($_SESSION['look_alert'])) { + ?> + +
+

You have logged in as user .

+
+ login as"; + } + ?> +
"> edit + + +
+

Are you sure you want to user account?

+
+
+ + delete +
+

Are you sure you want to delete user account?

+
+
+ + + + + + + + + + +
+ + + + + + + + + + + + +
[] package
Bandwidth: % () +
+
+
+
Disk: % () +
+
+
+
+ + + + + +
+ Web:
+ Mail:
+
+ Databases:
+ User Dirs:
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Template:
Web Domains: /
Web SSL:
Web Aliases: per domain
Dns Domains: /
Dns Records: per domain
Name Servers:
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Mail Domains: /
Mail Accounts: per domain
Databases: /
Cron Jobs: /
Shell:
Dedicated IP:
Backups: /
+
+
"> edit - - -
-

Are you sure you want to user account?

-
-
- - delete -
-

Are you sure you want to delete user account?

-
-
+ } + ?> +
- - - - - - -
- - - - - - - -
[] package
Bandwidth: % () -
Disk: % () -
- - -
- Web:
- Mail:
-
- Databases:
- User Dirs:
-
-
- - - - - - - - - - - - - - - -
Template:
Web Domains: /
Web SSL:
Web Aliases: per domain
Dns Domains: /
Dns Records: per domain
Name Servers:
- - - - - - - - - - - - - - - -
Mail Domains: /
Mail Accounts: per domain
Databases: /
Cron Jobs: /
Shell:
Dedicated IP:
Backups: /
-
- - + "; ?> - + + + + + +
+ +
+ - -"; ?> - - - - -
→ - -
- -"; ?> + "; ?> diff --git a/web/templates/admin/menu_add_user.html b/web/templates/admin/menu_add_user.html deleted file mode 100644 index 69d23bbe..00000000 --- a/web/templates/admin/menu_add_user.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - diff --git a/web/templates/admin/menu_edit_user.html b/web/templates/admin/menu_edit_user.html deleted file mode 100644 index dd5c9b46..00000000 --- a/web/templates/admin/menu_edit_user.html +++ /dev/null @@ -1,15 +0,0 @@ - - - - - diff --git a/web/templates/admin/menu_user.html b/web/templates/admin/menu_user.html deleted file mode 100644 index 3e25540b..00000000 --- a/web/templates/admin/menu_user.html +++ /dev/null @@ -1,43 +0,0 @@ - - -
-

.

-
- - - - - - - - - - -
diff --git a/web/templates/admin/panel.html b/web/templates/admin/panel.html index 4c961eac..a2efc498 100644 --- a/web/templates/admin/panel.html +++ b/web/templates/admin/panel.html @@ -1,47 +1,69 @@ - - -
- - - - - - - - - - - -

Packages IP Adresses RRD GraphicsStatisticsHistory LogLog out
- - - - - - + + + + + + + + + + +
PackagesIP AdressesRRD GraphicsStatisticsHistory LogLog out
+ + + + + + + + + + + + diff --git a/web/templates/footer.html b/web/templates/footer.html index 2705b571..caf828f8 100644 --- a/web/templates/footer.html +++ b/web/templates/footer.html @@ -1,13 +1,15 @@ - - - - - - -
Powered by Vesta Control Panel
vestacp.com
-
- - + + + + + + + + +
Powered by Vesta Control Panel
vestacp.com
+ + + + + diff --git a/web/templates/header.html b/web/templates/header.html index d5185a53..2537256a 100644 --- a/web/templates/header.html +++ b/web/templates/header.html @@ -1,625 +1,678 @@ - - - Vesta - <?php echo "$TAB"; ?> - - - - - - - -
+ + + Vesta - <?php echo "$TAB"; ?> + + + + + + + + +
+ + +
+ + +
diff --git a/web/templates/login.html b/web/templates/login.html index ef4db9eb..e236482b 100644 --- a/web/templates/login.html +++ b/web/templates/login.html @@ -1,5 +1,5 @@ - VestaCP - Login + Vesta - Login