cancel
Showing results for 
Search instead for 
Did you mean: 

Setting properties on AVM nodes with javascript webscript

stevereiner
Champ in-the-making
Champ in-the-making
I have added a new tab view in flexspaces with a tree and dual folders for navigating and working with AVM stores. While working on properties dialog and create folder support, I ran into this problem:
Setting title and description  doesn't work (get null values on these properties when look at the result in the node browser in admin console in web client)
Should I be doing something "special" to set properties on avm nodes? Using avmNode.rename(newname) does work for names.  Tried setting other properties without doing anything with name to isolate. Using 2.90C_dev 04 23 08 (Used the javascript debugger and saw values for description and title getting into javascript avm script node, just not into the avm repository)


var avmNode = avm.lookupNode(pathWithStore);
avmNode.properties.title = "title";
avmNode.properties.description = "description";
avmNode.save();

Steve
4 REPLIES 4

pmonks
Star Contributor
Star Contributor
Unfortunately the AVM is currently exposed mostly R/O to Javascript, so to do anything R/W in nature in the AVM either requires calling Java APIs from Javascript (as described at http://wiki.alfresco.com/wiki/JavaScript_API#Adding_Custom_Script_APIs and http://wiki.alfresco.com/wiki/JavaScript_API#Native_Java_API_Access) or implementing the Web Script in Java.

Note that you could possibly run into trouble using the mechanism described at http://wiki.alfresco.com/wiki/JavaScript_API#Native_Java_API_Access in the 2.9C builds - although this change was applied to the 2.1E branch some time ago (in early April, from memory) I don't know the exact timing of the merge forward of that fix to the Community branch.

Cheers,
Peter

stevereiner
Champ in-the-making
Champ in-the-making
Peter,

Only hit the R/O avm Javascript api wall when setting properties (actually does "W" just writes null no matter what). Was able to create/upload files, create folders, delete nodes, copy, move with javascript  in the avm.   Did notice no javascript apis for creating webprojects, creating webapp folders, checking links, submit, revert, webforms, etc.

Thanks,
Steve

pmonks
Star Contributor
Star Contributor
Interesting!  I guess that must have changed in 2.9 (or possibly 2.2 - most of my Javascript API knowledge dates to 2.0/2.1  Smiley SurprisedopsSmiley Happy.

In that case that behaviour sounds like a bug - could I suggest raising it in JIRA (http://issues.alfresco.com/) and posting the link back here for all of us to peruse?

Cheers,
Peter

stevereiner
Champ in-the-making
Champ in-the-making
Found open existing bug in JIRA "Need to support editing properties on AVM nodes" ALFCOM-82 which was WCM-279 (but it doesn't mention javascript)
http://issues.alfresco.com/browse/ALFCOM-82

Created new bug
http://issues.alfresco.com/browse/ALFCOM-1720

FlexSpaces 0.3 and its webscripts now has AVM support (except for setting non name properties!)
Supports navigating / working with files and folders in AVM stores in new WCM tab view with tree and drag/drop/clipboard between dual folder views.
Also native drag/drop/copy/paste of desktop files into AVM stores in FlexSpceaces+AIR.

http://forge.alfresco.com/projects/flexspaces/

Also noticed could do an ADM to AVM copy, but not an AVM to ADM copy,  in flexspaces/webscripts with the crossRepoCopy.copy()
This doesn't look javascript specific, since I saw the same problem in the web client.

Steve