Forum OpenACS Development: Complex Survey and Section Templates

The Complex Survey package in contrib has a UI that allows you to create a template specifically for a given section_id. (section-template-ae) This seems very useful.

After debugging I've got that page to work and it displays on the preview if I set @style@ appropriately.

However, its not working in the normal /www/respond page. Looking at the code, the following section of survey_section_add_to_form seems to be the section that should control the template. The code is finding the file and $section_template has the template contents in it. However section_template is never used anywhere else and the survey is displayed with the standard template not its specific template.

From survey_section_add_to_form:

 # Is there a template for the section?
    set template_filename "[template::get_resource_path]/forms/survey/sections/${section_id}.adp"
    if {[file exists $template_filename]} {
        set section_template [template::util::read_file $template_filename]
        uplevel [list set section_template($section_info(name)) $section_template]
    }
Can anyone shed some light on the intent of the code?

How do I tell acs-templating to use a specific template for a specific section when creating a form? I can't just set the @style@ as I did in section-template-ae because that would effect the whole form not just the specific section.

Thanks

Caroline

Collapse
Posted by Malte Sussdorff on
As sections are displayed seperately on each page, you should be able to use exactly the same code. Using templates for sections that are displayed on one page is out of the scope of complex survey. If this functionality is needed we should incorporate it in our assessment specifications.
Collapse
Posted by Malte Sussdorff on
If you look at the style files they contain code to handle your request. If there is a template they will display the template and ignore the rest. Check out /survey/acs-templating/ressources/forms/survey/plain.adp for an example.