hrz-unimr / Ilias.RESTPlugin

An ILIAS Plugin for creating and using REST APIs
GNU General Public License v3.0
10 stars 18 forks source link

"Start Administration Panel" fails with "{{'INDEX_BRAND' | translate}}" #15

Closed imonk closed 9 years ago

imonk commented 9 years ago

I was able to install & activate the plugin. I can open the info page (see attachment). Everything looks good but the REST/apps/admin/index.php seems to have trouble translating when I'm trying to open the Administration Panel.

restplugin

Error:

rest2
Hufschmidt commented 9 years ago

Thank you for your report.

The translation inside the admin-panel is done using AngularJS. Is only the translation missing, or is the whole login/navigation panel missing/broken?

My first guess is, either the Angular plugin could not load/find the translations or Angular (as a whole) was unable to initialize for some reason.

Is there any output in the developer console when browsing the admin-panel? (In chrome: CTRL + SHIFT + I -> Console)

imonk commented 9 years ago

Thanks for the swift reply.

You're right, AngularJS is complaining that some postVars is not defined in the module myApp.service (see console log below). Since the php fails on translating the index_title I don't get anything else of the RESTplugin admin panel than " {{'INDEX_BRAND' | translate}}". Within ILIAS everything seems to be fine, I have english & german language packages installed and can switch between them without problems.

Console error output (domain-name replaced with [myDomain]) :

Uncaught SyntaxError: Unexpected identifier                                           index.php:31 

Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:       angular.js:68
Error: [$injector:modulerr] Failed to instantiate module myApp.services due to:
ReferenceError: postVars is not defined
    at new <anonymous> (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/js/services.js:24:21)
    at invoke (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4464:17)
    at Object.instantiate (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4472:27)
    at provider (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4307:36)
    at Object.provider (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4299:16)
    at runInvokeQueue (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4370:35)
    at http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4378:11
    at forEach (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:336:20)
    at loadModules (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4360:5)
    at http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4377:40
http://errors.angularjs.org/1.4.4-build.4128+sha.e742316/$injector/modulerr…erInterfaceHook%2FREST%2Fapps%2Fadmin%2Flibs%2Fjs%2Fangular.js%3A4377%3A40
    at REGEX_STRING_REGEXP (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:68:12)
    at http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4399:15
    at forEach (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:336:20)
    at loadModules (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4360:5)
    at http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4377:40
    at forEach (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:336:20)
    at loadModules (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4360:5)
    at createInjector (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:4286:11)
    at doBootstrap (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:1649:20)
    at bootstrap (http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/libs/js/angular.js:1670:12)
http://errors.angularjs.org/1.4.4-build.4128+sha.e742316/$injector/modulerr…erInterfaceHook%2FREST%2Fapps%2Fadmin%2Flibs%2Fjs%2Fangular.js%3A1670%3A12)

REGEX_STRING_REGEXP @   angular.js:68
(anonymous function)    @   angular.js:4399
forEach @   angular.js:336
loadModules @   angular.js:4360
createInjector  @   angular.js:4286
doBootstrap @   angular.js:1649
bootstrap   @   angular.js:1670
angularInit @   angular.js:1564
(anonymous function)    @   angular.js:28353
jQuery.Callbacks.fire   @   jquery.js:3094
jQuery.Callbacks.self.fireWith  @   jquery.js:3206
jQuery.extend.ready @   jquery.js:3412
completed   @   jquery.js:3428
Hufschmidt commented 9 years ago

Could you try accessing the admin-panel by calling:

 restplugin.php/rest/config

restplugin.php is located inside your base ILIAS folder.

If this works, then our "auto-login" Feature when coming from ILIAS is broken (again)...

imonk commented 9 years ago

I tried calling it directly but got back a 500 error. The permissions for restplugin.php are the same as for every other .php file in the ilias base folder.

Browser Console Log

GET http://[myDomain]/ilias/restplugin.php/rest/config 500 (Internal Server Error)
Navigated to http://[myDomain]/ilias/restplugin.php/rest/config                     ilias/restplugin.php/:1 

GET http://[myDomain]/ilias/restplugin.php/ 500 (Internal Server Error)             ilias/restplugin.php
Navigated to http://[myDomain]/ilias/restplugin.php/

The restplugin.log states a call from my IP, but nothing else:

REST call from 31.2... at 21/08/2015,13:58:42
imonk commented 9 years ago

Th error.log states some invalid usage of $this when not in object context and an undefined constant ENT_HTML5:

