SlideShare a Scribd company logo
1 of 15
Download to read offline
Alfresco Surf Code Camp
Walkthrough: Creating a Simple Surf Site
Objectives

             Configure Web Framework
             Set up a new site
             Drop in assets
             Add a home page
             Bind a component to the page




12/01/09                                    2
Sample Site

             We will use alfwf.war as a starting point
              • Blank Surf framework with no site construction data in it
              • Built from source; “web-framework” project
             Extract as webapp into standalone Tomcat
             Sample location:
              • /opt/tomcat/webapps/alfwf
              • http://localhost:8580/alfwf




12/01/09                                                                    3
Web Framework Configuration

             Configure Surf to use your site configuration file
             web-framework-config-custom.xml
              • /WEB-INF/classes/alfresco/web-extension
              • Check web-framework-application-context.xml to be sure

             Create the web-extension directory
             In that directory, create web-framework-config-
             custom.xml with:
              <alfresco-config>

                 <config evaluator=quot;string-comparequot; condition=quot;WebFrameworkquot;>
                    <web-framework>
                       <application-defaults>
                           <site-configuration>sample.site.configuration</site-configuration>
                       </application-defaults>
                    </web-framework>
                 </config>

              </alfresco-config>



12/01/09                                                                                   4
Set up a new site

             Add a site configuration object
             Convention
              • Configuration for sample site
              • /WEB-INF/classes/alfresco/site-
                data/configurations/sample.site.configuration.xml

             Points to a default root page: home


             Create sample.site.configuration.xml
              • /WEB-INF/classes/alfresco/site-data/configurations
               <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?>
               <configuration>
                 <title>Surf Sample Site</title>
                 <description>Surf Sample Site</description>
                 <source-id>site</source-id>
                 <properties>
                   <root-page>home</root-page>
                 </properties>
               </configuration>



12/01/09                                                             5
Drop in assets

             Unzip the assets.zip file into the web application
              • /opt/tomcat/webapps/alfwf/EXTRACT HERE
             Manifest:
              • /images/walkthrough/farman.jpg




12/01/09                                                          6
Add a home page

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



             The home page must know how to render
                  Use template instance: home
              ●




12/01/09                                                           7
Add a home page

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

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




             The template instance needs a renderer
              • The FreeMarker renderer:      /walkthrough/home.ftl




12/01/09                                                                 8
Add a home page

             Add the FreeMarker template
             home.ftl
              • /WEB-INF/classes/alfresco/templates/walkthrough
               <html xmlns=quot;http://www.w3.org/1999/xhtmlquot;>
                  <head>
                     <title>${page.title}</title>
                     ${head}
                  </head>
                  <body>
                     This is the home page
                     <br/>
                     <br/>
                     <@region id=quot;contentquot; scope=quot;pagequot; />
                  </body>
               </html>


             Defines a region called content in the page scope




12/01/09                                                          9
Bind a component to the page

             Bind a component into the home page
              • Region name is content and scope is page
              • File name convention: <scope>.<regionId>.<sourceId>.xml
             page.content.home.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>home</source-id>
                   <url>/blocks/image</url>
                   <properties>
                      <src>${url.context}/images/walkthrough/farman.jpg</src>
                   </properties>
                </component>




             The blocks/image web script needs to be defined



12/01/09                                                                        10
Bind a component to the page

             Image Component
              • Provided to you in blocks-image.zip
              • May become part of Surf at some point
              • Web Script Component
              • URL: /blocks/image
              • Extract blocks-image.zip to WEB-INF/classes/alfresco/site-
                webscripts




12/01/09                                                                     11
Image.get Script (Built In)‫‏‬
           Image Web Script

            site-webscripts/blocks/image.get.desc.xml
             <webscript>
               <shortname>Image - Web Component</shortname>
               <description>Image - Web Component</description>
               <url>/blocks/image</url>
             </webscript>



            site-webscripts/blocks/image.get.js
             var src = instance.properties[quot;srcquot;];
             if(src == null)‫‏‬
             {
                  src = quot;/quot;;
             }
             src = src.replace('${url.context}', url.context);
             model.src = src;



            site-webscripts/blocks/image.get.html.ftl
             <#assign titleString = quot;quot;>
             <#if title?exists>
                  <#assign titleString = quot;title='quot; + title + quot;' quot;>
             </#if>
             <img src=quot;${src}quot; border=quot;0quot; ${titleString} />
