SlideShare a Scribd company logo
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=quot;classpath:alfresco/site-webscripts/age/feed.utils.jsquot;>

             var path = quot;/Company%20Homequot;;

             // load the feel
             var connector = remote.connect(quot;alfrescoquot;);
             var feed = connector.get(quot;/api/path/workspace/SpacesStorequot; + path + quot;/childrenquot;);

             // 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[quot;titlequot;] = entry.*::title.toString();
                item[quot;iconquot;] = 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

             folderlist.get.html.ftl
              • /WEB-INF/classes/alfresco/site-webscripts/age

                <div>
                   <div class=quot;titlequot;>${msg(quot;folderlist.namequot;)}</div>
                   <div class=quot;bodyquot;>
                      <h2>${title}</h2>
                      <ul>
                      <#list items as item>
                        <li>
                          <a href=quot;TODOquot;>
                            <img src=quot;${item.icon}quot;/>&nbsp;${item.title}
                          </a>
                        </li>
                      </#list>
                      </ul>
                   </div>
                </div>




07/11/08                                                                   7
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=quot;1.0quot; encoding=quot;UTF-8quot;?>

              <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=quot;1.0quot; encoding=quot;UTF-8quot;?>

              <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
Add Content Details Page

             Add the ‘content-details’ page
             Re-uses the ‘tools’ template
             content-details.xml
              • /WEB-INF/classes/alfresco/site-data/pages

               <?xml version='1.0' encoding='UTF-8'?>
               <page>
                  <title>Content Details</title>
                  <template-instance>tools</template-instance>
                  <authentication>user</authentication>
               </page>




07/11/08                                                         13
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 Browser Component

             browser.get.desc.xml
             <webscript>
                <shortname>Content Browser</shortname>
                <description>Content Browser</description>
                <url>/age/content/browser</url>
             </webscript>




07/11/08                                                     17
Add a CMIS Browser Component

             browser.get.properties
             contentbrowser.name = Content Browser




07/11/08                                             18
Add a CMIS Browser Component

               browser.get.js
           <import resource=quot;classpath:alfresco/site-webscripts/age/feed.utils.jsquot;>

           // determine the path
           var path = content.properties[quot;displayPathquot;] + quot;/quot; + content.properties[quot;namequot;];
           path = path.replace( new RegExp(quot; quot;,quot;gquot;), quot;%20quot; );

           // retrieve the feed
           var connector = remote.connect(quot;alfrescoquot;);
           var feed = connector.get(quot;/api/path/workspace/SpacesStorequot; + path + quot;/childrenquot;);
           var xml = loadFeed(feed);

           // set up model
           model.title = xml.*::title.toString();
           var items = new Array();
           for each (entry in xml.*::entry)
           {
                var item = { };
                item[quot;titlequot;] = entry.*::title.toString();
                item[quot;iconquot;] = entry.*::icon.toString();
                item[quot;idquot;] = entry.*::id.toString().substring(9);
                     item[quot;nodeRefquot;] = quot;workspace://SpacesStore/quot; + item[quot;idquot;];
                     item[quot;urlquot;] = context.linkBuilder.object(item[quot;nodeRefquot;]);
                items.push(item);
           }
           model.items = items;

07/11/08                                                                                       19
Add a CMIS Browser Component

             browser.get.html.ftl
            <div>
               <div class=quot;titlequot;>${msg(quot;contentbrowser.namequot;)}</div>
               <div class=quot;bodyquot;>
                  <h2>${title}</h2>
                  <ul>

                 <#list items as item>
                   <li>
                     <a href=quot;${item.url}quot;>
                       <img src=quot;${item.icon}quot;/>&nbsp;${item.title}
                     </a>
                   </li>
                 </#list>

                  </ul>
               </div>
            </div>




07/11/08                                                                20
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

             details.get.desc.xml

             <webscript>
                <shortname>Content Details</shortname>
                <description>Content Details</description>
                <url>/age/content/details</url>
             </webscript>




