New SubmitContentEdit Macro needs to allow Editing of content from the front end
- Make sure every field works. Fix where it doesn't
- make sure it respects permissions
- Make it take the contentInode. Need to support publishing etc... as we currently do.
- Don't break the current adding of content.
Hi Prasad,
After talking to Will and JT, I think the way this should work is as:
- a new macro (to avoid confusion)
- re-use the code in the submitContent macro vtl file to create the form and make sure to update/use the same struts action as on submitContent macro
- make sure that when the macro is called, all fields populate with content from the existing form contentlet passed by inode
- Make sure we support all fields EXCEPT fields like Custom field, Permissions field, Relationships field, keyfield
- We must respect role permissions including CMS Anonymous to edit/save the content
We should also supply an example of how to call the actions manually on a page the same way we do for custom submit content form: http://www.dotcms.com/docs/2.0/CustomSubmitContentForm
##System Default Error handling in the form
#if(!$UtilMethods.isSet("$!errorMessagesPath"))
#set($errorMessagesPath = 'static/content/error_messages.vtl')
#end
#parse($errorMessagesPath)
#foreach($con in $dotcontent.pull("+structureName:CustomSubmitcontentEdit +(conhost:48190c8c-42c4-46af-8d1a-0cd5db894797 conhost:SYSTEM_HOST)",10,"modDate desc"))
#set($contentmap $con)
#set($conId= $con.get('inode'))
#set($conIdentifier= $con.get('identifier'))
#end
##Set options to "false" to save or "true" to save and publish content
#set($options = "contentAutoPublish=true;")
##Submit content action/values needed by all submit content forms
<form id="submitContentForm" name="submitContentForm" method="post" enctype="multipart/form-data" action="/dotCMS/submitContent">
<input type="hidden" value="submitContent" name="dispatch">
<input type="hidden" value="$crypt.crypt($options)" name="options">
<input id="referrer" type="hidden" value="/home/custom-content-edit-form-.html" name="referrer">
##Structure identifier is added as a value to identify content type Ex: b8308443-13c6-4f93-a88f-7624a7b25bc0
<input type="hidden" value="1dee0903-53ec-4fdc-befd-3f8297303ea0" name="structure">
##Contentlet inode or identifier is required to populate content type Ex: b8308443-13c6-4f93-a88f-7624a7b25bc0
<input type="hidden" id="contentInode" name="contentInode" value="$conId">
##Contentlet identifier is required to submit binary file content type Ex: b8308443-13c6-4f93-a88f-7624a7b25bc0
<input type="hidden" id="contentIdentifier" name="contentIdentifier" value="$conIdentifier">
"<input type="hidden" value="" name="userId">"
name: <input type="text" name="companyName" id="companyName" value="$contentmap.get('companyName')"><br>
address: <input type="textarea" name="address" id="address" value="$contentmap.get('address')"><br>
##To submit the form
<br><br><input type=submit value="submit">
</form>
Dean we must doc this really well. Please test all cases. Might want to discuss with Jason about building a kitchen sink form in the demo.
Dean Changes brought back by prasad
I tested every field I could think of and works great, except the new code that Ozzy and Gabriela also submitted to support custom fields in forms is not broke. Generated new task so that custom fields work on forms AND the new submitContentEdit macro: https://github.com/dotCMS/dotCMS/issues/1090
Added doc task: http://jira.dotmarketing.net/browse/DOTCMSINC-1147