Forums / Setup & design / Trying to move an object via custom edit template

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

eZ debug

Timing: Jan 18 2025 16:10:03
Script start
Timing: Jan 18 2025 16:10:03
Module start 'content'
Timing: Jan 18 2025 16:10:03
Module end 'content'
Timing: Jan 18 2025 16:10:03
Script end

Main resources:

Total runtime0.1745 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0082 589.2891180.8125
Module start 'content' 0.00820.0070 770.101697.9453
Module end 'content' 0.01510.1592 868.0469533.3750
Script end 0.1744  1,401.4219 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00382.1896200.0002
Check MTime0.00150.8343200.0001
Mysql Total
Database connection0.00130.723810.0013
Mysqli_queries0.118968.15021410.0008
Looping result0.00140.82201390.0000
Template Total0.158991.010.1589
Template load0.00090.499610.0009
Template processing0.158090.519910.1580
Override
Cache load0.00060.325410.0006
Sytem overhead
Fetch class attribute can translate value0.00110.658310.0011
XML
Image XML parsing0.00040.226210.0004
General
dbfile0.00724.1379200.0004
String conversion0.00000.004130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs