View Issue Details

IDProjectCategoryView StatusLast Update
04927User patchesSurvey at runtimepublic2012-06-21 13:23
ReportertimbeeAssigned Tomdekker 
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.90 
Target VersionFixed in Version1.91 
Summary04927: added SurveyGroupQuestion identifier as a variable for use in questions
Description

sometimes people use javascript in the question text field to do special things with a question. It is often necessary in this js to reference the input field element of the question, which has an html id in the format of AnswerSxGxQ. Instead of hard-coding the SxGxQ every time, this patch lets users simply use the template replacement marker of "{SGQ}" (without quotes) which will later get replaced with the actual SxGxQ before rendering in the survey.

Steps To Reproduce

Only four lines were added to the code in four separate files:

group.php (for displaying group by group surveys)
line:1258

question.php (for displaying question by question surveys)
line:572

survey.php (for displaying all-in-one surveys)
line:968

common_functions.php (handles the actual replacement of text)
line:2909

Additional Information

This was based on the install files for 1.9.1 RC3 Build 9642. Nothing else was altered except for the files/lines mentioned in "Steps To Reproduce"

Available at:
http://groundless.org/stuff/limesurvey-1.9.1-rc3-timbee-1.tar.gz

TagsNo tags attached.
Complete LimeSurvey version number (& build)9642

Activities

timbee

timbee

2011-02-04 17:34

reporter   ~14053

Okay, I built a patch based on the latest SVN source (9742),
attached a a file here...

timbee

timbee

2011-02-04 17:35

reporter  

diff.patch (1,333 bytes)
Common subdirectories: limesurvey_9742/admin and limesurvey-timbee/admin
Common subdirectories: limesurvey_9742/classes and limesurvey-timbee/classes
diff limesurvey_9742/common_functions.php limesurvey-timbee/common_functions.php
2908a2909
>     if (strpos($line, "{SGQ}") !== false) $line=str_replace("{SGQ}", $question['sgq'], $line);
Common subdirectories: limesurvey_9742/docs and limesurvey-timbee/docs
Common subdirectories: limesurvey_9742/fonts and limesurvey-timbee/fonts
diff limesurvey_9742/group.php limesurvey-timbee/group.php
1250a1251
>         $question['sgq']=$qa[7];
Common subdirectories: limesurvey_9742/images and limesurvey-timbee/images
Common subdirectories: limesurvey_9742/locale and limesurvey-timbee/locale
diff limesurvey_9742/question.php limesurvey-timbee/question.php
571a572
>             $question['sgq']=$qa[7];
Common subdirectories: limesurvey_9742/scripts and limesurvey-timbee/scripts
diff limesurvey_9742/survey.php limesurvey-timbee/survey.php
967a968
>                 $question['sgq']=$qa[7];
Common subdirectories: limesurvey_9742/.svn and limesurvey-timbee/.svn
Common subdirectories: limesurvey_9742/templates and limesurvey-timbee/templates
Common subdirectories: limesurvey_9742/tmp and limesurvey-timbee/tmp
Common subdirectories: limesurvey_9742/upload and limesurvey-timbee/upload
diff.patch (1,333 bytes)
DenisChenu

DenisChenu

2011-02-05 10:56

developer   ~14054

Thanks !

Not for 1.90, but maybe for 1.91 or 1.92.

timbee

timbee

2011-02-06 01:51

reporter   ~14056

groovy, thanks :)

Mazi

Mazi

2011-02-08 20:57

partner   ~14091

Menno, can you review the patch?

mdekker

mdekker

2011-02-09 19:59

reporter   ~14119

Sure no problem

mdekker

mdekker

2011-02-09 20:38

reporter   ~14120

Committed in svn 9755
Could you please add the documentation to our wiki?
http://docs.limesurvey.org/The+template+editor&structure=English+Instructions+for+LimeSurvey#Keywords

perhaps with a link in the relevant work-around sections with the javascript?

Issue History

Date Modified Username Field Change
2011-02-03 17:31 timbee New Issue
2011-02-04 17:34 timbee Note Added: 14053
2011-02-04 17:35 timbee File Added: diff.patch
2011-02-05 10:56 DenisChenu Note Added: 14054
2011-02-06 01:51 timbee Note Added: 14056
2011-02-08 20:57 Mazi Assigned To => mdekker
2011-02-08 20:57 Mazi Status new => assigned
2011-02-08 20:57 Mazi Note Added: 14091
2011-02-09 19:59 mdekker Note Added: 14119
2011-02-09 20:38 mdekker Note Added: 14120
2011-02-09 20:38 mdekker Status assigned => resolved
2011-02-09 20:38 mdekker Fixed in Version => 1.91
2011-02-09 20:38 mdekker Resolution open => fixed
2012-06-21 13:23 c_schmitz Status resolved => closed