From 987f2d8c625b4f32400f66be0f6e43739d3660dd Mon Sep 17 00:00:00 2001 From: "Dro1d.Ru" Date: Wed, 15 Nov 2017 21:02:47 +0500 Subject: [PATCH] minor fixes --- assets/js/dash/modules.js | 12 +- assets/js/designer/editor.js | 49 ++++---- designer/controllers/dash.php | 13 ++ designer/designer.php | 1 + languages/ru/dash.js.php | 3 +- themes/default/designer/page.php | 208 +++++++++++++++---------------- zira/helper.php | 1 + zira/router.php | 14 ++- 8 files changed, 168 insertions(+), 133 deletions(-) diff --git a/assets/js/dash/modules.js b/assets/js/dash/modules.js index ea773cb..6d25e49 100644 --- a/assets/js/dash/modules.js +++ b/assets/js/dash/modules.js @@ -33,14 +33,22 @@ var dash_modules_close = function() { var dash_modules_activate = function() { var selected = desk_window_selected(this); if (selected && typeof(selected.items)!="undefined" && selected.items.length==1) { - desk_window_request(this, url('dash/system/module'),{'module':selected.items[0], 'active': 1}); + desk_window_request(this, url('dash/system/module'),{'module':selected.items[0], 'active': 1}, function(){ + desk_confirm(t('Page reload required. Reload now ?'), function(){ + window.location.reload(); + }); + }); } }; var dash_modules_deactivate = function() { var selected = desk_window_selected(this); if (selected && typeof(selected.items)!="undefined" && selected.items.length==1) { - desk_window_request(this, url('dash/system/module'),{'module':selected.items[0], 'active': 0}); + desk_window_request(this, url('dash/system/module'),{'module':selected.items[0], 'active': 0}, function(){ + desk_confirm(t('Page reload required. Reload now ?'), function(){ + window.location.reload(); + }); + }); } }; diff --git a/assets/js/designer/editor.js b/assets/js/designer/editor.js index 66cd267..fb4aa71 100644 --- a/assets/js/designer/editor.js +++ b/assets/js/designer/editor.js @@ -1152,6 +1152,7 @@ setColorStyle('.emoji-editable', color); setColorStyle('#main-container .input-group-addon', color); setColorStyle('#main-container .input-group-addon a', color); + setColorStyle('.jumbotron', hexColor(color)); }); // forms background @@ -1402,7 +1403,7 @@ } // container - if ($('.container').length>0) { + if (typeof(designer_style_is_main)!="undefined" && designer_style_is_main && $('.container').length>0) { if (!isWideContainer()) { $('body').append(''); } else { @@ -1436,7 +1437,7 @@ } // cols - if ($('.col-sm-4').length>0) { + if (typeof(designer_style_is_main)!="undefined" && designer_style_is_main && $('.col-sm-4').length>0) { if (!isWideCols()) { $('body').append(''); } else { @@ -1472,30 +1473,32 @@ } // html - if ($('body').height() != $(window).height()) { - $('body').append(''); - } else { - $('body').append(''); - } - designer_positions['html_height'] = function() { - var html_height_x = $(window).width()-1.75*radiobtn_size; - var html_height_y = $(window).height()-3*radiobtn_size; - $('#html-designer-radio-btn').css({'left':html_height_x,'top':html_height_y}); - }; - $('#html-designer-radio-btn').tooltip(); - $('#html-designer-radio-btn').click(function(){ + if (typeof(designer_style_is_main)!="undefined" && designer_style_is_main) { if ($('body').height() != $(window).height()) { - $('html,body').css('height','100%'); - setHeightStyle('html,body','100%'); - $(this).children('.glyphicon').removeClass('glyphicon-unchecked').addClass('glyphicon-check'); - $(this).attr('title', t('Set body height = auto')).tooltip('fixTitle').tooltip('hide'); + $('body').append(''); } else { - $('html,body').css('height','auto'); - removeHeightStyle('html,body'); - $(this).children('.glyphicon').removeClass('glyphicon-check').addClass('glyphicon-unchecked'); - $(this).attr('title', t('Set body height = 100%')).tooltip('fixTitle').tooltip('hide'); + $('body').append(''); } - }); + designer_positions['html_height'] = function() { + var html_height_x = $(window).width()-1.75*radiobtn_size; + var html_height_y = $(window).height()-3*radiobtn_size; + $('#html-designer-radio-btn').css({'left':html_height_x,'top':html_height_y}); + }; + $('#html-designer-radio-btn').tooltip(); + $('#html-designer-radio-btn').click(function(){ + if ($('body').height() != $(window).height()) { + $('html,body').css('height','100%'); + setHeightStyle('html,body','100%'); + $(this).children('.glyphicon').removeClass('glyphicon-unchecked').addClass('glyphicon-check'); + $(this).attr('title', t('Set body height = auto')).tooltip('fixTitle').tooltip('hide'); + } else { + $('html,body').css('height','auto'); + removeHeightStyle('html,body'); + $(this).children('.glyphicon').removeClass('glyphicon-check').addClass('glyphicon-unchecked'); + $(this).attr('title', t('Set body height = 100%')).tooltip('fixTitle').tooltip('hide'); + } + }); + } $(designer_selectors).css('display', 'block'); $(window).trigger('resize'); diff --git a/designer/controllers/dash.php b/designer/controllers/dash.php index e79bae5..657e903 100644 --- a/designer/controllers/dash.php +++ b/designer/controllers/dash.php @@ -31,6 +31,14 @@ class Dash extends \Dash\Controller { Zira\View::setAjax(false); Zira\View::setRenderDbWidgets(false); Zira\Assets::setActive(false); + if (!$style->main) { + $link = Zira\Helper::tag_short('link', array( + 'rel' => 'stylesheet', + 'type' => 'text/css', + 'href' => Zira\Helper::url('style') + )); + Zira\View::addHtml($link, Zira\View::VAR_HEAD_BOTTOM); + } $block = new Zira\Widgets\Block(); $block->setCaching(false); @@ -69,6 +77,11 @@ class Dash extends \Dash\Controller { $css .= Zira\Helper::tag_close('style'); Zira\View::addHTML($css, Zira\View::VAR_HEAD_BOTTOM); + $script = Zira\Helper::tag_open('script', array('type'=>'text/javascript')); + $script .= 'designer_style_is_main = '.($style->main ? 'true' : 'false').';'; + $script .= Zira\Helper::tag_close('script'); + Zira\View::addHTML($script, Zira\View::VAR_HEAD_BOTTOM); + Zira\Router::setModule(DEFAULT_MODULE); Zira\Router::setController(DEFAULT_CONTROLLER); Zira\Router::setAction(DEFAULT_ACTION); diff --git a/designer/designer.php b/designer/designer.php index d5f31f8..9001e07 100644 --- a/designer/designer.php +++ b/designer/designer.php @@ -27,6 +27,7 @@ class Designer { public function beforeDispatch() { Zira\Router::addRoute('style','designer/index/index'); + Zira\Router::addAllLanguagesRoute('style'); } public function bootstrap() { diff --git a/languages/ru/dash.js.php b/languages/ru/dash.js.php index e927150..768c1dd 100644 --- a/languages/ru/dash.js.php +++ b/languages/ru/dash.js.php @@ -27,5 +27,6 @@ return array( 'Maximum files count per upload:' => 'Максимальное число файлов для загрузки:', 'Sorry, but it seems that your browser is not supported.' => 'Извините, но похоже, ваш браузер не поддерживается.', 'Author' => 'Автор', - 'Minimize all' => 'Свернуть всё' + 'Minimize all' => 'Свернуть всё', + 'Page reload required. Reload now ?' => 'Нужно перезагрузить страницу. Перезагрузить сейчас ?' ); \ No newline at end of file diff --git a/themes/default/designer/page.php b/themes/default/designer/page.php index 06032c9..817d68c 100644 --- a/themes/default/designer/page.php +++ b/themes/default/designer/page.php @@ -1,107 +1,3 @@ - -
-
- - -
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam tempus nec eros in auctor. Fusce porttitor elementum enim, eu commodo tortor laoreet ac. Proin sed efficitur urna. Praesent non ex efficitur, accumsan diam id, mattis ipsum. Proin eget arcu sapien. Nulla pretium blandit rhoncus. Aenean mollis odio id ante imperdiet venenatis. Maecenas sed pulvinar est.

