// Creation of AdminController : Admin tabs will now extend this class (see AdminTools.php for example)

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8667 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
tDidierjean
2011-09-20 16:04:35 +00:00
parent b45dd02452
commit 92cc465a3c
33 changed files with 1316 additions and 46 deletions
+21 -23
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -31,8 +31,6 @@ header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-ch
header('Pragma: no-cache');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
require_once(dirname(__FILE__).'/init.php');
echo '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.$iso.'" lang="'.$iso.'">
@@ -72,13 +70,13 @@ echo '
if (data)
{
json = jQuery.parseJSON(data);
// Add orders notifications to the list
html = "";
nb_notifs = 0;
$.each(json.order, function(property, value) {
html += "<li>'.translate('A new order has been made on your shop.').'<br />'.translate('Order number : ').'<strong>#" + parseInt(value.id_order) + "</strong><br />'.translate('Total : ').'<strong>" + value.total_paid_real + "</strong><br />'.translate('From : ').'<strong>" + value.customer_name + "</strong><br /><a href=\"index.php?tab=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'&vieworder&id_order=" + parseInt(value.id_order) + "\">'.translate('Click here to see that order').'</a></li>";
});
});
if (html != "")
{
$("#list_orders_notif").prev("p").hide();
@@ -90,17 +88,17 @@ echo '
else
{
$("#orders_notif_number_wrapper").hide();
}
}
// Add customers notifications to the list
html = "";
nb_notifs = 0;
$.each(json.customer, function(property, value) {
html += "<li>'.translate('A new customer registered on your shop.').'<br />'.translate('Customer name : ').'<strong>" + value.customer_name + "</strong><br /><a href=\"index.php?tab=AdminCustomers&token='.Tools::getAdminTokenLite('AdminCustomers').'&viewcustomer&id_customer=" + parseInt(value.id_customer) + "\">'.translate('Click here to see that customer').'</a></li>";
});
});
if (html != "")
{
$("#list_customers_notif").prev("p").hide();
$("#list_customers_notif").prev("p").hide();
$("#list_customers_notif").empty().append(html);
nb_notifs = $("#list_customers_notif li").length;
$("#customers_notif_value").text(nb_notifs);
@@ -110,7 +108,7 @@ echo '
{
$("#customers_notif_number_wrapper").hide();
}
// Add messages notifications to the list
html = "";
nb_notifs = 0;
@@ -119,7 +117,7 @@ echo '
});
if (html != "")
{
$("#list_messages_notif").prev("p").hide();
$("#list_messages_notif").prev("p").hide();
$("#list_messages_notif").empty().append(html);
nb_notifs = $("#list_messages_notif li").length;
$("#messages_notif_value").text(nb_notifs);
@@ -129,12 +127,12 @@ echo '
{
$("#messages_notif_number_wrapper").hide();
}
}
setTimeout("getPush()",60000);
});
}
$().ready(function()
{
var hints = $(\'.translatable span.hint\');
@@ -149,12 +147,12 @@ echo '
$youEditFieldFor = sprintf(translate('A modification of this field will be applied for the shop %s'), '<b>'.Context::getContext()->shop->name.'</b>');
echo 'hints.html(hints.html()+\'<br /><span class="red">'.addslashes($youEditFieldFor).'</span>\');';
}
echo ' var html = "";
echo ' 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")
@@ -164,16 +162,16 @@ echo ' var html = "";
if(!$("#" + wrapper_id + "_wrapper").is(":visible"))
{
$(".notifs_wrapper").hide();
$("#" + wrapper_id + "_number_wrapper").hide();
$("#" + wrapper_id + "_wrapper").show();
$("#" + wrapper_id + "_number_wrapper").hide();
$("#" + wrapper_id + "_wrapper").show();
}else
{
$("#" + wrapper_id + "_wrapper").hide();
$("#" + wrapper_id + "_wrapper").hide();
}
}
}
});
});
$("#main").click(function(){
$(".notifs_wrapper").hide();
});
@@ -209,7 +207,7 @@ echo ' var html = "";
</div>
</div>';
}
if (Configuration::get('PS_SHOW_NEW_MESSAGES') == 1)
if (Configuration::get('PS_SHOW_NEW_MESSAGES') == 1)
{
echo '<div id="messages_notif" class="notifs"><span id="messages_notif_number_wrapper" class="number_wrapper"><span id="messages_notif_value">0</span></span>
<div id="messages_notif_wrapper" class="notifs_wrapper">
@@ -324,7 +322,7 @@ if (Context::getContext()->employee->bo_uimode == 'hover')
echo ' <ul id="submenu" '.(strlen($mainsubtablist) ? 'class="withLeftBorder clearfix"' : '').'>'.$mainsubtablist.'</ul>
<div id="main">
<div id="content">'
.(file_exists(PS_ADMIN_DIR.'/../install') ? '<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">'
.(file_exists(_PS_ADMIN_DIR_.'/../install') ? '<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">'
.translate('For security reasons, you must also:').' '.
translate('delete the /install folder').
'</div>' : '').'
+17 -9
View File
@@ -26,11 +26,10 @@
*/
define('_PS_ADMIN_DIR_', getcwd());
define('PS_ADMIN_DIR', _PS_ADMIN_DIR_); // Retro-compatibility
include(PS_ADMIN_DIR.'/../config/config.inc.php');
include(PS_ADMIN_DIR.'/functions.php');
include(PS_ADMIN_DIR.'/header.inc.php');
include(_PS_ADMIN_DIR_.'/../config/config.inc.php');
include(_PS_ADMIN_DIR_.'/functions.php');
include(_PS_ADMIN_DIR_.'/init.php');
if (empty($tab) and !sizeof($_POST))
{
$tab = 'AdminHome';
@@ -38,14 +37,22 @@ if (empty($tab) and !sizeof($_POST))
$_POST['token'] = Tools::getAdminTokenLite($tab);
}
if ($adminObj = checkingTab($tab))
if ($adminObj = checkingTab($tab))
{
// init is different for new tabs (AdminController) and old tabs (AdminTab)
if ($adminObj instanceof AdminController)
{
$adminObj->path = dirname($_SERVER["PHP_SELF"]);
$adminObj->run();
}
else
{
include(_PS_ADMIN_DIR_.'/header.inc.php');
$isoUser = Context::getContext()->language->id;
$tabs = array();
$tabs = recursiveTab($adminObj->id, $tabs);
$tabs = array_reverse($tabs);
$bread = '';
foreach ($tabs AS $key => $item)
$bread .= ' <img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" alt="&gt;" />
'.((sizeof($tabs) - 1 > $key)
@@ -75,8 +82,8 @@ if (empty($tab) and !sizeof($_POST))
'.$bread;
echo '
</div>';
if (Shop::isMultiShopActivated() && Context::shop() != Shop::CONTEXT_ALL)
{
echo '<div class="multishop_info">';
@@ -144,7 +151,8 @@ if (empty($tab) and !sizeof($_POST))
die;
}
}
include(_PS_ADMIN_DIR_.'/footer.inc.php');
}
}
include(PS_ADMIN_DIR.'/footer.inc.php');
+8 -9
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -25,19 +25,18 @@
* International Registered Trademark & Property of PrestaShop SA
*/
class AdminTools extends AdminTab
class AdminTools extends AdminController
{
public function postProcess()
public function __construct()
{
$this->className = 'AdminTools';
parent::__construct();
}
public function display()
{
echo '<fieldset><legend><img src="../img/admin/tab-tools.gif" />'.$this->l('Shop Tools').'</legend>';
echo '<p>'.$this->l('Several tools are available to manage your shop.').'</p>';
echo '<br />';
echo '<p>'.$this->l('Please choose a tool by selecting a Tools sub-tab above.').'</p>';
echo '</fieldset>';
parent::display();
$this->context->smarty->display('adminTools.tpl');
}
}
+82
View File
@@ -0,0 +1,82 @@
body{background:#EFEFEF}
#top_container{margin:0;padding:0}
#header_infos{float:left;font-size:10px;margin:10px 20px 4px 0;width:380px;height:40px}
#header_infos #header_shopname span{display:block;font-size:24px;height:28px;overflow:hidden;margin-bottom:-8px}
#header_infos #header_logout{text-decoration:underline}
#header_infos #header_foaccess{text-decoration:none}
#header_search{float:right;height:39px;width:356px}
#header_search #bo_query{float:left;height:16px;line-height:16px;margin:8px 2px 0 30px;vertical-align:middle;width:140px}
#header_search #bo_search_type{float:left;height:21px;line-height:21px;margin:8px 2px 0 0;vertical-align:middle;width:90px}
#header_search #bo_search_submit{cursor:pointer;float:left;font-weight:700;margin:7px 0 0 2px;width:79px}
#header_quick{float:right;height:39px;margin-right:1px;width:175px}
#header_quick #quick_select{margin:8px 0 0 20px;vertical-align:middle;width:140px}
#header_shoplist{float: right;}
#header_myaccount{background:url(bg-lang.png) no-repeat;display:block;float:right;height:16px;margin:8px 1px 0 0;width:16px}
.button{background-color:#FFF6D3;border:1px solid #DFD5AF;border-left:1px solid #FFF6D3;border-top:1px solid #FFF6D3;color:#268CCD;padding:3px}
.button[disabled=disabled]{color:#8C8C8C}
input.button[disabled=disabled]:hover{background-color:#FFF6D3}
.button:hover{background-color:#F0EBD6}
.table{border:1px solid #DFD5C3;padding:0}
.table th a{text-decoration:underline}
.table a:hover{text-decoration:none}
.table tr th{background:#F4E6C9 url(news-bg.gif) repeat-x top left;padding:4px 6px}
.table tr td{border-bottom:1px solid #DEDEDE;color:#963;font-size:.9em;height:23px;padding:0 4px 0 6px}
.table tr.last td{border-bottom:none}
.alt_row{background-color:#EFEFEF}
.path_bar{background-color:#E2EBEE;border:1px solid #999999;font-family:Trebuchet,Arial,Helvetica,sans-serif;font-size:13px;margin-bottom:20px;padding:5px}
.path_bar a{font-weight:700}
.cat_bar{background-color:#F4E8CD;border:1px solid #999999;font-family:Trebuchet,Arial,Helvetica,sans-serif;font-size:12px;font-weight:700;margin-bottom:20px;padding:5px}
.cat_bar a{font-weight:700}
fieldset{background:#FFFFF0;border:1px solid #DFD5C3;font-size:1.1em;margin:0;padding:1em}
legend{background:#FFF6D3;border:1px solid #DFD5C3;font-weight:700;margin:0;padding:.2em .5em;text-align:left}
#menu{float:left;height:30px;line-height:normal;margin:10px 0 0;*margin:7px 0 0;padding:0;width:100%;padding:0 1px}
#menu li{background:url(bg-tab.png) repeat-x 0 -2px;float:left;height:29px;list-style:none;margin:0 1px 0 0;list-style:none;display:block;border:1px solid #999999;-moz-border-radius-topright:6px;-moz-border-radius-topleft:6px;-webkit-border-top-right-radius:6px;-webkit-border-top-left-radius:6px}
#menu li a{color:#000;display:block;height:20px;padding:8px 8px 4px 0;font-weight:bold;font-size:0.95em;}
#menu img{display:inline;padding:0 3px 0 6px;vertical-align:top;width:16px;height:16px}
#menu li.active,#menu li:hover{background-position:0 -38px;white-space:nowrap;}
#menu li.active a{color:#000}
#submenu{background:#ECEADE;clear:both;color:#666;margin:0;padding:0;border:1px solid #999999}
.withLeftBorder{background:transparent url(separator_subnav.png) no-repeat 0 5px}
#submenu li{display:inline;list-style:none;margin:0;background:transparent url(separator_subnav.png) no-repeat right 0;padding-left:7px;padding-right:7px;margin-top:8px;float:left;height:29px}
#submenu li a{text-decoration:underline}
#menu li{_height:32px;_padding-top:3px}
#menu li a{_display:inline;_padding:6px 5px 4px 0}
.tab-page {border:1px solid #ccc;background:#FFFFF0}
.tab-row .tab.selected {border:1px solid #ccc;background:#FFF6D3;margin:1px -3px -3px 0px;top:-2px}
.tab-row .tab {background:#EFEFEF}
hr {height: 1px;color:#E0D0B1;background-color:#E0D0B1}
#footer {height:40px;background:#ECEADE url(footer-bg.png) repeat-x scroll left bottom;border:1px solid #999999;font-size:12px;clear:both;font-size:0.9em;color:#666666}
#content {background-color:#FFF;border-left:1px solid #999999;border-right:1px solid #999999}
input[type="text"],input[type="password"],input[type="file"],textarea {border:1px solid #E0D0B1}
select {border: 1px solid #E0D0B1}
select[disabled="disabled"], input[disabled="disabled"],textarea[disabled="disabled"] {border: 1px solid #CCCCCC;color: #AAAAAA}
.header_module{background:url(header_module.png);padding-left: 0.5em;padding-top: 0.8em;height:20px;color: #812143;border:solid 1px #CCC;}
a.action_module{color: #268CCD;text-decoration: underline;}
a.header_module_toggle{font-weight: bold;color: #268CCD;display:block;}
a.module_toggle_all{color: #268CCD;}
.nbr_module{float:right;margin-right:10px;font-style:italic;font-size:12px;color: #268CCD;}
.autoupgradeSteps div { line-height: 30px; }
.upgradestep { margin-right: 5px;padding-left: 10px; padding-right: 5px;}
#upgradeNow.stepok, .autoupgradeSteps a.stepok { background-image: url("../img/admin/enabled.gif");background-position: left center;background-repeat: no-repeat;padding-left: 15px;}
#upgradeNow {-moz-border-bottom-colors: none;-moz-border-image: none;-moz-border-left-colors: none;-moz-border-right-colors: none;-moz-border-top-colors: none;border-color: #FFF6D3 #DFD5AF #DFD5AF #FFF6D3;border-right: 1px solid #DFD5AF;border-style: solid;border-width: 1px;color: #268CCD;font-size: medium;padding: 5px;}
.button-autoupgrade {-moz-border-bottom-colors: none;-moz-border-image: none;-moz-border-left-colors: none;-moz-border-right-colors: none;-moz-border-top-colors: none;border-color: #FFF6D3 #DFD5AF #DFD5AF #FFF6D3;border-right: 1px solid #DFD5AF;border-style: solid;border-width: 1px;color: #268CCD;font-size: medium;padding: 5px;}
.processing {overflow: auto;}
#header_infos {width: 445px;}
#header_shopname {float: left;width: 300px;}
#employee_links {float: left;clear: both;margin-top: 10px;}
#notifs_icon_wrapper {float: left;position: relative;margin-top: 8px;}
.notifs {float: left;position: relative; cursor: pointer;margin: 0px 5px;width: 18px;height: 15px;}
#orders_notif {background: url("notif_order.png") no-repeat left top;}
#customers_notif {background: url("notif_customer.png") no-repeat left top;}
#messages_notif {background: url("notif_message.png") no-repeat left top;}
.number_wrapper {color: white;display: none;font-size: 13px;font-weight: bold;position: absolute;right: -8px;top: -10px;z-index: 101;padding: 2px 5px;}
.number_wrapper span {background-color: #F03D25;display: block;padding: 0 2px;border-color: -moz-use-text-color #DD3822 #DD3822;border-radius: 2px 2px 2px 2px;border-right: 1px solid #DD3822;border-style: none solid solid;border-width: 0 0px;}
.notifs_wrapper {display: none;cursor:auto; position: absolute;top: 20px;left: 0;width:300px;background-color: white;border:2px solid #E0E0E0;padding: 10px;color: black;}
.notifs_wrapper h3 {font-size: 14px;padding-bottom:8px;margin:0;border-bottom: 2px solid #E0E0E0;}
.notifs_wrapper ul {padding:6px 0;margin:0;}
.notifs_wrapper ul li {text-decoration: none;list-style: none;font-size:12px;padding:5px 0;}
#header_infos .notifs_wrapper a {font-weight: bold;color: black;}
.notifs_wrapper p {font-size: 12px;padding-top:8px;margin:0;border-top: 2px solid #E0E0E0;}
.notifs_wrapper p.no_notifs {border: none;}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 968 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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;
Binary file not shown.

After

Width:  |  Height:  |  Size: 277 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 218 B

+34
View File
@@ -0,0 +1,34 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
{include file='header.tpl'}
<fieldset>
<legend><img src="../img/admin/tab-tools.gif" />{l s='Shop Tools'}</legend>
<p>{l s='Several tools are available to manage your shop.'}</p>
<br />
<p>{l s='Please choose a tool by selecting a Tools sub-tab above.'}</p>
</fieldset>
{include file='footer.tpl'}
+47
View File
@@ -0,0 +1,47 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
</div>
</div>
{$HOOK_FOOTER}
<div id="footer">
<div style="float:left;margin-left:10px;padding-top:6px">
<a href="http://www.prestashop.com/" target="_blank" style="font-weight:700;color:#666666">PrestaShop&trade; {$ps_version}</a><br />
<span style="font-size:10px">{l s='Load time: '}{$end_time}s</span>
</div>
<div style="float:right;height:40px;margin-right:10px;line-height:38px;vertical-align:middle">
{if $iso_is_fr}
<span style="color: #812143; font-weight: bold;">Questions / Renseignements / Formations :</span> <strong>+33 (0)1.40.18.30.04</strong> de 09h &agrave; 18h
{/if}
| <a href="http://www.prestashop.com/en/contact_us/" target="_blank" class="footer_link">{l s='Contact'}</a>
| <a href="http://forge.prestashop.com" target="_blank" class="footer_link">{l s='Bug Tracker'}</a>
| <a href="http://www.prestashop.com/forums/" target="_blank" class="footer_link">{l s='Forum'}</a>
</div>
</div>
</div>
</div>
</body>
</html>
+263
View File
@@ -0,0 +1,263 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{$iso}" lang="{$iso}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="robots" content="NOFOLLOW, NOINDEX" />
<title>PrestaShop&trade; - {l s='Administration panel'|escape:'htmlall':'UTF-8'}</title>
<script type="text/javascript">
var helpboxes = {$help_box};
var roundMode = {$round_mode};
{* Notifications vars *}
var new_order_msg = '{l s='A new order has been made on your shop.'}';
var order_number_msg = '{l s='Order number : '}';
var total_msg = '{l s='Total : '}';
var from_msg = '{l s='From : '}';
var see_order_msg = '{l s='Click here to see that order'}';
var new_customer_msg = '{l s='A new customer registered on your shop.'}';
var customer_name_msg = '{l s='Customer name : '}';
var see_customer_msg = '{l s='Click here to see that customer'}';
var new_msg = '{l s='A new message posted on your shop.'}';
var excerpt_msg = '{l s='Excerpt : '}';
var see_msg = '{l s='Click here to see that message'}';
</script>
{if isset($css_files)}
{foreach from=$css_files key=css_uri item=media}
<link href="{$css_uri}" rel="stylesheet" type="text/css" media="{$media}" />
{/foreach}
{/if}
{if isset($js_files)}
{foreach from=$js_files item=js_uri}
<script type="text/javascript" src="{$js_uri}"></script>
{/foreach}
{/if}
<script type="text/javascript">
$(function() {
$.ajax({
type: 'POST',
url: 'ajax.php',
data: 'helpAccess=1&item={$class_name}&isoUser={$iso_user}&country={$country_iso_code}&version={$version}',
async : true,
success: function(msg) {
$("#help-button").html(msg);
$("#help-button").fadeIn("slow");
}
});
});
</script>
<link rel="shortcut icon" href="{$img_dir}favicon.ico" />
{$HOOK_HEADER}
<!--[if IE]>
<link type="text/css" rel="stylesheet" href="'._PS_CSS_DIR_.'admin-ie.css" />
<![endif]-->
<style type="text/css">
div#header_infos, div#header_infos a#header_shopname, div#header_infos a#header_logout, div#header_infos a#header_foaccess {
color:{$brightness}
}
</style>
</head>
<body {if $bo_color} style="background:{$bo_color}" {/if}>
{if $is_multishop}
<script type="text/javascript">
hints.html(hints.html()+\'<br /><span class="red">'.addslashes(
{if $shop_context == 'all'}
{l s='A modification of this field will be applied for all shops'}
{elseif $shop_context == 'group'}{l s=''}
{l s='A modification of this field will be applied for all shops of group '}<b>{$shop_name}</b>
{/if}
).'</span>\');
</script>
{/if}
<div id="top_container">
<div id="container">
<div id="header_infos"><span>
<a id="header_shopname" href="index.php"><span>{$shop_name}</span></a><div id="notifs_icon_wrapper">
{if {$show_new_orders} == 1}
<div id="orders_notif" class="notifs">
<span id="orders_notif_number_wrapper" class="number_wrapper">
<span id="orders_notif_value">0</span>
</span>
<div id="orders_notif_wrapper" class="notifs_wrapper">
<h3>{l s='Last orders'}</h3>
<p class="no_notifs">{l s='No new orders has been made on your shop'}</p>
<ul id="list_orders_notif"></ul>
<p><a href="index.php?tab=AdminOrders&token={$token_admin_orders}">{l s='Show all orders'}</a></p>
</div>
</div>
{/if}
{if ($show_new_customers == 1)}
<div id="customers_notif" class="notifs notifs_alternate">
<span id="customers_notif_number_wrapper" class="number_wrapper">
<span id="customers_notif_value">0</span>
</span>
<div id="customers_notif_wrapper" class="notifs_wrapper">
<h3>{l s='Last customers'}</h3>
<p class="no_notifs">{l s='No new customers registered on your shop'}</p>
<ul id="list_customers_notif"></ul>
<p><a href="index.php?tab=AdminCustomers&token={$token_admin_customers}">{l s='Show all customers'}</a></p>
</div>
</div>
{/if}
{if {$show_new_messages} == 1}
<div id="messages_notif" class="notifs">
<span id="messages_notif_number_wrapper" class="number_wrapper">
<span id="messages_notif_value">0</span>
</span>
<div id="messages_notif_wrapper" class="notifs_wrapper">
<h3>{l s='Last messages'}</h3>
<p class="no_notifs">{l s='No new messages posted on your shop'}</p>
<ul id="list_messages_notif"></ul>
<p><a href="index.php?tab=AdminMessages&token='.Tools::getAdminTokenLite('AdminMessages').'">{l s='Show all messages'}</a></p>
</div>
</div>
{/if}
</div>
<span id="employee_links">
{$first_name}&nbsp;{$last_name}
[ <a href="index.php?logout" id="header_logout">
<span>{l s='logout'}</span>
</a> ]
{if {$base_url}}
- <a href="{$base_url}" id="header_foaccess" target="_blank" title="{l s='View my shop'}"><span>{l s='View my shop'}</span></a>
{/if}
- <a href="index.php?tab=AdminEmployees&id_employee={$employee->id}&updateemployee&token={$token_admin_employees}" style="font-size: 10px;"><img src="../img/admin/employee.gif" alt="" /> {l s='My preferences'}</a>
</span></div>
<div id="header_search">
<form method="post" action="index.php?tab=AdminSearch&token={$token_admin_search}">
<input type="text" name="bo_query" id="bo_query" value="{$bo_query}" />
<select name="bo_search_type" id="bo_search_type">
<option value="0">{l s='everywhere'}</option>
<option value="1" {if {$search_type} == 1} selected="selected" {/if}>{l s='catalog'}</option>
<option value="2" {if {$search_type} == 2} selected="selected" {/if}>{l s='customers'}</option>
<option value="6" {if {$search_type} == 6} selected="selected" {/if}>{l s='ip address'}</option>
<option value="3" {if {$search_type} == 3} selected="selected" {/if}>{l s='orders'}</option>
<option value="4" {if {$search_type} == 4} selected="selected" {/if}>{l s='invoices'}</option>
<option value="5" {if {$search_type} == 5} selected="selected" {/if}>{l s='carts'}</option>
</select>
<input type="submit" id="bo_search_submit" class="button" value="{l s='Search'}"/>
</form>
</div>
<div id="header_quick">
<script type="text/javascript">
function quickSelect(elt)
{
var eltVal = $(elt).val();
if (eltVal == "0") return false;
else if (eltVal.substr(eltVal.length - 6) == "_blank") window.open(eltVal.substr(0, eltVal.length - 6), "_blank");
else location.href = eltVal;
}
</script>
<select onchange="quickSelect(this);" id="quick_select">
<option value="0">{l s='Quick Access'}</option>
{foreach $quick_access as $quick}
<option value="{$quick.link}{if $quick.new_window}_blank{/if}">&gt; {$quick.name}</option>
{/foreach}
</select>
</div>
{if $multi_shop}
<div id="header_shoplist">{l s='Select your shop:'}{$shop_list}</div>
{/if}
<div class="flatclear">&nbsp;</div>
{$HOOK_TOP}
<ul id="menu">
{if !$tab}
<div class="mainsubtablist" style="display:none"></div>'
{/if}
{foreach $tabs AS $t}
<li class="submenu_size {if $t.current}active{/if}" id="maintab{$t.id_tab}">
<a href="index.php?tab={$t.class_name}&token={$t.token}">
<img src="{$t.img}" alt="" /> {$t.name}
</a>
</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="index.php?tab={$t2.class_name}&token={$t2.token}">{$t2.name}</a></li>
{/foreach}
{if $t.current}
{assign var='mainsubtab' value=$t}
{/if}
</div>
{/foreach}
{if $employee->bo_uimode == 'hover'}
<script type="text/javascript">
$("#menu li").hoverIntent( { over:hoverTabs,timeout:100,out:outTabs } );
function outTabs(){}
function hoverTabs() {
var content = $("#tab"+parseInt(this.id.substr(7, 3))+"_subtabs").html();
$("#submenu").html(content);
if (content.length == 0)
$("#submenu").removeClass("withLeftBorder");
else
$("#submenu").addClass("withLeftBorder");
$("#menu li").removeClass("active");
$(this).addClass("active");
}
</script>
{/if}
<ul id="submenu" {if isset($mainsubtab)}class="withLeftBorder clearfix"{/if}>
{if isset($mainsubtab)}
{foreach $mainsubtab.sub_tabs AS $t}
<li><a href="index.php?tab={$t.class_name}&token={$t.token}">{$t.name}</a></li>
{/foreach}
{/if}
</ul>
<div id="main">
<div id="content">
{if $install_dir_exists}
<div style="background-color: #FFEBCC;border: 1px solid #F90;line-height: 20px;margin: 0px 0px 10px;padding: 10px 20px;">
{l s='For security reasons, you must also:'} {l s='delete the /install folder'}
</div>
{/if}
<div class="path_bar">
<div id="help-button" class="floatr" style="display: none; font-family: Verdana; font-size: 10px; margin-right: 4px; margin-top: 4px;"></div>
<a href="?token={$home_token}">{l s='Back Office'}</a>
{foreach $tabs_breadcrumb AS $item}
<img src="../img/admin/separator_breadcrum.png" style="margin-right:5px" alt="&gt;" />
{if isset($item.token)}<a href="?tab={$item.class_name}&token={$item.token}">{/if}
{$item.name}
{if isset($item.token)}</a>{/if}
{/foreach}
</div>
{if $is_multishop}
<div class="multishop_info">
{if $shop_context == 'group'}
{l s='You are configuring your store for group shop '}<b>{$shop_name}</b>
{elseif $shop_context == 'shop'}
{l s='You are configuring your store for shop '}<b>{$shop_name}</b>
{/if}
</div>
{/if}
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 2007-2011 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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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,43 @@
{*
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<html>
<head>
<title>{l s='Invalid security token'}</title>
</head>
<body style="font-family:Arial,Verdana,Helvetica,sans-serif;background-color:#EC8686">
<div style="background-color:#FAE2E3;border:1px solid #000000;color:#383838;font-weight:700;line-height:20px;margin:0 0 10px;padding:10px 15px;width:500px">
<img src="../img/admin/error2.png" style="margin:-4px 5px 0 0;vertical-align:middle">
{l s='Invalid security token'}
</div>
<a href="{$url}" method="get" style="float:left;margin:10px">
<input type="button" value="{l s='I understand the risks and I really want to display this page'}" style="height:30px;margin-top:5px" />
</a>
<a href="index.php" method="get" style="float:left;margin:10px">
<input type="button" value="{l s='Take me out of here!'}" style="height:40px" />
</a>
</body>
</html>
+453
View File
@@ -0,0 +1,453 @@
<?php
class AdminController extends Controller
{
public $path;
/** @var string Associated table name */
public $table;
/** @var string Object identifier inside the associated table */
protected $identifier = false;
/** @var string Tab name */
public $className;
/** @var array tabAccess */
public $tabAccess;
/** @var integer Tab id */
public $id = -1;
/** @var string Security token */
public $token;
/** @var string shop | group_shop */
public $shopLinkType;
/** @var string Default ORDER BY clause when $_orderBy is not defined */
protected $_defaultOrderBy = false;
public function __construct()
{
parent::__construct();
$this->id = Tab::getIdFromClassName($this->className);
$this->_conf = array(
1 => $this->l('Deletion successful'), 2 => $this->l('Selection successfully deleted'),
3 => $this->l('Creation successful'), 4 => $this->l('Update successful'),
5 => $this->l('Status update successful'), 6 => $this->l('Settings update successful'),
7 => $this->l('Image successfully deleted'), 8 => $this->l('Module downloaded successfully'),
9 => $this->l('Thumbnails successfully regenerated'), 10 => $this->l('Message sent to the customer'),
11 => $this->l('Comment added'), 12 => $this->l('Module installed successfully'),
13 => $this->l('Module uninstalled successfully'), 14 => $this->l('Language successfully copied'),
15 => $this->l('Translations successfully added'), 16 => $this->l('Module transplanted successfully to hook'),
17 => $this->l('Module removed successfully from hook'), 18 => $this->l('Upload successful'),
19 => $this->l('Duplication completed successfully'), 20 => $this->l('Translation added successfully but the language has not been created'),
21 => $this->l('Module reset successfully'), 22 => $this->l('Module deleted successfully'),
23 => $this->l('Localization pack imported successfully'), 24 => $this->l('Refund Successful'),
25 => $this->l('Images successfully moved'),
);
if (!$this->identifier) $this->identifier = 'id_'.$this->table;
if (!$this->_defaultOrderBy) $this->_defaultOrderBy = $this->identifier;
$className = get_class($this);
if ($className == 'AdminCategories' OR $className == 'AdminProducts')
$className = 'AdminCatalog';
$this->token = Tools::getAdminToken($className.(int)$this->id.(int)$this->context->employee->id);
if (!Shop::isMultiShopActivated())
$this->shopLinkType = '';
}
/**
* Check rights to view the current tab
*
* @return boolean
*/
public function viewAccess($disable = false)
{
if ($disable)
return true;
$this->tabAccess = Profile::getProfileAccess($this->context->employee->id_profile, $this->id);
if ($this->tabAccess['view'] === '1')
return true;
return false;
}
/**
* Check for security token
*/
public function checkToken()
{
$token = Tools::getValue('token');
return (!empty($token) AND $token === $this->token);
}
public function run()
{
$this->checkAccess();
$this->init();
$this->postProcess();
$this->setMedia();
$this->initHeader();
$this->initFooter();
//$adminObj->displayConf();
//$adminObj->displayErrors();
$this->display();
}
/**
* Check if the token is valid, else display a warning page
*/
public function checkAccess()
{
if (!$this->checkToken())
{
// If this is an XSS attempt, then we should only display a simple, secure page
// ${1} in the replacement string of the regexp is required, because the token may begin with a number and mix up with it (e.g. $17)
$url = preg_replace('/([&?]token=)[^&]*(&.*)?$/', '${1}'.$this->token.'$2', $_SERVER['REQUEST_URI']);
if (false === strpos($url, '?token=') AND false === strpos($url, '&token='))
$url .= '&token='.$this->token;
$this->context->smarty->assign('url', htmlentities($url));
$this->context->smarty->display(_PS_ADMIN_DIR_.'/themes/invalid_token.tpl');
die;
}
}
public function display()
{
}
/**
* Assign smarty variables for the header
*/
public function initHeader()
{
// Shop context
if (Shop::isMultiShopActivated())
{
if (Context::shop() == Shop::CONTEXT_ALL)
$shop_context = 'all';
elseif (Context::shop() == Shop::CONTEXT_GROUP)
{
$shop_context = 'group';
$shop_name = $this->context->shop->getGroup()->name;
}
else
{
$shop_context = 'shop';
$shop_name = $this->context->shop->name;
}
$this->context->smarty->assign(array(
'shop_name' => $shop_name,
'shop_context' => $shop_context,
));
$youEditFieldFor = sprintf($this->l('A modification of this field will be applied for the shop %s'), '<b>'.Context::getContext()->shop->name.'</b>');
}
// Multishop
$is_multishop = Shop::isMultiShopActivated();// && Context::shop() != Shop::CONTEXT_ALL;
/*if ($is_multishop)
{
if (Context::shop() == Shop::CONTEXT_GROUP)
{
$shop_context = 'group';
$shop_name = $this->context->shop->getGroup()->name;
}
elseif (Context::shop() == Shop::CONTEXT_SHOP)
{
$shop_context = 'shop';
$shop_name = $this->context->shop->name;
}*/
// Quick access
$quick_access = QuickAccess::getQuickAccesses($this->context->language->id);
foreach ($quick_access AS $index => $quick)
{
preg_match('/tab=(.+)(&.+)?$/', $quick['link'], $adminTab);
if (isset($adminTab[1]))
{
if (strpos($adminTab[1], '&'))
$adminTab[1] = substr($adminTab[1], 0, strpos($adminTab[1], '&'));
$quick_access[$index]['link'] .= '&token='.Tools::getAdminToken($adminTab[1].(int)(Tab::getIdFromClassName($adminTab[1])).(int)($this->context->employee->id));
}
}
// Tab list
$tabs = Tab::getTabs($this->context->language->id, 0);
foreach ($tabs AS $index => $tab)
{
if (Tab::checkTabRights($tab['id_tab']) === true)
{
$img_exists_cache = Tools::file_exists_cache(_PS_ADMIN_DIR_.'/themes/'.$this->context->employee->bo_theme.'/img/t/'.$tab['class_name'].'.gif');
$img = ($img_exists_cache ? 'themes/'.Context::getContext()->employee->bo_theme.'/img/' : _PS_IMG_).'t/'.$tab['class_name'].'.gif';
if (trim($tab['module']) != '')
$img = _MODULE_DIR_.$tab['module'].'/'.$tab['class_name'].'.gif';
$tabs[$index]['current'] = ($tab['class_name'] == $this->className) || (Tab::getCurrentParentId() == $tab['id_tab']);
$tabs[$index]['img'] = $img;
$tabs[$index]['token'] = Tools::getAdminToken($tab['class_name'].(int)($tab['id_tab']).(int)$this->context->employee->id);
$sub_tabs = Tab::getTabs($this->context->language->id, $tab['id_tab']);
foreach ($sub_tabs AS $index2 => $sub_tab)
{
if (Tab::checkTabRights($sub_tab) === true)
{
$sub_tabs[$index2]['token'] = Tools::getAdminTokenLite($sub_tab['class_name']);
}
else
unset($sub_tabs[$index2]);
}
$tabs[$index]['sub_tabs'] = $sub_tabs;
}
else
unset($tabs[$index]);
}
// Breadcrumbs
$home_token = Tools::getAdminToken('AdminHome'.intval(Tab::getIdFromClassName('AdminHome')).(int)$this->context->employee->id);
$tabs_breadcrumb = array();
$tabs_breadcrumb = recursiveTab($this->id, $tabs_breadcrumb);
$tabs_breadcrumb = array_reverse($tabs_breadcrumb);
foreach ($tabs_breadcrumb AS $key => $item)
for ($i = 0; $i < (count($tabs_breadcrumb) - 1); $i++)
$tabs_breadcrumb[$key]['token'] = Tools::getAdminToken($item['class_name'].intval($item['id_tab']).(int)$this->context->employee->id);
/* Hooks are volontary out the initialize array (need those variables already assigned) */
$this->context->smarty->assign(array(
'img_dir' => _PS_IMG_,
'iso' => $this->context->language->iso_code,
'class_name' => $this->className,
'iso_user' => $this->context->language->id,
'country_iso_code' => $this->context->country->iso_code,
'version' => _PS_VERSION_,
'help_box' => Configuration::get('PS_HELPBOX'),
'round_mode' => Configuration::get('PS_PRICE_ROUND_MODE'),
'brightness' => Tools::getBrightness(empty($this->context->employee->bo_color) ? '#FFFFFF' : $this->context->employee->bo_color) < 128 ? 'white' : '#383838',
'edit_field' => isset($youEditFieldFor) ? $youEditFieldFor : '\'\'',
'lang_iso' => $this->context->language->iso_code,
'link' => $this->context->link,
'bo_color' => isset($this->context->employee->bo_color) ? Tools::htmlentitiesUTF8($this->context->employee->bo_color) : null,
'shop_name' => Configuration::get('PS_SHOP_NAME'),
'show_new_orders' => Configuration::get('PS_SHOW_NEW_ORDERS'),
'show_new_customers' => Configuration::get('PS_SHOW_NEW_CUSTOMERS'),
'show_new_messages' => Configuration::get('PS_SHOW_NEW_MESSAGES'),
'token_admin_orders' => Tools::getAdminTokenLite('AdminOrders'),
'token_admin_customers' => Tools::getAdminTokenLite('AdminCustomers'),
'token_admin_employees' => Tools::getAdminTokenLite('AdminEmployees'),
'token_admin_search' => Tools::getAdminTokenLite('AdminSearch'),
'first_name' => Tools::substr($this->context->employee->firstname, 0, 1),
'last_name' => htmlentities($this->context->employee->lastname, ENT_COMPAT, 'UTF-8'),
'base_url' => $this->context->shop->getBaseURL(),
'employee' => $this->context->employee,
'search_type' => Tools::getValue('bo_search_type'),
'bo_query' => Tools::safeOutput(Tools::stripslashes(Tools::getValue('bo_query'))),
'quick_access' => $quick_access,
'multi_shop' => Shop::isMultiShopActivated(),
'shop_list' => (Shop::isMultiShopActivated() ? generateShopList() : null), //@TODO refacto
'tab' => $tab,
'current_parent_id' => (int)Tab::getCurrentParentId(),
'tabs' => $tabs,
'install_dir_exists' => file_exists(_PS_ADMIN_DIR_.'/../install'),
'home_token' => $home_token,
'tabs_breadcrumb' => $tabs_breadcrumb,
'is_multishop' => $is_multishop,
));
$this->context->smarty->assign(array(
'HOOK_HEADER' => Module::hookExec('backOfficeHeader'),
'HOOK_TOP' => Module::hookExec('backOfficeTop'),
));
$this->context->smarty->assign('css_files', $this->css_files);
$this->context->smarty->assign('js_files', array_unique($this->js_files));
//$this->context->smarty->display(_PS_ADMIN_DIR_.'/themes/header.tpl');
}
/**
* Assign smarty variables for the page main content
*/
public function initContent()
{
}
/**
* Assign smarty variables for the footer
*/
public function initFooter()
{
$this->context->smarty->assign(array(
'ps_version' => _PS_VERSION_,
'end_time' => number_format(microtime(true) - $this->timerStart, 3, '.', ''),
'iso_is_fr' => strtoupper($this->context->language->iso_code) == 'FR',
));
$this->context->smarty->assign(array(
'HOOK_FOOTER' => Module::hookExec('backOfficeFooter'),
));
}
public function setMedia()
{
$this->addCSS(_PS_JS_DIR_.'jquery/datepicker/datepicker.css', 'all');
$this->addCSS(_PS_CSS_DIR_.'admin.css', 'all');
$this->addCSS(_PS_CSS_DIR_.'jquery.cluetip.css', 'all');
$this->addCSS($this->path.'/themes/'.'default/admin.css', 'all');
if ($this->context->language->is_rtl)
$this->addCSS(_THEME_CSS_DIR_.'rtl.css');
$this->addJS(_PS_JS_DIR_.'jquery/jquery-1.4.4.min.js');
$this->addJS(_PS_JS_DIR_.'jquery/jquery.hoverIntent.minified.js');
$this->addJS(_PS_JS_DIR_.'jquery/jquery.cluetip.js');
$this->addJS(_PS_JS_DIR_.'admin.js');
$this->addJS(_PS_JS_DIR_.'toggle.js');
$this->addJS(_PS_JS_DIR_.'tools.js');
$this->addJS(_PS_JS_DIR_.'ajax.js');
$this->addJS(_PS_JS_DIR_.'notifications.js');
}
public static function translate($string, $class, $addslashes = FALSE, $htmlentities = TRUE)
{
$class = strtolower($class);
// if the class is extended by a module, use modules/[module_name]/xx.php lang file
//$currentClass = get_class($this);
if(false AND Module::getModuleNameFromClass($class))
{
$string = str_replace('\'', '\\\'', $string);
return Module::findTranslation(Module::$classInModule[$class], $string, $class);
}
global $_LANGADM;
$_LANGADM = array_change_key_case($_LANGADM);
//if ($class == __CLASS__)
// $class = 'AdminTab';
$key = md5(str_replace('\'', '\\\'', $string));
$str = (key_exists($class.$key, $_LANGADM)) ? $_LANGADM[$class.$key] : ((key_exists($class.$key, $_LANGADM)) ? $_LANGADM[$class.$key] : $string);
$str = $htmlentities ? htmlentities($str, ENT_QUOTES, 'utf-8') : $str;
return str_replace('"', '&quot;', ($addslashes ? addslashes($str) : stripslashes($str)));
}
/**
* use translations files to replace english expression.
*
* @param mixed $string term or expression in english
* @param string $class
* @param boolan $addslashes if set to true, the return value will pass through addslashes(). Otherwise, stripslashes().
* @param boolean $htmlentities if set to true(default), the return value will pass through htmlentities($string, ENT_QUOTES, 'utf-8')
* @return string the translation if available, or the english default text.
*/
protected function l($string, $class = 'AdminTab', $addslashes = FALSE, $htmlentities = TRUE)
{
$class = get_class($this);
return self::translate($string, $class, $addslashes, $htmlentities);
}
public function init()
{
ob_start();
$this->timerStart = microtime(true);
if (isset($_GET['logout']))
$this->context->employee->logout();
if (!isset($this->context->employee) || !$this->context->employee->isLoggedBack())
Tools::redirectAdmin('login.php?redirect='.$_SERVER['REQUEST_URI']);
// Set current index
$currentIndex = $_SERVER['SCRIPT_NAME'].(($tab = Tools::getValue('tab')) ? '?tab='.$tab : '');
if ($back = Tools::getValue('back'))
$currentIndex .= '&back='.urlencode($back);
AdminTab::$currentIndex = $currentIndex;
$iso = $this->context->language->iso_code;
include(_PS_TRANSLATIONS_DIR_.$iso.'/errors.php');
include(_PS_TRANSLATIONS_DIR_.$iso.'/fields.php');
include(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php');
/* Server Params */
$protocol_link = (Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
$protocol_content = (isset($useSSL) AND $useSSL AND Configuration::get('PS_SSL_ENABLED')) ? 'https://' : 'http://';
$link = new Link($protocol_link, $protocol_content);
$this->context->link = $link;
//define('_PS_BASE_URL_', Tools::getShopDomain(true));
//define('_PS_BASE_URL_SSL_', Tools::getShopDomainSsl(true));
/*$path = _PS_ADMIN_DIR_.'/themes/';
if (empty($this->context->employee->bo_theme) OR !file_exists($path.$this->context->employee->bo_theme.'/admin.css'))
{
if (file_exists($path.'oldschool/admin.css'))
$this->context->employee->bo_theme = 'oldschool';
elseif (file_exists($path.'origins/admin.css'))
$this->context->employee->bo_theme = 'origins';
else
foreach (scandir($path) as $theme)
if ($theme[0] != '.' AND file_exists($path.$theme.'/admin.css'))
{
$employee->bo_theme = $theme;
break;
}
$this->context->employee->update();
}*/
// Change shop context ?
if (Shop::isMultiShopActivated() && Tools::getValue('setShopContext') !== false)
{
$this->context->cookie->shopContext = Tools::getValue('setShopContext');
$url = parse_url($_SERVER['REQUEST_URI']);
$query = (isset($url['query'])) ? $url['query'] : '';
parse_str($query, $parseQuery);
unset($parseQuery['setShopContext']);
Tools::redirectAdmin($url['path'] . '?' . http_build_query($parseQuery));
}
$shopID = '';
if ($this->context->cookie->shopContext)
{
$split = explode('-', $this->context->cookie->shopContext);
if (count($split) == 2 && $split[0] == 's')
$shopID = (int)$split[1];
}
$this->context->shop = new Shop($shopID);
/* Filter memorization */
if (isset($_POST) AND !empty($_POST) AND isset($this->table))
foreach ($_POST AS $key => $value)
if (is_array($this->table))
{
foreach ($this->table AS $table)
if (strncmp($key, $table.'Filter_', 7) === 0 OR strncmp($key, 'submitFilter', 12) === 0)
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
}
elseif (strncmp($key, $this->table.'Filter_', 7) === 0 OR strncmp($key, 'submitFilter', 12) === 0)
$this->context->cookie->$key = !is_array($value) ? $value : serialize($value);
if (isset($_GET) AND !empty($_GET) AND isset($this->table))
foreach ($_GET AS $key => $value)
if (is_array($this->table))
{
foreach ($this->table AS $table)
if (strncmp($key, $table.'OrderBy', 7) === 0 OR strncmp($key, $table.'Orderway', 8) === 0)
$this->context->cookie->$key = $value;
}
elseif (strncmp($key, $this->table.'OrderBy', 7) === 0 OR strncmp($key, $this->table.'Orderway', 12) === 0)
$this->context->cookie->$key = $value;
}
public function displayErrors()
{
p($this->_errors);
}
public function postProcess()
{
}
}
+12
View File
@@ -240,4 +240,16 @@ class TabCore extends ObjectModel
WHERE `id_tab` = '.(int)$result[$i]['id_tab']);
return true;
}
public static function checkTabRights($id_tab)
{
static $tabAccesses = NULL;
if ($tabAccesses === NULL)
$tabAccesses = Profile::getProfileAccesses(Context::getContext()->employee->id_profile);
if (isset($tabAccesses[(int)($id_tab)]['view']))
return ($tabAccesses[(int)($id_tab)]['view'] === '1');
return false;
}
}
+9 -5
View File
@@ -102,14 +102,14 @@ Context::getContext()->country = $defaultCountry;
/* Instantiate cookie */
$cookieLifetime = (time() + (((int)Configuration::get('PS_COOKIE_LIFETIME_BO') > 0 ? (int)Configuration::get('PS_COOKIE_LIFETIME_BO') : 1)* 3600));
if (defined('PS_ADMIN_DIR'))
if (defined('_PS_ADMIN_DIR_'))
$cookie = new Cookie('psAdmin', '', $cookieLifetime);
else
$cookie = new Cookie('ps', '', $cookieLifetime);
Context::getContext()->cookie = $cookie;
/* Create employee if in BO, customer else */
if (defined('PS_ADMIN_DIR'))
if (defined('_PS_ADMIN_DIR_'))
{
$employee = new Employee($cookie->id_employee);
Context::getContext()->employee = $employee;
@@ -123,9 +123,9 @@ else
$customer = new Customer($cookie->id_customer);
$customer->logged = $cookie->logged;
}
else
else
$customer = new Customer();
$customer->id_guest = $cookie->id_guest;
Context::getContext()->customer = $customer;
}
@@ -158,7 +158,11 @@ if (function_exists('date_default_timezone_set'))
@date_default_timezone_set(Configuration::get('PS_TIMEZONE'));
/* Smarty */
require_once(dirname(__FILE__).'/smarty.config.inc.php');
if (!defined('_PS_ADMIN_DIR_'))
require_once(dirname(__FILE__).'/smarty.config.inc.php');
else
require_once(dirname(__FILE__).'/smartyadmin.config.inc.php');
Context::getContext()->smarty = $smarty;
/* Possible value are true, false, 'URL'
(for 'URL' append SMARTY_DEBUG as a parameter to the url)
+150
View File
@@ -0,0 +1,150 @@
<?php
/*
* 2007-2011 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 <contact@prestashop.com>
* @copyright 2007-2011 PrestaShop SA
* @version Release: $Revision: 6844 $
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
define('_PS_SMARTY_DIR_', _PS_TOOL_DIR_.'smarty/');
require_once(_PS_SMARTY_DIR_.'Smarty.class.php');
global $smarty;
$smarty = new Smarty();
$smarty->template_dir = _PS_ADMIN_DIR_.'/themes/template';
$smarty->compile_dir = _PS_SMARTY_DIR_.'admincompile';
$smarty->cache_dir = _PS_SMARTY_DIR_.'admincache';
$smarty->caching = false;
$smarty->force_compile = (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_FORCE_COMPILE_) ? true : false;
$smarty->compile_check = (Configuration::get('PS_SMARTY_FORCE_COMPILE') == _PS_SMARTY_CHECK_COMPILE_) ? true : false;
$smarty->debugging = false;
$smarty->debugging_ctrl = 'URL'; // 'NONE' on production
$smarty->deprecation_notices = false; // so many depreciated yet not migrated smarty calls
if (Configuration::get('PS_HTML_THEME_COMPRESSION'))
$smarty->registerFilter('output', 'smartyMinifyHTML');
if (Configuration::get('PS_JS_HTML_THEME_COMPRESSION'))
$smarty->registerFilter('output', 'smartyPackJSinHTML');
smartyRegisterFunction($smarty, 'modifier', 'truncate', 'smarty_modifier_truncate');
smartyRegisterFunction($smarty, 'modifier', 'secureReferrer', array('Tools', 'secureReferrer'));
smartyRegisterFunction($smarty, 'function', 't', 'smartyTruncate'); // unused
smartyRegisterFunction($smarty, 'function', 'm', 'smartyMaxWords'); // unused
smartyRegisterFunction($smarty, 'function', 'p', 'smartyShowObject'); // Debug only
smartyRegisterFunction($smarty, 'function', 'd', 'smartyDieObject'); // Debug only
smartyRegisterFunction($smarty, 'function', 'l', 'smartyTranslate');
smartyRegisterFunction($smarty, 'function', 'dateFormat', array('Tools', 'dateFormat'));
smartyRegisterFunction($smarty, 'function', 'convertPrice', array('Product', 'convertPrice'));
smartyRegisterFunction($smarty, 'function', 'convertPriceWithCurrency', array('Product', 'convertPriceWithCurrency'));
smartyRegisterFunction($smarty, 'function', 'displayWtPrice', array('Product', 'displayWtPrice'));
smartyRegisterFunction($smarty, 'function', 'displayWtPriceWithCurrency', array('Product', 'displayWtPriceWithCurrency'));
smartyRegisterFunction($smarty, 'function', 'displayPrice', array('Tools', 'displayPriceSmarty'));
smartyRegisterFunction($smarty, 'modifier', 'convertAndFormatPrice', array('Product', 'convertAndFormatPrice')); // used twice
function smartyTranslate($params, &$smarty)
{
global $_LANGADM;
$htmlentities = !isset($params['js']);
$addslashes = !isset($params['slashes']);
$string = str_replace('\'', '\\\'', $params['s']);
$filename = ((!isset($smarty->compiler_object) OR !is_object($smarty->compiler_object->template)) ? $smarty->template_filepath : $smarty->compiler_object->template->getTemplateFilepath());
$class = Tools::substr(basename($filename), 0, -4);//.'_'.md5($string);
if(in_array($class, array('header','footer','password','login')))
$class = 'index';
return AdminController::translate($string, $class, $addslashes, $htmlentities);
}
function smartyDieObject($params, &$smarty)
{
return Tools::d($params['var']);
}
function smartyShowObject($params, &$smarty)
{
return Tools::p($params['var']);
}
function smartyMaxWords($params, &$smarty)
{
Tools::displayAsDeprecated();
$params['s'] = str_replace('...', ' ...', html_entity_decode($params['s'], ENT_QUOTES, 'UTF-8'));
$words = explode(' ', $params['s']);
foreach($words AS &$word)
if(Tools::strlen($word) > $params['n'])
$word = Tools::substr(trim(chunk_split($word, $params['n']-1, '- ')), 0, -1);
return implode(' ', Tools::htmlentitiesUTF8($words));
}
function smartyTruncate($params, &$smarty)
{
Tools::displayAsDeprecated();
$text = isset($params['strip']) ? strip_tags($params['text']) : $params['text'];
$length = $params['length'];
$sep = isset($params['sep']) ? $params['sep'] : '...';
if (Tools::strlen($text) > $length + Tools::strlen($sep))
$text = Tools::substr($text, 0, $length).$sep;
return (isset($params['encode']) ? Tools::htmlentitiesUTF8($text, ENT_NOQUOTES) : $text);
}
function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false, $charset = 'UTF-8')
{
if (!$length)
return '';
if (Tools::strlen($string) > $length)
{
$length -= min($length, Tools::strlen($etc));
if (!$break_words && !$middle)
$string = preg_replace('/\s+?(\S+)?$/u', '', Tools::substr($string, 0, $length+1, $charset));
return !$middle ? Tools::substr($string, 0, $length, $charset).$etc : Tools::substr($string, 0, $length/2, $charset).$etc.Tools::substr($string, -$length/2, $charset);
}
else
return $string;
}
function smartyMinifyHTML($tpl_output, &$smarty)
{
$tpl_output = Tools::minifyHTML($tpl_output);
return $tpl_output;
}
function smartyPackJSinHTML($tpl_output, &$smarty)
{
$tpl_output = Tools::packJSinHTML($tpl_output);
return $tpl_output;
}
function smartyRegisterFunction($smarty, $type, $function, $params)
{
if (!in_array($type, array('function', 'modifier')))
return false;
$smarty->registerPlugin($type, $function, $params);
}
+105
View File
@@ -0,0 +1,105 @@
function getPush()
{
$.post("ajax.php",{"getNotifications" : "1"}, function(data) {
if (data)
{
json = jQuery.parseJSON(data);
// Add orders notifications to the list
html = "";
nb_notifs = 0;
$.each(json.order, function(property, value) {
html += "<li>" + new_order_msg + "<br />" + order_number_msg + "<strong>#" + parseInt(value.id_order) + "</strong><br />" + total_msg + "<strong>" + value.total_paid_real + "</strong><br />" + from_msg + "<strong>" + value.customer_name + "</strong><br /><a href=\"index.php?tab=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'&vieworder&id_order=" + parseInt(value.id_order) + "\">" + see_order_msg + "</a></li>";
});
if (html != "")
{
$("#list_orders_notif").prev("p").hide();
$("#list_orders_notif").empty().append(html);
nb_notifs = $("#list_orders_notif li").length;
$("#orders_notif_value").text(nb_notifs);
$("#orders_notif_number_wrapper").show();
}
else
{
$("#orders_notif_number_wrapper").hide();
}
// Add customers notifications to the list
html = "";
nb_notifs = 0;
$.each(json.customer, function(property, value) {
html += "<li>" + new_customer_msg + "<br />" + customer_name_msg + "<strong>" + value.customer_name + "</strong><br /><a href=\"index.php?tab=AdminCustomers&token='.Tools::getAdminTokenLite('AdminCustomers').'&viewcustomer&id_customer=" + parseInt(value.id_customer) + "\">" + see_customer_msg + "</a></li>";
});
if (html != "")
{
$("#list_customers_notif").prev("p").hide();
$("#list_customers_notif").empty().append(html);
nb_notifs = $("#list_customers_notif li").length;
$("#customers_notif_value").text(nb_notifs);
$("#customers_notif_number_wrapper").show();
}
else
{
$("#customers_notif_number_wrapper").hide();
}
// Add messages notifications to the list
html = "";
nb_notifs = 0;
$.each(json.message, function(property, value) {
html += "<li>" + new_msg + "<br />" + from_msg + "<strong>" + value.customer_name + "</strong><br />" + excerpt_msg + "<strong>" + value.message_customer + "</strong><br /><a href=\"index.php?tab=AdminOrders&token='.Tools::getAdminTokenLite('AdminOrders').'&vieworder&id_order=" + parseInt(value.id_order) + "\">" + see_msg + "</a></li>";
});
if (html != "")
{
$("#list_messages_notif").prev("p").hide();
$("#list_messages_notif").empty().append(html);
nb_notifs = $("#list_messages_notif li").length;
$("#messages_notif_value").text(nb_notifs);
$("#messages_notif_number_wrapper").show();
}
else
{
$("#messages_notif_number_wrapper").hide();
}
}
setTimeout("getPush()",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();
});