SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
Alfresco Surf Code Camp
Walkthrough 2: Adding CMIS to Green Energy
Objectives

             Place additional functionality into Green Energy Site
             Get exposed to CMIS by adding a component that lists
             the contents of a folder
             Use E4X to parse XML in JavaScript




07/11/08                                                             2
Green Energy

             We will extend the Green Energy site you started in
             Lab #3
             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
Drop in assets

             Unzip the assets.zip file into the web application
             Manifest:
              • /images/age/folder.png
              • /images/age/page.png
              • /WEB-INF/classes/alfresco/templates/age/tools.ftl
              • /WEB-INF/classes/alfresco/site-webscripts/age/feed-util.js




07/11/08                                                                     5
Add a tools page

             Add a tools page
             Points to a rendering template: tools
             tools.xml
             /WEB-INF/classes/alfresco/site-data/pages
             <?xml version='1.0' encoding='UTF-8'?>
             <page>
                <title>Tools</title>
                <template-instance>tools</template-instance>
                <authentication>user</authentication>
             </page>


             The tools page must know how to render
              • Use template instance: tools




07/11/08                                                       6
Add a tools template instance

             Add a tools template instance
             Points to a FreeMarker file: /age/tools
             tools.xml
              • /WEB-INF/classes/alfresco/site-data/template-instances

                <?xml version='1.0' encoding='UTF-8'?>
                <template-instance>
                   <template-type>/age/tools</template-type>
                </template-instance>




             The template instance needs a renderer
              • The FreeMarker renderer:     /age/tools.ftl

              • You already unzipped this. It was in assets.zip




07/11/08                                                                 7
Tools Template




                                     navigation  template scope




                   left                         content
                page scope                     page scope




                             footer  global scope
07/11/08                                                          8
Bind in the navigation component

             Add a component binding for the navigation
             template.navigation.tools.xml
              • /WEB-INF/classes/alfresco/site-data/components
               <?xml version='1.0' encoding='UTF-8'?>
               <component>
                  <scope>template</scope>
                  <region-id>navigation</region-id>
                  <source-id>tools</source-id>
                  <url>/blocks/navigation</url>
               </component>

             Note: The footer will naturally bind as it is globally
             scoped.




07/11/08                                                              9
Add as a child of the home page

             Adds the ‘tools’ page as a child of the ‘home’ page
              • Page association
             home-tools.xml
              • /WEB-INF/classes/alfresco/site-data/page-associations

                <?xml version='1.0' encoding='UTF-8'?>
                <page-association>
                   <source-id>home</source-id>
                   <dest-id>tools</dest-id>
                   <assoc-type>child</assoc-type>
                </page-association>




07/11/08                                                                10
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                                                         11
Try it out




07/11/08                12
Add a FolderList Component

             Navigate to the site-webscripts directory
              • /WEB-INF/classes/alfresco/site-webscripts
             Create a folder called age
             Navigate into the age directory
              • /WEB-INF/classes/alfresco/site-webscripts/age
             Create a Web Script:
              • folderlist




07/11/08                                                        13
FolderList Component

             Create a web script with the following url
              • /age/folderlist
             folderlist.get.desc.xml
             <webscript>
                <shortname>Folder Listing</shortname>
                <description>Provides a list of contents under Company Home</description>
                <url>/age/folderlist</url>
             </webscript>




07/11/08                                                                                14
FolderList Component

             folderlist.get.properties
             folderlist.name = Folder Listing




07/11/08                                        15
FolderList Component

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

             // TODO: Load the feed
             var feed = null;

             // TODO: convert feed to JavaScript
             var xml = null;

             // set up the model
             model.title = xml.*::title.toString();
             var items = new Array();
             for each (entry in xml.*::entry)
             {
                  var item = { };

                      // TODO: retrieve title value
                 item[quot;titlequot;] = null;

                      // TODO: retrieve icon value
                 item[quot;iconquot;] = null;

                  items.push(item);
             }
             model.items = items;


