Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

survey activation event and adding content to survey overview

  • mindau
  • mindau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #171135 by mindau
Hello, I'm developing survey url shortener plugin (based on Bitly api ) and encountered some problems.

from the manual beforeSurveyActivate event is not yet released. For short url generation im using beforeSurveySettingsSave event. . beforeSurveyActivate event checks if survey is active or not and if active then beforeSurveyActivate calls short url generation. This solution is not best, because I must to click "save" on the survey if I want to generate a short url. Can I use any other event that suits better?

Second question is if i can somehow put new generated url into Overview tab under default survey url?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 5 months ago #171137 by DenisChenu
About beforeSurveyActivate : seems manual is outdated github.com/LimeSurvey/LimeSurvey/blob/af...vate_helper.php#L267

Else, sometimes i use www.limesurvey.org/manual/Plugin_events#Model_Events to know what happen.

For «put new generated url into Overview» : only javascript solution

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • mindau
  • mindau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #171208 by mindau
Thank you, beforeSurveyActivate works indeed!

Now I'm struggling with short URL display solution.


I think I can use beforeSurveyBarRender() event to check if survey is activated & short url is generated and if yes -> then append short url with javascript in right place.

But how can I inject JS from plugin class?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 5 months ago #171217 by DenisChenu
framagit.org/Shnoulle/insertAdminJS/blob...nsertAdminJS.php#L49

beforeControllerAction , you can restrict to admin + survey for example

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
  • mindau
  • mindau's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 5 months ago #171232 by mindau
Thank you for your help. I solved this with beforeSurveyBarRender instead of beforeControllerAction, because i have better control and information of survey.

I will upload my plugin later to github and post it in forum.

My plugin uses Bitly shortener api. After activation bitly url is posted to overview also.

Just one quick question.

Based on Plugins_-_advanced Manual settings could have also readOnly option. But its somehow does not work. I tried true, 1 "1","true" but I can edit it anyway

... array(
'type' => 'string',
'readOnly' => true
.....
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
6 years 5 months ago - 6 years 5 months ago #171244 by DenisChenu
I never use beforeSurveyBarRender , maybe i must look at it , thank you.

About the issue : did you try
Code:
'htmlOptions'  => array(
'readonly' => true,
),

Remind : you need to save yourself the settings in www.limesurvey.org/manual/NewSurveySettings

PS about the readOnly : strange : code is here : github.com/LimeSurvey/LimeSurvey/blob/d3...tingsWidget.php#L611 Please , report the issue with an example plugin.

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 6 years 5 months ago by DenisChenu.
The topic has been locked.
Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose