2
0
Fork 0

add optional side panels hiding

This commit is contained in:
ivan 2020-04-07 21:40:30 +03:00
parent 55eb683b36
commit b2c971ce2a
7 changed files with 25 additions and 1 deletions

View File

@ -2,3 +2,5 @@
App::$strings["Link on Hub"] = "Link auf dem Hub"; App::$strings["Link on Hub"] = "Link auf dem Hub";
App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Zeige \"Link auf dem Hub\" im Dropdown-Menü"; App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Zeige \"Link auf dem Hub\" im Dropdown-Menü";
App::$strings["Hide side panels on the link page"] = "Seitenwände auf der Linkseite ausblenden";

View File

@ -2,3 +2,4 @@
App::$strings["Link on Hub"] = "Enlazar con la entrada en el hub"; App::$strings["Link on Hub"] = "Enlazar con la entrada en el hub";
App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Mostrar \"Enlazar con la entrada en el hub\" en el menú desplegable"; App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Mostrar \"Enlazar con la entrada en el hub\" en el menú desplegable";
App::$strings["Hide side panels on the link page"] = "Ocultar los paneles laterales en la página de enlaces";

View File

@ -2,3 +2,4 @@
App::$strings["Link on Hub"] = "Lien sur le Hub"; App::$strings["Link on Hub"] = "Lien sur le Hub";
App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Afficher \"Lien sur le Hub\" dans le menu déroulant"; App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Afficher \"Lien sur le Hub\" dans le menu déroulant";
App::$strings["Hide side panels on the link page"] = "Masquer les panneaux latéraux sur la page de liens";

View File

@ -2,3 +2,4 @@
App::$strings["Link on Hub"] = "Link al hub"; App::$strings["Link on Hub"] = "Link al hub";
App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Mostra \"Link al hub\" nel menu a tendina"; App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Mostra \"Link al hub\" nel menu a tendina";
App::$strings["Hide side panels on the link page"] = "Nascondere i pannelli laterali nella pagina dei link";

View File

@ -2,3 +2,4 @@
App::$strings["Link on Hub"] = "Ссылка на хабе"; App::$strings["Link on Hub"] = "Ссылка на хабе";
App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Показывать \"Ссылку на хабе\" в выпадающем меню"; App::$strings["Show \"Link on Hub\" in the dropdown menu"] = "Показывать \"Ссылку на хабе\" в выпадающем меню";
App::$strings["Hide side panels on the link page"] = "Скрывать боковые панели на странице ссылки";

View File

@ -2,7 +2,7 @@
/** /**
* Name: Link * Name: Link
* Description: Using short links on whole hub * Description: Using short links on whole hub
* Version: 0.67 * Version: 0.69
* Author: ivan zlax <@zlax@ussr.win> * Author: ivan zlax <@zlax@ussr.win>
* Maintainer: ivan zlax <@zlax@ussr.win> * Maintainer: ivan zlax <@zlax@ussr.win>
*/ */
@ -15,12 +15,15 @@ function link_load() {
Route::register('addon/link/Mod_Link.php','link'); Route::register('addon/link/Mod_Link.php','link');
if (get_config('link','linkonhub')) if (get_config('link','linkonhub'))
register_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link'); register_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link');
if (get_config('link','hideasides'))
register_hook('page_header', 'addon/link/link.php', 'hideasides_header');
set_config('link','linkenabled',1); set_config('link','linkenabled',1);
} }
function link_unload() { function link_unload() {
Route::unregister('addon/link/Mod_Link.php','link'); Route::unregister('addon/link/Mod_Link.php','link');
unregister_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link'); unregister_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link');
unregister_hook('page_header', 'addon/link/link.php', 'hideasides_header');
del_config('link','linkenabled'); del_config('link','linkenabled');
} }
@ -28,16 +31,22 @@ function link_plugin_admin(&$a,&$o) {
$t = get_markup_template( "admin.tpl", "addon/link/" ); $t = get_markup_template( "admin.tpl", "addon/link/" );
$o = replace_macros($t, array( $o = replace_macros($t, array(
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$hideasides' => array('hideasides', t('Hide side panels on the link page'), get_config('link', 'hideasides')),
'$linkonhub' => array('linkonhub', t('Show "Link on Hub" in the dropdown menu'), get_config('link', 'linkonhub')), '$linkonhub' => array('linkonhub', t('Show "Link on Hub" in the dropdown menu'), get_config('link', 'linkonhub')),
)); ));
} }
function link_plugin_admin_post(&$a) { function link_plugin_admin_post(&$a) {
set_config('link','linkonhub',trim($_POST['linkonhub'])); set_config('link','linkonhub',trim($_POST['linkonhub']));
set_config('link','hideasides',trim($_POST['hideasides']));
if (get_config('link','linkonhub')) if (get_config('link','linkonhub'))
register_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link'); register_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link');
else else
unregister_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link'); unregister_hook('dropdown_extras', 'addon/link/link.php', 'dropdown_link');
if (get_config('link','hideasides'))
register_hook('page_header', 'addon/link/link.php', 'hideasides_header');
else
unregister_hook('page_header', 'addon/link/link.php', 'hideasides_header');
info( t('Settings updated.') . EOL ); info( t('Settings updated.') . EOL );
} }
@ -47,3 +56,11 @@ function dropdown_link(&$extras) {
$arr['dropdown_extras'] .= '<a class="dropdown-item" href="'.z_root().'/link/'.$item_id.'" title="'.t('Link on Hub').'" class="u-url"><i class="generic-icons-nav fa fa-fw fa-link"></i>'.t('Link on Hub').'</a>'; $arr['dropdown_extras'] .= '<a class="dropdown-item" href="'.z_root().'/link/'.$item_id.'" title="'.t('Link on Hub').'" class="u-url"><i class="generic-icons-nav fa fa-fw fa-link"></i>'.t('Link on Hub').'</a>';
$extras = $arr; $extras = $arr;
} }
function hideasides_header($a, &$b) {
$querystr = stristr(App::$query_string, '/', true);
if ($querystr == "link") {
$addScriptTag = "<style>#region_1 { display: none; } #region_3 { display: none; }</style>\r\n";
App::$page['htmlhead'] .= $addScriptTag;
}
}

View File

@ -1,2 +1,3 @@
{{include file="field_checkbox.tpl" field=$linkonhub}} {{include file="field_checkbox.tpl" field=$linkonhub}}
{{include file="field_checkbox.tpl" field=$hideasides}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>