[Fri Aug 21 13:58:26 2015] [error] [client 31.24.11.200] PHP Fatal error: Using $this when not in object context in /var/www/vhosts/[...]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/app.php on line 89 
[Fri Aug 21 13:58:26 2015] [error] [client 31.24.11.200] PHP Fatal error: Using $this when not in object context in /var/www/vhosts/[...]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/app.php on line 195 
[Fri Aug 21 13:58:49 2015] [error] [client 31.24.11.200] PHP Notice: Use of undefined constant ENT_HTML5 - assumed 'ENT_HTML5' in /var/www/vhosts/[...]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php on line 40, referer: http://[myDomain]/ilias/ilias.php?ref_id=31&admin_mode=settings&ctype=Services&cname=UIComponent&slot_id=uihk&pname=REST&cmd=configure&cmdClass=ilrestconfiggui&cmdNode=rc:6s:uv&baseClass=ilAdministrationGUI 
[Fri Aug 21 13:58:49 2015] [error] [client 31.24.11.200] PHP Notice: Use of undefined constant ENT_HTML5 - assumed 'ENT_HTML5' in /var/www/vhosts/[...]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php on line 41, referer: http://[myDomain]/ilias/ilias.php?ref_id=31&admin_mode=settings&ctype=Services&cname=UIComponent&slot_id=uihk&pname=REST&cmd=configure&cmdClass=ilrestconfiggui&cmdNode=rc:6s:uv&baseClass=ilAdministrationGUI 
[Fri Aug 21 13:58:49 2015] [error] [client 31.24.11.200] PHP Notice: Use of undefined constant ENT_HTML5 - assumed 'ENT_HTML5' in /var/www/vhosts/[...]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php on line 42, referer: http://[myDomain]/ilias/ilias.php?ref_id=31&admin_mode=settings&ctype=Services&cname=UIComponent&slot_id=uihk&pname=REST&cmd=configure&cmdClass=ilrestconfiggui&cmdNode=rc:6s:uv&baseClass=ilAdministrationGUI 
[Fri Aug 21 13:58:49 2015] [error] [client 31.24.11.200] PHP Notice: Use of undefined constant ENT_HTML5 - assumed 'ENT_HTML5' in /var/www/vhosts/[...]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php on line 43, referer: http://[myDomain]/ilias/ilias.php?ref_id=31&admin_mode=settings&ctype=Services&cname=UIComponent&slot_id=uihk&pname=REST&cmd=configure&cmdClass=ilrestconfiggui&cmdNode=rc:6s:uv&baseClass=ilAdministrationGUI 
[Fri Aug 21 13:58:49 2015] [error] [client 31.24.11.200] PHP Notice: Use of undefined constant ENT_HTML5 - assumed 'ENT_HTML5' in /var/www/vhosts/[...]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php on line 44, referer: http://[myDomain]/ilias/ilias.php?ref_id=31&admin_mode=settings&ctype=Services&cname=UIComponent&slot_id=uihk&pname=REST&cmd=configure&cmdClass=ilrestconfiggui&cmdNode=rc:6s:uv&baseClass=ilAdministrationGUI 
[Fri Aug 21 13:58:49 2015] [error] [client 31.24.11.200] PHP Notice: Use of undefined constant ENT_HTML5 - assumed 'ENT_HTML5' in /var/www/vhosts/[...]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php on line 45, referer: http://[myDomain]/ilias/ilias.php?ref_id=31&admin_mode=settings&ctype=Services&cname=UIComponent&slot_id=uihk&pname=REST&cmd=configure&cmdClass=ilrestconfiggui&cmdNode=rc:6s:uv&baseClass=ilAdministrationGUI
Hufschmidt commented 9 years ago

Which PHP version is running on your server? We tested mostly against 5.6, although we also did some limited tests with 5.4.

imonk commented 9 years ago

Oh dear, we're still on 5.3.3. I probably should have mentioned earlier, sorry. I guess it's time to update...

Hufschmidt commented 9 years ago

I did a quick search and it seems like ENT_HTML5 constants where introduced in 5.4. While those aren't strikely necessary, fixing the issue with $this is a bit more difficult/involved. ( Eg. http://stackoverflow.com/questions/8690557/refer-to-this-from-anonymous-function-inside-a-class-method )

You can try downloading the latest version with git (should fix ENT_HTML5 constants missing) and apply this patch afterwards: https://gist.github.com/Hufschmidt/70f07504fc30574ea01b

