cancel
Showing results for 
Search instead for 
Did you mean: 

Making the My Sandbox => Web Forms useful

marcus
Champ in-the-making
Champ in-the-making
I might be missing something, hence the post, but how are people using the "My Sandbox => Web Forms" functionality? A lot of the web forms I use are not configured with a hard set output path, meaning that using this functionality creates content at the root of the webapp, which is undesirable. Is there something I'm missing around functionality that allows you to specify WHERE the content gets created? I've got around this problem in a few cases by having a property on the webform that allows you to select a target folder (an xs:anyURI property), and setting the output path dynamically based on that setting, but it seems like the solution to the problem should be at a higher level, and that I shouldn't be polluting my content model with structural information like that.

Any ideas?
1 REPLY 1

kvc
Champ in-the-making
Champ in-the-making
Marcus:

In order to folder content, we need to either implicitly figure out or explicitly be told where to generate output.  If you do not configure an output path, given no other context, the only known place to generate content is the ROOT directory of your sandbox.  This therefore is the default behavior when using a web form from the sandbox view when an output path is not configured.  If you do navigate into a directory in your sandbox, however, and user the Create Web Content action, that same XML will be placed in your current directory.  Once again, given no output path, the assumption is that your current context (directory location) is where the content should be generated (in the case of the My Web Forms list on your sandbox page, that means the root dir).

Now, there are two ways to avoid this is that is not desired behavior:

1.  Use an output path.  This will guarantee that wherever content is
     created that it is stored in the right location.  Basic output paths
     simply correspond to content type - for example, /content/form_name

2.  Use a metadata property.  Using an element within your form to
     capture that directory location where the content is to be stored is
     a great use of our support for using XML elements in an output
     path.  Instead of viewing that path information as polluting your
     content model, instead it should be viewed as a complement to your
     content model:  the element used should be a metadata property,
     for example a category, that the user selects to classify their content,
     and in turn have the category be the very same folder under which
     the content is stored.

Now, there are two ways to allow the user to select this "category" property:  first, you can use an in-line callout (a JSP) to generate and present to the user a list of available content categories which they can tag their content with.  This value can be used to generate a directory on the fly to store the generated XML or use an existing folder to store content in.  Second, you can use as you are doing our file picker, and, new to 2.1.0 Community Final you can now limit any given instance of the file picker control to select just content, just folders, or any specific file mimetype.  In this case, you'd likely want to limit the file picker to just selecting directories, which in this case would correspond to categories.    An example of the config file (web-client-config-wcm.xml) that allows you to specify some of these default for the file picker in 2.1.0 Community Final can be found here:


           <widget xforms-type="xf:upload"
                   javascript-class-name="alfresco.xforms.FilePicker">
             <param name="selectable_types">wcm:avmcontent,wcm:avmfolder</param>
           </widget>
           <widget xforms-type="xf:upload"
                   appearance="image_file_picker"
                   javascript-class-name="alfresco.xforms.FilePicker">
             <param name="selectable_types">wcm:avmcontent</param>
             <param name="filter_mimetypes">image/*</param>
           </widget>
           <widget xforms-type="xf:upload"
                   appearance="html_file_picker"
                   javascript-class-name="alfresco.xforms.FilePicker">
             <!– allow folder selection to handle index pages –>
             <param name="selectable_types">wcm:avmcontent,wcm:avmfolder</param>
             <param name="filter_mimetypes">text/html</param>
           </widget>
           <widget xforms-type="xf:upload"
                   appearance="folder_picker"
                   javascript-class-name="alfresco.xforms.FilePicker">
             <param name="selectable_types">wcm:avmfolder</param>
             <param name="filter_mimetypes">*</param>
           </widget>
           <widget xforms-type="xf:upload"
                   appearance="file_picker"
                   javascript-class-name="alfresco.xforms.FilePicker">
             <param name="selectable_types">wcm:avmcontent</param>
           </widget>