From 630e221d1b1fdfca6189c30267401ed28873edd2 Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Mon, 24 Dec 2001 00:17:41 +0000 Subject: [PATCH] Now in ui form (single layer) for mainscreen message --- admin/inc/class.uimainscreen.inc.php | 132 +++++++++++++++++++++++++++ admin/inc/hook_admin.inc.php | 2 +- 2 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 admin/inc/class.uimainscreen.inc.php diff --git a/admin/inc/class.uimainscreen.inc.php b/admin/inc/class.uimainscreen.inc.php new file mode 100644 index 0000000000..6436005310 --- /dev/null +++ b/admin/inc/class.uimainscreen.inc.php @@ -0,0 +1,132 @@ + True); + + function uimainscreen() + { + $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); + } + + function index() + { + if ($GLOBALS['HTTP_POST_VARS']['cancel']) + { + header('Location: ' . $GLOBALS['phpgw']->link('/admin/index.php')); + } + + $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'); + + $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(); + echo parse_navbar(); + + if ($GLOBALS['HTTP_POST_VARS']['submit']) + { + $GLOBALS['phpgw']->db->query("DELETE FROM lang WHERE message_id='$section" . "_message' AND app_name='" + . "$section' AND lang='$select_lang'",__LINE__,__FILE__); + $GLOBALS['phpgw']->db->query("INSERT INTO lang VALUES ('$section" . "_message','$section','$select_lang','" + . addslashes($message) . "')",__LINE__,__FILE__); + $message = '
'.lang('message has been updated').'
'; + } + + if (empty($select_lang)) + { + $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',' '); + $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); + + $select_lang = ''; + $GLOBALS['phpgw']->template->set_var('label',lang('Language')); + $GLOBALS['phpgw']->template->set_var('value',$select_lang); + $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 = ''; + $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',''); + $GLOBALS['phpgw']->template->fp('rows','row_2',True); + } + else + { + $GLOBALS['phpgw']->db->query("SELECT content FROM lang WHERE lang='$select_lang' AND message_id='$section" + . "_message'"); + $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); + $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); + $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); + $GLOBALS['phpgw']->template->set_var('value','' + ); + $GLOBALS['phpgw']->template->fp('rows','row_2',True); + } + + $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel')); + $GLOBALS['phpgw']->template->set_var('error_message',$message); + $GLOBALS['phpgw']->template->pfp('out','form'); + } + } +?> diff --git a/admin/inc/hook_admin.inc.php b/admin/inc/hook_admin.inc.php index 8285b84feb..5cc6b40c78 100644 --- a/admin/inc/hook_admin.inc.php +++ b/admin/inc/hook_admin.inc.php @@ -43,7 +43,7 @@ if (! $GLOBALS['phpgw']->acl->check('mainscreen_message_access',1,'admin')) { - $file['Change Main Screen Message'] = $GLOBALS['phpgw']->link('/admin/mainscreen_message.php'); + $file['Change Main Screen Message'] = $GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index'); } if (! $GLOBALS['phpgw']->acl->check('current_sessions_access',1,'admin'))