View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
10645Bug reportsPluginspublic2016-10-26 12:22
Reportermohammad Assigned Toollehar  
PrioritylowSeverityblock 
Status closedResolutionfixed 
Product Version2.50.x 
Fixed in Version2.55.x 
Summary10645: CSS Not Loaded When Using NewDirectRequest Event Plugin
Description

Hi Team,

I'm following the same steps here https://manual.limesurvey.org/Add_new_menu_and_view_by_a_plugin

And the result as SS below !

TagsNo tags attached.
Attached Files
Bug heat10
Complete LimeSurvey version number (& build)160225
I will donate to the project if issue is resolvedNo
BrowserFirefox
Database type & version5.6.28 - MySQL Community Server (GPL)
Server OS (if known)OS X Version 10.8.5 - local development
Webserver software & version (if known)Apache/2.2.29 (Unix) DAV/2 PHP/5.3.29 mod_ssl/2.2.29 OpenSSL/0.9.8zg
PHP Version5.3.29

Users monitoring this issue

There are no users monitoring this issue.

Activities

ollehar

ollehar

2016-03-03 14:30

administrator   ~35867

The file MenuWidget.php was removed. That's the class that fires the event afterAdminMenuLoad.

mohammad

mohammad

2016-03-03 14:57

reporter   ~35873

Last edited: 2016-03-03 14:58

Even when I used newDirectRequest event only - without afterAdminMenuLoad event-, the design as SS

ollehar

ollehar

2016-03-03 15:34

administrator   ~35885

I don't think the class SHOULD have been removed, it might have been a mistake.

Can you provide us with your plugin code, please?

mohammad

mohammad

2016-03-03 15:38

reporter   ~35888

It's Straight forward as link above

class Pages extends PluginBase {

protected $storage = 'DbStorage';    
static protected $description = 'New Pages Plugin';
static protected $name = "Pages";

public function __construct(PluginManager $manager, $id) {
    parent::__construct($manager, $id);

    $this->subscribe('afterAdminMenuLoad');
    $this->subscribe('newDirectRequest');
}

public function afterAdminMenuLoad(){
    $event = $this->event;
    $menu = $event->get('menu', array());
    $menu['items']['left'][]=array(
            'href' => $this->api->createUrl('plugins/direct', array('plugin' => 'newPages', 'function' => 'rewards')),//"admin/plugins/direct/newPages?function=rewards",
            'alt' => gT('Rewards'),
            'image' => 'bounce.png'
        );
    $event->set('menu', $menu);
}

public function newDirectRequest(){
    $event = $this->event;
    $request = $event->get('request');
    //get the function param and then you can call that method
    $functionToCall = $event->get('function');        
    $content = call_user_func(array($this,$functionToCall));  

    $event->setContent($this, $content);
}

public function rewards() {
    $content = "<h1> plugin content set succesfully </h1>";
    return $content;        
}

}

ollehar

ollehar

2016-03-03 15:43

administrator   ~35890

And if you remove the plugin the CSS comes back?

mohammad

mohammad

2016-03-03 15:46

reporter   ~35891

All pages working fine. Just in this new page from plugin.

ex: http://localhost/limesurvey/index.php/plugins/direct?plugin=pages&function=rewards

DenisChenu

DenisChenu

2016-03-21 10:27

developer   ~36639

Attention : i think directRequest don't need ALWAYS admin css.

Think can be :

  • No css (use own view)
  • Template css (and page ?)
  • Admin page : global/survey/group or question menu.

I already have Own views/css plugin. Survey template and admin are more hack actually.

mohammad

mohammad

2016-03-21 11:03

reporter   ~36643

Last edited: 2016-03-21 11:04

  • I think this should be an option to be more flexible, load admin css or not.

  • How can I add a menu to existing one's as plugin example if css not loaded as expected.

  • Could you please share your plugin to understand how can I use views and css in plugin ?

Thanks

DenisChenu

DenisChenu

2016-03-21 12:03

developer   ~36658

Sorry, actually the plugin is not public . All my public plugins are here : https://git.framasoft.org/groups/SondagePro-LimeSurvey-plugin

mohammad

mohammad

2016-03-21 13:53

reporter   ~36670

