[+] BO : Notification autorefresh can be deactivated
// ajaxPreProcess is now called at the end of init() process in admincontroller // fixed getTranslationsFlags
This commit is contained in:
@@ -95,6 +95,51 @@
|
||||
color:{$brightness}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function()
|
||||
{
|
||||
var hints = $('.translatable span.hint');
|
||||
if (youEditFieldFor)
|
||||
{
|
||||
hints.html(hints.html() + '<br /><span class="red">' + youEditFieldFor + '</span>');
|
||||
}
|
||||
var html = "";
|
||||
var nb_notifs = 0;
|
||||
var wrapper_id = "";
|
||||
var type = new Array();
|
||||
|
||||
$(".notifs").live("click", function(){
|
||||
wrapper_id = $(this).attr("id");
|
||||
type = wrapper_id.split("s_notif")
|
||||
$.post("ajax.php",
|
||||
{
|
||||
"updateElementEmployee" : "1", "updateElementEmployeeType" : type[0]
|
||||
}, function(data) {
|
||||
if(data)
|
||||
{
|
||||
if(!$("#" + wrapper_id + "_wrapper").is(":visible"))
|
||||
{
|
||||
$(".notifs_wrapper").hide();
|
||||
$("#" + wrapper_id + "_number_wrapper").hide();
|
||||
$("#" + wrapper_id + "_wrapper").show();
|
||||
}else
|
||||
{
|
||||
$("#" + wrapper_id + "_wrapper").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#main").click(function(){
|
||||
$(".notifs_wrapper").hide();
|
||||
});
|
||||
|
||||
// call it once immediately, then use setTimeout if refresh is activated
|
||||
getPush({$autorefresh_notifications});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body {if $bo_color} style="background:{$bo_color}" {/if}>
|
||||
<div id="top_container">
|
||||
@@ -194,24 +239,27 @@
|
||||
</div>
|
||||
{/if}
|
||||
{foreach $tabs AS $t}
|
||||
<li class="submenu_size {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
<a href="{$t.href}">
|
||||
<img src="{$t.img}" alt="" /> {$t.name}
|
||||
</a>
|
||||
<li class="submenu_size maintab {if $t.current}active{/if}" id="maintab{$t.id_tab}">
|
||||
<span class="title">
|
||||
<img src="{$t.img}" alt="" />{$t.name}
|
||||
</span>
|
||||
<ul class="submenu">
|
||||
{foreach from=$t.sub_tabs item=t2}
|
||||
<li><a href="{$t2.href}">{$t2.name}</a></li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
{foreach $tabs AS $t}
|
||||
<div id="tab{$t.id_tab}_subtabs" style="display:none">
|
||||
{foreach $t.sub_tabs AS $t2}
|
||||
<li><a href="{$t2.href}">{$t2.name}</a></li>
|
||||
<li class="subitem" ><a href="{$t2.href}">{$t2.name}</a></li>
|
||||
{/foreach}
|
||||
{if $t.current}
|
||||
{assign var='mainsubtab' value=$t}
|
||||
{/if}
|
||||
<div class="flatclear"> </div>
|
||||
</div>
|
||||
{/foreach}
|
||||
{* @todo : handle bo_uimode == hover / not hover ?
|
||||
{if $employee->bo_uimode == 'hover'}
|
||||
<script type="text/javascript">
|
||||
$("#menu li").hoverIntent( { over:hoverTabs,timeout:100,out:outTabs } );
|
||||
@@ -231,10 +279,12 @@
|
||||
<ul id="submenu" {if isset($mainsubtab)}class="withLeftBorder clearfix"{/if}>
|
||||
{if isset($mainsubtab)}
|
||||
{foreach $mainsubtab.sub_tabs AS $t}
|
||||
<li><a href="{$t.href}">{$t.name}</a></li>
|
||||
<li>
|
||||
<a href="{$t.href}">{$t.name}</a></li>
|
||||
{/foreach}
|
||||
{/if}
|
||||
</ul>
|
||||
*}
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
{if $install_dir_exists}
|
||||
|
||||
@@ -267,13 +267,14 @@ class AdminControllerCore extends Controller
|
||||
return (!empty($token) && $token === $this->token);
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo uses redirectAdmin only if !$this->ajax
|
||||
*/
|
||||
public function postProcess()
|
||||
{
|
||||
if ($this->ajax)
|
||||
{
|
||||
// from ajax-tab.php
|
||||
if (method_exists($this, 'ajaxPreprocess'))
|
||||
$this->ajaxPreProcess();
|
||||
$action = Tools::getValue('action');
|
||||
// no need to use displayConf() here
|
||||
if (!empty($action) && method_exists($this, 'ajaxProcess'.Tools::toCamelCase($action)))
|
||||
@@ -306,7 +307,10 @@ class AdminControllerCore extends Controller
|
||||
if (($object->deleteImage()))
|
||||
{
|
||||
$redirect = self::$currentIndex.'&add'.$this->table.'&'.$this->identifier.'='.Tools::getValue($this->identifier).'&conf=7&token='.$token;
|
||||
Tools::redirectAdmin($redirect);
|
||||
if (!$this->ajax)
|
||||
Tools::redirectAdmin($redirect);
|
||||
else
|
||||
$this->content = 'ok';
|
||||
}
|
||||
$this->_errors[] = Tools::displayError('An error occurred during image deletion (cannot load object).');
|
||||
break;
|
||||
@@ -655,6 +659,7 @@ class AdminControllerCore extends Controller
|
||||
*/
|
||||
public function displayForm($firstCall = true)
|
||||
{
|
||||
$this->initForm();
|
||||
$content = '';
|
||||
$allow_employee_form_lang = Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') ? Configuration::get('PS_BO_ALLOW_EMPLOYEE_FORM_LANG') : 0;
|
||||
|
||||
@@ -1140,8 +1145,8 @@ class AdminControllerCore extends Controller
|
||||
$this->content .= $helper->generateForm($this->fields_form);
|
||||
}
|
||||
// TODO delete when all forms use the helper
|
||||
else
|
||||
$this->content .= $this->displayForm();
|
||||
// else
|
||||
// $this->content .= $this->displayForm();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1403,6 +1408,8 @@ class AdminControllerCore extends Controller
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($this->ajax && method_exists($this, 'ajaxPreprocess'))
|
||||
$this->ajaxPreProcess();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2150,4 +2157,41 @@ EOF;
|
||||
else
|
||||
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display flags in forms for translations
|
||||
*
|
||||
* @param array $languages All languages available
|
||||
* @param integer $default_language Default language id
|
||||
* @param string $ids Multilingual div ids in form
|
||||
* @param string $id Current div id]
|
||||
* @param boolean $use_vars_instead_of_ids use an js vars instead of ids seperate by "¤"
|
||||
*
|
||||
* @todo : delete return params :
|
||||
* @param return define the return way : false for a display, true for a return
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTranslationsFlags($languages, $default_language, $ids, $id, $return = false, $use_vars_instead_of_ids = false)
|
||||
{
|
||||
if (count($languages) == 1)
|
||||
return false;
|
||||
$output = '
|
||||
<div class="displayed_flag">
|
||||
<img src="../img/l/'.$default_language.'.jpg" class="pointer" id="language_current_'.$id.'" onclick="toggleLanguageFlags(this);" alt="" />
|
||||
</div>
|
||||
<div id="languages_'.$id.'" class="language_flags">
|
||||
'.$this->l('Choose language:').'<br /><br />';
|
||||
foreach ($languages as $language)
|
||||
if($use_vars_instead_of_ids)
|
||||
$output .= '<img src="../img/l/'.(int)($language['id_lang']).'.jpg" class="pointer" alt="'.$language['name'].'" title="'.$language['name'].'" onclick="changeLanguage(\''.$id.'\', '.$ids.', '.$language['id_lang'].', \''.$language['iso_code'].'\');" /> ';
|
||||
else
|
||||
$output .= '<img src="../img/l/'.(int)($language['id_lang']).'.jpg" class="pointer" alt="'.$language['name'].'" title="'.$language['name'].'" onclick="changeLanguage(\''.$id.'\', \''.$ids.'\', '.$language['id_lang'].', \''.$language['iso_code'].'\');" /> ';
|
||||
$output .= '</div>';
|
||||
|
||||
if ($return)
|
||||
return $output;
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,7 +240,8 @@ INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_a
|
||||
(152, 'PS_CARRIER_DEFAULT_SORT', '0', NOW(), NOW()),
|
||||
(153, 'PS_STOCK_MVT_INC_REASON_DEFAULT', '1', NOW(), NOW()),
|
||||
(154, 'PS_STOCK_MVT_DEC_REASON_DEFAULT', '2', NOW(), NOW()),
|
||||
(155, 'PS_ADVANCED_STOCK_MANAGEMENT', '1', NOW(), NOW());
|
||||
(155, 'PS_ADVANCED_STOCK_MANAGEMENT', '1', NOW(), NOW()),
|
||||
(156, 'PS_ADMINREFRESH_NOTIFICATION', '1', NOW(), NOW());
|
||||
|
||||
INSERT INTO `PREFIX_configuration_lang` (`id_configuration`, `id_lang`, `value`, `date_upd`) VALUES
|
||||
(36, 1, 'IN', NOW()),(36, 2, 'FA', NOW()),(36, 3, 'CU', NOW()),(36, 4, 'FA', NOW()),(36, 5, 'FA', NOW()),
|
||||
|
||||
@@ -70,7 +70,8 @@ INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) VAL
|
||||
('PS_SHOW_NEW_CUSTOMERS', '1', NOW(), NOW()),
|
||||
('PS_SHOW_NEW_MESSAGES', '1', NOW(), NOW()),
|
||||
('PS_FEATURE_FEATURE_ACTIVE', '1', NOW(), NOW()),
|
||||
('PS_COMBINATION_FEATURE_ACTIVE', '1', NOW(), NOW());
|
||||
('PS_COMBINATION_FEATURE_ACTIVE', '1', NOW(), NOW()),
|
||||
('PS_ADMINREFRESH_NOTIFICATION', '1', NOW(), NOW());
|
||||
|
||||
/* PHP:update_feature_detachable_cache(); */;
|
||||
|
||||
|
||||
+3
-39
@@ -1,4 +1,4 @@
|
||||
function getPush()
|
||||
function getPush(refresh)
|
||||
{
|
||||
$.post("ajax.php",{"getNotifications" : "1"}, function(data) {
|
||||
if (data)
|
||||
@@ -62,44 +62,8 @@ function getPush()
|
||||
$("#messages_notif_number_wrapper").hide();
|
||||
}
|
||||
}
|
||||
setTimeout("getPush()",60000);
|
||||
if(refresh)
|
||||
setTimeout("getPush(1)",60000);
|
||||
});
|
||||
}
|
||||
|
||||
$().ready(function()
|
||||
{
|
||||
var hints = $('.translatable span.hint');
|
||||
if (youEditFieldFor)
|
||||
{
|
||||
hints.html(hints.html() + '<br /><span class="red">' + youEditFieldFor + '</span>');
|
||||
}
|
||||
var html = "";
|
||||
var nb_notifs = 0;
|
||||
var wrapper_id = "";
|
||||
var type = new Array();
|
||||
|
||||
$(".notifs").live("click", function(){
|
||||
wrapper_id = $(this).attr("id");
|
||||
type = wrapper_id.split("s_notif")
|
||||
$.post("ajax.php",{"updateElementEmployee" : "1", "updateElementEmployeeType" : type[0]}, function(data) {
|
||||
if(data)
|
||||
{
|
||||
if(!$("#" + wrapper_id + "_wrapper").is(":visible"))
|
||||
{
|
||||
$(".notifs_wrapper").hide();
|
||||
$("#" + wrapper_id + "_number_wrapper").hide();
|
||||
$("#" + wrapper_id + "_wrapper").show();
|
||||
}else
|
||||
{
|
||||
$("#" + wrapper_id + "_wrapper").hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$("#main").click(function(){
|
||||
$(".notifs_wrapper").hide();
|
||||
});
|
||||
|
||||
getPush();
|
||||
});
|
||||
Reference in New Issue
Block a user