[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 | |
---|
| 13 | class uimainscreen |
---|
| 14 | { |
---|
| 15 | var $public_functions = array('index' => True); |
---|
| 16 | |
---|
| 17 | function uimainscreen() |
---|
| 18 | { |
---|
| 19 | $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); |
---|
| 20 | } |
---|
| 21 | |
---|
| 22 | function index() |
---|
| 23 | { |
---|
| 24 | |
---|
| 25 | $html = createObject('phpgwapi.html'); |
---|
| 26 | $section = addslashes($_POST['section']); |
---|
| 27 | $select_lang = addslashes($_POST['select_lang']); |
---|
| 28 | $message = addslashes($_POST['message']); |
---|
| 29 | |
---|
| 30 | if (!$GLOBALS['phpgw']->acl->check('mainscreen_message_access',2,'admin')) |
---|
| 31 | { |
---|
| 32 | $acl_ok['loginscreen'] = True; |
---|
| 33 | } |
---|
[1117] | 34 | if (!$GLOBALS['phpgw']->acl->check('mainscreen_message_access',3,'admin')) |
---|
| 35 | { |
---|
| 36 | $acl_ok['loginhelp'] = True; |
---|
| 37 | } |
---|
[2] | 38 | if ($_POST['cancel'] && !isset($_POST['message']) || |
---|
| 39 | !count($acl_ok) || $_POST['submit'] && !isset($acl_ok[$section])) |
---|
| 40 | { |
---|
| 41 | $GLOBALS['phpgw']->redirect_link('/admin/index.php'); |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | $GLOBALS['phpgw']->template->set_file(array('message' => 'mainscreen_message.tpl')); |
---|
| 45 | $GLOBALS['phpgw']->template->set_block('message','form','form'); |
---|
| 46 | $GLOBALS['phpgw']->template->set_block('message','row','row'); |
---|
| 47 | $GLOBALS['phpgw']->template->set_block('message','row_2','row_2'); |
---|
| 48 | |
---|
| 49 | if ($_POST['submit']) |
---|
| 50 | { |
---|
| 51 | $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_lang WHERE message_id='$section" . "_message' AND app_name='" |
---|
| 52 | . "$section' AND lang='$select_lang'",__LINE__,__FILE__); |
---|
[7109] | 53 | $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_lang (message_id,app_name,lang,content)" |
---|
| 54 | ."VALUES ('$section" . "_message','$section','$select_lang','". $message . "')", |
---|
| 55 | __LINE__, |
---|
| 56 | __FILE__); |
---|
| 57 | $feedback_message = '<center>'.lang('message has been updated').'</center>'; |
---|
[2] | 58 | |
---|
| 59 | $section = ''; |
---|
[7109] | 60 | |
---|
[2] | 61 | } |
---|
| 62 | if ($_POST['cancel']) // back to section/lang-selection |
---|
| 63 | { |
---|
| 64 | $message = $section = ''; |
---|
| 65 | } |
---|
| 66 | switch ($section) |
---|
| 67 | { |
---|
| 68 | case 'mainscreen': |
---|
| 69 | $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit main screen message') . ': '.strtoupper($select_lang); |
---|
| 70 | break; |
---|
| 71 | case 'loginscreen': |
---|
| 72 | $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit login screen message') . ': '.strtoupper($select_lang); |
---|
| 73 | break; |
---|
[1117] | 74 | case 'loginhelp': |
---|
| 75 | $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit login help message') . ': '.strtoupper($select_lang); |
---|
| 76 | break; |
---|
[2] | 77 | default: |
---|
| 78 | $GLOBALS['phpgw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Main screen message'); |
---|
| 79 | break; |
---|
| 80 | } |
---|
| 81 | if(!@is_object($GLOBALS['phpgw']->js)) |
---|
| 82 | { |
---|
| 83 | $GLOBALS['phpgw']->js = CreateObject('phpgwapi.javascript'); |
---|
| 84 | } |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | if (empty($section)) |
---|
| 90 | { |
---|
| 91 | |
---|
| 92 | $GLOBALS['phpgw']->js->validate_file('jscode','openwindow','admin'); |
---|
| 93 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 94 | echo parse_navbar(); |
---|
| 95 | |
---|
| 96 | |
---|
| 97 | $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index')); |
---|
| 98 | $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw_info']['theme']['th_bg']); |
---|
| 99 | $GLOBALS['phpgw']->template->set_var('value',' '); |
---|
| 100 | $GLOBALS['phpgw']->template->fp('rows','row_2',True); |
---|
| 101 | |
---|
| 102 | $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); |
---|
| 103 | $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); |
---|
| 104 | |
---|
| 105 | $lang_select = '<select name="select_lang">'; |
---|
| 106 | $GLOBALS['phpgw']->db->query("SELECT lang,phpgw_languages.lang_name,phpgw_languages.lang_id FROM phpgw_lang,phpgw_languages WHERE " |
---|
| 107 | . "phpgw_lang.lang=phpgw_languages.lang_id GROUP BY lang,phpgw_languages.lang_name," |
---|
| 108 | . "phpgw_languages.lang_id ORDER BY lang",__LINE__,__FILE__); |
---|
| 109 | while ($GLOBALS['phpgw']->db->next_record()) |
---|
| 110 | { |
---|
| 111 | $lang = $GLOBALS['phpgw']->db->f('lang'); |
---|
| 112 | $lang_select .= '<option value="' . $lang . '"'.($lang == $select_lang ? ' selected' : '').'>' . |
---|
| 113 | $lang . ' - ' . $GLOBALS['phpgw']->db->f('lang_name') . "</option>\n"; |
---|
| 114 | } |
---|
| 115 | $lang_select .= '</select>'; |
---|
| 116 | $GLOBALS['phpgw']->template->set_var('label',lang('Language')); |
---|
| 117 | $GLOBALS['phpgw']->template->set_var('value',$lang_select); |
---|
| 118 | $GLOBALS['phpgw']->template->fp('rows','row',True); |
---|
| 119 | |
---|
| 120 | $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); |
---|
| 121 | $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); |
---|
| 122 | $select_section = '<select name="section">'."\n"; |
---|
| 123 | foreach($acl_ok as $key => $val) |
---|
| 124 | { |
---|
| 125 | $select_section .= ' <option value="'.$key.'"'. |
---|
| 126 | ($key == $_POST['section'] ? ' selected' : '') . '>' . |
---|
[1362] | 127 | ($key == 'mainscreen' ? lang('Main screen') : lang($key)) . "</option>\n"; |
---|
[2] | 128 | } |
---|
| 129 | $select_section .= '</select>'; |
---|
| 130 | $GLOBALS['phpgw']->template->set_var('label',lang('Section')); |
---|
| 131 | $GLOBALS['phpgw']->template->set_var('value',$select_section); |
---|
| 132 | $GLOBALS['phpgw']->template->fp('rows','row',True); |
---|
| 133 | |
---|
| 134 | $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); |
---|
| 135 | $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); |
---|
| 136 | $GLOBALS['phpgw']->template->set_var('value','<input type="submit" value="' . lang('Edit') |
---|
| 137 | . '"><input type="submit" name="cancel" value="'. lang('cancel') .'">'); |
---|
| 138 | $GLOBALS['phpgw']->template->fp('rows','row_2',True); |
---|
| 139 | } |
---|
| 140 | else |
---|
| 141 | { |
---|
| 142 | $GLOBALS['phpgw']->db->query("SELECT content FROM phpgw_lang WHERE lang='$select_lang' AND message_id='$section" |
---|
| 143 | . "_message'",__LINE__,__FILE__); |
---|
| 144 | $GLOBALS['phpgw']->db->next_record(); |
---|
| 145 | |
---|
| 146 | $current_message = $GLOBALS['phpgw']->db->f('content'); |
---|
| 147 | |
---|
[5333] | 148 | $text_or_htmlarea.= '<script type="text/javascript" src="./library/ckeditor/ckeditor.js"></script>'; |
---|
| 149 | $text_or_htmlarea.= '<textarea name="message">'.$current_message.'</textarea>'; |
---|
| 150 | $text_or_htmlarea.= '<script type="text/javascript">'. |
---|
| 151 | 'CKEDITOR.replace( \'message\',{'. |
---|
| 152 | 'removePlugins : \'elementspath\','. |
---|
| 153 | 'skin : \'office2003\','. |
---|
| 154 | 'toolbar : \'Full\''. |
---|
| 155 | '}'. |
---|
| 156 | ');</script>'; |
---|
[2] | 157 | |
---|
| 158 | $GLOBALS['phpgw']->common->phpgw_header(); |
---|
| 159 | echo parse_navbar(); |
---|
| 160 | |
---|
| 161 | $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/index.php','menuaction=admin.uimainscreen.index')); |
---|
| 162 | $GLOBALS['phpgw']->template->set_var('select_lang',$select_lang); |
---|
| 163 | $GLOBALS['phpgw']->template->set_var('section',$section); |
---|
| 164 | $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw_info']['theme']['th_bg']); |
---|
| 165 | $GLOBALS['phpgw']->template->set_var('value',' '); |
---|
| 166 | $GLOBALS['phpgw']->template->fp('rows','row_2',True); |
---|
| 167 | |
---|
| 168 | $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); |
---|
| 169 | $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | $GLOBALS['phpgw']->template->set_var('value',$text_or_htmlarea); |
---|
| 173 | |
---|
| 174 | |
---|
| 175 | |
---|
| 176 | $GLOBALS['phpgw']->template->fp('rows','row_2',True); |
---|
| 177 | |
---|
| 178 | $tr_color = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color); |
---|
| 179 | $GLOBALS['phpgw']->template->set_var('tr_color',$tr_color); |
---|
| 180 | $GLOBALS['phpgw']->template->set_var('value','<input type="submit" name="submit" value="' . lang('Save') |
---|
[5333] | 181 | . '"><input type="submit" name="cancel" value="'. lang('cancel') .'">'); |
---|
[2] | 182 | $GLOBALS['phpgw']->template->fp('rows','row_2',True); |
---|
| 183 | } |
---|
| 184 | |
---|
| 185 | $GLOBALS['phpgw']->template->set_var('lang_cancel',lang('Cancel')); |
---|
| 186 | $GLOBALS['phpgw']->template->set_var('error_message',$feedback_message); |
---|
| 187 | $GLOBALS['phpgw']->template->pfp('out','form'); |
---|
| 188 | } |
---|
| 189 | } |
---|
| 190 | ?> |
---|