From 676cdd9103010837bcf15212c95d38f31306f346 Mon Sep 17 00:00:00 2001 From: Thomas Hufschmidt Date: Thu, 10 Nov 2016 11:44:01 +0100 Subject: [PATCH] updated temporary admin-panel and checkout app for 1.6.0 refactoring changes --- apps/admin/index.php | 20 +++---- apps/admin/js/app.js | 16 +----- apps/admin/js/controllers.js | 67 +++++++--------------- apps/admin/js/services.js | 2 - apps/admin/lang/angular_en-US.js | 44 ++++++--------- apps/admin/partials/offline.html | 12 ---- apps/checkout/index.php | 24 ++++---- apps/checkout/js/app.js | 16 +----- apps/checkout/js/controllers.js | 67 ++++++---------------- apps/checkout/js/services.js | 87 ++++++++--------------------- apps/checkout/lang/angular_en-US.js | 46 +++++++-------- apps/checkout/partials/offline.html | 12 ---- classes/class.ilRESTConfigGUI.php | 65 ++++++++++----------- 13 files changed, 152 insertions(+), 326 deletions(-) delete mode 100644 apps/admin/partials/offline.html delete mode 100644 apps/checkout/partials/offline.html diff --git a/apps/admin/index.php b/apps/admin/index.php index 30688013..41e305e3 100644 --- a/apps/admin/index.php +++ b/apps/admin/index.php @@ -8,9 +8,9 @@ - + {{'INDEX_TITLE' | translate}} - + @@ -23,9 +23,9 @@ - + - + @@ -129,7 +129,7 @@ - + diff --git a/apps/admin/js/app.js b/apps/admin/js/app.js index a589c508..c6f20882 100644 --- a/apps/admin/js/app.js +++ b/apps/admin/js/app.js @@ -44,13 +44,6 @@ app.constant('restConfigURL', '/v2/admin/config/:key'); // Con * Setup all routes (used to display different functionality) */ app.config(function($routeProvider) { - // Login page - $routeProvider.when('/offline', { - templateUrl : 'partials/offline.html', - label: 'LABEL_LATER', // This will be replaced later! - controller: 'OfflineCtrl' - }); - // Login page $routeProvider.when('/login', { templateUrl : 'partials/login.html', @@ -132,17 +125,10 @@ app.config(function(cfpLoadingBarProvider) { app.run(function($rootScope, $location, authentication, restEndpoint, $templateCache) { // Go to login page if not logged in (and we should not display the offline notification) $rootScope.$on('$routeChangeStart', function(event, current, previous, rejection) { - if (!(authentication.isAuthenticated() || $location.url() == "/offline")) { + if (!authentication.isAuthenticated()) { $location.url("/login"); } }); - - // Something went wrong (rest-interfac down, maybe?) - $rootScope.$on('$routeChangeError', function(event, current, previous, rejection) { - if (rejection == "NoEndpoint") { - $location.path("/offline"); - } - }); }); diff --git a/apps/admin/js/controllers.js b/apps/admin/js/controllers.js index afd710b3..b441163f 100644 --- a/apps/admin/js/controllers.js +++ b/apps/admin/js/controllers.js @@ -24,7 +24,6 @@ ctrl.controller("MainCtrl", function($scope, $location, $filter, breadcrumbs, au // Add breadcrumbs to scope and setup translations breadcrumbs.options = { 'LABEL_LOGIN': $filter('translate')('LABEL_LOGIN'), - 'LABEL_OFFLINE': $filter('translate')('LABEL_OFFLINE'), 'LABEL_CLIENTS': $filter('translate')('LABEL_CLIENTS'), 'LABEL_EDIT': $filter('translate')('LABEL_EDIT'), 'LABEL_OVERVIEW': $filter('translate')('LABEL_OVERVIEW'), @@ -736,8 +735,20 @@ ctrl.controller('LoginCtrl', function($scope, $location, $filter, apiKey, restAu }, // Failure (Logout internally and redirdct) function (response){ - $scope.authentication.logout(); - $location.url("/login"); + // Try to decode the more common error-codes + if (response.status == 401) + $scope.authentication.setError($filter('translate')('LOGIN_REJECTED')); + else if (response.status == 404) + $scope.authentication.setError($filter('translate')('NOT_INSTALLED')); + else if (response.status == 405) + $scope.authentication.setError($filter('translate')('LOGIN_DISABLED')); + else if (response.status == 500) + $scope.authentication.setError($filter('translate')('CRITICAL_ERROR')); + else if (response.status != 200) + $scope.authentication.setError($filter('translate')('LOGIN_UNKNOWN')); + + $scope.authentication.logout(); + $location.url("/login"); } ); }; @@ -775,14 +786,17 @@ ctrl.controller('LoginCtrl', function($scope, $location, $filter, apiKey, restAu }, // Failure (Logout internally and redirdct) function (response){ - console.log("NOT OK"); // Try to decode the more common error-codes if (response.status == 401) - $scope.authentication.setError($filter('restInfo')($filter('translate')('LOGIN_REJECTED'), response.status, response.data)); + $scope.authentication.setError($filter('translate')('LOGIN_REJECTED')); + else if (response.status == 404) + $scope.authentication.setError($filter('translate')('NOT_INSTALLED')); else if (response.status == 405) - $scope.authentication.setError($filter('restInfo')($filter('translate')('LOGIN_DISABLED'), response.status, response.data)); + $scope.authentication.setError($filter('translate')('LOGIN_DISABLED')); + else if (response.status == 500) + $scope.authentication.setError($filter('translate')('CRITICAL_ERROR')); else if (response.status != 200) - $scope.authentication.setError($filter('restInfo')($filter('translate')('LOGIN_UNKNOWN'), response.status, response.data)); + $scope.authentication.setError($filter('translate')('LOGIN_UNKNOWN')); // Logout and redirect $scope.authentication.logout(); @@ -794,42 +808,3 @@ ctrl.controller('LoginCtrl', function($scope, $location, $filter, apiKey, restAu // Do the initialisation $scope.init(); }); - - -/* - * Simple controller that manages functionality of the route that - * should be displayed IFF the REST-Interface can't be contacted. - * Note: Currently this is only implemented for when the "connection" is - * unavailable during page-load. (Nothing happens when the "connection" - * is lost after AngularJS was loaded and initialized) - */ -ctrl.controller('OfflineCtrl', function($scope, $location, restEndpoint) { - /* - * Called during (every) instantiation of this controller. - * - * Note: Using a dedicated method is cleaner and more reusable than - * doing it directly inside the controller. - */ - $scope.init = function() { - // Convert URL to absolute [Cheat a bit >:->] - var a = document.createElement('a'); - a.href = "/"; - - // Set endpoints (for display purpose only) - $scope.postEndPoint = a.href+postVars.restEndpoint; - $scope.installDir = a.href+restEndpoint.getInstallDir(); - }; - - - /* - * Retry connection by completly reloading page, - * thus reloading AngularJS. - */ - $scope.retry = function() { - document.location.href = './'; - }; - - - // Do the initialisation - $scope.init(); -}); diff --git a/apps/admin/js/services.js b/apps/admin/js/services.js index 490a6b97..c43599ee 100644 --- a/apps/admin/js/services.js +++ b/apps/admin/js/services.js @@ -183,8 +183,6 @@ services.factory('clientStorage', function() { * This services tries to find the REST Endpoint, in the following order: * - Using the 'restEndpoint' POST variable * - Find the ILIAS main folder () by using 'window.location.pathname' and finding the 'Customizing' folder - * - Try to find restplugin.php endpoint using http.get(/restplugin.php/routes) - * - Try to find sub-domain endpoint using http.get(/routes) * Als contains a promise that gets resolved once endpoint has been found (or rejected if non is found). */ services.factory('restEndpoint', function($q, $http, restRoutesURL) { diff --git a/apps/admin/lang/angular_en-US.js b/apps/admin/lang/angular_en-US.js index 7358e840..75ebfe7c 100644 --- a/apps/admin/lang/angular_en-US.js +++ b/apps/admin/lang/angular_en-US.js @@ -6,7 +6,7 @@ * This variable will manage all en-US translations */ var lang_en_us = angular.module('myApp.translate.en-US', []); - + /* * Load en-US translations @@ -29,7 +29,7 @@ lang_en_us.config(function($translateProvider) { DIALOGS_OK: "OK", DIALOGS_YES: "Yes", DIALOGS_NO: "No", - + // Custom AngularJS texts DIALOG_DELETE: 'Delete Client', DIALOG_DELETE_MSG: 'Do you really want to remove this client?', @@ -37,25 +37,26 @@ lang_en_us.config(function($translateProvider) { DIALOG_DELETE_AP_MSG: 'This clients API-Key is required by the the Admin-Panel, you should change the default api-key (inside app.js) first!

