Forums / General / About user editing folder in front web

About user editing folder in front web

Author Message

Albert Balagueró

Thursday 05 May 2011 7:28:20 am

Hi,

i would like to know if somebody knows about any complement or configuration of classes that allows to registered user to only edit the images that they have loaded in their own folder, automaticly created on user registration. And do this directly in the front web, not in the admin panel.

Thanks in advance.
Cheers!

Ivo Lukac

Thursday 05 May 2011 1:49:04 pm

There is an extension for this: http://projects.ez.no/personal_folder, but very old. It should be rewritten for newer eZ versions.

Basically you need to trigger a workflow after user registers which creates a folder and applies a specific role to the user so he can create images.

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Quoc Huy Nguyen Dinh

Monday 09 May 2011 4:01:33 am

You can achieve this using the existing after-publishing trigger bound to a multiplexer workflow. Then the multiplexer would upon publishing of a 'user' object call a custom workflow which in turns calls a custom workflow event with this:

function execute( $process, $event )
{
    $parameters = $process->attribute( 'parameter_list' );

    // Retreive object info from the parameters
    $objectID = $parameters['object_id'];
    $object = eZContentObject::fetch( $objectID );
    $nodeID = $object->attribute( 'main_node_id' );
    $parentNodeID = $object->attribute( 'main_parent_node_id' );
    $datamap = $object->dataMap();

    // the user account being created 
    $userAccount = $datamap['user_account']->content();
    $userLogin = $userAccount->attribute('login');

    $params = array();

    // Node ID of the parent folder where to create the user personal folder
    // Best is to store that in an INI file
    $params['parent_node_id'] = 637;
    $params['class_identifier'] = 'folder';

    // The creator id is set to the user id
    $params['creator_id'] = $objectID;

    // attributes for the created folder
    $attributesData = array();

    // Set the name of the folder to the name of the user
    $attributesData['name'] = $object->attribute('name');
    // Set the short name to the user login
    $attributesData['short_name'] = $userLogin;

    $params['attributes'] = $attributesData;

    $db = eZDB::instance();
    $db->begin();
    $folderObject = eZContentFunctions::createAndPublishObject( $params );

    // In the user class, you can add a new attribute of datatype Enhanced Object Relation:
    // http://projects.ez.no/enhanced_objectrelation/
    // This can help to locate the user's personal folder
    $userFolderAttribute = $datamap['related_diagram_repository'];

    // Resetting default relation
    $fromObjectID =(int) $object->attribute('id');
    $contentClassAttributeID =(int) $userFolderAttribute->ContentClassAttributeID;
    $contentObjectVersion =(int) $object->attribute('version') + 1;
    $db->query( "DELETE FROM ezcontentobject_link WHERE from_contentobject_id='$fromObjectID' AND from_contentobject_version='$contentObjectVersion' AND  contentclassattribute_id='$contentClassAttributeID'" );

    // Set relation to the user's Folder
    $object->addContentObjectRelation($folderObject->attribute('id'), (int)$object->attribute('version'), $userFolderAttribute->ContentClassAttributeID);

    $db->commit();

    return eZWorkflowType::STATUS_ACCEPTED;

}

Albert Balagueró

Tuesday 24 May 2011 9:53:37 am

Hi to all,
thanks for your responds.

I've tried with personalfolder (I have done it one year ago and it worked) but it does not seem to work. I think that it is a problem with the "patch" files that I must copy to kernel/users. I don't reach to undertand what I'm doing wrong.

For the second option, how I link the workflow code to the trigger, I'm really new in eZ and I don't reach the way to do it like you told Quoc Huy Nguyen Dinh.
Please, I will really apreciate I you would you show me the steps, one by one, to do what you said.

Sorry for may bad english...

Thanks a lot to all!

Albert Balagueró

Tuesday 24 May 2011 9:56:46 am

Sorry, and another question, where do I must put the above code?

Thanks.

Quoc Huy Nguyen Dinh

Tuesday 24 May 2011 12:41:56 pm

Hi there, (what's your name by the way?)

I'm pretty busy these days so won't be able to fully help you with this, but I wrote a tutorial on how to create workflows, so please have a read at it and learn workflows as they are a pretty important eZ Publish feature. If you still have issues, I will try to give more help later.

http://share.ez.no/learn/ez-publish/creating-a-simple-custom-workflow-event

Albert Balagueró

Tuesday 24 May 2011 12:53:03 pm

Ups, sorry, my name is Albert,
if tried yet this tutorial but I'm going crazy, I don't know if I'm doing well all the steps, I don't reach the solution, I think I have a problem understanding the order of workflow creation.

I continue to try.
Thanks anyway.

I really apreciate your comments.

eZ debug

Timing: Jan 17 2025 21:12:33
Script start
Timing: Jan 17 2025 21:12:33
Module start 'content'
Timing: Jan 17 2025 21:12:33
Module end 'content'
Timing: Jan 17 2025 21:12:33
Script end

Main resources:

Total runtime0.6460 sec
Peak memory usage4,096.0000 KB
Database Queries209

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 599.5859180.8438
Module start 'content' 0.00570.5486 780.4297681.4922
Module end 'content' 0.55430.0917 1,461.9219341.2969
Script end 0.6460  1,803.2188 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.6286210.0002
Check MTime0.00140.2240210.0001
Mysql Total
Database connection0.00080.126310.0008
Mysqli_queries0.572288.57482090.0027
Looping result0.00160.24812070.0000
Template Total0.623796.520.3119
Template load0.00220.336820.0011
Template processing0.621696.210920.3108
Template load and register function0.00020.023810.0002
states
state_id_array0.00090.141610.0009
state_identifier_array0.00070.102520.0003
Override
Cache load0.00190.2889390.0000
Sytem overhead
Fetch class attribute can translate value0.00080.123040.0002
Fetch class attribute name0.00100.147890.0001
XML
Image XML parsing0.00150.226640.0004
class_abstraction
Instantiating content class attribute0.00000.0026100.0000
General
dbfile0.00190.2911360.0001
String conversion0.00000.000830.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
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 29
 Number of unique templates used: 8

Time used to render debug report: 0.0001 secs