View Issue Details

IDProjectCategoryView StatusLast Update
04698User patchesTemplatespublic2013-01-13 12:24
ReporterDenisChenu Assigned Tosammousa  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.90+ 
Target Version1.91Fixed in Version 
Summary04698: Optionnal part in template
Description

Hello,

Sometimes in template, i like to use some background, padding, css3 option . It can be fun ;).

But if i put for example:
.questionhelp{background:yellow;color:red;padding:20px} the i have a yllow box of help is empty.

I think it can be interesting to have some optionnal part:
{optionalpartQUESTIONHELPoptionalparttoo}

This can be intersting too for this problem:
http://www.limesurvey.org/support/forums/2-design-issues/50769-question-indent?lang=fr#50775

Additional Information

Patch for some template part, but i think it need review. Maybe there are more simple solution.

I add for the other template part if OK, or maybe it intersting to restrict only for some part.

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

Activities

DenisChenu

DenisChenu

2010-10-25 16:30

developer  

templatepregreplace.diff (4,653 bytes)
2596c2596
<         if (strpos($line, "{GROUPNAME}") !== false) $line=str_replace("{GROUPNAME}", $groupname, $line);
---
>         if (preg_match("~(.*)(\{)(.*)GROUPNAME(.*)(\})(.*)~",$line)) $line=preg_replace("~(.*)(\{)(.*)GROUPNAME(.*)(\})(.*)~","$1$3$groupname$4$6",$line);
2600c2600
<         if (strpos($line, "{GROUPNAME}") !== false) $line=str_replace("{GROUPNAME}", '' , $line);
---
>         if (preg_match("~(.*)(\{)(.*)GROUPNAME(.*)(\})(.*)~",$line)) $line=preg_replace("~(.*)(\{)(.*)GROUPNAME(.*)(\})(.*)~","$1$6",$line);
2610c2610
<         if (strpos($line, "{GROUPDESCRIPTION}") !== false) $line=str_replace("{GROUPDESCRIPTION}", $groupdescription, $line);
---
>         if (preg_match("~(.*)(\{)(.*)GROUPDESCRIPTION(.*)(\})(.*)~",$line)) $line=preg_replace("~(.*)(\{)(.*)GROUPDESCRIPTION(.*)(\})(.*)~","$1$3$groupdescription$4$6",$line);
2614c2614
<         if (strpos($line, "{GROUPDESCRIPTION}") !== false) $line=str_replace("{GROUPDESCRIPTION}", '' , $line);
---
>         if (preg_match("~(.*)(\{)(.*)GROUPDESCRIPTION(.*)(\})(.*)~",$line)) $line=preg_replace("~(.*)(\{)(.*)GROUPDESCRIPTION(.*)(\})(.*)~","$1$6",$line);
2625,2630c2625,2666
<             if (strpos($line, "{QUESTION_TEXT}") !== false) $line=str_replace("{QUESTION_TEXT}", $question['text'], $line);
<             if (strpos($line, "{QUESTION_HELP}") !== false) $line=str_replace("{QUESTION_HELP}", $question['help'], $line);
<             if (strpos($line, "{QUESTION_MANDATORY}") !== false) $line=str_replace("{QUESTION_MANDATORY}", $question['mandatory'], $line);
<             if (strpos($line, "{QUESTION_MAN_MESSAGE}") !== false) $line=str_replace("{QUESTION_MAN_MESSAGE}", $question['man_message'], $line);
<             if (strpos($line, "{QUESTION_VALID_MESSAGE}") !== false) $line=str_replace("{QUESTION_VALID_MESSAGE}", $question['valid_message'], $line);
<             if (strpos($line, "{QUESTION_FILE_VALID_MESSAGE}") !== false) $line=str_replace("{QUESTION_FILE_VALID_MESSAGE}", $question['file_valid_message'], $line);
---
>             if(preg_match("~(.*)(\{)(.*)QUESTION_TEXT(.*)(\})(.*)~",$line)){
>                 if(trim($question['text'])!=""){
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_TEXT(.*)(\})(.*)~","$1$3{$question['text']}$4$6",$line);
>                 }else{
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_TEXT(.*)(\})(.*)~","$1$6",$line);
>                 }
>             }
>             if(preg_match("~(.*)(\{)(.*)QUESTION_HELP(.*)(\})(.*)~",$line)){
>                 if(trim($question['help'])!=""){
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_HELP(.*)(\})(.*)~","$1$3{$question['help']}$4$6",$line);
>                 }else{
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_HELP(.*)(\})(.*)~","$1$6",$line);
>                 }
>             }
>             if(preg_match("~(.*)(\{)(.*)QUESTION_MANDATORY(.*)(\})(.*)~",$line)){
>                 if(trim($question['mandatory'])!=""){
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_MANDATORY(.*)(\})(.*)~","$1$3{$question['mandatory']}$4$6",$line);
>                 }else{
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_MANDATORY(.*)(\})(.*)~","$1$6",$line);
>                 }
>             }
>             if(preg_match("~(.*)(\{)(.*)QUESTION_MAN_MESSAGE(.*)(\})(.*)~",$line)){
>                 if(trim($question['man_message'])!=""){
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_MAN_MESSAGE(.*)(\})(.*)~","$1$3{$question['man_message']}$4$6",$line);
>                 }else{
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_MAN_MESSAGE(.*)(\})(.*)~","$1$6",$line);
>                 }
>             }
>             if(preg_match("~(.*)(\{)(.*)QUESTION_VALID_MESSAGE(.*)(\})(.*)~",$line)){
>                 if(trim($question['valid_message'])!=""){
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_VALID_MESSAGE(.*)(\})(.*)~","$1$3{$question['man_message']}$4$6",$line);
>                 }else{
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_VALID_MESSAGE(.*)(\})(.*)~","$1$6",$line);
>                 }
>             }
>             if(preg_match("~(.*)(\{)(.*)QUESTION_FILE_VALID_MESSAGE(.*)(\})(.*)~",$line)){
>                 if(trim($question['valid_message'])!=""){
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_FILE_VALID_MESSAGE(.*)(\})(.*)~","$1$3{$question['file_valid_message']}$4$6",$line);
>                 }else{
>                     $line=preg_replace("~(.*)(\{)(.*)QUESTION_FILE_VALID_MESSAGE(.*)(\})(.*)~","$1$6",$line);
>                 }
>             }
templatepregreplace.diff (4,653 bytes)
DenisChenu

DenisChenu

2013-01-13 12:24

developer   ~23624

Sam work this in 2.2.

Issue History

Date Modified Username Field Change
2010-10-25 16:30 DenisChenu New Issue
2010-10-25 16:30 DenisChenu File Added: templatepregreplace.diff
2010-10-26 16:46 c_schmitz Assigned To => c_schmitz
2010-10-26 16:46 c_schmitz Status new => assigned
2012-08-14 22:52 c_schmitz Project Development => User patches
2013-01-13 12:24 DenisChenu Note Added: 23624
2013-01-13 12:24 DenisChenu Status assigned => closed
2013-01-13 12:24 DenisChenu Assigned To c_schmitz => sammousa
2013-01-13 12:24 DenisChenu Resolution open => fixed