How to split large objects into several edit pages

Author Message

Lazaro Ferreira

Tuesday 17 August 2004 4:12:52 am

Hi,

We would like to split a large object edit tpl, into several shorter edit templates, to make easier the input of data ( something like EZP setup wizard )

Is there any standard approach to deal with this, in EZP 3.4 ?

Thanks
Lazaro Ferreira

Lazaro
http://www.mzbusiness.com

Bård Farstad

Tuesday 17 August 2004 5:00:21 am

Hi Lazaro,

this is currently not directly supported. But you could probably make it by changing the edit template. The the problem is that some datatypes require input, which means that you would need to add hidden variables for the different fields. You could e.g. make a switch which will show the fields for the current step while at the same time having the oter attribute variables as hidden variables.

You could step through the steps using the store draft buttong and adding a status variable about the position. E.g. /content/edit/42/2/(position)/first_step then you would change the form target to /content/edit/42/2/(position)/second_step based on the current posistion.

--bård

Documentation: http://ez.no/doc

Lazaro Ferreira

Tuesday 17 August 2004 6:17:38 am

Hi bård,

I got it, We will try!

Thanks
Lazaro Ferreira

 

Lazaro
http://www.mzbusiness.com

Bård Farstad

Tuesday 17 August 2004 7:01:07 am

Great,

let us know how you progress. I know other people are interested in this as well. It was also discussed on the summer conference this year.

--bård

Documentation: http://ez.no/doc

J-A Eberhard

Wednesday 06 September 2006 9:34:55 am

Hi,

Two years later I have the same question...

Did you came up with a nice solution?

Regards

Open Source Solution Provider
Open-Net Ltd Switzerland
http://www.open-net.ch

J-A Eberhard

Tuesday 19 September 2006 12:03:56 pm

FYI. I solved the problem with a css based solution.
Testing if arguments have value and hidding them with the css properties. Like that I submit everytime the whole object but the user only see relevant fields.

Open Source Solution Provider
Open-Net Ltd Switzerland
http://www.open-net.ch

Claudia Kosny

Tuesday 19 September 2006 1:07:31 pm

Hi

I think I would have done it by writing a small extension for this using Bards suggestion. Rough idea:
Replace the edit template with an override where the form action is a script of your extension. The script takes the posted variables and gives them back to the template which makes hidden input types out of them and shows the next batch of the attributes to edit. This is repeated until we are at the last batch. The the form action is changed to the original form action again so when we post this, EZ gets the data for the full form.

Advantages:
- Easy to implement (for a specific class, a general solution is a bit more complicated as you would have to group the attributes somehow).
- Easy to implement the possibility to get back and forward between the single pages/
- No objects with partial data are created, if the user cancels there are no leftovers to cleanup
- Also works for objects with required attributes.

Problems:
- Validation is done only at the end, not at each page (although this could certainly be implemented)
- Posted data might be very long (although not longer than with the one-page edit)

Greetings from Luxembourg

Claudia

Norman Leutner

Tuesday 19 September 2006 1:24:17 pm

Hi,
we've done this on a project and used an extension to create the objects as a draft version.
After the last step, the object is published.

As already metioned by Claudia, we had to validate all attributes by hand.

Mit freundlichen Grüßen
Best regards

Norman Leutner

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

J-A Eberhard

Tuesday 19 September 2006 3:09:45 pm

Hi,

You talked about an extension, could you publish it?
Would such an extension been able to take care of the Enhanced ObjectRelation datatype?

Thanks

Open Source Solution Provider
Open-Net Ltd Switzerland
http://www.open-net.ch

Norman Leutner

Tuesday 19 September 2006 11:21:25 pm

The extension we made was for an online auction system so its a bit to special for your needs, but it shouldn't be a problem to build you one one.

Creating an draft object is simple:

 function createDraftObject($parent_node_id, $owner_id, $class_name, $attributes )
   {    
      $class =& eZContentClass::fetchByIdentifier( $class_name );

      if ( !is_object( $class ) )
      {
         die("Class not found");
      }
    
     
      $parent_node =& eZContentObjectTreeNode::fetch($parent_node_id);
      
      // set associated object to parent node (folder object) 
      if ( !is_object( $parent_node ) )
      {
         die("Could not set parent node");
      }
      
      
      $parent_content = $parent_node->attribute('object');
      $section_id = $parent_content->attribute( 'section_id' );

      
      // create the object
      $content_object =& $class->instantiate( $owner_id, $section_id );

      //assign new object to parent node
      $node_assignment =& eZNodeAssignment::create( array(
            'contentobject_id' => $content_object->attribute( 'id' ),
            'contentobject_version' => $content_object->attribute( 'current_version' ),
            'parent_node' => $parent_node->attribute( 'node_id' ),
            'is_main' => 1 ) );
      $node_assignment->store();

      // Set status to draft for the content object version
      $content_object_version =& $content_object->version(
              $content_object->attribute( 'current_version' ) );
      $content_object_version->setAttribute( 'status', EZ_VERSION_STATUS_DRAFT);
      $content_object_version->store();             


      // Assign the attributes
      $content_attributes =& $content_object_version->contentObjectAttributes();
      foreach ($content_attributes as $content_attribute)
      {
         // Each attribute has an attribute called 'identifier' that identifies it.
         $attribute_identifier = 
            $content_attribute->attribute("contentclass_attribute_identifier");

         if (isset($attributes[$attribute_identifier]))
         {          
            $this->importAttribute($attributes[$attribute_identifier], $content_attribute);
            $contentClassAttribute = $content_attribute->attribute( 'contentclass_attribute' );
            $dataTypeString = $contentClassAttribute->attribute( 'data_type_string' );
            //echo $dataTypeString."<br/>";
         }
         else
         {        
            eZDebug::writeDebug( 'attribute value not found for '.
                  $class_name.".".$attribute_identifier);
         }
      }

      $id = $content_object->attribute('id');
      
      return eZContentObject::fetch($id);
   }

Mit freundlichen Grüßen
Best regards

Norman Leutner

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

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 19 2025 11:46:34
Script start
Timing: Jan 19 2025 11:46:34
Module start 'layout'
Timing: Jan 19 2025 11:46:34
Module start 'content'
Timing: Jan 19 2025 11:46:35
Module end 'content'
Timing: Jan 19 2025 11:46:35
Script end

Main resources:

Total runtime1.4508 sec
Peak memory usage4,096.0000 KB
Database Queries84

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 589.2891152.6406
Module start 'layout' 0.00550.0033 741.929739.4922
Module start 'content' 0.00891.4403 781.4219753.7969
Module end 'content' 1.44910.0016 1,535.218824.1250
Script end 1.4507  1,559.3438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.2518160.0002
Check MTime0.00140.0939160.0001
Mysql Total
Database connection0.00080.056210.0008
Mysqli_queries1.361493.8411840.0162
Looping result0.00090.0613820.0000
Template Total1.410197.220.7050
Template load0.00200.140420.0010
Template processing1.408097.052920.7040
Template load and register function0.00020.011810.0002
states
state_id_array0.00180.121410.0018
state_identifier_array0.00270.185620.0013
Override
Cache load0.00190.1277660.0000
Sytem overhead
Fetch class attribute can translate value0.00050.037550.0001
Fetch class attribute name0.00130.0903130.0001
XML
Image XML parsing0.00190.128450.0004
class_abstraction
Instantiating content class attribute0.00000.0031170.0000
General
dbfile0.00260.1812290.0001
String conversion0.00000.000740.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
10content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
8content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
7content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/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: 44
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs