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$
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Stylite Pixelegg template
|
|
|
|
*/
|
|
|
|
class pixelegg_framework extends jdots_framework
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
}
|
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' &&
|
|
|
|
!(html::$ua_mobile || $GLOBALS['egw_info']['user']['preferences']['common']['theme'] == 'mobile'))
|
2014-01-06 11:36:18 +01:00
|
|
|
{
|
|
|
|
self::validate_file('/pixelegg/js/slider.js');
|
|
|
|
}
|
|
|
|
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
|
|
|
|
*
|
|
|
|
* @see egw_framework::_get_css()
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function _get_css()
|
|
|
|
{
|
2014-12-18 18:13:49 +01:00
|
|
|
$ret = parent::_get_css();
|
|
|
|
// color to use
|
|
|
|
$color = str_replace('custom',$GLOBALS['egw_info']['user']['preferences']['common']['template_custom_color'],
|
|
|
|
$GLOBALS['egw_info']['user']['preferences']['common']['template_color']);
|
2015-07-01 14:44:34 +02:00
|
|
|
|
2016-02-01 16:08:13 +01:00
|
|
|
// Create a dark variant of the color
|
|
|
|
$color_darker = $this->_color_shader($color, -30);
|
|
|
|
|
|
|
|
if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $GLOBALS['egw_info']['user']['preferences']['common']['sidebox_custom_color']))
|
|
|
|
{
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i', $GLOBALS['egw_info']['user']['preferences']['common']['loginbox_custom_color']))
|
|
|
|
{
|
|
|
|
$loginbox_color = $GLOBALS['egw_info']['user']['preferences']['common']['loginbox_custom_color'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$loginbox_color = $color_darker;
|
|
|
|
}
|
2015-07-01 14:44:34 +02:00
|
|
|
|
2014-12-18 18:13:49 +01:00
|
|
|
if (preg_match('/^(#[0-9A-F]+|[A-Z]+)$/i',$color)) // a little xss check
|
|
|
|
{
|
|
|
|
$ret['app_css'] = "
|
|
|
|
/**
|
|
|
|
* theme changes to color pixelegg for color: $color
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
-Top window framework header
|
|
|
|
-sidebar actiuve category :hover
|
|
|
|
-popup toolbar
|
|
|
|
*/
|
|
|
|
div#egw_fw_header, div.egw_fw_ui_category:hover,#loginMainDiv,#loginMainDiv #divAppIconBar #divLogo,
|
2015-02-20 17:06:18 +01:00
|
|
|
.dialogFooterToolbar, .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*/
|
|
|
|
#loginMainDiv div#centerBox {
|
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
|
|
|
}
|
2016-01-14 16:43:52 +01:00
|
|
|
|
2016-01-15 10:10:24 +01:00
|
|
|
|
|
|
|
";
|
2016-02-10 14:37:36 +01:00
|
|
|
/* Mobile theme custom colors*/
|
|
|
|
if (html::$ua_mobile)
|
|
|
|
{
|
|
|
|
$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};
|
|
|
|
";
|
|
|
|
}
|
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']))
|
|
|
|
{
|
|
|
|
$GLOBALS['loginscreenmessage'] = '<h1>'.$GLOBALS['egw_info']['server']['site_title'].'</h1>';
|
|
|
|
}
|
|
|
|
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
|
|
|
}
|