07/11/08                                                     22
Add a CMIS Details Component

             details.get.js

             if(context.content != null)
             {
                model.properties = context.content.properties;

                 // TODO
                 model.title = null;
                 model.description = null;
                 model.mimetype = null;
                 model.id = null;
                 model.downloadUrl = null;
             }




07/11/08                                                         23
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 +
                quot;/proxy/alfresco/api/node/content/workspace/SpacesStore/quot; +
                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
Add a CMIS Details Component

             details.get.head.ftl

             <style type=quot;text/cssquot;>

             .doc-header
             {
                  font-size: 14px;
                  font-family: Verdana;
                  font-weight: bold;
                  color: gray;
                  padding: 4px;
             }

             A.doc
             {
                  text-decoration: none;
             }
             </style>




07/11/08                                   26
Add a CMIS Details Component

             details.get.html.ftl
             <#if content?exists>
               <h2 class=quot;doc-headerquot;>${title} <i>(${mimetype})</i></h2>
               ${description}
               <br/><br/>
               <#if downloadUrl?exists>
                 <a href=quot;${downloadUrl}quot;>Download</a>
               </#if>
               <br/><br/>
               <h2>Properties</h2>
               <br/>
               <table>
               <#list properties?keys as propertyKey>
                  <#assign propertyValue = properties[propertyKey]>
                  <tr>
                     <td>
                        ${propertyKey}<br/>
                        ${propertyValue?string}
                     </td>
                  </tr>
               </#list>
               </table>
             <#else>
                  No Content Selected
             </#if>



07/11/08                                                                   27
Bind in Content Browser component

             Add a left-side content browser component
             page.left.content-details.xml
              • /WEB-INF/classes/alfresco/site-data/components

              <?xml version='1.0' encoding='UTF-8'?>
              <component>
                 <scope>page</scope>
                 <region-id>left</region-id>
                 <source-id>content-details</source-id>
                 <url>/age/content/browser</url>
              </component>




07/11/08                                                         28
Bind in Content Details Component

             Add a centered content details component
             page.content.content-details.xml
              • /WEB-INF/classes/alfresco/site-data/components

              <?xml version='1.0' encoding='UTF-8'?>
              <component>
                 <scope>page</scope>
                 <region-id>content</region-id>
                 <source-id>content-details</source-id>
                 <url>/age/content/details</url>
              </component>




07/11/08                                                         29
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

More Related Content

What's hot

Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui framework
HongSeong Jeon
 
Open Social Summit Korea
Open Social Summit KoreaOpen Social Summit Korea
Open Social Summit Korea
Arne Roomann-Kurrik
 
Advanced Fluid
Advanced FluidAdvanced Fluid
Advanced Fluid
Sebastian Kurfürst
 
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)Carles Farré
 
<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress
Matt Harris
 
Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1
Byrne Reese
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESS
jsmith92
 
Extreme Web Productivity with Spring Roo
Extreme Web Productivity with Spring RooExtreme Web Productivity with Spring Roo
Extreme Web Productivity with Spring Roo
Stefan Schmidt
 
Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Byrne Reese
 
Web Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaosWeb Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaos
Matteo Papadopoulos
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
Brad Williams
 
Java presentation
Java presentationJava presentation
Java presentation
Karan Sareen
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
markparolisi
 
浜松Rails3道場 其の弐 Model編
浜松Rails3道場 其の弐 Model編 浜松Rails3道場 其の弐 Model編
浜松Rails3道場 其の弐 Model編 Masakuni Kato
 
JSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph PicklJSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph Pickl
Christoph Pickl
 
Java servlets and CGI
Java servlets and CGIJava servlets and CGI
Java servlets and CGI
lavanya marichamy
 

What's hot (18)

Jlook web ui framework
Jlook web ui frameworkJlook web ui framework
Jlook web ui framework
 
Open Social Summit Korea
Open Social Summit KoreaOpen Social Summit Korea
Open Social Summit Korea
 