I walkthrow all plugins, it seems there is no one simulate how to add new page, am I wrong ?

DenisChenu

DenisChenu

2016-03-21 14:02

developer   ~36676

No,

The most near : https://github.com/BelgianHealthCareKnowledgeCentre/LS-AutoComment_IterativeQuestionnaire/blob/master/autoCommentIterativeQuestionnaire.php#L555

But for 2.06 only ... bad hackink code.

mohammad

mohammad

2016-03-22 14:08

reporter   ~36703

Last edited: 2016-03-22 14:08

Configure in Example Plugin NOT working, I got the following error:
Alias "bootstrap.widgets.TbButtonGroup" is invalid. Make sure it points to an existing PHP file and the file is readable.

mohammad

mohammad

2016-03-22 14:12

reporter   ~36704

Also I got the following error when using afterAdminMenuLoad events

Alias "ext.Menu.MenuWidget" is invalid. Make sure it points to an existing PHP file and the file is readable.

DenisChenu

DenisChenu

2016-03-22 14:24

developer   ~36706

autoCommentIterativeQuestionnaire is a 2.06 plugin, not a 2.50 plugin.

Actually : seems there are no easy solution to have

Please : if you can make some pull request , it can be really great : https://github.com/LimeSurvey/LimeSurvey/pull/new/master

mohammad

mohammad

2016-03-22 14:59

reporter   ~36708

I didn't talk about autoCommentIterativeQuestionnaire.

It's new issues in 2.50 plugin

DenisChenu

DenisChenu

2016-03-22 15:01

developer   ~36709

Oh yes : this one : https://github.com/LimeSurvey/LimeSurvey/blob/master/plugins/Demo/Example/Example.php :)

mohammad

mohammad

2016-03-22 15:08

reporter   ~36710

Yes :)

DenisChenu

DenisChenu

2016-04-01 16:22

developer   ~36939

OK, find a solution when have time.

Think i start with a "public" solution, more easy (with the good template etc ...)

DenisChenu

DenisChenu

2016-04-04 16:33

developer   ~36987

I don't fix afterAdminMenuLoad because before it work only in Plugin menu, not in other menu.
But fix only the view.

