From 29772cbfddd0131067cf3f414d55621e90197271 Mon Sep 17 00:00:00 2001 From: Malishev Dmitry Date: Fri, 30 Dec 2011 12:18:58 +0300 Subject: [PATCH] Batch operations JS + PHP --- web/js/actions.js | 14 ++++++++++++-- web/vesta/api/IP.class.php | 2 +- web/vesta/api/USER.class.php | 9 +++++++-- web/vesta/core/Vesta.class.php | 6 +++--- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/web/js/actions.js b/web/js/actions.js index 69b9648f..17c0902d 100644 --- a/web/js/actions.js +++ b/web/js/actions.js @@ -53,16 +53,19 @@ App.Actions.update_cs_value = function(evt) App.Actions.mass_delete = function() { App.Actions.mass_action('massiveDelete'); + App.Actions.reset_batch(); } App.Actions.mass_suspend = function() { App.Actions.mass_action('massiveSuspend'); + App.Actions.reset_batch(); } App.Actions.mass_unsuspend = function() { App.Actions.mass_action('massiveUnsuspend'); + App.Actions.reset_batch(); } App.Actions.mass_action = function(method_name) @@ -80,6 +83,13 @@ App.Actions.mass_action = function(method_name) } } +App.Actions.reset_batch = function() +{ + $('#batch-processor .selector-title').html('NONE'); + $('.styled.do_action_toggle_batch_selector.style-applied').attr('checked', false); + $('.checkbox.do_action_toggle_batch_selector').css('background-position', '0 0'); +} + App.Actions.do_change_password = function() { @@ -533,7 +543,7 @@ App.Actions.add_form_ns = function(evt) $(form).find('.ns-entry').each(function(i, o) { - $(o).find('label').text('NameServer #' + (i + 1)); + $(o).find('label').text('NS #' + (i + 1)); $(o).find('input').attr('name', 'NS' + (i + 1)); }); } @@ -581,7 +591,7 @@ App.Actions.view_template_info = function(evt) $.each(reply.data, function(key) { html += '
  • '+key+': '+reply.data[key]+'
  • '; }); - App.Helpers.openInnerPopup(elm, '', 'Template Settings'); + App.Helpers.openInnerPopup(elm, '', 'Template Info'); } }); } diff --git a/web/vesta/api/IP.class.php b/web/vesta/api/IP.class.php index 9605b2fd..00e1bcd4 100644 --- a/web/vesta/api/IP.class.php +++ b/web/vesta/api/IP.class.php @@ -45,7 +45,7 @@ class IP extends AjaxHandler public function getListUserIpsExecute(Request $request) { $reply = array(); - $result = Vesta::execute(Vesta::V_LIST_SYS_IPS, array(Config::get('response_type'))); + $result = Vesta::execute(Vesta::V_LIST_USER_IPS, array(Config::get('response_type'))); foreach ($result['data'] as $ip => $details) { $reply[] = array_merge( array( diff --git a/web/vesta/api/USER.class.php b/web/vesta/api/USER.class.php index c3a0b0de..9aade6f3 100644 --- a/web/vesta/api/USER.class.php +++ b/web/vesta/api/USER.class.php @@ -367,9 +367,14 @@ class USER extends AjaxHandler public function loginAsExecute(Request $request) { $_user = $request->getParameter('user'); - VestaSession::loginAs($_user); - return $this->reply(TRUE, ''); + if(Vesta::hasRights(VestaSession::getInstance()->getUserRole(), 'login_as')) + { + VestaSession::loginAs($_user); + return $this->reply(TRUE, ''); + } + + return $this->reply(FALSE, ''); } public function logoutAsExecute(Request $request) diff --git a/web/vesta/core/Vesta.class.php b/web/vesta/core/Vesta.class.php index dcbd6de0..455ebc9f 100644 --- a/web/vesta/core/Vesta.class.php +++ b/web/vesta/core/Vesta.class.php @@ -219,9 +219,9 @@ class Vesta */ public function hasRights($role, $command) { - return TRUE; - echo 'role - '.$role; - exit(); + // return TRUE; + // echo 'role - '.$role; + // exit(); $rights = array( self::ADMIN => array(),