[+] BO : AdminModules Preferences

This commit is contained in:
fSerny
2012-01-24 15:39:10 +00:00
parent cf5a58be86
commit 48cb2f5dc5
14 changed files with 243 additions and 40 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 998 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -29,5 +29,9 @@
{$module_content}
{else}
{include file='controllers/modules/js.tpl'}
{include file='controllers/modules/page.tpl'}
{if isset($smarty.get.select) && $smarty.get.select eq 'favorites'}
{include file='controllers/modules/favorites.tpl'}
{else}
{include file='controllers/modules/page.tpl'}
{/if}
{/if}
@@ -0,0 +1,64 @@
<div id="productBox">
{include file='controllers/modules/header.tpl'}
<a href="index.php?controller={$smarty.get.controller|htmlentities}&token={$smarty.get.token|htmlentities}"><img src="themes/default/img/modules_view_layout_sidebar_grey.png" alt="{l s='Normal view'}" border="0" /></a>
<img src="themes/default/img/modules_view_table_select_row.png" alt="{l s='Favorites view'}" border="0" /><br />
<div id="container">
<div id="moduleContainer" style="padding:0px;margin:0px;padding-top:15px">
<table cellspacing="0" cellpadding="0" style="width: 100%; margin-bottom:10px;" class="table" id="">
<col width="20px">
<col width="180px">
<col width="320px">
<col width="80px">
<col width="100px">
<col width="70px">
<col width="70px">
<col width="70px">
</colgroup>
<thead>
<tr class="nodrag nodrop">
<th class="center">Logo</th>
<th>Nom du module</th>
<th>Description</th>
<th>Etat</th>
<th>Catégories</th>
<th>Intérêt</th>
<th>Favori</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{foreach from=$modules key=km item=module}
<tr{if $km % 2 eq 0} class="alt_row"{/if}>
<td><img src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}" width="16" height="16" /></td>
<td>{$module->displayName}</td>
<td>{$module->description|truncate:80:'…'}</td>
<td>{if isset($module->id) && $module->id gt 0}<span class="setup">{l s='Installed'}</span>{else}<span class="setup non-install">{l s='Not Installed'}</span>{/if}</td>
<td>{$module->categoryName}</td>
<td>
<select name="i_{$module->name}" class="moduleFavorite" style="width:50px">
<option value="" selected="selected">---</option>
<option value="1" {if isset($module->preferences.interest) && $module->preferences.interest eq '1'}selected="selected"{/if}>Yes</option>
<option value="0" {if isset($module->preferences.interest) && $module->preferences.interest eq '0'}selected="selected"{/if}>No</option>
</select>
</td>
<td>
<select name="f_{$module->name}" class="moduleFavorite" style="width:50px">
<option value="" selected="selected">---</option>
<option value="1" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '1'}selected="selected"{/if}>Yes</option>
<option value="0" {if isset($module->preferences.favorite) && $module->preferences.favorite eq '0'}selected="selected"{/if}>No</option>
</select>
</td>
<td id="r_{$module->name}">&nbsp;</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
</div>
@@ -24,6 +24,39 @@
* International Registered Trademark & Property of PrestaShop SA
*}
{if !isset($logged_on_addons)}
{if $check_url_fopen eq 'ko' OR $check_curl eq 'ko' OR $check_openssl eq 'ko'}
<div class="warn">
<b>{l s='If you want to be able to fully use the AdminModules pannel and have free modules available, you should enable the following configuration on your server :'}</b><br />
{if $check_url_fopen eq 'ko'}- {l s='Enable allow_url_fopen'}<br />{/if}
{if $check_curl eq 'ko'}- {l s='Enable php curl extension'}<br />{/if}
{if $check_openssl eq 'ko'}- {l s='Enable php openssl extension'}<br />{/if}
</div>
{else}
<!--start addons login-->
<div class="filter-module" id="addons_login_div">
<p>{l s='You have a PrestaShop Addons account ?'}</p>
<form id="addons_login_form" method="post">
<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>
</form>
</div>
<!--end addons login-->
{/if}
{/if}
<!--start filter module-->
<style>.ac_results { border:1px solid #C2C4D9; }</style>
<div class="filter-module">
@@ -70,34 +70,4 @@
<br />
</div>
{if !isset($logged_on_addons)}
{if $check_url_fopen eq 'ko' OR $check_curl eq 'ko' OR $check_openssl eq 'ko'}
<div class="warn">
<b>{l s='If you want to be able to fully use the AdminModules pannel and have free modules available, you should enable the following configuration on your server :'}</b><br />
{if $check_url_fopen eq 'ko'}- {l s='Enable allow_url_fopen'}<br />{/if}
{if $check_curl eq 'ko'}- {l s='Enable php curl extension'}<br />{/if}
{if $check_openssl eq 'ko'}- {l s='Enable php openssl extension'}<br />{/if}
</div>
{else}
<!--start addons login-->
<div class="filter-module" id="addons_login_div">
<p>{l s='You have a PrestaShop Addons account ?'}</p>
<form id="addons_login_form" method="post">
<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>
</form>
</div>
<!--end addons login-->
{/if}
{/if}
@@ -36,6 +36,7 @@
var ajaxCurrentIndex = '{$ajaxCurrentIndex}';
var by = '{l s='by'}';
var errorLogin = '{l s='Could not login to Addons'}';
var confirmPreferencesSaved = '{l s='Preferences saved'}';
{if isset($smarty.get.anchor)}var anchor = '{$smarty.get.anchor|htmlentities|replace:'(':''|replace:')':''|replace:'{':''|replace:'}':''}';{else}var anchor = '';{/if}
@@ -279,6 +280,48 @@
// Method to save favorites preferences
$('.moduleFavorite').change(function()
{
var value_pref = $(this).val();
var module_pref = $(this).attr('name');
var action_pref = module_pref.substring(0, 1);
module_pref = module_pref.substring(2, module_pref.length);
try
{
resAjax = $.ajax({
type:"POST",
url : ajaxCurrentIndex,
async: true,
data : {
ajax : "1",
token : token,
controller : "AdminModules",
action : "saveFavoritePreferences",
action_pref : action_pref,
module_pref : module_pref,
value_pref : value_pref
},
success : function(data)
{
// res.status = cache or refresh
if (data == 'OK')
$('#r_' + module_pref).html(confirmPreferencesSaved);
},
error: function(res,textStatus,jqXHR)
{
//jAlert("TECHNICAL ERROR"+res);
}
});
}
catch(e){}
return false;
});
});
{/literal}
</script>
@@ -29,13 +29,25 @@
{include file='controllers/modules/header.tpl'}
{include file='controllers/modules/filters.tpl'}
<br />
<img src="themes/default/img/modules_view_layout_sidebar.png" alt="{l s='Normal view'}" border="0" />
<a href="index.php?controller={$smarty.get.controller|htmlentities}&token={$smarty.get.token|htmlentities}&select=favorites"><img src="themes/default/img/modules_view_table_select_row_grey.png" alt="{l s='Favorites view'}" border="0" /></a><br />
<div id="container">
<!--start sidebar module-->
<div class="sidebar">
<div class="categorieTitle">
<h3>{l s='Categories'}</h3>
<div class="subHeadline">{$nb_modules}</div>
<div class="subHeadline">&nbsp;</div>
<ul class="categorieList">
<li {if isset($categoryFiltered.favorites)}style="background-color:#EBEDF4"{/if} class="categoryModuleFilterLink">
<div class="categorieWidth"><a href="{$currentIndex}&token={$token}&filterCategory=favorites"><span><b>{l s='Favorites'}</b></span></a></div>
<div class="count"><b>{$nb_modules_favorites}</b></div>
</li>
<li {if count($categoryFiltered) lte 0}style="background-color:#EBEDF4"{/if} class="categoryModuleFilterLink">
<div class="categorieWidth"><a href="{$currentIndex}&token={$token}&unfilterCategory=yes"><span><b>{l s='Total'}</b></span></a></div>
<div class="count"><b>{$nb_modules}</b></div>
</li>
{foreach from=$list_modules_categories item=module_category key=module_category_key}
<li {if isset($categoryFiltered[$module_category_key])}style="background-color:#EBEDF4"{/if} class="categoryModuleFilterLink">
<div class="categorieWidth"><a href="{$currentIndex}&token={$token}&{if isset($categoryFiltered[$module_category_key])}un{/if}filterCategory={$module_category_key}"><span>{$module_category.name}</span></a></div>