True); function uimainscreen() { $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); } function index() { $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')) { $acl_ok['mainscreen'] = True; } 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])) { $GLOBALS['phpgw']->redirect_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'); 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','" . $message . "')",__LINE__,__FILE__); $message = '
'.lang('message has been updated').'
'; $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; } if(!@is_object($GLOBALS['phpgw']->js)) { $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); } $GLOBALS['phpgw']->js->validate_file('jscode','openwindow','admin'); $GLOBALS['phpgw']->common->phpgw_header(); echo parse_navbar(); if (empty($section)) { $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); $lang_select = ''; $GLOBALS['phpgw']->template->set_var('label',lang('Language')); $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 = ''; $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 phpgw_lang WHERE lang='$select_lang' AND message_id='$section" . "_message'",__LINE__,__FILE__); $GLOBALS['phpgw']->db->next_record(); $current_message = $GLOBALS['phpgw']->db->f('content'); $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'); } } ?>