From 85bcd0200d158e5f3089c6d62dce230226669ff0 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 9 Jan 2015 18:58:23 +0000 Subject: [PATCH] modernized login- and start-message editing a bit --- admin/inc/class.uimainscreen.inc.php | 270 ++++++++---------- .../templates/default/mainscreen_message.tpl | 11 +- etemplate/js/et2_widget_button.js | 2 +- phpgwapi/inc/class.html.inc.php | 2 +- phpgwapi/js/jsapi/egw.js | 8 +- 5 files changed, 132 insertions(+), 161 deletions(-) diff --git a/admin/inc/class.uimainscreen.inc.php b/admin/inc/class.uimainscreen.inc.php index c0268d6911..7811197295 100644 --- a/admin/inc/class.uimainscreen.inc.php +++ b/admin/inc/class.uimainscreen.inc.php @@ -1,164 +1,136 @@ True); - class uimainscreen + function index() { - var $public_functions = array('index' => True); - - function index() + $section = $_POST['section']; + $select_lang = $_POST['select_lang']; + $message = get_magic_quotes_gpc() ? stripslashes($_POST['message']) : $_POST['message']; + $acl_ok = array(); + if (!$GLOBALS['egw']->acl->check('mainscreen_message_access',1,'admin')) { - $section = $_POST['section']; - $select_lang = $_POST['select_lang']; - $message = get_magic_quotes_gpc() ? stripslashes($_POST['message']) : $_POST['message']; - $acl_ok = array(); - if (!$GLOBALS['egw']->acl->check('mainscreen_message_access',1,'admin')) + $acl_ok['mainscreen'] = True; + } + if (!$GLOBALS['egw']->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['egw']->redirect_link('/admin/index.php'); + } + + egw_framework::validate_file('ckeditor','ckeditor','phpgwapi'); + + $GLOBALS['egw']->template->set_file(array('message' => 'mainscreen_message.tpl')); + $GLOBALS['egw']->template->set_block('message','form','form'); + $GLOBALS['egw']->template->set_block('message','row','row'); + $GLOBALS['egw']->template->set_block('message','row_2','row_2'); + + if ($_POST['save']) + { + translation::write($select_lang,$section,$section.'_message',$message); + egw_framework::message(lang('message has been updated')); + + $section = ''; + } + if ($_POST['cancel']) // back to section/lang-selection + { + $message = $section = ''; + } + switch ($section) + { + case 'mainscreen': + $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit main screen message') . ': '.strtoupper($select_lang); + break; + case 'loginscreen': + $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit login screen message') . ': '.strtoupper($select_lang); + break; + default: + $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Main screen message'); + break; + } + if (empty($section)) + { + common::egw_header(); + echo parse_navbar(); + + $GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uimainscreen.index')); + $GLOBALS['egw']->template->set_var('value',' '); + $GLOBALS['egw']->template->fp('rows','row_2',True); + + $langs = translation::get_installed_langs(); + $langs['en'] .= ' ('.lang('All languages').')'; + $lang_select = html::select('select_lang', 'en', $langs); + + $GLOBALS['egw']->template->set_var('label',lang('Language')); + $GLOBALS['egw']->template->set_var('value',$lang_select); + $GLOBALS['egw']->template->fp('rows','row',True); + + $select_section = ''; + $GLOBALS['egw']->template->set_var('label',lang('Section')); + $GLOBALS['egw']->template->set_var('value',$select_section); + $GLOBALS['egw']->template->fp('rows','row',True); + + $GLOBALS['egw']->template->set_var('value', + html::submit_button('edit', lang('Edit'))."\n".html::submit_button('cancel', lang('Cancel'))); + $GLOBALS['egw']->template->fp('rows','row_2',True); + } + else + { + $current_message = translation::read($select_lang,$section,$section.'_message'); + if ($_POST['no']) $current_message = strip_tags($current_message); + if (empty($_POST['no']) && ($_POST['yes'] || empty($current_message) || + strlen($current_message) != strlen(strip_tags($current_message)))) { - $acl_ok['loginscreen'] = True; - } - if ($_POST['cancel'] && !isset($_POST['message']) || - !count($acl_ok) || $_POST['submit'] && !isset($acl_ok[$section])) - { - $GLOBALS['egw']->redirect_link('/admin/index.php'); - } - - egw_framework::validate_file('ckeditor','ckeditor','phpgwapi'); - - $GLOBALS['egw']->template->set_file(array('message' => 'mainscreen_message.tpl')); - $GLOBALS['egw']->template->set_block('message','form','form'); - $GLOBALS['egw']->template->set_block('message','row','row'); - $GLOBALS['egw']->template->set_block('message','row_2','row_2'); - - if ($_POST['submit']) - { - $GLOBALS['egw']->translation->write($select_lang,$section,$section.'_message',$message); - $feedback_message = '
'.lang('message has been updated').'
'; - - $section = ''; - } - if ($_POST['cancel']) // back to section/lang-selection - { - $message = $section = ''; - } - switch ($section) - { - case 'mainscreen': - $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit main screen message') . ': '.strtoupper($select_lang); - break; - case 'loginscreen': - $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Edit login screen message') . ': '.strtoupper($select_lang); - break; - default: - $GLOBALS['egw_info']['flags']['app_header'] = lang('Admin').' - '.lang('Main screen message'); - break; - } - if (empty($section)) - { - $GLOBALS['egw']->common->egw_header(); - echo parse_navbar(); - - - $GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uimainscreen.index')); - $GLOBALS['egw']->template->set_var('tr_color',$GLOBALS['egw_info']['theme']['th_bg']); - $GLOBALS['egw']->template->set_var('value',' '); - $GLOBALS['egw']->template->fp('rows','row_2',True); - - $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); - $GLOBALS['egw']->template->set_var('tr_color',$tr_color); - - $lang_select = ''; - - $GLOBALS['egw']->template->set_var('label',lang('Language')); - $GLOBALS['egw']->template->set_var('value',$lang_select); - $GLOBALS['egw']->template->fp('rows','row',True); - - $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); - $GLOBALS['egw']->template->set_var('tr_color',$tr_color); - $select_section = ''; - $GLOBALS['egw']->template->set_var('label',lang('Section')); - $GLOBALS['egw']->template->set_var('value',$select_section); - $GLOBALS['egw']->template->fp('rows','row',True); - - $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); - $GLOBALS['egw']->template->set_var('tr_color',$tr_color); - $GLOBALS['egw']->template->set_var('value',''); - $GLOBALS['egw']->template->fp('rows','row_2',True); + $text_or_htmlarea = html::fckEditorQuick('message','advanced',$current_message,'400px','800px'); + $htmlarea_button = html::submit_button("no", lang('disable WYSIWYG-editor')); } else { - $current_message = $GLOBALS['egw']->translation->read($select_lang,$section,$section.'_message'); - if ($_POST['no-htmlarea']) $current_message = strip_tags($current_message); - if($_POST['htmlarea'] || strlen($current_message) > strlen(strip_tags($current_message))) - { - $text_or_htmlarea = html::fckEditorQuick('message','advanced',$current_message,'400px','800px'); - $htmlarea_button=''; - } - else - { - $text_or_htmlarea=''; - $htmlarea_button=''; - } - $GLOBALS['egw']->common->egw_header(); - echo parse_navbar(); - - $GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uimainscreen.index')); - $GLOBALS['egw']->template->set_var('select_lang',$select_lang); - $GLOBALS['egw']->template->set_var('section',$section); - $GLOBALS['egw']->template->set_var('tr_color',$GLOBALS['egw_info']['theme']['th_bg']); - $GLOBALS['egw']->template->set_var('value',' '); - $GLOBALS['egw']->template->fp('rows','row_2',True); - - $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); - $GLOBALS['egw']->template->set_var('tr_color',$tr_color); - - - $GLOBALS['egw']->template->set_var('value',$text_or_htmlarea); - - - - $GLOBALS['egw']->template->fp('rows','row_2',True); - - $tr_color = $GLOBALS['egw']->nextmatchs->alternate_row_color($tr_color); - $GLOBALS['egw']->template->set_var('tr_color',$tr_color); - $GLOBALS['egw']->template->set_var('value',''.$htmlarea_button); - $GLOBALS['egw']->template->fp('rows','row_2',True); + $text_or_htmlarea=''; + $htmlarea_button = html::submit_button("yes", lang('activate WYSIWYG-editor')); } + common::egw_header(); + echo parse_navbar(); - $GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel')); - $GLOBALS['egw']->template->set_var('error_message',$feedback_message); - $GLOBALS['egw']->template->pparse('out','form'); + $GLOBALS['egw']->template->set_var('form_action',$GLOBALS['egw']->link('/index.php','menuaction=admin.uimainscreen.index')); + $GLOBALS['egw']->template->set_var('select_lang',$select_lang); + $GLOBALS['egw']->template->set_var('section',$section); + $GLOBALS['egw']->template->set_var('value',' '); + $GLOBALS['egw']->template->fp('rows','row_2',True); + + $GLOBALS['egw']->template->set_var('value',$text_or_htmlarea); + + $GLOBALS['egw']->template->fp('rows','row_2',True); + + $GLOBALS['egw']->template->set_var('value', + html::submit_button('save', lang('Save'))."\n".html::submit_button('cancel', lang('Cancel')). + "\n".$htmlarea_button); + $GLOBALS['egw']->template->fp('rows','row_2',True); } + + $GLOBALS['egw']->template->set_var('lang_cancel',lang('Cancel')); + $GLOBALS['egw']->template->pparse('out','form'); } -?> +} diff --git a/admin/templates/default/mainscreen_message.tpl b/admin/templates/default/mainscreen_message.tpl index 0750afc449..05dc829b37 100644 --- a/admin/templates/default/mainscreen_message.tpl +++ b/admin/templates/default/mainscreen_message.tpl @@ -1,24 +1,23 @@ -
{error_message}
- - + + {rows}
- + {label} - {value} + {value} - {value} + {value} diff --git a/etemplate/js/et2_widget_button.js b/etemplate/js/et2_widget_button.js index e9e21afea1..f5ec15d960 100644 --- a/etemplate/js/et2_widget_button.js +++ b/etemplate/js/et2_widget_button.js @@ -421,7 +421,7 @@ jQuery.extend(et2_button, copy: /copy(&|\]|$)/, more: /more(&|\]|$)/, check: /(yes|check)(&|\]|$)/, - canceled: /no(&|\]|$)/, + cancelled: /no(&|\]|$)/, ok: /ok(&|\]|$)/, close: /close(&|\]|$)/, add: /(add(&|\]|$)|create)/ // customfields use create* diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index 6cee188e68..20bdbb0edf 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -672,7 +672,7 @@ egw_LAB.wait(function() { 'copy' => '/copy(&|\]|$)/', 'more' => '/more(&|\]|$)/', 'check' => '/(yes|check)(&|\]|$)/', - 'canceled' => '/no(&|\]|$)/', + 'cancelled' => '/no(&|\]|$)/', 'ok' => '/ok(&|\]|$)/', 'close' => '/close(&|\]|$)/', 'add' => '/(add(&|\]|$)|create)/', // customfields use create* diff --git a/phpgwapi/js/jsapi/egw.js b/phpgwapi/js/jsapi/egw.js index 1dd35a50dd..15447cd6e9 100644 --- a/phpgwapi/js/jsapi/egw.js +++ b/phpgwapi/js/jsapi/egw.js @@ -216,14 +216,14 @@ // instanciate app object var appname = window.egw_appName; - if (window.app && window.app[appname] != 'object' && typeof window.app.classes[appname] == 'function') + if (window.app && typeof window.app[appname] != 'object' && typeof window.app.classes[appname] == 'function') { window.app[appname] = new window.app.classes[appname](); } // set sidebox for tabed templates var sidebox = egw_script.getAttribute('data-setSidebox') || jQuery('#late-sidebox').attr('data-setSidebox'); - if (window.framework && sidebox) + if (window.framework && sidebox && sidebox !== 'null') { window.framework.setSidebox.apply(window.framework, JSON.parse(sidebox)); } @@ -245,10 +245,10 @@ { delta_height = 0; } - if((delta_width != 0 || delta_height != 0) && + if((delta_width != 0 || delta_height != 0) && (delta_width >2 || delta_height >2 || delta_width<-2 || delta_height < -2)) { - + if (window.framework && typeof window.framework.resize_popup != 'undefined') { window.framework.resize_popup($et2.outerWidth(true), $et2.outerHeight(true), window);