Creating Space with PHPLibrary 

Discussion of the PHP Library for Alfresco

Creating Space with PHPLibrary

Postby juanc82 » 13 Mar 2006, 08:49

Hi.

First of all, congratulations for your PHP iniciative it will be great for us PHP developers.

Now I have two questions:

1)how can I create a space via php library? Is it with a query using CML?
2)how can I give permissions to users on that space?

I'm not sure how can I do this. If it can't be done via the actual library, it will be of great help to receive some hints.

Thanks a lot.
juanc82
Community Member
Community Member
 
Posts: 6
Joined: 06 Mar 2006, 21:27

0 Points (What is this?)

Postby rwetherall » 17 Mar 2006, 10:03

Hi,

Thanks for the kind comments.

Yes, in order to create a space you will need to use CML and to assign permissions you will need to use the AccessControl web service.

These are both available in 1.2, but only the stub have been generated fro the PHP library, there are not the helper interfaces that are available for some of the other services.

This means you'll have to a bit of work, calling the PHP stubs directly in order to so this.

Hope this helps,
Cheers,
Roy
- Read the Alfresco Developer Guide here
rwetherall
Alfresco Engineer
Alfresco Engineer
 
Posts: 384
Joined: 27 Jun 2005, 11:59
Location: Alfresco HQ

1 Point (What is this?)

Postby rwetherall » 30 Mar 2006, 14:49

Hi,

Support for CML in the PHP library has been contributed.

Checkout the latest code from the PHP forge project to try it out.

Cheers,
Roy
- Read the Alfresco Developer Guide here
rwetherall
Alfresco Engineer
Alfresco Engineer
 
Posts: 384
Joined: 27 Jun 2005, 11:59
Location: Alfresco HQ

1 Point (What is this?)

Support for CML

Postby juanc82 » 09 Apr 2006, 21:13

Hi Roy

Thanks for the annoucement.

I've been wondering how to create the space with CML. I've been looking at the code and also comparing it with the one in Java but i don't arrive to the code that actually will let me create a space from a PHP application.

I've noticed that the new version of the library includes the update method but i don't now how to build a CML statement (in this case an CMLCreate statement) in order to pass it to this function.

Any hints?

Thanks a lot
juanc82
Community Member
Community Member
 
Posts: 6
Joined: 06 Mar 2006, 21:27

0 Points (What is this?)

Sample Code: Create Store using PHP

Postby eron123 » 14 Jun 2006, 13:52

Here is some sample code for creating Stores:
Code: Select all
$storename = "New Store";
$properties[0] = new NamedValue( "{http://www.alfresco.org/model/content/1.0}name", $storename);
$properties[1] = new NamedValue( "{http://www.alfresco.org/model/content/1.0}title", $storename);
$properties[2] = new NamedValue("{http://www.alfresco.org/model/content/1.0}description", "test");
$reference = new Reference($store, $focus->settings['alfresco_space'] );
$parentreference = new ParentReference($store, $reference->getUuid(), $reference->getPath(), ASSOC_CONTAINS,  createQNameString( NAMESPACE_CONTENT_MODEL, $storename) );
$create = new CMLCreate($storename, $parentreference, TYPE_FOLDER, $properties);
$cml = new CML();
$cmllist[0] = $create;
$cml->setCreate($create );

$results = @$repository_service->update($cml);
eron123
Community Member
Community Member
 
Posts: 14
Joined: 07 May 2006, 22:07

0 Points (What is this?)

Postby khalylmk » 04 Sep 2006, 06:02

hello,
is the creation/upload content similar to this code?

thx
khalylmk
 
Posts: 3
Joined: 22 Aug 2006, 07:37

0 Points (What is this?)

create/upload code

Postby eron123 » 05 Sep 2006, 19:18

Unfortunately I'm not sure the PHP library upload code works or is complete. I'd lov to see a sample if someone can get it working?
eron123
Community Member
Community Member
 
