View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
11727 | Bug reports | Expression Manager | public | 2016-09-29 13:31 | 2016-10-21 10:41 |
Reporter | TonyM | Assigned To | ollehar | ||
Priority | none | Severity | partial_block | ||
Status | closed | Resolution | fixed | ||
Product Version | 2.52.x | ||||
Fixed in Version | 2.54 | ||||
Summary | 11727: "Undefined index: LEMsid" with a plugin sidebody URL | ||||
Description | I got this error after logging in and entering a survey: "Undefined index: LEMsid" at application/helpers/expressions/em_manager_helper.php(4803) The method call at | ||||
Steps To Reproduce |
| ||||
Tags | No tags attached. | ||||
Attached Files | TestPlugin.php (286 bytes)
<?php class TestPlugin extends ls\pluginmanager\PluginBase { protected $storage = 'DbStorage'; static protected $name = 'TestPlugin'; static protected $description = 'test'; protected $settings = array(); function handleAdminRequest( $surveyId ) { echo 'test'; } } TestPlugin2.php (416 bytes)
<?php class TestPlugin2 extends ls\pluginmanager\PluginBase { protected $storage = 'DbStorage'; static protected $name = 'TestPlugin2'; static protected $description = 'test'; protected $settings = array(); function handleAdminRequest( $surveyId ) { return '<strong>Some content wrapped inside the Limesurvey admin dashboard HTML wrapper. Survey ID is '. ( (int) $surveyId ) .'.</strong>'; } } | ||||
Bug heat | 10 | ||||
Complete LimeSurvey version number (& build) | 2.52+160920 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | MySQL Ver 15.1 Distrib 10.0.27-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2 | ||||
Server OS (if known) | Debian | ||||
Webserver software & version (if known) | Apache | ||||
PHP Version | PHP 5.4.45 | ||||
Not sure what you're trying to do here. The documentation is not entirely up to date with regard to plugins and 2.5. You can check this plugin for examples: https://github.com/olleharstedt/MassAction/blob/master/MassAction.php#L933 Feel free to ask any questions. Olle |
|
I need a reliable way to create custom admin pages, that are wrapped inside the Limesurvey admin UI, in two flavors:
See the attached screenshots. P.S. I noticed that the TestPlugin.php is slightly wrong (echo instead of return). I attached the corrected TestPlugin2.php (browse to http://example.com/limesurvey/admin/pluginhelper?sa=sidebody&plugin=TestPlugin2&method=handleAdminRequest&surveyId=<id_of_an_existing_survey>). P.P.S. I never got newDirectRequest to work. The attached plugin NewDirectRequestNotWorking.php illustrates the problem (see also issue 10645), so I used the plugin sidebody URLs instead. NewDirectRequestNotWorking.php (1,116 bytes)
<?php /** * When accessing the path: * * http://localhost/limesurvey/plugins/direct/?plugin=NewDirectRequestNotWorking&function=someEndpoint * * this plugin throws the error: * * Alias "ext.Menu.MenuWidget" is invalid. Make sure it points to an existing PHP file and the file is readable. * /framework/YiiBase.php(323) */ class NewDirectRequestNotWorking extends ls\pluginmanager\PluginBase { protected $storage = 'DbStorage'; static protected $name = 'NewDirectRequestNotWorking'; static protected $description = 'test'; protected $settings = array(); function init() { $this->subscribe( 'newDirectRequest' ); } function newDirectRequest() { $event = $this->event; if ( $event->get( 'target' ) === __CLASS__ ) { $functionToCall = $event->get( 'function' ); if ( method_exists( $this, $functionToCall ) ) { $content = $this->$functionToCall(); $event->setContent( $this, $content ); } } } function someEndpoint() { return '<strong>Some content wrapped inside the Limesurvey admin dashboard HTML wrapper.</strong>'; } } |
|
The URL in Screenshot_2016-10-15_12-22-26.png (when surveyId is non-zero) only works, when I change the Survey_Common_Action.php call from LimeExpressionManager::StartProcessingPage(false, Yii::app()->baseUrl) to LimeExpressionManager::StartProcessingPage(false). Here are again the steps to reproduce:
|
|
PS : newDirectRequest don't have any helper. More for json, dieredirect in fact. M%aybe add a new function in it for 'quickduplay message/content) to public : https://bugs.limesurvey.org/view.php?id=11801 Minimal layout for public survey. I lik ethe idea to have different event for public part VS admin part. |
|
Tony, your URL is wrong, I'm afraid. 2.5 uses a plugin helper, like this: localhost/index.php/admin/pluginhelper?sa=sidebody&plugin=ExamplePlugin&method=actionIndex&surveyId=793951 |
|
Check this example plugin. BUT: You will have to pull the latest update from github, the necessary code is not released yet (will be soon). |
|
A question: Which manual page did you first stumble upon when trying to implement plugin? If you give me a link I can update it. |
|
Note that pluginhelper has two subactions (sa) you will use: "sidebody" and "fullpagewrapper". The "sidebody" subaction needs surveyId as a param:
For "fullpagewrapper":
Hope this helps! Olle |
|
Which part of my URL is incorrect? My URL The "fullpagewrapper" is a nice addition. It will be useful for me, so that I don't have to fake a full-page-wrapped custom admin page anymore with the "sidebody" subaction and no surveyId. I checked the ExamplePlugin.php. Why is it using the newDirectRequest event? If I delete the newDirectRequest() and the init() methods from this plugin, the sidebody and fullpagewrapper URLs still work. The bug mentioned in the ticket description still exists in 2.54.4. Have you tried to reproduce the steps? Using a subdirectory installation of Limesurvey, this fails:
This succeeds:
|
|
(I can't seem to be able to edit the message, but the last URL should of course have the surveyId 1235.) |
|
Great reproduction : LEMsid is related to expression manager start. But try reproducing issue with example plugin : Go to the link just after login : no issue for me BUT : seems more a core bug here : maybe LEM session is not set just before adding a survey. Not really needed in fact .... |
|
OK, I can confirm that bug. Will have a look. |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=21100 |
|
Version 2.55 released |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2016-09-29 13:31 | TonyM | New Issue | |
2016-09-29 13:31 | TonyM | File Added: TestPlugin.php | |
2016-09-30 00:23 | DenisChenu | Issue Monitored: DenisChenu | |
2016-10-14 16:50 | ollehar | Note Added: 41361 | |
2016-10-14 16:50 | ollehar | Assigned To | => ollehar |
2016-10-14 16:50 | ollehar | Status | new => assigned |
2016-10-15 11:49 | TonyM | File Added: Screenshot_2016-10-15_12-22-38.png | |
2016-10-15 11:50 | TonyM | File Added: Screenshot_2016-10-15_12-22-26.png | |
2016-10-15 11:52 | TonyM | File Added: TestPlugin2.php | |
2016-10-15 12:18 | TonyM | File Added: NewDirectRequestNotWorking.php | |
2016-10-15 12:18 | TonyM | Note Added: 41370 | |
2016-10-15 12:26 | TonyM | Note Added: 41371 | |
2016-10-15 13:08 | DenisChenu | Note Added: 41372 | |
2016-10-17 10:50 | ollehar | Note Added: 41384 | |
2016-10-17 10:50 | ollehar | Note Edited: 41384 | |
2016-10-17 11:02 | ollehar | File Added: ExamplePlugin.php | |
2016-10-17 11:03 | ollehar | File Added: ExamplePlugin-2.php | |
2016-10-17 11:03 | ollehar | Note Added: 41385 | |
2016-10-17 11:03 | ollehar | Note Added: 41386 | |
2016-10-17 11:05 | ollehar | Note Added: 41387 | |
2016-10-17 11:06 | ollehar | File Deleted: ExamplePlugin-2.php | |
2016-10-18 21:30 | TonyM | Note Added: 41450 | |
2016-10-18 21:38 | TonyM | Note Added: 41451 | |
2016-10-18 23:46 | DenisChenu | Note Added: 41453 | |
2016-10-19 10:16 | ollehar | Note Added: 41460 | |
2016-10-19 10:37 | ollehar | Status | assigned => resolved |
2016-10-19 10:37 | ollehar | Resolution | open => fixed |
2016-10-19 10:37 | ollehar | Fixed in Version | => 2.54 |
2016-10-19 11:33 | ollehar | Changeset attached | => LimeSurvey master 6a432f99 |
2016-10-19 11:33 | ollehar | Note Added: 41480 | |
2016-10-21 10:41 | c_schmitz | Note Added: 41517 | |
2016-10-21 10:41 | c_schmitz | Status | resolved => closed |