diff --git a/admin-dev/themes/default/js/admin-theme.js b/admin-dev/themes/default/js/admin-theme.js
index 017c4c1e814cb..e571468d328ca 100755
--- a/admin-dev/themes/default/js/admin-theme.js
+++ b/admin-dev/themes/default/js/admin-theme.js
@@ -22,10 +22,9 @@
* International Registered Trademark & Property of PrestaShop SA
*/
-$( document ).ready(function() {
+$(document).ready(function() {
$("[name^='checkBoxShopGroupAsso_theme']").change(function(){
-
$(this).parents('.tree-folder').find("[name^='checkBoxShopAsso_theme']").each(function(){
var id = $(this).attr('value');
var checked = $(this).prop('checked');
@@ -39,7 +38,6 @@ $( document ).ready(function() {
toggleShopModuleCheckbox(id, checked);
});
- //nav side bar
function navSidebar(){
//$('body.page-topbar').removeClass('page-topbar').addClass('page-sidebar');
//$('#nav-topbar').attr('id','nav-sidebar');
@@ -70,7 +68,7 @@ $( document ).ready(function() {
$('.expanded').removeClass('expanded');
});
}
- //nav top bar
+
function navTopbar(){
//$('body').removeClass('page-sidebar').addClass('page-topbar').removeClass('page-sidebar-closed');
$('#nav-sidebar').attr('id','nav-topbar');
@@ -137,6 +135,7 @@ $( document ).ready(function() {
$(this).addClass('expanded');
}
});
+
//get click for item which has submenu
navigation.on('click.submenu','.maintab.has_submenu a.title', function(e){
e.preventDefault();
@@ -149,6 +148,7 @@ $( document ).ready(function() {
navigation.append(submenu);
submenu.show();
});
+
navigation.on('click.back','#nav-mobile-submenu-back',function(e){
e.preventDefault();
submenu.remove();
@@ -170,7 +170,6 @@ $( document ).ready(function() {
}
}
- //nav switch - not used for now
function navSwitch(){
if ($('body').hasClass('page-sidebar')){
navTopbar();
@@ -179,7 +178,6 @@ $( document ).ready(function() {
}
}
- //init menu
function initNav(){
if ($('body').hasClass('page-sidebar')){
navSidebar();
@@ -188,23 +186,18 @@ $( document ).ready(function() {
navTopbar();
}
}
-
initNav();
- // tooltips
- $('.label-tooltip, .help-tooltip').tooltip();
- //modal
+ $('.label-tooltip, .help-tooltip').tooltip();
$("#error-modal").modal("show");
//scroll top
function animateGoTop() {
- if ($(window).scrollTop())
- {
+ if ($(window).scrollTop()) {
$('#go-top:hidden').stop(true, true).fadeIn();
$('#go-top:hidden').removeClass('hide');
- } else {
+ } else
$('#go-top').stop(true, true).fadeOut();
- }
}
$("#go-top").on('click',function() {
@@ -216,7 +209,6 @@ $( document ).ready(function() {
animateGoTop();
});
-
function toggleShopModuleCheckbox(id_shop, toggle){
var formGroup = $("[for='to_disable_shop"+id_shop+"']").parent();
if (toggle === true)
diff --git a/classes/Media.php b/classes/Media.php
index 4429eb06a315e..f074e893e586b 100755
--- a/classes/Media.php
+++ b/classes/Media.php
@@ -36,7 +36,6 @@ class MediaCore
'ui.resizable' => array('fileName' => 'jquery.ui.resizable.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.selectable' => array('fileName' => 'jquery.ui.selectable.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
'ui.sortable' => array('fileName' => 'jquery.ui.sortable.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.mouse'), 'theme' => true),
- 'ui.accordion' => array('fileName' => 'jquery.ui.accordion.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.autocomplete' => array('fileName' => 'jquery.ui.autocomplete.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position', 'ui.menu'), 'theme' => true),
'ui.button' => array('fileName' => 'jquery.ui.button.min.js', 'dependencies' => array('ui.core', 'ui.widget'), 'theme' => true),
'ui.dialog' => array('fileName' => 'jquery.ui.dialog.min.js', 'dependencies' => array('ui.core', 'ui.widget', 'ui.position','ui.button'), 'theme' => true),
diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php
index 4eb9b7d5ccf72..0bef2916b66a6 100644
--- a/classes/controller/AdminController.php
+++ b/classes/controller/AdminController.php
@@ -2005,7 +2005,6 @@ public function setMedia()
$this->addJS(array(
_PS_JS_DIR_.'admin.js',
_PS_JS_DIR_.'tools.js',
- _PS_JS_DIR_.'ajax.js',
_PS_JS_DIR_.'toolbar.js',
_PS_JS_DIR_.'jquery/plugins/timepicker/jquery-ui-timepicker-addon.js'
));
diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php
index 1aa24c1e6b39f..c558edafc8e54 100644
--- a/controllers/admin/AdminProductsController.php
+++ b/controllers/admin/AdminProductsController.php
@@ -1325,8 +1325,7 @@ public function postProcess()
{
$this->addJqueryUI(array(
'ui.core',
- 'ui.widget',
- 'ui.accordion',
+ 'ui.widget'
));
$this->addjQueryPlugin(array(
diff --git a/js/admin.js b/js/admin.js
index 59b4ab2cf1e14..99015ab26e1f6 100644
--- a/js/admin.js
+++ b/js/admin.js
@@ -921,6 +921,75 @@ $(document).ready(function()
$('#'+list_id+'-empty-filters-alert').show();
}
});
+
+ var message = $('.toolbarHead');
+ var view = $(window);
+
+ // bind only if message exists. placeholder will be its parent
+ view.bind("scroll resize", function(e)
+ {
+ message.each(function(el){
+ if (message.length)
+ {
+ placeholder = $(this).parent();
+ if (e.type == 'resize')
+ $(this).css('width', $(this).parent().width());
+
+ placeholderTop = placeholder.offset().top;
+ var viewTop = view.scrollTop() + 15;
+ // here we force the toolbar to be "not fixed" when
+ // the height of the window is really small (toolbar hiding the page is not cool)
+ window_is_more_than_twice_the_toolbar = view.height() > message.parent().height() * 2;
+ if (!$(this).hasClass("fix-toolbar") && (window_is_more_than_twice_the_toolbar && (viewTop > placeholderTop)))
+ {
+ $(this).css('width', $(this).width());
+ // fixing parent height will prevent that annoying "pagequake" thing
+ // the order is important : this has to be set before adding class fix-toolbar
+ $(this).parent().css('height', $(this).parent().height());
+ $(this).addClass("fix-toolbar");
+ }
+ else if ($(this).hasClass("fix-toolbar") && (!window_is_more_than_twice_the_toolbar || (viewTop <= placeholderTop)) )
+ {
+ $(this).removeClass("fix-toolbar");
+ $(this).removeAttr('style');
+ $(this).parent().removeAttr('style');
+ }
+ }
+ });
+ }); // end bind
+
+ // if count errors
+ $('#hideError').on('click', function(e)
+ {
+ e.preventDefault();
+ $('.error').hide('slow', function (){
+ $('.error').remove();
+ });
+ return false;
+ });
+
+ // if count warnings
+ $(document).on('click', '#linkSeeMore', function(e){
+ e.preventDefault();
+ $('#seeMore').show();
+ $(this).hide();
+ $('#linkHide').show();
+ return false;
+ });
+ $(document).on('click', '#linkHide', function(e){
+ e.preventDefault();
+ $('#seeMore').hide();
+ $(this).hide();
+ $('#linkSeeMore').show();
+ return false;
+ });
+ $(document).on('click', '#hideWarn', function(e){
+ e.preventDefault();
+ $('.warn').hide('slow', function (){
+ $('.warn').remove();
+ });
+ return false;
+ });
});
@@ -1195,3 +1264,105 @@ function ajaxStates (id_state_selected)
});
}
}
+
+var query;
+var lang = Array();
+
+function setLang(array_lang) { lang = array_lang; }
+
+function getQuery() {
+ var result;
+
+ result = query;
+ if (result == null) {
+ if (window.XMLHttpRequest)
+ result = new XMLHttpRequest();
+ else if (window.ActiveXObject)
+ result = new ActiveXObject('Microsoft.XMLHTTP');
+ }
+ return result;
+}
+
+function onQueryChange() {
+ if (query.readyState == 4 && query.status == 200)
+ document.getElementById('ajax_confirmation').innerHTML = ''+lang[0]+'';
+}
+
+function request_failed() { alert(lang[1]); }
+
+function showActivity() {
+ document.getElementById('ajax_confirmation').innerHTML = ''+lang[2]+'';
+}
+
+function check_for_all_accesses(tabsize, tabnumber)
+{
+ var i = 0;
+ var res = 0;
+ var right = 0;
+ var rights = new Array('view', 'add', 'edit', 'delete', 'all');
+
+ while (i != parseInt(tabsize) + 1)
+ {
+ if ($('#view'+i).prop('checked') == false || $('#edit'+i).prop('checked') == false || $('#add'+i).prop('checked') == false || $('#delete'+i).prop('checked') == false)
+ $('#all'+i).attr('checked', false);
+ else
+ $('#all'+i).attr('checked', "checked");
+ i++;
+ }
+ right = 0;
+ while (right != 5)
+ {
+ res = 0;
+ i = 0;
+ while (i != tabsize)
+ {
+ if ($('#'+rights[right]+i).prop('checked') == true)
+ res++;
+ i++;
+ }
+ if (res == tabnumber - 1)
+ $('#'+rights[right]+'all').attr('checked', "checked");
+ else
+ $('#'+rights[right]+'all').attr('checked', false);
+ right++;
+ }
+}
+
+function perfect_access_js_gestion(src, action, id_tab, tabsize, tabnumber, table)
+{
+ if (id_tab == '-1' && action == 'all')
+ {
+ $(table+' .add').attr('checked', src.checked);
+ $(table+' .edit').attr('checked', src.checked);
+ $(table+' .delete').attr('checked', src.checked);
+ $(table+' .view').attr('checked', src.checked);
+ $(table+' .all').attr('checked', src.checked);
+ }
+ else if (action == 'all')
+ $(table+' .'+id_tab).attr('checked', src.checked);
+ else if (id_tab == '-1')
+ $(table+' .'+action).attr('checked', src.checked);
+ check_for_all_accesses(tabsize, tabnumber);
+}
+
+function ajax_power(src, action, id_tab, id_profile, token, tabsize, tabnumber)
+{
+ query = getQuery();
+ perfect_access_js_gestion(src, action, id_tab, tabsize, tabnumber);
+ if (query != null) {
+ try {
+ query.open('POST', 'index.php?tab=AdminAccess', true);
+ query.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
+ query.onreadystatechange = onQueryChange;
+ query.send('submitAddaccess=1&action='+action+'&perm='+parseInt(src.checked ? '1' : status = '0')+'&id_tab='+parseInt(id_tab)+'&id_profile='+parseInt(id_profile)+'&token='+token);
+ showActivity();
+ }
+ catch(exc) {
+ request_failed();
+ }
+ }
+ else
+ alert(lang[3]);
+}
+
+function redirect(new_page) { window.location = new_page; }
diff --git a/js/ajax.js b/js/ajax.js
deleted file mode 100644
index fc365c5ef0bf7..0000000000000
--- a/js/ajax.js
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
-* 2007-2014 PrestaShop
-*
-* NOTICE OF LICENSE
-*
-* This source file is subject to the Open Software License (OSL 3.0)
-* that is bundled with this package in the file LICENSE.txt.
-* It is also available through the world-wide-web at this URL:
-* http://opensource.org/licenses/osl-3.0.php
-* If you did not receive a copy of the license and are unable to
-* obtain it through the world-wide-web, please send an email
-* to license@prestashop.com so we can send you a copy immediately.
-*
-* DISCLAIMER
-*
-* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
-* versions in the future. If you wish to customize PrestaShop for your
-* needs please refer to http://www.prestashop.com for more information.
-*
-* @author PrestaShop SA
-* @copyright 2007-2014 PrestaShop SA
-* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
-* International Registered Trademark & Property of PrestaShop SA
-*/
-
-var query;
-var lang = Array();
-
-function setLang(array_lang) { lang = array_lang; }
-
-function getQuery() {
- var result;
-
- result = query;
- if (result == null) {
- if (window.XMLHttpRequest)
- result = new XMLHttpRequest();
- else if (window.ActiveXObject)
- result = new ActiveXObject('Microsoft.XMLHTTP');
- }
- return result;
-}
-
-function onQueryChange() {
- if (query.readyState == 4 && query.status == 200)
- document.getElementById('ajax_confirmation').innerHTML = ''+lang[0]+'';
-}
-
-function request_failed() { alert(lang[1]); }
-
-function showActivity() {
- document.getElementById('ajax_confirmation').innerHTML = ''+lang[2]+'';
-}
-
-function check_for_all_accesses(tabsize, tabnumber)
-{
- var i = 0;
- var res = 0;
- var right = 0;
- var rights = new Array('view', 'add', 'edit', 'delete', 'all');
-
- while (i != parseInt(tabsize) + 1)
- {
- if ($('#view'+i).prop('checked') == false || $('#edit'+i).prop('checked') == false || $('#add'+i).prop('checked') == false || $('#delete'+i).prop('checked') == false)
- $('#all'+i).attr('checked', false);
- else
- $('#all'+i).attr('checked', "checked");
- i++;
- }
- right = 0;
- while (right != 5)
- {
- res = 0;
- i = 0;
- while (i != tabsize)
- {
- if ($('#'+rights[right]+i).prop('checked') == true)
- res++;
- i++;
- }
- if (res == tabnumber - 1)
- $('#'+rights[right]+'all').attr('checked', "checked");
- else
- $('#'+rights[right]+'all').attr('checked', false);
- right++;
- }
-}
-
-function perfect_access_js_gestion(src, action, id_tab, tabsize, tabnumber, table)
-{
- if (id_tab == '-1' && action == 'all')
- {
- $(table+' .add').attr('checked', src.checked);
- $(table+' .edit').attr('checked', src.checked);
- $(table+' .delete').attr('checked', src.checked);
- $(table+' .view').attr('checked', src.checked);
- $(table+' .all').attr('checked', src.checked);
- }
- else if (action == 'all')
- $(table+' .'+id_tab).attr('checked', src.checked);
- else if (id_tab == '-1')
- $(table+' .'+action).attr('checked', src.checked);
- check_for_all_accesses(tabsize, tabnumber);
-}
-
-function ajax_power(src, action, id_tab, id_profile, token, tabsize, tabnumber)
-{
- query = getQuery();
- perfect_access_js_gestion(src, action, id_tab, tabsize, tabnumber);
- if (query != null) {
- try {
- query.open('POST', 'index.php?tab=AdminAccess', true);
- query.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
- query.onreadystatechange = onQueryChange;
- query.send('submitAddaccess=1&action='+action+'&perm='+parseInt(src.checked ? '1' : status = '0')+'&id_tab='+parseInt(id_tab)+'&id_profile='+parseInt(id_profile)+'&token='+token);
- showActivity();
- }
- catch(exc) {
- request_failed();
- }
- }
- else
- alert(lang[3]);
-}
-
-function redirect(new_page) { window.location = new_page; }
\ No newline at end of file
diff --git a/js/attributesBack.js b/js/attributesBack.js
index 0ee539dfaddf1..9b185325530d3 100644
--- a/js/attributesBack.js
+++ b/js/attributesBack.js
@@ -25,7 +25,6 @@
var storeUsedGroups = {};
-
function populate_attrs()
{
var attr_group = getE('attribute_group');
diff --git a/js/notifications.js b/js/notifications.js
index ef9d3cf970dcf..e887c53f3c94c 100644
--- a/js/notifications.js
+++ b/js/notifications.js
@@ -2,9 +2,8 @@ $(document).ready(function()
{
var hints = $('.translatable span.hint');
if (youEditFieldFor)
- {
hints.html(hints.html() + '
' + youEditFieldFor + '');
- }
+
var html = "";
var nb_notifs = 0;
var wrapper_id = "";
@@ -13,17 +12,19 @@ $(document).ready(function()
$(".notifs").click(function(){
var wrapper_id = $(this).parent().attr("id");
- $.post("ajax.php",
+ $.post(
+ "ajax.php",
{
"updateElementEmployee" : "1",
"updateElementEmployeeType" : $(this).parent().attr('data-type')
- }, function(data) {
- if(data)
- {
- $("#" + wrapper_id + "_value").html(0);
- $("#" + wrapper_id + "_number_wrapper").hide();
- }
- });
+ },
+ function(data) {
+ if (data) {
+ $("#" + wrapper_id + "_value").html(0);
+ $("#" + wrapper_id + "_number_wrapper").hide();
+ }
+ }
+ );
});
// call it once immediately, then use setTimeout if refresh is activated
@@ -107,6 +108,6 @@ function getPush(refresh)
$("#customer_messages_notif_number_wrapper").hide();
}
if (refresh)
- setTimeout("getPush(1)", 60000);
+ setTimeout("getPush(1)", 120000);
});
}
\ No newline at end of file
diff --git a/js/toolbar.js b/js/toolbar.js
deleted file mode 100644
index b687ef0646985..0000000000000
--- a/js/toolbar.js
+++ /dev/null
@@ -1,70 +0,0 @@
-$(document).ready(function(){
- var message = $('.toolbarHead');
- var view = $(window);
-
- // bind only if message exists. placeholder will be its parent
- view.bind("scroll resize", function(e)
- {
- message.each(function(el){
- if (message.length)
- {
- placeholder = $(this).parent();
- if(e.type == 'resize')
- $(this).css('width', $(this).parent().width());
-
- placeholderTop = placeholder.offset().top;
- var viewTop = view.scrollTop() + 15;
- // here we force the toolbar to be "not fixed" when
- // the height of the window is really small (toolbar hiding the page is not cool)
- window_is_more_than_twice_the_toolbar = view.height() > message.parent().height() * 2;
- if (!$(this).hasClass("fix-toolbar") && (window_is_more_than_twice_the_toolbar && (viewTop > placeholderTop)))
- {
- $(this).css('width', $(this).width());
- // fixing parent height will prevent that annoying "pagequake" thing
- // the order is important : this has to be set before adding class fix-toolbar
- $(this).parent().css('height', $(this).parent().height());
- $(this).addClass("fix-toolbar");
- }
- else if ($(this).hasClass("fix-toolbar") && (!window_is_more_than_twice_the_toolbar || (viewTop <= placeholderTop)) )
- {
- $(this).removeClass("fix-toolbar");
- $(this).removeAttr('style');
- $(this).parent().removeAttr('style');
- }
- }
- });
- }); // end bind
-
- // if count errors
- $('#hideError').on('click', function(e)
- {
- e.preventDefault();
- $('.error').hide('slow', function (){
- $('.error').remove();
- });
- return false;
- });
-
- // if count warnings
- $(document).on('click', '#linkSeeMore', function(e){
- e.preventDefault();
- $('#seeMore').show();
- $(this).hide();
- $('#linkHide').show();
- return false;
- });
- $(document).on('click', '#linkHide', function(e){
- e.preventDefault();
- $('#seeMore').hide();
- $(this).hide();
- $('#linkSeeMore').show();
- return false;
- });
- $(document).on('click', '#hideWarn', function(e){
- e.preventDefault();
- $('.warn').hide('slow', function (){
- $('.warn').remove();
- });
- return false;
- });
-});
\ No newline at end of file