07/11/08                                                                                16
Notes
           FolderList Component
             Loading the feed
              • Recommended API (CMIS)
              • /api/path/workspace/SpacesStore/<path>/children
              • Example: /api/path/workspace/SpacesStore/Company%20Home/children

             Convert the feed to JavaScript
              • Helper function defined in import
              • var xmlObject = loadFeed(feed);
              • <import resource=quot;classpath:alfresco/site-webscripts/age/feed.utils.jsquot;>

             Set up the model
              • Namespace aware
              • Use namespace independent way of pulling properties
              • var value = node.*::propertyName.toString();

             More info on E4X
              • http://www.ibm.com/developerworks/library/ws-ajax1/




07/11/08                                                                                   17
FolderList Component

             folderlist.get.html.ftl
             <div>
                <div class=quot;titlequot;>TODO#1</div>
                <div class=quot;bodyquot;>
                   <h2>TODO#2</h2>
                   <ul>
                   <#list items as item>
                      <li><img src=“TODO#3quot;/>&nbsp;TODO#4</li>
                   </#list>
                   </ul>
                </div>
             </div>




07/11/08                                                         18
Notes
           FolderList Component
             TODO #1
              • Insert value of folderlist.name from properties file
              • Syntax: ${msg(string)}
             TODO #2
              • Insert value of title from model
              • Syntax: ${variableName} or ${object.variableName}
             TODO #3
              • Insert value of icon from items array
              • Syntax: ${variableName} or ${object.variableName}
             TODO #4
              • Insert value of title from items array
              • Syntax: ${variableName} or ${object.variableName}




07/11/08                                                               19
Bind in the FolderList component

             Add a component binding for the FolderList
             component
             page.content.tools.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>tools</source-id>
                  <url>/age/folderlist</url>
               </component>




07/11/08                                                         20
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                                                         21
Try it out




07/11/08                22
Try it out

             Potential problem: Images not showing up
              • http://localhost:8080/alfresco/images/xyz.gif
              • http://labs3c:8580/alfresco/images/xyz.gif
              • Hack: entry.*::icon.toString().replace('localhost', 'labs3c');




07/11/08                                                                         23
Wrap-up

                 In this walkthrough, you...
                     • Added a new page called Tools
                     • Bound a new “folderlist” component to a region on the Tools page
                     • Implemented the folderlist component to use a CMIS call to
                       retrieve the folder contents of a specified path
                     • Used E4X to parse the XML that CMIS returned




07/11/08   Optaros and Client confidential. All rights reserved.                          24

Weitere ähnliche Inhalte

Was ist angesagt?

HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010Patrick Lauke
 
JSUG - Maven by Michael Greifeneder
JSUG - Maven by Michael GreifenederJSUG - Maven by Michael Greifeneder
JSUG - Maven by Michael GreifenederChristoph Pickl
 
HTML5 and friends - Institutional Web Management Workshop 2010
HTML5 and friends - Institutional Web Management Workshop 2010HTML5 and friends - Institutional Web Management Workshop 2010
HTML5 and friends - Institutional Web Management Workshop 2010Patrick Lauke
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress PluginBrad Williams
 
Html servlet example
Html   servlet exampleHtml   servlet example
Html servlet examplervpprash
 
AIR 開發應用程式實務
AIR 開發應用程式實務AIR 開發應用程式實務
AIR 開發應用程式實務angelliya00
 
Firefox OS workshop, JSFoo, India
Firefox OS workshop, JSFoo, IndiaFirefox OS workshop, JSFoo, India
Firefox OS workshop, JSFoo, IndiaRobert Nyman
 
Desmistificando o Phonegap (Cordova)
Desmistificando o Phonegap (Cordova)Desmistificando o Phonegap (Cordova)
Desmistificando o Phonegap (Cordova)Loiane Groner
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialYi-Ting Cheng
 

Was ist angesagt? (10)

HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
 
JSUG - Maven by Michael Greifeneder
JSUG - Maven by Michael GreifenederJSUG - Maven by Michael Greifeneder
JSUG - Maven by Michael Greifeneder
 