-

Donec laoreet lobortis tellus. Nullam iaculis in lacus non eleifend. Duis imperdiet odio eget nibh pulvinar eleifend vitae vitae tortor. Praesent ullamcorper lorem quis dictum blandit. Nulla id facilisis nunc, ut tempus neque. Aenean aliquet neque lorem, sit amet porttitor libero tincidunt id. Nulla ac orci eu sem dictum tincidunt. Phasellus volutpat odio et nunc porta, eget cursus odio viverra.

-
-
- -
-
-
- - - -
- -
- - - - -
-
- - -
-

(99)

- -
- -
-
- -
-
+ +
+
+ + +
+

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam tempus nec eros in auctor. Fusce porttitor elementum enim, eu commodo tortor laoreet ac. Proin sed efficitur urna. Praesent non ex efficitur, accumsan diam id, mattis ipsum. Proin eget arcu sapien. Nulla pretium blandit rhoncus. Aenean mollis odio id ante imperdiet venenatis. Maecenas sed pulvinar est.

+

Donec laoreet lobortis tellus. Nullam iaculis in lacus non eleifend. Duis imperdiet odio eget nibh pulvinar eleifend vitae vitae tortor. Praesent ullamcorper lorem quis dictum blandit. Nulla id facilisis nunc, ut tempus neque. Aenean aliquet neque lorem, sit amet porttitor libero tincidunt id. Nulla ac orci eu sem dictum tincidunt. Phasellus volutpat odio et nunc porta, eget cursus odio viverra.