Do you really want to remove this client?', DIALOG_UPDATE: 'Update Admin-Panel Client', DIALOG_UPDATE_MSG: 'This clients API-Key is required by the the Admin-Panel, you should change the default api-key (inside app.js) first!

Do you really want to apply this changes?', - + // Breadcrumb labels - LABEL_OFFLINE: 'Offline', LABEL_LOGIN: 'Login', LABEL_CLIENTS: 'Clients', LABEL_EDIT: 'Edit', LABEL_OVERVIEW: 'Overview', LABEL_CONFIGURATIONS: 'Configurations', - + // Warning & error-messages AUTH_PERM: 'You have been logged out because you don\'t have enough permissions to access this menu.', - NO_CLIENTS: 'Warning: Could not contact REST-Interface to fetch client data! %INFO%', - DEL_FAILED_REMOTE: 'Warning: Delete-Operation failed, could not contact REST-Interface! %INFO%', - SAVE_FAILED_UNKOWN: 'Warning: Save-Operation failed, for unknown reason! %INFO%', - SAVE_FAILED_REMOTE: 'Warning: Save-Operation failed, could not contact REST-Interface! %INFO%', - LOGIN_REJECTED: 'Login failed: Username/Password combination was rejected. %INFO%', - LOGIN_DISABLED: 'Login failed: REST-Interface is disabled! %INFO%', - LOGIN_UNKNOWN: 'Login failed: An unknown error occured while trying to contact the REST-Interface. %INFO%', - + NO_CLIENTS: 'Warning: Could not contact REST-Interface to fetch client data!', + DEL_FAILED_REMOTE: 'Warning: Delete-Operation failed, could not contact REST-Interface!', + SAVE_FAILED_UNKOWN: 'Warning: Save-Operation failed, for unknown reason!', + SAVE_FAILED_REMOTE: 'Warning: Save-Operation failed, could not contact REST-Interface!', + LOGIN_REJECTED: 'Login failed: Username/Password combination was rejected.', + LOGIN_DISABLED: 'Login failed: REST-Interface is disabled!', + LOGIN_UNKNOWN: 'Login failed: An unknown error occured while trying to contact the REST-Interface.', + NOT_INSTALLED: 'Login failed: The RESTPlugin does not seem to be installed correclty (404).', + CRITICAL_ERROR: 'Login failed: The RESTPlugin raised a critical error, please report as bug.', + // Index.php INDEX_TITLE: 'ILIAS REST Plugin - Administration', INDEX_BRAND: 'ILIAS REST Plugin', @@ -63,7 +64,7 @@ lang_en_us.config(function($translateProvider) { INDEX_LOGOUT: 'Logout', INDEX_VERSION: 'Version', INDEX_POWERED: 'Powered by', - + // partials/login.html LOGIN_AUTO: 'You came from the ILIAS platform. Trying to login automatically ...', LOGIN_HEAD: 'REST Plugin Administration', @@ -98,16 +99,7 @@ lang_en_us.config(function($translateProvider) { LIST_GRANT_CC: 'Client Credentials', LIST_NEW_CLIENT: 'Create a new REST client', LIST_IP_RESTRICTION: 'IP', - - // partials/offline.html - OFFLINE_WARNING: 'Warning!', - OFFLINE_ISSUE: 'Could not locate/contact the REST-API endpoint(s) at:', - OFFLINE_URL_POST: '[POST information]', - OFFLINE_URL_FILE: '[File URL]', - OFFLINE_URL_SUB: '[Subdomain URL]', - OFFLINE_EXPLANATION: 'The Admin-Panel requires an active REST-Endpoint to work.', - OFFLINE_RETRY: 'Retry', - + // partials/clientedit.html EDIT_BACK: 'Back', EDIT_SAVE: 'Save', @@ -156,7 +148,7 @@ lang_en_us.config(function($translateProvider) { EDIT_CONFIG_SALT_DESCRIPTION_TEXT: 'SALT is a unique character sequence which is used to lift the entropy of the tokens.', }); - + // Ste default language $translateProvider.preferredLanguage('en-US'); -}); \ No newline at end of file +}); diff --git a/apps/admin/partials/offline.html b/apps/admin/partials/offline.html deleted file mode 100644 index 94217819..00000000 --- a/apps/admin/partials/offline.html +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/apps/checkout/index.php b/apps/checkout/index.php index 1c5eca92..d2fdf6c1 100644 --- a/apps/checkout/index.php +++ b/apps/checkout/index.php @@ -8,9 +8,9 @@ - + {{'INDEX_TITLE' | translate}} - + @@ -22,9 +22,9 @@ - + - + @@ -127,7 +127,7 @@ - + diff --git a/apps/checkout/js/app.js b/apps/checkout/js/app.js index 5877a389..c663060f 100644 --- a/apps/checkout/js/app.js +++ b/apps/checkout/js/app.js @@ -44,13 +44,6 @@ app.constant('restApiRoutesURL', '/v2/util/tokenroutes'); // API * Setup all routes (used to display different functionality) */ app.config(function($routeProvider) { - // Login page - $routeProvider.when('/offline', { - templateUrl : 'partials/offline.html', - label: 'LABEL_LATER', // This will be replaced later! - controller: 'OfflineCtrl' - }); - // Login page $routeProvider.when('/login', { templateUrl : 'partials/login.html', @@ -120,17 +113,10 @@ app.config(function(cfpLoadingBarProvider) { app.run(function($rootScope, $location, authentication, restEndpoint, $templateCache) { // Go to login page if not logged in (and we should not display the offline notification) $rootScope.$on('$routeChangeStart', function(event, current, previous, rejection) { - if (!(authentication.isAuthenticated() || $location.url() == "/offline")) { + if (!authentication.isAuthenticated()) { $location.url("/login"); } }); - - // Something went wrong (rest-interfac down, maybe?) - $rootScope.$on('$routeChangeError', function(event, current, previous, rejection) { - if (rejection == "NoEndpoint") { - $location.path("/offline"); - } - }); }); diff --git a/apps/checkout/js/controllers.js b/apps/checkout/js/controllers.js index 65187612..a9d559b9 100644 --- a/apps/checkout/js/controllers.js +++ b/apps/checkout/js/controllers.js @@ -24,7 +24,6 @@ ctrl.controller("MainCtrl", function($scope, $location, $filter, breadcrumbs, au // Add breadcrumbs to scope and setup translations breadcrumbs.options = { 'LABEL_LOGIN': $filter('translate')('LABEL_LOGIN'), - 'LABEL_OFFLINE': $filter('translate')('LABEL_OFFLINE'), 'LABEL_CLIENTS': $filter('translate')('LABEL_CLIENTS'), 'LABEL_EDIT': $filter('translate')('LABEL_EDIT'), 'LABEL_CHECKOUT': $filter('translate')('LABEL_CHECKOUT') @@ -151,7 +150,7 @@ ctrl.controller("CheckoutCtrl", function($sce, $scope, $location, $filter, $reso $scope.openTypeAhead = function () { $scope.inputRestEndpoint = "/"; } - + $scope.onSelect = function ($item, $model, $label) { console.log("on Selected called."); console.log("item "+$item); @@ -291,7 +290,7 @@ ctrl.controller("CheckoutCtrl", function($sce, $scope, $location, $filter, $reso default: console.log('Requesting via GET (default)'); } - + } // This method needs to be invoked in case when the rest route requires @@ -366,18 +365,21 @@ ctrl.controller('LoginCtrl', function($scope, $location, $filter, apiKey, restAu }, // Failure (Logout internally and redirect) function (response){ - console.log("NOT OK"); - // Try to decode the more common error-codes - if (response.status == 401) - $scope.authentication.setError($filter('restInfo')($filter('translate')('LOGIN_REJECTED'), response.status, response.data)); - else if (response.status == 405) - $scope.authentication.setError($filter('restInfo')($filter('translate')('LOGIN_DISABLED'), response.status, response.data)); - else if (response.status != 200) - $scope.authentication.setError($filter('restInfo')($filter('translate')('LOGIN_UNKNOWN'), response.status, response.data)); - - // Logout and redirect - $scope.authentication.logout(); - $location.url("/login"); + // Try to decode the more common error-codes + if (response.status == 401) + $scope.authentication.setError($filter('translate')('LOGIN_REJECTED')); + else if (response.status == 404) + $scope.authentication.setError($filter('translate')('NOT_INSTALLED')); + else if (response.status == 405) + $scope.authentication.setError($filter('translate')('LOGIN_DISABLED')); + else if (response.status == 500) + $scope.authentication.setError($filter('translate')('CRITICAL_ERROR')); + else if (response.status != 200) + $scope.authentication.setError($filter('translate')('LOGIN_UNKNOWN')); + + // Logout and redirect + $scope.authentication.logout(); + $location.url("/login"); } ); }; @@ -390,38 +392,3 @@ ctrl.controller('LoginCtrl', function($scope, $location, $filter, apiKey, restAu // Do the initialisation $scope.init(); }); - - -/* - * Simple controller that manages functionality of the route that - * should be displayed IFF the REST-Interface can't be contacted. - */ -ctrl.controller('OfflineCtrl', function($scope, $location, restEndpoint) { - /* - * Called during (every) instantiation of this controller. - * - * Note: Using a dedicated method is cleaner and more reusable than - * doing it directly inside the controller. - */ - $scope.init = function() { - // Convert URL to absolute [Cheat a bit >:->] - var a = document.createElement('a'); - a.href = "/"; - - // Set endpoints (for display purpose only) - $scope.postEndPoint = a.href+postVars.restEndpoint; - $scope.installDir = a.href+restEndpoint.getInstallDir(); - }; - - - /* - * Retry. - */ - $scope.retry = function() { - document.location.href = './'; - }; - - - // Do the initialisation - $scope.init(); -}); diff --git a/apps/checkout/js/services.js b/apps/checkout/js/services.js index 8c8f334e..faee30c2 100644 --- a/apps/checkout/js/services.js +++ b/apps/checkout/js/services.js @@ -125,78 +125,37 @@ services.provider('authentication', function() { }); + /* * This services tries to find the REST Endpoint, in the following order: * - Using the 'restEndpoint' POST variable * - Find the ILIAS main folder () by using 'window.location.pathname' and finding the 'Customizing' folder - * - Try to find restplugin.php endpoint using http.get(/restplugin.php/routes) - * - Try to find sub-domain endpoint using http.get(/routes) * Als contains a promise that gets resolved once endpoint has been found (or rejected if non is found). */ services.factory('restEndpoint', function($q, $http, restRoutesURL) { // Promise and endpoint variables var deferred = $q.defer(); - var restEndpoint = ""; - - // Tries to find ILIAS main folder by looking at window.location.pathname - // and finding the 'Customizing' folder - var getInstallDir = function() { - var pathArray = window.location.pathname.split('/'); - var iliasSubFolder = ''; - for (var i = 0; i < pathArray.length; i++) { - if (pathArray[i] == 'Customizing') - break; - if (pathArray[i] !== '') - iliasSubFolder += '/'+pathArray[i]; - } - return iliasSubFolder; - } - var dir; - // Find ILIAS main folder - dir = getInstallDir(); - - // Stores wether AJAJ call was successfull (true) or not (false) [null means not done] - var apiPath = null; - var phpPath = null; - - // Initiate AJAJ call - var apiQuery = $http.get(dir+restRoutesURL); - var phpQuery = $http.get(dir+'/restplugin.php'+restRoutesURL); - - // AJAJ call succeeded, save result and forward to promise (resolve) - // Note: Also make sure, that promise is only resolved once. - apiQuery.success(function(data, status, headers, config) { - apiPath = true; - if (phpPath !== true) { - restEndpoint = dir; - deferred.resolve(restEndpoint); - } - }); - phpQuery.success(function(data, status, headers, config) { - phpPath = true; - if (apiPath !== true) { - restEndpoint = dir+"/restplugin.php"; - deferred.resolve(restEndpoint); - } - }); + // Fetch installation directory from current path + var pluginPath = '/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST'; + var fullPath = window.location.pathname; + var index = fullPath.indexOf(pluginPath); - // AJAJ call failed, forward to promise (reject) - // Note: Also make sure, that promise is only rejected once. - apiQuery.error(function(data, status, headers, config) { - apiPath = false; - if (phpPath === false) { - restEndpoint = null; - deferred.reject("NoEndpoint"); - } - }); - phpQuery.error(function(data, status, headers, config) { - phpPath = false; - if (apiPath === false) { - restEndpoint = null; - deferred.reject("NoEndpoint"); - } - }); + // Fallback value + var installDir = pluginPath; + + // Extract from window-location + if (index >= 0) + installDir = fullPath.substring(0, index + pluginPath.length) + // Extract from post-variable passed by ILIAS + else if (postVars.restEndpoint !== "") + installDir = postVars.restEndpoint.concat(pluginPath); + + // Append endpoint location + var endPoint = installDir.concat('/api.php'); + + // Legacy-code, because I'm to lazy to update the other code >_> + deferred.resolve(endPoint); // Return object containing: return { @@ -207,11 +166,13 @@ services.factory('restEndpoint', function($q, $http, restRoutesURL) { // Function to query found endpoint // Note: If promise got resolved this contains a valid endpoint! getEndpoint: function () { - return restEndpoint; + return endPoint; }, // Function that returns the ILIAS main folder - getInstallDir: getInstallDir + getInstallDir: function () { + return installDir; + } }; }); diff --git a/apps/checkout/lang/angular_en-US.js b/apps/checkout/lang/angular_en-US.js index aa7708fa..ba2f6bf3 100644 --- a/apps/checkout/lang/angular_en-US.js +++ b/apps/checkout/lang/angular_en-US.js @@ -6,7 +6,7 @@ * This variable will manage all en-US translations */ var lang_en_us = angular.module('myApp.translate.en-US', []); - + /* * Load en-US translations @@ -29,7 +29,7 @@ lang_en_us.config(function($translateProvider) { DIALOGS_OK: "OK", DIALOGS_YES: "Yes", DIALOGS_NO: "No", - + // Custom AngularJS texts DIALOG_DELETE: 'Delete Client', DIALOG_DELETE_MSG: 'Do you really want to remove this client?', @@ -37,24 +37,25 @@ lang_en_us.config(function($translateProvider) { DIALOG_DELETE_AP_MSG: 'This clients API-Key is required by the the Admin-Panel, you should change the default api-key (inside app.js) first!

