[-] BO : AdminModule shows when connected to Addons and have a logout button

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13731 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
fSerny
2012-02-29 10:29:12 +00:00
parent 28f2912d04
commit 0f22c97c6e
5 changed files with 70 additions and 3 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -25,7 +25,23 @@
*}
{if !isset($logged_on_addons)}
{if isset($logged_on_addons)}
<!--start addons login-->
<div class="filter-module" id="addons_login_div">
<p>{l s='You are logged on PrestaShop Addons'}</p>
<div style="float:right">
<label><img src="themes/default/img/module-profile.png" /> {l s='Welcome'} {$username_addons}</label>
<label>|</label>
<label><a href="#" id="addons_logout_button"><img src="themes/default/img/module-logout.png" /> {l s='Logout from addons'}</a></label>
</div>
</div>
<!--end addons login-->
{else}
{if $check_url_fopen eq 'ko' OR $check_openssl eq 'ko'}
@@ -45,7 +61,7 @@
<label>{l s='Login Addons'} :</label> <input type="text" value="" id="username_addons" autocomplete="off" class="ac_input">
<label>{l s= 'Password Addons'} :</label> <input type="password" value="" id="password_addons" autocomplete="off" class="ac_input">
<input type="submit" class="button" id="addons_login_button" value="{l s='Log in'}">
<span id="addons_loading" style="color:red"></span>
<br /><span id="addons_loading" style="color:red"></span>
</form>
</div>
@@ -35,7 +35,7 @@
var dirNameCurrentIndex = '{$dirNameCurrentIndex}';
var ajaxCurrentIndex = '{$ajaxCurrentIndex}';
var by = '{l s='by'}';
var errorLogin = '{l s='Could not login to Addons'}';
var errorLogin = '{l s='Could not login to Addons, please check your credentials and your internet connection.'}';
var confirmPreferencesSaved = '{l s='Preferences saved'}';
{if isset($smarty.get.anchor)}var anchor = '{$smarty.get.anchor|htmlentities|replace:'(':''|replace:')':''|replace:'{':''|replace:'}':''|replace:'\'':''|replace:'/':''}';{else}var anchor = '';{/if}
@@ -233,6 +233,47 @@
});
// Method to log out PrestaShop Addons WebServices
$('#addons_logout_button').click(function()
{
try
{
resAjax = $.ajax({
type:"POST",
url : ajaxCurrentIndex,
async: true,
data : {
ajax : "1",
token : token,
controller : "AdminModules",
action : "logOutAddonsWebservices"
},
beforeSend: function(xhr)
{
$('#addons_loading').html('<img src="../img/loader.gif" border="0">');
},
success : function(data)
{
// res.status = cache or refresh
if (data == 'OK')
{
$('#addons_loading').html('');
$('#addons_login_div').fadeOut();
window.location.href = window.location.href;
}
else
$('#addons_loading').html(errorLogin);
},
error: function(res,textStatus,jqXHR)
{
//jAlert("TECHNICAL ERROR"+res);
}
});
}
catch(e){}
return false;
});
// Method to set filter on modules
function setFilter()
@@ -289,6 +289,13 @@ class AdminModulesControllerCore extends AdminController
die($result);
}
public function ajaxProcessLogOutAddonsWebservices()
{
$this->context->cookie->username_addons = '';
$this->context->cookie->password_addons = '';
die('OK');
}
public function ajaxProcessReloadModulesList()
{
if (Tools::getValue('filterCategory'))
@@ -1084,7 +1091,10 @@ class AdminModulesControllerCore extends AdminController
$tpl_vars['check_openssl'] = (extension_loaded('openssl') ? 'ok' : 'ko');
if ($this->logged_on_addons)
{
$tpl_vars['logged_on_addons'] = 1;
$tpl_vars['username_addons'] = $this->context->cookie->username_addons;
}
$smarty->assign($tpl_vars);
}