Browse files

Update Admin template to remove PHP code and use template tags

  • Loading branch information...
1 parent 87d7b08 commit 93b73f04e70ed5bff1ec0f6df28d32297a91e5b3 @haraldpdl committed Mar 2, 2012
View
93 osCommerce/OM/Core/Site/Admin/Controller.php
@@ -10,6 +10,7 @@
use osCommerce\OM\Core\Access;
use osCommerce\OM\Core\Cache;
+ use osCommerce\OM\Core\HTML;
use osCommerce\OM\Core\PDO;
use osCommerce\OM\Core\OSCOM;
use osCommerce\OM\Core\Registry;
@@ -49,6 +50,98 @@ public static function initialize() {
$OSCOM_Template = Registry::get('Template');
$OSCOM_Template->setApplication(Registry::get('Application'));
+ $OSCOM_Template->setValue('html_text_direction', Registry::get('Language')->getTextDirection());
+ $OSCOM_Template->setValue('html_lang', OSCOM::getDef('html_lang_code')); // HPDL A better solution is to define the ISO 639-1 value at the language level
+ $OSCOM_Template->setValue('html_character_set', Registry::get('Language')->getCharacterSet());
+ $OSCOM_Template->setValue('html_page_title', 'OSCOMMERCE' . ($OSCOM_Template->hasPageTitle() ? ': ' . $OSCOM_Template->getPageTitle() : ''));
+ $OSCOM_Template->setValue('default_site_application', OSCOM::getDefaultSiteApplication());
+ $OSCOM_Template->setValue('current_site_application', OSCOM::getSiteApplication());
+ $OSCOM_Template->setValue('batch_size', MAX_DISPLAY_SEARCH_RESULTS);
+ $OSCOM_Template->setValue('tax_decimal_places', TAX_DECIMAL_PLACES);
+ $OSCOM_Template->setValue('content_page_file', $OSCOM_Template->getPageContentsFile());
+ $OSCOM_Template->setValue('template_header_file', $OSCOM_Template->getTemplateFile('header.php'));
+ $OSCOM_Template->setValue('template_footer_file', $OSCOM_Template->getTemplateFile('footer.php'));
+ $OSCOM_Template->setValue('template_has_header', $OSCOM_Template->hasPageHeader());
+ $OSCOM_Template->setValue('template_has_footer', $OSCOM_Template->hasPageFooter());
+ $OSCOM_Template->setValue('oscom_version', OSCOM::getVersion());
+ $OSCOM_Template->setValue('logged_in', isset($_SESSION[OSCOM::getSite()]['id']));
+
+ $apps_links = '';
+
+ if ( isset($_SESSION[OSCOM::getSite()]['id']) ) {
+ $apps_links .= '<ul>';
+
+ foreach ( Access::getLevels() as $group => $links ) {
+ $application = current($links);
+
+ $apps_links .= ' <li><a href="' . OSCOM::getLink(null, $application['module']) . '"><span style="float: right;">&#9656;</span>' . Access::getGroupTitle($group) . '</a>' .
+ ' <ul>';
+
+ foreach ( $links as $link ) {
+ $apps_links .= ' <li><a href="' . OSCOM::getLink(null, $link['module']) . '">' . $OSCOM_Template->getIcon(16, $link['icon']) . '&nbsp;' . $link['title'] . '</a></li>';
+ }
+
+ $apps_links .= ' </ul>' .
+ ' </li>';
+ }
+
+ $apps_links .= '</ul>';
+ }
+
+ $OSCOM_Template->setValue('apps_links', $apps_links);
+
+ $total_shortcuts = 0;
+ $shortcut_links = '';
+
+ if ( isset($_SESSION[OSCOM::getSite()]['id']) ) {
+ $shortcut_links .= '<ul class="apps" style="float: right;">';
+
+ if ( Registry::get('Application')->canLinkTo() ) {
+ if ( Access::isShortcut(OSCOM::getSiteApplication()) ) {
+ $shortcut_links .= ' <li class="shortcuts">' . HTML::link(OSCOM::getLink(null, 'Dashboard', 'RemoveShortcut&shortcut=' . OSCOM::getSiteApplication()), HTML::icon('shortcut_remove.png')) . '</li>';
+ } else {
+ $shortcut_links .= ' <li class="shortcuts">' . HTML::link(OSCOM::getLink(null, 'Dashboard', 'AddShortcut&shortcut=' . OSCOM::getSiteApplication()), HTML::icon('shortcut_add.png')) . '</li>';
+ }
+ }
+
+ if ( Access::hasShortcut() ) {
+ $shortcut_links .= ' <li class="shortcuts">';
+
+ foreach ( Access::getShortcuts() as $shortcut ) {
+ $shortcut_links .= '<a href="' . OSCOM::getLink(null, $shortcut['module']) . '" id="shortcut-' . $shortcut['module'] . '">' . $OSCOM_Template->getIcon(16, $shortcut['icon'], $shortcut['title']) . '<div class="notBubble"></div></a>';
+
+ $total_shortcuts++;
+ }
+
+ $shortcut_links .= ' </li>';
+ }
+
+ $shortcut_links .= ' <li><a href="#">' . HTML::outputProtected($_SESSION[OSCOM::getSite()]['username']) . ' &#9662;</a>' .
+ ' <ul>' .
+ ' <li><a href="' . OSCOM::getLink(null, 'Login', 'Logoff') . '">' . OSCOM::getDef('header_title_logoff') . '</a></li>' .
+ ' </ul>' .
+ ' </li>' .
+ '</ul>';
+ }
+
+ $OSCOM_Template->setValue('total_shortcuts', $total_shortcuts);
+ $OSCOM_Template->setValue('shortcut_links', $shortcut_links);
+
+ $ms_pinned_sites = '';
+
+ if ( Access::hasShortcut() ) {
+ $ms_pinned_sites .= 'window.external.msSiteModeClearJumplist();' . "\n" .
+ 'window.external.msSiteModeCreateJumplist("Shortcuts");' . "\n";
+
+ foreach ( Access::getShortcuts() as $shortcut ) {
+ $ms_pinned_sites .= 'window.external.msSiteModeAddJumpListItem("' . $shortcut['title'] . '", "' . OSCOM::getLink(null, $shortcut['module']) . '", "", "self");' . "\n";
+ }
+
+ $ms_pinned_sites .= 'window.external.msSiteModeShowJumplist();' . "\n";
+ }
+
+ $OSCOM_Template->setValue('ms_pinned_sites', $ms_pinned_sites);
+
// HPDL move following checks elsewhere
// check if a default currency is set
if (!defined('DEFAULT_CURRENCY')) {
View
4 osCommerce/OM/Core/Site/Admin/languages/en_US.php
@@ -1,8 +1,10 @@
# osCommerce Online Merchant
#
-# @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
+# @copyright Copyright (c) 2012 osCommerce; http://www.oscommerce.com
# @license BSD License; http://www.oscommerce.com/bsdlicense.txt
+html_lang_code = en
+
administration_title = osCommerce Administration Tool
header_title_help = Help
View
128 osCommerce/OM/Core/Site/Admin/templates/oscom.php
@@ -1,128 +1,94 @@
-<?php
-/**
- * osCommerce Online Merchant
- *
- * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
- * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
- */
-
- use osCommerce\OM\Core\Access;
- use osCommerce\OM\Core\HTML;
- use osCommerce\OM\Core\OSCOM;
- use osCommerce\OM\Core\Registry;
-?>
-
<!doctype html>
-<html dir="<?php echo $OSCOM_Language->getTextDirection(); ?>" lang="<?php echo $OSCOM_Language->getCode(); ?>">
+<html dir="{value}html_text_direction{value}" lang="{value}html_lang{value}">
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $OSCOM_Language->getCharacterSet(); ?>" />
+<meta http-equiv="Content-Type" content="text/html; charset={value}html_character_set{value}" />
-<title><?php echo STORE_NAME . ': ' . OSCOM::getDef('administration_title') . ($OSCOM_Template->hasPageTitle() ? ': ' . $OSCOM_Template->getPageTitle() : ''); ?></title>
+<title>{value}html_page_title{value}</title>
-<link rel="icon" type="image/png" href="<?php echo OSCOM::getPublicSiteLink('images/oscommerce_icon.png'); ?>" />
+<link rel="icon" type="image/png" href="{publiclink}images/oscommerce_icon.png{publiclink}" />
-<meta name="generator" value="osCommerce Online Merchant" />
+<meta name="generator" content="osCommerce Online Merchant" />
<meta name="robots" content="noindex,nofollow" />
-<script type="text/javascript" src="public/external/jquery/jquery-1.7.1.min.js"></script>
-<script type="text/javascript" src="public/external/jquery/jquery.cookie.js"></script>
-<script type="text/javascript" src="public/external/jquery/jquery.json-2.2.min.js"></script>
-<script type="text/javascript" src="public/external/jquery/jquery.tinysort.min.js"></script>
-<script type="text/javascript" src="public/external/jquery/jquery.ocupload-1.1.2.packed.js"></script>
-<script type="text/javascript" src="public/external/jquery/jquery.hoverIntent.minified.js"></script>
-<script type="text/javascript" src="public/external/jquery/jquery.placeholder.min.js"></script>
-<script type="text/javascript" src="public/external/jquery/jquery.droppy.js"></script>
-<script type="text/javascript" src="public/external/jquery/jquery.blockUI.js"></script>
-<script type="text/javascript" src="public/external/jquery/jquery.md5.js"></script>
-
-<script type="text/javascript" src="public/external/jquery/tipsy/jquery.tipsy.js"></script>
+<script src="public/external/jquery/jquery-1.7.1.min.js"></script>
+<script src="public/external/jquery/jquery.cookie.js"></script>
+<script src="public/external/jquery/jquery.json-2.2.min.js"></script>
+<script src="public/external/jquery/jquery.tinysort.min.js"></script>
+<script src="public/external/jquery/jquery.ocupload-1.1.2.packed.js"></script>
+<script src="public/external/jquery/jquery.hoverIntent.minified.js"></script>
+<script src="public/external/jquery/jquery.placeholder.min.js"></script>
+<script src="public/external/jquery/jquery.droppy.js"></script>
+<script src="public/external/jquery/jquery.blockUI.js"></script>
+<script src="public/external/jquery/jquery.md5.js"></script>
+
+<script src="public/external/jquery/tipsy/jquery.tipsy.js"></script>
<link rel="stylesheet" type="text/css" href="public/external/jquery/tipsy/tipsy.css" />
<script src="public/external/jquery/jquery.netchanger.min.js"></script>
<script src="public/external/jquery/jquery.safetynet.js"></script>
-<script src="public/sites/Admin/javascript/jquery/jquery.buttonsetTabs.js"></script>
-<script src="public/sites/Admin/javascript/jquery/jquery.equalResize.js"></script>
-<script src="public/sites/Admin/javascript/jquery/jquery.imageSelector.js"></script>
+<script src="{publiclink}javascript/jquery/jquery.buttonsetTabs.js{publiclink}"></script>
+<script src="{publiclink}javascript/jquery/jquery.equalResize.js{publiclink}"></script>
+<script src="{publiclink}javascript/jquery/jquery.imageSelector.js{publiclink}"></script>
<link rel="stylesheet" type="text/css" href="public/external/fileuploader/fileuploader.css" />
<script src="public/external/fileuploader/fileuploader.min.js"></script>
<link rel="stylesheet" type="text/css" href="public/external/jquery/ui/themes/smoothness/jquery-ui-1.8.17.custom.css" />
-<script type="text/javascript" src="public/external/jquery/ui/jquery-ui-1.8.17.custom.min.js"></script>
+<script src="public/external/jquery/ui/jquery-ui-1.8.17.custom.min.js"></script>
-<script type="text/javascript" src="public/external/alexei/sprintf.js"></script>
+<script src="public/external/alexei/sprintf.js"></script>
-<script type="text/javascript" src="<?php echo OSCOM::getPublicSiteLink('javascript/general.js'); ?>"></script>
-<script type="text/javascript" src="<?php echo OSCOM::getPublicSiteLink('javascript/datatable.js'); ?>"></script>
+<script src="{publiclink}javascript/general.js{publiclink}"></script>
+<script src="{publiclink}javascript/datatable.js{publiclink}"></script>
-<link rel="stylesheet" type="text/css" href="<?php echo OSCOM::getPublicSiteLink('templates/oscom/stylesheets/general.css'); ?>" />
+<link rel="stylesheet" type="text/css" href="{publiclink}templates/oscom/stylesheets/general.css{publiclink}" />
-<script type="text/javascript">
- var pageURL = '<?php echo OSCOM::getLink(); ?>';
- var pageModule = '<?php echo OSCOM::getSiteApplication(); ?>';
+<script>
+ var pageURL = '{link}{link}';
+ var pageModule = '{value}current_site_application{value}';
- var batchSize = parseInt('<?php echo MAX_DISPLAY_SEARCH_RESULTS; ?>');
- var batchTotalPagesText = '<?php echo addslashes(OSCOM::getDef('batch_results_number_of_entries')); ?>';
- var batchCurrentPageset = '<?php echo addslashes(OSCOM::getDef('result_set_current_page')); ?>';
- var batchIconNavigationBack = '<?php echo HTML::icon('nav_back.png'); ?>';
- var batchIconNavigationBackGrey = '<?php echo HTML::icon('nav_back_grey.png'); ?>';
- var batchIconNavigationForward = '<?php echo HTML::icon('nav_forward.png'); ?>';
- var batchIconNavigationForwardGrey = '<?php echo HTML::icon('nav_forward_grey.png'); ?>';
- var batchIconNavigationReload = '<?php echo HTML::icon('reload.png'); ?>';
- var batchIconProgress = '<?php echo HTML::icon('progress_ani.gif'); ?>';
+ var batchSize = parseInt('{value}batch_size{value}');
+ var batchTotalPagesText = '{lang addslashes}batch_results_number_of_entries{lang}';
+ var batchCurrentPageset = '{lang addslashes}result_set_current_page{lang}';
+ var batchIconNavigationBack = '{icon}nav_back.png{icon}';
+ var batchIconNavigationBackGrey = '{icon}nav_back_grey.png{icon}';
+ var batchIconNavigationForward = '{icon}nav_forward.png{icon}';
+ var batchIconNavigationForwardGrey = '{icon}nav_forward_grey.png{icon}';
+ var batchIconNavigationReload = '{icon}reload.png{icon}';
+ var batchIconProgress = '{icon}progress_ani.gif{icon}';
- var taxDecimalPlaces = parseInt('<?php echo TAX_DECIMAL_PLACES; ?>');
+ var taxDecimalPlaces = parseInt('{value}tax_decimal_places{value}');
</script>
<meta name="application-name" content="osCommerce Dashboard" />
<meta name="msapplication-tooltip" content="osCommerce Administration Dashboard" />
<meta name="msapplication-window" content="width=1024;height=768" />
<meta name="msapplication-navbutton-color" content="#ff7900" />
-<meta name="msapplication-starturl" content="<?php echo OSCOM::getLink(null, OSCOM::getDefaultSiteApplication(), null, 'SSL', false); ?>" />
+<meta name="msapplication-starturl" content="{link}{value}default_site_application{value}{link}" />
</head>
<body>
-<?php
- if ( $OSCOM_Template->hasPageHeader() ) {
- include($OSCOM_Template->getTemplateFile('header.php'));
- }
-?>
+{iftrue template_has_header}
+ {import}{value}template_header_file{value}{import}
+{iftrue}
<div id="appContent">
+ {widget}message_stack|header{widget}
-<?php
- if ( Registry::get('MessageStack')->exists('header') ) {
- echo Registry::get('MessageStack')->get('header');
- }
-
-// HPDL use only file_get_contents() when content pages no longer contain PHP
- $page_contents_file = $OSCOM_Template->getPageContentsFile();
- if ( substr($page_contents_file, strrpos($page_contents_file, '.')+1) == 'html' ) {
- echo file_get_contents($OSCOM_Template->getPageContentsFile());
- } else {
- include($OSCOM_Template->getPageContentsFile());
- }
-?>
-
+ {import}{value}content_page_file{value}{import}
</div>
-<?php
- if ( $OSCOM_Template->hasPageFooter() ) {
-?>
-
+{iftrue template_has_footer}
<div id="footer">
- <?php include($OSCOM_Template->getTemplateFile('footer.php')); ?>
+ {import}{value}template_footer_file{value}{import}
</div>
-
-<?php
- }
-?>
+{iftrue}
</body>
View
15 osCommerce/OM/Core/Site/Admin/templates/oscom/footer.php
@@ -1,14 +1,3 @@
-<?php
-/**
- * osCommerce Online Merchant
- *
- * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
- * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
- */
+<p align="center">osCommerce Online Merchant Copyright &copy; 2000-2012 <a href="http://www.oscommerce.com" target="_blank">osCommerce</a> (<a href="http://www.oscommerce.com/about/copyright" target="_blank">Copyright Policy</a>, <a href="http://www.oscommerce.com/about/trademark" target="_blank">Trademark Policy</a>)<br />osCommerce is a registered trademark of Harald Ponce de Leon</p>
- use osCommerce\OM\Core\OSCOM;
-?>
-
-<p align="center">osCommerce Online Merchant Copyright &copy; 2000-2011 <a href="http://www.oscommerce.com" target="_blank">osCommerce</a> (<a href="http://www.oscommerce.com/about/copyright" target="_blank">Copyright Policy</a>, <a href="http://www.oscommerce.com/about/trademark" target="_blank">Trademark Policy</a>)<br />osCommerce is a registered trademark of Harald Ponce de Leon</p>
-
-<div style="text-align: center; padding: 5px;"><span class="poweredByButton"><a href="http://www.oscommerce.com" target="_blank"><span class="poweredBy">Powered By</span><span class="osCommerce"><?php echo 'osCommerce Online Merchant v' . OSCOM::getVersion(); ?></span></a></span></div>
+<div style="text-align: center; padding: 5px;"><span class="poweredByButton"><a href="http://www.oscommerce.com" target="_blank"><span class="poweredBy">Powered By</span><span class="osCommerce">osCommerce Online Merchant v{value}oscom_version{value}</span></a></span></div>
View
221 osCommerce/OM/Core/Site/Admin/templates/oscom/header.php
@@ -1,171 +1,90 @@
-<?php
-/**
- * osCommerce Online Merchant
- *
- * @copyright Copyright (c) 2011 osCommerce; http://www.oscommerce.com
- * @license BSD License; http://www.oscommerce.com/bsdlicense.txt
- */
-
- use osCommerce\OM\Core\Access;
- use osCommerce\OM\Core\HTML;
- use osCommerce\OM\Core\OSCOM;
-?>
-
<div id="adminMenu">
<ul class="apps">
- <li class="shortcuts"><?php echo HTML::link(OSCOM::getLink(null, OSCOM::getDefaultSiteApplication()), HTML::image(OSCOM::getPublicSiteLink('images/oscommerce_icon.png'), null, 16, 16)); ?></li>
-
-<?php
- if ( isset($_SESSION[OSCOM::getSite()]['id']) ) {
- echo ' <li><a href="#">Applications &#9662;</a>' .
- ' <ul>';
-
- foreach ( Access::getLevels() as $group => $links ) {
- $application = current($links);
-
- echo ' <li><a href="' . OSCOM::getLink(null, $application['module']) . '"><span style="float: right;">&#9656;</span>' . Access::getGroupTitle($group) . '</a>' .
- ' <ul>';
-
- foreach ( $links as $link ) {
- echo ' <li><a href="' . OSCOM::getLink(null, $link['module']) . '">' . $OSCOM_Template->getIcon(16, $link['icon']) . '&nbsp;' . $link['title'] . '</a></li>';
- }
-
- echo ' </ul>' .
- ' </li>';
- }
-
- echo ' </ul>' .
- ' </li>';
- }
-
- echo ' <li><a href="' . OSCOM::getLink('Shop', 'Index', null, 'NONSSL', false) . '" target="_blank">' . OSCOM::getDef('header_title_online_catalog') . '</a></li>' .
- ' <li><a href="http://www.oscommerce.com" target="_blank">' . OSCOM::getDef('header_title_help') . ' &#9662;</a>' .
- ' <ul>' .
- ' <li><a href="http://www.oscommerce.com" target="_blank">osCommerce Support Site</a></li>' .
- ' <li><a href="http://www.oscommerce.info" target="_blank">Online Documentation</a></li>' .
- ' <li><a href="http://forums.oscommerce.com" target="_blank">Community Support Forums</a></li>' .
- ' <li><a href="http://addons.oscommerce.com" target="_blank">Add-Ons Site</a></li>' .
- ' <li><a href="http://forums.oscommerce.com/tracker/project-4-oscommerce-online-merchant-v3x/" target="_blank">Bug Reporter</a></li>' .
- ' </ul>' .
- ' </li>';
-?>
-
+ <li class="shortcuts"><a href="{link}{value}default_site_application{value}{link}"><img src="{publiclink}images/oscommerce_icon.png{publiclink}" /></a></li>
+
+{iftrue logged_in}
+ <li><a href="#">Applications &#9662;</a>
+ {value}apps_links{value}
+ </li>
+{iftrue}
+
+ <li><a href="{link}|Shop{link}" target="_blank">{lang}header_title_online_catalog{lang}</a></li>
+ <li><a href="http://www.oscommerce.com" target="_blank">{lang}header_title_help{lang} &#9662;</a>
+ <ul>
+ <li><a href="http://www.oscommerce.com" target="_blank">osCommerce Website</a></li>
+ <li><a href="http://www.oscommerce.info" target="_blank">Online Documentation</a></li>
+ <li><a href="http://forums.oscommerce.com" target="_blank">Community Forums</a></li>
+ <li><a href="http://www.oscommerce.com/index.php?Services" target="_blank">Support Services</a></li>
+ <li><a href="http://addons.oscommerce.com" target="_blank">Add-Ons</a></li>
+ <li><a href="http://forums.oscommerce.com/tracker/project-4-oscommerce-online-merchant-v3x/" target="_blank">Bug Reporter</a></li>
+ </ul>
+ </li>
</ul>
-<?php
- $total_shortcuts = 0;
-
- if ( isset($_SESSION[OSCOM::getSite()]['id']) ) {
- echo '<ul class="apps" style="float: right;">';
-
- if ( $OSCOM_Application->canLinkTo() ) {
- if ( Access::isShortcut(OSCOM::getSiteApplication()) ) {
- echo ' <li class="shortcuts">' . HTML::link(OSCOM::getLink(null, 'Dashboard', 'RemoveShortcut&shortcut=' . OSCOM::getSiteApplication()), HTML::icon('shortcut_remove.png')) . '</li>';
- } else {
- echo ' <li class="shortcuts">' . HTML::link(OSCOM::getLink(null, 'Dashboard', 'AddShortcut&shortcut=' . OSCOM::getSiteApplication()), HTML::icon('shortcut_add.png')) . '</li>';
- }
- }
-
- if ( Access::hasShortcut() ) {
- echo ' <li class="shortcuts">';
-
- foreach ( Access::getShortcuts() as $shortcut ) {
- echo '<a href="' . OSCOM::getLink(null, $shortcut['module']) . '" id="shortcut-' . $shortcut['module'] . '">' . $OSCOM_Template->getIcon(16, $shortcut['icon'], $shortcut['title']) . '<div class="notBubble"></div></a>';
-
- $total_shortcuts++;
- }
-
- echo ' </li>';
- }
-
- echo ' <li><a href="#">' . HTML::outputProtected($_SESSION[OSCOM::getSite()]['username']) . ' &#9662;</a>' .
- ' <ul>' .
- ' <li><a href="' . OSCOM::getLink(null, 'Login', 'Logoff') . '">' . OSCOM::getDef('header_title_logoff') . '</a></li>' .
- ' </ul>' .
- ' </li>' .
- '</ul>';
- }
-?>
+{iftrue logged_in}
+ {value}shortcut_links{value}
+{iftrue}
</div>
-<script type="text/javascript">
- $('#adminMenu .apps').droppy({speed: 0});
- $('#adminMenu .apps li img').tipsy();
+<script>
+$('#adminMenu .apps').droppy({speed: 0});
+$('#adminMenu .apps li img').tipsy();
</script>
-<?php
- if ( isset($_SESSION[OSCOM::getSite()]['id']) ) {
-?>
-
-<script type="text/javascript">
- var totalShortcuts = <?php echo $total_shortcuts; ?>;
- var wkn = new Object;
-
- if ( $.cookie('wkn') ) {
- wkn = $.secureEvalJSON($.cookie('wkn'));
- }
-
- function updateShortcutNotifications(resetApplication) {
- $.getJSON('<?php echo OSCOM::getRPCLink('Admin', 'Dashboard', 'GetShortcutNotifications&reset=RESETAPP'); ?>'.replace('RESETAPP', resetApplication), function (data) {
- $.each(data, function(key, val) {
- if ( $('#shortcut-' + key + ' .notBubble').html != val ) {
- if ( val > 0 || val.length > 0 ) {
- $('#shortcut-' + key + ' .notBubble').html(val).show();
-
- if ( (typeof webkitNotifications != 'undefined') && (webkitNotifications.checkPermission() == 0) ) {
- if ( typeof wkn[key] == 'undefined' ) {
- wkn[key] = new Object;
- }
+{iftrue logged_in}
+<script>
+var totalShortcuts = {value}total_shortcuts{value};
+var wkn = new Object;
+
+if ( $.cookie('wkn') ) {
+ wkn = $.secureEvalJSON($.cookie('wkn'));
+}
+
+function updateShortcutNotifications(resetApplication) {
+ $.getJSON('{rpclink}GetShortcutNotifications&reset=RESETAPP|Dashboard|Admin{rpclink}'.replace('RESETAPP', resetApplication), function (data) {
+ $.each(data, function(key, val) {
+ if ( $('#shortcut-' + key + ' .notBubble').html != val ) {
+ if ( val > 0 || val.length > 0 ) {
+ $('#shortcut-' + key + ' .notBubble').html(val).show();
+
+ if ( (typeof webkitNotifications != 'undefined') && (webkitNotifications.checkPermission() == 0) ) {
+ if ( typeof wkn[key] == 'undefined' ) {
+ wkn[key] = new Object;
+ }
- if ( wkn[key].value != val ) {
- wkn[key].value = val;
- wkn[key].n = webkitNotifications.createNotification('<?php echo OSCOM::getPublicSiteLink('images/applications/32/APPICON.png'); ?>'.replace('APPICON', key), key, val);
- wkn[key].n.replaceId = key;
- wkn[key].n.ondisplay = function(event) {
- setTimeout(function() {
- event.currentTarget.cancel();
- }, 5000);
- };
- wkn[key].n.show();
- }
+ if ( wkn[key].value != val ) {
+ wkn[key].value = val;
+ wkn[key].n = webkitNotifications.createNotification('{publiclink}images/applications/32/APPICON.png{publiclink}'.replace('APPICON', key), key, val);
+ wkn[key].n.replaceId = key;
+ wkn[key].n.ondisplay = function(event) {
+ setTimeout(function() {
+ event.currentTarget.cancel();
+ }, 5000);
+ };
+ wkn[key].n.show();
}
- } else {
- $('#shortcut-' + key + ' .notBubble').hide();
}
+ } else {
+ $('#shortcut-' + key + ' .notBubble').hide();
}
- });
-
- $.cookie('wkn', $.toJSON(wkn));
+ }
});
- }
-
- $(document).ready(function() {
- if ( totalShortcuts > 0 ) {
- updateShortcutNotifications(typeof resetShortcutNotification != 'undefined' ? '<?php echo OSCOM::getSiteApplication(); ?>' : null);
- setInterval('updateShortcutNotifications()', 10000);
- }
+ $.cookie('wkn', $.toJSON(wkn));
});
+}
- if ( (typeof window.external.msAddSiteMode != 'undefined') && window.external.msIsSiteMode() ) {
-
-<?php
- if ( Access::hasShortcut() ) {
- echo ' window.external.msSiteModeClearJumplist();' . "\n" .
- ' window.external.msSiteModeCreateJumplist("Shortcuts");' . "\n";
-
- foreach ( Access::getShortcuts() as $shortcut ) {
- echo ' window.external.msSiteModeAddJumpListItem("' . $shortcut['title'] . '", "' . OSCOM::getLink(null, $shortcut['module']) . '", "", "self");' . "\n";
- }
-
- echo ' window.external.msSiteModeShowJumplist();' . "\n";
- }
-?>
+$(function() {
+ if ( totalShortcuts > 0 ) {
+ updateShortcutNotifications(typeof resetShortcutNotification != 'undefined' ? '{value}current_site_application{value}' : null);
+ setInterval('updateShortcutNotifications()', 10000);
}
-</script>
+});
-<?php
- }
-?>
+if ( (typeof window.external.msAddSiteMode != 'undefined') && window.external.msIsSiteMode() ) {
+ {value}ms_pinned_sites{value}
+}
+</script>
+{iftrue}

0 comments on commit 93b73f0

Please sign in to comment.