From 7594796ee11c0b245d02d145868a13ac3d84ebfc Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Tue, 19 Apr 2016 05:52:16 -0400 Subject: Try toggling context help using onclick attribute --- Zotlabs/Module/Admin.php | 5 ++++- include/nav.php | 5 +++-- view/tpl/admin_site.tpl | 1 + view/tpl/nav.tpl | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index 8cc08fd13..d360f7b9d 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -264,6 +264,7 @@ class Admin extends \Zotlabs\Web\Controller { $force_publish = ((x($_POST,'publish_all')) ? True : False); $disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True); $login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False); + $enable_context_help = ((x($_POST,'enable_context_help')) ? True : False); $global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : ''); $no_community_page = !((x($_POST,'no_community_page')) ? True : False); $default_expire_days = ((array_key_exists('default_expire_days',$_POST)) ? intval($_POST['default_expire_days']) : 0); @@ -288,6 +289,7 @@ class Admin extends \Zotlabs\Web\Controller { set_config('system', 'mirror_frontpage', $mirror_frontpage); set_config('system', 'sitename', $sitename); set_config('system', 'login_on_homepage', $login_on_homepage); + set_config('system', 'enable_context_help', $enable_context_help); set_config('system', 'verify_email', $verify_email); set_config('system', 'default_expire_days', $default_expire_days); @@ -488,7 +490,8 @@ class Admin extends \Zotlabs\Web\Controller { '$verify_email' => array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")), '$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")), '$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')), - '$login_on_homepage' => array('login_on_homepage', t("login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")), + '$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")), + '$enable_context_help' => array('\enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")), '$directory_server' => (($dir_choices) ? array('directory_server', t("Directory Server URL"), get_config('system','directory_server'), t("Default directory server"), $dir_choices) : null), diff --git a/include/nav.php b/include/nav.php index 541ab3aed..b088d171d 100644 --- a/include/nav.php +++ b/include/nav.php @@ -152,7 +152,8 @@ EOT; if(! get_config('system','hide_help')) { require_once('mod/help.php'); $context_help = load_context_help(); - $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'),'help_nav_btn',$context_help); + $enable_context_help = get_config('system','enable_context_help') || 0; + $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'),'help_nav_btn',$context_help,$enable_context_help); } if(! UNO) @@ -248,7 +249,7 @@ $powered_by = ''; '$powered_by' => $powered_by, '$help' => t('@name, #tag, ?doc, content'), '$pleasewait' => t('Please wait...') - )); + )); call_hooks('page_header', App::$page['nav']); } diff --git a/view/tpl/admin_site.tpl b/view/tpl/admin_site.tpl index 54f625e0b..6b8729ee6 100755 --- a/view/tpl/admin_site.tpl +++ b/view/tpl/admin_site.tpl @@ -49,6 +49,7 @@ {{include file="field_input.tpl" field=$frontpage}} {{include file="field_checkbox.tpl" field=$mirror_frontpage}} {{include file="field_checkbox.tpl" field=$login_on_homepage}} + {{include file="field_checkbox.tpl" field=$enable_context_help}} {{if $directory_server}} {{include file="field_select.tpl" field=$directory_server}} {{/if}} diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index 90d741e96..0d70ac5be 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -189,7 +189,7 @@ {{if $nav.help}}
  • - +
  • -- cgit v1.2.3 From 6941fbb182dd7b91c2bc5c1de387affa746d97f6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 19 Apr 2016 13:38:06 +0200 Subject: add querystring to css and js which is added via head_add_{css, js} --- include/plugin.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/plugin.php b/include/plugin.php index 8dceb8fb1..7df3e302c 100755 --- a/include/plugin.php +++ b/include/plugin.php @@ -535,8 +535,11 @@ function format_css_if_exists($source) { else $path = theme_include($source[0]); - if($path) - return '' . "\r\n"; + if($path) { + $path = script_path() . '/' . $path; + $qstring = ((parse_url($path, PHP_URL_QUERY)) ? '&' : '?') . 'v=' . STD_VERSION; + return '' . "\r\n"; + } } /* @@ -612,8 +615,11 @@ function format_js_if_exists($source) { $path = $source; else $path = theme_include($source); - if($path) - return '' . "\r\n" ; + if($path) { + $path = script_path() . '/' . $path; + $qstring = ((parse_url($path, PHP_URL_QUERY)) ? '&' : '?') . 'v=' . STD_VERSION; + return '' . "\r\n" ; + } } @@ -678,4 +684,4 @@ function folder_exists($folder) // If it exist, check if it's a directory return (($path !== false) && is_dir($path)) ? $path : false; -} \ No newline at end of file +} -- cgit v1.2.3 From 82de68c3d3ff931fad4ddb48a69cf62576a5397a Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Thu, 21 Apr 2016 06:41:55 -0400 Subject: Added admin/site setting that toggles context help panel. If disabled, original help menu button behavior is restored. --- Zotlabs/Module/Admin.php | 3 ++- include/nav.php | 6 +++++ view/theme/redbasic/js/redbasic.js | 47 ------------------------------------ view/tpl/nav_header.tpl | 49 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 48 deletions(-) create mode 100644 view/tpl/nav_header.tpl diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php index d360f7b9d..1ff9065cd 100644 --- a/Zotlabs/Module/Admin.php +++ b/Zotlabs/Module/Admin.php @@ -455,6 +455,7 @@ class Admin extends \Zotlabs\Web\Controller { $homelogin = get_config('system','login_on_homepage'); + $enable_context_help = get_config('system','enable_context_help'); $t = get_markup_template("admin_site.tpl"); return replace_macros($t, array( @@ -491,7 +492,7 @@ class Admin extends \Zotlabs\Web\Controller { '$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")), '$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')), '$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")), - '$enable_context_help' => array('\enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")), + '$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")), '$directory_server' => (($dir_choices) ? array('directory_server', t("Directory Server URL"), get_config('system','directory_server'), t("Default directory server"), $dir_choices) : null), diff --git a/include/nav.php b/include/nav.php index ef5b5df45..9d8fdc30e 100644 --- a/include/nav.php +++ b/include/nav.php @@ -235,6 +235,12 @@ $powered_by = ''; // $powered_by = 'redr#matrix'; + $tpl = get_markup_template('nav_header.tpl'); + + App::$page['htmlhead'] .= replace_macros($tpl, array( + '$enable_context_help' => ((intval(get_config('system','enable_context_help')) === 1 || get_config('system','enable_context_help') === false) ? true : false) + )); + $tpl = get_markup_template('nav.tpl'); App::$page['nav'] .= replace_macros($tpl, array( diff --git a/view/theme/redbasic/js/redbasic.js b/view/theme/redbasic/js/redbasic.js index ccc24d2b3..877bcd840 100644 --- a/view/theme/redbasic/js/redbasic.js +++ b/view/theme/redbasic/js/redbasic.js @@ -67,50 +67,3 @@ function makeFullScreen(full) { $('main').css({'transition': ''}); } } - -/* contextual help */ -$('.help-content').css('top', '-' + $('#help-content').height() + 'px') -$(document).mouseup(function (e) -{ - e.preventDefault; - - var container = $("#help-content"); - - if ((!container.is(e.target) // if the target of the click isn't the container... - && container.has(e.target).length === 0 // ... nor a descendant of the container - && container.hasClass('help-content-open')) - || - ( - ($('#help_nav_btn').is(e.target) || $('#help_nav_btn').has(e.target).length !== 0) - && container.hasClass('help-content-open') - )) { - container.removeClass('help-content-open'); - $('main').removeClass('help-content-open'); - $('main').css('top', 'auto') - } - else if (($('#help_nav_btn').is(e.target) || $('#help_nav_btn').has(e.target).length !== 0) - && !container.hasClass('help-content-open')) { - $('#help-content').addClass('help-content-open'); - $('main').removeClass('help-content-open'); - var mainTop = $('#navbar-collapse-1').height(); - if ($('#navbar-collapse-1').height() < $('#help-content').height()) { - mainTop = $('#help-content').height(); - } - - $('main').css('top', +mainTop + +50 + 'px'); - } - -}); - -var contextualHelpFocus = function (target, openSidePanel) { - if (openSidePanel) { - $("main").addClass('region_1-on'); // Open the side panel to highlight element - } else { - $("main").removeClass('region_1-on'); - } - // Animate the page scroll to the element and then pulse the element to direct attention - $('html,body').animate({scrollTop: $(target).offset().top - $('#navbar-collapse-1').height() - $('#help-content').height() - 50}, 'slow'); - for (i = 0; i < 3; i++) { - $(target).fadeTo('slow', 0.1).fadeTo('slow', 1.0); - } -} \ No newline at end of file diff --git a/view/tpl/nav_header.tpl b/view/tpl/nav_header.tpl new file mode 100644 index 000000000..5fce26317 --- /dev/null +++ b/view/tpl/nav_header.tpl @@ -0,0 +1,49 @@ + \ No newline at end of file -- cgit v1.2.3 From d7f4bfedd5164596504d17b1ef4b8597a1304d98 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 21 Apr 2016 23:03:09 +0200 Subject: some fixes for contextual help and disable transition animation for now - it looked really wired because main moved with a different speed than help-content and help-content can not be displayed under the panel as it is implemented now. --- include/nav.php | 17 +++++++---- view/theme/redbasic/css/style.css | 63 +++++++++++++++++---------------------- view/tpl/nav.tpl | 22 ++++++++------ view/tpl/nav_header.tpl | 10 +++---- 4 files changed, 57 insertions(+), 55 deletions(-) diff --git a/include/nav.php b/include/nav.php index 9d8fdc30e..c59aaae37 100644 --- a/include/nav.php +++ b/include/nav.php @@ -150,10 +150,15 @@ EOT; $help_url = z_root() . '/help?f=&cmd=' . App::$cmd; if(! get_config('system','hide_help')) { - require_once('include/help.php'); - $context_help = load_context_help(); - $enable_context_help = get_config('system','enable_context_help') || 0; - $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'),'help_nav_btn',$context_help,$enable_context_help); + $context_help = ''; + $enable_context_help = ((intval(get_config('system','enable_context_help')) === 1 || get_config('system','enable_context_help') === false) ? true : false); + if($enable_context_help === true) { + require_once('include/help.php'); + $context_help = load_context_help(); + //direct directly to /help if $context_help is empty - this can be removed once we have context help for all modules + $enable_context_help = (($context_help) ? true : false); + } + $nav['help'] = array($help_url, t('Help'), "", t('Help and documentation'), 'help_nav_btn', $context_help, $enable_context_help); } if(! UNO) @@ -238,8 +243,8 @@ $powered_by = ''; $tpl = get_markup_template('nav_header.tpl'); App::$page['htmlhead'] .= replace_macros($tpl, array( - '$enable_context_help' => ((intval(get_config('system','enable_context_help')) === 1 || get_config('system','enable_context_help') === false) ? true : false) - )); + '$enable_context_help' => $enable_context_help + )); $tpl = get_markup_template('nav.tpl'); diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 038bffb2f..9072646d5 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -200,6 +200,34 @@ header #banner #logo-text { font-size: 22px; } +/* contextual help */ +.help-content { + background: $item_colour; + color: $font_colour; + position: fixed; + top: -50%; + left: 0px; + width: 100%; + max-height: 50%; + padding: 20px; + /*transition: top 300ms cubic-bezier(0.17, 0.04, 0.03, 0.94);*/ + border-bottom: #CCC 1px solid; + overflow: auto; +} + +.help-content-open { + top: 51px; + -moz-box-shadow: 0px 3px 3px rgba(0,0,0,0.2); + -webkit-box-shadow: 0px 3px 3px rgba(0,0,0,0.2); + box-shadow: 0px 3px 3px rgba(0,0,0,0.2); + /*transition: top 300ms cubic-bezier(0.17, 0.04, 0.03, 0.94);*/ +} + +.help-content dd { + margin-bottom: 1em; +} +/* contextual help end */ + /* footer */ footer { @@ -1895,38 +1923,3 @@ nav .badge.mail-update:hover { .help-searchlist a { font-size: 130%; } - -/* contextual help */ -.help-content { - background: $bgcolour; - color: $font_colour; - position: fixed; - top: -1000px; - left: 0%; - right: 100%; - width: 100%; - height: auto; - padding: 20px; - transition: top 300ms cubic-bezier(0.17, 0.04, 0.03, 0.94); - box-sizing: border-box; - border-bottom: #CCC thin solid; - overflow: auto; -} - -.help-content-open { - top: 50px; - -moz-box-shadow: 0px 3px 3px #ccc; - -webkit-box-shadow: 0px 3px 3px #ccc; - box-shadow: 0px 3px 3px #ccc; -} -main { - top: auto; -} -main.help-content-open { - top: 200px; -} - -.help-content dd { - margin-bottom: 1em; -} -/* contextual help end */ diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index 0d70ac5be..8fc6279d3 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -1,4 +1,4 @@ -
    +
    + {{if $nav.help.6}} +
    + {{$nav.help.5}} +

    Click here for more documentation...

    +
    + {{/if}} diff --git a/view/tpl/nav_header.tpl b/view/tpl/nav_header.tpl index 5fce26317..be990765c 100644 --- a/view/tpl/nav_header.tpl +++ b/view/tpl/nav_header.tpl @@ -18,18 +18,18 @@ )) { container.removeClass('help-content-open'); $('main').removeClass('help-content-open'); - $('main').css('top', 'auto') + $('main').css('top', '') } else if (($('#help_nav_btn').is(e.target) || $('#help_nav_btn').has(e.target).length !== 0) && !container.hasClass('help-content-open')) { $('#help-content').addClass('help-content-open'); $('main').removeClass('help-content-open'); var mainTop = $('#navbar-collapse-1').height(); - if ($('#navbar-collapse-1').height() < $('#help-content').height()) { - mainTop = $('#help-content').height(); + if ($('#navbar-collapse-1').outerHeight(true) < $('#help-content').height()) { + mainTop = $('#help-content').outerHeight(true); } - $('main').css('top', +mainTop + +50 + 'px'); + $('main').css('top', mainTop + 'px'); } }); @@ -46,4 +46,4 @@ $(target).fadeTo('slow', 0.1).fadeTo('slow', 1.0); } } - \ No newline at end of file + -- cgit v1.2.3 From 96d19c09f39b4d022741f9ba4def6a68c768946d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 21 Apr 2016 23:19:17 +0200 Subject: fix help button for collapsed state --- view/theme/redbasic/css/style.css | 3 ++- view/tpl/nav.tpl | 4 ++-- view/tpl/nav_header.tpl | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 9072646d5..7fddc7a88 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1703,9 +1703,10 @@ nav .badge.mail-update:hover { #expand-aside, #expand-tabs, -#help-btn { +#help_nav_btn_collapsed { color: $nav_active_icon_colour; padding: 7px 10px; + text-decoration: none; } .nav-tabs.nav-justified { diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index 8fc6279d3..69dd77368 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -11,7 +11,7 @@ - + {{if $userinfo}} @@ -191,7 +191,7 @@ {{/if}} {{if $nav.help}} -
  • +
  • {{/if}} diff --git a/view/tpl/nav_header.tpl b/view/tpl/nav_header.tpl index be990765c..27713b55b 100644 --- a/view/tpl/nav_header.tpl +++ b/view/tpl/nav_header.tpl @@ -13,14 +13,14 @@ && container.hasClass('help-content-open')) || ( - ($('#help_nav_btn').is(e.target) || $('#help_nav_btn').has(e.target).length !== 0) + ($('#help_nav_btn, #help_nav_btn_collapsed').is(e.target) || $('#help_nav_btn, #help_nav_btn_collapsed').has(e.target).length !== 0) && container.hasClass('help-content-open') )) { container.removeClass('help-content-open'); $('main').removeClass('help-content-open'); $('main').css('top', '') } - else if (($('#help_nav_btn').is(e.target) || $('#help_nav_btn').has(e.target).length !== 0) + else if (($('#help_nav_btn, #help_nav_btn_collapsed').is(e.target) || $('#help_nav_btn, #help_nav_btn_collapsed').has(e.target).length !== 0) && !container.hasClass('help-content-open')) { $('#help-content').addClass('help-content-open'); $('main').removeClass('help-content-open'); -- cgit v1.2.3 From bd11b1d61a9fa76458367db1e38d23b0dd694f36 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 21 Apr 2016 23:55:38 +0200 Subject: indicate if we will be displayed contextual help or default help --- view/theme/redbasic/css/style.css | 6 +++++- view/tpl/nav.tpl | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 7fddc7a88..6c883b7b6 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -202,7 +202,7 @@ header #banner #logo-text { /* contextual help */ .help-content { - background: $item_colour; + background: $comment_item_colour; color: $font_colour; position: fixed; top: -50%; @@ -226,6 +226,10 @@ header #banner #logo-text { .help-content dd { margin-bottom: 1em; } + +.contextual-help-btn { + text-decoration: underline; +} /* contextual help end */ /* footer */ diff --git a/view/tpl/nav.tpl b/view/tpl/nav.tpl index 69dd77368..1c7f8f5b2 100755 --- a/view/tpl/nav.tpl +++ b/view/tpl/nav.tpl @@ -12,7 +12,7 @@ - + {{if $nav.help.6}} {{/if}} {{if $userinfo}} {{$userinfo.name}} @@ -192,7 +192,7 @@ {{if $nav.help}} {{/if}} -- cgit v1.2.3 From cb8c83a42bc827d7b2fc589d3289ec62c4167398 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 21 Apr 2016 23:56:53 +0200 Subject: remove obsolete class --- view/theme/redbasic/css/style.css | 4 ---- 1 file changed, 4 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 6c883b7b6..5b8729111 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -226,10 +226,6 @@ header #banner #logo-text { .help-content dd { margin-bottom: 1em; } - -.contextual-help-btn { - text-decoration: underline; -} /* contextual help end */ /* footer */ -- cgit v1.2.3