Advanced Fluid
Advanced FluidAdvanced Fluid
Advanced Fluid
 
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
[DSBW Spring 2009] Unit 02: Web Technologies (2/2)
 
<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress<Head> Presentation: Plugging Into Wordpress
<Head> Presentation: Plugging Into Wordpress
 
Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1
 
Doing more with LESS
Doing more with LESSDoing more with LESS
Doing more with LESS
 
Extreme Web Productivity with Spring Roo
Extreme Web Productivity with Spring RooExtreme Web Productivity with Spring Roo
Extreme Web Productivity with Spring Roo
 
Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2
 
Web Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaosWeb Frontend development: tools and good practices to (re)organize the chaos
Web Frontend development: tools and good practices to (re)organize the chaos
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
 
BPMS1
BPMS1BPMS1
BPMS1
 
Java presentation
Java presentationJava presentation
Java presentation
 
Ugo Cei Presentation
Ugo Cei PresentationUgo Cei Presentation
Ugo Cei Presentation
 
WordPress Structure and Best Practices
WordPress Structure and Best PracticesWordPress Structure and Best Practices
WordPress Structure and Best Practices
 
浜松Rails3道場 其の弐 Model編
浜松Rails3道場 其の弐 Model編 浜松Rails3道場 其の弐 Model編
浜松Rails3道場 其の弐 Model編
 
JSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph PicklJSUG - Spring by Christoph Pickl
JSUG - Spring by Christoph Pickl
 
Java servlets and CGI
Java servlets and CGIJava servlets and CGI
Java servlets and CGI
 

Viewers also liked

The standard resistor colour code chart
The standard resistor colour code chartThe standard resistor colour code chart
The standard resistor colour code chartSaint Columban College
 
03 resistors and color code
03 resistors and color code03 resistors and color code
03 resistors and color codeMegan Dilworth
 
ofdm applications
ofdm applicationsofdm applications
ofdm applicationsbelal park
 
Resistor Color Coding
Resistor Color CodingResistor Color Coding
Resistor Color CodingRey Arthur
 
Resistor Color Code
Resistor Color CodeResistor Color Code
Resistor Color Coderahman84
 
Resistor color coding
Resistor color codingResistor color coding
Resistor color coding
Geossip Arnido
 

Viewers also liked (6)

The standard resistor colour code chart
The standard resistor colour code chartThe standard resistor colour code chart
The standard resistor colour code chart
 
03 resistors and color code
03 resistors and color code03 resistors and color code
03 resistors and color code
 
ofdm applications
ofdm applicationsofdm applications
ofdm applications
 
Resistor Color Coding
Resistor Color CodingResistor Color Coding
Resistor Color Coding
 
Resistor Color Code
Resistor Color CodeResistor Color Code
Resistor Color Code
 
Resistor color coding
Resistor color codingResistor color coding
Resistor color coding
 

Similar to Optaros Surf Code Camp Lab 4

Optaros Surf Code Camp Walkthrough 1
Optaros Surf Code Camp Walkthrough 1Optaros Surf Code Camp Walkthrough 1
Optaros Surf Code Camp Walkthrough 1
Jeff Potts
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Applicationelliando dias
 
Spring Surf 101
Spring Surf 101Spring Surf 101
Spring Surf 101
Alfresco Software
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website Optimization
Gerard Sychay
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
goodfriday
 
Mobile library on drupal cil2011
Mobile library on drupal   cil2011Mobile library on drupal   cil2011
Mobile library on drupal cil2011sc20866
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf Platform
Alfresco Software
 
Optaros Surf Code Camp Lab 1
Optaros Surf Code Camp Lab 1Optaros Surf Code Camp Lab 1
Optaros Surf Code Camp Lab 1
Jeff Potts
 
EPiServer Web Parts
EPiServer Web PartsEPiServer Web Parts
EPiServer Web Parts
EPiServer Meetup Oslo
 
Struts Portlet
Struts PortletStruts Portlet
Struts Portlet
Saikrishna Basetti
 
