cancel
Showing results for 
Search instead for 
Did you mean: 

Webform and directories

mvlach
Champ in-the-making
Champ in-the-making
Hello,

I am using alfresco(WCM) in small company and there is no problem. When we use this product for the large company, we have problem with usability of webforms. The definition on webform is coupled to the output path (i.e. /content/article/${name}.xml} and we can't place these file to userdefined directory structure. We have 8 templates (articles webforms) and we want to place output to the any directory in the web-app folder.

Can we saying:

create content for template A and place output to the directory B ? But in runtime, not only in definition of webform ? And second; can we use the formsdatafunction library to obtain it ?

Thanks Mila
7 REPLIES 7

zaizi
Champ in-the-making
Champ in-the-making
Hi,

See http://wiki.alfresco.com/wiki/Forms_Developer_Guide#Output_Path_Pattern_Examples

1. Using ${name}.xml puts it into the directory in which the use is currently browsing in the WCM. So browse the site by clicking on "Browse site" link in the user's sandbox and then select "Create Web content" from the "Create" drop down on the top left hand corner.

2. Using ${xml['root_tag/myns:namespaced'].xml you can based the output path pattern on a data value in the XML file created by the form. This is quite powerful as you can use the include a dynamic list of categories or list of existing folders in the form itself using http://wiki.alfresco.com/wiki/Forms_Authoring_Guide#Using_dynamic_types_in_schemas.

E.g. in the web form include a <xs:include schemaLocation="/get_folders.jsp"/>. (in this case get_folders.jsp is in the root of your WCM project and virtualisation server is running). This can return a dynamic list of folders currently that can be published to. This value of this field to work out the output path pattern.

Ainga

kvc
Champ in-the-making
Champ in-the-making
One other thing to consider:

Instead of a JSP callout, you can use the file-picker (xs:anyURI in your schema) and include an annotation that allows you to just select directories (can see that in your web-client-config-wcm.xml config file).  You can also as of 2.2E specify a top-level directory limiter - i.e., only allow the user to select a directory underneath a given path.

You can then reference that value in your output path expression.

Cheers.

Kevin

mvlach
Champ in-the-making
Champ in-the-making
Hi Kevin,

I know about this, but problem is the implementation of the form data functions. This library cannot find xml content recursive (in sub directory)
- or am I wrong ?

Thansk Mila

steventux
Champ in-the-making
Champ in-the-making
See http://wiki.alfresco.com/wiki/Forms_Developer_Guide#Output_Path_Pattern_Examples

1. Using ${name}.xml puts it into the directory in which the use is currently browsing in the WCM. So browse the site by clicking on "Browse site" link in the user's sandbox and then select "Create Web content" from the "Create" drop down on the top left hand corner.

I got a bit stuck - so for the hard of thinking like me an important distinction:

I have this data (simplified for post)

<report:report>
<editors_choice xsi:nil="true"/>
<featured xsi:nil="false">true</featured>
<created>2008-10-11</created>
</report:report>

trying to configure the output path for this

${xml['report:report/created']}
doesn't work

but

${xml['report:report'].created} 
ah yeah

I'm keen to drop the namespaced root tag
<report:report>
anyone know how I do this?

steventux
Champ in-the-making
Champ in-the-making
I've run into problems most likely with my own lack of understanding of the xml I am creating.
Having set elementFormDefault="unqualified" I get xml as above - the root node is qualified the elements are not. Simple enough to understand.
But I dont get how this works in Freemarker templates. I have successfully applied ftl templates when using elementFormDefault="qualified" and would use this despite it seeming very verbose, but then I can't work out the output pattern to use if I have xml like

<report:report>
<report:created>2008-10-11</report:created>
</report:report>
I'd prefer to turn off all the qualified naming in my nodes - it makes for better reading and easier output patterns and XPaths - can anyone advise what to do?

steventux
Champ in-the-making
Champ in-the-making
Answering my own question

${xml['report:report']['report:created']}

ugly and cumbersome, I'd much rather simplify the xml but working is working.

samwise
Champ in-the-making
Champ in-the-making
steventux,

You are a wonderful human being.  Your solution works completely; I was tearing out my hair trying to get this working.  Thank you.  Smiley Happy