cancel
Showing results for 
Search instead for 
Did you mean: 

Webforms + Filepicker

maephisto
Champ in-the-making
Champ in-the-making
Hi to everybody.

I've some questions about the filepicker ui control.

  1. How can I filter what kind of resources the filepicker can show? Something similar was asked here but I didn't understand how to modify the XSD file to render a web form to create a filepicker control that filters sone files instead of others.

  2. Always here there's something about "metadata": through a JSP callout i can show some categories but how can I create a directory on-the-fly or modify the filepicker in the same form when I select a category insted of another one? These two functionalities are suggested in that post too.
Thx in advance
21 REPLIES 21

kvc
Champ in-the-making
Champ in-the-making
Maephisto:


With 2.1.0, we provide 5 default appearances of the file-picker.  Different appearances can be used for different elements within the same web form using the appearance annotation.

These default configs can be found in web-client-config-wcm.xml.   These enable you to limit selection based on file or folder, mimetype.


           <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>


To use an element from an XML for create directories, you'll want to refer to the element using the xml node variable in your Freemarker expression in your output path.  The reference for this can be found in the Help instructions next to the output path field. 

Let us know if any more questions.

Kevin

maephisto
Champ in-the-making
Champ in-the-making
Thank you for the answer.

I'll make some experiments with appearance for the filepicker and with Freemarker expression in output path: I'll let you know if there are problems.

Another question: since configuration for filepicker appearances is in web-client-config-wcm.xml, have I also the possibility to change that configuration to customize filepicker? For example, I could create a filepicker that filters PDF files with a definition like the following one:

<widget xforms-type="xf:upload"
   appearance="pdf_file_picker"
   javascript-class-name="alfresco.xforms.FilePicker">
   <param name="selectable_types">wcm:avmcontent</param>
   <param name="filter_mimetypes">application/pdf</param>
</widget>
If the answer is positive, where could I find a reference for web-client-config-wcm.xml customization?

kvc
Champ in-the-making
Champ in-the-making
Yes, this is the goal of the config file.

We'll be working on documentation on the wiki starting next week in prep for the final release of 2.1.0 Enterprise, targeted end of the month.

Glad to see you're potentially finding utility in the new config options.

Kevin

maephisto
Champ in-the-making
Champ in-the-making
testing appearance hack, I wasn't able to create a custom filepicker.

This is the definition in XSD I wrote to create the form


<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:az="http://www.sky.it/contentmodels/az"
   xmlns:alf="http://www.alfresco.org"
    targetNamespace="http://www.sky.it/contentmodels/az">
     <xs:element name="enterprise">
       <xs:complexType>
            <xs:sequence>
              <xs:element name="logo" type="xs:anyURI">
                 <xs:annotation>
                  <xs:appinfo>
                     <alf:label>Logo path</alf:label>
                     <alf:alert>A logo is required to create content</alf:alert>
                     <alf:appearance>image_file_picker</alf:appearance>
                  </xs:appinfo>
                </xs:annotation>
             </xs:element>
              <xs:element name="name" type="xs:normalizedString"/>
            <xs:element name="code" type="xs:normalizedString" />
            </xs:sequence>
       </xs:complexType>
     </xs:element>
</xs:schema>

While alert and label are correctly shown, filepicker doesn't filter anything. Where am I wrong?

edit: I almost forgot. I'm using Alfresco Community Release 2.1

edit2: I edited the file web-client-config-wcm.xml in /<alfresco-root>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco and I noticed there's nothing like

<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>
and so on. There is just ONE line referring to xf:upload

<widget xforms-type="xf:upload" javascript-class-name="alfresco.xforms.FilePicker"/>
I tried to modify web-client-config-wcm.xml adding xf:upload image_file_picker appearance but nothing changed in the rendered form. I also tried to modify RictTextEditor config to add HTML code button and the modification worked, so it seems there's some issue with xf:upload appearance hack: can u confirm it?

kvc
Champ in-the-making
Champ in-the-making
Maephisto:


Are you using Community Final?  This enhancements was not in Community RC1. 

You can tell if it is by the web-client-config-wcm.xml file.  If you do
not see the default appearances for the file-picker, that release version
does not support the filtered file-picker widget.  You should have to
modify any code or config file other than your own XSD to get a
default file-picker filtered on images.


Kevin

maephisto
Champ in-the-making
Champ in-the-making
Well, I've followed the Alfresco 2.1 Download link… on sourceforge there's a release on 2007-07-24… You are saying that this release contains the file web-client-config-wcm.xml with more than one filepicker widget?

Where can i find the version of Alfresco currently installed on my system?

edit: damn, I've opened the README file and these are the first three lines:

==============================
Alfresco 2.1 Release Candidate
==============================
Ok, so I've downloaded Alfresco 2.1 RC
With the new version, I will be able to create all the customizations of filepicker just modifying ONLY the web-client-config-wcm.xml file, right?

edit2: I've downloaded Alfresco 2.1 and in web-client-config-wcm.xml file (located in <alfresco-root>/tomcat/webapps/alfresco/WEB-INF/classes/alfresco) there's just ONE line for filepicker. I'm going crazy: where are the appearances you were talking about?

kvc
Champ in-the-making
Champ in-the-making
Maephisto:


You are not going crazy; I'm being crazy unclear.

This check-in was done post Community Final (what is currently posted on SourceForge) after our 2.1 Enterprise branch split.  Normally post branch we only do bug fixes marked "Major" in JIRA (Community gets all "Blocker" and "Critical" bugs fixed, as well as many Majors are possible).  In this particular case, because of all the forum activities around the file-picker widget and TinyMCE editor, we've added an enhancement (which will get back-ported to an updated Community release once we finalize and ship Enterprise end of this month).

You can get access to the v2.1 branch and the current 2.1 Enterprise BETA (it is much more stable than Community) either via subscription or by requesting a trial eval.  Otherwise, stay tuned for the 2.1 Community refresh we'll do in a few weeks time.

Sorry for being unclear.  That's what happens when you answer questions too quickly!

Kevin

maephisto
Champ in-the-making
Champ in-the-making
You can get access to the v2.1 branch and the current 2.1 Enterprise BETA (it is much more stable than Community) either via subscription or by requesting a trial eval.

I'm sorry to bother you… but where can I get the 2.1 version? On alfresco.com if I click download I can request a trial for 2.0 version… Where am I wrong?

xexiz
Champ in-the-making
Champ in-the-making
i Know this post is really old, but this isnt fix yet i guess? because i'm having the 2.1 installed and also having only one definition for the xf:upload and the latest file modification on forge for WCM 2.1 is 2007-07-24 05:39

tell me if i'm wrong!
I would love to be able to select only folder, and be able to set the default path to open the "select box" Smiley Happy

thx
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.