Flex_rest_optimization
Flex_rest_optimizationFlex_rest_optimization
Flex_rest_optimization
Khou Suylong
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog Sample
Skills Matter
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009marpierc
 
Running PHP on a Java container
Running PHP on a Java containerRunning PHP on a Java container
Running PHP on a Java container
netinhoteixeira
 
HTML5
HTML5HTML5

Similar to Optaros Surf Code Camp Lab 4 (20)

Optaros Surf Code Camp Walkthrough 1
Optaros Surf Code Camp Walkthrough 1Optaros Surf Code Camp Walkthrough 1
Optaros Surf Code Camp Walkthrough 1
 
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts ApplicationStep by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
 
Spring Surf 101
Spring Surf 101Spring Surf 101
Spring Surf 101
 
New Browsers
New BrowsersNew Browsers
New Browsers
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website Optimization
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
 
Mobile library on drupal cil2011
Mobile library on drupal   cil2011Mobile library on drupal   cil2011
Mobile library on drupal cil2011
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf Platform
 
Optaros Surf Code Camp Lab 1
Optaros Surf Code Camp Lab 1Optaros Surf Code Camp Lab 1
Optaros Surf Code Camp Lab 1
 
EPiServer Web Parts
EPiServer Web PartsEPiServer Web Parts
EPiServer Web Parts
 
Html5
Html5Html5
Html5
 
T5 Oli Aro
T5 Oli AroT5 Oli Aro
T5 Oli Aro
 
Struts Portlet
Struts PortletStruts Portlet
Struts Portlet
 
Flex_rest_optimization
Flex_rest_optimizationFlex_rest_optimization
Flex_rest_optimization
 
Apache Aries Blog Sample
Apache Aries Blog SampleApache Aries Blog Sample
Apache Aries Blog Sample
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
 
Running PHP on a Java container
Running PHP on a Java containerRunning PHP on a Java container
Running PHP on a Java container
 
HTML5
HTML5HTML5
HTML5
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
 
Servlet30 20081218
Servlet30 20081218Servlet30 20081218
Servlet30 20081218
 

More from Jeff Potts

No Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with AnsibleNo Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with Ansible
Jeff Potts
 
Moving From Actions & Behaviors to Microservices
Moving From Actions & Behaviors to MicroservicesMoving From Actions & Behaviors to Microservices
Moving From Actions & Behaviors to Microservices
Jeff Potts
 
Flexible Permissions Management with ACL Templates
Flexible Permissions Management with ACL TemplatesFlexible Permissions Management with ACL Templates
Flexible Permissions Management with ACL Templates
Jeff Potts
 
Moving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco RepositoryMoving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco Repository
Jeff Potts
 
Could Alfresco Survive a Zombie Attack?
Could Alfresco Survive a Zombie Attack?Could Alfresco Survive a Zombie Attack?
Could Alfresco Survive a Zombie Attack?
Jeff Potts
 
Connecting Content Management Apps with CMIS
Connecting Content Management Apps with CMISConnecting Content Management Apps with CMIS
Connecting Content Management Apps with CMIS
Jeff Potts
 
The Challenges of Keeping Bees
The Challenges of Keeping BeesThe Challenges of Keeping Bees
The Challenges of Keeping Bees
Jeff Potts
 
Getting Started With CMIS
Getting Started With CMISGetting Started With CMIS
Getting Started With CMIS
Jeff Potts
 
Alfresco: What every developer should know
Alfresco: What every developer should knowAlfresco: What every developer should know
Alfresco: What every developer should know
Jeff Potts
 
CMIS: An Open API for Managing Content
CMIS: An Open API for Managing ContentCMIS: An Open API for Managing Content
CMIS: An Open API for Managing Content
Jeff Potts
 
Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...
Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...
Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...
Jeff Potts
 
Alfresco: The Story of How Open Source Disrupted the ECM Market
Alfresco: The Story of How Open Source Disrupted the ECM MarketAlfresco: The Story of How Open Source Disrupted the ECM Market
Alfresco: The Story of How Open Source Disrupted the ECM Market
Jeff Potts
 
Join the Alfresco community
Join the Alfresco communityJoin the Alfresco community
Join the Alfresco community
Jeff Potts
 
Intro to the Alfresco Public API
Intro to the Alfresco Public APIIntro to the Alfresco Public API
Intro to the Alfresco Public API
Jeff Potts
 
Apache Chemistry in Action
Apache Chemistry in ActionApache Chemistry in Action
Apache Chemistry in Action
Jeff Potts
 
Building Content-Rich Java Apps in the Cloud with the Alfresco API
Building Content-Rich Java Apps in the Cloud with the Alfresco APIBuilding Content-Rich Java Apps in the Cloud with the Alfresco API
Building Content-Rich Java Apps in the Cloud with the Alfresco API
Jeff Potts
 
Alfresco Community Survey 2012 Results
Alfresco Community Survey 2012 ResultsAlfresco Community Survey 2012 Results
Alfresco Community Survey 2012 ResultsJeff Potts
 
Getting Started with CMIS
Getting Started with CMISGetting Started with CMIS
Getting Started with CMIS
Jeff Potts
 
Relational Won't Cut It: Architecting Content Centric Apps
Relational Won't Cut It: Architecting Content Centric AppsRelational Won't Cut It: Architecting Content Centric Apps
Relational Won't Cut It: Architecting Content Centric Apps
Jeff Potts
 
Alfresco SAUG: State of ECM
Alfresco SAUG: State of ECMAlfresco SAUG: State of ECM
Alfresco SAUG: State of ECM
Jeff Potts
 

More from Jeff Potts (20)

No Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with AnsibleNo Docker? No Problem: Automating installation and config with Ansible
No Docker? No Problem: Automating installation and config with Ansible
 
Moving From Actions & Behaviors to Microservices
Moving From Actions & Behaviors to MicroservicesMoving From Actions & Behaviors to Microservices
Moving From Actions & Behaviors to Microservices
 
Flexible Permissions Management with ACL Templates
Flexible Permissions Management with ACL TemplatesFlexible Permissions Management with ACL Templates
Flexible Permissions Management with ACL Templates
 
Moving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco RepositoryMoving Gigantic Files Into and Out of the Alfresco Repository
Moving Gigantic Files Into and Out of the Alfresco Repository
 
Could Alfresco Survive a Zombie Attack?
Could Alfresco Survive a Zombie Attack?Could Alfresco Survive a Zombie Attack?
Could Alfresco Survive a Zombie Attack?
 
Connecting Content Management Apps with CMIS
Connecting Content Management Apps with CMISConnecting Content Management Apps with CMIS
Connecting Content Management Apps with CMIS
 
The Challenges of Keeping Bees
The Challenges of Keeping BeesThe Challenges of Keeping Bees
The Challenges of Keeping Bees
 
Getting Started With CMIS
Getting Started With CMISGetting Started With CMIS
Getting Started With CMIS
 
Alfresco: What every developer should know
Alfresco: What every developer should knowAlfresco: What every developer should know
Alfresco: What every developer should know
 
CMIS: An Open API for Managing Content
CMIS: An Open API for Managing ContentCMIS: An Open API for Managing Content
CMIS: An Open API for Managing Content
 
Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...
Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...
Apache Chemistry in Action: Using CMIS and your favorite language to unlock c...
 
Alfresco: The Story of How Open Source Disrupted the ECM Market
Alfresco: The Story of How Open Source Disrupted the ECM MarketAlfresco: The Story of How Open Source Disrupted the ECM Market
Alfresco: The Story of How Open Source Disrupted the ECM Market
 
Join the Alfresco community
Join the Alfresco communityJoin the Alfresco community
Join the Alfresco community
 
Intro to the Alfresco Public API
Intro to the Alfresco Public APIIntro to the Alfresco Public API
Intro to the Alfresco Public API
 
Apache Chemistry in Action
Apache Chemistry in ActionApache Chemistry in Action
Apache Chemistry in Action
 
