From ce4e2be003a3253de7c514a79344f3eec8bc918d Mon Sep 17 00:00:00 2001 From: MikeyGMT Date: Sun, 19 Mar 2017 16:42:57 +0000 Subject: [PATCH] Text to Lans in Admin UI #6 Text to Lans in Admin UI #6 Checked prefs, theme and plugin manager, un/reinstalled featurebox, works fine. --- e107_handlers/admin_ui.php | 107 ++++++++++----------- e107_languages/English/English.php | 1 + e107_languages/English/admin/lan_admin.php | 7 ++ 3 files changed, 58 insertions(+), 57 deletions(-) diff --git a/e107_handlers/admin_ui.php b/e107_handlers/admin_ui.php index 724a4ec79..cbd310b91 100644 --- a/e107_handlers/admin_ui.php +++ b/e107_handlers/admin_ui.php @@ -1092,7 +1092,7 @@ class e_admin_dispatcher if(!$this->checkModeAccess($currentMode)) { $request->setAction('e403'); - e107::getMessage()->addError('You don\'t have permissions to view this page.') + e107::getMessage()->addError(LAN_NO_PERMISSIONS) ->addDebug('Mode access restriction triggered.'); return false; } @@ -1103,7 +1103,7 @@ class e_admin_dispatcher if(!$this->checkRouteAccess($route)) { $request->setAction('e403'); - e107::getMessage()->addError('You don\'t have permissions to view this page.') + e107::getMessage()->addError(LAN_NO_PERMISSIONS) ->addDebug('Route access restriction triggered:'.$route); return false; } @@ -1675,7 +1675,7 @@ class e_admin_controller if(!empty($this->disallow) && in_array($currentAction, $this->disallow)) { $request->setAction('e403'); - e107::getMessage()->addError('You don\'t have permissions to view this page.') + e107::getMessage()->addError(LAN_NO_PERMISSIONS) ->addDebug('Controller action disallowed restriction triggered.'); return false; } @@ -1684,7 +1684,7 @@ class e_admin_controller if(!empty($this->allow) && !in_array($currentAction, $this->allow)) { $request->setAction('e403'); - e107::getMessage()->addError('You don\'t have permissions to view this page.') + e107::getMessage()->addError(LAN_NO_PERMISSIONS) ->addDebug('Controller action not in allowed list restriction triggered.'); return false; } @@ -2167,7 +2167,7 @@ class e_admin_controller public function E404Page() { - return '
'.LAN_UI_404_BODY_ERROR.'
'; // TODO - lan + return '
'.LAN_UI_404_BODY_ERROR.'
'; } @@ -2184,7 +2184,7 @@ class e_admin_controller public function E403Page() { - return '
'.LAN_UI_403_BODY_ERROR.'
'; // TODO - lan + return '
'.LAN_UI_403_BODY_ERROR.'
'; } @@ -3246,8 +3246,7 @@ class e_admin_controller_ui extends e_admin_controller // check userclass manager class if (!isset($e_userclass->class_tree[$id]) || !$user->checkClass($e_userclass->class_tree[$id])) { - // TODO lan - $msg = $tp->lanVars("You don't have management permissions on [x]",$label); + $msg = $tp->lanVars(LAN_NO_ADMIN_PERMISSION,$label); $this->getTreeModel()->addMessageWarning($msg); unset($classes[$id],$msg); } @@ -3304,11 +3303,11 @@ class e_admin_controller_ui extends e_admin_controller case 'datestamp': $dateConvert = array( - "hour" => "1 hour ago", - "day" => "24 hours ago", - "week" => "1 week ago", - "month" => "1 month ago", - "year" => "1 year ago" + "hour" => LAN_UI_FILTER_PAST_HOUR,//"1 hour ago",//etc + "day" => LAN_UI_FILTER_PAST_24_HOURS, + "week" => LAN_UI_FILTER_PAST_WEEK, + "month" => LAN_UI_FILTER_PAST_MONTH, + "year" => LAN_UI_FILTER_PAST_YEAR ); $ky = $filter[2]; @@ -4669,32 +4668,32 @@ class e_admin_ui extends e_admin_controller_ui $res = $sql->insert('links', $linkArray); - // FIXME lans if($res !== FALSE) { - e107::getMessage()->addSuccess('Created Sitelink: '.($name ? $name : 'n/a').""); - $scount++; + e107::getMessage()->addSuccess(LAN_CREATED.": ".LAN_SITELINK.": ".($name ? $name : 'n/a')); + $scount++; } else { if($sql->getLastErrorNumber()) { - e107::getMessage()->addError('SQL Link Creation Error'); //TODO - Lan + e107::getMessage()->addError(LAN_CREATED_FAILED.": ".LAN_SITELINK.": ".$name.": ".LAN_SQL_ERROR); e107::getMessage()->addDebug('SQL Link Creation Error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText()); - } + } else { - e107::getMessage()->addError('Unknown error: '.$name." not added"); + e107::getMessage()->addError(LAN_CREATED_FAILED.": ".LAN_SITELINK.": ".$name.": ".LAN_UNKNOWN_ERROR);//Unknown Error } } - + } - if($scount > 0) - { - e107::getMessage()->addSuccess("
{$scount} new sitelinks were added but are currently unassigned. You should now modify these links to your liking.

