[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare - administration * 4 * http://www.egroupware.org * 5 * -------------------------------------------- * 6 * This program is free software; you can redistribute it and/or modify it * 7 * under the terms of the GNU General Public License as published by the * 8 * Free Software Foundation; either version 2 of the License, or (at your * 9 * option) any later version. * 10 \**************************************************************************/ 11 12 /* $Id: class.uimainscreen.inc.php 20969 2006-04-06 07:55:29Z ralfbecker $ */ 13 14 class uimainscreen 15 { 16 var $public_functions = array('index' => True); 17 18 function uimainscreen() 19 { 20 $GLOBALS['egw']->nextmatchs =& CreateObject('phpgwapi.nextmatchs'); 21 } 22 23 function index() 24 { 25 26 $html =& CreateObject('phpgwapi.html'); 27 $section = $_POST['section']; 28 $select_lang = $_POST['select_lang']; 29 $message = get_magic_quotes_gpc() ? stripslashes($_POST['message']) : $_POST['message']; 30 31 $acl_ok = array(); 32 if (!$GLOBALS['egw']->acl->check('mainscreen_message_access',1,'admin')) 33 { 34 $acl_ok['mainscreen'] = True; 35 } 36 if (!$GLOBALS['egw']->acl->check('mainscreen_message_access',2,'admin')) 37 { 38 $acl_ok['loginscreen'] = True; 39 } 40 if ($_POST['cancel'] && !isset($_POST['message']) || 41 !count($acl_ok) || $_POST['submit'] && !isset($acl_ok[$section])) 42 { 43 $GLOBALS['egw']->redirect_link('/admin/index.php'); 44 } 45 46 $GLOBALS['egw']->template->set_file(array('message' => 'mainscreen_message.tpl')); 47 $GLOBALS['egw']->template->set_block('message','form','form'); 48 $GLOBALS['egw']->template->set_block('message','row','row'); 49 $GLOBALS['egw']->template->set_block('message','row_2','row_2'); 50 51 if ($_POST['submit']) 52 { 53 $GLOBALS['egw']->translation->write($select_lang,$section,$section.'_message',$message); 54 $feedback_message = '<center>'.lang('message has been updated').'</center>'; 55 56 $section = ''; 57 } 58 if ($_POST['cancel']) // back to section/lang-selection 59 { 60 $message = $section = ''; 61 } 62 switch ($section) 63 { 64 case 'mainscreen': 65 $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit main screen message') . ': '.strtoupper($select_lang); 66 break; 67 case 'loginscreen': 68 $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit login screen message') . ': '.strtoupper($select_lang); 69 break; 70 default: 71 $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Main screen message'); 72 break; 73 } 74 if(!@is_object($GLOBALS['egw']->js)) 75 { 76 $GLOBALS['egw']->js =& CreateObject('phpgwapi.javascript'); 77 } 78 if (empty($section)) 79 { 80 81 $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); 82 $GLOBALS['egw']->common->egw_header(); 83 echo parse_navbar(); 84 85 86 $GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uimainscreen.index')); 87 $GLOBALS['egw']->template->set_var('tr_color',$GLOBALS['egw_info']['theme']['th_bg']); 88 $GLOBALS['egw']->template->set_var('value',' '); 89 $GLOBALS['egw']->template->fp('rows','row_2',True); 90 91 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 92 $GLOBALS['egw']->template->set_var('tr_color',$tr_color); 93 94 $lang_select = '<select name="select_lang">'; 95 foreach($GLOBALS['egw']->translation->get_installed_langs() as $lang => $lang_name) 96 { 97 $lang_select .= '<option value="' . $lang . '"'.($lang == $select_lang ? ' selected="selected"' : '').'>' . 98 $lang . ' - ' . $lang_name . "</option>\n"; 99 } 100 $lang_select .= '</select>'; 101 102 $GLOBALS['egw']->template->set_var('label',lang('Language')); 103 $GLOBALS['egw']->template->set_var('value',$lang_select); 104 $GLOBALS['egw']->template->fp('rows','row',True); 105 106 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 107 $GLOBALS['egw']->template->set_var('tr_color',$tr_color); 108 $select_section = '<select name="section">'."\n"; 109 foreach($acl_ok as $key => $val) 110 { 111 $select_section .= ' <option value="'.$key.'"'. 112 ($key == $_POST['section'] ? ' selected' : '') . '>' . 113 ($key == 'mainscreen' ? lang('Main screen') : lang("Login screen")) . "</option>\n"; 114 } 115 $select_section .= '</select>'; 116 $GLOBALS['egw']->template->set_var('label',lang('Section')); 117 $GLOBALS['egw']->template->set_var('value',$select_section); 118 $GLOBALS['egw']->template->fp('rows','row',True); 119 120 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 121 $GLOBALS['egw']->template->set_var('tr_color',$tr_color); 122 $GLOBALS['egw']->template->set_var('value','<input type="submit" value="' . lang('Edit') 123 . '"><input type="submit" name="cancel" value="'. lang('cancel') .'">'); 124 $GLOBALS['egw']->template->fp('rows','row_2',True); 125 } 126 else 127 { 128 $current_message = $GLOBALS['egw']->translation->read($select_lang,$section,$section.'_message'); 129 130 if($_POST['htmlarea']) 131 { 132 $text_or_htmlarea=$html->htmlarea('message',$html->htmlspecialchars($current_message)); 133 $htmlarea_button='<input type="submit" name="no-htmlarea" onclick="self.location.href=\''.$GLOBALS['egw']->link('/index.php','menuaction=admin.uimainscreen.index&htmlarea=true').'\'" value="'.lang('disable WYSIWYG-editor').'">'; 134 } 135 else 136 { 137 $text_or_htmlarea='<textarea name="message" style="width:100%; min-width:350px; height:300px;" wrap="virtual">' . $html->htmlspecialchars($current_message) . '</textarea>'; 138 $htmlarea_button='<input type="submit" name="htmlarea" onclick="self.location.href=\''.$GLOBALS['egw']->link('/index.php','menuaction=admin.uimainscreen.index&htmlarea=true').'\'" value="'.lang('activate WYSIWYG-editor').'">'; 139 140 } 141 142 $GLOBALS['egw']->js->validate_file('jscode','openwindow','admin'); 143 $GLOBALS['egw']->common->egw_header(); 144 echo parse_navbar(); 145 146 $GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uimainscreen.index')); 147 $GLOBALS['egw']->template->set_var('select_lang',$select_lang); 148 $GLOBALS['egw']->template->set_var('section',$section); 149 $GLOBALS['egw']->template->set_var('tr_color',$GLOBALS['egw_info']['theme']['th_bg']); 150 $GLOBALS['egw']->template->set_var('value',' '); 151 $GLOBALS['egw']->template->fp('rows','row_2',True); 152 153 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 154 $GLOBALS['egw']->template->set_var('tr_color',$tr_color); 155 156 157 $GLOBALS['egw']->template->set_var('value',$text_or_htmlarea); 158 159 160 161 $GLOBALS['egw']->template->fp('rows','row_2',True); 162 163 $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); 164 $GLOBALS['egw']->template->set_var('tr_color',$tr_color); 165 $GLOBALS['egw']->template->set_var('value','<input type="submit" name="submit" value="' . lang('Save') 166 . '"><input type="submit" name="cancel" value="'. lang('cancel') .'">'.$htmlarea_button); 167 $GLOBALS['egw']->template->fp('rows','row_2',True); 168 } 169 170 $GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel')); 171 $GLOBALS['egw']->template->set_var('error_message',$feedback_message); 172 $GLOBALS['egw']->template->pfp('out','form'); 173 } 174 } 175 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |