2001-12-24 01:17:41 +01:00
|
|
|
<?php
|
2003-08-28 16:16:30 +02:00
|
|
|
/**************************************************************************\
|
2004-01-27 00:26:19 +01:00
|
|
|
* eGroupWare - administration *
|
|
|
|
* http://www.egroupware.org *
|
2003-08-28 16:16:30 +02:00
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
2001-12-24 01:17:41 +01:00
|
|
|
|
|
|
|
class uimainscreen
|
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
var $public_functions = array('index' => True);
|
2001-12-24 01:17:41 +01:00
|
|
|
|
|
|
|
function uimainscreen()
|
|
|
|
{
|
|
|
|
$GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
|
|
|
}
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
function index()
|
2003-04-23 03:08:32 +02:00
|
|
|
{
|
2004-04-22 02:19:50 +02:00
|
|
|
|
2004-05-19 11:33:56 +02:00
|
|
|
$html = createObject('phpgwapi.html');
|
|
|
|
$section = addslashes($_POST['section']);
|
2003-08-28 16:16:30 +02:00
|
|
|
$select_lang = addslashes($_POST['select_lang']);
|
|
|
|
$message = addslashes($_POST['message']);
|
|
|
|
|
|
|
|
$acl_ok = array();
|
|
|
|
if (!$GLOBALS['phpgw']->acl->check('mainscreen_message_access',1,'admin'))
|
2003-04-26 10:56:28 +02:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$acl_ok['mainscreen'] = True;
|
2003-04-26 10:56:28 +02:00
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
if (!$GLOBALS['phpgw']->acl->check('mainscreen_message_access',2,'admin'))
|
|
|
|
{
|
|
|
|
$acl_ok['loginscreen'] = True;
|
|
|
|
}
|
|
|
|
if ($_POST['cancel'] && !isset($_POST['message']) ||
|
|
|
|
!count($acl_ok) || $_POST['submit'] && !isset($acl_ok[$section]))
|
2001-12-24 01:17:41 +01:00
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
|
2001-12-24 01:17:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$GLOBALS['phpgw']->template->set_file(array('message' => 'mainscreen_message.tpl'));
|
|
|
|
$GLOBALS['phpgw']->template->set_block('message','form','form');
|
|
|
|
$GLOBALS['phpgw']->template->set_block('message','row','row');
|
|
|
|
$GLOBALS['phpgw']->template->set_block('message','row_2','row_2');
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_POST['submit'])
|
2001-12-24 01:17:41 +01:00
|
|
|
{
|
2002-02-23 18:19:28 +01:00
|
|
|
$GLOBALS['phpgw']->db->query("DELETE FROM phpgw_lang WHERE message_id='$section" . "_message' AND app_name='"
|
2001-12-24 01:17:41 +01:00
|
|
|
. "$section' AND lang='$select_lang'",__LINE__,__FILE__);
|
2004-05-19 11:33:56 +02:00
|
|
|
$GLOBALS['phpgw']->db->query("INSERT INTO phpgw_lang (message_id,app_name,lang,content)VALUES ('$section" . "_message','$section','$select_lang','"
|
2003-08-28 16:16:30 +02:00
|
|
|
. $message . "')",__LINE__,__FILE__);
|
2004-04-22 02:19:50 +02:00
|
|
|
$feedback_message = '<center>'.lang('message has been updated').'</center>';
|
2003-08-28 16:16:30 +02:00
|
|
|
|
|
|
|
$section = '';
|
2001-12-24 01:17:41 +01:00
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
if ($_POST['cancel']) // back to section/lang-selection
|
|
|
|
{
|
|
|
|
$message = $section = '';
|
|
|
|
}
|
|
|
|
switch ($section)
|
|
|
|
{
|
|
|
|
case 'mainscreen':
|
|
|
|
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit main screen message') . ': '.strtoupper($select_lang);
|
|
|
|
break;
|
|
|
|
case 'loginscreen':
|
|
|
|
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit login screen message') . ': '.strtoupper($select_lang);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Main screen message');
|
|
|
|
break;
|
|
|
|
}
|
2004-02-26 10:01:42 +01:00
|
|
|
if(!@is_object($GLOBALS['phpgw']->js))
|
|
|
|
{
|
|
|
|
$GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript');
|
|
|
|
}
|
2001-12-24 01:17:41 +01:00
|
|
|
|
2004-04-22 02:19:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
if (empty($section))
|
2001-12-24 01:17:41 +01:00
|
|
|
{
|
2004-04-22 02:19:50 +02:00
|
|
|
|
|
|
|
$GLOBALS['phpgw']->js->validate_file('jscode','openwindow','admin');
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_header();
|
|
|
|
echo parse_navbar();
|
|
|
|
|
|
|
|
|
|
|
|
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index'));
|
2001-12-24 01:17:41 +01:00
|
|
|
$GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw_info']['theme']['th_bg']);
|
|
|
|
$GLOBALS['phpgw']->template->set_var('value',' ');
|
|
|
|
$GLOBALS['phpgw']->template->fp('rows','row_2',True);
|
|
|
|
|
|
|
|
$tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
|
|
|
|
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
|
|
|
|
|
2003-08-28 16:16:30 +02:00
|
|
|
$lang_select = '<select name="select_lang">';
|
2002-02-23 18:17:02 +01:00
|
|
|
$GLOBALS['phpgw']->db->query("SELECT lang,phpgw_languages.lang_name,phpgw_languages.lang_id FROM phpgw_lang,phpgw_languages WHERE "
|
|
|
|
. "phpgw_lang.lang=phpgw_languages.lang_id GROUP BY lang,phpgw_languages.lang_name,"
|
2003-08-28 16:16:30 +02:00
|
|
|
. "phpgw_languages.lang_id ORDER BY lang",__LINE__,__FILE__);
|
2001-12-24 01:17:41 +01:00
|
|
|
while ($GLOBALS['phpgw']->db->next_record())
|
|
|
|
{
|
2003-08-28 16:16:30 +02:00
|
|
|
$lang = $GLOBALS['phpgw']->db->f('lang');
|
|
|
|
$lang_select .= '<option value="' . $lang . '"'.($lang == $select_lang ? ' selected' : '').'>' .
|
|
|
|
$lang . ' - ' . $GLOBALS['phpgw']->db->f('lang_name') . "</option>\n";
|
2001-12-24 01:17:41 +01:00
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
$lang_select .= '</select>';
|
2001-12-24 01:17:41 +01:00
|
|
|
$GLOBALS['phpgw']->template->set_var('label',lang('Language'));
|
2003-08-28 16:16:30 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('value',$lang_select);
|
2001-12-24 01:17:41 +01:00
|
|
|
$GLOBALS['phpgw']->template->fp('rows','row',True);
|
|
|
|
|
|
|
|
$tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
|
|
|
|
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
|
2003-08-28 16:16:30 +02:00
|
|
|
$select_section = '<select name="section">'."\n";
|
|
|
|
foreach($acl_ok as $key => $val)
|
|
|
|
{
|
|
|
|
$select_section .= ' <option value="'.$key.'"'.
|
|
|
|
($key == $_POST['section'] ? ' selected' : '') . '>' .
|
|
|
|
($key == 'mainscreen' ? lang('Main screen') : lang("Login screen")) . "</option>\n";
|
|
|
|
}
|
|
|
|
$select_section .= '</select>';
|
2001-12-24 01:17:41 +01:00
|
|
|
$GLOBALS['phpgw']->template->set_var('label',lang('Section'));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('value',$select_section);
|
|
|
|
$GLOBALS['phpgw']->template->fp('rows','row',True);
|
|
|
|
|
|
|
|
$tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
|
|
|
|
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
|
2003-08-28 16:16:30 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('value','<input type="submit" value="' . lang('Edit')
|
2001-12-24 01:17:41 +01:00
|
|
|
. '"><input type="submit" name="cancel" value="'. lang('cancel') .'">');
|
|
|
|
$GLOBALS['phpgw']->template->fp('rows','row_2',True);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-04-22 02:19:50 +02:00
|
|
|
$GLOBALS['phpgw']->db->query("SELECT content FROM phpgw_lang WHERE lang='$select_lang' AND message_id='$section"
|
2003-08-28 16:16:30 +02:00
|
|
|
. "_message'",__LINE__,__FILE__);
|
2001-12-24 01:17:41 +01:00
|
|
|
$GLOBALS['phpgw']->db->next_record();
|
2004-04-22 02:19:50 +02:00
|
|
|
|
2001-12-24 01:17:41 +01:00
|
|
|
$current_message = $GLOBALS['phpgw']->db->f('content');
|
2004-04-22 02:19:50 +02:00
|
|
|
|
2004-07-11 10:33:28 +02:00
|
|
|
if($_POST['htmlarea'])
|
2004-04-22 02:19:50 +02:00
|
|
|
{
|
2004-08-28 15:35:02 +02:00
|
|
|
$text_or_htmlarea=$html->htmlarea('message',stripslashes($current_message));
|
2004-07-11 10:33:28 +02:00
|
|
|
$htmlarea_button='<input type="submit" name="no-htmlarea" onclick="self.location.href=\''.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index&htmlarea=true').'\'" value="'.lang('disable WYSIWYG-editor').'">';
|
2004-04-22 02:19:50 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$text_or_htmlarea='<textarea name="message" style="width:100%; min-width:350px; height:300px;" wrap="virtual">' . stripslashes($current_message) . '</textarea>';
|
2004-07-11 10:33:28 +02:00
|
|
|
$htmlarea_button='<input type="submit" name="htmlarea" onclick="self.location.href=\''.$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index&htmlarea=true').'\'" value="'.lang('activate WYSIWYG-editor').'">';
|
2004-04-22 02:19:50 +02:00
|
|
|
|
|
|
|
}
|
2001-12-24 01:17:41 +01:00
|
|
|
|
2004-04-22 02:19:50 +02:00
|
|
|
$GLOBALS['phpgw']->js->validate_file('jscode','openwindow','admin');
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_header();
|
|
|
|
echo parse_navbar();
|
|
|
|
|
2001-12-24 01:17:41 +01:00
|
|
|
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index'));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('select_lang',$select_lang);
|
|
|
|
$GLOBALS['phpgw']->template->set_var('section',$section);
|
|
|
|
$GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw_info']['theme']['th_bg']);
|
|
|
|
$GLOBALS['phpgw']->template->set_var('value',' ');
|
|
|
|
$GLOBALS['phpgw']->template->fp('rows','row_2',True);
|
|
|
|
|
|
|
|
$tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
|
|
|
|
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
|
2004-04-22 02:19:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
$GLOBALS['phpgw']->template->set_var('value',$text_or_htmlarea);
|
|
|
|
|
|
|
|
|
|
|
|
|
2001-12-24 01:17:41 +01:00
|
|
|
$GLOBALS['phpgw']->template->fp('rows','row_2',True);
|
|
|
|
|
|
|
|
$tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
|
|
|
|
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
|
2003-08-28 16:16:30 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('value','<input type="submit" name="submit" value="' . lang('Save')
|
2004-04-22 02:19:50 +02:00
|
|
|
. '"><input type="submit" name="cancel" value="'. lang('cancel') .'">'.$htmlarea_button);
|
2001-12-24 01:17:41 +01:00
|
|
|
$GLOBALS['phpgw']->template->fp('rows','row_2',True);
|
|
|
|
}
|
|
|
|
|
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel'));
|
2004-04-22 02:19:50 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('error_message',$feedback_message);
|
2001-12-24 01:17:41 +01:00
|
|
|
$GLOBALS['phpgw']->template->pfp('out','form');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|