Do you really want to remove this client?', DIALOG_UPDATE: 'Update Admin-Panel Client', DIALOG_UPDATE_MSG: 'This clients API-Key is required by the the Admin-Panel, you should change the default api-key (inside app.js) first!

Do you really want to apply this changes?', - + // Breadcrumb labels - LABEL_OFFLINE: 'Offline', LABEL_LOGIN: 'Checkout Login', LABEL_CLIENTS: 'Clients', LABEL_EDIT: 'Edit', LABEL_CHECKOUT: 'Checkout', - + // Warning & error-messages AUTH_PERM: 'You have been logged out because you don\'t have enough permissions to access this menu.', - NO_CLIENTS: 'Warning: Could not contact REST-Interface to fetch client data! %INFO%', - DEL_FAILED_REMOTE: 'Warning: Delete-Operation failed, could not contact REST-Interface! %INFO%', - SAVE_FAILED_UNKOWN: 'Warning: Save-Operation failed, for unknown reason! %INFO%', - SAVE_FAILED_REMOTE: 'Warning: Save-Operation failed, could not contact REST-Interface! %INFO%', - LOGIN_REJECTED: 'Login failed: Username/Password combination was rejected. %INFO%', - LOGIN_DISABLED: 'Login failed: REST-Interface is disabled! %INFO%', - LOGIN_UNKNOWN: 'Login failed: An unknown error occured while trying to contact the REST-Interface. %INFO%', - + NO_CLIENTS: 'Warning: Could not contact REST-Interface to fetch client data!', + DEL_FAILED_REMOTE: 'Warning: Delete-Operation failed, could not contact REST-Interface!', + SAVE_FAILED_UNKOWN: 'Warning: Save-Operation failed, for unknown reason!', + SAVE_FAILED_REMOTE: 'Warning: Save-Operation failed, could not contact REST-Interface!', + LOGIN_REJECTED: 'Login failed: Username/Password combination was rejected.', + LOGIN_DISABLED: 'Login failed: REST-Interface is disabled!', + LOGIN_UNKNOWN: 'Login failed: An unknown error occured while trying to contact the REST-Interface.', + NOT_INSTALLED: 'Login failed: The RESTPlugin does not seem to be installed correclty (404).', + CRITICAL_ERROR: 'Login failed: The RESTPlugin raised a critical error, please report as bug.', + // Index.php INDEX_TITLE: 'Checkout', INDEX_BRAND: 'ILIAS REST Plugin', @@ -62,7 +63,7 @@ lang_en_us.config(function($translateProvider) { INDEX_LOGOUT: 'Logout', INDEX_VERSION: 'Version', INDEX_POWERED: 'Powered by', - + // partials/login.html LOGIN_AUTO: 'You came from the ILIAS platform. Trying to login automatically ...', LOGIN_HEAD: 'REST Administration', @@ -70,7 +71,7 @@ lang_en_us.config(function($translateProvider) { LOGIN_PASSWORD: 'Password', LOGIN_LOGIN: 'Login', LOGIN_APIKEY: 'API Key', - + // partials/clientlist.html LIST_ID: 'ID', LIST_API_KEY: 'API-Key', @@ -84,16 +85,7 @@ lang_en_us.config(function($translateProvider) { LIST_GRANT_R: 'Resource Owner', LIST_GRANT_CC: 'Client Credentials', LIST_NEW_CLIENT: 'Create a new REST client', - - // partials/offline.html - OFFLINE_WARNING: 'Warning!', - OFFLINE_ISSUE: 'Could not locate/contact the REST-API endpoint(s) at:', - OFFLINE_URL_POST: '[POST information]', - OFFLINE_URL_FILE: '[File URL]', - OFFLINE_URL_SUB: '[Subdomain URL]', - OFFLINE_EXPLANATION: 'The Admin-Panel requires an active REST-Endpoint to work.', - OFFLINE_RETRY: 'Retry', - + // partials/clientedit.html EDIT_BACK: 'Back', EDIT_SAVE: 'Save', @@ -128,7 +120,7 @@ lang_en_us.config(function($translateProvider) { CHECKOUT_INPUT: 'Please enter a route:', CHECKOUT_OPEN_NEW_WINDOW: 'Send the request to a new window. This option can be necessary for routes involving downloads or redirects.' }); - + // Ste default language $translateProvider.preferredLanguage('en-US'); -}); \ No newline at end of file +}); diff --git a/apps/checkout/partials/offline.html b/apps/checkout/partials/offline.html deleted file mode 100644 index 9d097cd2..00000000 --- a/apps/checkout/partials/offline.html +++ /dev/null @@ -1,12 +0,0 @@ - - - diff --git a/classes/class.ilRESTConfigGUI.php b/classes/class.ilRESTConfigGUI.php index bbc1d7ae..f1e96d78 100644 --- a/classes/class.ilRESTConfigGUI.php +++ b/classes/class.ilRESTConfigGUI.php @@ -5,8 +5,8 @@ * Authors: D.Schaefer, T.Hufschmidt <(schaefer|hufschmidt)@hrz.uni-marburg.de> * Since 2014 */ - - + + // Include core configuration UI class require_once("./Services/Component/classes/class.ilPluginConfigGUI.php"); // Requires <$tpl>, <$ilUser>, <$ilCtrl>, <$ilTabs> @@ -20,7 +20,7 @@ * @author Dirk Schaefer * @version $Id$ */ -class ilRESTConfigGUI extends ilPluginConfigGUI { +class ilRESTConfigGUI extends ilPluginConfigGUI { /** * Handles all commmands * - configure @@ -32,7 +32,7 @@ class ilRESTConfigGUI extends ilPluginConfigGUI { function performCommand($cmd) { global $ilTabs; $ilTabs->clearTargets(); - + // Handle commands switch ($cmd) { case "configure": @@ -47,54 +47,47 @@ function performCommand($cmd) { */ function configure() { global $tpl, $ilUser, $ilCtrl; - + // Get base ILIAS directory for POST data $inst_folder = dirname($_SERVER['SCRIPT_NAME']); $inst_folder = str_replace('\\', '/', $inst_folder); - $inst_folder = ($inst_folder == '/' ? '' : $inst_folder); - + $inst_folder = ($inst_folder == '' ? '/' : $inst_folder); + // Get plugin o bject for translations $pl = $this->getPluginObject(); - + // Required to be able to fetch rtoken on $ilCtrl $ilCtrl->getFormAction($this); - + // Create HTML layout $configHTML = '

'.$pl->txt("welcome_config").'

'; $configHTML .= '
'; $configHTML .= '

'.$pl->txt("welcome_adminpanel").'

'; $configHTML .= ' -
- - - - - - - - -
+
+ + + + + + + + +
'; $configHTML .= '
'; - /* $configHTML .= ' - - ';*/ $configHTML .= '

'.$pl->txt("welcome_checkout_app").'

'; $configHTML .= ' -
- - - -
+
+ + + + + + + + +
'; $configHTML .= '
'; // Render content in ILIAS