12/01/09                                                                   12
Review
           Review

            Create Site - Basic Configuration
             • web-extension/web-framework-config-custom.xml
             • site-data/configurations/sample.site.configuration.xml
                 – Points to root page home

            Define Page Template (Layout)‫‏‬
             • Page - site-data/pages/home.xml
                 – Points to template-instance home
             • Temlate-Instance - site-data/template-instances/home.xml
                 – Points to freemarker template /walkthrough/home (ftl)‫‏‬
             • Template HTML - templates/walkthrough/home.ftl
                 – Defines region Content, scope page

            Populate Layout
             • site-data/components/page.content.home.xml (note convention)‫‏‬
             • Points to /blocks/image web script
             • site-webscripts/blocks/image.get.js
12/01/09                                                                       13
Try it out

             Start Alfresco
              • http://labs3c:8080/alfresco

             Start Surf Tomcat (Restart if it was running)‫‏‬
              • 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/page

             If you want the URL to work without “/page” use the
             index.jsp provided to do a redirect




12/01/09                                                           14
Wrap-up

                 In this walkthrough, you...
                     • Configured a fresh Surf framework (alfwf.war)‫‏‬
                     • Created a page
                     • Created a template instance
                     • Pointed the template instance to a FreeMarker template
                     • Created a component binding that pointed to an Image
                       component
                               – The component was bound to a region on the template
                     • Added an Image component implemented as a web script




12/01/09   Optaros and Client confidential. All rights reserved.                       15

More Related Content

What's hot

Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)
Joao Lucas Santana
 
HTML5 Who what where when why how
HTML5 Who what where when why howHTML5 Who what where when why how
HTML5 Who what where when why how
brucelawson
 
2012 03 27_philly_jug_rewrite_static
2012 03 27_philly_jug_rewrite_static2012 03 27_philly_jug_rewrite_static
2012 03 27_philly_jug_rewrite_static
Lincoln III
 
HTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranHTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - Altran
Robert Nyman
 
Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2
Byrne Reese
 

What's hot (20)

Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyConsegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
 
Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)Desenvolvimento web com Ruby on Rails (parte 2)
Desenvolvimento web com Ruby on Rails (parte 2)
 
