Skip to content

Commit

Permalink
add possibility to hide all admin UI elenents
Browse files Browse the repository at this point in the history
* Check out new Configuration -> Settings -> Hide Admin UI
* Watch the new UI element in the top left corner when logged-in

Note for all users of Typesetter Beta 5.1.1-b1:
This commit implements the functionality of my 'Hide Admin UI'
plugin (https://github.com/juek/HideAdminUI) into Typesetter core.
Once you sync/merge this commit with your Typesetter fork(s) or
installation(s) UNINSTALL THE PLUGIN to avoid conflicts.
  • Loading branch information
juek committed Mar 4, 2020
1 parent d4e49e0 commit a3b483e
Show file tree
Hide file tree
Showing 9 changed files with 361 additions and 61 deletions.
26 changes: 21 additions & 5 deletions include/Page/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,27 @@ public function GetFile(){
*
*/
public function AdminLinks(){
global $langmessage;


$admin_links = array();

global $langmessage, $config;


$admin_links = [];


// HideAdminUI
$hotkey_hint = '';
if( !empty($config['admin_ui_hotkey']) ){
$hotkey_hint = ' (' . $config['admin_ui_hotkey'] . ')';
};
$admin_links[] = \gp\tool::Link(
$this->title,
'<i class="fa fa-eye-slash"></i>',
'',
[
'title' => $langmessage['Hide Admin UI'] . $hotkey_hint,
'class' => 'admin-link admin-link-hide-ui',
'data-cmd' => 'hide_ui',
]
);

// page options: less frequently used links that don't have to do with editing the content of the page
$option_links = array();
Expand Down
96 changes: 52 additions & 44 deletions include/admin/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ public function __construct($args){
'desc' => 'textarea',

'Interface' => false,
'colorbox_style' => array(
'colorbox_style' => [
'minimalistic' => 'Minimalistic',
'example1' => 'Example 1',
'example2' => 'Example 2',
'example3' => 'Example 3',
'example4' => 'Example 4',
'example5' => 'Example 5',
),
],
'gallery_legacy_style' => 'boolean',
'language' => '',
'langeditor' => '',
Expand All @@ -71,29 +71,36 @@ public function __construct($args){
'minifyjs' => 'boolean',
'combinecss' => 'boolean',
'etag_headers' => 'boolean',
'space_char' => array('_'=>'Undersorce "_"','-'=>'Dash "-"'),
'space_char' => [
'_' => 'Undersorce "_"',
'-' => 'Dash "-"'
],

/* Hide Admin UI Settings */
'Hide Admin UI' => false,
'admin_ui_autohide_below' => 'integer',
'admin_ui_hotkey' => '',

/* Contact Configuration */
'contact_config' => false,
'toemail' => '',
'toname' => '',
'from_address' => '',
'from_name' => '',
'from_use_user' => 'boolean',
'require_email' => '',
'contact_advanced' => false,
'mail_method' => '',
'sendmail_path' => '',
'smtp_hosts' => '',
'smtp_user' => '',
'smtp_pass' => 'password',
//'fromemail' => '',

'reCaptcha' => false,
'recaptcha_public' => '',
'recaptcha_private' => '',
'recaptcha_language' => '',
'contact_config' => false,
'toemail' => '',
'toname' => '',
'from_address' => '',
'from_name' => '',
'from_use_user' => 'boolean',
'require_email' => '',
'contact_advanced' => false,
'mail_method' => '',
'sendmail_path' => '',
'smtp_hosts' => '',
'smtp_user' => '',
'smtp_pass' => 'password',
//'fromemail' => '',

'reCaptcha' => false,
'recaptcha_public' => '',
'recaptcha_private' => '',
'recaptcha_language' => '',
);

}
Expand Down Expand Up @@ -169,10 +176,10 @@ protected function SaveConfig(){
'Admin/Configuration',
$langmessage['recreate_all_thumbnails'],
'cmd=recreate_thumbs',
array(
[
'class' => '',
'data-cmd' =>'creq',
)
'data-cmd' => 'creq',
]
));
}

Expand Down Expand Up @@ -231,11 +238,11 @@ protected function getPossible(){


//recaptcha language
$possible['recaptcha_language'] = array();
$possible['recaptcha_language'] = [];
$possible['recaptcha_language']['inherit'] = $langmessage['default'];

// According to https://developers.google.com/recaptcha/docs/language
$recaptcha_languages = array(
$recaptcha_languages = [
'af', 'am', 'ar', 'az',
'bn', 'bg',
'ca', 'cs',
Expand All @@ -257,37 +264,39 @@ protected function getPossible(){
'uk', 'ur',
'vi',
'zh-HK', 'zh-CN', 'zh-TW', 'zu',
);
];
foreach($recaptcha_languages as $lang){
$possible['recaptcha_language'][$lang] = $lang;
}



//website language
$possible['language'] = $this->GetPossibleLanguages();


//tidy
if( function_exists('tidy_parse_string') ){
$possible['HTML_Tidy'] = array('off'=>$langmessage['Off'],''=>$langmessage['On']);
$possible['HTML_Tidy'] = [
'off' => $langmessage['Off'],
'' => $langmessage['On']
];
}else{
$possible['HTML_Tidy'] = array(''=>'Unavailable');
$possible['HTML_Tidy'] = [''=>'Unavailable'];
}



//required email fields
$possible['require_email'] = array( 'none' => 'None',
'' => 'Subject &amp; Message',
'email' => 'Subject, Message &amp; Email' );
$possible['require_email'] = [
'none' => 'None',
'' => 'Subject &amp; Message',
'email' => 'Subject, Message &amp; Email'
];


//see xoopsmultimailer.php
$possible['mail_method'] = array( 'mail' => 'PHP mail()',
'sendmail' => 'sendmail',
'smtp' => 'smtp',
'smtpauth' => 'SMTPAuth' );
$possible['mail_method'] = [
'mail' => 'PHP mail()',
'sendmail' => 'sendmail',
'smtp' => 'smtp',
'smtpauth' => 'SMTPAuth'
];

//CDN
foreach(\gp\tool\Output\Combine::$scripts as $key => $script_info){
Expand All @@ -306,10 +315,8 @@ protected function getPossible(){
array_unshift($possible[$config_key],$langmessage['None']);
}


gpSettingsOverride('configuration',$possible);


return $possible;
}

Expand All @@ -336,6 +343,7 @@ private function GetPossibleLanguages(){
return array_combine($languages, $languages);
}


/**
* Display configuration settings
*
Expand Down
93 changes: 93 additions & 0 deletions include/css/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2411,3 +2411,96 @@ table.tp-tablesorter {
.CodeMirror {
font-family: $font_family_monospace !important;
}


/**
* Hide Admin UI overrides
* keep this part at the very end of the stylesheet
* for precedence
*/
html.override_admin_style {
// page offset when editor is open
margin-left: 0 !important;
margin-top: 0 !important;
width: auto !important;

// all Admin UI elements
#gp_admin_html,
.messages.gp-fixed-adjust {
display: none;
}

// fixed navbars - top bar compensation
.gp-fixed-adjust {
margin-top: 0 !important;
}

body.gpAdmin .navbar-fixed-top {
top: 0;
}

// Theme Cajon Navbar
.navbar-theme-cajon.navbar-fixed-side-left {
left: 0 !important;
}
}

// The Hide UI icon
#admincontent_panel .admin-link-hide-ui {
padding: 8px 10px;
> .fa {
margin: 0;
}
> img {
display: inline-block;
height: 14px;
width: auto;
}
}

// The Show UI icon
div.show-admin-ui {
display: none;
}
html.override_admin_style div.show-admin-ui {
display: block;
z-index: 12000;
cursor: pointer;
position: fixed;
top: 0;
left: 0;
padding: 8px;
font-size: 13px;
line-height: 13px;
color: rgba(221, 221, 221, 0.8);
-webkit-animation: 2s infinite indicator-pulse;
animation: 2s infinite indicator-pulse;

&:hover {
background: rgba(60, 60, 60, 0.5);
}

> img {
display: inline-block;
height: 14px;
width: auto;
}
}

@media print {
html.override_admin_style div.show-admin-ui {
display: none;
}
}

// pulse animation
@keyframes indicator-pulse {
0% { color: rgba(221, 221, 221, 0.85); }
50% { color: rgba(60,60,60,0.85); }
100% { color: rgba(221,221,221,0.85); }
}
@-webkit-keyframes indicator-pulse {
0% { color: rgba(221, 221, 221, 0.85); }
50% { color: rgba(60,60,60,0.85); }
100% { color: rgba(221,221,221,0.85); }
}
Loading

0 comments on commit a3b483e

Please sign in to comment.