Leave afterAdminMenuLoad for someone else or for 3.0 (where it's more ready)

DenisChenu

DenisChenu

2016-04-30 16:14

developer   ~38053

@olle : i assign it to you, because i think you made some fix to offer a new way to display admin page for plugin? OK ?

ollehar

ollehar

2016-05-02 10:49

administrator   ~38078

@Denis, yes I did, but only for 2.5. Look at my repo here: https://github.com/olleharstedt/MassAction for an example usage.

ollehar

ollehar

2016-05-02 10:52

administrator   ~38079

This is the part to generate URL to new plugin page:

    $href = Yii::app()->createUrl(
        'admin/pluginhelper', 
        array(
            'sa' => 'sidebody',
            'plugin' => 'MassAction',
            'method' => 'actionIndex',
            'surveyId' => $surveyId
        )
    );
ollehar

ollehar

2016-05-02 10:55

administrator   ~38080

NB: This is not official yet and might change.

LouisGac

LouisGac

2016-06-03 14:59

developer   ~39194

status on this bug?
is it fixed?

YuriyBabenko

YuriyBabenko

2016-09-09 03:34

reporter   ~40738

@LuisGac - I can confirm that the bug is NOT fixed. Running the latest version of LS, following the same example plugin as the reporter. I've slimmed-down the example plugin to only have the newDirectRequest event.

On loading the page, I get this error: Alias "ext.Menu.MenuWidget" is invalid. Make sure it points to an existing PHP file and the file is readable.

I found that the Menu extension's MenuWidget widget is being requested from /application/views/layouts/main.php, on line 31: $this->widget('ext.Menu.MenuWidget', $this->navData);

It is mentioned above that the Menu extension was removed from the codebase, so I'm guessing this line needs to be removed, too. Removing this line loads the page, but as for another poster above, it is missing all CSS/layout found on other pages.

ollehar

ollehar

2016-09-09 10:23

administrator   ~40740

Those instructions are for 2.06, not 2.50.x

LouisGac

LouisGac

2016-09-09 10:38

developer   ~40742

IN the future, we'll create a component for menus in admin UI so it will be easy for people to add/remove/update menus anywhere.

YuriyBabenko

YuriyBabenko

2016-09-09 23:42

reporter   ~40745

@olle - how does one register a route and render a view (with the proper CSS/surrounding markup) in 2.50.x?

ollehar

ollehar

2016-09-12 09:43

administrator   ~40752

Hi Yurly,

Best for now is to check existent plugin. E.g., you could checkout the Cint branch and look at the Cint plugin, or the Mass Action plugin: https://github.com/olleharstedt/MassAction

I'll try to find time to add proper documentation. Just ask me here or on #limesurvey IRC channel if you need more help.

Olle

Issue History

Date Modified Username Field Change
2016-03-02 09:47 mohammad New Issue
2016-03-02 09:47 mohammad File Added: Screen Shot 2016-03-01 at 4.54.28 PM.png
2016-03-03 12:40 ollehar Assigned To => ollehar
2016-03-03 12:40 ollehar Status new => assigned
2016-03-03 14:30 ollehar Note Added: 35867
2016-03-03 14:30 ollehar Assigned To ollehar => c_schmitz
2016-03-03 14:57 mohammad Note Added: 35873
2016-03-03 14:57 mohammad Note Edited: 35873
2016-03-03 14:58 mohammad Note Edited: 35873
2016-03-03 15:34 ollehar Note Added: 35885
2016-03-03 15:38 mohammad Note Added: 35888
2016-03-03 15:43 ollehar Note Added: 35890
2016-03-03 15:46 mohammad Note Added: 35891
2016-03-21 10:27 DenisChenu Note Added: 36639
2016-03-21 11:03 mohammad Note Added: 36643
2016-03-21 11:04 mohammad Note Edited: 36643
2016-03-21 12:03 DenisChenu Note Added: 36658
2016-03-21 13:53 mohammad Note Added: 36670
2016-03-21 14:02 DenisChenu Note Added: 36676
2016-03-22 14:08 mohammad Note Added: 36703
2016-03-22 14:08 mohammad Note Edited: 36703
2016-03-22 14:12 mohammad Note Added: 36704
2016-03-22 14:24 DenisChenu Note Added: 36706
2016-03-22 14:59 mohammad Note Added: 36708
2016-03-22 15:01 DenisChenu Note Added: 36709
2016-03-22 15:08 mohammad Note Added: 36710
2016-04-01 16:14 c_schmitz Assigned To c_schmitz => DenisChenu
2016-04-01 16:22 DenisChenu Note Added: 36939
2016-04-04 16:33 DenisChenu Note Added: 36987
2016-04-05 15:02 DenisChenu Priority urgent => normal
2016-04-05 15:02 DenisChenu Target Version => 3.0
2016-04-05 15:03 DenisChenu Assigned To DenisChenu =>
2016-04-05 15:23 DenisChenu Status assigned => new
2016-04-25 19:30 LouisGac Priority normal => low
2016-04-30 16:13 DenisChenu Assigned To => ollehar
2016-04-30 16:13 DenisChenu Status new => assigned
2016-04-30 16:14 DenisChenu Note Added: 38053
2016-05-02 10:49 ollehar Note Added: 38078
2016-05-02 10:52 ollehar Note Added: 38079
2016-05-02 10:55 ollehar Note Added: 38080
2016-06-03 14:59 LouisGac Note Added: 39194
2016-06-03 14:59 LouisGac Status assigned => acknowledged
2016-06-09 13:56 c_schmitz Assigned To ollehar =>
2016-06-09 13:58 c_schmitz Assigned To => ollehar
2016-06-09 13:58 c_schmitz Status acknowledged => assigned
2016-08-31 17:01 ollehar Status assigned => feedback
2016-09-09 03:34 YuriyBabenko Note Added: 40738
2016-09-09 10:23 ollehar Note Added: 40740
2016-09-09 10:38 LouisGac Note Added: 40742
2016-09-09 23:42 YuriyBabenko Note Added: 40745
2016-09-12 09:43 ollehar Note Added: 40752
2016-10-26 12:22 ollehar Status feedback => closed
2016-10-26 12:22 ollehar Resolution open => fixed
2016-10-26 12:22 ollehar Fixed in Version => 2.55.x