diff --git a/cattemplateswitcher/cattemplateswitcher.page.list.main.php b/cattemplateswitcher/cattemplateswitcher.page.list.main.php index 858f31d..4eaab04 100644 --- a/cattemplateswitcher/cattemplateswitcher.page.list.main.php +++ b/cattemplateswitcher/cattemplateswitcher.page.list.main.php @@ -7,22 +7,30 @@ ==================== */ defined('COT_CODE') or die('Wrong URL'); -$tpl_arr = array('page', 'list'); +require_once cot_langfile('cattemplateswitcher', 'plug'); $mode = cot_import('mode', 'R', 'ALP'); -require_once cot_langfile('cattemplateswitcher', 'plug'); + +$tpl_arr = array('page', 'list'); $modes = explode(',', $cfg['plugin']['cattemplateswitcher']['mode']); -if (!empty($mode) && in_array($mode, $modes) && $mode != 'default') $_SESSION[$c]['cat_tpl_mode'] = $mode; -elseif($mode == 'default') unset($_SESSION[$c]['cat_tpl_mode']); -if (isset($_SESSION[$c]['cat_tpl_mode']) && !empty($_SESSION[$c]['cat_tpl_mode'])) +if ($cfg['plugin']['cattemplateswitcher']['global_save']) $saved_mode = &$_SESSION[$c]['cat_tpl_mode']; +else $saved_mode = &$_SESSION['cat_tpl_mode']; + +if (!empty($mode) && in_array($mode, $modes) && $mode != 'default') $saved_mode = $mode; +elseif($mode == 'default') { - $mode = $_SESSION[$c]['cat_tpl_mode']; + if ($cfg['plugin']['cattemplateswitcher']['global_save']) unset($_SESSION[$c]['cat_tpl_mode']); + else unset($_SESSION['cat_tpl_mode']); + unset($saved_mode); +} + +if (isset($saved_mode) && !empty($saved_mode)) +{ + $mode = $saved_mode; $tpl_arr[] = $mode; } else $mode = 'default'; if (!empty($cat['tpl'])) $tpl_arr[] = $cat['tpl']; -$mskin = cot_tplfile($tpl_arr); - -?> \ No newline at end of file +$mskin = cot_tplfile($tpl_arr); \ No newline at end of file diff --git a/cattemplateswitcher/cattemplateswitcher.setup.php b/cattemplateswitcher/cattemplateswitcher.setup.php index 6247e94..f462742 100644 --- a/cattemplateswitcher/cattemplateswitcher.setup.php +++ b/cattemplateswitcher/cattemplateswitcher.setup.php @@ -5,12 +5,11 @@ Name=Category template switcher Category=navigation-structure Description=Adds visitors the opportunity to switch the display mode (templates) category -Version=1.0 -Date=2013-09-23 +Version=1.1 +Date=2014-04-06 Author=Dayver -Copyright=Partial copyright (c) Dayver 2013 +Copyright=Partial copyright (c) Dayver 2013-2014 Notes=BSD License -SQL= Auth_guests=R Lock_guests=W12345A Auth_members=R @@ -20,9 +19,7 @@ [BEGIN_COT_EXT_CONFIG] mode=01:string::default,table,line:Mode codes, comma separated +global_save=02:radio::0:Save switched mode for any cat or for all [END_COT_EXT_CONFIG] ==================== */ -defined('COT_CODE') or die('Wrong URL'); - - -?> \ No newline at end of file +defined('COT_CODE') or die('Wrong URL'); \ No newline at end of file diff --git a/cattemplateswitcher/lang/cattemplateswitcher.en.lang.php b/cattemplateswitcher/lang/cattemplateswitcher.en.lang.php index 46f3d11..7b177dd 100644 --- a/cattemplateswitcher/lang/cattemplateswitcher.en.lang.php +++ b/cattemplateswitcher/lang/cattemplateswitcher.en.lang.php @@ -12,6 +12,7 @@ */ $L['cfg_mode'] = array('Mode codes', 'comma separated'); +$L['cfg_global_save'] = array('Save switched mode for any cat or for all', ''); /** * Plugin Admin @@ -25,4 +26,4 @@ $L['plug_cattemplateswitcher_mode']['line'] = 'linear'; $L['plug_cattemplateswitcher_mode']['table'] = 'Table'; -$L['plug_cattemplateswitcher_mode']['default'] = 'Default'; +$L['plug_cattemplateswitcher_mode']['default'] = 'Default'; \ No newline at end of file diff --git a/cattemplateswitcher/lang/cattemplateswitcher.ru.lang.php b/cattemplateswitcher/lang/cattemplateswitcher.ru.lang.php index 6dc6c91..932dc52 100644 --- a/cattemplateswitcher/lang/cattemplateswitcher.ru.lang.php +++ b/cattemplateswitcher/lang/cattemplateswitcher.ru.lang.php @@ -1,28 +1,29 @@ -