But I have a feeling this won't be the last problems we might stumble upon with 5.3.x...

imonk commented 9 years ago

Thanks for your effort. The new version complains differently when opening the Admin-Panel (with & without patch): restfail Not sure about those double slashes... direct call of .../ilias/restplugin.php/rest/config does't work either.

After patching the error.log doesn't complain anymore about the previous issues, but others:

[Mon Aug 24 17:33:56 2015] [error] [client 31.24.11.200] PHP Fatal error: Call to undefined function RESTController\\libs\\getallheaders() in /var/www/vhosts/[myDomain]/subdomains/[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/libs/RESTRequest.php on line 23, referer: http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php 
[Mon Aug 24 17:33:56 2015] [error] [client 31.24.11.200] PHP Fatal error: Call to protected method RESTController\\RESTController::displayError() from context '' in /var/www/vhosts/[myDomain]/subdomains/[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/app.php on line 198, referer: http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php 
[Mon Aug 24 17:34:07 2015] [error] [client 31.24.11.200] PHP Fatal error: Call to undefined function RESTController\\libs\\getallheaders() in /var/www/vhosts/[myDomain]/subdomains/[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/libs/RESTRequest.php on line 23 
[Mon Aug 24 17:34:07 2015] [error] [client 31.24.11.200] PHP Fatal error: Call to protected method RESTController\\RESTController::displayError() from context '' in /var/www/vhosts/[myDomain]/subdomains/[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/app.php on line 198 
[Mon Aug 24 17:35:42 2015] [error] [client 31.24.11.200] PHP Warning: require_once(Services/Init/classes/class.ilInitialisation.php): failed to open stream: No such file or directory in /var/www/vhosts/[myDomain]/subdomains/[myDomain]/ilias/ilias.php on line 15, referer: http://[myDomain]/ilias/ilias.php?ref_id=31&admin_mode=settings&ctype=Services&cname=UIComponent&slot_id=uihk&pname=REST&cmd=configure&cmdClass=ilrestconfiggui&cmdNode=rc:6s:uv&baseClass=ilAdministrationGUI 
[Mon Aug 24 17:35:42 2015] [error] [client 31.24.11.200] PHP Fatal error: require_once(): Failed opening required 'Services/Init/classes/class.ilInitialisation.php' (include_path='.:') in /var/www/vhosts/[myDomain]/subdomains/[myDomain]/ilias/ilias.php on line 15, referer: http://[myDomain]/ilias/ilias.php?ref_id=31&admin_mode=settings&ctype=Services&cname=UIComponent&slot_id=uihk&pname=REST&cmd=configure&cmdClass=ilrestconfiggui&cmdNode=rc:6s:uv&baseClass=ilAdministrationGUI 
[Mon Aug 24 17:37:10 2015] [error] [client 31.24.11.200] File does not exist: /var/www/vhosts/[myDomain]/subdomains/[myDomain]/ilias/routes, referer: http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php 
[Mon Aug 24 17:37:10 2015] [error] [client 31.24.11.200] PHP Fatal error: Call to undefined function RESTController\\libs\\getallheaders() in /var/www/vhosts/[myDomain]/subdomains/[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/libs/RESTRequest.php on line 23, referer: http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php 
[Mon Aug 24 17:37:10 2015] [error] [client 31.24.11.200] PHP Fatal error: Call to protected method RESTController\\RESTController::displayError() from context '' in /var/www/vhosts/[myDomain]/subdomains/[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/RESTController/app.php on line 198, referer: http://[myDomain]/ilias/Customizing/global/plugins/Services/UIComponent/UserInterfaceHook/REST/apps/admin/index.php
imonk commented 9 years ago

Just to let you know. I installed ILIAS 5.0.4 with PHP Version 5.5.26 on a VM and the control panel works flawlessly. It is yet another reason to update our productive Server in the near future. Thanks again for your help.

Hufschmidt commented 9 years ago

This is good to hear. :)

In the future we might do some further work on (sup)porting PHP 5.3.x (since it is currently the minimal version required for ILIAS 5.0.x), but currently we are / I'm more focused at implementing a client-side application that consumes our REST-API.

I'll close this issue for now and add this to our internal task-tracker.

Hufschmidt commented 9 years ago

PS: Is there a way we could contact you? Although we are still relatively early in development we'd be interrested in feedback / your use-cases. (My contact: hufschmidt [@] hrz [.] uni-marburg [.] de)