Hi Jeff In Share In DocumentLibrary ,there is a toolbar with selected items dropdownlist with menu copy,move,assign workflow,permission etc .When i select a document and click the assign workflow menu a pop is shown to select the assign and due date etc .I just want to know where the mapping is made in toolbar.get.html.ftl .The workflow.js is called when the ’assign workflow ...’ is clicked.where is the workflow.js and menu dropdown assign workflow is mapped . span class=’onActionAssignWorkflow’>${msg(’menu.selected-items.assign-workflow’)}
Alfresco Surf Code Camp
Lab 4: Content associations and CMIS
Objectives
Build an Object Viewer page in Surf
Add a CMIS Browser Component
Add a CMIS Display Component
Work with XML streams and process them in
FreeMarker
Experiment with linking to object instances
07/11/08 2
Green Energy
We will further extend the Green Energy site
• We started this in Lab #3
• It was extended in the walkthrough with introductory CMIS
Sample location:
• /opt/tomcat/webapps/alfwf
• http://labs3c:8580/alfwf
07/11/08 3
Directories
Green Energy Web Application
• /opt/tomcat/webapps/alfwf
site-data
• /WEB-INF/classes/alfresco/site-data
site-webscripts
• /WEB-INF/classes/alfresco/site-webscripts
FreeMarker templates
• /WEB-INF/classes/alfresco/templates
07/11/08 4
Update the FolderList Component
folderlist.get.js
<import resource=\"classpath:alfresco/site-webscripts/age/feed.utils.js\">
var path = \"/Company%20Home\";
// load the feel
var connector = remote.connect(\"alfresco\");
var feed = connector.get(\"/api/path/workspace/SpacesStore\" + path + \"/children\");
// parse the feed and set namespace
var xml = loadFeed(feed);
// set up the model
model.title = xml.*::title.toString();
var items = new Array();
for each (entry in xml.*::entry)
{
var item = { };
item[\"title\"] = entry.*::title.toString();
item[\"icon\"] = entry.*::icon.toString();
item[“id”] = null; // TODO
item[“url”] = null; // TODO
items.push(item);
}
model.items = items;
07/11/08 5
Update the FolderList Component
Fill in the “id” property for each item in the array
• We can use the “content” property
• Syntax: node.*::childElement.toString();
Fill in the “url” property for each item in the array
• Use the LinkBuilder API
• Creates a link to an object
• context.linkBuilder.object(“workspace://SpacesStore/” +
item[“id”]);
07/11/08 6
Update the FolderList Component
TODO
Insert value of url from model
●
Syntax: ${variableName} or ${object.variableName}
●
07/11/08 8
Try it out
Start Alfresco
• http://labs3c:8080/alfresco
Start Surf Tomcat
• http://labs3c:8580/sample
Browse to
• http://labs3c:8580/alfwf/service/index
Click on ‘Refresh’ to reset the Web Scripts cache
Test your site
• http://labs3c:8580/sample
07/11/08 9
Try it out
07/11/08 10
Content Association: cm:content
Add a Content Association for cm:content
Points to a page: content-details
cm_content.details.xml
• /WEB-INF/classes/alfresco/site-data/content-associations
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<content-association>
<source-id>{http://www.alfresco.org/model/content/1.0}content</source-id>
<dest-id>content-details</dest-id>
<assoc-type>page</assoc-type>
</content-association>
This tells the framework to use the page ‘content-
details’ whenever it is told to display content of type
• {http://www.alfresco.org/model/content/1.0}content
07/11/08 11
Content Association: cm:folder
Add a Content Association for cm:folder
Points to a page: content-details
cm_folder.details.xml
• /WEB-INF/classes/alfresco/site-data/content-associations
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<content-association>
<source-id>{http://www.alfresco.org/model/content/1.0}folder</source-id>
<dest-id>content-details</dest-id>
<assoc-type>page</assoc-type>
</content-association>
This tells the framework to use the page ‘content-
details’ whenever it is told to display content of type
• {http://www.alfresco.org/model/content/1.0}folder
07/11/08 12
Tools Template
navigation template scope
left content
page scope page scope
footer global scope
07/11/08 14
Two Components Side by Side
We would like to add two components to this page
• Content Browser
• Content Details
Using the content browser on the left, users select
documents and folders
By selecting folders, they drill down in the browser
Clicking on a document tells the content details
component to show the content details
07/11/08 15
Add a CMIS Browser Component
Navigate to the site-webscripts directory
• /WEB-INF/classes/alfresco/site-webscripts
Create a path called age/content
Navigate into the age/content path
• /WEB-INF/classes/alfresco/site-webscripts/age/content
Create a Web Script:
• browser
07/11/08 16
Add a CMIS Details Component
Navigate to the site-webscripts directory
• /WEB-INF/classes/alfresco/site-webscripts
Create a path called age/content
Navigate into the age/content path
• /WEB-INF/classes/alfresco/site-webscripts/age/content
Create a Web Script:
• details
07/11/08 21
Add a CMIS Details Component
Set up model variables
Name
• {http://www.alfresco.org/model/content/1.0}name
Description
• {http://www.alfresco.org/model/content/1.0}description
Id
• {http://www.alfresco.org/model/system/1.0}node-uuid
Download URL
• url.context +
\"/proxy/alfresco/api/node/content/workspace/SpacesStore/\" +
model.id;
07/11/08 24
Add a CMIS Details Component
Use the object data that was automatically loaded by
the framework
Variable: context.content
Useful JSON Tool - http://www.jsonlint.com/
• Copy-and-paste JSON into a form and JSON lint makes it pretty
JSON Example – Company Home
• http://labs3c:8080/alfresco/service/webframework/content/meta
data
JSON Example – Guest Space
• http://labs3c:8080/alfresco/service/webframework/content/meta
data?id=workspace://SpacesStore/ba5a95a3-3931-4ba3-8db7-
c5eb95a156a3
JSON Example – Guest Tutorial PDF
• http://labs3c:8080/alfresco/service/webframework/content/meta
data?id=workspace://SpacesStore/a7824f47-e929-4c64-
b789-19b7f22e5b07
07/11/08 25
Try it out
Start Alfresco
• http://labs3c:8080/alfresco
Start Surf Tomcat
• http://labs3c:8580/alfwf
Browse to
• http://labs3c:8580/alfwf/service/index
Click on ‘Refresh’ to reset the Web Scripts cache
Test your site
• http://labs3c:8580/alfwf
07/11/08 30
Try it out
07/11/08 31
Try it out
07/11/08 32
Wrap-up
In this lab, you...
• Associated cm:folder with a specific page
• Associated cm:content with a specific page
• Created a “browse” and a “details” component and bound them to
regions on the Tools page
07/11/08 Optaros and Client confidential. All rights reserved. 33
Surf Code Camp Lab 4 is the final lab in which a pa more
Surf Code Camp Lab 4 is the final lab in which a pages are added to the Green Energy site that facilitate browsing through the repository hierarchy using CMIS and Surf object associations.
Full solution source code is at http://ecmarchitect.com/images/green-energy-code-camp.zip less
1 comments
Comments 1 - 1 of 1 previous next Post a comment