+
+
+ +
+
+
+ + + +
+ +
+ + + + +
+
+ + +
+

(99)

+ +
+ +
+
+ +
+
diff --git a/zira/helper.php b/zira/helper.php index 4e86f0d..b67fca6 100644 --- a/zira/helper.php +++ b/zira/helper.php @@ -34,6 +34,7 @@ class Helper { $path=trim($path,'/'); if (self::$_add_language_to_url && + !Router::isAllLanguagesRoute($path) && Locale::getLanguage() && Config::get('languages') && count(Config::get('languages'))>1 && diff --git a/zira/router.php b/zira/router.php index b38084e..b91eb8f 100644 --- a/zira/router.php +++ b/zira/router.php @@ -15,6 +15,7 @@ class Router { protected static $action; protected static $param; protected static $available_routes = array('zira', 'user'); + protected static $all_languages_routes = array('cron', 'sitemap.xml'); protected static $_map = array(); @@ -89,6 +90,14 @@ class Router { public static function addAvailableRoute($route) { self::$available_routes []= $route; } + + public static function addAllLanguagesRoute($route) { + self::$all_languages_routes []= $route; + } + + public static function isAllLanguagesRoute($route) { + return in_array($route, self::$all_languages_routes); + } public static function dispatch() { self::$request = trim(urldecode(Request::uri())); @@ -207,10 +216,9 @@ class Router { if (!self::$language && count(Config::get('languages'))>1 && !empty(self::$request) && - self::$request!='cron' && - self::$request!='sitemap.xml' && self::$module!='dash' && - self::$controller!='dash' + self::$controller!='dash' && + !in_array(self::$request, self::$all_languages_routes) ) { self::$language = Config::get('language'); Response::redirect(self::$language.'/'.self::$request, true);