Merge pull request #449 from shreesh-webkul/qlo-catalog-update
Added catalog page, updated dashboard and added recomendation section
This commit is contained in:
@@ -90,6 +90,7 @@
|
||||
@import "controllers/carrier-wizard"
|
||||
@import "controllers/dashboard"
|
||||
@import "controllers/login"
|
||||
@import "controllers/modules_catalog"
|
||||
@import "controllers/modules"
|
||||
@import "controllers/search"
|
||||
@import "controllers/translations"
|
||||
|
||||
90
admin/themes/default/sass/controllers/_modules_catalog.sass
Normal file
90
admin/themes/default/sass/controllers/_modules_catalog.sass
Normal file
@@ -0,0 +1,90 @@
|
||||
#suggestion-wrapper-placeholder
|
||||
.panel
|
||||
text-align: center
|
||||
|
||||
#catalog-center-column
|
||||
padding: 0 30px
|
||||
.btn.btn-primary
|
||||
background: #1292FF
|
||||
border-radius: 5px
|
||||
.pagination-container
|
||||
text-align: center
|
||||
margin-bottom: 12px
|
||||
.list-container
|
||||
.list-header
|
||||
margin-bottom: 40px
|
||||
.title
|
||||
font-size: 24px
|
||||
color: #000000
|
||||
font-weight: 700
|
||||
.sort-label
|
||||
margin-top: 6px
|
||||
.explore-panel
|
||||
font-weight: 600
|
||||
font-size: 16px
|
||||
color: #000000
|
||||
|
||||
.bootstrap
|
||||
#catalog-center-column
|
||||
.list-empty
|
||||
background-color: unset !important
|
||||
|
||||
|
||||
#suggested-modules-list, #suggested-theme-list
|
||||
.suggested-elements
|
||||
display: -webkit-box
|
||||
display: -webkit-flex
|
||||
display: -ms-flexbox
|
||||
display: flex
|
||||
flex-wrap: wrap
|
||||
margin: 0 -15px
|
||||
.element-panel
|
||||
display: flex
|
||||
flex-direction: column
|
||||
margin-bottom: 25px
|
||||
> .panel
|
||||
border: unset
|
||||
box-shadow: 0px 3px 10px rgba(0, 0, 0, 0.05)
|
||||
margin: 0 10px
|
||||
height: 100%
|
||||
|
||||
|
||||
#suggested-modules-list
|
||||
.module-info-wrapper
|
||||
position: relative
|
||||
height: 100%
|
||||
.module-logo img
|
||||
max-height: 60px
|
||||
margin-bottom: 20px
|
||||
margin-right: 10px
|
||||
.panel-action
|
||||
.module-price
|
||||
font-size: 14px
|
||||
font-weight: 700
|
||||
|
||||
#suggested-theme-list
|
||||
.theme-info-wrapper
|
||||
position: relative
|
||||
height: 100%
|
||||
.theme-logo
|
||||
position: relative
|
||||
width: 100%
|
||||
padding-top: 70%
|
||||
img
|
||||
position: absolute
|
||||
top: 0
|
||||
left: 0
|
||||
right: 0
|
||||
bottom: 0
|
||||
height: 100%
|
||||
width: 100%
|
||||
object-fit: cover
|
||||
border-radius: 5px
|
||||
.panel-action
|
||||
.theme-price
|
||||
font-size: 14px
|
||||
font-weight: 700
|
||||
|
||||
#catalog-center-column
|
||||
.explore-panel
|
||||
margin-bottom: 60px
|
||||
@@ -204,3 +204,6 @@
|
||||
|
||||
.pointer
|
||||
cursor: pointer
|
||||
|
||||
#recommendation-wrapper
|
||||
margin-bottom: 20px
|
||||
@@ -102,6 +102,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{include file='recomended-banner.tpl'}
|
||||
<div class="row" id="recommendation-wrapper" style="display:none">
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-8 col-md-push-4 col-lg-7 col-lg-push-3" id="hookDashboardZoneTwo">
|
||||
<div class='row'>
|
||||
@@ -114,9 +117,16 @@
|
||||
<div class="col-md-4 col-md-pull-8 col-lg-2 col-lg-pull-0" id="hookDashboardZoneThree">
|
||||
<div class="row">
|
||||
{$hookDashboardZoneThree}
|
||||
{if isset($upgrade_info) && $upgrade_info}
|
||||
<div class="col-sm-12">
|
||||
<section class="widget panel">
|
||||
{$upgrade_info->dash_upgrade_panel}
|
||||
</section>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="col-sm-12">
|
||||
<section class="dash_links widget panel">
|
||||
<h3><i class="icon-link"></i> {l s="Useful links"}</h3>
|
||||
<h3><i class="icon-link"></i> {l s="Help Center"}</h3>
|
||||
<dl>
|
||||
<dt><a href="https://qloapps.com/qlo-reservation-system/" class="_blank">{l s="Official Documentation"}</a></dt>
|
||||
<dd>{l s="Qloapps User Guide"}</dd>
|
||||
|
||||
@@ -29,11 +29,6 @@
|
||||
<div class="col-lg-8">
|
||||
<div class="form-group">
|
||||
<label>{l s='Filter by'}</label>
|
||||
<select name="module_install" id="module_install_filter" class="form-control {if isset($showInstalledModules) && $showInstalledModules && $showInstalledModules != 'installedUninstalled' }active{/if}">
|
||||
<option value="installedUninstalled" {if $showInstalledModules eq 'installedUninstalled'}selected="selected"{/if}>{l s='Installed & Not Installed'}</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='Modules Not Installed '}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -71,10 +66,10 @@
|
||||
<!-- <span class="pull-right">
|
||||
<button class="btn btn-default " type="submit" name="resetFilterModules">
|
||||
<i class="icon-eraser"></i>
|
||||
{l s='Reset'}
|
||||
{l s='Reset'}
|
||||
</button>
|
||||
<button class="btn btn-default " name="filterModules" id="filterModulesButton" type="submit">
|
||||
<i class="icon-filter"></i>
|
||||
<i class="icon-filter"></i>
|
||||
{l s='Filter'}
|
||||
</button>
|
||||
</span> -->
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
if (module_name != '')
|
||||
$.uiTableFilter($('#moduleContainer').find('table'), module_name);
|
||||
|
||||
|
||||
$('#moduleQuicksearch').on('keyup', function(){
|
||||
val = this.value;
|
||||
if ($('#filter_all').hasClass('active'))
|
||||
@@ -86,15 +86,15 @@
|
||||
clearInterval(interval);
|
||||
interval = null;
|
||||
}
|
||||
|
||||
|
||||
}, 100);
|
||||
|
||||
|
||||
|
||||
|
||||
}).on('keydown', function(e){
|
||||
if (e.keyCode == 13)
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
$('input[name="filtername"]').result(function(event, data, formatted) {
|
||||
$('#filternameForm').submit();
|
||||
});
|
||||
@@ -114,7 +114,7 @@
|
||||
$(this).attr("rel", "false");
|
||||
$("input[name=modules]").removeAttr("checked");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Method to reload filter in ajax
|
||||
$('.categoryModuleFilterLink').click(function()
|
||||
@@ -212,12 +212,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
$(document).on('change', '#module_type_filter, #module_install_filter, #module_status_filter, #country_module_value_filter', function() {
|
||||
setFilter();
|
||||
$(document).on('change', '#module_type_filter, #module_install_filter, #module_status_filter, #country_module_value_filter', function() {
|
||||
setFilter();
|
||||
});
|
||||
|
||||
$('.moduleTabPreferencesChoise').change(function()
|
||||
{
|
||||
{
|
||||
var value_pref = $(this).val();
|
||||
var module_pref = $(this).attr('name');
|
||||
module_pref = module_pref.substring(2, module_pref.length);
|
||||
@@ -240,7 +240,7 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Method to save favorites preferences
|
||||
$('.moduleFavorite').change(function()
|
||||
{
|
||||
@@ -309,7 +309,7 @@
|
||||
else
|
||||
$('#favorite-count').html(total_favorites-1);
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
error: function(res,textStatus,jqXHR)
|
||||
{
|
||||
|
||||
@@ -27,9 +27,9 @@
|
||||
|
||||
<div class="modal-body">
|
||||
<div class="alert alert-warning">
|
||||
<h3>{l s='Do you want to install this module that could not be verified by PrestaShop?'}</h3>
|
||||
<h3>{l s='Do you want to install this module that could not be verified by QloApps?'}</h3>
|
||||
|
||||
<p>{l s="This generally happens when the module isn't distributed through our official marketplace, PrestaShop Addons - or when your server failed to communicate with PrestaShop Addons."}</p>
|
||||
<p>{l s="This generally happens when the module isn't distributed through our official marketplace, QloApps Addons - or when your server failed to communicate with QloApps Addons."}</p>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@@ -59,7 +59,7 @@
|
||||
<div class="modal-footer">
|
||||
<div class="alert alert-info">
|
||||
<p>
|
||||
{l s='Since you may not have downloaded this module from PrestaShop Addons, we cannot assert that the module is not adding some undisclosed functionalities. We advise you to install it only if you trust the source of the content.'}
|
||||
{l s='Since you may not have downloaded this module from QloApps Addons, we cannot assert that the module is not adding some undisclosed functionalities. We advise you to install it only if you trust the source of the content.'}
|
||||
<a id="untrusted-show-risk" href="#"><strong>{l s="What's the risk?"}</strong></a>
|
||||
</p>
|
||||
</div>
|
||||
@@ -74,13 +74,13 @@
|
||||
|
||||
<p>{l s="A module that hasn't been verified may be dangerous and could add hidden functionalities like backdoors, ads, hidden links, spam, etc. Don’t worry, this alert is simply a warning."}</p>
|
||||
|
||||
<p>{l s="PrestaShop, being an open-source software, has an awesome community with a long history of developing and sharing high quality modules. Before installing this module, making sure its author is a known community member is always a good idea (by checking [1]our forum[/1] for instance)." tags=['<a href="https://www.prestashop.com/forums/">']}</p>
|
||||
<p>{l s="QloApps, being an open-source software, has an awesome community with a long history of developing and sharing high quality modules. Before installing this module, making sure its author is a known community member is always a good idea (by checking [1]our forum[/1] for instance)." tags=['<a href="https://forums.qloapps.com/">']}</p>
|
||||
|
||||
<h4>{l s='What Should I Do?'}</h4>
|
||||
|
||||
|
||||
<p>{l s="If you trust or find the author of this module to be an active community member, you can proceed with the installation."}
|
||||
|
||||
<p>{l s="Otherwise you can look for similar modules on the official marketplace. [1]Click here to browse PrestaShop Addons[/1]." tags=['<a class="catalog-link" href="#">']}
|
||||
<p>{l s="Otherwise you can look for similar modules on the official marketplace. [1]Click here to browse QloApps Addons[/1]." tags=['<a class="catalog-link" href="https://qloapps.com/addons/" target="_blank">']}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -22,17 +22,59 @@
|
||||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*}
|
||||
<div class="panel">
|
||||
<ul class=" nav nav-pills">
|
||||
<li><a href="#mod-alert" data-toggle="tab">{l s="Alert"} <span class="badge {if $module_alerts|@count}badge-danger{else}badge-success{/if}">{$module_alerts|@count}</span></a></li>
|
||||
<li><a href="#mod-update" data-toggle="tab">{l s="Updates"} <span class="badge {if $upgrade_available|@count}badge-danger{else}badge-success{/if}">{$upgrade_available|@count}</span></a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div id="mod-alert" class="tab-pane">
|
||||
<hr>
|
||||
{if $module_alerts|@count}
|
||||
<div class="alert alert-warning">
|
||||
{l s='There are %d alerts regarding your modules.' sprintf=count($module_alerts)}
|
||||
<ul>
|
||||
{foreach from=$module_alerts item='alert'}
|
||||
<li>{$alert}</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{else}
|
||||
<div class="alert alert-success">
|
||||
{l s='There are no alerts regarding your modules.'}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div id="mod-update" class="tab-pane">
|
||||
<hr>
|
||||
{if $upgrade_available|@count}
|
||||
<div class="alert alert-info">
|
||||
{l s='An upgrade is available for some of your modules!'}
|
||||
<ul>
|
||||
{foreach from=$upgrade_available item='module'}
|
||||
<li><a href="{$currentIndex|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}&anchor={$module.anchor|escape:'html':'UTF-8'}"><b>{$module.displayName|escape:'html':'UTF-8'}</b></a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{else}
|
||||
<div class="alert alert-success">
|
||||
{l s='All modules are up to date!'}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="alert bg-info">
|
||||
<div class="row modules-addons-info">
|
||||
<h4>{l s='Explore all QloApps addons'} <a class="btn btn-default _blank" href="https://qloapps.com/addons/"> {l s='QloApps addons'}</a></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{$kpis}
|
||||
{if $add_permission eq '1'}
|
||||
<div id="module_install" class="row" style="{if !isset($smarty.post.downloadflag)}display: none;{/if}">
|
||||
|
||||
<div class="panel col-lg-12">
|
||||
<form action="{$currentIndex|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}" method="post" enctype="multipart/form-data" class="form-horizontal">
|
||||
<form id="module_install_form" action="{$currentIndex|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}" method="post" enctype="multipart/form-data" class="form-horizontal">
|
||||
<h3>{l s='Add a new module'}</h3>
|
||||
<p class="alert alert-info">{l s='The module must either be a Zip file (.zip) or a tarball file (.tar, .tar.gz, .tgz).'}</p>
|
||||
<div class="form-group">
|
||||
@@ -60,26 +102,32 @@
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-lg-9 col-lg-push-3">
|
||||
<button class="btn btn-default" type="submit" name="download">
|
||||
<button class="btn btn-default" type="submit" name="uploadAndInstall">
|
||||
<i class="icon-upload-alt" ></i>
|
||||
{l s='Upload this module'}
|
||||
{l s='Upload and install this module'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div id="module_install_status" class="form-group" style="display:none">
|
||||
<div class="col-lg-6 col-lg-push-3">
|
||||
<ul class="list-unstyled">
|
||||
<li class="mod_status_upload" style="display:none"><i class="icon-refresh icon-spin"></i> {l s='Uploading module.'}</li>
|
||||
<li class="mod_status_check" style="display:none"><i class="icon-refresh icon-spin"></i> {l s='Checking module if module is trusted.'}</li>
|
||||
<li class="mod_status_install" style="display:none"><i class="icon-refresh icon-spin"></i> {l s='Installing module.'}</li>
|
||||
<li class="mod_status_update" style="display:none"><i class="icon-refresh icon-spin"></i> {l s='Module already installed, checking and installing updates.'}</li>
|
||||
<li class="mod_status_rollback" style="display:none"><i class="icon-refresh icon-spin"></i> {l s='Rolling back changes.'}</li>
|
||||
</ul>
|
||||
<div class="install_msg"></div>
|
||||
<div class="install_errors" style="display:none">
|
||||
{l s='Errors.'}
|
||||
<div class="list"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{if $upgrade_available|@count}
|
||||
<div class="alert alert-info">
|
||||
{l s='An upgrade is available for some of your modules!'}
|
||||
<ul>
|
||||
{foreach from=$upgrade_available item='module'}
|
||||
<li><a href="{$currentIndex|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}&anchor={$module.anchor|escape:'html':'UTF-8'}"><b>{$module.displayName|escape:'html':'UTF-8'}</b></a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="panel">
|
||||
<div class="panel-heading">
|
||||
<i class="icon-list-ul"></i>
|
||||
|
||||
@@ -40,14 +40,19 @@
|
||||
{assign var='modules' value=''}
|
||||
{foreach from=$upgrade_available item='module'}
|
||||
{assign var='modules' value=$modules|cat:$module.name:'|'}
|
||||
{if $module.is_native}
|
||||
{assign var='native_upgade' value=true}
|
||||
{/if}
|
||||
{/foreach}
|
||||
{assign var='modules' value=$modules|substr:0:-1}
|
||||
<li>
|
||||
<a id="desc-module-update-all" class="toolbar_btn" href="{$currentIndex|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}&updateAll=1" title="{l s='Update all'}">
|
||||
<i class="process-icon-refresh"></i>
|
||||
<div>{l s='Update all'}</div>
|
||||
</a>
|
||||
</li>
|
||||
{if isset($native_upgade) && $native_upgade}
|
||||
<li>
|
||||
<a id="desc-module-update-all" class="toolbar_btn" href="{$currentIndex|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}&updateAll=1" title="{l s='Update all'}">
|
||||
<i class="process-icon-refresh"></i>
|
||||
<div>{l s='Update all'}</div>
|
||||
</a>
|
||||
</li>
|
||||
{/if}
|
||||
{else}
|
||||
<li>
|
||||
<a id="desc-module-check-and-update-all" class="toolbar_btn" href="{$currentIndex|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}&check=1" title="{l s='Check for update'}">
|
||||
@@ -56,6 +61,12 @@
|
||||
</a>
|
||||
</li>
|
||||
{/if}
|
||||
<li>
|
||||
<a id="desc-module-catalog" class="toolbar_btn anchor" href="{$link->getAdminLink('AdminModulesCatalog')}" title="{l s='Recommended Modules and Services'}">
|
||||
<i class="process-icon-modules-list"></i>
|
||||
<div>{l s='Recommended Modules and Services'}</div>
|
||||
</a>
|
||||
</li>
|
||||
{if $add_permission eq '1' && ($context_mode != Context::MODE_HOST)}
|
||||
<li>
|
||||
<a id="desc-module-new" class="toolbar_btn anchor" href="#" onclick="$('#module_install').slideToggle();" title="{l s='Add a new module'}">
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
{if $is_addons_partner}
|
||||
<a class="btn btn-success btn-lg pull-right" href="{$url}">{l s='Install module'}</a>
|
||||
{else}
|
||||
<a class="btn btn-success btn-lg pull-right" href="{$url}" onclick="return !window.open(this.href);">{l s='View on PrestaShop Addons'}</a>
|
||||
<a class="btn btn-success btn-lg pull-right" href="{$url}" onclick="return !window.open(this.href);">{l s='View on QloApps store'}</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -35,8 +35,6 @@
|
||||
<small class="text-muted">v{$module->version} - by {$module->author}</small>
|
||||
{if isset($module->type) && $module->type == 'addonsBought'}
|
||||
- <span class="module-badge-bought help-tooltip text-warning" data-title="{l s="You bought this module on QloApps Addons. Thank You."}"><i class="icon-pushpin"></i> <small>{l s="Bought"}</small></span>
|
||||
{elseif isset($module->type) && $module->type == 'addonsMustHave'}
|
||||
- <span class="module-badge-popular help-tooltip text-primary" data-title="{l s="This module is available on QloApps Addons"}"><i class="icon-group"></i> <small>{l s="Popular"}</small></span>
|
||||
{elseif isset($module->type) && $module->type == 'addonsPartner'}
|
||||
- <span class="module-badge-partner help-tooltip text-warning" data-title="{l s="This module is available for free thanks to our partner."}"><i class="icon-pushpin"></i> <small>{l s="Official"}</small></span>
|
||||
{elseif isset($module->id) && $module->id gt 0}
|
||||
|
||||
@@ -25,46 +25,16 @@
|
||||
*}
|
||||
|
||||
{if isset($tab_modules_list) && !empty($tab_modules_list)}
|
||||
<div class="row row-margin-bottom">
|
||||
<div class="col-lg-12">
|
||||
<ul class="nav nav-pills">
|
||||
{if count($tab_modules_list.not_installed)}
|
||||
<li class="active">
|
||||
<a href="#tab_modules_list_not_installed" data-toggle="tab">
|
||||
{l s='Not Installed'}
|
||||
</a>
|
||||
</li>
|
||||
{/if}
|
||||
{if count($tab_modules_list.installed)}
|
||||
<li {if count($tab_modules_list.not_installed) == 0}class="active"{/if}>
|
||||
<a href="#tab_modules_list_installed" data-toggle="tab">
|
||||
{l s='Installed'}
|
||||
</a>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div id="modules_list_container_content" class="tab-content modal-content-overflow">
|
||||
{if count($tab_modules_list.not_installed)}
|
||||
<div class="tab-pane active" id="tab_modules_list_not_installed">
|
||||
<table id="tab_modules_list_not_installed" class="table">
|
||||
{foreach from=$tab_modules_list.not_installed item=module}
|
||||
{include file='controllers/modules/tab_module_line.tpl' class_row={cycle values=",rowalt"}}
|
||||
{/foreach}
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
{if count($tab_modules_list.installed)}
|
||||
<div class="tab-pane {if count($tab_modules_list.not_installed) == 0}active{/if}" id="tab_modules_list_installed">
|
||||
<table id="tab_modules_list_installed" class="table">
|
||||
{foreach from=$tab_modules_list.installed item=module}
|
||||
{include file='controllers/modules/tab_module_line.tpl' class_row={cycle values=",rowalt"}}
|
||||
{/foreach}
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<table id="tab_modules_list_not_installed" class="table">
|
||||
{foreach from=$tab_modules_list.not_installed item=module}
|
||||
{include file='controllers/modules/tab_module_line.tpl' class_row={cycle values=",rowalt"}}
|
||||
{/foreach}
|
||||
</table>
|
||||
<table id="tab_modules_list_installed" class="table">
|
||||
{foreach from=$tab_modules_list.installed item=module}
|
||||
{include file='controllers/modules/tab_module_line.tpl' class_row={cycle values=",rowalt"}}
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
||||
<div class="alert alert-addons row-margin-top">
|
||||
<a href="https://qloapps.com/addons" onclick="return !window.open(this.href);">{l s='More modules on qloapps.com/addons/'}</a>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<div id="ajax_confirmation" class="alert alert-success hide"></div>
|
||||
{* ajaxBox allows*}
|
||||
<div id="ajaxBox" style="display:none"></div>
|
||||
|
||||
{* {include file='controllers/modules_catalog/recomended-banner.tpl'} *}
|
||||
{include file='recomended-banner.tpl'}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
{include file='controllers/modules_catalog/page.tpl'}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../');
|
||||
exit;
|
||||
@@ -0,0 +1,51 @@
|
||||
{*
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*}
|
||||
|
||||
<div class="suggested-elements row">
|
||||
{foreach $elements as $element}
|
||||
<div class="col-xs-12 col-sm-6 col-md-4 element-panel">
|
||||
<div class="panel">
|
||||
<div class="module-info-wrapper">
|
||||
<div class="module-logo clearfix">
|
||||
<img src="{if isset($element->image)}{$element->image}{else}{$modules_uri}/{$element->name}/{$element->logo}{/if}" title="{$element->displayName}" class="pull-left">
|
||||
<h4 class="name" data-name="{$element->name}">{$element->displayName}</h4>
|
||||
<p class="text-muted">{$element->version} {l s='By'} {$element->author}</p>
|
||||
</div>
|
||||
<p>
|
||||
{if $element->description_full}
|
||||
{$element->description_full|truncate:90:"..."}
|
||||
{else}
|
||||
{$element->description|truncate:90:"..."}
|
||||
{/if}
|
||||
{* <a href="{if $element->element_type == $element_type_module}{$currentIndex|escape:'html':'UTF-8'}&token={$token|escape:'html':'UTF-8'}&ajax=1&action=GetModuleQuickView&module={$element->name|urlencode}{else}{$element->addons_buy_url|replace:' ':'+'|escape:'html':'UTF-8'}{/if}" class="fancybox-quick-view pull-right">{l s='Read more'}</a> *}
|
||||
</p>
|
||||
<div class="panel-action clearfix">
|
||||
{if isset($element->type) && $element->type == 'addonsMustHave' && $element->not_on_disk}
|
||||
<span class="module-price">{if isset($element->price)}{if $element->price|floatval == 0}{l s='Free'}{elseif isset($element->id_currency)}{displayPrice price=$element->price currency=$element->id_currency}{/if}{/if}</span>
|
||||
<a class="btn button-action pull-right btn-primary _blank" href="{$element->addons_buy_url|replace:' ':'+'|escape:'html':'UTF-8'}">{l s='Explore'}</a>
|
||||
{else}
|
||||
{* <a class="btn button-action pull-right btn-primary{if !$element->trusted} untrustedaddon{/if}" {if !$element->trusted} data-target="#moduleNotTrusted" data-toggle="modal"{/if} data-link="{$element->options.install_url|escape:'html':'UTF-8'}" data-module-display-name="{$element->displayName|escape:'html':'UTF-8'}" data-module-name="{$element->name|escape:'html':'UTF-8'}" data-module-image="{if isset($element->image)}{$element->image}{else}{$modules_uri}/{$element->name}/{$element->logo}{/if}" data-author-name="{$element->author|escape:'html':'UTF-8'}" data-author-uri="{if isset($element->author_uri)}{$element->author_uri|escape:'html':'UTF-8'}{/if}" href="{if !$element->trusted}#{else}{$element->options.install_url|escape:'html':'UTF-8'}{/if}" title="{l s='Install'}">{l s='Install'}</a> *}
|
||||
<a class="btn button-action pull-right btn-primary" data-link="{$element->options.install_url|escape:'html':'UTF-8'}" data-module-display-name="{$element->displayName|escape:'html':'UTF-8'}" data-module-name="{$element->name|escape:'html':'UTF-8'}" data-module-image="{if isset($element->image)}{$element->image}{else}{$modules_uri}/{$element->name}/{$element->logo}{/if}" data-author-name="{$element->author|escape:'html':'UTF-8'}" data-author-uri="{if isset($element->author_uri)}{$element->author_uri|escape:'html':'UTF-8'}{/if}" href="#" title="{l s='Install'}">{l s='Install'}</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
@@ -0,0 +1,116 @@
|
||||
{*
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*}
|
||||
<div id="catalog-center-column">
|
||||
{if isset($modules) && $modules}
|
||||
<div id="suggested-modules-list" class="row list-container">
|
||||
<div class="col-sm-12">
|
||||
<div class="row form-horizontal list-header">
|
||||
<div class="pull-left col-sm-6 title">{l s='Suggested Modules'} </div>
|
||||
<div class="pull-right col-sm-3">
|
||||
<div class="input-group">
|
||||
<input type="text" name="module-search" id="module-search" placeholder="{l s='Search module name...'}">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-search"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{if isset($sort_criterta) && $sort_criterta}
|
||||
<div class="pull-right col-sm-3">
|
||||
<div class="row">
|
||||
<label class="pull-left sort-label"><span>{l s='Sort By :'}</span></label>
|
||||
<div class="col-sm-9">
|
||||
<select name="module-sort" id="module-sort">
|
||||
{foreach $sort_criterta as $criteria}
|
||||
<option value="{$criteria['value']}" {if $criteria['value'] == $module_sort}selected{/if}>{$criteria['title']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{include file='controllers/modules_catalog/modules_list.tpl' elements=$modules}
|
||||
<div class="list-empty" style="display:none">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No modules found'}
|
||||
</div>
|
||||
</div>
|
||||
<div class="pagination-container">
|
||||
<ul class="pagination-block"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel explore-panel text-center">
|
||||
{l s='Explore all addon of Qloapps'}
|
||||
<a href="https://qloapps.com/addons/" class="btn btn-primary btn-lg">{l s='QloApps Addons'}</a>
|
||||
</div>
|
||||
{/if}
|
||||
{if isset($themes) && $themes}
|
||||
<div id="suggested-theme-list" class="row list-container">
|
||||
<div class="col-sm-12">
|
||||
<div class="row form-horizontal list-header">
|
||||
{* <div class="row"> *}
|
||||
<div class="pull-left col-sm-6 title">{l s='Suggested Themes'} </div>
|
||||
|
||||
<div class="pull-right col-sm-3">
|
||||
<div class="input-group">
|
||||
<input type="text" name="theme-search" id="theme-search" placeholder="{l s='Search theme name...'}">
|
||||
<span class="input-group-addon">
|
||||
<i class="icon-search"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{if isset($sort_criterta) && $sort_criterta}
|
||||
<div class="pull-right col-sm-3">
|
||||
<div class="row">
|
||||
{* <div class="col-sm-3"> *}
|
||||
<label class="pull-left sort-label"><span>{l s='Sort By :'}</span></label>
|
||||
{* </div> *}
|
||||
<div class="col-sm-9">
|
||||
<select name="theme-sort" id="theme-sort">
|
||||
{foreach $sort_criterta as $criteria}
|
||||
<option value="{$criteria['value']}" {if $criteria['value'] == $theme_sort}selected{/if}>{$criteria['title']}</option>
|
||||
{/foreach}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{* </div> *}
|
||||
</div>
|
||||
{include file='controllers/modules_catalog/theme_list.tpl' elements=$themes}
|
||||
<div class="list-empty" style="display:none">
|
||||
<div class="list-empty-msg">
|
||||
<i class="icon-warning-sign list-empty-icon"></i>
|
||||
{l s='No themes found'}
|
||||
</div>
|
||||
</div>
|
||||
<div class="pagination-container">
|
||||
<ul class="pagination-block"></ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel explore-panel text-center">
|
||||
{l s='Explore all themes of Qloapps'}
|
||||
<a href="https://store.webkul.com/Qloapps/responsive.html" class="btn btn-primary btn-lg">{l s='QloApps Themes'}</a>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,46 @@
|
||||
{*
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*}
|
||||
|
||||
<div class="suggested-elements row">
|
||||
{foreach $elements as $element}
|
||||
<div class="col-sm-6 col-md-6 element-panel">
|
||||
<div class="panel">
|
||||
<div class="theme-info-wrapper">
|
||||
<div class="theme-logo clearfix">
|
||||
<img src="{if isset($element->image)}{$element->image}{else}{$modules_uri}/{$element->name}/{$element->logo}{/if}" title="{$element->displayName}">
|
||||
|
||||
</div>
|
||||
<h4 class="name" data-name="{$element->name}">{$element->displayName}</h4>
|
||||
<p class="text-muted">{$element->version} {l s='By'} {$element->author}</p>
|
||||
<p>
|
||||
{if $element->description_full}{$element->description_full|truncate:180:"..."}{else}{$element->description|truncate:180:"..."}{/if}
|
||||
</p>
|
||||
<div class="panel-action clearfix">
|
||||
{if isset($element->type) && $element->type == 'addonsMustHave'}
|
||||
<span class="theme-price">{if isset($element->price)}{if $element->price|floatval == 0}{l s='Free'}{elseif isset($element->id_currency)}{displayPrice price=$element->price currency=$element->id_currency}{/if}{/if}</span>
|
||||
<a class="btn button-action pull-right btn-primary _blank" href="{$element->addons_buy_url|replace:' ':'+'|escape:'html':'UTF-8'}">{l s='Explore'}</a>
|
||||
{else}
|
||||
<a class="btn button-action pull-right btn-primary" href="{$element->options.install_url|escape:'html':'UTF-8'}" title="{l s='Install'}">{l s='Install'}</a>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/foreach}
|
||||
</div>
|
||||
@@ -135,167 +135,171 @@
|
||||
<a id="header_shopname" href="{$default_tab_link|escape:'html':'UTF-8'}">{$shop_name}</a>
|
||||
{/if}
|
||||
<ul id="header_notifs_icon_wrapper">
|
||||
{if {$show_new_orders} == 1}
|
||||
<li id="orders_notif" class="dropdown" data-type="order">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle notifs" data-toggle="dropdown">
|
||||
<i class="icon-shopping-cart"></i>
|
||||
<span id="orders_notif_number_wrapper" class="notifs_badge hide">
|
||||
<span id="orders_notif_value">0</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu notifs_dropdown">
|
||||
<section id="orders_notif_wrapper" class="notifs_panel">
|
||||
<div class="notifs_panel_header">
|
||||
<h3>{l s='Latest Orders'}</h3>
|
||||
</div>
|
||||
<div id="list_orders_notif" class="list_notif">
|
||||
<span class="no_notifs">
|
||||
{l s='No new orders have been placed on your shop.'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="notifs_panel_footer">
|
||||
<a href="index.php?controller=AdminOrders&token={getAdminToken tab='AdminOrders'}">{l s='Show all orders'}</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
{if {$show_new_customers} == 1}
|
||||
<li id="customers_notif" class="dropdown" data-type="customer">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle notifs" data-toggle="dropdown">
|
||||
<i class="icon-user"></i>
|
||||
<span id="customers_notif_number_wrapper" class="notifs_badge hide">
|
||||
<span id="customers_notif_value">0</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu notifs_dropdown">
|
||||
<section id="customers_notif_wrapper" class="notifs_panel">
|
||||
<div class="notifs_panel_header">
|
||||
<h3>{l s='Latest Registrations'}</h3>
|
||||
</div>
|
||||
<div id="list_customers_notif" class="list_notif">
|
||||
<span class="no_notifs">
|
||||
{l s='No new customers have registered on your shop.'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="notifs_panel_footer">
|
||||
<a href="index.php?controller=AdminCustomers&token={getAdminToken tab='AdminCustomers'}">{l s='Show all customers'}</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
{if {$show_new_messages} == 1}
|
||||
<li id="customer_messages_notif" class="dropdown" data-type="customer_message">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle notifs" data-toggle="dropdown">
|
||||
<i class="icon-envelope"></i>
|
||||
<span id="customer_messages_notif_number_wrapper" class="notifs_badge hide">
|
||||
<span id="customer_messages_notif_value" >0</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu notifs_dropdown">
|
||||
<section id="customer_messages_notif_wrapper" class="notifs_panel">
|
||||
<div class="notifs_panel_header">
|
||||
<h3>{l s='Latest Messages'}</h3>
|
||||
</div>
|
||||
<div id="list_customer_messages_notif" class="list_notif">
|
||||
<span class="no_notifs">
|
||||
{l s='No new messages have been posted on your shop.'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="notifs_panel_footer">
|
||||
<a href="index.php?controller=AdminCustomerThreads&token={getAdminToken tab='AdminCustomerThreads'}">{l s='Show all messages'}</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
{if {$show_new_orders} == 1}
|
||||
<li id="orders_notif" class="dropdown" data-type="order">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle notifs" data-toggle="dropdown">
|
||||
<i class="icon-shopping-cart"></i>
|
||||
<span id="orders_notif_number_wrapper" class="notifs_badge hide">
|
||||
<span id="orders_notif_value">0</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu notifs_dropdown">
|
||||
<section id="orders_notif_wrapper" class="notifs_panel">
|
||||
<div class="notifs_panel_header">
|
||||
<h3>{l s='Latest Orders'}</h3>
|
||||
</div>
|
||||
<div id="list_orders_notif" class="list_notif">
|
||||
<span class="no_notifs">
|
||||
{l s='No new orders have been placed on your shop.'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="notifs_panel_footer">
|
||||
<a href="index.php?controller=AdminOrders&token={getAdminToken tab='AdminOrders'}">{l s='Show all orders'}</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
{if {$show_new_customers} == 1}
|
||||
<li id="customers_notif" class="dropdown" data-type="customer">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle notifs" data-toggle="dropdown">
|
||||
<i class="icon-user"></i>
|
||||
<span id="customers_notif_number_wrapper" class="notifs_badge hide">
|
||||
<span id="customers_notif_value">0</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu notifs_dropdown">
|
||||
<section id="customers_notif_wrapper" class="notifs_panel">
|
||||
<div class="notifs_panel_header">
|
||||
<h3>{l s='Latest Registrations'}</h3>
|
||||
</div>
|
||||
<div id="list_customers_notif" class="list_notif">
|
||||
<span class="no_notifs">
|
||||
{l s='No new customers have registered on your shop.'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="notifs_panel_footer">
|
||||
<a href="index.php?controller=AdminCustomers&token={getAdminToken tab='AdminCustomers'}">{l s='Show all customers'}</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
{if {$show_new_messages} == 1}
|
||||
<li id="customer_messages_notif" class="dropdown" data-type="customer_message">
|
||||
<a href="javascript:void(0);" class="dropdown-toggle notifs" data-toggle="dropdown">
|
||||
<i class="icon-envelope"></i>
|
||||
<span id="customer_messages_notif_number_wrapper" class="notifs_badge hide">
|
||||
<span id="customer_messages_notif_value" >0</span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="dropdown-menu notifs_dropdown">
|
||||
<section id="customer_messages_notif_wrapper" class="notifs_panel">
|
||||
<div class="notifs_panel_header">
|
||||
<h3>{l s='Latest Messages'}</h3>
|
||||
</div>
|
||||
<div id="list_customer_messages_notif" class="list_notif">
|
||||
<span class="no_notifs">
|
||||
{l s='No new messages have been posted on your shop.'}
|
||||
</span>
|
||||
</div>
|
||||
<div class="notifs_panel_footer">
|
||||
<a href="index.php?controller=AdminCustomerThreads&token={getAdminToken tab='AdminCustomerThreads'}">{l s='Show all messages'}</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
{if count($quick_access) >= 0}
|
||||
<ul id="header_quick">
|
||||
<li class="dropdown">
|
||||
<a href="javascript:void(0)" id="quick_select" class="dropdown-toggle" data-toggle="dropdown">{l s='Quick Access'} <i class="icon-caret-down"></i></a>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach $quick_access as $quick}
|
||||
<li {if $link->matchQuickLink({$quick.link})}{assign "matchQuickLink" $quick.id_quick_access}class="active"{/if}>
|
||||
<a href="{$quick.link|escape:'html':'UTF-8'}"{if $quick.new_window} class="_blank"{/if}>
|
||||
{if isset($quick.icon)}
|
||||
<i class="icon-{$quick.icon} icon-fw"></i>
|
||||
{else}
|
||||
<i class="icon-chevron-right icon-fw"></i>
|
||||
{/if}
|
||||
{$quick.name}
|
||||
{if count($quick_access) >= 0}
|
||||
<ul id="header_quick">
|
||||
<li class="dropdown">
|
||||
<a href="javascript:void(0)" id="quick_select" class="dropdown-toggle" data-toggle="dropdown">{l s='Quick Access'} <i class="icon-caret-down"></i></a>
|
||||
<ul class="dropdown-menu">
|
||||
{foreach $quick_access as $quick}
|
||||
<li {if $link->matchQuickLink({$quick.link})}{assign "matchQuickLink" $quick.id_quick_access}class="active"{/if}>
|
||||
<a href="{$quick.link|escape:'html':'UTF-8'}"{if $quick.new_window} class="_blank"{/if}>
|
||||
{if isset($quick.icon)}
|
||||
<i class="icon-{$quick.icon} icon-fw"></i>
|
||||
{else}
|
||||
<i class="icon-chevron-right icon-fw"></i>
|
||||
{/if}
|
||||
{$quick.name}
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
<li class="divider"></li>
|
||||
{if isset($matchQuickLink)}
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="ajax-quick-link" data-method="remove" data-quicklink-id="{$matchQuickLink}">
|
||||
<i class="icon-minus-circle"></i>
|
||||
{l s='Remove from QuickAccess'}
|
||||
</a>
|
||||
</li>
|
||||
{/if}
|
||||
<li {if isset($matchQuickLink)}class="hide"{/if}>
|
||||
<a href="javascript:void(0);" class="ajax-quick-link" data-method="add">
|
||||
<i class="icon-plus-circle"></i>
|
||||
{l s='Add current page to QuickAccess'}
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
<li class="divider"></li>
|
||||
{if isset($matchQuickLink)}
|
||||
<li>
|
||||
<a href="javascript:void(0);" class="ajax-quick-link" data-method="remove" data-quicklink-id="{$matchQuickLink}">
|
||||
<i class="icon-minus-circle"></i>
|
||||
{l s='Remove from QuickAccess'}
|
||||
</a>
|
||||
</li>
|
||||
{/if}
|
||||
<li {if isset($matchQuickLink)}class="hide"{/if}>
|
||||
<a href="javascript:void(0);" class="ajax-quick-link" data-method="add">
|
||||
<i class="icon-plus-circle"></i>
|
||||
{l s='Add current page to QuickAccess'}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
{$quick_access_current_link_name = " - "|explode:$quick_access_current_link_name}
|
||||
<script>
|
||||
$(function() {
|
||||
$('.ajax-quick-link').on('click', function(e){
|
||||
e.preventDefault();
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
{$quick_access_current_link_name = " - "|explode:$quick_access_current_link_name}
|
||||
<script>
|
||||
$(function() {
|
||||
$('.ajax-quick-link').on('click', function(e){
|
||||
e.preventDefault();
|
||||
|
||||
var method = $(this).data('method');
|
||||
var method = $(this).data('method');
|
||||
|
||||
if(method == 'add')
|
||||
var name = prompt('{l s='Please name this shortcut:' js=1}', '{$quick_access_current_link_name.0|truncate:32}');
|
||||
if(method == 'add')
|
||||
var name = prompt('{l s='Please name this shortcut:' js=1}', '{$quick_access_current_link_name.0|truncate:32}');
|
||||
|
||||
if(method == 'add' && name || method == 'remove')
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: { "cache-control": "no-cache" },
|
||||
async: false,
|
||||
url: "{$link->getAdminLink('AdminQuickAccesses')}" + "&action=GetUrl" + "&rand={1|rand:200}" + "&ajax=1" + "&method=" + method + ( $(this).data('quicklink-id') ? "&id_quick_access=" + $(this).data('quicklink-id') : ""),
|
||||
data: {
|
||||
"url": "{$link->getQuickLink($smarty.server['REQUEST_URI'])}",
|
||||
"name": name,
|
||||
"icon": "{$quick_access_current_link_icon}"
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
var quicklink_list ='';
|
||||
$.each(data, function(index,value){
|
||||
if (typeof data[index]['name'] !== 'undefined')
|
||||
quicklink_list += '<li><a href="' + data[index]['link'] + '&token=' + data[index]['token'] + '"><i class="icon-chevron-right"></i> ' + data[index]['name'] + '</a></li>';
|
||||
});
|
||||
|
||||
if (typeof data['has_errors'] !== 'undefined' && data['has_errors'])
|
||||
$.each(data, function(index, value)
|
||||
{
|
||||
if (typeof data[index] == 'string')
|
||||
$.growl.error({ title: "", message: data[index]});
|
||||
if(method == 'add' && name || method == 'remove')
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
headers: { "cache-control": "no-cache" },
|
||||
async: false,
|
||||
url: "{$link->getAdminLink('AdminQuickAccesses')}" + "&action=GetUrl" + "&rand={1|rand:200}" + "&ajax=1" + "&method=" + method + ( $(this).data('quicklink-id') ? "&id_quick_access=" + $(this).data('quicklink-id') : ""),
|
||||
data: {
|
||||
"url": "{$link->getQuickLink($smarty.server['REQUEST_URI'])}",
|
||||
"name": name,
|
||||
"icon": "{$quick_access_current_link_icon}"
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
var quicklink_list ='';
|
||||
$.each(data, function(index,value){
|
||||
if (typeof data[index]['name'] !== 'undefined')
|
||||
quicklink_list += '<li><a href="' + data[index]['link'] + '&token=' + data[index]['token'] + '"><i class="icon-chevron-right"></i> ' + data[index]['name'] + '</a></li>';
|
||||
});
|
||||
else if (quicklink_list)
|
||||
{
|
||||
$("#header_quick ul.dropdown-menu").html(quicklink_list);
|
||||
showSuccessMessage(update_success_msg);
|
||||
|
||||
if (typeof data['has_errors'] !== 'undefined' && data['has_errors'])
|
||||
$.each(data, function(index, value)
|
||||
{
|
||||
if (typeof data[index] == 'string')
|
||||
$.growl.error({ title: "", message: data[index]});
|
||||
});
|
||||
else if (quicklink_list)
|
||||
{
|
||||
$("#header_quick ul.dropdown-menu").html(quicklink_list);
|
||||
showSuccessMessage(update_success_msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/if}
|
||||
</script>
|
||||
{/if}
|
||||
|
||||
<ul id="header_employee_box">
|
||||
{if $upgrade_info->update_available > 0}
|
||||
<li class="hidden-md hidden-sm hidden-xs"><a href="{$upgrade_info->upgrade_url}">{l s='QloApps Update Availabe:'} {$upgrade_info->latest_availabe}</a></li>
|
||||
{/if}
|
||||
<li class="hidden-sm hidden-xs">
|
||||
<a target="_blank" href="https://qloapps.com/addons/" class="toolbar_btn" title="{l s='Explore QloApps Addons'}">
|
||||
<i class="icon-chain-broken"></i>
|
||||
@@ -303,20 +307,20 @@
|
||||
</a>
|
||||
</li>
|
||||
{if {$base_url}}
|
||||
<li>
|
||||
<a href="{if isset($base_url_tc)}{$base_url_tc|escape:'html':'UTF-8'}{else}{$base_url|escape:'html':'UTF-8'}{/if}" id="header_foaccess" class="_blank" title="{l s='View my shop'}">
|
||||
<span class="string-long">{l s='My site'}</span>
|
||||
<span class="string-short">{l s='Site'}</span>
|
||||
</a>
|
||||
{if isset($maintenance_mode) && $maintenance_mode == true}
|
||||
<span class="maintenance-mode">
|
||||
—
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-placement="bottom" data-html="true"
|
||||
title="<p class='text-left text-nowrap'><strong>{l s='Your site is in maintenance.'}</strong></p><p class='text-left'>{l s='Your visitors and customers cannot access your shop while in maintenance mode.%s To manage the maintenance settings, go to Preferences > Maintenance.' sprintf='<br />'}</p>">{l s='Maintenance mode'}</span>
|
||||
</span>
|
||||
{/if}
|
||||
</li>
|
||||
{/if}
|
||||
<li>
|
||||
<a href="{if isset($base_url_tc)}{$base_url_tc|escape:'html':'UTF-8'}{else}{$base_url|escape:'html':'UTF-8'}{/if}" id="header_foaccess" class="_blank" title="{l s='View my shop'}">
|
||||
<span class="string-long">{l s='My site'}</span>
|
||||
<span class="string-short">{l s='Site'}</span>
|
||||
</a>
|
||||
{if isset($maintenance_mode) && $maintenance_mode == true}
|
||||
<span class="maintenance-mode">
|
||||
—
|
||||
<span class="label-tooltip" data-toggle="tooltip" data-placement="bottom" data-html="true"
|
||||
title="<p class='text-left text-nowrap'><strong>{l s='Your site is in maintenance.'}</strong></p><p class='text-left'>{l s='Your visitors and customers cannot access your shop while in maintenance mode.%s To manage the maintenance settings, go to Preferences > Maintenance.' sprintf='<br />'}</p>">{l s='Maintenance mode'}</span>
|
||||
</span>
|
||||
{/if}
|
||||
</li>
|
||||
{/if}
|
||||
<li id="employee_infos" class="dropdown">
|
||||
<a href="{$link->getAdminLink('AdminEmployees')|escape:'html':'UTF-8'}&id_employee={$employee->id|intval}&updateemployee" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<span class="string-long">{$employee->firstname} {$employee->lastname}</span>
|
||||
@@ -333,11 +337,12 @@
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<span id="ajax_running">
|
||||
<i class="icon-refresh icon-spin icon-fw"></i>
|
||||
</span>
|
||||
|
||||
{if isset($displayBackOfficeTop)}{$displayBackOfficeTop}{/if}
|
||||
{if isset($displayBackOfficeTop)}{$displayBackOfficeTop}{/if}
|
||||
</div>
|
||||
</nav>{* end header_infos*}
|
||||
</header>
|
||||
@@ -349,13 +354,13 @@
|
||||
{if isset($page_header_toolbar)}{$page_header_toolbar}{/if}
|
||||
{if isset($modal_module_list)}{$modal_module_list}{/if}
|
||||
|
||||
{if $install_dir_exists}
|
||||
{if $install_dir_exists}
|
||||
<div class="alert alert-warning">
|
||||
{l s='For security reasons, you must also delete the /install folder.'}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{hook h='displayAdminAfterHeader'}
|
||||
{hook h='displayAdminAfterHeader'}
|
||||
|
||||
|
||||
{* end display_header*}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
{counter}
|
||||
{/foreach}
|
||||
</table>
|
||||
{if $controller_name == 'AdminPayment' && isset($view_all)}
|
||||
{* {if $controller_name == 'AdminPayment' && isset($view_all)}
|
||||
<div class="panel-footer">
|
||||
<div class="col-lg-4 col-lg-offset-4">
|
||||
<a class="btn btn-default btn-block" href="index.php?tab=AdminModules&token={getAdminToken tab='AdminModules'}&filterCategory=payments_gateways">
|
||||
@@ -46,7 +46,7 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if} *}
|
||||
{else}
|
||||
<table class="table">
|
||||
<tr>
|
||||
|
||||
@@ -105,7 +105,6 @@
|
||||
</li>
|
||||
{/if} *}
|
||||
</ul>
|
||||
{if (isset($tab_modules_open) && $tab_modules_open) || isset($tab_modules_list)}
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var modules_list_loaded = false;
|
||||
@@ -116,15 +115,12 @@
|
||||
|
||||
});
|
||||
{/if}
|
||||
{if isset($tab_modules_list)}
|
||||
$('.process-icon-modules-list').parent('a').unbind().bind('click', function (){
|
||||
$('#modules_list_container').modal('show');
|
||||
openModulesList();
|
||||
});
|
||||
{/if}
|
||||
$('.process-icon-modules-list').parent('a').unbind().bind('click', function (){
|
||||
$('#modules_list_container').modal('show');
|
||||
openModulesList();
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
42
admin/themes/default/template/recomended-banner.tpl
Normal file
42
admin/themes/default/template/recomended-banner.tpl
Normal file
@@ -0,0 +1,42 @@
|
||||
{*
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*}
|
||||
|
||||
<div id="recommendation-wrapper-skeleton">
|
||||
<script>
|
||||
loadRecommendation();
|
||||
</script>
|
||||
<div class="col-sm-12">
|
||||
<div class="banner panel">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="skeleton-loading-pulse loading-container-bar"></div>
|
||||
<div class="loading-container-bar"></div>
|
||||
<div class="skeleton-loading-pulse loading-container-bar"></div>
|
||||
<div class="loading-container-bar"></div>
|
||||
<div class="skeleton-loading-pulse loading-container-bar"></div>
|
||||
<div class="loading-container-bar"></div>
|
||||
<div class="skeleton-loading-pulse loading-container-bar"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="recommendation-wrapper" style="display:none">
|
||||
</div>
|
||||
@@ -46,8 +46,6 @@ class TabCore extends ObjectModel
|
||||
/** @var int hide_host_mode */
|
||||
public $hide_host_mode = false;
|
||||
|
||||
const TAB_MODULE_LIST_URL = _QLO_TAB_MODULE_LIST_URL_;
|
||||
|
||||
/**
|
||||
* @see ObjectModel::$definition
|
||||
*/
|
||||
@@ -597,4 +595,9 @@ class TabCore extends ObjectModel
|
||||
|
||||
return $modules_list;
|
||||
}
|
||||
|
||||
public static function isTabModuleListAvailable()
|
||||
{
|
||||
return file_exists(_PS_ROOT_DIR_.Module::CACHE_FILE_TAB_MODULES_LIST);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3323,7 +3323,8 @@ exit;
|
||||
'version' => isset($params['version']) ? $params['version'] : _QLOAPPS_VERSION_,
|
||||
'iso_lang' => Tools::strtolower(isset($params['iso_lang']) ? $params['iso_lang'] : Context::getContext()->language->iso_code),
|
||||
'iso_code' => Tools::strtolower(isset($params['iso_country']) ? $params['iso_country'] : Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))),
|
||||
'shop_url' => isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain(),
|
||||
'shop_url_ssl' => isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomainSsl(),
|
||||
'physical_uri' => Context::getContext()->shop->physical_uri,
|
||||
'mail' => isset($params['email']) ? $params['email'] : Configuration::get('PS_SHOP_EMAIL')
|
||||
));
|
||||
|
||||
@@ -3347,6 +3348,10 @@ exit;
|
||||
$protocols[] = 'http';
|
||||
$post_data .= '&method=listing&action=must-have-themes';
|
||||
break;
|
||||
case 'addons-modules':
|
||||
$protocols[] = 'http';
|
||||
$post_data .= '&method=listing&action=addons-modules';
|
||||
break;
|
||||
case 'customer':
|
||||
$post_data .= '&method=listing&action=customer&username='.urlencode(trim(Context::getContext()->cookie->username_addons))
|
||||
.'&password='.urlencode(trim(Context::getContext()->cookie->password_addons));
|
||||
@@ -3359,10 +3364,10 @@ exit;
|
||||
$post_data .= '&method=check_customer&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
|
||||
break;
|
||||
case 'check_module':
|
||||
$post_data .= '&method=check&module_name='.urlencode($params['module_name']).'&module_key='.urlencode($params['module_key']);
|
||||
break;
|
||||
$post_data .= '&method=check&module='.urlencode($params['module_name']);
|
||||
break;
|
||||
case 'module':
|
||||
$post_data .= '&method=module&module_name='.urlencode($params['module_name']);
|
||||
$post_data .= '&method=module&module='.urlencode($params['module_name']);
|
||||
if (isset($params['username_addons']) && isset($params['password_addons'])) {
|
||||
$post_data .= '&username='.urlencode($params['username_addons']).'&password='.urlencode($params['password_addons']);
|
||||
} else {
|
||||
@@ -3374,13 +3379,24 @@ exit;
|
||||
.'&password='.urlencode($params['password_addons'])
|
||||
.'&shop_url='.urlencode(isset($params['shop_url']) ? $params['shop_url'] : Tools::getShopDomain())
|
||||
.'&mail='.urlencode(isset($params['email']) ? $params['email'] : Configuration::get('PS_SHOP_EMAIL'));
|
||||
$protocols[] = 'https';
|
||||
break;
|
||||
case 'install-modules':
|
||||
$protocols[] = 'http';
|
||||
$post_data .= '&method=listing&action=install-modules';
|
||||
$post_data .= defined('_PS_HOST_MODE_') ? '-od' : '';
|
||||
break;
|
||||
case 'catalog-recommendation':
|
||||
$protocols[] = 'http';
|
||||
$post_data .= '&method=content&action=catalogRecommendation';
|
||||
$post_data .= defined('_PS_HOST_MODE_') ? '-od' : '';
|
||||
break;
|
||||
case 'dashboard-recommendation':
|
||||
$protocols[] = 'http';
|
||||
$post_data .= '&method=content&action=dashboardRecommendation';
|
||||
$post_data .= defined('_PS_HOST_MODE_') ? '-od' : '';
|
||||
break;
|
||||
case 'check-version':
|
||||
$post_data .= '&method=check-version&autoupgrade='.(int)(Module::isInstalled('qloautoupgrade') && Module::isEnabled('qloautoupgrade'));
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
class UpgraderCore
|
||||
{
|
||||
const DEFAULT_CHECK_VERSION_DELAY_HOURS = 24;
|
||||
|
||||
// @todo find correct class to declare upgrade_info for header
|
||||
const CACHE_FILE_UPGRADE_AVAILABE = '/config/xml/upgrade_available.xml';
|
||||
|
||||
public $rss_version_link;
|
||||
public $rss_md5file_link_dir;
|
||||
/**
|
||||
|
||||
@@ -1575,6 +1575,7 @@ class AdminControllerCore extends Controller
|
||||
$this->page_header_toolbar_title = $this->toolbar_title[count($this->toolbar_title) - 1];
|
||||
}
|
||||
|
||||
$this->initTabModuleList();
|
||||
$this->addPageHeaderToolBarModulesListButton();
|
||||
|
||||
$this->context->smarty->assign('help_link', 'http://help.prestashop.com/'.Language::getIsoById($this->context->employee->id_lang).'/doc/'
|
||||
@@ -1652,7 +1653,6 @@ class AdminControllerCore extends Controller
|
||||
);
|
||||
}
|
||||
}
|
||||
$this->addToolBarModulesListButton();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2086,7 +2086,7 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$this->getLanguages();
|
||||
$this->initToolbar();
|
||||
$this->initTabModuleList();
|
||||
// $this->initTabModuleList();
|
||||
$this->initPageHeaderToolbar();
|
||||
|
||||
if ($this->display == 'edit' || $this->display == 'add') {
|
||||
@@ -2128,22 +2128,10 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
protected function initTabModuleList()
|
||||
{
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 86400)) {
|
||||
@file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have'));
|
||||
}
|
||||
if (!$this->isFresh(Module::CACHE_FILE_TAB_MODULES_LIST, 604800)) {
|
||||
$this->refresh(Module::CACHE_FILE_TAB_MODULES_LIST, _QLO_TAB_MODULE_LIST_URL_);
|
||||
}
|
||||
|
||||
$this->tab_modules_list = Tab::getTabModulesList($this->id);
|
||||
|
||||
if (is_array($this->tab_modules_list['default_list']) && count($this->tab_modules_list['default_list'])) {
|
||||
$this->filter_modules_list = $this->tab_modules_list['default_list'];
|
||||
} elseif (is_array($this->tab_modules_list['slider_list']) && count($this->tab_modules_list['slider_list'])) {
|
||||
$this->addToolBarModulesListButton();
|
||||
$this->addPageHeaderToolBarModulesListButton();
|
||||
$this->context->smarty->assign(array(
|
||||
'tab_modules_list' => implode(',', $this->tab_modules_list['slider_list']),
|
||||
'admin_module_ajax_url' => $this->context->link->getAdminLink('AdminModules'),
|
||||
'back_tab_modules_list' => $this->context->link->getAdminLink(Tools::getValue('controller')),
|
||||
'tab_modules_open' => (int)Tools::getValue('tab_modules_open')
|
||||
@@ -2151,11 +2139,17 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected function addPageHeaderToolBarModulesListButton()
|
||||
{
|
||||
$this->filterTabModuleList();
|
||||
$tab_modules_list = Tab::getTabModulesList($this->id);
|
||||
|
||||
if (is_array($this->tab_modules_list['slider_list']) && count($this->tab_modules_list['slider_list'])) {
|
||||
$tab_modules_list = $this->filterTabModuleList($tab_modules_list);
|
||||
|
||||
if ((is_array($tab_modules_list['slider_list']) && count($tab_modules_list['slider_list']))
|
||||
|| !Tab::isTabModuleListAvailable()
|
||||
) {
|
||||
$this->page_header_toolbar_btn['modules-list'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Recommended Modules and Services')
|
||||
@@ -2163,19 +2157,8 @@ class AdminControllerCore extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
protected function addToolBarModulesListButton()
|
||||
{
|
||||
$this->filterTabModuleList();
|
||||
|
||||
if (is_array($this->tab_modules_list['slider_list']) && count($this->tab_modules_list['slider_list'])) {
|
||||
$this->toolbar_btn['modules-list'] = array(
|
||||
'href' => '#',
|
||||
'desc' => $this->l('Recommended Modules and Services')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected function filterTabModuleList()
|
||||
protected function filterTabModuleList($tab_modules_list)
|
||||
{
|
||||
static $list_is_filtered = null;
|
||||
|
||||
@@ -2183,59 +2166,83 @@ class AdminControllerCore extends Controller
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 86400)) {
|
||||
file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'));
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_ALL_COUNTRY_MODULES_LIST, 86400)) {
|
||||
file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_ALL_COUNTRY_MODULES_LIST, Tools::addonsRequest('native_all'));
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 86400)) {
|
||||
@file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have'));
|
||||
}
|
||||
|
||||
libxml_use_internal_errors(true);
|
||||
|
||||
$country_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST);
|
||||
$must_have_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST);
|
||||
$all_module_list = array();
|
||||
|
||||
if (!empty($country_module_list) && $country_module_list_xml = @simplexml_load_string($country_module_list)) {
|
||||
$country_module_list_array = array();
|
||||
if (is_object($country_module_list_xml->module)) {
|
||||
foreach ($country_module_list_xml->module as $k => $m) {
|
||||
$all_module_list[] = (string)$m->name;
|
||||
libxml_use_internal_errors(true);
|
||||
if (file_exists(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST)) {
|
||||
$country_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST);
|
||||
if (!empty($country_module_list) && $country_module_list_xml = @simplexml_load_string($country_module_list)) {
|
||||
$country_module_list_array = array();
|
||||
if (is_object($country_module_list_xml->module)) {
|
||||
foreach ($country_module_list_xml->module as $k => $m) {
|
||||
$all_module_list[] = (string)$m->name;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach (libxml_get_errors() as $error) {
|
||||
$this->errors[] = Tools::displayError(sprintf('Error found : %1$s in country_module_list.xml file.', $error->message));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach (libxml_get_errors() as $error) {
|
||||
$this->errors[] = Tools::displayError(sprintf('Error found : %1$s in country_module_list.xml file.', $error->message));
|
||||
}
|
||||
}
|
||||
|
||||
libxml_clear_errors();
|
||||
|
||||
|
||||
|
||||
if (!empty($must_have_module_list) && $must_have_module_list_xml = @simplexml_load_string($must_have_module_list)) {
|
||||
$must_have_module_list_array = array();
|
||||
if (is_object($country_module_list_xml->module)) {
|
||||
foreach ($must_have_module_list_xml->module as $l => $mo) {
|
||||
$all_module_list[] = (string)$mo->name;
|
||||
if (file_exists(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST)) {
|
||||
$must_have_module_list = file_get_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST);
|
||||
if (!empty($must_have_module_list) && $must_have_module_list_xml = @simplexml_load_string($must_have_module_list)) {
|
||||
$must_have_module_list_array = array();
|
||||
if (is_object($country_module_list_xml->module)) {
|
||||
foreach ($must_have_module_list_xml->module as $l => $mo) {
|
||||
$all_module_list[] = (string)$mo->name;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach (libxml_get_errors() as $error) {
|
||||
$this->errors[] = Tools::displayError(sprintf('Error found : %1$s in must_have_module_list.xml file.', $error->message));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach (libxml_get_errors() as $error) {
|
||||
$this->errors[] = Tools::displayError(sprintf('Error found : %1$s in must_have_module_list.xml file.', $error->message));
|
||||
}
|
||||
}
|
||||
|
||||
libxml_clear_errors();
|
||||
|
||||
$this->tab_modules_list['slider_list'] = array_intersect($this->tab_modules_list['slider_list'], $all_module_list);
|
||||
$tab_modules_list['slider_list'] = array_intersect($tab_modules_list['slider_list'], $all_module_list);
|
||||
|
||||
$list_is_filtered = true;
|
||||
|
||||
return $tab_modules_list;
|
||||
}
|
||||
|
||||
public function ajaxProcessRefreshModuleList($force_reload_cache = false)
|
||||
{
|
||||
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
$this->status = 'error';
|
||||
}
|
||||
} else {
|
||||
$this->status = 'cache';
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
$this->status = 'error';
|
||||
}
|
||||
} else {
|
||||
$this->status = 'cache';
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_TAB_MODULES_LIST, _TIME_1_WEEK_)) {
|
||||
if ($this->refresh(Module::CACHE_FILE_TAB_MODULES_LIST, _QLO_TAB_MODULE_LIST_URL_)) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
$this->status = 'error';
|
||||
}
|
||||
} else {
|
||||
$this->status = 'cache';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2369,7 +2376,9 @@ class AdminControllerCore extends Controller
|
||||
foreach ($xml_module->children() as $module) {
|
||||
/** @var SimpleXMLElement $module */
|
||||
foreach ($module->attributes() as $key => $value) {
|
||||
if ($xml_module->attributes() == 'native' && $key == 'name') {
|
||||
if (($xml_module->attributes() == 'native' || $xml_module->attributes() == 'disk')
|
||||
&& $key == 'name'
|
||||
) {
|
||||
$this->list_natives_modules[] = (string)$value;
|
||||
}
|
||||
if ($xml_module->attributes() == 'partner' && $key == 'name') {
|
||||
@@ -2441,6 +2450,8 @@ class AdminControllerCore extends Controller
|
||||
|
||||
$helper = new HelperList();
|
||||
|
||||
unset($this->toolbar_btn);
|
||||
$this->initToolbar();
|
||||
// Empty list is ok
|
||||
if (!is_array($this->_list)) {
|
||||
$this->displayWarning($this->l('Bad SQL query', 'Helper').'<br />'.htmlspecialchars($this->_list_error));
|
||||
@@ -2824,6 +2835,19 @@ class AdminControllerCore extends Controller
|
||||
'submit_form_ajax' => (int)Tools::getValue('submitFormAjax')
|
||||
));
|
||||
|
||||
// get upgrade available info
|
||||
if (!$this->isFresh(Upgrader::CACHE_FILE_UPGRADE_AVAILABE, _TIME_1_DAY_)) {
|
||||
file_put_contents(_PS_ROOT_DIR_.Upgrader::CACHE_FILE_UPGRADE_AVAILABE, Tools::addonsRequest('check-version'));
|
||||
}
|
||||
if (file_exists(_PS_ROOT_DIR_.Upgrader::CACHE_FILE_UPGRADE_AVAILABE)) {
|
||||
$content = Tools::file_get_contents( _PS_ROOT_DIR_.Upgrader::CACHE_FILE_UPGRADE_AVAILABE);
|
||||
$upgradeInfo = simplexml_load_string($content);
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'upgrade_info' => $upgradeInfo
|
||||
));
|
||||
}
|
||||
|
||||
Employee::setLastConnectionDate($this->context->employee->id);
|
||||
|
||||
$this->initProcess();
|
||||
@@ -4053,7 +4077,7 @@ class AdminControllerCore extends Controller
|
||||
* @param int $timeout
|
||||
* @return bool
|
||||
*/
|
||||
public function isFresh($file, $timeout = 604800)
|
||||
public function isFresh($file, $timeout = _TIME_1_WEEK_)
|
||||
{
|
||||
if (($time = @filemtime(_PS_ROOT_DIR_.$file)) && filesize(_PS_ROOT_DIR_.$file) > 0) {
|
||||
return ((time() - $time) < $timeout);
|
||||
@@ -4103,8 +4127,17 @@ class AdminControllerCore extends Controller
|
||||
$link_admin_modules = $this->context->link->getAdminLink('AdminModules', true);
|
||||
|
||||
$module->options['install_url'] = $link_admin_modules.'&install='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name);
|
||||
$module->options['update_url'] = $link_admin_modules.'&update='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name);
|
||||
if ($module->is_native) {
|
||||
$module->options['update_url'] = $link_admin_modules.'&update='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name);
|
||||
} else {
|
||||
if ($module->url) {
|
||||
$module->options['update_url'] = $module->url;
|
||||
} else {
|
||||
$module->options['update_url'] = '';
|
||||
}
|
||||
}
|
||||
$module->options['uninstall_url'] = $link_admin_modules.'&uninstall='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name);
|
||||
$module->options['delete_url'] = $link_admin_modules.'&delete='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name);
|
||||
|
||||
$module->optionsHtml = $this->displayModuleOptions($module, $output_type, $back);
|
||||
|
||||
|
||||
@@ -171,13 +171,15 @@ abstract class ModuleCore
|
||||
|
||||
const CACHE_FILE_TAB_MODULES_LIST = '/config/xml/tab_modules_list.xml';
|
||||
|
||||
const CACHE_FILE_ALL_COUNTRY_MODULES_LIST = '/config/xml/modules_native_addons.xml';
|
||||
// const CACHE_FILE_ALL_COUNTRY_MODULES_LIST = '/config/xml/modules_native_addons.xml';
|
||||
const CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST = '/config/xml/default_country_modules_list.xml';
|
||||
|
||||
const CACHE_FILE_CUSTOMER_MODULES_LIST = '/config/xml/customer_modules_list.xml';
|
||||
|
||||
const CACHE_FILE_MUST_HAVE_MODULES_LIST = '/config/xml/must_have_modules_list.xml';
|
||||
|
||||
const CACHE_FILE_ADDONS_MODULES_LIST = '/config/xml/addons_modules_list.xml';
|
||||
|
||||
const CACHE_FILE_TRUSTED_MODULES_LIST = '/config/xml/trusted_modules_list.xml';
|
||||
const CACHE_FILE_UNTRUSTED_MODULES_LIST = '/config/xml/untrusted_modules_list.xml';
|
||||
|
||||
@@ -1259,6 +1261,16 @@ abstract class ModuleCore
|
||||
return Translate::getModuleTranslation((string)$xml_module->name, Module::configXmlStringFormat($xml_module->displayName), (string)$xml_module->name);
|
||||
}
|
||||
|
||||
public static function getModuleInstallVersion($module)
|
||||
{
|
||||
return Db::getInstance()->getRow('
|
||||
SELECT m.`name`, m.`version`, mp.`interest`, module_shop.`enable_device`
|
||||
FROM `'._DB_PREFIX_.'module` m
|
||||
'.Shop::addSqlAssociation('module', 'm', false).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'module_preference` mp ON (mp.`module` = m.`name` AND mp.`id_employee` = '.(int)$id_employee.')
|
||||
WHERE m.`name` = "'.pSQL($module).'"');
|
||||
}
|
||||
|
||||
protected static function useTooMuchMemory()
|
||||
{
|
||||
$memory_limit = Tools::getMemoryLimit();
|
||||
@@ -1297,7 +1309,7 @@ abstract class ModuleCore
|
||||
$result = Db::getInstance()->executeS('
|
||||
SELECT m.name, m.version, mp.interest, module_shop.enable_device
|
||||
FROM `'._DB_PREFIX_.'module` m
|
||||
'.Shop::addSqlAssociation('module', 'm').'
|
||||
'.Shop::addSqlAssociation('module', 'm', false).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'module_preference` mp ON (mp.`module` = m.`name` AND mp.`id_employee` = '.(int)$id_employee.')');
|
||||
foreach ($result as $row) {
|
||||
$modules_installed[$row['name']] = $row;
|
||||
@@ -1364,7 +1376,21 @@ abstract class ModuleCore
|
||||
|
||||
$item->active = 0;
|
||||
$item->onclick_option = false;
|
||||
$item->trusted = Module::isModuleTrusted($item->name);
|
||||
$item->url = false;
|
||||
$item->is_native = false;
|
||||
|
||||
if (defined('_PS_HOST_MODE_') && in_array($item->name, self::$hosted_modules_blacklist)) {
|
||||
continue;
|
||||
} elseif (isset($modules_installed[$item->name])) {
|
||||
$item->installed = true;
|
||||
$item->database_version = $modules_installed[$item->name]['version'];
|
||||
$item->interest = $modules_installed[$item->name]['interest'];
|
||||
$item->enable_device = $modules_installed[$item->name]['enable_device'];
|
||||
} else {
|
||||
$item->installed = false;
|
||||
$item->database_version = 0;
|
||||
$item->interest = 0;
|
||||
}
|
||||
|
||||
$module_list[] = $item;
|
||||
|
||||
@@ -1417,7 +1443,6 @@ abstract class ModuleCore
|
||||
$item->is_configurable = $tmp_module->is_configurable = method_exists($tmp_module, 'getContent') ? 1 : 0;
|
||||
$item->need_instance = isset($tmp_module->need_instance) ? $tmp_module->need_instance : 0;
|
||||
$item->active = $tmp_module->active;
|
||||
$item->trusted = Module::isModuleTrusted($tmp_module->name);
|
||||
$item->currencies = isset($tmp_module->currencies) ? $tmp_module->currencies : null;
|
||||
$item->currencies_mode = isset($tmp_module->currencies_mode) ? $tmp_module->currencies_mode : null;
|
||||
$item->confirmUninstall = isset($tmp_module->confirmUninstall) ? html_entity_decode($tmp_module->confirmUninstall) : null;
|
||||
@@ -1429,6 +1454,7 @@ abstract class ModuleCore
|
||||
$item->badges = isset($tmp_module->badges) ? (array)$tmp_module->badges : null;
|
||||
$item->url = isset($tmp_module->url) ? $tmp_module->url : null;
|
||||
$item->onclick_option = method_exists($module, 'onclickOption') ? true : false;
|
||||
$item->is_native = false;
|
||||
|
||||
if ($item->onclick_option) {
|
||||
$href = Context::getContext()->link->getAdminLink('Module', true).'&module_name='.$tmp_module->name.'&tab_module='.$tmp_module->tab;
|
||||
@@ -1440,6 +1466,19 @@ abstract class ModuleCore
|
||||
}
|
||||
}
|
||||
|
||||
if (defined('_PS_HOST_MODE_') && in_array($item->name, self::$hosted_modules_blacklist)) {
|
||||
continue;
|
||||
} elseif (isset($modules_installed[$item->name])) {
|
||||
$item->installed = true;
|
||||
$item->database_version = $modules_installed[$item->name]['version'];
|
||||
$item->interest = $modules_installed[$item->name]['interest'];
|
||||
$item->enable_device = $modules_installed[$item->name]['enable_device'];
|
||||
} else {
|
||||
$item->installed = false;
|
||||
$item->database_version = 0;
|
||||
$item->interest = 0;
|
||||
}
|
||||
|
||||
$module_list[] = $item;
|
||||
|
||||
if (!$xml_exist || $need_new_config_file) {
|
||||
@@ -1475,9 +1514,8 @@ abstract class ModuleCore
|
||||
}
|
||||
|
||||
$files_list = array(
|
||||
array('type' => 'addonsModules', 'file' => _PS_ROOT_DIR_.self::CACHE_FILE_ADDONS_MODULES_LIST, 'loggedOnAddons' => 0),
|
||||
array('type' => 'addonsNative', 'file' => _PS_ROOT_DIR_.self::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 'loggedOnAddons' => 0),
|
||||
array('type' => 'addonsMustHave', 'file' => _PS_ROOT_DIR_.self::CACHE_FILE_MUST_HAVE_MODULES_LIST, 'loggedOnAddons' => 0),
|
||||
array('type' => 'addonsBought', 'file' => _PS_ROOT_DIR_.self::CACHE_FILE_CUSTOMER_MODULES_LIST, 'loggedOnAddons' => 1),
|
||||
);
|
||||
foreach ($files_list as $f) {
|
||||
if (file_exists($f['file']) && ($f['loggedOnAddons'] == 0 || $logged_on_addons)) {
|
||||
@@ -1497,90 +1535,20 @@ abstract class ModuleCore
|
||||
if (Tools::strtolower($m->name) == Tools::strtolower($modaddons->name) && !isset($m->available_on_addons)) {
|
||||
$flag_found = 1;
|
||||
if ($m->version != $modaddons->version && version_compare($m->version, $modaddons->version) === -1) {
|
||||
$module_list[$k]->version_addons = $modaddons->version;
|
||||
$module_list[$k]->version_addons = strip_tags((string)$modaddons->version);
|
||||
}
|
||||
$module_list[$k]->url = isset($modaddons->url) ? strip_tags((string)$modaddons->url) : null;
|
||||
|
||||
if ($f['type'] == 'addonsNative') {
|
||||
$module_list[$k]->is_native = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($flag_found == 0) {
|
||||
$item = new stdClass();
|
||||
$item->id = 0;
|
||||
$item->warning = '';
|
||||
$item->type = strip_tags((string)$f['type']);
|
||||
$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);
|
||||
$item->description = stripslashes(strip_tags((string)$modaddons->description));
|
||||
$item->description_full = stripslashes(strip_tags((string)$modaddons->description_full));
|
||||
$item->author = strip_tags((string)$modaddons->author);
|
||||
$item->limited_countries = array();
|
||||
$item->parent_class = '';
|
||||
$item->onclick_option = false;
|
||||
$item->is_configurable = 0;
|
||||
$item->need_instance = 0;
|
||||
$item->not_on_disk = 1;
|
||||
$item->available_on_addons = 1;
|
||||
$item->trusted = Module::isModuleTrusted($item->name);
|
||||
$item->active = 0;
|
||||
$item->description_full = stripslashes($modaddons->description_full);
|
||||
$item->additional_description = isset($modaddons->additional_description) ? stripslashes($modaddons->additional_description) : null;
|
||||
$item->compatibility = isset($modaddons->compatibility) ? (array)$modaddons->compatibility : null;
|
||||
$item->nb_rates = isset($modaddons->nb_rates) ? (array)$modaddons->nb_rates : null;
|
||||
$item->avg_rate = isset($modaddons->avg_rate) ? (array)$modaddons->avg_rate : null;
|
||||
$item->badges = isset($modaddons->badges) ? (array)$modaddons->badges : null;
|
||||
$item->url = isset($modaddons->url) ? $modaddons->url : null;
|
||||
|
||||
if (isset($modaddons->img)) {
|
||||
if (!file_exists(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg')) {
|
||||
if (!file_put_contents(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg', Tools::file_get_contents($modaddons->img))) {
|
||||
copy(_PS_IMG_DIR_.'404.gif', _PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg')) {
|
||||
$item->image = '../img/tmp/'.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
if ($item->type == 'addonsMustHave') {
|
||||
$item->addons_buy_url = strip_tags((string)$modaddons->url);
|
||||
$prices = (array)$modaddons->price;
|
||||
$id_default_currency = Configuration::get('PS_CURRENCY_DEFAULT');
|
||||
|
||||
foreach ($prices as $currency => $price) {
|
||||
if ($id_currency = Currency::getIdByIsoCode($currency)) {
|
||||
$item->price = (float)$price;
|
||||
$item->id_currency = (int)$id_currency;
|
||||
|
||||
if ($id_default_currency == $id_currency) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$module_list[$modaddons->id.'-'.$item->name] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($module_list as $key => &$module) {
|
||||
if (defined('_PS_HOST_MODE_') && in_array($module->name, self::$hosted_modules_blacklist)) {
|
||||
unset($module_list[$key]);
|
||||
} elseif (isset($modules_installed[$module->name])) {
|
||||
$module->installed = true;
|
||||
$module->database_version = $modules_installed[$module->name]['version'];
|
||||
$module->interest = $modules_installed[$module->name]['interest'];
|
||||
$module->enable_device = $modules_installed[$module->name]['enable_device'];
|
||||
} else {
|
||||
$module->installed = false;
|
||||
$module->database_version = 0;
|
||||
$module->interest = 0;
|
||||
}
|
||||
}
|
||||
usort($module_list, function ($a, $b) { return strnatcasecmp($a->displayName, $b->displayName); });
|
||||
if ($errors) {
|
||||
if (!isset(Context::getContext()->controller) && !Context::getContext()->controller->controller_name) {
|
||||
@@ -1622,6 +1590,91 @@ abstract class ModuleCore
|
||||
return $module_list;
|
||||
}
|
||||
|
||||
public static function getInstalledModulesOnDisk($use_config = false, $logged_on_addons = false, $id_employee = false)
|
||||
{
|
||||
$modules = self::getModulesOnDisk($use_config, $logged_on_addons, $id_employee);
|
||||
return array_filter($modules, function($m) {
|
||||
return $m->installed;
|
||||
});
|
||||
}
|
||||
|
||||
public static function getSuggestedModules()
|
||||
{
|
||||
$files_list = array(
|
||||
array('type' => 'addonsMustHave', 'file' => _PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 'loggedOnAddons' => 0),
|
||||
array('type' => 'addonsNative', 'file' => _PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 'loggedOnAddons' => 0),
|
||||
);
|
||||
$module_list = array();
|
||||
foreach ($files_list as $f) {
|
||||
$file = $f['file'];
|
||||
$content = Tools::file_get_contents($file);
|
||||
$xml = @simplexml_load_string($content, null, LIBXML_NOCDATA);
|
||||
if ($xml && isset($xml->module)) {
|
||||
foreach ($xml->module as $modaddons) {
|
||||
$item = new stdClass();
|
||||
$item->id = 0;
|
||||
$item->warning = '';
|
||||
$item->type = strip_tags((string)$f['type']);
|
||||
$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);
|
||||
$item->description = stripslashes(strip_tags((string)$modaddons->description));
|
||||
$item->description_full = stripslashes(strip_tags((string)$modaddons->description_full));
|
||||
$item->author = strip_tags((string)$modaddons->author);
|
||||
$item->limited_countries = array();
|
||||
$item->parent_class = '';
|
||||
$item->onclick_option = false;
|
||||
$item->is_configurable = 0;
|
||||
$item->need_instance = 0;
|
||||
$item->not_on_disk = 1;
|
||||
$item->available_on_addons = 1;
|
||||
$item->active = 0;
|
||||
$item->description_full = stripslashes($modaddons->description_full);
|
||||
$item->additional_description = isset($modaddons->additional_description) ? stripslashes($modaddons->additional_description) : null;
|
||||
$item->compatibility = isset($modaddons->compatibility) ? (array)$modaddons->compatibility : null;
|
||||
$item->nb_rates = isset($modaddons->nb_rates) ? (array)$modaddons->nb_rates : null;
|
||||
$item->avg_rate = isset($modaddons->avg_rate) ? (array)$modaddons->avg_rate : null;
|
||||
$item->badges = isset($modaddons->badges) ? (array)$modaddons->badges : null;
|
||||
$item->url = isset($modaddons->url) ? $modaddons->url : null;
|
||||
$item->is_native = false;
|
||||
|
||||
if (isset($modaddons->img)) {
|
||||
if (!file_exists(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg')) {
|
||||
if (!file_put_contents(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg', Tools::file_get_contents($modaddons->img))) {
|
||||
copy(_PS_IMG_DIR_.'404.gif', _PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg')) {
|
||||
$item->image = '../img/tmp/'.md5((int)$modaddons->id.'-'.$modaddons->name).'.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
if ($item->type == 'addonsMustHave') {
|
||||
$item->addons_buy_url = strip_tags((string)$modaddons->url);
|
||||
$prices = (array)$modaddons->price;
|
||||
$id_default_currency = Configuration::get('PS_CURRENCY_DEFAULT');
|
||||
|
||||
foreach ($prices as $currency => $price) {
|
||||
if ($id_currency = Currency::getIdByIsoCode($currency)) {
|
||||
$item->price = (float)$price;
|
||||
$item->id_currency = (int)$id_currency;
|
||||
|
||||
if ($id_default_currency == $id_currency) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$module_list[$modaddons->id.'-'.$item->name] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
$module_list = array_values($module_list);
|
||||
return $module_list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return non native module
|
||||
@@ -1641,7 +1694,7 @@ abstract class ModuleCore
|
||||
$arr_native_modules = array();
|
||||
if (is_array($native_modules)) {
|
||||
foreach ($native_modules as $native_modules_type) {
|
||||
if (in_array($native_modules_type['type'], array('native', 'partner'))) {
|
||||
if (in_array($native_modules_type['type'], array('native', 'disk', 'partner'))) {
|
||||
$arr_native_modules[] = '""';
|
||||
foreach ($native_modules_type->module as $module) {
|
||||
$arr_native_modules[] = '"'.pSQL($module['name']).'"';
|
||||
@@ -1710,7 +1763,7 @@ abstract class ModuleCore
|
||||
* @param string $key The key provided by addons
|
||||
* @return int
|
||||
*/
|
||||
final public static function isModuleTrusted($module_name)
|
||||
final public static function isModuleTrusted($module_name, $check_api = true)
|
||||
{
|
||||
static $trusted_modules_list_content = null;
|
||||
static $modules_list_content = null;
|
||||
@@ -1724,7 +1777,7 @@ abstract class ModuleCore
|
||||
// we use the file, otherwise we regenerate it
|
||||
if (!(file_exists(_PS_ROOT_DIR_.self::CACHE_FILE_TRUSTED_MODULES_LIST)
|
||||
&& filesize(_PS_ROOT_DIR_.self::CACHE_FILE_TRUSTED_MODULES_LIST) > 0
|
||||
&& ((time() - filemtime(_PS_ROOT_DIR_.self::CACHE_FILE_TRUSTED_MODULES_LIST)) < 86400)
|
||||
&& ((time() - filemtime(_PS_ROOT_DIR_.self::CACHE_FILE_TRUSTED_MODULES_LIST)) < _TIME_1_DAY_)
|
||||
)) {
|
||||
self::generateTrustedXml();
|
||||
}
|
||||
@@ -1748,8 +1801,6 @@ abstract class ModuleCore
|
||||
$untrusted_modules_list_content = Tools::file_get_contents(_PS_ROOT_DIR_.self::CACHE_FILE_UNTRUSTED_MODULES_LIST);
|
||||
}
|
||||
|
||||
$objModule = Module::getInstanceByName($module_name);
|
||||
|
||||
// If the module is trusted, which includes both partner modules and modules bought on Addons
|
||||
|
||||
if (stripos($trusted_modules_list_content, $module_name) !== false) {
|
||||
@@ -1769,10 +1820,11 @@ abstract class ModuleCore
|
||||
// If the module isn't in one of the xml files
|
||||
// It might have been uploaded recenlty so we check
|
||||
// Addons API and clear XML files to be regenerated next time
|
||||
Tools::deleteFile(_PS_ROOT_DIR_.self::CACHE_FILE_TRUSTED_MODULES_LIST);
|
||||
Tools::deleteFile(_PS_ROOT_DIR_.self::CACHE_FILE_UNTRUSTED_MODULES_LIST);
|
||||
|
||||
return (int)Module::checkModuleFromAddonsApi($module_name);
|
||||
if ($check_api) {
|
||||
Tools::deleteFile(_PS_ROOT_DIR_.self::CACHE_FILE_TRUSTED_MODULES_LIST);
|
||||
Tools::deleteFile(_PS_ROOT_DIR_.self::CACHE_FILE_UNTRUSTED_MODULES_LIST);
|
||||
return (int)Module::checkModuleFromAddonsApi($module_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1787,9 +1839,11 @@ abstract class ModuleCore
|
||||
$untrusted = array();
|
||||
|
||||
$trusted_modules_xml = array(
|
||||
_PS_ROOT_DIR_.self::CACHE_FILE_ALL_COUNTRY_MODULES_LIST,
|
||||
_PS_ROOT_DIR_.self::CACHE_FILE_MUST_HAVE_MODULES_LIST,
|
||||
);
|
||||
// _PS_ROOT_DIR_.self::CACHE_FILE_ALL_COUNTRY_MODULES_LIST,
|
||||
_PS_ROOT_DIR_.self::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST,
|
||||
_PS_ROOT_DIR_.self::CACHE_FILE_MUST_HAVE_MODULES_LIST,
|
||||
_PS_ROOT_DIR_.self::CACHE_FILE_ADDONS_MODULES_LIST,
|
||||
);
|
||||
|
||||
if (file_exists(_PS_ROOT_DIR_.self::CACHE_FILE_CUSTOMER_MODULES_LIST)) {
|
||||
$trusted_modules_xml[] = _PS_ROOT_DIR_.self::CACHE_FILE_CUSTOMER_MODULES_LIST;
|
||||
@@ -1874,12 +1928,12 @@ abstract class ModuleCore
|
||||
|
||||
if (!is_object($obj)) {
|
||||
return false;
|
||||
} elseif ($obj->module_key === '') {
|
||||
return false;
|
||||
// } elseif ($obj->module_key === '') {
|
||||
// return false;
|
||||
} else {
|
||||
$params = array(
|
||||
'module_name' => $obj->name,
|
||||
'module_key' => $obj->module_key,
|
||||
// 'module_key' => $obj->module_key,
|
||||
);
|
||||
$xml = Tools::addonsRequest('check_module', $params);
|
||||
return (bool)(strpos($xml, 'success') !== false);
|
||||
|
||||
@@ -77,6 +77,8 @@ if (_PS_DEBUG_PROFILING_) {
|
||||
include_once(_PS_TOOL_DIR_.'profiling/Tools.php');
|
||||
}
|
||||
|
||||
require_once (_PS_ROOT_DIR_.'/modules/hotelreservationsystem/define.php');
|
||||
|
||||
if (Tools::convertBytes(ini_get('upload_max_filesize')) < Tools::convertBytes('100M')) {
|
||||
ini_set('upload_max_filesize', '100M');
|
||||
}
|
||||
@@ -264,4 +266,5 @@ if (!defined('_MEDIA_SERVER_3_')) {
|
||||
define('_MEDIA_SERVER_3_', Configuration::get('PS_MEDIA_SERVER_3'));
|
||||
}
|
||||
|
||||
require_once (_PS_ROOT_DIR_.'/modules/hotelreservationsystem/define.php');
|
||||
define('_TIME_1_DAY_', 86400);
|
||||
define('_TIME_1_WEEK_', 604800);
|
||||
@@ -84,5 +84,5 @@ Tools::safeDefine('_PS_API_DOMAIN_', 'api.prestashop.com');
|
||||
Tools::safeDefine('_PS_API_URL_', 'http://'._PS_API_DOMAIN_);
|
||||
Tools::safeDefine('_PS_CURRENCY_FEED_URL_', _PS_API_URL_.'/xml/currencies.xml');
|
||||
Tools::safeDefine('_QLO_API_DOMAIN_', 'api.qloapps.com');
|
||||
Tools::safeDefine('_QLO_API_URL_', 'http://'._QLO_API_DOMAIN_);
|
||||
Tools::safeDefine('_QLO_API_URL_', 'https://'._QLO_API_DOMAIN_);
|
||||
Tools::safeDefine('_QLO_TAB_MODULE_LIST_URL_', _QLO_API_URL_.'/xml/tab_modules_list.xml');
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
|
||||
class AdminDashboardControllerCore extends AdminController
|
||||
{
|
||||
|
||||
const DASHBOARD_RECOMMENDATION_CONTENT = '/cache/dashboard_recommendation.html';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
@@ -282,6 +285,15 @@ class AdminDashboardControllerCore extends AdminController
|
||||
'hotel_name' => $objHotelBranchInfo->hotel_name.', '.$hotelAddressInfo['city'],
|
||||
);
|
||||
}
|
||||
|
||||
if (file_exists(_PS_ROOT_DIR_.Upgrader::CACHE_FILE_UPGRADE_AVAILABE)) {
|
||||
$content = Tools::file_get_contents( _PS_ROOT_DIR_.Upgrader::CACHE_FILE_UPGRADE_AVAILABE);
|
||||
$upgradeInfo = simplexml_load_string($content);
|
||||
$this->context->smarty->assign(array(
|
||||
'upgrade_info' => $upgradeInfo
|
||||
));
|
||||
}
|
||||
|
||||
$this->tpl_view_vars = array(
|
||||
'date_from' => $this->context->employee->stats_date_from,
|
||||
'date_to' => $this->context->employee->stats_date_to,
|
||||
@@ -294,7 +306,7 @@ class AdminDashboardControllerCore extends AdminController
|
||||
//'translations' => $translations,
|
||||
'action' => self::$currentIndex.'&token='.$this->token,
|
||||
'warning' => $this->getWarningDomainName(),
|
||||
'new_version_url' => Tools::getCurrentUrlProtocolPrefix()._PS_API_DOMAIN_.'/version/check_version.php?v='._PS_VERSION_.'&lang='.$this->context->language->iso_code.'&autoupgrade='.(int)(Module::isInstalled('autoupgrade') && Module::isEnabled('autoupgrade')).'&hosted_mode='.(int)defined('_PS_HOST_MODE_'),
|
||||
'new_version_url' => Tools::getCurrentUrlProtocolPrefix()._QLO_API_DOMAIN_.'/index.php?version='._QLOAPPS_VERSION_.'&lang='.$this->context->language->iso_code.'&method=check-version&autoupgrade='.(int)(Module::isInstalled('qloautoupgrade') && Module::isEnabled('qloautoupgrade')).'&hosted_mode='.(int)defined('_PS_HOST_MODE_'),
|
||||
'dashboard_use_push' => Configuration::get('PS_DASHBOARD_USE_PUSH'),
|
||||
'calendar' => $calendar_helper->generate(),
|
||||
'PS_DASHBOARD_SIMULATION' => Configuration::get('PS_DASHBOARD_SIMULATION'),
|
||||
@@ -411,7 +423,7 @@ class AdminDashboardControllerCore extends AdminController
|
||||
public function ajaxProcessGetBlogRss()
|
||||
{
|
||||
$return = array('has_errors' => false, 'rss' => array());
|
||||
if (!$this->isFresh('/config/xml/blog-'.$this->context->language->iso_code.'.xml', 86400)) {
|
||||
if (!$this->isFresh('/config/xml/blog-'.$this->context->language->iso_code.'.xml', _TIME_1_DAY_)) {
|
||||
if (!$this->refresh('/config/xml/blog-'.$this->context->language->iso_code.'.xml', _PS_API_URL_.'/rss/blog/blog-'.$this->context->language->iso_code.'.xml')) {
|
||||
$return['has_errors'] = true;
|
||||
}
|
||||
@@ -506,4 +518,25 @@ class AdminDashboardControllerCore extends AdminController
|
||||
|
||||
die(json_encode($return));
|
||||
}
|
||||
|
||||
public function ajaxProcessGetRecommendationContent()
|
||||
{
|
||||
$response = array('success' => false);
|
||||
if ($content = $this->getRecommendationContent()) {
|
||||
$response['success'] = true;
|
||||
$response['content'] = $content;
|
||||
}
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function getRecommendationContent()
|
||||
{
|
||||
if (!$this->isFresh(self::DASHBOARD_RECOMMENDATION_CONTENT, _TIME_1_DAY_)) {
|
||||
@file_put_contents(_PS_ROOT_DIR_.self::DASHBOARD_RECOMMENDATION_CONTENT, Tools::addonsRequest('dashboard-recommendation'));
|
||||
}
|
||||
if (file_exists(_PS_ROOT_DIR_.self::DASHBOARD_RECOMMENDATION_CONTENT)) {
|
||||
return Tools::file_get_contents(_PS_ROOT_DIR_.self::DASHBOARD_RECOMMENDATION_CONTENT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +278,6 @@ class AdminEmailsControllerCore extends AdminController
|
||||
$this->initTabModuleList();
|
||||
$this->initToolbar();
|
||||
$this->initPageHeaderToolbar();
|
||||
$this->addToolBarModulesListButton();
|
||||
unset($this->toolbar_btn['save']);
|
||||
$back = $this->context->link->getAdminLink('AdminDashboard');
|
||||
|
||||
|
||||
332
controllers/admin/AdminModulesCatalogController.php
Normal file
332
controllers/admin/AdminModulesCatalogController.php
Normal file
@@ -0,0 +1,332 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2020 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright 2010-2020 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
class AdminModulesCatalogControllerCore extends AdminController
|
||||
{
|
||||
|
||||
public $modules;
|
||||
|
||||
const CATALOG_RECOMMENDATION_CONTENT = '/cache/catalog_recommendation.html';
|
||||
|
||||
const ELEMENT_TYPE_MODULE = 1;
|
||||
const ELEMENT_TYPE_THEME = 2;
|
||||
|
||||
const MODULES_PER_PAGE = 18;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->bootstrap = true;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
$this->initSuggestedModulesList();
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
parent::initContent();
|
||||
|
||||
$suggestedModules = Module::getSuggestedModules();
|
||||
|
||||
$modulesToAdd = array();
|
||||
$dirModules = ModuleCore::getModulesOnDisk();
|
||||
$modules_name = array_column($suggestedModules, 'name');
|
||||
foreach ($dirModules as $mod) {
|
||||
if (($id = array_search($mod->name, $modules_name)) !== false) {
|
||||
if ($mod->installed) {
|
||||
unset($suggestedModules[$id]);
|
||||
} else {
|
||||
$suggestedModules[$id]->not_on_disk = false;
|
||||
}
|
||||
} else {
|
||||
if (!$mod->installed) {
|
||||
$modulesToAdd[] = $mod;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$modules = array_merge($suggestedModules, $modulesToAdd);
|
||||
|
||||
$link_admin_modules = $this->context->link->getAdminLink('AdminModules', true);
|
||||
foreach ($modules as $key => $module) {
|
||||
$module->options['install_url'] = $link_admin_modules.'&install='.urlencode($module->name).'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name);
|
||||
$module->element_type = self::ELEMENT_TYPE_MODULE;
|
||||
$module->logo = '../../img/questionmark.png';
|
||||
|
||||
if (@filemtime(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.basename(_PS_MODULE_DIR_).DIRECTORY_SEPARATOR.$module->name
|
||||
.DIRECTORY_SEPARATOR.'logo.gif')) {
|
||||
$module->logo = 'logo.gif';
|
||||
}
|
||||
if (@filemtime(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.basename(_PS_MODULE_DIR_).DIRECTORY_SEPARATOR.$module->name
|
||||
.DIRECTORY_SEPARATOR.'logo.png')) {
|
||||
$module->logo = 'logo.png';
|
||||
}
|
||||
|
||||
$modules[$key] = $module;
|
||||
}
|
||||
|
||||
$this->sortList($modules, 'module');
|
||||
$this->modules = $modules;
|
||||
|
||||
$this->themes = $this->getSuggestedThemes();
|
||||
|
||||
$this->assignSortCriteria();
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'modules' => $this->modules,
|
||||
'themes' => $this->themes,
|
||||
'modules_uri' => __PS_BASE_URI__.basename(_PS_MODULE_DIR_),
|
||||
'element_type_module' => self::ELEMENT_TYPE_MODULE,
|
||||
'element_type_theme' => self::ELEMENT_TYPE_THEME,
|
||||
|
||||
));
|
||||
}
|
||||
|
||||
public function initModal()
|
||||
{
|
||||
parent::initModal();
|
||||
|
||||
$modal_content = $this->context->smarty->fetch('controllers/modules/'.(($this->context->mode == Context::MODE_HOST) ? 'modal_not_trusted_blocked.tpl' : 'modal_not_trusted.tpl'));
|
||||
$this->modals[] = array(
|
||||
'modal_id' => 'moduleNotTrusted',
|
||||
'modal_class' => 'modal-lg',
|
||||
'modal_title' => ($this->context->mode == Context::MODE_HOST) ? $this->l('This module cannot be installed') : $this->l('Important Notice'),
|
||||
'modal_content' => $modal_content
|
||||
);
|
||||
}
|
||||
|
||||
public function assignSortCriteria()
|
||||
{
|
||||
$sortCriterta = array(
|
||||
array (
|
||||
'key' => 'popularity',
|
||||
'value' => 'popularity',
|
||||
'title' => $this->l('Popularity')
|
||||
),
|
||||
array (
|
||||
'key' => 'name',
|
||||
'value' => 'name',
|
||||
'title' => $this->l('Name')
|
||||
),
|
||||
array (
|
||||
'key' => 'price_increasing',
|
||||
'value' => 'price_increasing',
|
||||
'title' => $this->l('Price (low to high)')
|
||||
),
|
||||
array (
|
||||
'key' => 'price_decreasing',
|
||||
'value' => 'price_decreasing',
|
||||
'title' => $this->l('Price (high to low)')
|
||||
),
|
||||
);
|
||||
$this->context->smarty->assign(array(
|
||||
'sort_criterta' => $sortCriterta,
|
||||
'module_sort' => Configuration::get('PS_SORT_MODULE_MODULES_CATALOG_'.(int)$this->context->employee->id),
|
||||
'theme_sort' => Configuration::get('PS_SORT_THEME_MODULES_CATALOG_'.(int)$this->context->employee->id),
|
||||
));
|
||||
}
|
||||
|
||||
public function getSuggestedThemes()
|
||||
{
|
||||
$installedThemes = array();
|
||||
$themes = Theme::getAllThemes()->getAll();
|
||||
foreach ($themes as $theme) {
|
||||
$installedThemes[] = Theme::getThemeInfo($theme->id);
|
||||
}
|
||||
$files_list = array(
|
||||
array('type' => 'addonsMustHave', 'file' => _PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 'loggedOnAddons' => 0),
|
||||
);
|
||||
|
||||
$theme_list = array();
|
||||
foreach ($files_list as $f) {
|
||||
$file = $f['file'];
|
||||
$content = Tools::file_get_contents($file);
|
||||
$xml = @simplexml_load_string($content, null, LIBXML_NOCDATA);
|
||||
if ($xml && isset($xml->theme)) {
|
||||
foreach ($xml->theme as $modthemes) {
|
||||
foreach ($installedThemes as $theme) {
|
||||
if ($theme['theme_name'] == $modthemes->name)
|
||||
continue;
|
||||
$item = new stdClass();
|
||||
$item->id = 0;
|
||||
$item->warning = '';
|
||||
$item->type = strip_tags((string)$f['type']);
|
||||
$item->element_type = self::ELEMENT_TYPE_THEME;
|
||||
$item->name = strip_tags((string)$modthemes->name);
|
||||
$item->version = strip_tags((string)$modthemes->version);
|
||||
$item->displayName = strip_tags((string)$modthemes->displayName);
|
||||
$item->description = stripslashes(strip_tags((string)$modthemes->description));
|
||||
$item->description_full = stripslashes(strip_tags((string)$modthemes->description_full));
|
||||
$item->author = strip_tags((string)$modthemes->author);
|
||||
$item->limited_countries = array();
|
||||
$item->parent_class = '';
|
||||
$item->onclick_option = false;
|
||||
$item->available_on_addons = 1;
|
||||
$item->active = 0;
|
||||
$item->additional_description = isset($modthemes->additional_description) ? stripslashes($modthemes->additional_description) : null;
|
||||
$item->compatibility = isset($modthemes->compatibility) ? (array)$modthemes->compatibility : null;
|
||||
$item->nb_rates = isset($modthemes->nb_rates) ? (array)$modthemes->nb_rates : null;
|
||||
$item->avg_rate = isset($modthemes->avg_rate) ? (array)$modthemes->avg_rate : null;
|
||||
$item->badges = isset($modthemes->badges) ? (array)$modthemes->badges : null;
|
||||
$item->url = isset($modthemes->url) ? $modthemes->url : null;
|
||||
|
||||
if (isset($modthemes->img)) {
|
||||
if (!file_exists(_PS_TMP_IMG_DIR_.md5((int)$modthemes->id.'-'.$modthemes->name).'.jpg')) {
|
||||
if (!file_put_contents(_PS_TMP_IMG_DIR_.md5((int)$modthemes->id.'-'.$modthemes->name).'.jpg', Tools::file_get_contents($modthemes->img))) {
|
||||
copy(_PS_IMG_DIR_.'404.gif', _PS_TMP_IMG_DIR_.md5((int)$modthemes->id.'-'.$modthemes->name).'.jpg');
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists(_PS_TMP_IMG_DIR_.md5((int)$modthemes->id.'-'.$modthemes->name).'.jpg')) {
|
||||
$item->image = '../img/tmp/'.md5((int)$modthemes->id.'-'.$modthemes->name).'.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
if ($item->type == 'addonsMustHave') {
|
||||
$item->addons_buy_url = strip_tags((string)$modthemes->url);
|
||||
$prices = (array)$modthemes->price;
|
||||
$id_default_currency = Configuration::get('PS_CURRENCY_DEFAULT');
|
||||
|
||||
foreach ($prices as $currency => $price) {
|
||||
if ($id_currency = Currency::getIdByIsoCode($currency)) {
|
||||
$item->price = (float)$price;
|
||||
$item->id_currency = (int)$id_currency;
|
||||
|
||||
if ($id_default_currency == $id_currency) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$theme_list[$modthemes->id.'-'.$item->name] = $item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$theme_list = array_values($theme_list);
|
||||
$this->sortList($theme_list, 'theme');
|
||||
|
||||
return $theme_list;
|
||||
}
|
||||
|
||||
public function initToolbar()
|
||||
{
|
||||
parent::initToolbar();
|
||||
$this->page_header_toolbar_btn['addons'] = array(
|
||||
'href' => 'https://qloapps.com/addons/',
|
||||
'desc' => $this->l('Explore all Addons'),
|
||||
'imgclass' => 'modules-list',
|
||||
'target' => true
|
||||
);
|
||||
}
|
||||
|
||||
public function getRecommendationContent()
|
||||
{
|
||||
if (!$this->isFresh(self::CATALOG_RECOMMENDATION_CONTENT, _TIME_1_DAY_)) {
|
||||
@file_put_contents(_PS_ROOT_DIR_.self::CATALOG_RECOMMENDATION_CONTENT, Tools::addonsRequest('catalog-recommendation'));
|
||||
}
|
||||
if (file_exists(_PS_ROOT_DIR_.self::CATALOG_RECOMMENDATION_CONTENT)) {
|
||||
return Tools::file_get_contents(_PS_ROOT_DIR_.self::CATALOG_RECOMMENDATION_CONTENT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function sortList(&$list, $type)
|
||||
{
|
||||
|
||||
switch($type) {
|
||||
case 'module':
|
||||
$criteria = Configuration::get('PS_SORT_MODULE_MODULES_CATALOG_'.(int)$this->context->employee->id);
|
||||
break;
|
||||
case 'theme':
|
||||
$criteria = Configuration::get('PS_SORT_THEME_MODULES_CATALOG_'.(int)$this->context->employee->id);
|
||||
break;
|
||||
}
|
||||
if ($criteria != 'popularity') {
|
||||
usort($list, function($a, $b) use($criteria){
|
||||
if ($criteria == 'name') {
|
||||
return strnatcasecmp($a->displayName, $b->displayName);
|
||||
} else if ($criteria == 'price_increasing') {
|
||||
if (isset($a->price) && isset($b->price))
|
||||
return $a->price > $b->price;
|
||||
else if (isset($b->price) && $b->price)
|
||||
return true;
|
||||
} else if ($criteria == 'price_decreasing') {
|
||||
if (isset($a->price) && isset($b->price))
|
||||
return $a->price < $b->price;
|
||||
else if (isset($b->price) && $b->price)
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function setSorting($module_sorting, $theme_sorting)
|
||||
{
|
||||
Configuration::updateValue('PS_SORT_MODULE_MODULES_CATALOG_'.(int)$this->context->employee->id, $module_sorting);
|
||||
Configuration::updateValue('PS_SORT_THEME_MODULES_CATALOG_'.(int)$this->context->employee->id, $theme_sorting);
|
||||
}
|
||||
|
||||
|
||||
public function ajaxProcessGetRecommendationContent()
|
||||
{
|
||||
$response = array('success' => false);
|
||||
if ($content = $this->getRecommendationContent()) {
|
||||
$response['success'] = true;
|
||||
$response['content'] = $content;
|
||||
}
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessSetSorting()
|
||||
{
|
||||
$this->setSorting(Tools::getValue('module_sorting'), Tools::getValue('theme_sorting'));
|
||||
$this->ajaxDie(json_encode(array(
|
||||
'success' => true
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
protected function initSuggestedModulesList()
|
||||
{
|
||||
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, _TIME_1_DAY_)) {
|
||||
file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'));
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, _TIME_1_DAY_)) {
|
||||
@file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have'));
|
||||
}
|
||||
}
|
||||
|
||||
public function setMedia()
|
||||
{
|
||||
parent::setMedia();
|
||||
$this->addJS(_PS_JS_DIR_.'admin/modules_catalog.js');
|
||||
$this->context->controller->addJS(_PS_JS_DIR_.'/twbs-pagination/jquery.twbsPagination.min.js');
|
||||
Media::addJSdef(array(
|
||||
'num_block_per_page' => self::MODULES_PER_PAGE
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,9 @@ class AdminModulesControllerCore extends AdminController
|
||||
foreach ($xml_module->children() as $module) {
|
||||
/** @var SimpleXMLElement $module */
|
||||
foreach ($module->attributes() as $key => $value) {
|
||||
if ($xml_module->attributes() == 'native' && $key == 'name') {
|
||||
if (($xml_module->attributes() == 'native' || $xml_module->attributes() == 'disk')
|
||||
&& $key == 'name'
|
||||
) {
|
||||
$this->list_natives_modules[] = (string)$value;
|
||||
}
|
||||
if ($xml_module->attributes() == 'partner' && $key == 'name') {
|
||||
@@ -156,17 +158,22 @@ class AdminModulesControllerCore extends AdminController
|
||||
parent::setMedia();
|
||||
$this->addJqueryPlugin(array('autocomplete', 'fancybox', 'tablefilter'));
|
||||
|
||||
if ($this->context->mode == Context::MODE_HOST && Tools::isSubmit('addnewmodule')) {
|
||||
Media::addjsDef(array(
|
||||
'remove_uploaded_module_txt' => $this->l('Do you want to remove the uploaded/installed module?'),
|
||||
'module_install_error_txt' => $this->l('There was an error while installing module.'),
|
||||
));
|
||||
$this->addJS(_PS_JS_DIR_.'admin/modules.js');
|
||||
|
||||
if ($this->context->mode == Context::MODE_HOST && Tools::isSubmit('addnewmodule')) {
|
||||
$this->addJS(_PS_JS_DIR_.'admin/addons.js');
|
||||
}
|
||||
}
|
||||
|
||||
public function ajaxProcessRefreshModuleList($force_reload_cache = false)
|
||||
{
|
||||
$xml_modules_list = _QLO_API_DOMAIN_.'/xml/'.str_replace('.', '', _QLOAPPS_VERSION_).'.xml';
|
||||
|
||||
// Refresh modules_list.xml every week
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MODULES_LIST, 86400) || $force_reload_cache) {
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
$xml_modules_list = _QLO_API_DOMAIN_.'/xml/'.str_replace('.', '', _QLOAPPS_VERSION_).'.xml';
|
||||
if ($this->refresh(Module::CACHE_FILE_MODULES_LIST, 'https://'.$xml_modules_list)) {
|
||||
$this->status = 'refresh';
|
||||
} elseif ($this->refresh(Module::CACHE_FILE_MODULES_LIST, 'http://'.$xml_modules_list)) {
|
||||
@@ -180,7 +187,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
|
||||
// If logged to Addons Webservices, refresh default country native modules list every day
|
||||
if ($this->status != 'error') {
|
||||
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 86400) || $force_reload_cache) {
|
||||
if (!$this->isFresh(Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, Tools::addonsRequest('native'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
@@ -190,7 +197,17 @@ class AdminModulesControllerCore extends AdminController
|
||||
$this->status = 'cache';
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 86400) || $force_reload_cache) {
|
||||
if (!$this->isFresh(Module::CACHE_FILE_ADDONS_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_ADDONS_MODULES_LIST, Tools::addonsRequest('addons-modules'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
$this->status = 'error';
|
||||
}
|
||||
} else {
|
||||
$this->status = 'cache';
|
||||
}
|
||||
|
||||
if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, _TIME_1_DAY_) || $force_reload_cache) {
|
||||
if (file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have'))) {
|
||||
$this->status = 'refresh';
|
||||
} else {
|
||||
@@ -213,6 +230,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
$this->status = 'cache';
|
||||
}
|
||||
}
|
||||
Module::generateTrustedXml();
|
||||
}
|
||||
|
||||
public function displayAjaxRefreshModuleList()
|
||||
@@ -268,19 +286,29 @@ class AdminModulesControllerCore extends AdminController
|
||||
|
||||
public function ajaxProcessGetTabModulesList()
|
||||
{
|
||||
$tab_modules_list = Tools::getValue('tab_modules_list');
|
||||
// $tab_modules_list = Tools::getValue('tab_modules_list');
|
||||
$conrollerClass = Tools::getValue('controller_class');
|
||||
$controllerId = Tab::getIdFromClassName($conrollerClass);
|
||||
|
||||
if (!Tab::isTabModuleListAvailable()) {
|
||||
$this->ajaxProcessRefreshModuleList();
|
||||
}
|
||||
|
||||
if ($tab_modules_list = Tab::getTabModulesList($controllerId)) {
|
||||
$tab_modules_list = $this->filterTabModuleList($tab_modules_list);
|
||||
}
|
||||
|
||||
$back = Tools::getValue('back_tab_modules_list');
|
||||
if ($back) {
|
||||
$back .= '&tab_modules_open=1';
|
||||
}
|
||||
$modules_list = array('installed' =>array(), 'not_installed' => array());
|
||||
if ($tab_modules_list) {
|
||||
$tab_modules_list = explode(',', $tab_modules_list);
|
||||
$modules_list_unsort = $this->getModulesByInstallation($tab_modules_list);
|
||||
if (count($tab_modules_list['slider_list'])) {
|
||||
$modules_list_unsort = $this->getModulesByInstallation($tab_modules_list['slider_list']);
|
||||
}
|
||||
|
||||
$installed = $uninstalled = array();
|
||||
foreach ($tab_modules_list as $key => $value) {
|
||||
foreach ($tab_modules_list['slider_list'] as $key => $value) {
|
||||
$continue = 0;
|
||||
foreach ($modules_list_unsort['installed'] as $mod_in) {
|
||||
if ($mod_in->name == $value) {
|
||||
@@ -551,7 +579,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function postProcessDownload()
|
||||
public function postProcessDownload($redirect = true)
|
||||
{
|
||||
/* PrestaShop demo mode */
|
||||
if (_PS_MODE_DEMO_ || ($this->context->mode == Context::MODE_HOST)) {
|
||||
@@ -593,7 +621,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
} elseif (!move_uploaded_file($_FILES['file']['tmp_name'], _PS_MODULE_DIR_.$_FILES['file']['name'])) {
|
||||
$this->errors[] = Tools::displayError('An error occurred while copying the archive to the module directory.');
|
||||
} else {
|
||||
$this->extractArchive(_PS_MODULE_DIR_.$_FILES['file']['name']);
|
||||
$this->extractArchive(_PS_MODULE_DIR_.$_FILES['file']['name'], $redirect);
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = Tools::displayError('You do not have permission to add this.');
|
||||
@@ -709,12 +737,9 @@ class AdminModulesControllerCore extends AdminController
|
||||
return;
|
||||
}
|
||||
|
||||
if ($key == 'check') {
|
||||
$this->ajaxProcessRefreshModuleList(true);
|
||||
} elseif ($key == 'checkAndUpdate') {
|
||||
if ($key == 'checkAndUpdate') {
|
||||
$modules = array();
|
||||
$this->ajaxProcessRefreshModuleList(true);
|
||||
$modules_on_disk = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee);
|
||||
$modules_on_disk = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee, true);
|
||||
|
||||
// Browse modules list
|
||||
foreach ($modules_on_disk as $km => $module_on_disk) {
|
||||
@@ -769,6 +794,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
array('type' => 'addonsNative', 'file' => Module::CACHE_FILE_DEFAULT_COUNTRY_MODULES_LIST, 'loggedOnAddons' => 0),
|
||||
// array('type' => 'addonsBought', 'file' => Module::CACHE_FILE_CUSTOMER_MODULES_LIST, 'loggedOnAddons' => 1),
|
||||
// array('type' => 'addonsMustHave', 'file' => Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 'loggedOnAddons' => 1),
|
||||
array('type' => 'addonsMustHave', 'file' => Module::CACHE_FILE_ADDONS_MODULES_LIST, 'loggedOnAddons' => 1),
|
||||
);
|
||||
|
||||
foreach ($files_list as $f) {
|
||||
@@ -782,6 +808,9 @@ class AdminModulesControllerCore extends AdminController
|
||||
$module_to_update[$name]['name'] = $modaddons->name;
|
||||
$module_to_update[$name]['displayName'] = $modaddons->displayName;
|
||||
$module_to_update[$name]['need_loggedOnAddons'] = $f['loggedOnAddons'];
|
||||
if ($modaddons->url) {
|
||||
$module_to_update[$name]['url'] = $modaddons->url;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -790,7 +819,8 @@ class AdminModulesControllerCore extends AdminController
|
||||
|
||||
foreach ($module_to_update as $name => $attr) {
|
||||
if ((is_null($attr) && $this->logged_on_addons == 0) || ($attr['need_loggedOnAddons'] == 1 && $this->logged_on_addons == 0)) {
|
||||
$this->errors[] = sprintf(Tools::displayError('You need to be logged in to your PrestaShop Addons account in order to update the %s module. %s'), '<strong>'.$name.'</strong>', '<a href="#" class="addons_connect" data-toggle="modal" data-target="#modal_addons_connect" title="Addons">'.$this->l('Click here to log in.').'</a>');
|
||||
$this->errors[] = sprintf(Tools::displayError('You need to be download this module from store in order to update the %s module. %s'), '<strong>'.$name.'</strong>', '<a href="'.$attr['url'].'" title="Store">'.$this->l('Click here to download.').'</a>');
|
||||
// $this->errors[] = sprintf(Tools::displayError('You need to be logged in to your PrestaShop Addons account in order to update the %s module. %s'), '<strong>'.$name.'</strong>', '<a href="#" class="addons_connect" data-toggle="modal" data-target="#modal_addons_connect" title="Addons">'.$this->l('Click here to log in.').'</a>');
|
||||
} elseif (!is_null($attr['name'])) {
|
||||
$download_ok = false;
|
||||
if ($attr['need_loggedOnAddons'] == 0 && file_put_contents(_PS_MODULE_DIR_.$name.'.zip', Tools::addonsRequest('module', array('module_name' => pSQL($attr['name']))))) {
|
||||
@@ -1041,7 +1071,8 @@ class AdminModulesControllerCore extends AdminController
|
||||
|
||||
protected function getModulesByInstallation($tab_modules_list = null)
|
||||
{
|
||||
$all_modules = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee);
|
||||
// $all_modules = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee);
|
||||
$all_modules = Module::getSuggestedModules();
|
||||
$all_unik_modules = array();
|
||||
$modules_list = array('installed' =>array(), 'not_installed' => array());
|
||||
|
||||
@@ -1426,12 +1457,13 @@ class AdminModulesControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// Retrieve Modules List
|
||||
$modules = Module::getModulesOnDisk(true, $this->logged_on_addons, $this->id_employee);
|
||||
$modules = Module::getInstalledModulesOnDisk(true, $this->logged_on_addons, $this->id_employee);
|
||||
$this->initModulesList($modules);
|
||||
$this->nb_modules_total = count($modules);
|
||||
$module_errors = array();
|
||||
$module_success = array();
|
||||
$upgrade_available = array();
|
||||
$module_alerts = array();
|
||||
$dont_filter = false;
|
||||
|
||||
//Add succes message for one module update
|
||||
@@ -1514,7 +1546,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
$href = Context::getContext()->link->getAdminLink('AdminModules', true).'&module_name='.$module->name.'&tab_module='.$module->tab.'&configure='.$module->name;
|
||||
$this->context->smarty->assign('text', sprintf($this->l('%1$s: %2$s'), $module->displayName, $module->warning));
|
||||
$this->context->smarty->assign('module_link', $href);
|
||||
$this->displayWarning($this->context->smarty->fetch('controllers/modules/warning_module.tpl'));
|
||||
$module_alerts[] = $this->context->smarty->fetch('controllers/modules/warning_module.tpl');
|
||||
}
|
||||
|
||||
// AutoComplete array
|
||||
@@ -1540,7 +1572,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
}
|
||||
unset($object);
|
||||
if ($module->installed && isset($module->version_addons) && $module->version_addons) {
|
||||
$upgrade_available[] = array('anchor' => ucfirst($module->name), 'name' => $module->name, 'displayName' => $module->displayName);
|
||||
$upgrade_available[] = array('anchor' => ucfirst($module->name), 'name' => $module->name, 'displayName' => $module->displayName, 'is_native' => $module->is_native);
|
||||
}
|
||||
|
||||
if (in_array($module->name, $this->list_partners_modules)) {
|
||||
@@ -1578,6 +1610,7 @@ class AdminModulesControllerCore extends AdminController
|
||||
$tpl_vars = array(
|
||||
'token' => $this->token,
|
||||
'upgrade_available' => $upgrade_available,
|
||||
'module_alerts' => $module_alerts,
|
||||
'currentIndex' => self::$currentIndex,
|
||||
'dirNameCurrentIndex' => dirname(self::$currentIndex),
|
||||
'ajaxCurrentIndex' => str_replace('index', 'ajax-tab', self::$currentIndex),
|
||||
@@ -1648,4 +1681,192 @@ class AdminModulesControllerCore extends AdminController
|
||||
));
|
||||
$this->smartyOutputContent('controllers/modules/quickview.tpl');
|
||||
}
|
||||
|
||||
public function ajaxProcessUploadModule()
|
||||
{
|
||||
$response = array('success' => false);
|
||||
$this->postProcessDownload(false);
|
||||
if (!count($this->errors)) {
|
||||
$filename = $_FILES['file']['name'];
|
||||
$filename = explode('.', $filename);
|
||||
if ($module = Module::getInstanceByName($filename[0])) {
|
||||
$response['success'] = true;
|
||||
if (Module::isInstalled($module->name)) {
|
||||
$response['msg'] = $this->l('module already installed, update if available');
|
||||
} else {
|
||||
$response['msg'] = $this->l('module uploaded successfully');
|
||||
}
|
||||
if (@filemtime(_PS_ROOT_DIR_.DIRECTORY_SEPARATOR.basename(_PS_MODULE_DIR_).DIRECTORY_SEPARATOR.$module->name
|
||||
.DIRECTORY_SEPARATOR.'logo.png')) {
|
||||
$module->image = _MODULE_DIR_.DIRECTORY_SEPARATOR.$module->name
|
||||
.DIRECTORY_SEPARATOR.'logo.png';
|
||||
}
|
||||
$response['data']['module'] = array(
|
||||
'module_name' => $module->name,
|
||||
'displayName' => $module->displayName,
|
||||
'installed' => Module::isInstalled($module->name),
|
||||
'author' => $module->author,
|
||||
'image' => $module->image ? $module->image : ''
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$response['errors'] = $this->errors;
|
||||
}
|
||||
$this->logAndResponseAjax($response);
|
||||
}
|
||||
|
||||
public function ajaxProcessCheckModuleTrusted()
|
||||
{
|
||||
$response = array(
|
||||
'success' => false,
|
||||
'data' => array('trusted' => false)
|
||||
);
|
||||
if ($moduleName = Tools::getValue('module_name')) {
|
||||
if ($module = Module::getInstanceByName($moduleName)) {
|
||||
if ($response['data']['trusted'] = Module::isModuleTrusted($moduleName)) {
|
||||
$response['msg'] = $this->l('Module trusted');
|
||||
} else {
|
||||
$response['msg'] = $this->l('Module not trusted');
|
||||
}
|
||||
$response['success'] = true;
|
||||
} else {
|
||||
$this->errors[] = $this->l('Module not found.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Invalid module provided');
|
||||
}
|
||||
$response['errors'] = $this->errors;
|
||||
$this->logAndResponseAjax($response);
|
||||
}
|
||||
|
||||
public function ajaxProcessInstallModule()
|
||||
{
|
||||
$response = array(
|
||||
'success' => false,
|
||||
);
|
||||
if ($moduleName = Tools::getValue('module_name')) {
|
||||
if ($module = Module::getInstanceByName($moduleName)) {
|
||||
if (!Module::isInstalled($module->name)) {
|
||||
if ($response['success'] = $module->install()) {
|
||||
$response['msg'] = $this->l('Module installed successfully');
|
||||
$response['data']['redirect'] = $this->context->link->getAdminLink('AdminModules').'&conf=12&anchor='.$module->name;
|
||||
} else {
|
||||
$this->errors[] = $this->l('Cannot install this module.');
|
||||
}
|
||||
} else {
|
||||
$response['success'] = true;
|
||||
$response['msg'] = $this->l('Module already installed');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Module not found.');
|
||||
}
|
||||
}
|
||||
|
||||
if (count($this->errors)) {
|
||||
$response['data']['callback']['process'] = 'delete';
|
||||
$response['data']['callback']['msg'] = $this->l('There was some error while installing the module, do you want to delete the uploded module');
|
||||
$response['errors'] = $this->errors;
|
||||
}
|
||||
$this->logAndResponseAjax($response);
|
||||
}
|
||||
|
||||
public function ajaxProcessRollbackModuleUpload()
|
||||
{
|
||||
$response = array(
|
||||
'success' => false
|
||||
);
|
||||
$process = Tools::getValue('process');
|
||||
if ($moduleName = Tools::getValue('module_name')) {
|
||||
if($process == 'disable') {
|
||||
if ($module = Module::getInstanceByName($moduleName)) {
|
||||
if (Module::isInstalled($module->name)) {
|
||||
$module->disable();
|
||||
$response['success'] = true;
|
||||
$response['msg'] = $this->l('Module disable successfully');
|
||||
$response['data']['redirect'] = $this->context->link->getAdminLink('AdminModules').'&conf=5';
|
||||
}
|
||||
}
|
||||
} else if($process == 'delete' || $process == 'uninstall') {
|
||||
if ($module = Module::getInstanceByName($moduleName)) {
|
||||
if (Module::isInstalled($module->name)) {
|
||||
if ($module->uninstall()) {
|
||||
if ($process == 'uninstall') {
|
||||
$response['success'] = true;
|
||||
$response['msg'] = $this->l('Module uninstall process completed');
|
||||
$response['data']['redirect'] = $this->context->link->getAdminLink('AdminModules').'&conf=22';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if($process == 'delete') {
|
||||
if (is_dir(_PS_MODULE_DIR_.$moduleName)) {
|
||||
$this->recursiveDeleteOnDisk(_PS_MODULE_DIR_.$moduleName);
|
||||
$response['success'] = true;
|
||||
$response['msg'] = $this->l('Module rollback process completed');
|
||||
$response['data']['redirect'] = $this->context->link->getAdminLink('AdminModules').'&conf=22';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$response['errors'] = $this->errors;
|
||||
|
||||
$this->logAndResponseAjax($response);
|
||||
}
|
||||
|
||||
public function ajaxProcessUpdateModule()
|
||||
{
|
||||
$response = array(
|
||||
'success' => false
|
||||
);
|
||||
if ($moduleName = Tools::getValue('module_name')) {
|
||||
if ($module = Module::getInstanceByName($moduleName)) {
|
||||
if ($installed = Module::getModuleInstallVersion($module->name)) {
|
||||
$module->installed = (bool)$installed;
|
||||
$module->database_version = $installed['version'];
|
||||
if (Module::initUpgradeModule($module)) {
|
||||
if (!class_exists($module->name)) {
|
||||
require_once(_PS_MODULE_DIR_.$module->name.'/'.$module->name.'.php');
|
||||
}
|
||||
if ($object = Adapter_ServiceLocator::get($module->name)) {
|
||||
$object->runUpgradeModule();
|
||||
if ((count($errors_module_list = $object->getErrors()))) {
|
||||
$this->errors = array_merge($this->errors, array('name' => $module->displayName, 'message' => $errors_module_list));
|
||||
} elseif ((count($conf_module_list = $object->getConfirmations()))) {
|
||||
$response['data']['upgrade'][] = array('name' => $module->displayName, 'message' => $conf_module_list);
|
||||
$response['success'] = true;
|
||||
$html = $this->generateHtmlMessage($response['data']['upgrade']);
|
||||
$response['msg'] = sprintf($this->l('The following module was upgraded successfully: %s.'), $html);
|
||||
$response['data']['redirect'] = $this->context->link->getAdminLink('AdminModules').'&conf=29&anchor='.$module->name;
|
||||
}
|
||||
unset($object);
|
||||
} else {
|
||||
$this->errors[] = $this->l('Module not found!');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('There was some error while updating the module');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Module not installed, install module before updating.');
|
||||
}
|
||||
} else {
|
||||
$this->errors[] = $this->l('Module not found!');
|
||||
}
|
||||
}
|
||||
if (count($this->errors)) {
|
||||
$response['data']['callback']['process'] = 'disable';
|
||||
$response['data']['callback']['msg'] = $this->l('There was some error while updating the module, do you want to disable the module');
|
||||
$response['errors'] = $this->errors;
|
||||
}
|
||||
|
||||
$this->logAndResponseAjax($response);
|
||||
}
|
||||
|
||||
public function logAndResponseAjax($response)
|
||||
{
|
||||
if (isset($response['errors']) && count($response['errors'])) {
|
||||
PrestaShopLogger::addLog('Module install/upload error : Resquest => '.json_encode(Tools::getAllValues()).' || Response =>'.(json_encode($response)), 1, null, 'Module', null, true, (int)$this->context->employee->id);
|
||||
}
|
||||
$this->ajaxDie(json_encode($response));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,12 +92,6 @@ class AdminPaymentControllerCore extends AdminController
|
||||
$this->toolbar_title = array_unique($this->breadcrumbs);
|
||||
}
|
||||
|
||||
public function initPageHeaderToolbar()
|
||||
{
|
||||
parent::initPageHeaderToolbar();
|
||||
$this->page_header_toolbar_btn = array();
|
||||
}
|
||||
|
||||
public function postProcess()
|
||||
{
|
||||
if (Tools::getValue('action') == 'GetModuleQuickView' && Tools::getValue('ajax') == '1') {
|
||||
@@ -274,40 +268,4 @@ class AdminPaymentControllerCore extends AdminController
|
||||
|
||||
return parent::renderView();
|
||||
}
|
||||
|
||||
public function renderModulesList()
|
||||
{
|
||||
if ($this->getModulesList($this->filter_modules_list)) {
|
||||
$active_list = array();
|
||||
foreach ($this->modules_list as $key => $module) {
|
||||
if (in_array($module->name, $this->list_partners_modules)) {
|
||||
$this->modules_list[$key]->type = 'addonsPartner';
|
||||
}
|
||||
if (isset($module->description_full) && trim($module->description_full) != '') {
|
||||
$module->show_quick_view = true;
|
||||
}
|
||||
|
||||
if ($module->active) {
|
||||
$active_list[] = $module;
|
||||
} else {
|
||||
$unactive_list[] = $module;
|
||||
}
|
||||
}
|
||||
|
||||
$helper = new Helper();
|
||||
$fetch = '';
|
||||
|
||||
if (isset($active_list)) {
|
||||
$this->context->smarty->assign('panel_title', $this->l('Active payment'));
|
||||
$fetch = $helper->renderModulesList($active_list);
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(array(
|
||||
'panel_title' => $this->l('Recommended payment gateways'),
|
||||
'view_all' => true
|
||||
));
|
||||
$fetch .= $helper->renderModulesList($unactive_list);
|
||||
return $fetch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ abstract class AdminStatsTabControllerCore extends AdminPreferencesControllerCor
|
||||
}
|
||||
|
||||
$this->initTabModuleList();
|
||||
$this->addToolBarModulesListButton();
|
||||
$this->toolbar_title = $this->l('Stats', 'AdminStatsTab');
|
||||
$this->initPageHeaderToolbar();
|
||||
if ($this->display == 'view') {
|
||||
|
||||
@@ -506,7 +506,7 @@ class AdminThemesControllerCore extends AdminController
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (!$this->isFresh(Theme::CACHE_FILE_CUSTOMER_THEMES_LIST, 86400)) {
|
||||
if (!$this->isFresh(Theme::CACHE_FILE_CUSTOMER_THEMES_LIST, _TIME_1_DAY_)) {
|
||||
file_put_contents(_PS_ROOT_DIR_.Theme::CACHE_FILE_CUSTOMER_THEMES_LIST, Tools::addonsRequest('customer_themes'));
|
||||
}
|
||||
|
||||
@@ -2075,6 +2075,15 @@ class AdminThemesControllerCore extends AdminController
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
foreach ($xml->modules as $row) {
|
||||
if ($row['type'] == 'disk') {
|
||||
foreach ($row->module as $row2) {
|
||||
$natives[] = (string)$row2['name'];
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (count($natives) > 0) {
|
||||
|
||||
@@ -186,6 +186,9 @@
|
||||
<tab id="Modules_1" id_parent="Modules" active="1" hide_host_mode="0">
|
||||
<class_name>AdminModules</class_name>
|
||||
</tab>
|
||||
<tab id="Modules_Catalog" id_parent="Modules" active="1" hide_host_mode="0">
|
||||
<class_name>AdminModulesCatalog</class_name>
|
||||
</tab>
|
||||
<!-- <tab id="Modules_Themes_Catalog" id_parent="Modules" active="1" hide_host_mode="0">
|
||||
<class_name>AdminAddonsCatalog</class_name>
|
||||
</tab> -->
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
<access id="access_3_59" id_profile="Logistician" id_tab="Taxes" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_3_60" id_profile="Logistician" id_tab="Translations" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_3_61" id_profile="Logistician" id_tab="Modules_1" view="1" add="0" edit="1" delete="0"/>
|
||||
<access id="access_3_62" id_profile="Logistician" id_tab="Modules_Catalog" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_3_62" id_profile="Logistician" id_tab="Modules_Themes_Catalog" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_3_63" id_profile="Logistician" id_tab="Positions" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_3_64" id_profile="Logistician" id_tab="Payment" view="0" add="0" edit="0" delete="0"/>
|
||||
@@ -169,6 +170,7 @@
|
||||
<access id="access_4_59" id_profile="Translator" id_tab="Taxes" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_4_60" id_profile="Translator" id_tab="Translations" view="1" add="1" edit="1" delete="1"/>
|
||||
<access id="access_4_61" id_profile="Translator" id_tab="Modules_1" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_4_62" id_profile="Translator" id_tab="Modules_Catalog" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_4_62" id_profile="Translator" id_tab="Modules_Themes_Catalog" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_4_63" id_profile="Translator" id_tab="Positions" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_4_64" id_profile="Translator" id_tab="Payment" view="0" add="0" edit="0" delete="0"/>
|
||||
@@ -269,6 +271,7 @@
|
||||
<access id="access_5_59" id_profile="Salesman" id_tab="Taxes" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_5_60" id_profile="Salesman" id_tab="Translations" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_5_61" id_profile="Salesman" id_tab="Modules_1" view="1" add="0" edit="1" delete="0"/>
|
||||
<access id="access_5_62" id_profile="Salesman" id_tab="Modules_Catalog" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_5_62" id_profile="Salesman" id_tab="Modules_Themes_Catalog" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_5_63" id_profile="Salesman" id_tab="Positions" view="0" add="0" edit="0" delete="0"/>
|
||||
<access id="access_5_64" id_profile="Salesman" id_tab="Payment" view="0" add="0" edit="0" delete="0"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Данъчни правила"/>
|
||||
<tab id="Translations" name="Преводи"/>
|
||||
<tab id="Modules_1" name="Модули и услуги"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Каталог с модули и теми"/>
|
||||
<tab id="Positions" name="Разположение"/>
|
||||
<tab id="Payment" name="Плащане"/>
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<tab id='Tax_Rules' name='শুল্ক নিয়ম'/>
|
||||
<tab id='Translations' name='অনুবাদ'/>
|
||||
<tab id='Modules_1' name='মডিউল'/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id='Modules_Themes_Catalog' name='মডিউল এবং থইম ক্যাটআলগ'/>
|
||||
<tab id='Positions' name='অবস্থান'/>
|
||||
<tab id='Payment' name='পরিশোধ'/>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<!-- <tab id="Merchandise_Returns" name="Devolução de mercadoria"/> -->
|
||||
<tab id="Modules_1" name="Módulos e Serviços"/>
|
||||
<tab id="Modules" name="Módulos"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Catálogo de Módulos & Temas"/>
|
||||
<tab id="Monitoring" name="Monitoramento"/>
|
||||
<tab id="Multistore" name="Multiloja"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Daňová pravidla"/>
|
||||
<tab id="Translations" name="Překlady"/>
|
||||
<tab id="Modules_1" name="Moduly a Služby"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Katalog modulů a šablon"/>
|
||||
<tab id="Positions" name="Pozice modulů"/>
|
||||
<tab id="Payment" name="Platba"/>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<!-- <tab id="Merchandise_Returns" name="Warenrücksendungen"/> -->
|
||||
<tab id="Modules_1" name="Module"/>
|
||||
<tab id="Modules" name="Module"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Module & Templates"/>
|
||||
<tab id="Monitoring" name="Kontrollübersicht"/>
|
||||
<tab id="Multistore" name="Multishop"/>
|
||||
|
||||
@@ -58,7 +58,8 @@
|
||||
<tab id="Taxes" name="Taxes"/>
|
||||
<tab id="Tax_Rules" name="Tax Rules"/>
|
||||
<tab id="Translations" name="Translations"/>
|
||||
<tab id="Modules_1" name="Modules and Services"/>
|
||||
<tab id="Modules_1" name="Manage Modules"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Modules & Themes Catalog"/>
|
||||
<tab id="Positions" name="Positions"/>
|
||||
<tab id="Payment" name="Payment"/>
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<tab id="Tax_Rules" name="Reglas de tasas"/>
|
||||
<tab id="Translations" name="Traducciones"/>
|
||||
<tab id="Modules_1" name="Módulos y Servicios"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Catálogo de Módulos y Temas"/>
|
||||
<tab id="Positions" name="Posiciones de los módulos"/>
|
||||
<tab id="Payment" name="Pago"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="قوانین مالیاتی"/>
|
||||
<tab id="Translations" name="ترجمهها"/>
|
||||
<tab id="Modules_1" name="ماژول ها و سرویس ها"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="کاتالوگ ماژولها و قالبها"/>
|
||||
<tab id="Positions" name="جایگاهها"/>
|
||||
<tab id="Payment" name="پرداخت"/>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<!-- <tab id="Merchandise_Returns" name="Retours produits"/> -->
|
||||
<tab id="Modules_1" name="Modules et Services"/>
|
||||
<tab id="Modules" name="Modules et Services"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Catalogue de modules et thèmes"/>
|
||||
<tab id="Monitoring" name="Suivi"/>
|
||||
<tab id="Multistore" name="Multiboutique"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="כללי מס"/>
|
||||
<tab id="Translations" name="תרגומים"/>
|
||||
<tab id="Modules_1" name="מודולים"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="קטלוג מודולים וערכות עיצוב"/>
|
||||
<tab id="Positions" name="מיקומים"/>
|
||||
<tab id="Payment" name="תשלום"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Pravila poreza"/>
|
||||
<tab id="Translations" name="Prijevodi"/>
|
||||
<tab id="Modules_1" name="Moduli i servisi"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Katalog Modula i Tema"/>
|
||||
<tab id="Positions" name="Pozicije"/>
|
||||
<tab id="Payment" name="Plaćanje"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Adószabályok"/>
|
||||
<tab id="Translations" name="Translations"/>
|
||||
<tab id="Modules_1" name="Modules and Services"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Modules & Themes Catalog"/>
|
||||
<tab id="Positions" name="Positions"/>
|
||||
<tab id="Payment" name="Fizetés"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Aturan pajak"/>
|
||||
<tab id="Translations" name="Terjemahan"/>
|
||||
<tab id="Modules_1" name="Modul dan layanan"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Katalog modul dan theme"/>
|
||||
<tab id="Positions" name="Posisi"/>
|
||||
<tab id="Payment" name="Pembayaran"/>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<!-- <tab id="Merchandise_Returns" name="Restituzione prodotto"/> -->
|
||||
<tab id="Modules_1" name="Moduli e Servizi"/>
|
||||
<tab id="Modules" name="Moduli"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Catalogo Moduli e temi"/>
|
||||
<tab id="Monitoring" name="Monitoraggio"/>
|
||||
<tab id="Multistore" name="Multi-negozio"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Mokesčių taisyklės"/>
|
||||
<tab id="Translations" name="Vertimai"/>
|
||||
<tab id="Modules_1" name="Moduliai ir paslaugos"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Modulių ir temų katalogas"/>
|
||||
<tab id="Positions" name="Pozicijos"/>
|
||||
<tab id="Payment" name="Mokėjimas"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Даночни правила"/>
|
||||
<tab id="Translations" name="Преводи"/>
|
||||
<tab id="Modules_1" name="Модули"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Модули и каталог на теми"/>
|
||||
<tab id="Positions" name="Позиции"/>
|
||||
<tab id="Payment" name="Плаќање"/>
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
<tab id="Tax_Rules" name="Btw-regels"/>
|
||||
<tab id="Translations" name="Vertalingen"/>
|
||||
<tab id="Modules_1" name="Modules en Services"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Module- & themacatologus"/>
|
||||
<tab id="Positions" name="Posities"/>
|
||||
<tab id="Payment" name="Betaling"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Tax Rules"/>
|
||||
<tab id="Translations" name="Translations"/>
|
||||
<tab id="Modules_1" name="Moduler og tjenester"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Modules & Themes Catalog"/>
|
||||
<tab id="Positions" name="Positions"/>
|
||||
<tab id="Payment" name="Payment"/>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<!-- <tab id="Merchandise_Returns" name="Zwroty produktów"/> -->
|
||||
<tab id="Modules_1" name="Moduły i usługi"/>
|
||||
<tab id="Modules" name="Moduły"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Katalog Modułów i Szablonów"/>
|
||||
<tab id="Monitoring" name="Monitorowanie"/>
|
||||
<tab id="Multistore" name="Zestawienie sklepów ?"/>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<!-- <tab id="Merchandise_Returns" name="Devolução de mercadoria"/> -->
|
||||
<tab id="Modules_1" name="Módulos e Serviços"/>
|
||||
<tab id="Modules" name="Módulos"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Catálogo de Módulos e Temas"/>
|
||||
<tab id="Monitoring" name="Monitoramento"/>
|
||||
<tab id="Multistore" name="Multi loja"/>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<!-- <tab id="Merchandise_Returns" name="Retours produits"/> -->
|
||||
<tab id="Modules_1" name="Modules et services"/>
|
||||
<tab id="Modules" name="Modules"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Catalogue de modules et thèmes"/>
|
||||
<tab id="Monitoring" name="Suivi"/>
|
||||
<tab id="Multistore" name="Multiboutique"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Reguli de taxare"/>
|
||||
<tab id="Translations" name="Traduceri"/>
|
||||
<tab id="Modules_1" name="Module și servicii"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Catalog de teme și module"/>
|
||||
<tab id="Positions" name="Poziții"/>
|
||||
<tab id="Payment" name="Plată"/>
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
<!-- <tab id="Merchandise_Returns" name="Возвраты товаров"/> -->
|
||||
<tab id="Modules_1" name="Модули и Сервисы"/>
|
||||
<tab id="Modules" name="Модули"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Модули & Шаблоны"/>
|
||||
<tab id="Monitoring" name="Мониторинг"/>
|
||||
<tab id="Multistore" name="Мульти-магазин"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Davčna pravila"/>
|
||||
<tab id="Translations" name="Prevodi"/>
|
||||
<tab id="Modules_1" name="Moduli in storitve"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Katalog modulov in tem"/>
|
||||
<tab id="Positions" name="Pozicije"/>
|
||||
<tab id="Payment" name="Plačilo"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Poreksa pravila"/>
|
||||
<tab id="Translations" name="Prevodi"/>
|
||||
<tab id="Modules_1" name="Modules and Services"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Katalog tema i modula"/>
|
||||
<tab id="Positions" name="Pozicije"/>
|
||||
<tab id="Payment" name="Plaćanje"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Momsregler"/>
|
||||
<tab id="Translations" name="Översättningar"/>
|
||||
<tab id="Modules_1" name="Moduler och Tjänster"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Katalog med moduler & teman"/>
|
||||
<tab id="Positions" name="Positioner"/>
|
||||
<tab id="Payment" name="Betalning"/>
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<tab id="Tax_Rules" name="稅務規則"/>
|
||||
<tab id="Translations" name="翻譯"/>
|
||||
<tab id="Modules_1" name="模組"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="目錄模組與佈景"/>
|
||||
<tab id="Positions" name="位置"/>
|
||||
<tab id="Payment" name="付款"/>
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<!-- <tab id="Merchandise_Returns" name="Hàng hóa trả lại"/> -->
|
||||
<tab id="Modules" name="Modules và dịch vụ"/>
|
||||
<tab id="Modules_1" name="Modules và dịch vụ"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Danh mục Module & Giao diện"/>
|
||||
<tab id="Monitoring" name="Giám sát"/>
|
||||
<tab id="Multistore" name="Multistore"/>
|
||||
|
||||
@@ -59,6 +59,7 @@
|
||||
<tab id="Tax_Rules" name="Tax Rules"/>
|
||||
<tab id="Translations" name="Translations"/>
|
||||
<tab id="Modules_1" name="Modules"/>
|
||||
<tab id="Modules_Catalog" name="Modules Catalog"/>
|
||||
<tab id="Modules_Themes_Catalog" name="Modules & Themes Catalog"/>
|
||||
<tab id="Positions" name="Positions"/>
|
||||
<tab id="Payment" name="Payment"/>
|
||||
|
||||
@@ -54,7 +54,7 @@ function deactivate_custom_modules()
|
||||
$arrNativeModules = array();
|
||||
if (is_array($nativeModules)) {
|
||||
foreach ($nativeModules as $nativeModulesType) {
|
||||
if (in_array($nativeModulesType['type'], array('native', 'partner'))) {
|
||||
if (in_array($nativeModulesType['type'], array('native', 'disk', 'partner'))) {
|
||||
$arrNativeModules[] = '""';
|
||||
foreach ($nativeModulesType->module as $module) {
|
||||
$arrNativeModules[] = '"'.pSQL($module['name']).'"';
|
||||
|
||||
52
js/admin.js
52
js/admin.js
@@ -728,6 +728,27 @@ $(document).ready(function()
|
||||
$('#theme_fieldset_'+formToMove+' .form-wrapper').appendTo('#'+formDestination);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
resAjax = $.ajax({
|
||||
type:"POST",
|
||||
url: 'index.php',
|
||||
headers: {"cache-control": "no-cache"},
|
||||
async: true,
|
||||
cache: false,
|
||||
data: {
|
||||
ajax : "1",
|
||||
token : token,
|
||||
action : "refreshModuleList"
|
||||
},
|
||||
success: function(data){
|
||||
}
|
||||
});
|
||||
}
|
||||
catch(e) { }
|
||||
|
||||
|
||||
|
||||
$('select.chosen').each(function(k, item){
|
||||
$(item).chosen({disable_search_threshold: 10, search_contains: true});
|
||||
});
|
||||
@@ -863,7 +884,6 @@ $(document).ready(function()
|
||||
var moduleLink = $(this).data('link');
|
||||
var authorUri = $(this).data('author-uri');
|
||||
var isValidUri = /(https?):\/\/([a-z0-9\.]*)?(prestashop.com).*/gi;
|
||||
var addonsSearchLink = 'http://addons.prestashop.com/en/search?search_query='+encodeURIComponent(moduleDisplayName)+'&utm_source=back-office&utm_medium=addons-certified&utm_campaign=back-office-'+iso_user.toUpperCase();
|
||||
|
||||
$('.modal #untrusted-module-logo').attr('src', moduleImage);
|
||||
$('.modal .module-display-name-placeholder').text(moduleDisplayName);
|
||||
@@ -873,7 +893,6 @@ $(document).ready(function()
|
||||
$('.modal .author-name-placeholder').wrap('<a href="'+authorUri+'" onclick="window.open(this.href);return false;"></a>');
|
||||
|
||||
$('.modal #proceed-install-anyway').attr('href', moduleLink);
|
||||
$('.modal .catalog-link').attr('href', addonsSearchLink);
|
||||
$('.modal .catalog-link').attr('onclick', 'window.open(this.href);return false;');
|
||||
});
|
||||
|
||||
@@ -1206,14 +1225,14 @@ function openModulesList()
|
||||
ajax : "1",
|
||||
controller : "AdminModules",
|
||||
action : "getTabModulesList",
|
||||
tab_modules_list : tab_modules_list,
|
||||
controller_class: help_class_name,
|
||||
back_tab_modules_list : window.location.href
|
||||
},
|
||||
success : function(data)
|
||||
{
|
||||
$('#modules_list_container_tab_modal').html(data).slideDown();
|
||||
$('#modules_list_loader').hide();
|
||||
modules_list_loaded = true;
|
||||
// modules_list_loaded = true;
|
||||
$('.help-tooltip').tooltip();
|
||||
}
|
||||
});
|
||||
@@ -1576,3 +1595,28 @@ function countDown($source, $target) {
|
||||
$target.html(max-$source.val().length);
|
||||
});
|
||||
}
|
||||
|
||||
function loadRecommendation()
|
||||
{
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'index.php',
|
||||
async: true,
|
||||
dataType: 'JSON',
|
||||
data: {
|
||||
action: 'getRecommendationContent',
|
||||
tab: help_class_name,
|
||||
ajax: 1,
|
||||
token: token
|
||||
},
|
||||
success: function(res) {
|
||||
$('#recommendation-wrapper-skeleton').fadeOut('slow').hide();
|
||||
if (res.success) {
|
||||
$('#recommendation-wrapper').html(res.content).fadeIn('slow');
|
||||
}
|
||||
},
|
||||
error: function(res) {
|
||||
$('#recommendation-wrapper-skeleton').fadeOut('slow').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -297,7 +297,6 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
refreshDashboard(false, false);
|
||||
getBlogRss();
|
||||
bindSubmitDashConfig();
|
||||
bindCancelDashConfig();
|
||||
|
||||
|
||||
299
js/admin/modules.js
Normal file
299
js/admin/modules.js
Normal file
@@ -0,0 +1,299 @@
|
||||
/**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*/
|
||||
|
||||
$('document').ready( function() {
|
||||
|
||||
$('[data-toggle="tab"]').click(function() {
|
||||
if ($(this).parent().hasClass('active')) {
|
||||
$($(this).attr("href")).toggleClass('active');
|
||||
setTimeout(() => {
|
||||
$(this).parent().removeClass('active');
|
||||
}, 0);
|
||||
}
|
||||
});
|
||||
|
||||
$('#module_install_form').on('submit', function(e) {
|
||||
e.preventDefault();
|
||||
let module;
|
||||
initializeUploadPanel();
|
||||
uploadModule(this).then((response) => {
|
||||
module = response.data.module;
|
||||
if (!module.installed) {
|
||||
checkModuleTrusted(module).then((response) => {
|
||||
if (!response.data.trusted) {
|
||||
return displayWariningIfUntrusted(module);
|
||||
} else {
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}).then((install) => {
|
||||
if (install) {
|
||||
return installModule(module);
|
||||
} else {
|
||||
if (confirm(remove_uploaded_module_txt)) {
|
||||
return rollBackChanges(module, 'delete');
|
||||
} else {
|
||||
window.location.href = admin_modules_link + '&conf=18';
|
||||
}
|
||||
}
|
||||
}).catch((response) => {
|
||||
handleError(response, module);
|
||||
});
|
||||
} else {
|
||||
updateModule(module).catch((response) => {
|
||||
handleError(response, module);
|
||||
});
|
||||
}
|
||||
}).catch((response) => {
|
||||
displayErrors(response, module);
|
||||
}).finally(() => {
|
||||
$('#module_install_form').find('button[type="submit"]').attr("disabled", false);
|
||||
});
|
||||
});
|
||||
|
||||
$('#proceed-install-anyway').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
})
|
||||
|
||||
function displayErrors(response, module)
|
||||
{
|
||||
let error_list = $('<ul/>').appendTo('#module_install_status .install_errors .list');
|
||||
$.each(response.errors, function(i, val) {
|
||||
$('<li/>').text(val).appendTo(error_list);
|
||||
});
|
||||
$('#module_install_status div.install_errors').show();
|
||||
}
|
||||
|
||||
function handleError(response, module)
|
||||
{
|
||||
displayErrors(response, module);
|
||||
if (response.data.callback.process) {
|
||||
setTimeout(() => {
|
||||
if (confirm(response.data.callback.msg ? response.data.callback.msg : module_install_error_txt+' '+remove_uploaded_module_txt)) {
|
||||
rollBackChanges(module, response.data.callback.process);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
function displayWariningIfUntrusted(data)
|
||||
{
|
||||
return new Promise((resolve) => {
|
||||
var moduleDisplayName = data.displayName;
|
||||
var moduleImage = data.image;
|
||||
var authorName = data.author;
|
||||
|
||||
$('.modal #untrusted-module-logo').attr('src', moduleImage);
|
||||
$('.modal .module-display-name-placeholder').text(moduleDisplayName);
|
||||
$('.modal .author-name-placeholder').text(authorName);
|
||||
|
||||
$('#moduleNotTrusted').modal('show');
|
||||
|
||||
$('#proceed-install-anyway').click(() => {
|
||||
$('#moduleNotTrusted').modal('hide');
|
||||
resolve(true);
|
||||
});
|
||||
$('#moduleNotTrusted').on('hidden.bs.modal', (e) => {
|
||||
resolve(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function initializeUploadPanel()
|
||||
{
|
||||
$('#module_install_form').find('button[type="submit"]').attr("disabled","disabled");
|
||||
$('#module_install_status').show().find('ul li').hide().find('i').removeClass('icon-check icon-times text-danger text-success').addClass('icon-refresh icon-spin');
|
||||
$('#module_install_status div.install_errors').hide();
|
||||
return
|
||||
}
|
||||
|
||||
function uploadModule(uploadModule)
|
||||
{
|
||||
return new Promise((resolve, reject) => {
|
||||
let formData = new FormData(uploadModule);
|
||||
formData.append('ajax', true);
|
||||
formData.append('action', 'uploadModule');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: admin_modules_link,
|
||||
data: formData,
|
||||
dataType: 'json',
|
||||
contentType: false,
|
||||
cache: false,
|
||||
processData:false,
|
||||
beforeSend: function(){
|
||||
$('#module_install_status').find('.mod_status_upload').show();
|
||||
},
|
||||
success: function(json) {
|
||||
if (json.success) {
|
||||
$('#module_install_status').find('.mod_status_upload i').addClass('icon-check text-success').removeClass('icon-refresh icon-spin');
|
||||
resolve(json);
|
||||
}
|
||||
else {
|
||||
$('#module_install_status').find('.mod_status_upload i').addClass('icon-times text-danger').removeClass('icon-refresh icon-spin');
|
||||
reject(json);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function checkModuleTrusted(data)
|
||||
{
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: admin_modules_link,
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'checkModuleTrusted',
|
||||
module_name: data.module_name
|
||||
},
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
beforeSend: function(){
|
||||
$('#module_install_status').find('.mod_status_check').show();
|
||||
},
|
||||
success: function(json) {
|
||||
if (json.success){
|
||||
$('#module_install_status').find('.mod_status_check i').addClass('icon-check text-success').removeClass('icon-refresh icon-spin');
|
||||
if (json.msg){
|
||||
$('#module_install_status').find('.mod_status_check').append(' <b>'+json.msg+'</b>');
|
||||
if (json.data.trusted) {
|
||||
$('#module_install_status').find('.mod_status_check b').addClass('text-success');
|
||||
} else {
|
||||
$('#module_install_status').find('.mod_status_check b').addClass('text-danger');
|
||||
}
|
||||
}
|
||||
resolve(json);
|
||||
} else {
|
||||
$('#module_install_status').find('.mod_status_check i').addClass('icon-times text-danger').removeClass('icon-refresh icon-spin');
|
||||
reject(json);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function installModule(data)
|
||||
{
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: admin_modules_link,
|
||||
data: {
|
||||
ajax: true,
|
||||
action: 'installModule',
|
||||
module_name: data.module_name
|
||||
},
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
beforeSend: function(){
|
||||
$('#module_install_status').find('.mod_status_install').show();
|
||||
},
|
||||
success: function(json) {
|
||||
if (json.success){
|
||||
$('#module_install_status').find('.mod_status_install i').addClass('icon-check text-success').removeClass('icon-refresh icon-spin');
|
||||
resolve(json);
|
||||
|
||||
if (json.data.redirect) {
|
||||
window.location.href = json.data.redirect;
|
||||
}
|
||||
}
|
||||
else{
|
||||
$('#module_install_status').find('.mod_status_install i').addClass('icon-times text-danger').removeClass('icon-refresh icon-spin');
|
||||
reject(json);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function rollBackChanges(data, process)
|
||||
{
|
||||
if (!process) {
|
||||
process = 'delete';
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url : admin_modules_link,
|
||||
data : {
|
||||
ajax : true,
|
||||
token : token,
|
||||
action : "rollbackModuleUpload",
|
||||
process : process,
|
||||
module_name: data.module_name
|
||||
},
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
beforeSend: function(){
|
||||
$('#module_install_status').find('.mod_status_rollback').show();
|
||||
},
|
||||
success: function(json){
|
||||
if (json.success) {
|
||||
$('#module_install_status').find('.mod_status_rollback i').addClass('icon-check text-success').removeClass('icon-refresh icon-spin');
|
||||
if (json.data.redirect) {
|
||||
window.location.href = json.data.redirect;
|
||||
}
|
||||
} else {
|
||||
$('#module_install_status').find('.mod_status_install i').addClass('icon-times text-danger').removeClass('icon-refresh icon-spin');
|
||||
reject(json);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function updateModule(data)
|
||||
{
|
||||
return new Promise((resolve, reject) => {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url : admin_modules_link,
|
||||
data : {
|
||||
ajax : true,
|
||||
token : token,
|
||||
action : "updateModule",
|
||||
module_name: data.module_name
|
||||
},
|
||||
dataType: 'JSON',
|
||||
cache: false,
|
||||
beforeSend: function(){
|
||||
$('#module_install_status').find('.mod_status_update').show();
|
||||
},
|
||||
success: function(json){
|
||||
if (json.success) {
|
||||
$('#module_install_status').find('.mod_status_update i').addClass('icon-check text-success').removeClass('icon-refresh icon-spin');
|
||||
$('#module_install_status div.install_msg').append(json.msg);
|
||||
if (json.data.redirect) {
|
||||
window.location.href = json.data.redirect;
|
||||
}
|
||||
resolve(json);
|
||||
} else {
|
||||
$('#module_install_status').find('.mod_status_update i').addClass('icon-times text-danger').removeClass('icon-refresh icon-spin');
|
||||
reject(json);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
118
js/admin/modules_catalog.js
Normal file
118
js/admin/modules_catalog.js
Normal file
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through LICENSE.txt file inside our module
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to CustomizationPolicy.txt file inside our module for more information.
|
||||
*
|
||||
* @author Webkul IN
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license LICENSE.txt
|
||||
*/
|
||||
|
||||
$('document').ready( function() {
|
||||
initPagination();
|
||||
// ScrollTo
|
||||
$('#module-search').on('keyup', function(){
|
||||
val = this.value;
|
||||
setTimeout(function () {
|
||||
filterPanel(val, 'suggested-modules-list');
|
||||
}, 200);
|
||||
}).on('keydown', function(e){
|
||||
if (e.keyCode == 13)
|
||||
return false;
|
||||
if (e.keyCode == 27) {
|
||||
this.value = '';
|
||||
}
|
||||
});
|
||||
|
||||
$('#theme-search').on('keyup', function(){
|
||||
val = this.value;
|
||||
setTimeout(function () {
|
||||
filterPanel(val, 'suggested-theme-list');
|
||||
}, 200);
|
||||
}).on('keydown', function(e){
|
||||
if (e.keyCode == 13)
|
||||
return false;
|
||||
if (e.keyCode == 27) {
|
||||
this.value = '';
|
||||
}
|
||||
});
|
||||
|
||||
$('#theme-sort, #module-sort').on('change', function(){
|
||||
setFilter();
|
||||
});
|
||||
|
||||
function filterPanel(val, element_class)
|
||||
{
|
||||
$('#'+element_class+' .list-empty').hide();
|
||||
$('#'+element_class+' .element-panel').css('display', 'flex').removeClass('hidden');
|
||||
|
||||
if (val != '') {
|
||||
var reg = new RegExp(val, "i");
|
||||
$('#'+element_class+' .element-panel .name').each(function(id, ele_name) {
|
||||
if (!reg.test($(ele_name).text()) && !reg.test($(ele_name).data('name'))){
|
||||
// if (!$(mod_name).text().includes(val)) {
|
||||
$(ele_name).closest('.element-panel').hide().addClass('hidden');
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!$('#'+element_class+' .element-panel:visible').length) {
|
||||
$('#'+element_class+' .list-empty').css('display', 'flex');
|
||||
}
|
||||
initPagination(element_class);
|
||||
}
|
||||
|
||||
function setFilter()
|
||||
{
|
||||
let theme_sorting = $("#theme-sort").val();
|
||||
let module_sorting = $("#module-sort").val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: 'index.php',
|
||||
async: true,
|
||||
dataType: 'JSON',
|
||||
data: {
|
||||
action: 'setSorting',
|
||||
theme_sorting: theme_sorting,
|
||||
module_sorting: module_sorting,
|
||||
tab: 'AdminModulesCatalog',
|
||||
ajax: 1,
|
||||
token: token
|
||||
},
|
||||
success: function(res) {
|
||||
location.reload();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function initPagination(selected_element_class) {
|
||||
$.each($('.suggested-elements'), function(i, element) {
|
||||
if (selected_element_class) {
|
||||
if ($(element).closest('.list-container').attr('id') != selected_element_class)
|
||||
return;
|
||||
}
|
||||
$(element).siblings('.pagination-container').find('.pagination-block').twbsPagination('destroy');
|
||||
let items = $(element).children(':not(.hidden)');
|
||||
if (items.length) {
|
||||
let total_pages = Math.ceil(items.length / num_block_per_page);
|
||||
$(element).siblings('.pagination-container').find('.pagination-block').twbsPagination({
|
||||
totalPages: total_pages,
|
||||
visiblePages: 5,
|
||||
onPageClick: function(e, pageNumber) {
|
||||
let showFrom = num_block_per_page * (pageNumber - 1);
|
||||
let showTo = showFrom + num_block_per_page;
|
||||
items.hide().slice(showFrom, showTo).css('display', 'flex');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
13
js/twbs-pagination/LICENSE
Normal file
13
js/twbs-pagination/LICENSE
Normal file
@@ -0,0 +1,13 @@
|
||||
Copyright 2014-2018 © Eugene Simakin
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
29
js/twbs-pagination/index.php
Normal file
29
js/twbs-pagination/index.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* 2010-2022 Webkul.
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* All right is reserved,
|
||||
* Please go through this link for complete license : https://store.webkul.com/license.html
|
||||
*
|
||||
* DISCLAIMER
|
||||
*
|
||||
* Do not edit or add to this file if you wish to upgrade this module to newer
|
||||
* versions in the future. If you wish to customize this module for your
|
||||
* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
|
||||
*
|
||||
* @author Webkul IN <support@webkul.com>
|
||||
* @copyright 2010-2022 Webkul IN
|
||||
* @license https://store.webkul.com/license.html
|
||||
*/
|
||||
|
||||
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
header('Cache-Control: post-check=0, pre-check=0', false);
|
||||
header('Pragma: no-cache');
|
||||
|
||||
header('Location: ../../');
|
||||
exit;
|
||||
364
js/twbs-pagination/jquery.twbsPagination.js
Normal file
364
js/twbs-pagination/jquery.twbsPagination.js
Normal file
@@ -0,0 +1,364 @@
|
||||
/*!
|
||||
* jQuery pagination plugin v1.4.2
|
||||
* http://josecebe.github.io/twbs-pagination/
|
||||
*
|
||||
* Copyright 2014-2018, Eugene Simakin
|
||||
* Released under Apache 2.0 license
|
||||
* http://apache.org/licenses/LICENSE-2.0.html
|
||||
*/
|
||||
(function ($, window, document, undefined) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var old = $.fn.twbsPagination;
|
||||
|
||||
// PROTOTYPE AND CONSTRUCTOR
|
||||
|
||||
var TwbsPagination = function (element, options) {
|
||||
this.$element = $(element);
|
||||
this.options = $.extend({}, $.fn.twbsPagination.defaults, options);
|
||||
|
||||
if (this.options.startPage < 1 || this.options.startPage > this.options.totalPages) {
|
||||
throw new Error('Start page option is incorrect');
|
||||
}
|
||||
|
||||
this.options.totalPages = parseInt(this.options.totalPages);
|
||||
if (isNaN(this.options.totalPages)) {
|
||||
throw new Error('Total pages option is not correct!');
|
||||
}
|
||||
|
||||
this.options.visiblePages = parseInt(this.options.visiblePages);
|
||||
if (isNaN(this.options.visiblePages)) {
|
||||
throw new Error('Visible pages option is not correct!');
|
||||
}
|
||||
|
||||
if (this.options.beforePageClick instanceof Function) {
|
||||
this.$element.first().on('beforePage', this.options.beforePageClick);
|
||||
}
|
||||
|
||||
if (this.options.onPageClick instanceof Function) {
|
||||
this.$element.first().on('page', this.options.onPageClick);
|
||||
}
|
||||
|
||||
// hide if only one page exists
|
||||
if (this.options.hideOnlyOnePage && this.options.totalPages == 1) {
|
||||
if (this.options.initiateStartPageClick) {
|
||||
this.$element.trigger('page', 1);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
if (this.options.href) {
|
||||
this.options.startPage = this.getPageFromQueryString();
|
||||
if (!this.options.startPage) {
|
||||
this.options.startPage = 1;
|
||||
}
|
||||
}
|
||||
|
||||
var tagName = (typeof this.$element.prop === 'function') ?
|
||||
this.$element.prop('tagName') : this.$element.attr('tagName');
|
||||
|
||||
if (tagName === 'UL') {
|
||||
this.$listContainer = this.$element;
|
||||
} else {
|
||||
var elements = this.$element;
|
||||
var $newListContainer = $([]);
|
||||
elements.each(function(index) {
|
||||
var $newElem = $("<ul></ul>");
|
||||
$(this).append($newElem);
|
||||
$newListContainer.push($newElem[0]);
|
||||
});
|
||||
this.$listContainer = $newListContainer;
|
||||
this.$element = $newListContainer;
|
||||
}
|
||||
|
||||
this.$listContainer.addClass(this.options.paginationClass);
|
||||
|
||||
if (this.options.initiateStartPageClick) {
|
||||
this.show(this.options.startPage);
|
||||
} else {
|
||||
this.currentPage = this.options.startPage;
|
||||
this.render(this.getPages(this.options.startPage));
|
||||
this.setupEvents();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
TwbsPagination.prototype = {
|
||||
|
||||
constructor: TwbsPagination,
|
||||
|
||||
destroy: function () {
|
||||
this.$element.empty();
|
||||
this.$element.removeData('twbs-pagination');
|
||||
this.$element.off('page');
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
show: function (page) {
|
||||
if (page < 1 || page > this.options.totalPages) {
|
||||
throw new Error('Page is incorrect.');
|
||||
}
|
||||
this.currentPage = page;
|
||||
|
||||
this.$element.trigger('beforePage', page);
|
||||
|
||||
var pages = this.getPages(page);
|
||||
this.render(pages);
|
||||
this.setupEvents();
|
||||
|
||||
this.$element.trigger('page', page);
|
||||
|
||||
return pages;
|
||||
},
|
||||
|
||||
enable: function () {
|
||||
this.show(this.currentPage);
|
||||
},
|
||||
|
||||
disable: function () {
|
||||
var _this = this;
|
||||
this.$listContainer.off('click').on('click', 'li', function (evt) {
|
||||
evt.preventDefault();
|
||||
});
|
||||
this.$listContainer.children().each(function () {
|
||||
var $this = $(this);
|
||||
if (!$this.hasClass(_this.options.activeClass)) {
|
||||
$(this).addClass(_this.options.disabledClass);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
buildListItems: function (pages) {
|
||||
var listItems = [];
|
||||
|
||||
if (this.options.first) {
|
||||
listItems.push(this.buildItem('first', 1));
|
||||
}
|
||||
|
||||
if (this.options.prev) {
|
||||
var prev = pages.currentPage > 1 ? pages.currentPage - 1 : this.options.loop ? this.options.totalPages : 1;
|
||||
listItems.push(this.buildItem('prev', prev));
|
||||
}
|
||||
|
||||
for (var i = 0; i < pages.numeric.length; i++) {
|
||||
listItems.push(this.buildItem('page', pages.numeric[i]));
|
||||
}
|
||||
|
||||
if (this.options.next) {
|
||||
var next = pages.currentPage < this.options.totalPages ? pages.currentPage + 1 : this.options.loop ? 1 : this.options.totalPages;
|
||||
listItems.push(this.buildItem('next', next));
|
||||
}
|
||||
|
||||
if (this.options.last) {
|
||||
listItems.push(this.buildItem('last', this.options.totalPages));
|
||||
}
|
||||
|
||||
return listItems;
|
||||
},
|
||||
|
||||
buildItem: function (type, page) {
|
||||
var $itemContainer = $('<li></li>'),
|
||||
$itemContent = $('<a></a>'),
|
||||
itemText = this.options[type] ? this.makeText(this.options[type], page) : page;
|
||||
|
||||
$itemContainer.addClass(this.options[type + 'Class']);
|
||||
$itemContainer.data('page', page);
|
||||
$itemContainer.data('page-type', type);
|
||||
$itemContainer.append($itemContent.attr('href', this.makeHref(page)).addClass(this.options.anchorClass).html(itemText));
|
||||
|
||||
return $itemContainer;
|
||||
},
|
||||
|
||||
getPages: function (currentPage) {
|
||||
var pages = [];
|
||||
|
||||
var half = Math.floor(this.options.visiblePages / 2);
|
||||
var start = currentPage - half + 1 - this.options.visiblePages % 2;
|
||||
var end = currentPage + half;
|
||||
|
||||
var visiblePages = this.options.visiblePages;
|
||||
if (visiblePages > this.options.totalPages) {
|
||||
visiblePages = this.options.totalPages;
|
||||
}
|
||||
|
||||
// handle boundary case
|
||||
if (start <= 0) {
|
||||
start = 1;
|
||||
end = visiblePages;
|
||||
}
|
||||
if (end > this.options.totalPages) {
|
||||
start = this.options.totalPages - visiblePages + 1;
|
||||
end = this.options.totalPages;
|
||||
}
|
||||
|
||||
var itPage = start;
|
||||
while (itPage <= end) {
|
||||
pages.push(itPage);
|
||||
itPage++;
|
||||
}
|
||||
|
||||
return {"currentPage": currentPage, "numeric": pages};
|
||||
},
|
||||
|
||||
render: function (pages) {
|
||||
var _this = this;
|
||||
this.$listContainer.children().remove();
|
||||
var items = this.buildListItems(pages);
|
||||
$.each(items, function(key, item){
|
||||
_this.$listContainer.append(item);
|
||||
});
|
||||
|
||||
this.$listContainer.children().each(function () {
|
||||
var $this = $(this),
|
||||
pageType = $this.data('page-type');
|
||||
|
||||
switch (pageType) {
|
||||
case 'page':
|
||||
if ($this.data('page') === pages.currentPage) {
|
||||
$this.addClass(_this.options.activeClass);
|
||||
}
|
||||
break;
|
||||
case 'first':
|
||||
$this.toggleClass(_this.options.disabledClass, pages.currentPage === 1);
|
||||
break;
|
||||
case 'last':
|
||||
$this.toggleClass(_this.options.disabledClass, pages.currentPage === _this.options.totalPages);
|
||||
break;
|
||||
case 'prev':
|
||||
$this.toggleClass(_this.options.disabledClass, !_this.options.loop && pages.currentPage === 1);
|
||||
break;
|
||||
case 'next':
|
||||
$this.toggleClass(_this.options.disabledClass,
|
||||
!_this.options.loop && pages.currentPage === _this.options.totalPages);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
|
||||
setupEvents: function () {
|
||||
var _this = this;
|
||||
this.$listContainer.off('click').on('click', 'li', function (evt) {
|
||||
var $this = $(this);
|
||||
if ($this.hasClass(_this.options.disabledClass) || $this.hasClass(_this.options.activeClass)) {
|
||||
return false;
|
||||
}
|
||||
// Prevent click event if href is not set.
|
||||
!_this.options.href && evt.preventDefault();
|
||||
_this.show(parseInt($this.data('page')));
|
||||
});
|
||||
},
|
||||
|
||||
changeTotalPages: function(totalPages, currentPage) {
|
||||
this.options.totalPages = totalPages;
|
||||
return this.show(currentPage);
|
||||
},
|
||||
|
||||
makeHref: function (page) {
|
||||
return this.options.href ? this.generateQueryString(page) : "#";
|
||||
},
|
||||
|
||||
makeText: function (text, page) {
|
||||
return text.replace(this.options.pageVariable, page)
|
||||
.replace(this.options.totalPagesVariable, this.options.totalPages)
|
||||
},
|
||||
|
||||
getPageFromQueryString: function (searchStr) {
|
||||
var search = this.getSearchString(searchStr),
|
||||
regex = new RegExp(this.options.pageVariable + '(=([^&#]*)|&|#|$)'),
|
||||
page = regex.exec(search);
|
||||
if (!page || !page[2]) {
|
||||
return null;
|
||||
}
|
||||
page = decodeURIComponent(page[2]);
|
||||
page = parseInt(page);
|
||||
if (isNaN(page)) {
|
||||
return null;
|
||||
}
|
||||
return page;
|
||||
},
|
||||
|
||||
generateQueryString: function (pageNumber, searchStr) {
|
||||
var search = this.getSearchString(searchStr),
|
||||
regex = new RegExp(this.options.pageVariable + '=*[^&#]*');
|
||||
if (!search) return '';
|
||||
return '?' + search.replace(regex, this.options.pageVariable + '=' + pageNumber);
|
||||
},
|
||||
|
||||
getSearchString: function (searchStr) {
|
||||
var search = searchStr || window.location.search;
|
||||
if (search === '') {
|
||||
return null;
|
||||
}
|
||||
if (search.indexOf('?') === 0) search = search.substr(1);
|
||||
return search;
|
||||
},
|
||||
|
||||
getCurrentPage: function () {
|
||||
return this.currentPage;
|
||||
},
|
||||
|
||||
getTotalPages: function () {
|
||||
return this.options.totalPages;
|
||||
}
|
||||
};
|
||||
|
||||
// PLUGIN DEFINITION
|
||||
|
||||
$.fn.twbsPagination = function (option) {
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
var methodReturn;
|
||||
|
||||
var $this = $(this);
|
||||
var data = $this.data('twbs-pagination');
|
||||
var options = typeof option === 'object' ? option : {};
|
||||
|
||||
if (!data) $this.data('twbs-pagination', (data = new TwbsPagination(this, options) ));
|
||||
if (typeof option === 'string') methodReturn = data[ option ].apply(data, args);
|
||||
|
||||
return ( methodReturn === undefined ) ? $this : methodReturn;
|
||||
};
|
||||
|
||||
$.fn.twbsPagination.defaults = {
|
||||
totalPages: 1,
|
||||
startPage: 1,
|
||||
visiblePages: 5,
|
||||
initiateStartPageClick: true,
|
||||
hideOnlyOnePage: false,
|
||||
href: false,
|
||||
pageVariable: '{{page}}',
|
||||
totalPagesVariable: '{{total_pages}}',
|
||||
page: null,
|
||||
first: 'First',
|
||||
prev: 'Previous',
|
||||
next: 'Next',
|
||||
last: 'Last',
|
||||
loop: false,
|
||||
beforePageClick: null,
|
||||
onPageClick: null,
|
||||
paginationClass: 'pagination',
|
||||
nextClass: 'page-item next',
|
||||
prevClass: 'page-item prev',
|
||||
lastClass: 'page-item last',
|
||||
firstClass: 'page-item first',
|
||||
pageClass: 'page-item',
|
||||
activeClass: 'active',
|
||||
disabledClass: 'disabled',
|
||||
anchorClass: 'page-link'
|
||||
};
|
||||
|
||||
$.fn.twbsPagination.Constructor = TwbsPagination;
|
||||
|
||||
$.fn.twbsPagination.noConflict = function () {
|
||||
$.fn.twbsPagination = old;
|
||||
return this;
|
||||
};
|
||||
|
||||
$.fn.twbsPagination.version = "1.4.2";
|
||||
|
||||
})(window.jQuery, window, document);
|
||||
10
js/twbs-pagination/jquery.twbsPagination.min.js
vendored
Normal file
10
js/twbs-pagination/jquery.twbsPagination.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user