2013-11-11 19:45:33 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* EGroupware: Stylite Pixelegg template
|
|
|
|
*
|
|
|
|
* et2 Messages
|
|
|
|
*
|
|
|
|
* Please do NOT change css-files directly, instead change less-files and compile them!
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
|
|
* @author Stefan Reinhard <stefan.reinhard@pixelegg.de>
|
|
|
|
* @package pixelegg
|
|
|
|
* @version $Id$
|
|
|
|
*/
|
|
|
|
|
2016-04-07 22:42:06 +02:00
|
|
|
use EGroupware\Api;
|
|
|
|
|
2013-11-11 19:45:33 +01:00
|
|
|
/**
|
|
|
|
* Stylite Pixelegg template
|
|
|
|
*/
|
2016-05-02 16:19:34 +02:00
|
|
|
class pixelegg_framework extends Api\Framework\Ajax
|
2013-11-11 19:45:33 +01:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Appname used for everything but JS includes, which we re-use from jdots
|
|
|
|
*/
|
|
|
|
const APP = 'pixelegg';
|
2014-12-09 15:25:52 +01:00
|
|
|
/**
|
|
|
|
* Appname used to include javascript code
|
|
|
|
*/
|
|
|
|
const JS_INCLUDE_APP = 'pixelegg';
|
2013-11-11 19:45:33 +01:00
|
|
|
|
2013-11-14 14:53:24 +01:00
|
|
|
/**
|
|
|
|
* Enable to use this template sets login.tpl for login page
|
|
|
|
*/
|
|
|
|
const LOGIN_TEMPLATE_SET = true;
|
|
|
|
|
2013-11-11 19:45:33 +01:00
|
|
|
/**
|
2013-11-12 10:37:19 +01:00
|
|
|
* Constructor
|
|
|
|
*
|
|
|
|
* Overwritten to set own app/template name (parent can NOT use static::APP!)
|
|
|
|
*
|
2016-02-01 16:08:13 +01:00
|
|
|
* @param string $template ='pixelegg' name of the template
|
2013-11-12 10:37:19 +01:00
|
|
|
*/
|
|
|
|
function __construct($template=self::APP)
|
2013-11-11 19:45:33 +01:00
|
|
|
{
|
|
|
|
parent::__construct($template); // call the constructor of the extended class
|
2016-02-17 17:50:54 +01:00
|
|
|
|
|
|
|
// search 'mobile' dirs first
|
2016-04-07 22:42:06 +02:00
|
|
|
if (Api\Header\UserAgent::mobile()) array_unshift ($this->template_dirs, 'mobile');
|
2013-11-11 19:45:33 +01:00
|
|
|
}
|
2014-01-06 11:36:18 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Render header
|
|
|
|
*
|
|
|
|
* Overwritten to load our slider.js
|
|
|
|
*
|
|
|
|
* @param array $extra
|
|
|
|
* @return type
|
|
|
|
*/
|
|
|
|
function header(array $extra=array())
|
|
|
|
{
|
|
|
|
// load our slider.js, but only if framework requested
|
2016-01-19 14:31:31 +01:00
|
|
|
if (!self::$header_done && $_GET['cd'] === 'yes' &&
|
2016-04-07 22:42:06 +02:00
|
|
|
!(Api\Header\UserAgent::mobile() || $GLOBALS['egw_info']['user']['preferences']['common']['theme'] == 'mobile'))
|
2014-01-06 11:36:18 +01:00
|
|
|
{
|
2016-04-07 22:42:06 +02:00
|
|
|
self::includeJS('/pixelegg/js/slider.js');
|
2014-01-06 11:36:18 +01:00
|
|
|
}
|
|
|
|
return parent::header($extra);
|
|
|
|
}
|
2015-07-01 14:44:34 +02:00
|
|
|
|
2014-12-18 18:13:49 +01:00
|
|
|
/**
|
|
|
|
* Make given color lighter or darker by percentage
|
|
|
|
*
|
|
|
|
* @param string $color in hex
|
|
|
|
* @param int $percent int
|
|
|
|
* @return string returns color hex format (for instance: #2b2b2b)
|
|
|
|
*/
|
2016-02-01 16:08:13 +01:00
|
|
|
function _color_shader($color, $percent)
|
|
|
|
{
|
|
|
|
if ($color[0] == '#') $color = ltrim($color, '#');
|
2014-12-18 18:13:49 +01:00
|
|
|
|
|
|
|
$R = hexdec(substr($color,0,2));
|
|
|
|
$G = hexdec(substr($color,2,2));
|
|
|
|
$B = hexdec(substr($color,4,2));
|
|
|
|
|
2016-02-01 16:08:13 +01:00
|
|
|
$Rs = round($R * (100 + $percent) / 100);
|
|
|
|
$Gs = round($G * (100 + $percent) / 100);
|
|
|
|
$Bs = round($B * (100 + $percent) / 100);
|
2014-07-02 12:37:50 +02:00
|
|
|
|
2016-02-01 16:08:13 +01:00
|
|
|
if ($Rs > 255) $Rs = 255;
|
|
|
|
if ($Gs > 255) $Gs = 255;
|
|
|
|
if ($Bs > 255) $Bs = 255;
|
2014-12-18 18:13:49 +01:00
|
|
|
|
2016-02-01 16:08:13 +01:00
|
|
|
return '#'.sprintf('%02X%02X%02X', $Rs, $Gs, $Bs);
|
2014-12-18 18:13:49 +01:00
|
|
|
}
|
2015-07-01 14:44:34 +02:00
|
|
|
|
2014-07-02 12:37:50 +02:00
|
|
|
/**
|
|
|
|
* Overwrite to NOT add customizable colors from jDots
|
|
|
|
*
|
2016-04-07 22:42:06 +02:00
|
|
|
* @see Api\Framework::_get_css()
|
2014-07-02 12:37:50 +02:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function _get_css()
|
|
|
|
{
|
2014-12-18 18:13:49 +01:00
|
|
|
$ret = parent::_get_css();
|
|
|
|
// color to use
|
2021-10-07 10:14:08 +02:00
|
|
|
$color = str_replace('custom', $GLOBALS['egw_info']['user']['preferences']['common']['template_custom_color'] ?? null,
|
|
|
|
$GLOBALS['egw_info']['user']['preferences']['common']['template_color'] ?? null);
|
2015-07-01 14:44:34 +02:00
|
|
|
|
2016-02-01 16:08:13 +01:00
|
|
|
// Create a dark variant of the color
|
2019-06-14 15:45:56 +02:00
|
|
|
$color_darker = empty($color) ? '' :$this->_color_shader($color, -30);
|
2016-02-01 16:08:13 +01:00
|
|
|
|
2021-10-07 10:14:08 +02:00
|
|
|
if (!empty($GLOBALS['egw_info']['user']['preferences']['common']['sidebox_custom_color']) && preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $GLOBALS['egw_info']['user']['preferences']['common']['sidebox_custom_color']))
|
2016-02-01 16:08:13 +01:00
|
|
|
{
|
|
|
|
$sidebox_color_hover = $GLOBALS['egw_info']['user']['preferences']['common']['sidebox_custom_color'];
|
|
|
|
$sidebox_color = $this->_color_shader($sidebox_color_hover, -30);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$sidebox_color_hover = $color;
|
|
|
|
$sidebox_color = $color_darker;
|
|
|
|
}
|
2021-10-07 10:14:08 +02:00
|
|
|
if (!empty($GLOBALS['egw_info']['user']['preferences']['common']['loginbox_custom_color']) && preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $GLOBALS['egw_info']['user']['preferences']['common']['loginbox_custom_color']))
|
2016-02-01 16:08:13 +01:00
|
|
|
{
|
|
|
|
$loginbox_color = $GLOBALS['egw_info']['user']['preferences']['common']['loginbox_custom_color'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$loginbox_color = $color_darker;
|
|
|
|
}
|
2021-10-07 10:14:08 +02:00
|
|
|
//always set header logo used in sharing regardless of custom color being set
|
|
|
|
$header = !empty($GLOBALS['egw_info']['server']['login_logo_header']) ? Api\Framework::get_login_logo_or_bg_url('login_logo_header', 'logo')
|
2020-03-26 13:01:59 +01:00
|
|
|
: Api\Framework::get_login_logo_or_bg_url('login_logo_file', 'logo');
|
|
|
|
$ret['app_css'] .= "
|
|
|
|
/*
|
|
|
|
sharing
|
|
|
|
*/
|
|
|
|
div#popupMainDiv:after {
|
|
|
|
background-image: url($header);
|
|
|
|
}
|
|
|
|
";
|
2015-07-01 14:44:34 +02:00
|
|
|
|
2019-06-14 15:22:21 +02:00
|
|
|
if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$color) || preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$loginbox_color)) // a little xss check
|
2014-12-18 18:13:49 +01:00
|
|
|
{
|
2016-04-07 22:42:06 +02:00
|
|
|
if (!Api\Header\UserAgent::mobile())
|
2016-03-18 13:29:20 +01:00
|
|
|
{
|
|
|
|
$ret['app_css'] .= "
|
2014-12-18 18:13:49 +01:00
|
|
|
/**
|
|
|
|
* theme changes to color pixelegg for color: $color
|
|
|
|
*/
|
2020-03-26 12:12:11 +01:00
|
|
|
/*
|
|
|
|
sharing
|
|
|
|
*/
|
|
|
|
div#popupMainDiv:before {
|
|
|
|
background-color: $color;
|
|
|
|
}
|
2014-12-18 18:13:49 +01:00
|
|
|
/*
|
|
|
|
-Top window framework header
|
|
|
|
-sidebar actiuve category :hover
|
|
|
|
-popup toolbar
|
|
|
|
*/
|
2017-02-20 11:53:52 +01:00
|
|
|
div#egw_fw_header, div.egw_fw_ui_category:hover,#loginMainDiv,
|
2016-04-07 11:13:26 +02:00
|
|
|
.et2_portlet .ui-widget-header{
|
2015-02-20 15:05:32 +01:00
|
|
|
background-color: $color !important;
|
2014-12-18 18:13:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*Login background*/
|
|
|
|
#loginMainDiv #divAppIconBar #divLogo img[src$='svg'] {
|
2016-02-01 16:08:13 +01:00
|
|
|
background-color: $color;
|
2014-12-18 18:13:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*Center box in login page*/
|
2017-11-23 17:21:15 +01:00
|
|
|
#loginMainDiv div#centerBox form{
|
2016-02-01 16:08:13 +01:00
|
|
|
background-color: $loginbox_color;
|
2014-12-18 18:13:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*Sidebar menu active category*/
|
2016-02-01 16:08:13 +01:00
|
|
|
#egw_fw_sidebar #egw_fw_sidemenu .egw_fw_ui_category_active:hover{
|
|
|
|
background-color: $sidebox_color_hover !important;
|
|
|
|
}
|
2015-02-20 15:05:32 +01:00
|
|
|
#egw_fw_sidebar #egw_fw_sidemenu .egw_fw_ui_category_active{
|
2016-02-01 16:08:13 +01:00
|
|
|
background-color: $sidebox_color !important;
|
2014-12-18 18:13:49 +01:00
|
|
|
}
|
2018-07-06 14:17:03 +02:00
|
|
|
.ui-datepicker div.ui-timepicker-div div.ui_tpicker_minute_slider span.ui-slider-handle,
|
|
|
|
.ui-datepicker table.ui-datepicker-calendar .ui-state-active,
|
|
|
|
.ui-datepicker div.ui-timepicker-div div.ui_tpicker_hour_slider span.ui-slider-handle,
|
|
|
|
.ui-widget-header {background-color: $sidebox_color;}
|
2016-01-15 10:10:24 +01:00
|
|
|
";
|
2016-03-18 13:29:20 +01:00
|
|
|
}
|
|
|
|
else
|
2016-02-10 14:37:36 +01:00
|
|
|
/* Mobile theme custom colors*/
|
|
|
|
{
|
2016-03-18 13:29:20 +01:00
|
|
|
$ret['app_css'] .= "
|
2016-01-15 10:10:24 +01:00
|
|
|
/* Mobile theme specific color changes */
|
|
|
|
|
2016-01-14 16:43:52 +01:00
|
|
|
/*nextmatch header and plus_button in mobile theme*/
|
|
|
|
body div.et2_nextmatch .search,
|
|
|
|
body div.et2_nextmatch .search button,
|
|
|
|
body button.plus_button,
|
|
|
|
body div.et2_nextmatch .search .nm_action_header,
|
|
|
|
body div.et2_nextmatch .search .nm_toggle_header,
|
2016-02-08 15:36:54 +01:00
|
|
|
body div.et2_nextmatch .search .nm_favorites_button,
|
2016-02-10 14:37:36 +01:00
|
|
|
body #loginMainDiv,
|
|
|
|
body #egw_fw_firstload,
|
|
|
|
body .dialogHeadbar{
|
2016-01-14 16:43:52 +01:00
|
|
|
background-color: $color;
|
2016-02-10 14:37:36 +01:00
|
|
|
}
|
|
|
|
body #egw_fw_sidebar #egw_fw_sidemenu .egw_fw_ui_category_active{background-color: $sidebox_color !important};
|
|
|
|
";
|
2016-02-17 17:50:54 +01:00
|
|
|
}
|
2014-12-18 18:13:49 +01:00
|
|
|
}
|
|
|
|
return $ret;
|
2014-07-02 12:37:50 +02:00
|
|
|
}
|
2014-07-25 11:57:50 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* displays a login screen
|
|
|
|
*
|
|
|
|
* Reimplemented to remove site_title from login box and display it as loginscreenmessage, if none set.
|
|
|
|
*
|
|
|
|
* @param string $extra_vars for login url
|
2015-07-01 14:44:34 +02:00
|
|
|
* @param string $change_passwd =null string with message to render input fields for password change
|
2014-07-25 11:57:50 +02:00
|
|
|
*/
|
2015-07-01 14:44:34 +02:00
|
|
|
function login_screen($extra_vars, $change_passwd=null)
|
2014-07-25 11:57:50 +02:00
|
|
|
{
|
|
|
|
if (empty($GLOBALS['loginscreenmessage']))
|
|
|
|
{
|
2019-08-09 15:52:19 +02:00
|
|
|
$GLOBALS['loginscreenmessage'] = $GLOBALS['egw_info']['server']['site_title'];
|
2014-07-25 11:57:50 +02:00
|
|
|
}
|
|
|
|
unset($GLOBALS['egw_info']['server']['site_title']);
|
|
|
|
|
2015-07-01 14:44:34 +02:00
|
|
|
return parent::login_screen($extra_vars, $change_passwd);
|
2014-07-25 11:57:50 +02:00
|
|
|
}
|
2013-11-11 19:45:33 +01:00
|
|
|
}
|