T5 Oli Aro
T5 Oli AroT5 Oli Aro
T5 Oli Aro
 
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
PrettyFaces: SEO, Dynamic, Parameters, Bookmarks, Navigation for JSF / JSF2 (...
 
Doing Things the WordPress Way
Doing Things the WordPress WayDoing Things the WordPress Way
Doing Things the WordPress Way
 
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJRealize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
Realize mais com HTML 5 e CSS 3 - 16 EDTED - RJ
 
Beautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFacesBeautiful Java EE - PrettyFaces
Beautiful Java EE - PrettyFaces
 
HTML5 Who what where when why how
HTML5 Who what where when why howHTML5 Who what where when why how
HTML5 Who what where when why how
 
HTML5 and Accessibility sitting in a tree
HTML5 and Accessibility sitting in a treeHTML5 and Accessibility sitting in a tree
HTML5 and Accessibility sitting in a tree
 
2012 03 27_philly_jug_rewrite_static
2012 03 27_philly_jug_rewrite_static2012 03 27_philly_jug_rewrite_static
2012 03 27_philly_jug_rewrite_static
 
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
You too can be a bedwetting antfucker: Bruce Lawson, Opera, Fronteers 2011
 
HTML5 workshop, part 1
HTML5 workshop, part 1HTML5 workshop, part 1
HTML5 workshop, part 1
 
HTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - AltranHTML5, The Open Web, and what it means for you - Altran
HTML5, The Open Web, and what it means for you - Altran
 
Taking your Web App for a walk
Taking your Web App for a walkTaking your Web App for a walk
Taking your Web App for a walk
 
More Than You Ever Wanted to Know About Resource Hints - Harry Roberts (CSS W...
More Than You Ever Wanted to Know About Resource Hints - Harry Roberts (CSS W...More Than You Ever Wanted to Know About Resource Hints - Harry Roberts (CSS W...
More Than You Ever Wanted to Know About Resource Hints - Harry Roberts (CSS W...
 
HTML5 JS APIs
HTML5 JS APIsHTML5 JS APIs
HTML5 JS APIs
 
So you want to build a Facebook app
So you want to build a Facebook appSo you want to build a Facebook app
So you want to build a Facebook app
 
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and GulpOptimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
Optimising Your Front End Workflow With Symfony, Twig, Bower and Gulp
 
Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1Hacking Movable Type Training - Day 1
Hacking Movable Type Training - Day 1
 
Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2Hacking Movable Type Training - Day 2
Hacking Movable Type Training - Day 2
 

Similar to 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
elliando dias
 
Aspnet2 Overview
Aspnet2 OverviewAspnet2 Overview
Aspnet2 Overview
ajitbergi
 
Mobile library on drupal cil2011
Mobile library on drupal   cil2011Mobile library on drupal   cil2011
Mobile library on drupal cil2011
sc20866
 

Similar to Optaros Surf Code Camp Walkthrough 1 (20)

Optaros Surf Code Camp Walkthrough 2
Optaros Surf Code Camp Walkthrough 2Optaros Surf Code Camp Walkthrough 2
Optaros Surf Code Camp Walkthrough 2
 
Optaros Surf Code Camp Lab 1
Optaros Surf Code Camp Lab 1Optaros Surf Code Camp Lab 1
Optaros Surf Code Camp Lab 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
 
EPiServer Web Parts
EPiServer Web PartsEPiServer Web Parts
EPiServer Web Parts
 
Real-World AJAX with ASP.NET
Real-World AJAX with ASP.NETReal-World AJAX with ASP.NET
Real-World AJAX with ASP.NET
 
Front End Website Optimization
Front End Website OptimizationFront End Website Optimization
Front End Website Optimization
 
Aspnet2 Overview
Aspnet2 OverviewAspnet2 Overview
Aspnet2 Overview
 
Spring Surf 101
Spring Surf 101Spring Surf 101
Spring Surf 101
 
IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009
 
Aleph500 How we made it our own
Aleph500 How we made it our ownAleph500 How we made it our own
Aleph500 How we made it our own
 
Mobile library on drupal cil2011
Mobile library on drupal   cil2011Mobile library on drupal   cil2011
Mobile library on drupal cil2011
 
Fast by Default
Fast by DefaultFast by Default
Fast by Default
 
Introduction to Alfresco Surf Platform
Introduction to Alfresco Surf PlatformIntroduction to Alfresco Surf Platform
Introduction to Alfresco Surf Platform
 
Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09Even Faster Web Sites at jQuery Conference '09
Even Faster Web Sites at jQuery Conference '09
 
สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1สปริงเฟรมเวิร์ค4.1
สปริงเฟรมเวิร์ค4.1
 
Ant
Ant Ant
Ant
 
Apache Roller, Acegi Security and Single Sign-on
Apache Roller, Acegi Security and Single Sign-onApache Roller, Acegi Security and Single Sign-on
Apache Roller, Acegi Security and Single Sign-on
 
Generic Setup De-Mystified
Generic Setup De-MystifiedGeneric Setup De-Mystified
Generic Setup De-Mystified
 
A Holistic View of Website Performance
A Holistic View of Website PerformanceA Holistic View of Website Performance
A Holistic View of Website Performance
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 

More from Jeff Potts

Alfresco Community Survey 2012 Results
Alfresco Community Survey 2012 ResultsAlfresco Community Survey 2012 Results
Alfresco Community Survey 2012 Results
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

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
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
Earley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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?
 
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
 
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
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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...
 
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...
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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
 

Optaros Surf Code Camp Walkthrough 1

  • 1. Alfresco Surf Code Camp Walkthrough: Creating a Simple Surf Site
  • 2. Objectives Configure Web Framework Set up a new site Drop in assets Add a home page Bind a component to the page 12/01/09 2
  • 3. Sample Site We will use alfwf.war as a starting point • Blank Surf framework with no site construction data in it • Built from source; “web-framework” project Extract as webapp into standalone Tomcat Sample location: • /opt/tomcat/webapps/alfwf • http://localhost:8580/alfwf 12/01/09 3
  • 4. Web Framework Configuration Configure Surf to use your site configuration file web-framework-config-custom.xml • /WEB-INF/classes/alfresco/web-extension • Check web-framework-application-context.xml to be sure Create the web-extension directory In that directory, create web-framework-config- custom.xml with: <alfresco-config> <config evaluator=quot;string-comparequot; condition=quot;WebFrameworkquot;> <web-framework> <application-defaults> <site-configuration>sample.site.configuration</site-configuration> </application-defaults> </web-framework> </config> </alfresco-config> 12/01/09 4
  • 5. Set up a new site Add a site configuration object Convention • Configuration for sample site • /WEB-INF/classes/alfresco/site- data/configurations/sample.site.configuration.xml Points to a default root page: home Create sample.site.configuration.xml • /WEB-INF/classes/alfresco/site-data/configurations <?xml version=quot;1.0quot; encoding=quot;UTF-8quot;?> <configuration> <title>Surf Sample Site</title> <description>Surf Sample Site</description> <source-id>site</source-id> <properties> <root-page>home</root-page> </properties> </configuration> 12/01/09 5
  • 6. Drop in assets Unzip the assets.zip file into the web application • /opt/tomcat/webapps/alfwf/EXTRACT HERE Manifest: • /images/walkthrough/farman.jpg 12/01/09 6
  • 7. Add a home page Add a home page Points to a rendering template: home home.xml • /WEB-INF/classes/alfresco/site-data/pages <?xml version='1.0' encoding='UTF-8'?> <page> <title>Home Page</title> <template-instance>home</template-instance> <authentication>none</authentication> </page> The home page must know how to render Use template instance: home ● 12/01/09 7
  • 8. Add a home page Add a home template instance Points to a FreeMarker file: /walkthrough/home home.xml • /WEB-INF/classes/alfresco/site-data/template-instances <?xml version='1.0' encoding='UTF-8'?> <template-instance> <template-type>/walkthrough/home</template-type> </template-instance> The template instance needs a renderer • The FreeMarker renderer: /walkthrough/home.ftl 12/01/09 8
  • 9. Add a home page Add the FreeMarker template home.ftl • /WEB-INF/classes/alfresco/templates/walkthrough <html xmlns=quot;http://www.w3.org/1999/xhtmlquot;> <head> <title>${page.title}</title> ${head} </head> <body> This is the home page <br/> <br/> <@region id=quot;contentquot; scope=quot;pagequot; /> </body> </html> Defines a region called content in the page scope 12/01/09 9
  • 10. Bind a component to the page Bind a component into the home page • Region name is content and scope is page • File name convention: <scope>.<regionId>.<sourceId>.xml page.content.home.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>home</source-id> <url>/blocks/image</url> <properties> <src>${url.context}/images/walkthrough/farman.jpg</src> </properties> </component> The blocks/image web script needs to be defined 12/01/09 10
  • 11. Bind a component to the page Image Component • Provided to you in blocks-image.zip • May become part of Surf at some point • Web Script Component • URL: /blocks/image • Extract blocks-image.zip to WEB-INF/classes/alfresco/site- webscripts 12/01/09 11
  • 12. Image.get Script (Built In)‫‏‬ Image Web Script site-webscripts/blocks/image.get.desc.xml <webscript> <shortname>Image - Web Component</shortname> <description>Image - Web Component</description> <url>/blocks/image</url> </webscript> site-webscripts/blocks/image.get.js var src = instance.properties[quot;srcquot;]; if(src == null)‫‏‬ { src = quot;/quot;; } src = src.replace('${url.context}', url.context); model.src = src; site-webscripts/blocks/image.get.html.ftl <#assign titleString = quot;quot;> <#if title?exists> <#assign titleString = quot;title='quot; + title + quot;' quot;> </#if> <img src=quot;${src}quot; border=quot;0quot; ${titleString} /> 12/01/09 12
  • 13. Review Review Create Site - Basic Configuration • web-extension/web-framework-config-custom.xml • site-data/configurations/sample.site.configuration.xml – Points to root page home Define Page Template (Layout)‫‏‬ • Page - site-data/pages/home.xml – Points to template-instance home • Temlate-Instance - site-data/template-instances/home.xml – Points to freemarker template /walkthrough/home (ftl)‫‏‬ • Template HTML - templates/walkthrough/home.ftl – Defines region Content, scope page Populate Layout • site-data/components/page.content.home.xml (note convention)‫‏‬ • Points to /blocks/image web script • site-webscripts/blocks/image.get.js 12/01/09 13
  • 14. Try it out Start Alfresco • http://labs3c:8080/alfresco Start Surf Tomcat (Restart if it was running)‫‏‬ • 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/page If you want the URL to work without “/page” use the index.jsp provided to do a redirect 12/01/09 14
  • 15. Wrap-up In this walkthrough, you... • Configured a fresh Surf framework (alfwf.war)‫‏‬ • Created a page • Created a template instance • Pointed the template instance to a FreeMarker template • Created a component binding that pointed to an Image component – The component was bound to a region on the template • Added an Image component implemented as a web script 12/01/09 Optaros and Client confidential. All rights reserved. 15