Trying to move an object via custom edit template

Author Message

Arran Price

Tuesday 15 November 2005 2:36:28 pm

Hi,

This is hopefully quite simple, but Im having a brain block.

I have a custom class which can be:
created (works)
viewed (works)
archived (moves object to a new folder - dosent work)
by various users on the non admin interface so Ive created custom templates to do that.

I figure creation and archiving a form of edit - ie its just changing the default location/parent node of the object but I cant seem to make it work.

I basically want the view form to have an archive button, and went clicked it asks for confirmation (from an edit template) and then moves it.

code below if its a new form it gets user input - if its an existing form it shows the data and should submit with a move to the new location.




   <h1> Form Title </h1>

<form enctype="multipart/form-data"
      method="post"
      action={concat("/content/edit/",
                     $object.id,
                     "/",
                     $edit_version)|ezurl}>
                     
    
   {include uri="design:content/edit_validation.tpl"} 
   

   {* DETERMINE IF THIS EDIT IS A NEW FORM OR FOR ARHIVE *}
   
   
   
   {$content|attribute(show,1)}
   
   
    {section show=$content_attributes.0.has_content|not}
       {set newform=true}  {* NEW *}
    {section-else}
       {set newform=false} {* ARHIVE *}
    {/section}

   
   <table class="layout" border="0">                  
      {section name=ContentObjectAttribute loop=$content_attributes)}
      
        <tr> 
            <td> 
               <p><b><label>{$ContentObjectAttribute:item.contentclass_attribute.name|wash}</label></b></p></div>
               <input type="hidden" name="ContentObjectAttribute_id[]" value="{$ContentObjectAttribute:item.id}" />
               {section show=$newform|eq(true)}
                  {attribute_edit_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}
               {section-else}
                  {attribute_view_gui attribute_base=$attribute_base attribute=$ContentObjectAttribute:item}
               {/section}
            </td>
         </tr> 
      {/section}
   </table>
         
             archive node={$archive_node}               
         
         <div class="buttonblock">
            {section show=$newform|eq(true)}   
               <input class="defaultbutton"
                  type="submit"
                  name="PublishButton"
                  value="Submit"/>
            {section-else}
                <input class="defaultbutton"
                  type="submit"
                  name="PublishButton"
                  value="Confirm Archive"/>
            {/section}
               
               <input class="button"
                  type="submit"
                  name="DiscardButton"
                  value="Cancel" />
                  
                  
               {section show=$newform|eq(true)}   
                  <input type="hidden"
                     name="MainNodeID"
                     value="{$form_node}" />
               {section-else}
                  {* this is one of my attempts to make it work which was unsuccessful *}
                  <input type="hidden"
                     name="MainNodeID"
                     checked="checked"
                     value="{$archive_node}" />
               {/section}
          </div>
       </td>
      </tr>
    </table>
 </form>

the error I get on trying to move it is:

Location did not validate

    * No main node selected, please select one.

any help greatly appreciated.

cheers

Arran

addendum - ezpublish 3.4.4 - Archive folder is fixed and $archived_node and $form_node are passed to this template (they are fixed, archive folder resides in the form folder)

Arran Price

Tuesday 15 November 2005 4:50:39 pm

fixed:
add

<input type="hidden" name="SetPlacementNodeIDArray[]" value="{$archive_node}" /> 

into the button block at the bottom of the template (for forms that arent new). also removed the checked line.

Arran

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:31:25
Script start
Timing: Jan 18 2025 19:31:25
Module start 'layout'
Timing: Jan 18 2025 19:31:25
Module start 'content'
Timing: Jan 18 2025 19:31:26
Module end 'content'
Timing: Jan 18 2025 19:31:26
Script end

Main resources:

Total runtime0.7481 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 592.1641152.6406
Module start 'layout' 0.00460.0028 744.804739.4766
Module start 'content' 0.00740.7391 784.2813446.1953
Module end 'content' 0.74650.0016 1,230.476612.1250
Script end 0.7481  1,242.6016 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4164160.0002
Check MTime0.00130.1781160.0001
Mysql Total
Database connection0.00070.093310.0007
Mysqli_queries0.700693.6436520.0135
Looping result0.00050.0672500.0000
Template Total0.713295.320.3566
Template load0.00210.283420.0011
Template processing0.711195.047620.3555
Template load and register function0.00020.021410.0002
states
state_id_array0.00190.251710.0019
state_identifier_array0.00190.248520.0009
Override
Cache load0.00170.2323260.0001
Sytem overhead
Fetch class attribute can translate value0.00050.069210.0005
Fetch class attribute name0.00190.249720.0009
XML
Image XML parsing0.00010.017810.0001
class_abstraction
Instantiating content class attribute0.00000.001420.0000
General
dbfile0.00070.0984100.0001
String conversion0.00000.001140.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs