H-Works Agency
|
Monday 28 January 2008 6:32:14 am
Hello, How is it possible to create a new node, for customs contents, under node_id '1' ? It would be at the same depth as "Contents, Users, Design...Etc" Thanx in advance.
EZP is Great
|
Piotrek Karaś
|
Tuesday 29 January 2008 11:16:46 am
You actually mean root node or a top level node?
If the latter, I've already done some experiments:
http://ez.ryba.eu/index.php/ez_publish/lab/custom_top_level_nodes_is_that_possible_round_i_exploration
Unfortunately, didn't find time to push it to a more practical dimension ;) There should be some other works if you look. If you mean root node, then I might be wrong, but don't think so. The root node has contentobject_id reference equal 0, and there is no contentobject corresponding, which from my experience suggests that root node is purely virtual. It might be called in a fixed way or never called at all, it might be there for tree structuring/recursing only.
--
Company: mediaSELF Sp. z o.o., http://www.mediaself.pl
eZ references: http://ez.no/partners/worldwide_partners/mediaself
eZ certified developer: http://ez.no/certification/verify/272585
eZ blog: http://ez.ryba.eu
|
H-Works Agency
|
Monday 07 July 2008 5:15:44 am
I was speaking of top-level nodes. I've read your article and the answer seems to be negative. For example i have a website with a "reservation" function. Those contents are neither webcontents, or else but uses ezp classes and must thus be inside ezp content tree. It would be nice if i could have moved all those reservations into a new top-level node and make a custom module accessing them.
EZP is Great
|
Björn Dieding@xrow.de
|
Monday 07 July 2008 5:26:28 am
somthing like this will do the job...
<?php
include_once( 'lib/ezutils/classes/ezcli.php' );
include_once( 'kernel/classes/ezscript.php' );
$cli =& eZCLI::instance();
$script =& eZScript::instance( array( 'description' => ( "Content Server Client setup script\n" .
"creates the incomming node for the content server client\n" .
"\n" .
"./extension/contentserver/bin/createincommingnode.php -ssiteaccessname" ),
'use-session' => true,
'use-modules' => true,
'use-extensions' => true ) );
$script->startup();
$options = $script->getOptions( "[admin-user:]",
"",
array( 'admin-user' => 'Admin user login name' ) );
$script->initialize();
include_once( 'kernel/classes/ezcontentobject.php' );
include_once( 'kernel/classes/ezsection.php' );
// login as admin
include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );
$user = eZUser::fetchByName( $options['admin-user'] );
if ( is_object( $user ) )
{
if ( $user->loginCurrent() )
$cli->output( "Logged in as 'admin'" );
}
else
{
$cli->error( 'No admin.' );
$script->shutdown( 1 );
}
$section = new eZSection( array( 'name' => 'Content server', 'navigation_part_identifier' => 'ezcontentservernavigationpart' ) );
$section->store();
$userClassID = 1;
$userCreatorID = 14;
$defaultSectionID = $section->ID;
$class = eZContentClass::fetch( $userClassID );
$contentObject = $class->instantiate( $userCreatorID, $defaultSectionID );
$remoteID = "contentserver:incomingnode";
$contentObject->setAttribute( 'remote_id', $remoteID );
$contentObject->store();
$contentObjectID = $contentObject->attribute( 'id' );
$userID = $contentObjectID;
$nodeAssignment = eZNodeAssignment::create( array( 'contentobject_id' => $contentObjectID,
'contentobject_version' => 1,
'parent_node' => 1,
'is_main' => 1 ) );
$nodeAssignment->store();
$version =& $contentObject->version( 1 );
$version->setAttribute( 'modified', time() );
$version->setAttribute( 'status', EZ_VERSION_STATUS_DRAFT );
$version->store();
$contentObjectID = $contentObject->attribute( 'id' );
$contentObjectAttributes = $version->contentObjectAttributes();
$contentObjectAttributes[0]->setAttribute( 'data_text', 'Incoming' );
$contentObjectAttributes[0]->store();
include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,
'version' => 1 ) );
$cli->output( "Node created with object_id #$contentObjectID" );
return $script->shutdown();
?>
Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/
|