Posts: 14
Joined: 07 May 2006, 22:07

0 Points (What is this?)

Postby khalylmk » 06 Sep 2006, 10:41

Hi,
in fact the best i could do is to overwrite the contents of a certain file with the contents of another (uploaded) file. now i only need to get to create a node within a store to be able to write to it... :( there's still the process of checking out and checking in...

i tried creating a new content node, with the following, but i'm getting an error. Hope someone could help me out:!
Code: Select all
$properties[0] = new NamedValue( "{http://www.alfresco.org/model/content/1.0}name",false, $contentname, null);
$properties[1] = new NamedValue( "{http://www.alfresco.org/model/content/1.0}title", false, $contentname, null);
$properties[2] = new NamedValue("{http://www.alfresco.org/model/content/1.0}description", false, "test", null);
//$reference = new Reference($store, $focus->settings['alfresco_space'] );
$parentreference = new ParentReference($store, $reference->getUuid(), $reference->getPath(), ASSOC_CONTAINS,  createQNameString( NAMESPACE_CONTENT_MODEL, $contentname) );
$create = new CMLCreate($contentname, $parentreference, TYPE_CONTENT, $properties);
$cml = new CML();
$cmllist[0] = $create;
$cml->setCreate($create ); 

$results = $repository_service->update($cml);



error:
Code: Select all
Error: couldn't build response
Stack trace: #0 D:\PROJECT\WORK\web\TEST\lib\alfresco\RepositoryService.php(109): BaseService->checkForError(Object(SOAP_Fault)) #1 D:\PROJECT\WORK\web\TEST\modules\alfresco\addNode.php5(107): RepositoryService->update(Object(CML)) #2
khalylmk
 
Posts: 3
Joined: 22 Aug 2006, 07:37

0 Points (What is this?)

Postby Marcus » 12 Oct 2006, 06:14

How did you go about uploading new content from a file?
Marcus
Alfresco Partner
Alfresco Partner
 
Posts: 115
Joined: 11 Jul 2006, 12:13

1 Point (What is this?)

Postby ga_katie » 11 Dec 2006, 18:30

it doesn't seem like there is anything about CML or NamedValue in the 1.4 version

has the method of adding a space/content changed?

there doesn't seem to be any sample code around for creating data.

could anyone provide an example of adding a space or creating content?
ga_katie
 
Posts: 3
Joined: 11 Dec 2006, 18:20

0 Points (What is this?)

Re: Sample Code: Create Store using PHP

Postby Fler » 16 May 2007, 10:59

I have tried the code below, but unfortunately isn't working. I think the $properties object is wrong, because if I comment all the $properties rows, the new folder is created, but the name of the new folder something like this: 639670bc-039b-11dc-a982-4b4c459a186c. Can anybody help me?

Thx,
Fler

eron123 wrote:Here is some sample code for creating Stores:
Code: Select all
$storename = "New Store";
$properties[0] = new NamedValue(
"{http://www.alfresco.org/model/content/1.0}name", $storename);
$properties[1] = new NamedValue(
"{http://www.alfresco.org/model/content/1.0}title", $storename);
$properties[2] = new
NamedValue("{http://www.alfresco.org/model/content/1.0}description",
"test");
$reference = new Reference($store, $focus->settings['alfresco_space'] );
$parentreference = new ParentReference($store, $reference->getUuid(),
$reference->getPath(), ASSOC_CONTAINS,  createQNameString(
NAMESPACE_CONTENT_MODEL, $storename) );
$create = new CMLCreate($storename, $parentreference, TYPE_FOLDER,
$properties);
$cml = new CML();
$cmllist[0] = $create;
$cml->setCreate($create );

$results = @$repository_service->update($cml);
Fler
 
Posts: 1
Joined: 11 May 2007, 13:25

0 Points (What is this?)


Return to PHP Library

Who is online

Users browsing this forum: No registered users and 0 guests