Modify Links"); + if($scount > 0) + { + e107::getMessage()->addSuccess(LAN_CREATED." (".$scount.") ".ADLAN_138); + e107::getMessage()->addSuccess("".LAN_CONFIGURE." ".ADLAN_138.""); return $scount; - } + } return false; @@ -4749,30 +4748,29 @@ class e_admin_ui extends e_admin_controller_ui $res = $sql->insert('featurebox', $fbArray); - // FIXME lans if($res !== FALSE) { - e107::getMessage()->addSuccess('Created Featurebox Item: '.($name ? $name : 'n/a').""); - $scount++; + e107::getMessage()->addSuccess(LAN_CREATED.": ".LAN_PLUGIN_FEATUREBOX_NAME.": ".($name ? $name : 'n/a')); + $scount++; } else { if($sql->getLastErrorNumber()) { - e107::getMessage()->addError('SQL Featurebox Creation Error'); //TODO - Lan - e107::getMessage()->addDebug('SQL Featurebox Creation Error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText()); + e107::getMessage()->addError(LAN_CREATED_FAILED.": ".LAN_PLUGIN_FEATUREBOX_NAME.": ".$name.": ".LAN_SQL_ERROR); + e107::getMessage()->addDebug('SQL Featurebox Creation Error #'.$sql->getLastErrorNumber().': '.$sql->getLastErrorText()); } else { - e107::getMessage()->addError('Unknown error: '.$name." not added"); + e107::getMessage()->addError(LAN_CREATED_FAILED.": ".$name.": ".LAN_UNKNOWN_ERROR); } } - } if($scount > 0) { - e107::getMessage()->addSuccess("
{$scount} new featurebox items were added but are currently unassigned. You should now modify these items to your liking.