Building Content-Rich Java Apps in the Cloud with the Alfresco API
Building Content-Rich Java Apps in the Cloud with the Alfresco APIBuilding Content-Rich Java Apps in the Cloud with the Alfresco API
Building Content-Rich Java Apps in the Cloud with the Alfresco API
 
Alfresco Community Survey 2012 Results
Alfresco Community Survey 2012 ResultsAlfresco Community Survey 2012 Results
Alfresco Community Survey 2012 Results
 
Getting Started with CMIS
Getting Started with CMISGetting Started with CMIS
Getting Started with CMIS
 
Relational Won't Cut It: Architecting Content Centric Apps
Relational Won't Cut It: Architecting Content Centric AppsRelational Won't Cut It: Architecting Content Centric Apps
Relational Won't Cut It: Architecting Content Centric Apps
 
Alfresco SAUG: State of ECM
Alfresco SAUG: State of ECMAlfresco SAUG: State of ECM
Alfresco SAUG: State of ECM
 

Recently uploaded

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
UiPathCommunity
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
Alex Pruden
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
Vlad Stirbu
 

Recently uploaded (20)

Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..UiPath Community Day Dubai: AI at Work..
UiPath Community Day Dubai: AI at Work..
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex ProofszkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
zkStudyClub - Reef: Fast Succinct Non-Interactive Zero-Knowledge Regex Proofs
 
Quantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIsQuantum Computing: Current Landscape and the Future Role of APIs
Quantum Computing: Current Landscape and the Future Role of APIs
 

