Forums / Developer / Feedback form and file upload

Feedback form and file upload

Author Message

Salvatore Guarino

Monday 07 November 2005 8:33:14 am

I want to edit the standard feedback-form class adding a field to allow user to upload a file from the front-end interface. There is a simply way to do it? If I add a "file" field in the class, the checkbox "collect information" is disabled. There is a simple way to do it?

Thanks,

Salvatore

Łukasz Serwatka

Monday 07 November 2005 1:08:05 pm

Hi Salvatore,

Look at
http://ez.no/community/forum/setup_design/how_to_send_a_file_with_a_feedback_form

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Salvatore Guarino

Tuesday 08 November 2005 6:12:47 am

Thank you Luke,

I created a custom class and I used your notification extension.

Bye!

Łukasz Serwatka

Tuesday 08 November 2005 6:41:39 am

Very nice ;) Good to see that is useful for someone ;)

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

John Smith

Sunday 10 September 2006 9:01:58 am

hi Guarino,

Could it be possible for you to let me know, how have you created custom class for the file to be uploaded from the user end.

Please help.
Smith

Norman Leutner

Sunday 10 September 2006 9:42:57 am

Hi,
just create a new class named "my form" with at least two attributes <name>,<file>.
Edit the anonymous role and allow the anonymous users to create objects of that class at a specific subtree.

Then create a button like:

    <form method="post" action="/content/action">
                <input class="button" type="submit" name="Feedback" value="Feedback" />
                <input type="hidden" name="RedirectURIAfterPublish" value="/" />
                <input type="hidden" name="ContentNodeID" value="5512" />
                <input type="hidden" name="ContentObjectID" value="5846" />
                <input type="hidden" name="NodeID" value="5512" />
                <input type="hidden" name="ClassIdentifier" value="my_form" />
            </div>
    </form>

Now you can see the standard edit.tpl when you klick on that button.
Then simply create a new overrride edit.tpl template for that class.

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

John Smith

Monday 11 September 2006 1:25:13 am

hi leutner,

Thank you very much for your help. Much Appreciated.

One more thing on which i would like some help from you.

What i am trying to achieve is to allow users to register first and after registering, they can upload a file, but each user can only see/edit their own uploaded files.

Another thing, on the administration end, the administrator must be able to know, who has uploaded what. Is their any solution. At the moment all the files which are uploaded by the different users from the user end, are going into same folder and the administrator can't tell who has uploaded what.

Please help

Smith

Norman Leutner

Monday 11 September 2006 2:23:03 am

Hey John,

at first you need to create a new section within the admin panel under /section/list
called "members_only". Then assign this section to the part / subtree of your site which should be only visible for registered users.

Then go to the create a new role under /role/list called "Guest accounts" like:

  content  read  Section( members_only ) , Owner( Self )    
  content  create  Class( my_form ) , Section( members_only )    
  content  edit  Class(  my_form ) , Section( members_only ) , Owner( Self )  

Now assign this role to the "Guest accounts" user group where all standard registered users are placed. All users which want to access the section "members_only" are now asked for their login data.

Reguarding the creator:
If anyone publishes something, the creator is stored. Within the admin panel list view, just click on the "Detailed view" button to show the creator of each object.

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

John Smith

Monday 11 September 2006 4:18:29 am

Thanks Leutner,

The Roles which i have given are given below:

content  read  Section( Members Only ) , Owner( Self )  
content  create  Class( My Form ) , Section( Members Only )  
content  edit  Class( My Form ) , Section( Members Only ) , Owner( Self )  
user  login  SiteAccess( news )  
content  read  Section( Standard , Members Only )

Everything working fine, but the user can see other files as well which are uploaded by other users.

Thanks in advance.

 

Norman Leutner

Monday 11 September 2006 7:03:37 am

Change

content read Section( Standard , Members Only ) 

to:

content read Section( Standard ) 

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Abdul Rehman

Monday 02 October 2006 2:08:18 am

Hey Leutner,
Regrading this post, I want to know that should the form "my_form" attributes will be declared as informatin collector ? In addition to this, I want to to send the newly created object information say 'feedback' to two different e-mail addresses.
Plz, guide me regarding this, and I am also new to ez publish.

Thanks.

JC Jee

Thursday 15 March 2007 8:52:14 pm

Hi Everyone,

I have tried following the examples here, and also tried searching through the threads, but I am still unable to get the default edit page to show. Can anyone kindly provide a step-by-step instructions for this newbie here to get the page to work?

I have created the following:
- feedback class "my_feedback", ID 29
- "myfolder", under the eZ publish content structure, Node ID 470, section "Feedback"
- assigned the rights to user "Anonymous":
content create Class( my_feedback ) , Section( Feedback )
content edit Class( my_feedback ) , Section( Feedback ) , Owner( Self )
content read Section( Feedback )

<form method="post" action="/myweb/index.php/web/content/action">
<input class="button" type="submit" name="Feedback" value="Feedback" />
<input type="hidden" name="ContentNodeID" value="470" />
<input type="hidden" name="ContentObjectID" value="29" />
<input type="hidden" name="NodeID" value="470" />
<input type="hidden" name="ClassIdentifier" value="my_feedback" />
</form>

I tried using the above form, but I get a blank page, except for the headers and footer specified in the base template. If I submit the form by specifying ClassIdentifier and NodeID, I get "Object Not Found". Can anyone enlighten me what went wrong?

Stéphane Bullier

Friday 16 March 2007 2:53:03 am

Hello,

To created content into frontoffice :

First I created a button :
<form method="post" action="/content/action">
<input type="hidden" name="ClassID" value="<class_id>" />
<input type="hidden" name="ContentLanguageCode" value="<fre-FR>" />
<input type="hidden" name="ContentObjectLanguageCode" value="<fre-FR>" />
<input type="hidden" name="ContentObjectID" value="{$content_object.id}" />
<input type="hidden" name="NodeID" value="{$current_node.node_id}" />
<input type="hidden" name="ContentNodeID" value="{$current_node.node_id}" />
<input class="button" type="submit" name="NewButton" value="<CreateNewContent>" />
</form>

Chang all text in <>.

After clic on button, you redirected :

<form enctype="multipart/form-data" method="post" action={concat("/content/edit/",$object.id,"/",$edit_version,"/",$edit_language|not|choose(concat($edit_language,"/"),''))|ezurl}>
{def $attributes=$content_attributes}
{foreach $attributes as $attribute}
<p>{$attribute.contentclass_attribute.name} : {attribute_edit_gui attribute=$attribute}</p>
{/foreach}
<input class="defaultbutton" type="submit" name="PublishButton" value="Envoyer pour publication" />
<input class="button" type="submit" name="DiscardButton" value="Abondonner" />
</form>

I you like to know how I can redirect the post of new content with
<input type="hidden" name="RedirectURIAfterPublish" value="<which_value??>" />
on page on "Thank you for your post".

Stéphane