2001-12-24 01:17:41 +01:00
|
|
|
<?php
|
2015-01-09 19:58:23 +01:00
|
|
|
/**
|
|
|
|
* EGgroupware administration
|
|
|
|
*
|
|
|
|
* @link http://www.egroupware.org
|
|
|
|
* @package admin
|
|
|
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
2018-10-26 16:39:55 +02:00
|
|
|
* @author Hadi Nategh <hn@egroupware.org>
|
|
|
|
* @copyright (c) 2018, Hadi Nategh <hn@egroupware.org>
|
2015-01-09 19:58:23 +01:00
|
|
|
* @version $Id$
|
|
|
|
*/
|
|
|
|
|
2016-04-27 21:12:20 +02:00
|
|
|
use EGroupware\Api;
|
|
|
|
use EGroupware\Api\Framework;
|
2018-10-26 16:39:55 +02:00
|
|
|
use EGroupware\Api\Etemplate;
|
|
|
|
use EGroupware\Api\Egw;
|
2016-04-27 21:12:20 +02:00
|
|
|
|
2016-05-14 21:04:03 +02:00
|
|
|
/**
|
|
|
|
* Mainscreen and login message
|
|
|
|
*/
|
|
|
|
class admin_messages
|
2015-01-09 19:58:23 +01:00
|
|
|
{
|
|
|
|
var $public_functions = array('index' => True);
|
|
|
|
|
2018-10-26 16:39:55 +02:00
|
|
|
var $sections = array ('mainscreen', 'loginscreen');
|
2015-01-09 19:58:23 +01:00
|
|
|
|
2018-10-26 16:39:55 +02:00
|
|
|
const MAINSCREEN = 'mainscreen';
|
|
|
|
const LOGINSCREEN = 'loginscreen';
|
2015-01-09 19:58:23 +01:00
|
|
|
|
2018-10-26 16:39:55 +02:00
|
|
|
function index ($content = null)
|
|
|
|
{
|
|
|
|
$tpl = new Etemplate('admin.mainscreen_message');
|
2001-12-24 01:17:41 +01:00
|
|
|
|
2018-10-26 16:39:55 +02:00
|
|
|
$acls = array (
|
|
|
|
self::MAINSCREEN => !$GLOBALS['egw']->acl->check('mainscreen_messa',1,'admin'),
|
|
|
|
self::LOGINSCREEN => !$GLOBALS['egw']->acl->check('mainscreen_messa',2,'admin')
|
|
|
|
);
|
2001-12-24 01:17:41 +01:00
|
|
|
|
2018-10-26 16:39:55 +02:00
|
|
|
if (!is_array($content))
|
2015-01-09 19:58:23 +01:00
|
|
|
{
|
2001-12-24 01:17:41 +01:00
|
|
|
|
2018-10-26 16:39:55 +02:00
|
|
|
$content = array(
|
|
|
|
'html' => true,
|
|
|
|
'lang' => $GLOBALS['egw_info']['user']['preferences']['common']['lang']
|
|
|
|
);
|
2015-01-09 19:58:23 +01:00
|
|
|
}
|
2018-10-26 16:39:55 +02:00
|
|
|
else {
|
|
|
|
list($button) = @each($content['button']);
|
|
|
|
|
|
|
|
if ($button)
|
2001-12-24 01:17:41 +01:00
|
|
|
{
|
2018-10-26 16:39:55 +02:00
|
|
|
switch($button)
|
|
|
|
{
|
|
|
|
case 'apply':
|
|
|
|
case 'save':
|
|
|
|
foreach (self::$sections as $section)
|
|
|
|
{
|
|
|
|
$prefix = $content['html'] == true ? 'html_' : 'text_';
|
|
|
|
if ($content[$prefix.$section] && $content[$prefix.$section])
|
|
|
|
{
|
|
|
|
Api\Translation::write($content['lang'], $section, $section.'_message',$content[$prefix.$section]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Framework::message(lang('message has been updated'));
|
|
|
|
if ($button == 'apply') break;
|
|
|
|
//fall through
|
|
|
|
default:
|
|
|
|
Egw::redirect_link('/index.php', array(
|
|
|
|
'menuaction' => 'admin.admin_ui.index',
|
|
|
|
'ajax' => 'true'
|
|
|
|
), 'admin');
|
|
|
|
}
|
2001-12-24 01:17:41 +01:00
|
|
|
}
|
|
|
|
}
|
2018-10-26 16:39:55 +02:00
|
|
|
$readonlys = array(
|
|
|
|
'tabs' => array(
|
|
|
|
self::MAINSCREEN => !$acls[self::MAINSCREEN],
|
|
|
|
self::LOGINSCREEN => !$acls[self::LOGINSCREEN]
|
|
|
|
)
|
|
|
|
);
|
|
|
|
$tpl->exec('admin.admin_messages.index', $content, array(), $readonlys);
|
2001-12-24 01:17:41 +01:00
|
|
|
}
|
2015-01-09 19:58:23 +01:00
|
|
|
}
|