Modify Featurebox Items"); + e107::getMessage()->addSuccess(LAN_CREATED." (".$scount.") ".LAN_PLUGIN_FEATUREBOX_NAME); + e107::getMessage()->addSuccess(""); return $scount; } @@ -4891,8 +4889,8 @@ class e_admin_ui extends e_admin_controller_ui } else { - // TODO lan - $this->getTreeModel()->addMessageWarning("Comma list is empty, aborting.")->setMessages(); + $this->getTreeModel()->addMessageWarning(LAN_UPDATED_FAILED)->setMessages();//"Comma list is empty, aborting." + $this->getTreeModel()->addDebug(LAN_UPDATED_FAILED.": Comma list is empty, aborting.")->setMessages(); } break; @@ -5139,7 +5137,7 @@ class e_admin_ui extends e_admin_controller_ui { header($protocol.': 404 Not Found', true, 404); header("Status: 404 Not Found", true, 404); - echo 'Field not found'; // FIXME lan + echo LAN_FIELD.": ".$this->fields[$_POST['name']].": ".LAN_NOT_FOUND; // Field: x: not found! $this->logajax('Field not found'); return; } @@ -5154,7 +5152,7 @@ class e_admin_ui extends e_admin_controller_ui { header($protocol.': 403 Forbidden', true, 403); header("Status: 403 Forbidden", true, 403); - echo 'Forbidden'; // FIXME lan + echo ADLAN_86; //Forbidden $this->logajax("Forbidden"); return; } @@ -5877,7 +5875,6 @@ class e_admin_form_ui extends e_form } /** - * TODO - lans * Generic DB Record Creation Form. * @return string */ @@ -5942,7 +5939,6 @@ class e_admin_form_ui extends e_form } /** - * TODO - lans * Generic Settings Form. * @return string */ @@ -6536,12 +6532,12 @@ class e_admin_form_ui extends e_form if(isset($options['addAll'])) { - $option['attach_all__'.$key] = vartrue($options['addAll'], '(add all)'); + $option['attach_all__'.$key] = vartrue($options['addAll'], "(".LAN_ADD_ALL.")"); unset($options['addAll']); } if(isset($options['clearAll'])) { - $_option['deattach_all__'.$key] = vartrue($options['clearAll'], '(clear all)'); + $_option['deattach_all__'.$key] = vartrue($options['clearAll'], "(".LAN_CLEAR_ALL.")"); unset($options['clearAll']); } @@ -6549,16 +6545,16 @@ class e_admin_form_ui extends e_form { foreach ($options as $value) { - $option['attach__'.$key.'__'.$value] = 'Add '.$value; - $_option['deattach__'.$key.'__'.$value] = 'Remove '.$value; + $option['attach__'.$key.'__'.$value] = LAN_ADD." ".$value; + $_option['deattach__'.$key.'__'.$value] = LAN_REMOVE." ".$value; } } else { foreach ($options as $value => $label) { - $option['attach__'.$key.'__'.$value] = 'Add '.$label; - $_option['deattach__'.$key.'__'.$value] = 'Remove '.$label; + $option['attach__'.$key.'__'.$value] = LAN_ADD." ".$label; + $_option['deattach__'.$key.'__'.$value] = LAN_REMOVE." ".$label; } } $option = array_merge($option, $_option); @@ -6648,14 +6644,12 @@ class e_admin_form_ui extends e_form break; case 'datestamp': - //TODO today, yesterday, this-month, last-month . - - $dateFilters = array ( + $dateFilters = array ( 'hour' => LAN_UI_FILTER_PAST_HOUR, - "day" => LAN_UI_FILTER_PAST_24_HOURS, - "week" => LAN_UI_FILTER_PAST_WEEK, - "month" => LAN_UI_FILTER_PAST_MONTH, - "year" => LAN_UI_FILTER_PAST_YEAR + "day" => LAN_UI_FILTER_PAST_24_HOURS, + "week" => LAN_UI_FILTER_PAST_WEEK, + "month" => LAN_UI_FILTER_PAST_MONTH, + "year" => LAN_UI_FILTER_PAST_YEAR ); foreach($dateFilters as $k => $name) @@ -6679,14 +6673,13 @@ class e_admin_form_ui extends e_form if($type === 'batch') { - // FIXME Lan foreach ($classes as $k => $v) { - $option['ucadd__'.$key.'__'.$k] = LAN_ADD.' '.$v; - $_option['ucremove__'.$key.'__'.$k] = 'Remove '.$v; + $option['ucadd__'.$key.'__'.$k] = LAN_ADD.' '.$v; + $_option['ucremove__'.$key.'__'.$k] = LAN_REMOVE." ".$v; } - $option['ucaddall__'.$key] = '(add all)'; - $_option['ucdelall__'.$key] = '(clear all)'; + $option['ucaddall__'.$key] = "(".LAN_ADD_ALL.")"; + $_option['ucdelall__'.$key] = "(".LAN_CLEAR_ALL.")"; $option = array_merge($option, $_option); } else @@ -6741,7 +6734,7 @@ class e_admin_form_ui extends e_form } else { - $option[$key.'__'.$k] = vartrue($data['user_name'],'Unknown'); + $option[$key.'__'.$k] = vartrue($data['user_name'],LAN_UNKNOWN); } diff --git a/e107_languages/English/English.php b/e107_languages/English/English.php index 6320d6f13..e487a9e7f 100644 --- a/e107_languages/English/English.php +++ b/e107_languages/English/English.php @@ -50,6 +50,7 @@ define("EMESSLAN_TITLE_SUCCESS", "Success"); define("EMESSLAN_TITLE_WARNING", "Warning"); define("EMESSLAN_TITLE_DEBUG", "System Debug"); +define("LAN_NO_PERMISSIONS", "You do not have permission to view this page."); define("LAN_EDIT","Edit"); define("LAN_DELETE","Delete"); define("LAN_DEFAULT","Default"); diff --git a/e107_languages/English/admin/lan_admin.php b/e107_languages/English/admin/lan_admin.php index c1bb5e53d..07b686dbe 100644 --- a/e107_languages/English/admin/lan_admin.php +++ b/e107_languages/English/admin/lan_admin.php @@ -272,6 +272,9 @@ define("LAN_NEVER", "Never"); define("LAN_PRUNE", "Prune"); define("LAN_RESET","Reset"); define("LAN_CLEAR","Clear"); +define("LAN_ADD_ALL", "Add All"); +define("LAN_CLEAR_ALL", "Clear All"); +define("LAN_UNKNOWN", "Unknown"); define("LAN_ALL","All"); define("LAN_IMPORT","Import"); // define("LAN_OK","OK"); // defined in e107_languages/English/English.php @@ -357,6 +360,7 @@ define("LAN_CONFIGURE", "Configure"); // define("LAN_BACK", "Back"); @see e107_languages/English.php define("LAN_NOPERMISSION", "no permissions"); +define("LAN_NO_ADMIN_PERMISSION", "You do not have administrator permissions for [x]"); define("LAN_CREDITS","Credits"); define("LAN_NEWVERSION","e107 v[x] Available"); @@ -444,6 +448,8 @@ define("LAN_UI_404_METHOD_ERROR", "Action [x] not found!"); define("LAN_UI_403_BODY_ERROR", "Access to the requested page is denied."); define("LAN_UI_403_TITLE_ERROR", "Access denied"); define("LAN_UI_FORM_METHOD_ERROR", "FATAL ERROR: The field name [x] is not allowed. Please rename the key [x] to something else in your fields array and database table (if required)."); +define("LAN_UNKNOWN_ERROR", "Unknown Error"); +define("LAN_SQL_ERROR", "SQL Error"); define("LAN_UI_BATCH_UPDATE_SUCCESS", "[x] set for [y] record(s)."); define("LAN_UI_BATCH_REVERSED_SUCCESS", "[x] records successfully reversed."); @@ -501,6 +507,7 @@ define("LAN_DASHBOARD_LAYOUT", "Dashboard Layout"); define("LAN_UNAVAILABLE", "Unavailable"); define("LAN_NO_LABEL_PROVIDED", "No Label Provided"); define("LAN_NOT_FOUND", "Not Found!"); +define("LAN_FIELD", "Field"); define("LAN_MAINTENANCE", "Maintenance"); define("LAN_RETURN_TO_FRONT_PANEL", "Return to Front Panel");