HTML5 and friends - Institutional Web Management Workshop 2010
HTML5 and friends - Institutional Web Management Workshop 2010HTML5 and friends - Institutional Web Management Workshop 2010
HTML5 and friends - Institutional Web Management Workshop 2010
 
Creating Your First WordPress Plugin
Creating Your First WordPress PluginCreating Your First WordPress Plugin
Creating Your First WordPress Plugin
 
Html servlet example
Html   servlet exampleHtml   servlet example
Html servlet example
 
Ant User Guide
Ant User GuideAnt User Guide
Ant User Guide
 
AIR 開發應用程式實務
AIR 開發應用程式實務AIR 開發應用程式實務
AIR 開發應用程式實務
 
Firefox OS workshop, JSFoo, India
Firefox OS workshop, JSFoo, IndiaFirefox OS workshop, JSFoo, India
Firefox OS workshop, JSFoo, India
 
Desmistificando o Phonegap (Cordova)
Desmistificando o Phonegap (Cordova)Desmistificando o Phonegap (Cordova)
Desmistificando o Phonegap (Cordova)
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
 

Ähnlich wie Optaros Surf Code Camp Walkthrough 2

Optaros Surf Code Camp Walkthrough 1
Optaros Surf Code Camp Walkthrough 1Optaros Surf Code Camp Walkthrough 1
Optaros Surf Code Camp Walkthrough 1Jeff 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
 
Optaros Surf Code Camp Lab 1
Optaros Surf Code Camp Lab 1Optaros Surf Code Camp Lab 1
Optaros Surf Code Camp Lab 1Jeff Potts
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NETgoodfriday
 
Running PHP on a Java container
Running PHP on a Java containerRunning PHP on a Java container
Running PHP on a Java containernetinhoteixeira
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformAlfresco Software
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website OptimizationGerard Sychay
 
An introduction to juice
An introduction to juice An introduction to juice
An introduction to juice juiceproject
 
How to learn to build your own PHP framework
How to learn to build your own PHP frameworkHow to learn to build your own PHP framework
How to learn to build your own PHP frameworkDinh Pham
 
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkHanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkNguyen Duc Phu
 
Creating Yahoo Mobile Widgets
Creating Yahoo Mobile WidgetsCreating Yahoo Mobile Widgets
Creating Yahoo Mobile WidgetsRicardo Varela
 
Terracotta Ch'ti Jug
Terracotta Ch'ti JugTerracotta Ch'ti Jug
Terracotta Ch'ti JugCh'ti JUG
 
Mobile library on drupal cil2011
Mobile library on drupal   cil2011Mobile library on drupal   cil2011
Mobile library on drupal cil2011sc20866
 

