From bc865d97900112287006f80cb51f2e3d4ca73d2a Mon Sep 17 00:00:00 2001 From: Tijn Kuyper Date: Tue, 5 Feb 2013 20:42:16 +0100 Subject: [PATCH] Issue #90 - Event calendar plugin - WIP (also #6) --- e107_plugins/calendar_menu/admin_config.php | 46 ++++++++++++------- .../languages/English_admin_calendar_menu.php | 8 ++-- 2 files changed, 35 insertions(+), 19 deletions(-) diff --git a/e107_plugins/calendar_menu/admin_config.php b/e107_plugins/calendar_menu/admin_config.php index 2bf47a44e..cb483bb1a 100644 --- a/e107_plugins/calendar_menu/admin_config.php +++ b/e107_plugins/calendar_menu/admin_config.php @@ -37,7 +37,11 @@ if (!getperms('P')) include_lan(e_PLUGIN.'calendar_menu/languages/'.e_LANGUAGE.'_admin_calendar_menu.php'); require_once(e_HANDLER.'form_handler.php'); -$frm = new e_form(); +$frm = e107::getForm(); + +require_once(e_HANDLER.'message_handler.php'); +$mes = e107::getMessage(); + $sql = e107::getDb(); $uc = e107::getUserClass(); // Userclass object pointer @@ -102,16 +106,18 @@ function logPrefChanges(&$prefList, &$oldPref, $logRef) // Do admin logging $logString = implode('[!br!]', $prefChanges); $admin_log->log_event($logRef,$logString,''); - $mes->add('Calendar prefs updated', E_MESSAGE_SUCCESS); + //$mes->add('Calendar prefs updated', E_MESSAGE_SUCCESS); + $mes->addSuccess(LAN_UPDATED); // TODO FIX "double success message in green box" } elseif ($result === FALSE) { - $mes->add('Error saving calendar prefs', E_MESSAGE_ERROR); + //$mes->add('Error saving calendar prefs', E_MESSAGE_ERROR); + $mes->addError("Error saving calendar prefs"); // TODO LAN } else { // Should never happen - $mes->add('Unexpected result: '.$result, E_MESSAGE_INFO); - + //$mes->add('Unexpected result: '.$result, E_MESSAGE_INFO); + $mes->addInfo('Unexpected result: '.$result); } } } @@ -164,7 +170,8 @@ if (isset($_POST['updatesettings'])) { logPrefChanges($prefSettings['updateOptions'], $calPref, 'EC_ADM_06'); $e107cache->clear('nq_event_cal'); // Clear cache as well, in case displays changed - $message = EC_ADLAN_A204; // "Calendar settings updated."; + //$message = EC_ADLAN_A204; // "Calendar settings updated."; + $mes->addSuccess(LAN_UPDATED); // TODO FIX "double success message in green box" } @@ -173,7 +180,8 @@ if (isset($_POST['updateforthcoming'])) { logPrefChanges($prefSettings['updateForthcoming'], $calPref, 'EC_ADM_07'); $e107cache->clear('nq_event_cal'); // Clear cache as well, in case displays changed - $message = EC_ADLAN_A109; // "Forthcoming Events settings updated."; + //$message = EC_ADLAN_A109; // "Forthcoming Events settings updated."; + $mes->addSuccess(LAN_UPDATED); // TODO FIX "double success message in green box" } @@ -201,7 +209,8 @@ if (isset($_POST['deleteold']) && isset($_POST['eventpost_deleteoldmonths'])) $ec_qs[1] = $old_date; } else - $message = EC_ADLAN_A148; + //$message = EC_ADLAN_A148; + $mes->addError(EC_ADLAN_A148); } @@ -246,7 +255,8 @@ if (isset($_POST['confirmdeleteold']) && ($action == 'backdel')) if (isset($_POST['confirmdelcache']) && ($action == 'cachedel')) { $e107cache->clear('nq_event_cal'); - $message = EC_ADLAN_A163; + //$message = EC_ADLAN_A163; + $mes->addSuccess(EC_ADLAN_A163); // TODO LAN $action = 'maint'; // Re-display maintenance menu } @@ -263,12 +273,12 @@ if ($action == 'confdel')
- ".$frm->admin_button('confirmdeleteold', EC_ADLAN_A205, 'delete')." + ".$frm->admin_button('confirmdeleteold', LAN_UI_DELETE_LABEL, 'delete')."
"; - $ns->tablerender(EC_ADLAN_A205, $text); + $ns->tablerender(LAN_UI_DELETE_LABEL, $text); } @@ -283,10 +293,10 @@ if ($action == 'confcache')
- ".$frm->admin_button('confirmdelcache', EC_ADLAN_A205, 'delete')." + ".$frm->admin_button('confirmdelcache', LAN_UI_DELETE_LABEL, 'delete')." "; - $ns->tablerender(EC_ADLAN_A205, $text); + $ns->tablerender(LAN_UI_DELETE_LABEL, $text); } @@ -294,18 +304,22 @@ if ($action == 'confcache') if (isset($ec_qs[2]) && isset($ec_qs[3]) && ($action == 'subs') && ($ec_qs[2] == 'del') && is_numeric($ec_qs[3])) { if ($sql->db_Delete('event_subs',"event_subid='{$ec_qs[3]}'")) - $message = EC_ADLAN_A180.$ec_qs[3]; + //$message = EC_ADLAN_A180.$ec_qs[3]; + $mes->addSuccess(LAN_DELETED.$ec_qs[3]); else - $message = EC_ADLAN_A181.$ec_qs[3]; + //$message = EC_ADLAN_A181.$ec_qs[3]; + $mes->addError(LAN_DELETED_FAILED.$ec_qs[3]); } - +/* if (isset($message) && ($message != "")) { $ns->tablerender('', "
{$message}
"); // TODO v2 style $message = ''; } +*/ +$ns->tablerender($caption, $mes->render() . $text); //category diff --git a/e107_plugins/calendar_menu/languages/English_admin_calendar_menu.php b/e107_plugins/calendar_menu/languages/English_admin_calendar_menu.php index e7349ee2a..1bb7851e1 100644 --- a/e107_plugins/calendar_menu/languages/English_admin_calendar_menu.php +++ b/e107_plugins/calendar_menu/languages/English_admin_calendar_menu.php @@ -24,6 +24,8 @@ * @version $Id$; */ +// TODO LAN REWRITE + define('EC_ADLAN_1', 'Event Calendar'); define('EC_LAN_12', "Monday"); @@ -178,8 +180,8 @@ define('EC_ADLAN_A176', "User Name"); //FIXME Use Generic define('EC_ADLAN_A177', "Category"); //FIXME Use Generic define('EC_ADLAN_A178', "Problems"); define('EC_ADLAN_A179', "Actions"); -define('EC_ADLAN_A180', "Deleted subscription record no "); //FIXME Use Generic -define('EC_ADLAN_A181', "Delete failed for record no "); //FIXME Use Generic +//define('EC_ADLAN_A180', "Deleted subscription record no "); //FIXME Use Generic +//define('EC_ADLAN_A181', "Delete failed for record no "); //FIXME Use Generic define('EC_ADLAN_A182', "Total --NUM-- entries in database"); define('EC_ADLAN_A183', "Calendar Menu mouseover shows event title"); define('EC_ADLAN_A184', "may not work with all browsers"); @@ -203,7 +205,7 @@ define('EC_ADLAN_A201', 'BBCode (Standard)'); define('EC_ADLAN_A202', 'BBCode with help'); define('EC_ADLAN_A203', 'WYSIWYG'); define('EC_ADLAN_A204', 'Calendar settings updated.'); -define('EC_ADLAN_A205', 'Confirm Delete'); +//define('EC_ADLAN_A205', 'Confirm Delete'); define('EC_ADLAN_A206', 'This plugin is a fully featured event calendar with calendar menu.'); define('EC_ADLAN_A207', 'Calendar Settings'); define('EC_ADLAN_A208', 'Events can be added by:');