Forum OpenACS Development: Problems with ad_form Quoting of Indents in OpenACS 5.9

Request notifications

Hi!

I understand that OpenACS 5.9 has changed HTML quoting policies in several ways for security and other reasons. These changes apparently also affect ad_form.

]po[ is based on hierarchical data structures and needs to display nested tree-like structures in many ad_form forms. We've got a dedicated TCL widget to display "categories" (the types and states of ]po[ business objects), but there are many cases where we need to pass hierarchical structures via the ad_form "select" widget using the "options" parameter including:
- Projects and sub-projects
- Tasks and sub-tasks
- Cost centers & departments
- Materials hierarchy
- Files and folders
- Companies and sub-companies
- Configuration items and sub-items
- Cost items and sub-items
- Discussion topics and sub-topics
- Menus and sub-menus
- Financial planning items and sub-items
- Groups, sub-groups and members

There are to my knowledge three options for creating indents in HTML:

- CSS: Is ruled out, OK.
- White spaces: Are ignored by HTML
-   non-breakable spaces: The "&" and ";" are quoted by ad_form

So apparently there is no way anymore to display tree-like structures in ad_form, is that correct? We won't write specific widgets for all of the cases above. So we would probably have to hack the quoting system? On the level of templates, or directly in ad_form?

Cheers,
Frank

Collapse
Posted by Gustaf Neumann on
Can you provide a short example showing the problem/differences? ad_form does not do quoting, but the templates and/or widgets might.

-g

Collapse
Posted by Frank Bergmann on
Hi Gustaf,

Just include a "&npsp;" in any "options" parameter of an ad_form entry.

Cheers,
Frank

Collapse
Posted by Gustaf Neumann on
Something like this?
ad_form -form {
    id:key
    {title:text 
        {label Title}
        {html {size 20}}
    }
    {body:text(textarea) 
        {label Body}
        {html {rows 10 cols 40}}
    }
    {vitamins:text(checkbox) 
        {label "Vitamins"}
        {options {
            {Lettuce lettuce}
            {" Tomato" tomato}
            {"  Pickle" pickle}
            {"   Sprouts" sprouts}
        }}
    }
} ....
the display is for me as expected, every option is indented further by one space.

Is this different for you?
-g

Collapse
Posted by Frank Bergmann on
Hi Gustaf,

Thanks for the quick replies. Correct, the Pickles and Sprouts appear indented in your example, I was wrong with the "any". Try adding the following select field. So the quoting issue only appears with the "select" widget?

        {action:text(select)
            {label Action}
            {options {
                { " aaa" a }
                { bbb b}
            }}
        }
Thanks,
Frank

Collapse
Posted by Gustaf Neumann on
Frank,

Thanks for the example. submitting concise bug-reports helps. I've updated the code in CVS (should also be available tomorrow via "upgade from repository". The example below works now as expected.

-g

    {action:text(select)
        {label Action}
        {options {
            { "    aaa" a }
            { "  bbb" b }
            { "<c>" c }
        }}
    }

Collapse
Posted by Frank Bergmann on
Hi Gustaf,

Could you please tell me which file was affected by fixing the issue? We had to patch OpenACS 5.9 considerably, so it would be a lot of work to update everything again.

Thanks!
Frank

Collapse
Posted by Gustaf Neumann on
you have a lot of patches for acs-core? This should not be necessary and sounds to me as if changes were local changes brought into at the wrong place.

anyhow, my positing above was on feb 24, you see the changes in chronological order in [1]. I think, [2,3] should be sufficient ... although i would not recommend to much cherry-picking.

-g

[1] http://cvs.openacs.org/
[2] http://cvs.openacs.org/changelog/OpenACS?cs=oacs-5-9%3Agustafn%3A20160224121926
[3] http://cvs.openacs.org/changelog/OpenACS?cs=oacs-5-9%3Agustafn%3A20160303203307

Collapse
Posted by Frank Bergmann on
Hi,

I've updated widget-procs.tcl, it seems to be OK now.

Maybe we could go through our changes at some moment (before the next ]po[ release?) and check together the changes?

Thanks a lot!
Frank