Merge pull request #351 from anaqreon/toggle-context-help
Toggle context help
This commit is contained in:
commit
391ed8655e
@ -264,6 +264,7 @@ class Admin extends \Zotlabs\Web\Controller {
|
|||||||
$force_publish = ((x($_POST,'publish_all')) ? True : False);
|
$force_publish = ((x($_POST,'publish_all')) ? True : False);
|
||||||
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True);
|
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True);
|
||||||
$login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
|
$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'])) : '');
|
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
|
||||||
$no_community_page = !((x($_POST,'no_community_page')) ? True : False);
|
$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);
|
$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', 'mirror_frontpage', $mirror_frontpage);
|
||||||
set_config('system', 'sitename', $sitename);
|
set_config('system', 'sitename', $sitename);
|
||||||
set_config('system', 'login_on_homepage', $login_on_homepage);
|
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', 'verify_email', $verify_email);
|
||||||
set_config('system', 'default_expire_days', $default_expire_days);
|
set_config('system', 'default_expire_days', $default_expire_days);
|
||||||
|
|
||||||
@ -453,6 +455,7 @@ class Admin extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
|
|
||||||
$homelogin = get_config('system','login_on_homepage');
|
$homelogin = get_config('system','login_on_homepage');
|
||||||
|
$enable_context_help = get_config('system','enable_context_help');
|
||||||
|
|
||||||
$t = get_markup_template("admin_site.tpl");
|
$t = get_markup_template("admin_site.tpl");
|
||||||
return replace_macros($t, array(
|
return replace_macros($t, array(
|
||||||
@ -488,7 +491,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).")),
|
'$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.")),
|
'$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.')),
|
'$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),
|
'$directory_server' => (($dir_choices) ? array('directory_server', t("Directory Server URL"), get_config('system','directory_server'), t("Default directory server"), $dir_choices) : null),
|
||||||
|
|
||||||
|
@ -152,7 +152,8 @@ EOT;
|
|||||||
if(! get_config('system','hide_help')) {
|
if(! get_config('system','hide_help')) {
|
||||||
require_once('include/help.php');
|
require_once('include/help.php');
|
||||||
$context_help = load_context_help();
|
$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)
|
if(! UNO)
|
||||||
@ -234,6 +235,12 @@ $powered_by = '';
|
|||||||
|
|
||||||
// $powered_by = '<strong>red<img class="smiley" src="' . z_root() . '/images/rm-16.png" alt="r#" />matrix</strong>';
|
// $powered_by = '<strong>red<img class="smiley" src="' . z_root() . '/images/rm-16.png" alt="r#" />matrix</strong>';
|
||||||
|
|
||||||
|
$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');
|
$tpl = get_markup_template('nav.tpl');
|
||||||
|
|
||||||
App::$page['nav'] .= replace_macros($tpl, array(
|
App::$page['nav'] .= replace_macros($tpl, array(
|
||||||
@ -248,7 +255,7 @@ $powered_by = '';
|
|||||||
'$powered_by' => $powered_by,
|
'$powered_by' => $powered_by,
|
||||||
'$help' => t('@name, #tag, ?doc, content'),
|
'$help' => t('@name, #tag, ?doc, content'),
|
||||||
'$pleasewait' => t('Please wait...')
|
'$pleasewait' => t('Please wait...')
|
||||||
));
|
));
|
||||||
|
|
||||||
call_hooks('page_header', App::$page['nav']);
|
call_hooks('page_header', App::$page['nav']);
|
||||||
}
|
}
|
||||||
|
@ -67,50 +67,3 @@ function makeFullScreen(full) {
|
|||||||
$('main').css({'transition': ''});
|
$('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);
|
|
||||||
}
|
|
||||||
}
|
|
@ -49,6 +49,7 @@
|
|||||||
{{include file="field_input.tpl" field=$frontpage}}
|
{{include file="field_input.tpl" field=$frontpage}}
|
||||||
{{include file="field_checkbox.tpl" field=$mirror_frontpage}}
|
{{include file="field_checkbox.tpl" field=$mirror_frontpage}}
|
||||||
{{include file="field_checkbox.tpl" field=$login_on_homepage}}
|
{{include file="field_checkbox.tpl" field=$login_on_homepage}}
|
||||||
|
{{include file="field_checkbox.tpl" field=$enable_context_help}}
|
||||||
{{if $directory_server}}
|
{{if $directory_server}}
|
||||||
{{include file="field_select.tpl" field=$directory_server}}
|
{{include file="field_select.tpl" field=$directory_server}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
@ -189,7 +189,7 @@
|
|||||||
|
|
||||||
{{if $nav.help}}
|
{{if $nav.help}}
|
||||||
<li class="{{$sel.help}}">
|
<li class="{{$sel.help}}">
|
||||||
<a class="{{$nav.help.2}}" target="hubzilla-help" href="{{$nav.help.0}}" title="{{$nav.help.3}}" id="{{$nav.help.4}}" onclick="return false;"><i class="icon-question"></i></a>
|
<a class="{{$nav.help.2}}" target="hubzilla-help" href="{{$nav.help.0}}" title="{{$nav.help.3}}" id="{{$nav.help.4}}" onclick="{{if $nav.help.6}}return false;{{/if}}"><i class="icon-question"></i></a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<div id="help-content" class="help-content">
|
<div id="help-content" class="help-content">
|
||||||
|
49
view/tpl/nav_header.tpl
Normal file
49
view/tpl/nav_header.tpl
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
<script>
|
||||||
|
/* contextual help */
|
||||||
|
{{if $enable_context_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');
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
{{/if}}
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
Reference in New Issue
Block a user