[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] admin/inc/class.uimainscreen.inc.php, 1.12
From: |
nomail |
Subject: |
[Phpgroupware-cvs] admin/inc/class.uimainscreen.inc.php, 1.12 |
Date: |
Thu, 30 Dec 2004 08:38:14 +0100 |
Update of /admin/inc
Modified Files:
Branch:
class.uimainscreen.inc.php
date: 2004/12/30 07:38:14; author: skwashd; state: Exp; lines: +68 -60
Log Message:
new HEAD admin - sans GIFs
=====================================================================
Index: admin/inc/class.uimainscreen.inc.php
diff -u admin/inc/class.uimainscreen.inc.php:1.11
admin/inc/class.uimainscreen.inc.php:1.12
--- admin/inc/class.uimainscreen.inc.php:1.11 Wed Nov 12 16:35:01 2003
+++ admin/inc/class.uimainscreen.inc.php Thu Dec 30 07:38:14 2004
@@ -1,46 +1,44 @@
<?php
-
/**************************************************************************\
- * phpGroupWare - Administration
*
- * http://www.phpgroupware.org
*
- * Written by coreteam <address@hidden> *
- * --------------------------------------------
*
- * 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$ */
+ /**************************************************************************\
+ * phpGroupWare - administration *
+ * http://www.phpgroupware.org *
+ * -------------------------------------------- *
+ * 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$ */
class uimainscreen
{
- var $public_functions = array
- (
- 'index' => True,
- 'mainscreen' => True
- );
+ var $public_functions = array('index' => True);
function uimainscreen()
{
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = True;
$GLOBALS['phpgw']->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
}
- function mainscreen()
+ function index()
{
- function display_section($appname,$file,$file2='')
+ $section = addslashes($_POST['section']);
+ $select_lang = addslashes($_POST['select_lang']);
+ $message = addslashes($_POST['message']);
+
+ $acl_ok = array();
+ if
(!$GLOBALS['phpgw']->acl->check('mainscreen_message_access',1,'admin'))
{
-
$GLOBALS['phpgw']->common->display_mainscreen($appname,$file2 ? $file2 : $file);
+ $acl_ok['mainscreen'] = True;
}
-
- $GLOBALS['phpgw']->hooks->process('admin');
-
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('list' =>
$GLOBALS['phpgw']->common->output));
- }
-
- function index()
- {
- if ($GLOBALS['HTTP_POST_VARS']['cancel'])
+ 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]))
{
- header('Location: ' .
$GLOBALS['phpgw']->link('/admin/index.php'));
+
$GLOBALS['phpgw']->redirect_link('/admin/index.php');
}
$GLOBALS['phpgw']->template->set_file(array('message'
=> 'mainscreen_message.tpl'));
@@ -48,24 +46,37 @@
$GLOBALS['phpgw']->template->set_block('message','row','row');
$GLOBALS['phpgw']->template->set_block('message','row_2','row_2');
- $section = $GLOBALS['HTTP_POST_VARS']['section'];
- $select_lang =
$GLOBALS['HTTP_POST_VARS']['select_lang'];
- $message = $GLOBALS['HTTP_POST_VARS']['message'];
-
- $GLOBALS['phpgw']->common->phpgw_header();
-
- if ($GLOBALS['HTTP_POST_VARS']['submit'])
+ if ($_POST['submit'])
{
$GLOBALS['phpgw']->db->query("DELETE FROM
phpgw_lang WHERE message_id='$section" . "_message' AND app_name='"
. "$section' AND
lang='$select_lang'",__LINE__,__FILE__);
$GLOBALS['phpgw']->db->query("INSERT INTO
phpgw_lang VALUES ('$section" . "_message','$section','$select_lang','"
- . addslashes($message) .
"')",__LINE__,__FILE__);
+ . $message . "')",__LINE__,__FILE__);
$message = '<center>'.lang('message has been
updated').'</center>';
+
+ $section = '';
}
+ 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;
+ }
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
- if (empty($select_lang))
+ if (empty($section))
{
-
$GLOBALS['phpgw']->template->set_var('header_lang',lang('Main screen message'));
$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index'));
$GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw_info']['theme']['th_bg']);
$GLOBALS['phpgw']->template->set_var('value',' ');
@@ -74,51 +85,48 @@
$tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
- $select_lang = '<select name="select_lang">';
+ $lang_select = '<select name="select_lang">';
$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,"
- . "phpgw_languages.lang_id ORDER BY
lang");
+ . "phpgw_languages.lang_id ORDER BY
lang",__LINE__,__FILE__);
while ($GLOBALS['phpgw']->db->next_record())
{
- $select_lang .= '<option value="' .
$GLOBALS['phpgw']->db->f('lang') . '">' . $GLOBALS['phpgw']->db->f('lang_id')
- . ' - ' .
$GLOBALS['phpgw']->db->f('lang_name') . '</option>';
+ $lang =
$GLOBALS['phpgw']->db->f('lang');
+ $lang_select .= '<option value="' .
$lang . '"'.($lang == $select_lang ? ' selected' : '').'>' .
+ $lang . ' - ' .
$GLOBALS['phpgw']->db->f('lang_name') . "</option>\n";
}
- $select_lang .= '</select>';
+ $lang_select .= '</select>';
$GLOBALS['phpgw']->template->set_var('label',lang('Language'));
-
$GLOBALS['phpgw']->template->set_var('value',$select_lang);
+
$GLOBALS['phpgw']->template->set_var('value',$lang_select);
$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);
- $select_section = '<select
name="section"><option value="mainscreen">' . lang('Main screen')
- . '</option><option
value="loginscreen">' . lang("Login screen") . '</option>'
- . '</select>';
+ $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>';
$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);
-
$GLOBALS['phpgw']->template->set_var('value','<input type="submit" value="' .
lang('Submit')
+
$GLOBALS['phpgw']->template->set_var('value','<input type="submit" value="' .
lang('Edit')
. '"><input type="submit" name="cancel"
value="'. lang('cancel') .'">');
$GLOBALS['phpgw']->template->fp('rows','row_2',True);
}
else
{
$GLOBALS['phpgw']->db->query("SELECT content
FROM phpgw_lang WHERE lang='$select_lang' AND message_id='$section"
- . "_message'");
+ . "_message'",__LINE__,__FILE__);
$GLOBALS['phpgw']->db->next_record();
$current_message =
$GLOBALS['phpgw']->db->f('content');
- if ($section == 'mainscreen')
- {
-
$GLOBALS['phpgw']->template->set_var('header_lang',lang('Edit main screen
message'));
- }
- else
- {
-
$GLOBALS['phpgw']->template->set_var('header_lang',lang('Edit login screen
message'));
- }
-
$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);
@@ -133,7 +141,7 @@
$tr_color =
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
$GLOBALS['phpgw']->template->set_var('tr_color',$tr_color);
-
$GLOBALS['phpgw']->template->set_var('value','<input type="submit"
name="submit" value="' . lang('Update')
+
$GLOBALS['phpgw']->template->set_var('value','<input type="submit"
name="submit" value="' . lang('Save')
. '"><input type="submit" name="cancel"
value="'. lang('cancel') .'">'
);
$GLOBALS['phpgw']->template->fp('rows','row_2',True);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] admin/inc/class.uimainscreen.inc.php, 1.12,
nomail <=