ez projects / ezapprove2 / forum / general / code review of ez4/php5 ver... / re: code review of ez4/php5...
You need to be logged in to post messages in the forums. New users may register here.
Member since: Posts: 37 |
Wednesday 27 February 2008 2:30:56 am Howdy
I've installed the eZ4 /php5 version and am doing a code review as we are going to use this in a project. Will provide patches/commits (if added as a member)...here's the first one Index: classes/ezxapprovestatususerlink.php =================================================================== --- classes/ezxapprovestatususerlink.php (revision 2500) +++ classes/ezxapprovestatususerlink.php (working copy) @@ -52,7 +52,7 @@ class eZXApproveStatusUserLink extends eZPersistentObject { const RoleCreator = 0; - const RoleApprover = 0; + const RoleApprover = 1; const StatusNone = 0; const StatusApproved = 1; Looks as if the RoleApprover was incorrectly assigned 0 when it from moved to a class constant. Cheers Bruce |
|
Member since: Posts: 37 |
Thursday 28 February 2008 1:55:42 am Minor changes to method definitions get rid of strict warnings:
Index: collaboration/ezapprove2/ezapprove2collaborationhandler.php =================================================================== --- collaboration/ezapprove2/ezapprove2collaborationhandler.php (revision 2500) +++ collaboration/ezapprove2/ezapprove2collaborationhandler.php (working copy) @@ -103,7 +103,7 @@ /*! \reimp */ - function title( $collaborationItem ) + function title( &$collaborationItem ) { return ezi18n( 'kernel/classes', 'Approval v.2' ); } @@ -156,7 +156,7 @@ \reimp \return the number of messages for the approve item. */ - function messageCount( $collaborationItem ) + function messageCount( &$collaborationItem ) { return eZCollaborationItemMessageLink::fetchItemCount( array( 'item_id' => $collaborationItem->attribute( 'id' ) ) ); } @@ -165,7 +165,7 @@ \reimp \return the number of unread messages for the approve item. */ - function unreadMessageCount( $collaborationItem ) + function unreadMessageCount( &$collaborationItem ) { $lastRead = 0; $status = $collaborationItem->attribute( 'user_status' ); @@ -271,7 +271,7 @@ \reimp Adds a new comment, approves the item or denies the item. */ - function handleCustomAction( $module, $collaborationItem ) + function handleCustomAction( &$module, &$collaborationItem ) { $redirectView = 'item'; $redirectParameters = array( 'full', $collaborationItem->attribute( 'id' ) ); |
|
Member since: Posts: 37 |
Thursday 28 February 2008 2:01:59 am When an item is first created and caught by the workflow and is editied by the approver, the approver is prompted to place the item after publishing. This can be impossible as there is no information as to where the object was created.
I tracked this down to when the new draft is created from the original that the node assignments are note copied because they have a remote_id of 0 (I suspect because it's not been published) The following patch manually copies the node assignments if the item has not been published and this "fixes' the issue. Index: collaboration/ezapprove2/ezapprove2collaborationhandler.php =================================================================== --- collaboration/ezapprove2/ezapprove2collaborationhandler.php (revision 2500) +++ collaboration/ezapprove2/ezapprove2collaborationhandler.php (working copy) @@ -345,6 +345,24 @@ // 2. Create new version based in the pending one. $newVersion = $contentObject->createNewVersion( $approveStatus->attribute( 'active_version' ) ); + // If the Object has never been published we have to copy the node + // assignment(s) acorss from the initial version to avoid the user + // being prompted for a location when publishing. + // + // It would appear that isn't done in the model for non published items. + if ($contentObject->attribute('published') == 0) + { + $version = $contentObject->attribute('current'); + $nodeAssignmentList = $version->attribute( 'node_assignments' ); + $contentObjectID = $contentObject->attribute('id'); + $newVersionNumber = $newVersion->attribute('version'); + foreach ( array_keys( $nodeAssignmentList ) as $key ) + { + $nodeAssignment = $nodeAssignmentList[$key]; + $clonedAssignment = $nodeAssignment->cloneNodeAssignment( $newVersionNumber, $contentObjectID ); + $clonedAssignment->store(); + } + } // 3. Set pending version to rejected. $oldVersion = $approveStatus->attribute( 'object_version' ); |
|
Member since: Posts: 37 |
Thursday 28 February 2008 2:09:15 am I suspect this is related the the previous item and possibility may be a an eZ issue. When an item is displayed in a collaboration preview using the plain view the location ("Placed in") is blank. You have to use the conten_version and not the content_object to get these to display.
I've added this to the extension but maybe it should go in the main eZ dist as it's most probably an issue with the shipped approve workflow Index: design/standard/templates/node/view/plain.tpl =================================================================== --- design/standard/templates/node/view/plain.tpl (revision 0) +++ design/standard/templates/node/view/plain.tpl (revision 0) @@ -0,0 +1,45 @@ +{* DO NOT EDIT THIS FILE! Use an override template instead. *} +{* Default object view template for read-only views + Displays object content only with no buttons or children *} +{default content_object=$node.object + content_version=$node.contentobject_version_object + node_name=$node.name|wash} + +<div class="objectheader"> +<h2>Default object view. <a class="menuheadlink" href={"/setup/templateview/node/view/plain.tpl"|ezurl}>Click to create a custom template</a></h2> +</div> + +<div class="object"> + <h1>{$node_name}</h1> + <input type="hidden" name="TopLevelNode" value="{$content_object.main_node_id}" /> + + {section name=ContentObjectAttribute loop=$content_version.contentobject_attributes} + <div class="block"> + <label>{$ContentObjectAttribute:item.contentclass_attribute.name|wash}</label> + <p class="box">{attribute_view_gui attribute=$ContentObjectAttribute:item}</p> + </div> + {/section} + + <h3>{'Placed in'|i18n('design/standard/node/view')}</h3> + {section name=Parent loop=$content_version.parent_nodes} + {let parent_node=fetch(content,node,hash(node_id,$:item.parent_node))} + {section name=Path loop=$:parent_node.path} + {node_view_gui view=text_linked content_node=$:item} / + {/section} + {node_view_gui view=text_linked content_node=$:parent_node}<br/> + {/let} + {/section} +</div> + + {let name=Object related_objects=$content_version.related_contentobject_array} + + {section name=ContentObject loop=$Object:related_objects show=$Object:related_objects sequence=array(bglight,bgdark)} + + <div class="block"> + {content_view_gui view=text_linked content_object=$Object:ContentObject:item} + </div> + + {/section} + {/let} + +{/default} |
|
Member since: Posts: 37 |
Thursday 28 February 2008 5:25:58 am Typo in Constant
Index: eventtypes/event/ezapprove2/ezapprove2type.php =================================================================== --- eventtypes/event/ezapprove2/ezapprove2type.php (revision 2500) +++ eventtypes/event/ezapprove2/ezapprove2type.php (working copy) @@ -128,7 +128,7 @@ if ( !$object ) { eZDebugSetting::writeError( 'kernel-workflow-approve', $parameters['object_id'], 'eZApprove2Type::execute' ); - return eZWorkflowType::STATUS_WORKFLOW_CANCELED; + return eZWorkflowType::STATUS_WORKFLOW_CANCELLED; } /* |
You need to be logged in to post messages in the forums. New users may register here.