[*] BO : New module interface tab now connected to PrestaShop Addons
This commit is contained in:
@@ -28,6 +28,6 @@
|
|||||||
{if isset($module_content)}
|
{if isset($module_content)}
|
||||||
{$module_content}
|
{$module_content}
|
||||||
{else}
|
{else}
|
||||||
{include file='themes/template/modules/js.tpl'}
|
{include file='modules/js.tpl'}
|
||||||
{include file='themes/template/modules/list.tpl'}
|
{include file='modules/page.tpl'}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision: 9771 $
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
<!--start filter module-->
|
||||||
|
<div class="filter-module">
|
||||||
|
<form id="filternameForm" method="post">
|
||||||
|
<input type="text" value="" name="filtername" autocomplete="off" class="ac_input">
|
||||||
|
<input type="submit" class="button" value="{l s='Search'}">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
|
||||||
|
<div class="select-filter">
|
||||||
|
<label class="search-filter">{l s='Sort by'}:</label>
|
||||||
|
|
||||||
|
<select name="module_type">
|
||||||
|
<option value="allModules" {if $showTypeModules eq 'allModules'}selected="selected"{/if}>{l s='All Modules'}</option>
|
||||||
|
<option value="nativeModules" {if $showTypeModules eq 'nativeModules'}selected="selected"{/if}>{l s='Native Modules'}</option>
|
||||||
|
<option value="partnerModules" {if $showTypeModules eq 'partnerModules'}selected="selected"{/if}>{l s='Partners Modules'}</option>
|
||||||
|
<optgroup label="{l s='Authors'}">
|
||||||
|
{foreach from=$list_modules_authors key=module_author item=status}
|
||||||
|
<option value="authorModules[{$module_author}]" {if $status eq "selected"}selected{/if}>{$module_author|truncate:20:'...'}</option>
|
||||||
|
{/foreach}
|
||||||
|
</optgroup>
|
||||||
|
<option value="otherModules" {if $showTypeModules eq 'otherModules'}selected="selected"{/if}>{l s='Others Modules'}</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select name="module_install">
|
||||||
|
<option value="installedUninstalled" {if $showInstalledModules eq 'installedUninstalled'}selected="selected"{/if}>{l s='Installed & Uninstalled'}</option>
|
||||||
|
<option value="installed" {if $showInstalledModules eq 'installed'}selected="selected"{/if}>{l s='Installed Modules'}</option>
|
||||||
|
<option value="uninstalled" {if $showInstalledModules eq 'uninstalled'}selected="selected"{/if}>{l s='Uninstalled Modules'}</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select name="module_status">
|
||||||
|
<option value="enabledDisabled" {if $showEnabledModules eq 'enabledDisabled'}selected="selected"{/if}>{l s='Enabled & Disabled'}</option>
|
||||||
|
<option value="enabled" {if $showEnabledModules eq 'enabled'}selected="selected"{/if}>{l s='Enabled Modules'}</option>
|
||||||
|
<option value="disabled" {if $showEnabledModules eq 'disabled'}selected="selected"{/if}>{l s='Disabled Modules'}</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select name="country_module_value">
|
||||||
|
<option value="0" >{l s='All countries'}</option>
|
||||||
|
<option value="1" {if $showCountryModules eq 1}selected="selected"{/if}>{l s='Current country:'} {$nameCountryDefault}</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="button-filter">
|
||||||
|
<input type="submit" value="{l s='Reset'}" name="resetFilterModules" class="button" />
|
||||||
|
<input type="submit" value="{l s='Filter'}" name="filterModules" class="button" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!--end filter module-->
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision: 9771 $
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
<div class="toolbar-placeholder">
|
||||||
|
<div class="toolbarBox toolbarHead">
|
||||||
|
|
||||||
|
<ul class="cc_button">
|
||||||
|
<li>
|
||||||
|
<a id="desc-module-new" class="toolbar_btn" href="#top_container" onclick="$('#module_install').slideToggle();" title="Add new">
|
||||||
|
<span class="process-icon-new-module" ></span>
|
||||||
|
<div>Add new module</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a id="desc-module-addon-new" class="toolbar_btn" href="{$addonsUrl}" title="Add new">
|
||||||
|
<span class="process-icon-new-module-addon" ></span>
|
||||||
|
<div>Add new via Addons</div>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="pageTitle">
|
||||||
|
<h3><span id="current_obj" style="font-weight: normal;"><span class="breadcrumb item-0">Module</span> : <span class="breadcrumb item-1">Liste de modules</span></span></h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="module_install" style="width:500px;margin-top:5px;{if !isset($smarty.post.downloadflag)}display: none;{/if}">
|
||||||
|
<fieldset>
|
||||||
|
<legend><img src="../img/admin/add.gif" alt="{l s='Add a new module'}" class="middle" /> {l s='Add a new module'}</legend>
|
||||||
|
<p>{'The module must be either a zip file or a tarball.'}</p>
|
||||||
|
<div style="float:left;margin-right:50px">
|
||||||
|
<form action="{$currentIndex}&token={$token}" method="post" enctype="multipart/form-data">
|
||||||
|
<label style="width: 100px">{l s='Module file'}</label>
|
||||||
|
<div class="margin-form" style="padding-left: 140px">
|
||||||
|
<input type="file" name="file" />
|
||||||
|
<p>{l s='Upload the module from your computer.'}</p>
|
||||||
|
</div>
|
||||||
|
<div class="margin-form" style="padding-left: 140px">
|
||||||
|
<input type="submit" name="download" value="{l s='Upload this module'}" class="button" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
@@ -35,6 +35,7 @@
|
|||||||
var dirNameCurrentIndex = '{$dirNameCurrentIndex}';
|
var dirNameCurrentIndex = '{$dirNameCurrentIndex}';
|
||||||
var ajaxCurrentIndex = '{$ajaxCurrentIndex}';
|
var ajaxCurrentIndex = '{$ajaxCurrentIndex}';
|
||||||
var by = '{l s='by'}';
|
var by = '{l s='by'}';
|
||||||
|
var errorLogin = '{l s='Could not login to Addons'}';
|
||||||
|
|
||||||
{literal}
|
{literal}
|
||||||
function getPrestaStore(){if(getE("prestastore").style.display!='block')return;$.post(dirNameCurrentIndex+"/ajax.php",{page:"prestastore"},function(a){getE("prestastore-content").innerHTML=a;})}
|
function getPrestaStore(){if(getE("prestastore").style.display!='block')return;$.post(dirNameCurrentIndex+"/ajax.php",{page:"prestastore"},function(a){getE("prestastore-content").innerHTML=a;})}
|
||||||
@@ -76,7 +77,7 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// the following to get modules_list.xml from prestashop.com
|
// Method to get modules_list.xml from prestashop.com and default_country_modules_list.xml from addons.prestashop.com
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -103,5 +104,52 @@
|
|||||||
}
|
}
|
||||||
catch(e){}
|
catch(e){}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// Method to log on PrestaShop Addons WebServices
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('#addons_login_button').click(function()
|
||||||
|
{
|
||||||
|
var username_addons = $("#username_addons").val();
|
||||||
|
var password_addons = $("#password_addons").val();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
resAjax = $.ajax({
|
||||||
|
type:"POST",
|
||||||
|
url : ajaxCurrentIndex,
|
||||||
|
async: true,
|
||||||
|
data : {
|
||||||
|
ajax : "1",
|
||||||
|
token : token,
|
||||||
|
controller : "AdminModules",
|
||||||
|
action : "logOnAddonsWebservices",
|
||||||
|
username_addons : username_addons,
|
||||||
|
password_addons : password_addons
|
||||||
|
},
|
||||||
|
beforeSend: function(xhr)
|
||||||
|
{
|
||||||
|
$('#addons_loading').html('<img src="../img/loader.gif" border="0">');
|
||||||
|
},
|
||||||
|
success : function(data)
|
||||||
|
{
|
||||||
|
// res.status = cache or refresh
|
||||||
|
if (data != 'KO')
|
||||||
|
{
|
||||||
|
$('#addons_loading').html('');
|
||||||
|
$('#addons_login_div').fadeOut();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$('#addons_loading').html(errorLogin);
|
||||||
|
},
|
||||||
|
error: function(res,textStatus,jqXHR)
|
||||||
|
{
|
||||||
|
//alert("TECHNICAL ERROR"+res);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch(e){}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
});
|
||||||
{/literal}
|
{/literal}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -24,156 +24,6 @@
|
|||||||
* International Registered Trademark & Property of PrestaShop SA
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
*}
|
*}
|
||||||
|
|
||||||
<div id="productBox">
|
|
||||||
<div class="toolbar-placeholder">
|
|
||||||
<div class="toolbarBox toolbarHead">
|
|
||||||
|
|
||||||
<ul class="cc_button">
|
|
||||||
<li>
|
|
||||||
<a id="desc-module-new" class="toolbar_btn" href="#top_container" onclick="$('#module_install').slideToggle();" title="Add new">
|
|
||||||
<span class="process-icon-new-module" ></span>
|
|
||||||
<div>Add new module</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<a id="desc-module-addon-new" class="toolbar_btn" href="{$addonsUrl}" title="Add new">
|
|
||||||
<span class="process-icon-new-module-addon" ></span>
|
|
||||||
<div>Add new via Addons</div>
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<div class="pageTitle">
|
|
||||||
<h3><span id="current_obj" style="font-weight: normal;"><span class="breadcrumb item-0">Module</span> : <span class="breadcrumb item-1">Liste de modules</span></span></h3>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="module_install" style="width:500px;margin-top:5px;{if !isset($smarty.post.downloadflag)}display: none;{/if}">
|
|
||||||
<fieldset>
|
|
||||||
<legend><img src="../img/admin/add.gif" alt="{l s='Add a new module'}" class="middle" /> {l s='Add a new module'}</legend>
|
|
||||||
<p>{'The module must be either a zip file or a tarball.'}</p>
|
|
||||||
<div style="float:left;margin-right:50px">
|
|
||||||
<form action="{$currentIndex}&token={$token}" method="post" enctype="multipart/form-data">
|
|
||||||
<label style="width: 100px">{l s='Module file'}</label>
|
|
||||||
<div class="margin-form" style="padding-left: 140px">
|
|
||||||
<input type="file" name="file" />
|
|
||||||
<p>{l s='Upload the module from your computer.'}</p>
|
|
||||||
</div>
|
|
||||||
<div class="margin-form" style="padding-left: 140px">
|
|
||||||
<input type="submit" name="download" value="{l s='Upload this module'}" class="button" />
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
<br />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<!--start filter module-->
|
|
||||||
<div class="filter-module">
|
|
||||||
<form id="filternameForm" method="post">
|
|
||||||
<input type="text" value="" name="filtername" autocomplete="off" class="ac_input">
|
|
||||||
<input type="submit" class="button" value="{l s='Search'}">
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<form method="post">
|
|
||||||
|
|
||||||
<div class="select-filter">
|
|
||||||
<label class="search-filter">{l s='Sort by'}:</label>
|
|
||||||
|
|
||||||
<select name="module_type">
|
|
||||||
<option value="allModules" {if $showTypeModules eq 'allModules'}selected="selected"{/if}>{l s='All Modules'}</option>
|
|
||||||
<option value="nativeModules" {if $showTypeModules eq 'nativeModules'}selected="selected"{/if}>{l s='Native Modules'}</option>
|
|
||||||
<option value="partnerModules" {if $showTypeModules eq 'partnerModules'}selected="selected"{/if}>{l s='Partners Modules'}</option>
|
|
||||||
<optgroup label="{l s='Authors'}">
|
|
||||||
{foreach from=$list_modules_authors key=module_author item=status}
|
|
||||||
<option value="authorModules[{$module_author}]" {if $status eq "selected"}selected{/if}>{$module_author|truncate:20:'...'}</option>
|
|
||||||
{/foreach}
|
|
||||||
</optgroup>
|
|
||||||
<option value="otherModules" {if $showTypeModules eq 'otherModules'}selected="selected"{/if}>{l s='Others Modules'}</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select name="module_install">
|
|
||||||
<option value="installedUninstalled" {if $showInstalledModules eq 'installedUninstalled'}selected="selected"{/if}>{l s='Installed & Uninstalled'}</option>
|
|
||||||
<option value="installed" {if $showInstalledModules eq 'installed'}selected="selected"{/if}>{l s='Installed Modules'}</option>
|
|
||||||
<option value="uninstalled" {if $showInstalledModules eq 'uninstalled'}selected="selected"{/if}>{l s='Uninstalled Modules'}</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select name="module_status">
|
|
||||||
<option value="enabledDisabled" {if $showEnabledModules eq 'enabledDisabled'}selected="selected"{/if}>{l s='Enabled & Disabled'}</option>
|
|
||||||
<option value="enabled" {if $showEnabledModules eq 'enabled'}selected="selected"{/if}>{l s='Enabled Modules'}</option>
|
|
||||||
<option value="disabled" {if $showEnabledModules eq 'disabled'}selected="selected"{/if}>{l s='Disabled Modules'}</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select name="country_module_value">
|
|
||||||
<option value="0" >{l s='All countries'}</option>
|
|
||||||
<option value="1" {if $showCountryModules eq 1}selected="selected"{/if}>{l s='Current country:'} {$nameCountryDefault}</option>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="button-filter">
|
|
||||||
<input type="submit" value="{l s='Reset'}" name="resetFilterModules" class="button" />
|
|
||||||
<input type="submit" value="{l s='Filter'}" name="filterModules" class="button" />
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</form>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<!--end filter module-->
|
|
||||||
|
|
||||||
<div id="container">
|
|
||||||
<!--start sidebar module-->
|
|
||||||
<div class="sidebar">
|
|
||||||
<div class="categorieTitle">
|
|
||||||
<h3>{l s='Categories'}</h3>
|
|
||||||
<div class="subHeadline">{$nb_modules}</div>
|
|
||||||
<ul class="categorieList">
|
|
||||||
{foreach from=$list_modules_categories item=module_category key=module_category_key}
|
|
||||||
<li {if isset($categoryFiltered[$module_category_key])}style="background-color:#EBEDF4"{/if}>
|
|
||||||
<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>
|
|
||||||
<div class="count">{$module_category.nb}</div>
|
|
||||||
</li>
|
|
||||||
{/foreach}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="categorieStatus">
|
|
||||||
<h3>Etat du module</h3>
|
|
||||||
<div class="subHeadline">{$nb_modules}</div>
|
|
||||||
<ul class="categorieList">
|
|
||||||
<li>
|
|
||||||
<div class="categorieWidth"><a href="#"><span>{l s='Installed'}</span></a></div>
|
|
||||||
<div class="count">{$nb_modules_installed}</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="categorieWidth"><a href="#"><span>{l s='Uninstalled'}</span></a></div>
|
|
||||||
<div class="count">{$nb_modules_uninstalled}</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="categorieStatus">
|
|
||||||
<h3>Etat du module</h3>
|
|
||||||
<div class="subHeadline">{$nb_modules}</div>
|
|
||||||
<ul class="categorieList">
|
|
||||||
<li>
|
|
||||||
<div class="categorieWidth"><a href="#"><span>{l s='Activated'}</span></a></div>
|
|
||||||
<div class="count">{$nb_modules_activated}</div>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<div class="categorieWidth"><a href="#"><span>{l s='Unactivated'}</span></a></div>
|
|
||||||
<div class="count">{$nb_modules_unactivated}</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="moduleContainer">
|
|
||||||
<table cellspacing="0" cellpadding="0" style="width: 100%; margin-bottom:10px;" class="table" id="">
|
<table cellspacing="0" cellpadding="0" style="width: 100%; margin-bottom:10px;" class="table" id="">
|
||||||
<col width="20px">
|
<col width="20px">
|
||||||
<col width="40px">
|
<col width="40px">
|
||||||
@@ -197,7 +47,7 @@
|
|||||||
{foreach from=$modules item=module}
|
{foreach from=$modules item=module}
|
||||||
<tr>
|
<tr>
|
||||||
<td><input type="checkbox" name="modules" value="{$module->name}" class="noborder"></td>
|
<td><input type="checkbox" name="modules" value="{$module->name}" class="noborder"></td>
|
||||||
<td><img class="imgm" alt="" src="../modules/{$module->name}/{$module->logo}"></td>
|
<td><img class="imgm" alt="" src="{if isset($module->image)}{$module->image}{else}../modules/{$module->name}/{$module->logo}{/if}"></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="moduleDesc" id="anchor{$module->name|ucfirst}">
|
<div class="moduleDesc" id="anchor{$module->name|ucfirst}">
|
||||||
<h3>{$module->displayName}{if isset($module->id) && $module->id gt 0}<span class="setup{if isset($module->active) && $module->active eq 0} off{/if}">{l s='Installed'}</span>{else}<span class="setup non-install">{l s='Not installed'}</span>{/if}</h3>
|
<h3>{$module->displayName}{if isset($module->id) && $module->id gt 0}<span class="setup{if isset($module->active) && $module->active eq 0} off{/if}">{l s='Installed'}</span>{else}<span class="setup non-install">{l s='Not installed'}</span>{/if}</h3>
|
||||||
@@ -210,7 +60,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<dl class="">
|
<dl class="">
|
||||||
<dt>{l s='Version'} :</dt>
|
<dt>{l s='Version'} :</dt>
|
||||||
<dd>{$module->version}</dd>|
|
<dd>{$module->version} {if isset($module->version_addons)}({l s='Update'} {$module->version_addons} {l s='available on PrestaShop Addons'}){/if}</dd>|
|
||||||
</dl>
|
</dl>
|
||||||
<dl class="">
|
<dl class="">
|
||||||
<dt>{l s='Category'} :</dt>
|
<dt>{l s='Category'} :</dt>
|
||||||
@@ -227,8 +77,6 @@
|
|||||||
<td><a href="{if isset($module->id) && $module->id gt 0}{$module->options.uninstall_url}{else}{$module->options.install_url}{/if}" class="button installed"><span>{if isset($module->id) && $module->id gt 0}{l s='Uninstall'}{else}{l s='Install'}{/if}</span></a></td>
|
<td><a href="{if isset($module->id) && $module->id gt 0}{$module->options.uninstall_url}{else}{$module->options.install_url}{/if}" class="button installed"><span>{if isset($module->id) && $module->id gt 0}{l s='Uninstall'}{else}{l s='Install'}{/if}</span></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
{*
|
||||||
|
* 2007-2011 PrestaShop
|
||||||
|
*
|
||||||
|
* NOTICE OF LICENSE
|
||||||
|
*
|
||||||
|
* This source file is subject to the Academic Free License (AFL 3.0)
|
||||||
|
* that is bundled with this package in the file LICENSE.txt.
|
||||||
|
* It is also available through the world-wide-web at this URL:
|
||||||
|
* http://opensource.org/licenses/afl-3.0.php
|
||||||
|
* If you did not receive a copy of the license and are unable to
|
||||||
|
* obtain it through the world-wide-web, please send an email
|
||||||
|
* to license@prestashop.com so we can send you a copy immediately.
|
||||||
|
*
|
||||||
|
* DISCLAIMER
|
||||||
|
*
|
||||||
|
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
|
||||||
|
* versions in the future. If you wish to customize PrestaShop for your
|
||||||
|
* needs please refer to http://www.prestashop.com for more information.
|
||||||
|
*
|
||||||
|
* @author PrestaShop SA <contact@prestashop.com>
|
||||||
|
* @copyright 2007-2011 PrestaShop SA
|
||||||
|
* @version Release: $Revision: 9771 $
|
||||||
|
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||||
|
* International Registered Trademark & Property of PrestaShop SA
|
||||||
|
*}
|
||||||
|
|
||||||
|
<div id="productBox">
|
||||||
|
|
||||||
|
{include file='modules/header.tpl'}
|
||||||
|
{include file='modules/filters.tpl'}
|
||||||
|
|
||||||
|
|
||||||
|
{if !isset($logged_on_addons)}
|
||||||
|
<!--start addons login-->
|
||||||
|
<div class="filter-module" id="addons_login_div">
|
||||||
|
<form id="addons_login_form" method="post">
|
||||||
|
<input type="text" value="" id="username_addons" autocomplete="off" class="ac_input">
|
||||||
|
<input type="text" 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}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div id="container">
|
||||||
|
<!--start sidebar module-->
|
||||||
|
<div class="sidebar">
|
||||||
|
<div class="categorieTitle">
|
||||||
|
<h3>{l s='Categories'}</h3>
|
||||||
|
<div class="subHeadline">{$nb_modules}</div>
|
||||||
|
<ul class="categorieList">
|
||||||
|
{foreach from=$list_modules_categories item=module_category key=module_category_key}
|
||||||
|
<li {if isset($categoryFiltered[$module_category_key])}style="background-color:#EBEDF4"{/if}>
|
||||||
|
<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>
|
||||||
|
<div class="count">{$module_category.nb}</div>
|
||||||
|
</li>
|
||||||
|
{/foreach}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="moduleContainer">
|
||||||
|
{include file='modules/list.tpl'}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
+86
-9
@@ -616,20 +616,25 @@ abstract class ModuleCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if config.xml module file exists and if it's not outdated
|
||||||
$configFile = _PS_MODULE_DIR_.$module.'/config.xml';
|
$configFile = _PS_MODULE_DIR_.$module.'/config.xml';
|
||||||
$xml_exist = file_exists($configFile);
|
$xml_exist = file_exists($configFile);
|
||||||
if ($xml_exist)
|
if ($xml_exist)
|
||||||
$needNewConfigFile = (filemtime($configFile) < filemtime(_PS_MODULE_DIR_.$module.'/'.$module.'.php'));
|
$needNewConfigFile = (filemtime($configFile) < filemtime(_PS_MODULE_DIR_.$module.'/'.$module.'.php'));
|
||||||
else
|
else
|
||||||
$needNewConfigFile = true;
|
$needNewConfigFile = true;
|
||||||
|
|
||||||
|
// If config.xml exists and that the use config flag is at true
|
||||||
if ($useConfig && $xml_exist)
|
if ($useConfig && $xml_exist)
|
||||||
{
|
{
|
||||||
|
// Load config.xml
|
||||||
libxml_use_internal_errors(true);
|
libxml_use_internal_errors(true);
|
||||||
$xml_module = simplexml_load_file($configFile);
|
$xml_module = simplexml_load_file($configFile);
|
||||||
foreach (libxml_get_errors() as $error)
|
foreach (libxml_get_errors() as $error)
|
||||||
$errors[] = '['.$module.'] '.Tools::displayError('Error found in config file:').' '.htmlentities($error->message);
|
$errors[] = '['.$module.'] '.Tools::displayError('Error found in config file:').' '.htmlentities($error->message);
|
||||||
libxml_clear_errors();
|
libxml_clear_errors();
|
||||||
|
|
||||||
|
// If no errors in Xml, no need instand and no need new config.xml file, we load only translations
|
||||||
if (!count($errors) && (int)$xml_module->need_instance == 0 && !$needNewConfigFile)
|
if (!count($errors) && (int)$xml_module->need_instance == 0 && !$needNewConfigFile)
|
||||||
{
|
{
|
||||||
$file = _PS_MODULE_DIR_.$module.'/'.Context::getContext()->language->iso_code.'.php';
|
$file = _PS_MODULE_DIR_.$module.'/'.Context::getContext()->language->iso_code.'.php';
|
||||||
@@ -657,28 +662,49 @@ abstract class ModuleCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If use config flag is at false or config.xml does not exist OR need instance OR need a new config.xml file
|
||||||
if (!$useConfig OR !$xml_exist OR (isset($xml_module->need_instance) AND (int)$xml_module->need_instance == 1) OR $needNewConfigFile)
|
if (!$useConfig OR !$xml_exist OR (isset($xml_module->need_instance) AND (int)$xml_module->need_instance == 1) OR $needNewConfigFile)
|
||||||
{
|
{
|
||||||
// If class already exists, don't include the file
|
// If class does not exists, we include the file
|
||||||
if (!class_exists($module, false))
|
if (!class_exists($module, false))
|
||||||
{
|
{
|
||||||
|
// Get content from php file
|
||||||
$filepath = _PS_MODULE_DIR_.$module.'/'.$module.'.php';
|
$filepath = _PS_MODULE_DIR_.$module.'/'.$module.'.php';
|
||||||
$file = trim(file_get_contents(_PS_MODULE_DIR_.$module.'/'.$module.'.php'));
|
$file = trim(file_get_contents(_PS_MODULE_DIR_.$module.'/'.$module.'.php'));
|
||||||
if (substr($file, 0, 5) == '<?php')
|
if (substr($file, 0, 5) == '<?php')
|
||||||
$file = substr($file, 5);
|
$file = substr($file, 5);
|
||||||
if (substr($file, -2) == '?>')
|
if (substr($file, -2) == '?>')
|
||||||
$file = substr($file, 0, -2);
|
$file = substr($file, 0, -2);
|
||||||
// if (false) is a trick to not load the class with "eval".
|
|
||||||
// this way require_once will works correctly
|
// If (false) is a trick to not load the class with "eval".
|
||||||
|
// This way require_once will works correctly
|
||||||
if (eval('if (false){ '.$file.' }') !== false)
|
if (eval('if (false){ '.$file.' }') !== false)
|
||||||
require_once( _PS_MODULE_DIR_.$module.'/'.$module.'.php' );
|
require_once( _PS_MODULE_DIR_.$module.'/'.$module.'.php' );
|
||||||
else
|
else
|
||||||
$errors[] = sprintf(Tools::displayError('%1$s (parse error in %2$s)'), $module, substr($filepath, strlen(_PS_ROOT_DIR_)));
|
$errors[] = sprintf(Tools::displayError('%1$s (parse error in %2$s)'), $module, substr($filepath, strlen(_PS_ROOT_DIR_)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If class exists, we just instanciate it
|
||||||
if (class_exists($module,false))
|
if (class_exists($module,false))
|
||||||
{
|
{
|
||||||
$moduleList[$moduleListCursor++] = new $module;
|
$tmpModule = new $module;
|
||||||
|
|
||||||
|
$item = new stdClass();
|
||||||
|
$item->id = $tmpModule->id;
|
||||||
|
$item->warning = $tmpModule->warning;
|
||||||
|
$item->name = $tmpModule->name;
|
||||||
|
$item->version = $tmpModule->version;
|
||||||
|
$item->tab = $tmpModule->tab;
|
||||||
|
$item->displayName = $tmpModule->displayName;
|
||||||
|
$item->description = $tmpModule->description;
|
||||||
|
$item->author = $tmpModule->author;
|
||||||
|
$item->limited_countries = $tmpModule->limited_countries;
|
||||||
|
$item->is_configurable = isset($tmpModule->is_configurable) ? $tmpModule->is_configurable : 0;
|
||||||
|
$item->need_instance = isset($tmpModule->need_instance) ? $tmpModule->need_instance : 0;
|
||||||
|
$item->active = $tmpModule->active;
|
||||||
|
unset($tmpModule);
|
||||||
|
|
||||||
|
$moduleList[] = $item;
|
||||||
if (!$xml_exist OR $needNewConfigFile)
|
if (!$xml_exist OR $needNewConfigFile)
|
||||||
{
|
{
|
||||||
self::$_generateConfigXmlMode = true;
|
self::$_generateConfigXmlMode = true;
|
||||||
@@ -711,6 +737,57 @@ abstract class ModuleCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Get Default Country Modules and customer module
|
||||||
|
$filesList = array(_PS_ROOT_DIR_.'/config/default_country_modules_list.xml', _PS_ROOT_DIR_.'/config/default_customer_modules_list.xml');
|
||||||
|
foreach ($filesList as $file)
|
||||||
|
if (file_exists($file))
|
||||||
|
{
|
||||||
|
$content = Tools::file_get_contents($file);
|
||||||
|
$xml = @simplexml_load_string($content, NULL, LIBXML_NOCDATA);
|
||||||
|
foreach ($xml->module as $modaddons)
|
||||||
|
{
|
||||||
|
$flagFound = 0;
|
||||||
|
foreach ($moduleList as $k => $m)
|
||||||
|
if ($m->name == $modaddons->name && !isset($m->available_on_addons))
|
||||||
|
{
|
||||||
|
$flagFound = 1;
|
||||||
|
if ($m->version != $modaddons->version && version_compare($m->version, $modaddons->version) === -1)
|
||||||
|
$moduleList[$k]->version_addons = $modaddons->version;
|
||||||
|
}
|
||||||
|
if ($flagFound == 0)
|
||||||
|
{
|
||||||
|
$item = new stdClass();
|
||||||
|
$item->id = 0;
|
||||||
|
$item->warning = '';
|
||||||
|
$item->name = strip_tags((string)$modaddons->name);
|
||||||
|
$item->version = strip_tags((string)$modaddons->version);
|
||||||
|
$item->tab = strip_tags((string)$modaddons->tab);
|
||||||
|
$item->displayName = strip_tags((string)$modaddons->displayName).' (Addons)';
|
||||||
|
$item->description = strip_tags((string)$modaddons->description);
|
||||||
|
$item->author = strip_tags((string)$modaddons->author);
|
||||||
|
$item->limited_countries = array();
|
||||||
|
$item->is_configurable = 0;
|
||||||
|
$item->need_instance = 0;
|
||||||
|
$item->available_on_addons = 1;
|
||||||
|
$item->active = 0;
|
||||||
|
if (!isset($modaddons->img) && isset($modaddons->id))
|
||||||
|
$modaddons->img = 'http://media.prestastore.com/img/pico/'.(int)$modaddons->id.'.jpg';
|
||||||
|
if (isset($modaddons->img))
|
||||||
|
{
|
||||||
|
if (!file_exists('../img/tmp/'.md5($modaddons->name).'.jpg'))
|
||||||
|
copy($modaddons->img, '../img/tmp/'.md5($modaddons->name).'.jpg');
|
||||||
|
if (file_exists('../img/tmp/'.md5($modaddons->name).'.jpg'))
|
||||||
|
$item->image = '../img/tmp/'.md5($modaddons->name).'.jpg';
|
||||||
|
}
|
||||||
|
$moduleList[] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//echo '<pre>'.print_r($moduleList, 1).'</pre>';
|
||||||
|
echo round($current_memory / 1024 / 1024, 2).'Mo<br />';
|
||||||
|
|
||||||
if ($errors)
|
if ($errors)
|
||||||
{
|
{
|
||||||
echo '<div class="alert error"><h3>'.Tools::displayError('The following module(s) couldn\'t be loaded').':</h3><ol>';
|
echo '<div class="alert error"><h3>'.Tools::displayError('The following module(s) couldn\'t be loaded').':</h3><ol>';
|
||||||
|
|||||||
@@ -58,8 +58,10 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
private $iso_default_country;
|
private $iso_default_country;
|
||||||
private $filter_configuration = array();
|
private $filter_configuration = array();
|
||||||
|
|
||||||
|
private $addons_url = 'https://addons.prestashop.com/webservice/151/';
|
||||||
|
private $logged_on_addons = false;
|
||||||
|
private $cache_file_default_country_modules_list = '/config/default_country_modules_list.xml';
|
||||||
|
private $cache_file_customer_modules_list = '/config/default_customer_modules_list.xml';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Admin Modules Controller Constructor
|
** Admin Modules Controller Constructor
|
||||||
@@ -123,6 +125,10 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
if ($xmlModule->attributes() == 'partner' && $key == 'name')
|
if ($xmlModule->attributes() == 'partner' && $key == 'name')
|
||||||
$this->list_partners_modules[] = (string)$value;
|
$this->list_partners_modules[] = (string)$value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if logged on Addons
|
||||||
|
if (isset($this->context->cookie->username_addons) && isset($this->context->cookie->password_addons) && !empty($this->context->cookie->username_addons) && !empty($this->context->cookie->password_addons))
|
||||||
|
$this->logged_on_addons = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -138,31 +144,61 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
** @return null
|
** @return null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public function isFresh($file, $timeout = 604800000)
|
||||||
|
{
|
||||||
|
if (file_exists(_PS_ROOT_DIR_.$file))
|
||||||
|
return ((time() - filemtime(_PS_ROOT_DIR_.$this->cache_file_modules_list)) < $timeout);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function refresh($file_to_refresh, $external_file)
|
||||||
|
{
|
||||||
|
return file_put_contents(_PS_ROOT_DIR_.$file_to_refresh, Tools::file_get_contents($external_file));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function ajaxProcessRefreshModuleList()
|
public function ajaxProcessRefreshModuleList()
|
||||||
{
|
{
|
||||||
// Refresh modules_list.xml every week
|
// Refresh modules_list.xml every week
|
||||||
if (!$this->isFresh())
|
if (!$this->isFresh($this->cache_file_modules_list, 604800))
|
||||||
{
|
{
|
||||||
if ($this->refresh())
|
if ($this->refresh($this->cache_file_modules_list, $this->xml_modules_list))
|
||||||
$this->status = 'refresh';
|
$this->status = 'refresh';
|
||||||
else
|
else
|
||||||
$this->status = 'error';
|
$this->status = 'error';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
$this->status = 'cache';
|
$this->status = 'cache';
|
||||||
}
|
|
||||||
|
|
||||||
public function isFresh($timeout = 604800000)
|
|
||||||
{
|
|
||||||
if (file_exists(_PS_ROOT_DIR_ . $this->_moduleCacheFile))
|
|
||||||
return ((time() - filemtime(_PS_ROOT_DIR_ . $this->_moduleCacheFile)) < $timeout);
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function refresh()
|
// If logged to Addons Webservices, refresh default country modules list every day
|
||||||
{
|
if ($this->logged_on_addons && $this->status != 'error')
|
||||||
return file_put_contents(_PS_ROOT_DIR_.$this->_moduleCacheFile, Tools::file_get_contents($this->xml_modules_list));
|
{
|
||||||
|
if (!$this->isFresh($this->cache_file_default_country_modules_list, 86400))
|
||||||
|
{
|
||||||
|
if ($this->refresh($this->cache_file_default_country_modules_list, $this->addons_url.'listing/'.strtolower(Configuration::get('PS_LOCALE_COUNTRY'))))
|
||||||
|
$this->status = 'refresh';
|
||||||
|
else
|
||||||
|
$this->status = 'error';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->status = 'cache';
|
||||||
|
}
|
||||||
|
|
||||||
|
// If logged to Addons Webservices, refresh customer modules list every day
|
||||||
|
if ($this->logged_on_addons && $this->status != 'error')
|
||||||
|
{
|
||||||
|
if (!$this->isFresh($this->cache_file_customer_modules_list, 86400))
|
||||||
|
{
|
||||||
|
if ($this->refresh($this->cache_file_customer_modules_list, $this->addons_url.'listing/customer/'.pSQL(trim($this->context->cookie->username_addons)).'/'.pSQL(trim($this->context->cookie->password_addons))))
|
||||||
|
$this->status = 'refresh';
|
||||||
|
else
|
||||||
|
$this->status = 'error';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$this->status = 'cache';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function displayAjaxRefreshModuleList()
|
public function displayAjaxRefreshModuleList()
|
||||||
@@ -171,8 +207,16 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function ajaxProcessLogOnAddonsWebservices()
|
||||||
|
{
|
||||||
|
$content = Tools::file_get_contents($this->addons_url.'listing/customer/'.pSQL(trim(Tools::getValue('username_addons'))).'/'.pSQL(trim(Tools::getValue('password_addons'))));
|
||||||
|
$xml = @simplexml_load_string($content, NULL, LIBXML_NOCDATA);
|
||||||
|
if (!$xml)
|
||||||
|
die('KO');
|
||||||
|
$this->context->cookie->username_addons = pSQL(trim(Tools::getValue('username_addons')));
|
||||||
|
$this->context->cookie->password_addons = pSQL(trim(Tools::getValue('password_addons')));
|
||||||
|
die('OK');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -558,6 +602,9 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
|
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
|
// Parent Post Process
|
||||||
|
parent::postProcess();
|
||||||
|
|
||||||
// Execute filter or callback methods
|
// Execute filter or callback methods
|
||||||
$filterMethods = array('filterModules', 'resetFilterModules', 'filterCategory', 'unfilterCategory');
|
$filterMethods = array('filterModules', 'resetFilterModules', 'filterCategory', 'unfilterCategory');
|
||||||
$callbackMethods = array('reset', 'download', 'enable', 'delete');
|
$callbackMethods = array('reset', 'download', 'enable', 'delete');
|
||||||
@@ -787,6 +834,9 @@ class AdminModulesControllerCore extends AdminController
|
|||||||
$tpl_vars['list_modules_categories'] = $this->list_modules_categories;
|
$tpl_vars['list_modules_categories'] = $this->list_modules_categories;
|
||||||
$tpl_vars['list_modules_authors'] = $this->modules_authors;
|
$tpl_vars['list_modules_authors'] = $this->modules_authors;
|
||||||
|
|
||||||
|
if ($this->logged_on_addons)
|
||||||
|
$tpl_vars['logged_on_addons'] = 1;
|
||||||
|
|
||||||
$smarty->assign($tpl_vars);
|
$smarty->assign($tpl_vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user