{"id":3996,"date":"2013-01-15T08:55:41","date_gmt":"2013-01-15T16:55:41","guid":{"rendered":"http:\/\/localhost\/exoblog\/?p=3996"},"modified":"2023-06-05T16:25:04","modified_gmt":"2023-06-05T14:25:04","slug":"exo-add-ons-creating-photo-galleries","status":"publish","type":"post","link":"https:\/\/www.exoplatform.com\/blog\/exo-add-ons-creating-photo-galleries\/","title":{"rendered":"eXo Add-ons: Creating Photo Galleries"},"content":{"rendered":"<p>It was to time to think about a new photo gallery feature which allows to the user to illustrate and use images in an animated diaporama.<\/p>\n<p>eXo platform 3.5 gives us enough flexibility to extend content types and offer simple ways to create and use content templates. That\u2019s why I created the photo gallery template which enables the user to create gallery content, to upload images, to edit the metadata and to display them in an animated format, based on eXo Platform\u2019s Document management system.<\/p>\n<p>In this tutorial, I\u2019ll illustrate the most important features of this content type and show how to install and then use it under eXo Platform 3.5.<\/p>\n<p><!--more--><\/p>\n<h2>Resources<\/h2>\n<p>It is possible to get source code from this location: <a href=\"https:\/\/github.com\/exo-addons\/adn-gallery\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/exo-addons\/adn-gallery<\/a><\/p>\n<h2>Installation via UI<\/h2>\n<p>The easiest way to perform the installation of the gallery is through the User interface, but it\u2019s not persistent after dropping the database.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/InstallationViaUI.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-3997\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/InstallationViaUI.png\" alt=\"\" width=\"526\" height=\"128\"><\/a><\/p>\n<h4>The namespace and nodetype configuration<\/h4>\n<p>We start by the creation of the namespace of our nodetype. Our nodetype name is <strong>gallery<\/strong> which is related to this new namespace <strong>adn<\/strong> for <strong>Addon<\/strong>, so we need to configure the <strong>adn<\/strong> namespace.<\/p>\n<p>To perform that, we need to create first the name <strong>adn<\/strong> by registering it with the URL <a href=\"https:\/\/www.exoplatform.com\/?utm_source=BlogEn&amp;utm_medium=Blog&amp;utm_campaign=Content&amp;utm_content=link\" target=\"_blank\" rel=\"noopener\">https:\/\/www.exoplatform.com\/<\/a> under the Namespace Registry, but I made it easier by preparing the configuration file, which you can found at this location: <a href=\"https:\/\/github.com\/exo-addons\/adn-gallery\/blob\/master\/adn-gallery-export.xml\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/exo-addons\/adn-gallery\/blob\/master\/adn-gallery-export.xml<\/a><\/p>\n<p>You just need to import it into the Namespace Registry.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/NamespaceAndNodeTypeConfiguration.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-3998\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/NamespaceAndNodeTypeConfiguration.png\" alt=\"\" width=\"614\" height=\"340\"><\/a><\/p>\n<h4>The Dialog Template Configuration<\/h4>\n<p>Now, we are able to create the related interface, for that we need to create the template for both; the dialog form and the view one. Go to the Content Presentation\/Manage Templates, and add a new template as illustrated below. Choose the related name <strong>adn-gallery<\/strong>, a label and attribute permissions of use.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/DialogTemplateConfiguration1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-3999\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/DialogTemplateConfiguration1.png\" alt=\"\" width=\"672\" height=\"386\"><\/a><\/p>\n<p>Then we navigate into the dialog tab, there we can edit the template, copy\/past the content from this file <a href=\"https:\/\/github.com\/exo-addons\/adn-gallery\/blob\/master\/adn-gallery-tmpl-dialog.gtmpl\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/exo-addons\/adn-gallery\/blob\/master\/adn-gallery-tmpl-dialog.gtmpl<\/a><\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/DialogTemplateConfiguration2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4000\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/DialogTemplateConfiguration2.png\" alt=\"\" width=\"649\" height=\"371\"><\/a><\/p>\n<h4>The View Template Configuration<\/h4>\n<p>We move to the view template configuration, but before that we need to add some resources related to the JQuery libraries, and thus we will be able to use it in our gallery.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ViewTemplateConfiguration1.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4001\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ViewTemplateConfiguration1.png\" alt=\"\" width=\"614\" height=\"376\"><\/a><\/p>\n<p>So, navigate to the back-office of the platform using the Site Explorer and upload the JS files into a given location, for our tutorial, we will choose \/acme\/js.<\/p>\n<p>Right click on one file and \u2018Copy URL to Clipboard\u2019 in order to have to exact location. Now, it\u2019s time to have the <strong>adn-gallery-tmpl-view.gtmpl<\/strong> and edit it at the 25th and the 26th lines to change the src parameter, as illustrated below:<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ViewTemplateConfiguration2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4002\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ViewTemplateConfiguration2.png\" alt=\"\" width=\"591\" height=\"309\"><\/a><\/p>\n<p>We go back to the Content Administration Manager in order to edit the nodetype, we need to copy\/past the content of this file: <a href=\"https:\/\/github.com\/exo-addons\/adn-gallery\/blob\/master\/adn-gallery-tmpl-view.gtmpl\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/exo-addons\/adn-gallery\/blob\/master\/adn-gallery-tmpl-view.gtmpl<\/a><\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ViewTemplateConfiguration3.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4003\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ViewTemplateConfiguration3.png\" alt=\"\" width=\"620\" height=\"420\"><\/a><\/p>\n<p>Now, our nodetype is ready and can be used to create a beautiful photos gallery.<\/p>\n<h2>Installation via extension<\/h2>\n<p>It\u2019s possible also to perform the installation of the gallery feature using the extension mechanism under eXo Platform 3.5 in order to define and to configure our new nodetype.<\/p>\n<h4>The namespace configuration<\/h4>\n<p>Our nodetype name is <strong>gallery<\/strong> which is related to this new namespace <strong>adn<\/strong> for <strong>Addon<\/strong>, so we need to configure the <strong>adn<\/strong> namespace.<\/p>\n<p>To perform that, we need to add to the system configuration file <a href=\"https:\/\/github.com\/exo-addons\/adn-gallery\/blob\/master\/Ext\/system-configuration.xml\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/exo-addons\/adn-gallery\/blob\/master\/Ext\/system-configuration.xml<\/a> this source code:<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/NamespaceConfiguration2.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4008\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/NamespaceConfiguration2.png\" alt=\"\" width=\"490\" height=\"199\"><\/a><\/p>\n<h4>The nodetype configuration<\/h4>\n<p>We need also to define our new nodetype<em> \u2018adn:gallery\u2019<\/em> under the <a href=\"https:\/\/github.com\/exo-addons\/adn-gallery\/blob\/master\/Ext\/nodetypes-adn-gallery-configuration.xml\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/exo-addons\/adn-gallery\/blob\/master\/Ext\/nodetypes-adn-gallery-configuration.xml<\/a> file.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/NodeTypeConfiguration.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4009\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/NodeTypeConfiguration.png\" alt=\"\" width=\"607\" height=\"458\"><\/a><\/p>\n<h4>The view and the dialog templates<\/h4>\n<p>Once defining the nodetype, we need to define the associated view and dialog templates. You may add them also using the extension mechanism.<\/p>\n<p>Let\u2019s assume that you dropped these files into this war \u2018my-extension.war\u2019 and then we may perform our configuration.<\/p>\n<h4>Add resources files<\/h4>\n<p>In order to make an animation, we will add the JQuery library and some Javascript functions, for that we need to add these two files <strong>jquery.min.js<\/strong> &amp; <strong>jquery.adn-gallery.js<\/strong> into our extension already defined.<\/p>\n<p>After that we have to update the view template <strong>adn-gallery-tmpl-view.gtmpl<\/strong> in the two first lines in order to define the location of the Javascript files like this:<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ResourceFile.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4010\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ResourceFile.png\" alt=\"\" width=\"603\" height=\"425\" srcset=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ResourceFile-100x69.png 100w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ResourceFile-43x30.png 43w\" sizes=\"(max-width: 603px) 100vw, 603px\" \/><\/a><\/p>\n<h2>Features<\/h2>\n<p>Now, it\u2019s Ok for the configuration phase, we can move to the use of our photo gallery.<br \/>\nWe can navigate to the back office of eXo Platform 3.5 and then create a new content. Choose the template <strong>Images Gallery<\/strong>:<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ChooseTemplate.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4013\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ChooseTemplate.png\" alt=\"\" width=\"539\" height=\"236\" srcset=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ChooseTemplate-360x159.png 360w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ChooseTemplate-200x89.png 200w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ChooseTemplate-100x44.png 100w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ChooseTemplate-68x30.png 68w\" sizes=\"(max-width: 539px) 100vw, 539px\" \/><\/a><\/p>\n<p>You confirm the input and save the document.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/SaveDocument.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4022\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/SaveDocument.png\" alt=\"\" width=\"546\" height=\"194\" srcset=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/SaveDocument-100x37.png 100w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/SaveDocument-70x26.png 70w\" sizes=\"(max-width: 546px) 100vw, 546px\" \/><\/a><\/p>\n<p>You may upload a set of images. You may also delete or update the related metadata of the image directly after uploading.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/UploadImage.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4023\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/UploadImage.png\" alt=\"\" width=\"545\" height=\"371\"><\/a><\/p>\n<p>Or using the explorer side of the document management system.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ExplorerSide.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4024\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/ExplorerSide.png\" alt=\"\" width=\"517\" height=\"280\"><\/a><\/p>\n<p>It\u2019s possible to edit the metadata of the image like title and description in order to be displayed in the gallery.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/EditForm.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4025\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/EditForm.png\" alt=\"\" width=\"603\" height=\"319\"><\/a><\/p>\n<p>And finally, you can get your photo gallery based on JQuery library.<\/p>\n<p><a href=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/PhotoGallery.png\"><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-4026\" style=\"border: 1px solid lightgray;\" src=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/PhotoGallery.png\" alt=\"\" width=\"506\" height=\"556\" srcset=\"https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/PhotoGallery.png 695w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/PhotoGallery-274x300.png 274w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/PhotoGallery-431x473.png 431w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/PhotoGallery-299x328.png 299w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/PhotoGallery-215x236.png 215w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/PhotoGallery-119x131.png 119w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/PhotoGallery-82x90.png 82w, https:\/\/www.exoplatform.com\/blog\/wp-content\/uploads\/2013\/01\/PhotoGallery-27x30.png 27w\" sizes=\"(max-width: 506px) 100vw, 506px\" \/><\/a><\/p>\n<h3>Submit your own eXo Add-ons!<\/h3>\n<p>If you are a developer and you have worked on something you would like to share with the eXo community, <a title=\"eXo Add-ons\" href=\"http:\/\/github.com\/exo-addons\" target=\"_blank\" rel=\"noopener\">eXo Add-ons<\/a> is the best place to host your code. And rest assured: you will remain the owner of your project. We won&#8217;t claim any IP or other rights. It&#8217;s your stuff, just a bit more visible.<\/p>\n<p>It&#8217;s very easy to <a title=\"eXo Add-On Repo Request\" href=\"https:\/\/www.exoplatform.com\/?utm_source=BlogEn&amp;utm_medium=Blog&amp;utm_campaign=Content&amp;utm_content=link\" target=\"_blank\" rel=\"noopener\">get your own repository<\/a> on eXo Add-ons. Just <a title=\"eXo Add-On Repo Request\" href=\"https:\/\/www.exoplatform.com\/?utm_source=BlogEn&amp;utm_medium=Blog&amp;utm_campaign=Content&amp;utm_content=link\" target=\"_blank\" rel=\"noopener\">drop us a request<\/a> and we&#8217;ll get you ready.<\/p>\n","protected":false},"excerpt":{"rendered":"It was to time to think about a new photo gallery feature which allows to the user to illustrate and use images in an animated diaporama. eXo platform 3.5 gives us enough flexibility to extend content types and offer simple ways to create and use content templates. That\u2019s why I created the photo gallery template [&hellip;]","protected":false},"author":7,"featured_media":12746,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[699],"tags":[],"lang":"en","translations":{"en":3996},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/posts\/3996"}],"collection":[{"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/comments?post=3996"}],"version-history":[{"count":0,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/posts\/3996\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/media?parent=3996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/categories?post=3996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.exoplatform.com\/blog\/wp-json\/wp\/v2\/tags?post=3996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}