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

maephisto
Champ in-the-making
Champ in-the-making
Very old post, you're right.

I'm not longer using Alfresco, but i think they fixed it moving all the upload-file buxfixes to Alfresco Community, after releasing Alfresco Enterprise. In fact Kevin wrote "Otherwise, stay tuned for the 2.1 Community refresh we'll do in a few weeks time.". Alfresco 2.1 Community was released some months ago, so it seems strange they didn't fix this issue.

xexiz
Champ in-the-making
Champ in-the-making
Well, it look like it's still not fix because Im only having one entry for xf:upload in the wcm-client-config file!!
and i'm having this version:

Alfresco started (Community Network): Current version 2.1.0 (484) schema 64 - Installed version 2.1.0 (484) schema 64

It's the latest release i found on source forge.. following the Wiki download pages!

prateek_dhanwal
Champ in-the-making
Champ in-the-making
Is it possible that i  can enter    the folder path  like    aseets/pdfs/    in   <param name="filter_mimetypes">application/pdf</param>     so that i can view only this folder  containing  PDF files.  Or Is there any other way.

Thanks

Prateek

prateek_dhanwal
Champ in-the-making
Champ in-the-making
Hi

   i want to show only few folder in my FilePicker .  What  should i write in <param name="selectable_types">wcm:avmfolder</param> so that only selectables folders will be shown.

Thanks

Prateek

roxanne
Champ in-the-making
Champ in-the-making
I want to restrict the filepicker to select only images in a given folder "images" in tomcat>webapps>ROOT

Here is the section I added to web-client-config-wcm.xml to add a folder_restricted_file_picker  appearance:

====================================
           <widget xforms-type="xf:upload"
                   appearance="folder_restricted_file_picker"
                   javascript-class-name="alfresco.xforms.FilePicker">
            <param name="selectable_types">wcm:avmcontent</param>
             <param name="filter_mimetypes">image/*</param>
          <param name="folder_restriction">images</param>
           </widget>
===================================

Here is the schema I used

===================================
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:alf="http://www.alfresco.org" elementFormDefault="qualified">
<xs:simpleType name="FilePickerType">
<xs:restriction base="xs:anyURI" />
</xs:simpleType>
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="filepicker" type="FilePickerType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:appinfo>
<alf:appearance>folder_restricted_file_picker</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
===================================

i've got information from http://wiki.alfresco.com/wiki/Configuring_XForms_Widgets


i finally end up getting this error: 'images' not found in /.

what do i do now??!!!!!

roxanne
Champ in-the-making
Champ in-the-making
I want to restrict the filepicker to select only images in a given folder "images" in tomcat>webapps>ROOT

Here is the section I added to web-client-config-wcm.xml to add a folder_restricted_file_picker  appearance:

====================================
           <widget xforms-type="xf:upload"
                   appearance="folder_restricted_file_picker"
                   javascript-class-name="alfresco.xforms.FilePicker">
            <param name="selectable_types">wcm:avmcontent</param>
             <param name="filter_mimetypes">image/*</param>
          <param name="folder_restriction">images</param>
           </widget>
===================================

Here is the schema I used

===================================
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:alf="http://www.alfresco.org" elementFormDefault="qualified">
<xs:simpleType name="FilePickerType">
<xs:restriction base="xs:anyURI" />
</xs:simpleType>
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="filepicker" type="FilePickerType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:appinfo>
<alf:appearance>folder_restricted_file_picker</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
===================================

i've got information from http://wiki.alfresco.com/wiki/Configuring_XForms_Widgets


i finally end up getting this error: 'images' not found in /.

what do i do now??!!!!!

roxanne
Champ in-the-making
Champ in-the-making
I've got the solution!


1.   Change a section in web-client-config-wcm.xml to add the appearance folder_restricted_file_picker 

           <widget xforms-type="xf:upload"
                   appearance="folder_restricted_file_picker"
                   javascript-class-name="alfresco.xforms.FilePicker">
             <param name="selectable_types">wcm:avmcontent</param>
             <param name="filter_mimetypes">image/*</param>
          <param name="folder_restriction">images</param>
           </widget>

   Here's the explanation:
               selectable_types   wcm:avmcontent   Picks only files (not folders)
               filter_mimetypes   image/*                   Picks only files which are images
               folder_restriction   images                    Folder in ROOT from where files are picked



2.   Create the following schema

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:alf="http://www.alfresco.org" elementFormDefault="qualified">
<xs:simpleType name="FilePickerType">
<xs:restriction base="xs:anyURI" />
</xs:simpleType>
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="filepicker" type="FilePickerType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:appinfo>
<alf:appearance>folder_restricted_file_picker</alf:appearance>
</xs:appinfo>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>



3.   Disable the button “Add Content”

i.   Go to file_picker_widget in C:\Alfresco\tomcat\webapps\alfresco\scripts\ajax
ii.   Go to line having “addContentLink.filePickerWidget = this;”
iii.   Comment this line by prefixing //
iv.   Save

4.   Restart the server.

5.   Create a Web Form and use the schema created.

6.   Create a Web Project and add this Web Form.

7.   Create a folder in ROOT and add files in it

i.   In Alfresco, navigate to the web project.
ii.   Click on the “My Sandbox” icon.
iii.   Go to Create>Create Folder; Title: images
iv.   Click on the newly created folder.
v.   Go to Create>Add Content.
vi.   Browse to the files and upload them. You will be able to add only image files!
vii.   Click “OK”

8.   Now use the Create Content option.

ribz33
Champ on-the-rise
Champ on-the-rise
Hi Roxanne,

I don't understand well what you want to do in your second post, but about first post maybe try to replace with this code :
<param name="folder_restriction">/images</param>

I think you forgot "/" before folder name.

roxanne
Champ in-the-making
Champ in-the-making
thanks pierrre for the reply!!

can u plz help me in creating an xslt to display the image??

ive tried out these lines:
<img src=".{root/filepicker}" alt="Image"/>
<xsl:value-of select="root/filepicker"/>

i'm not able to see the image.
the path displayed (of the image ) is \filename.extension

ribz33
Champ on-the-rise
Champ on-the-rise
try this :


<xsl:template match="/">
<xsl:element name="img">
  <xsl:attribute name="src">
    <xsl:value-of select="/root/filepicker"/>
  </xsl:attribute>
</xsl:element>
</xsl:template>
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.