diff --git a/web/index.html b/web/index.html index dc68fd25..f32a88a6 100644 --- a/web/index.html +++ b/web/index.html @@ -53,7 +53,6 @@

Vesta panel  

@@ -68,8 +67,8 @@  
- 0 users - 0 blocked + 0 users + 0 blocked
@@ -84,9 +83,8 @@  
- 0 users - 0 blocked - 3 waiting + 0 web domains + 0 blocked
@@ -99,9 +97,7 @@  
- 0 users - 0 blocked - 3 waiting + 0 mails
@@ -114,9 +110,8 @@  
- 0 users - 0 blocked - 3 waiting + 0 databases + 0 blocked
@@ -142,9 +137,8 @@  
- 0 users - 0 blocked - 3 waiting + 0 ip entries + 0 blocked
@@ -157,9 +151,8 @@  
- 0 users - 0 blocked - 3 waiting + 0 cron records + 0 blocked
diff --git a/web/js/helpers.js b/web/js/helpers.js index ae620fb9..00d33379 100644 --- a/web/js/helpers.js +++ b/web/js/helpers.js @@ -70,13 +70,21 @@ App.Helpers.getFirstKey = function(obj) App.Helpers.updateInitial = function() { // TODO: need api method - $.each(App.Env.initialParams, function(key) { - var item = App.Env.initialParams[key]; - $.each(item, function (i, o) { - if (i.indexOf('total_') != -1) { - App.View.updateInitialInfo(i, o); + $.each(App.Env.initialParams.totals, function(key) { + var item = App.Env.initialParams.totals[key]; + var expr_id = '#'+key; + if ('undefined' != typeof item.total) { + var ref = $(expr_id).find('.num-total'); + if (ref.length > 0) { + $(ref).html(item.total); } - }); + } + if ('undefined' != typeof item.blocked) { + var ref = $(expr_id).find('.num-blocked'); + if (ref.length > 0) { + $(ref).html(item.blocked); + } + } }); } diff --git a/web/js/html.js b/web/js/html.js index 7a432eb9..51e8c107 100644 --- a/web/js/html.js +++ b/web/js/html.js @@ -366,7 +366,7 @@ App.HTML.Build.cron_form = function(options, id) } var tpl = App.Templates.get('FORM', 'cron'); tpl.set(':source', options); - + tpl.set(':id', id || ''); options = App.Helpers.evalJSON(options) || {}; if (App.Helpers.isEmpty(options)) { tpl.set(':title', 'New cron entry'); diff --git a/web/js/pages.js b/web/js/pages.js index 26aff088..63089ff5 100644 --- a/web/js/pages.js +++ b/web/js/pages.js @@ -1,7 +1,7 @@ App.Pages.init = function(){ App.Ajax.request('MAIN.getInitial', {}, function(reply){ App.Env.initialParams = reply.data; - //App.Helpers.updateInitial(); + App.Helpers.updateInitial(); }); App.Pages.prepareHTML(); diff --git a/web/js/templates.js b/web/js/templates.js index f9cf32a4..a8101200 100644 --- a/web/js/templates.js +++ b/web/js/templates.js @@ -763,7 +763,7 @@ App.Templates.html = { '] }, cron: { - FORM: ['
\ + FORM: ['
\ \ \
~!:title~!
\ @@ -810,10 +810,10 @@ App.Templates.html = {
\
\ \ - \ + \
\
\ - \ + \ Cancel\ Help\
\ diff --git a/web/js/validators.js b/web/js/validators.js index 53ad7389..5fdcbf15 100644 --- a/web/js/validators.js +++ b/web/js/validators.js @@ -26,7 +26,7 @@ App.Validate.form = function(world, elm) } else { - if ($(field).val().trim() == '') { + if ($(field).val().trim() == '' || $(field).val().trim() == '-') { App.Env.FormError.push($(field).attr('name') + ' is required'); form_valid = false; } diff --git a/web/vesta/api/MAIN.class.php b/web/vesta/api/MAIN.class.php index 7493e701..40de2336 100644 --- a/web/vesta/api/MAIN.class.php +++ b/web/vesta/api/MAIN.class.php @@ -71,7 +71,8 @@ class MAIN extends AjaxHandler 'IP' => $this->getIpParams($data_ip), 'DNS' => $this->getDnsParams(), 'DB' => $this->getDbParams($data_db), - 'USERS' => $this->getUsersParams($data_users) + 'USERS' => $this->getUsersParams($data_users), + 'totals' => $this->getTotals() ); return $this->reply(true, $reply); @@ -81,6 +82,19 @@ class MAIN extends AjaxHandler // // + public function getTotals($data = array()) + { + return array( + 'USER' => array('total' => 7, 'blocked' => 0), + 'WEB_DOMAIN' => array('total' => 4, 'blocked' => 0), + 'MAIL' => array('total' => 0), + 'DB' => array('total' => 4, 'blocked' => 0), + 'DNS' => array('total' => 4, 'blocked' => 0), + 'IP' => array('total' => 2, 'blocked' => 0), + 'CRON' => array('total' => 5, 'blocked' => 0) + ); + } + /** * WEB DOMAIN initial params *