Ähnlich wie Optaros Surf Code Camp Walkthrough 2 (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
 
Optaros Surf Code Camp Lab 1
Optaros Surf Code Camp Lab 1Optaros Surf Code Camp Lab 1
Optaros Surf Code Camp Lab 1
 
Spring Surf 101
Spring Surf 101Spring Surf 101
Spring Surf 101
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
 
T5 Oli Aro
T5 Oli AroT5 Oli Aro
T5 Oli Aro
 
Struts Portlet
Struts PortletStruts Portlet
Struts Portlet
 
Running PHP on a Java container
Running PHP on a Java containerRunning PHP on a Java container
Running PHP on a Java container
 
Ext 0523
Ext 0523Ext 0523
Ext 0523
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf Platform
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website Optimization
 
New Browsers
New BrowsersNew Browsers
New Browsers
 
An introduction to juice
An introduction to juice An introduction to juice
An introduction to juice
 
How to learn to build your own PHP framework
How to learn to build your own PHP frameworkHow to learn to build your own PHP framework
How to learn to build your own PHP framework
 
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.frameworkHanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
Hanoi php day 2008 - 01.pham cong dinh - how.to.build.your.own.framework
 
Creating Yahoo Mobile Widgets
Creating Yahoo Mobile WidgetsCreating Yahoo Mobile Widgets
Creating Yahoo Mobile Widgets
 
Terracotta Ch'ti Jug
Terracotta Ch'ti JugTerracotta Ch'ti Jug
Terracotta Ch'ti Jug
 
Mobile library on drupal cil2011
Mobile library on drupal   cil2011Mobile library on drupal   cil2011
Mobile library on drupal cil2011
 
EPiServer Web Parts
EPiServer Web PartsEPiServer Web Parts
EPiServer Web Parts
 
Servlet30 20081218
Servlet30 20081218Servlet30 20081218
Servlet30 20081218
 

Mehr von 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 AnsibleJeff Potts
 
Moving From Actions & Behaviors to Microservices
Moving From Actions & Behaviors to MicroservicesMoving From Actions & Behaviors to Microservices
Moving From Actions & Behaviors to MicroservicesJeff Potts
 
Flexible Permissions Management with ACL Templates
Flexible Permissions Management with ACL TemplatesFlexible Permissions Management with ACL Templates
Flexible Permissions Management with ACL TemplatesJeff 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 RepositoryJeff 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 CMISJeff Potts
 
The Challenges of Keeping Bees
The Challenges of Keeping BeesThe Challenges of Keeping Bees
The Challenges of Keeping BeesJeff Potts
 
Getting Started With CMIS
Getting Started With CMISGetting Started With CMIS
Getting Started With CMISJeff Potts
 
Alfresco: What every developer should know
Alfresco: What every developer should knowAlfresco: What every developer should know
Alfresco: What every developer should knowJeff 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 ContentJeff 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 MarketJeff Potts
 
Join the Alfresco community
Join the Alfresco communityJoin the Alfresco community
Join the Alfresco communityJeff Potts
 
Intro to the Alfresco Public API
Intro to the Alfresco Public APIIntro to the Alfresco Public API
Intro to the Alfresco Public APIJeff Potts
 
Apache Chemistry in Action
Apache Chemistry in ActionApache Chemistry in Action
Apache Chemistry in ActionJeff 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 APIJeff 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 CMISJeff 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 AppsJeff Potts
 
Alfresco SAUG: State of ECM
Alfresco SAUG: State of ECMAlfresco SAUG: State of ECM
Alfresco SAUG: State of ECMJeff Potts
 

Mehr von 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
 

Kürzlich hochgeladen

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Kürzlich hochgeladen (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 

Optaros Surf Code Camp Walkthrough 2

  • 1. Alfresco Surf Code Camp Walkthrough 2: Adding CMIS to Green Energy
  • 2. Objectives Place additional functionality into Green Energy Site Get exposed to CMIS by adding a component that lists the contents of a folder Use E4X to parse XML in JavaScript 07/11/08 2
  • 3. Green Energy We will extend the Green Energy site you started in Lab #3 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. Drop in assets Unzip the assets.zip file into the web application Manifest: • /images/age/folder.png • /images/age/page.png • /WEB-INF/classes/alfresco/templates/age/tools.ftl • /WEB-INF/classes/alfresco/site-webscripts/age/feed-util.js 07/11/08 5
  • 6. Add a tools page Add a tools page Points to a rendering template: tools tools.xml /WEB-INF/classes/alfresco/site-data/pages <?xml version='1.0' encoding='UTF-8'?> <page> <title>Tools</title> <template-instance>tools</template-instance> <authentication>user</authentication> </page> The tools page must know how to render • Use template instance: tools 07/11/08 6
  • 7. Add a tools template instance Add a tools template instance Points to a FreeMarker file: /age/tools tools.xml • /WEB-INF/classes/alfresco/site-data/template-instances <?xml version='1.0' encoding='UTF-8'?> <template-instance> <template-type>/age/tools</template-type> </template-instance> The template instance needs a renderer • The FreeMarker renderer: /age/tools.ftl • You already unzipped this. It was in assets.zip 07/11/08 7
  • 8. Tools Template navigation  template scope left content page scope page scope footer  global scope 07/11/08 8
  • 9. Bind in the navigation component Add a component binding for the navigation template.navigation.tools.xml • /WEB-INF/classes/alfresco/site-data/components <?xml version='1.0' encoding='UTF-8'?> <component> <scope>template</scope> <region-id>navigation</region-id> <source-id>tools</source-id> <url>/blocks/navigation</url> </component> Note: The footer will naturally bind as it is globally scoped. 07/11/08 9
  • 10. Add as a child of the home page Adds the ‘tools’ page as a child of the ‘home’ page • Page association home-tools.xml • /WEB-INF/classes/alfresco/site-data/page-associations <?xml version='1.0' encoding='UTF-8'?> <page-association> <source-id>home</source-id> <dest-id>tools</dest-id> <assoc-type>child</assoc-type> </page-association> 07/11/08 10
  • 11. 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 11
  • 13. Add a FolderList Component Navigate to the site-webscripts directory • /WEB-INF/classes/alfresco/site-webscripts Create a folder called age Navigate into the age directory • /WEB-INF/classes/alfresco/site-webscripts/age Create a Web Script: • folderlist 07/11/08 13
  • 14. FolderList Component Create a web script with the following url • /age/folderlist folderlist.get.desc.xml <webscript> <shortname>Folder Listing</shortname> <description>Provides a list of contents under Company Home</description> <url>/age/folderlist</url> </webscript> 07/11/08 14
  • 15. FolderList Component folderlist.get.properties folderlist.name = Folder Listing 07/11/08 15
  • 16. FolderList Component folderlist.get.js <import resource=quot;classpath:alfresco/site-webscripts/age/feed.utils.jsquot;> // TODO: Load the feed var feed = null; // TODO: convert feed to JavaScript var xml = null; // set up the model model.title = xml.*::title.toString(); var items = new Array(); for each (entry in xml.*::entry) { var item = { }; // TODO: retrieve title value item[quot;titlequot;] = null; // TODO: retrieve icon value item[quot;iconquot;] = null; items.push(item); } model.items = items; 07/11/08 16
  • 17. Notes FolderList Component Loading the feed • Recommended API (CMIS) • /api/path/workspace/SpacesStore/<path>/children • Example: /api/path/workspace/SpacesStore/Company%20Home/children Convert the feed to JavaScript • Helper function defined in import • var xmlObject = loadFeed(feed); • <import resource=quot;classpath:alfresco/site-webscripts/age/feed.utils.jsquot;> Set up the model • Namespace aware • Use namespace independent way of pulling properties • var value = node.*::propertyName.toString(); More info on E4X • http://www.ibm.com/developerworks/library/ws-ajax1/ 07/11/08 17
  • 18. FolderList Component folderlist.get.html.ftl <div> <div class=quot;titlequot;>TODO#1</div> <div class=quot;bodyquot;> <h2>TODO#2</h2> <ul> <#list items as item> <li><img src=“TODO#3quot;/>&nbsp;TODO#4</li> </#list> </ul> </div> </div> 07/11/08 18
  • 19. Notes FolderList Component TODO #1 • Insert value of folderlist.name from properties file • Syntax: ${msg(string)} TODO #2 • Insert value of title from model • Syntax: ${variableName} or ${object.variableName} TODO #3 • Insert value of icon from items array • Syntax: ${variableName} or ${object.variableName} TODO #4 • Insert value of title from items array • Syntax: ${variableName} or ${object.variableName} 07/11/08 19
  • 20. Bind in the FolderList component Add a component binding for the FolderList component page.content.tools.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>tools</source-id> <url>/age/folderlist</url> </component> 07/11/08 20
  • 21. 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 21
  • 23. Try it out Potential problem: Images not showing up • http://localhost:8080/alfresco/images/xyz.gif • http://labs3c:8580/alfresco/images/xyz.gif • Hack: entry.*::icon.toString().replace('localhost', 'labs3c'); 07/11/08 23
  • 24. Wrap-up In this walkthrough, you... • Added a new page called Tools • Bound a new “folderlist” component to a region on the Tools page • Implemented the folderlist component to use a CMIS call to retrieve the folder contents of a specified path • Used E4X to parse the XML that CMIS returned 07/11/08 Optaros and Client confidential. All rights reserved. 24