Optaros Surf Code Camp Lab 4

  • 1. Alfresco Surf Code Camp Lab 4: Content associations and CMIS
  • 2. 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
  • 3. 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
  • 4. 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
  • 5. Update the FolderList Component folderlist.get.js <import resource=quot;classpath:alfresco/site-webscripts/age/feed.utils.jsquot;> var path = quot;/Company%20Homequot;; // load the feel var connector = remote.connect(quot;alfrescoquot;); var feed = connector.get(quot;/api/path/workspace/SpacesStorequot; + path + quot;/childrenquot;); // 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[quot;titlequot;] = entry.*::title.toString(); item[quot;iconquot;] = entry.*::icon.toString(); item[“id”] = null; // TODO item[“url”] = null; // TODO items.push(item); } model.items = items; 07/11/08 5
  • 6. 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
  • 7. Update the FolderList Component folderlist.get.html.ftl • /WEB-INF/classes/alfresco/site-webscripts/age <div> <div class=quot;titlequot;>${msg(quot;folderlist.namequot;)}</div> <div class=quot;bodyquot;> <h2>${title}</h2> <ul> <#list items as item> <li> <a href=quot;TODOquot;> <img src=quot;${item.icon}quot;/>&nbsp;${item.title} </a> </li> </#list> </ul> </div> </div> 07/11/08 7
  • 8. Update the FolderList Component TODO Insert value of url from model ● Syntax: ${variableName} or ${object.variableName} ● 07/11/08 8
  • 9. 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
  • 11. 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=quot;1.0quot; encoding=quot;UTF-8quot;?> <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
  • 12. 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=quot;1.0quot; encoding=quot;UTF-8quot;?> <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
  • 13. Add Content Details Page Add the ‘content-details’ page Re-uses the ‘tools’ template content-details.xml • /WEB-INF/classes/alfresco/site-data/pages <?xml version='1.0' encoding='UTF-8'?> <page> <title>Content Details</title> <template-instance>tools</template-instance> <authentication>user</authentication> </page> 07/11/08 13
  • 14. Tools Template navigation  template scope left content page scope page scope footer  global scope 07/11/08 14
  • 15. 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
  • 16. 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
  • 17. Add a CMIS Browser Component browser.get.desc.xml <webscript> <shortname>Content Browser</shortname> <description>Content Browser</description> <url>/age/content/browser</url> </webscript> 07/11/08 17
  • 18. Add a CMIS Browser Component browser.get.properties contentbrowser.name = Content Browser 07/11/08 18
  • 19. Add a CMIS Browser Component browser.get.js <import resource=quot;classpath:alfresco/site-webscripts/age/feed.utils.jsquot;> // determine the path var path = content.properties[quot;displayPathquot;] + quot;/quot; + content.properties[quot;namequot;]; path = path.replace( new RegExp(quot; quot;,quot;gquot;), quot;%20quot; ); // retrieve the feed var connector = remote.connect(quot;alfrescoquot;); var feed = connector.get(quot;/api/path/workspace/SpacesStorequot; + path + quot;/childrenquot;); var xml = loadFeed(feed); // set up model model.title = xml.*::title.toString(); var items = new Array(); for each (entry in xml.*::entry) { var item = { }; item[quot;titlequot;] = entry.*::title.toString(); item[quot;iconquot;] = entry.*::icon.toString(); item[quot;idquot;] = entry.*::id.toString().substring(9); item[quot;nodeRefquot;] = quot;workspace://SpacesStore/quot; + item[quot;idquot;]; item[quot;urlquot;] = context.linkBuilder.object(item[quot;nodeRefquot;]); items.push(item); } model.items = items; 07/11/08 19
  • 20. Add a CMIS Browser Component browser.get.html.ftl <div> <div class=quot;titlequot;>${msg(quot;contentbrowser.namequot;)}</div> <div class=quot;bodyquot;> <h2>${title}</h2> <ul> <#list items as item> <li> <a href=quot;${item.url}quot;> <img src=quot;${item.icon}quot;/>&nbsp;${item.title} </a> </li> </#list> </ul> </div> </div> 07/11/08 20
  • 21. 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
  • 22. Add a CMIS Details Component details.get.desc.xml <webscript> <shortname>Content Details</shortname> <description>Content Details</description> <url>/age/content/details</url> </webscript> 07/11/08 22
  • 23. Add a CMIS Details Component details.get.js if(context.content != null) { model.properties = context.content.properties; // TODO model.title = null; model.description = null; model.mimetype = null; model.id = null; model.downloadUrl = null; } 07/11/08 23
  • 24. 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 + quot;/proxy/alfresco/api/node/content/workspace/SpacesStore/quot; + model.id; 07/11/08 24
  • 25. 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
  • 26. Add a CMIS Details Component details.get.head.ftl <style type=quot;text/cssquot;> .doc-header { font-size: 14px; font-family: Verdana; font-weight: bold; color: gray; padding: 4px; } A.doc { text-decoration: none; } </style> 07/11/08 26
  • 27. Add a CMIS Details Component details.get.html.ftl <#if content?exists> <h2 class=quot;doc-headerquot;>${title} <i>(${mimetype})</i></h2> ${description} <br/><br/> <#if downloadUrl?exists> <a href=quot;${downloadUrl}quot;>Download</a> </#if> <br/><br/> <h2>Properties</h2> <br/> <table> <#list properties?keys as propertyKey> <#assign propertyValue = properties[propertyKey]> <tr> <td> ${propertyKey}<br/> ${propertyValue?string} </td> </tr> </#list> </table> <#else> No Content Selected </#if> 07/11/08 27
  • 28. Bind in Content Browser component Add a left-side content browser component page.left.content-details.xml • /WEB-INF/classes/alfresco/site-data/components <?xml version='1.0' encoding='UTF-8'?> <component> <scope>page</scope> <region-id>left</region-id> <source-id>content-details</source-id> <url>/age/content/browser</url> </component> 07/11/08 28
  • 29. Bind in Content Details Component Add a centered content details component page.content.content-details.xml • /WEB-INF/classes/alfresco/site-data/components <?xml version='1.0' encoding='UTF-8'?> <component> <scope>page</scope> <region-id>content</region-id> <source-id>content-details</source-id> <url>/age/content/details</url> </component> 07/11/08 29
  • 30. 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
  • 33. 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