WIDGETS TECHNICAL DOCUMENTATION PORTAL FACTORY 2.0

Similar documents
PORTALS, DASHBOARDS AND WIDGETS DIGITAL EXPERIENCE MANAGER 7.2

Introduction. Part I: jquery API 1. Chapter 1: Introduction to jquery 3

User Guide: Content editing

Tivoli Common Reporting V Cognos report in a Tivoli Integrated Portal dashboard

BEAWebLogic. Portal. Overview

Jahia Studio JAHIA DOCUMENTION

ESIGATE MODULE DOCUMENTATION DIGITAL EXPERIENCE MANAGER 7.2

ADDING INPUTS FORM FACTORY V2

Siteforce Pilot: Best Practices

ENRICHING PRIMO RECORDS WITH INFORMATION FROM WORDPRESS. Karsten Kryger Hansen Aalborg University Library

A. Add a property called debugclientlibs to the js.txt and set the value to true.

ANGULARJS INTERVIEW QUESTIONS

ver Wfl Adobe lif Sams Teach Yourself Betsy Bruce Robyn Ness SAMS 800 East 96th Street, Indianapolis, Indiana, USA WlM John Ray ^lg^

Dashboards. Overview. Overview, page 1 Dashboard Actions, page 2 Add Widgets to Dashboard, page 4 Run a Report from the Dashboard, page 6

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

Start editing and publishing content right away.

A Model-Controller Interface for Struts-Based Web Applications

Digital Factory 7 Search and Query API under the hood

A demo Wakanda solution (containing a project) is provided with each chapter. To run a demo:

Full Stack Web Developer

Comprehensive AngularJS Programming (5 Days)

The main differences with other open source reporting solutions such as JasperReports or mondrian are:

Prosphero Intranet Sample Websphere Portal / Lotus Web Content Management 6.1.5

Swiiit User Guide 09/11/2016

Development Training. For Developer. 4 th May, AOT Intranet Web Portal

Learn how to login to Sitefinity and what possible errors you can get if you do not have proper permissions.

FORMS. The Exciting World of Creating RSVPs and Gathering Information with Forms in ClickDimensions. Presented by: John Reamer

Jquery Manually Set Checkbox Checked Or Not

Installation Guide. Sitecore Federated Experience Manager. Installation & Configuration Guide

CMIS CONNECTOR MODULE DOCUMENTATION DIGITAL EXPERIENCE MANAGER 7.2

SSJS Server-Side JavaScript WAF Wakanda Ajax Framework

USER GUIDE EDIT MODE GUI AND TOOLS OVERVIEW DIGITAL EXPERIENCE MANAGER 7.1.1

USER GUIDE : CONTENT EDITING DIGITAL EXPERIENCE MANAGER 7.1.1

JSP MOCK TEST JSP MOCK TEST IV

Datastore Model Designer

No Programming Required Create web apps rapidly with Web AppBuilder for ArcGIS

Dreamweaver MX The Basics

Configuring Anonymous Access to Analysis Files in TIBCO Spotfire 7.5

Roxen Content Provider

Developing ASP.NET MVC 5 Web Applications. Course Outline

Overview

vfire 9.8 Release Notes Version 1.5

Dreamweaver CS4. Introduction. References :

Swiiit User Guide 03/09/2015

Creating Dashboard. Version: 7.3

WEBSITE INSTRUCTIONS. Table of Contents

20486: Developing ASP.NET MVC 4 Web Applications

20486-Developing ASP.NET MVC 4 Web Applications

Developing ASP.NET MVC 5 Web Applications

Configuring Ad hoc Reporting. Version: 16.0

BEAWebLogic. Portal. Tutorials Getting Started with WebLogic Portal

Visual Web Next Design Concepts. Winston Prakash Feb 12, 2008

ethnio tm IMPLEMENTATION GUIDE ETHNIO, INC W SUNSET BLVD LOS ANGELES, CA TEL (888) VERSION NO. 3 CREATED JUL 14, 2017

4D Ajax Framework 1.1 ADDENDUM

Tapestry. Code less, deliver more. Rayland Jeans

Virto SharePoint Forms Designer for Office 365. Installation and User Guide

Full Stack Web Developer

COURSE OUTLINE MOC 20480: PROGRAMMING IN HTML5 WITH JAVASCRIPT AND CSS3

CST272 Getting Started Page 1

1. Click on the button in your cover photo. 2. Chose the Donate Now option in the drop-down menu.

Course 20486B: Developing ASP.NET MVC 4 Web Applications

Financial. AngularJS. AngularJS. Download Full Version :

Developing ASP.NET MVC 4 Web Applications

Liferay Themes: Customizing Liferay s Look & Feel

Developing ASP.NET MVC 5 Web Applications

CIS 408 Internet Computing Sunnie Chung

Advanced Training Manual: Surveys Last Updated: October 2013

Introduction Haim Michael. All Rights Reserved.

Visual Studio Course Developing ASP.NET MVC 5 Web Applications

Fast Track to Java EE

ASP.NET MVC Training

Kyle #HubSpotting

Ajax- XMLHttpResponse. Returns a value such as ArrayBuffer, Blob, Document, JavaScript object, or a DOMString, based on the value of

Marketo Forms Integration Guide

Reading Writing Speaking Reading Writing Speaking. English Intermediate Intermediate Elementary Intermediate Intermediate Elementary

The 60-Minute Guide to Development Tools for IBM Lotus Domino, IBM WebSphere Portal, and IBM Workplace Applications

jquery in Action Second Edition !II BEAR BIBEAULT YEHUDA KATZ MANNING Greenwich (74 0 w. lang.)

COMSC-031 Web Site Development- Part 2

Financial. AngularJS. AngularJS.

Creating Web Mapping Applications. Nikki Golding

DbSchema Forms and Reports Tutorial

Simple AngularJS thanks to Best Practices

extc Web Developer Rapid Web Application Development and Ajax Framework Using Ajax

20486 Developing ASP.NET MVC 5 Web Applications

P a g e 1. Danish Technological Institute. Scripting and Web Languages Online Course k Scripting and Web Languages

KonaKart Shopping Widgets. 3rd January DS Data Systems (UK) Ltd., 9 Little Meadow Loughton, Milton Keynes Bucks MK5 8EH UK

Developing ASP.Net MVC 4 Web Application

12/05/2017. Geneva ServiceNow Custom Application Development

BPMone 2.8 Release Notes

Index. Boolean value, 282

Contents. Page Builder Pro Manual

The course also includes an overview of some of the most popular frameworks that you will most likely encounter in your real work environments.

COURSE 20486B: DEVELOPING ASP.NET MVC 4 WEB APPLICATIONS

Cracked IntegralUI Studio for Web all pc software ]

PeopleSoft PeopleTools Tips & Techniques

Qlik, QlikTech and QlikView are trademarks and registered trademarks of QlikTech International AB.

This course is intended for Java programmers who wish to write programs using many of the advanced Java features.

jquery Tutorial for Beginners: Nothing But the Goods

20486: Developing ASP.NET MVC 4 Web Applications (5 Days)

Intellicus Enterprise Reporting and BI Platform

Transcription:

1

SUMMARY 1 INTRODUCTION... 3 2 CUSTOM PORTAL WIDGETS... 4 2.1 Definitions... 4 2.2 Vie s. 5 2.3 kins 6 3 USING PORTALS IN YOUR SITE (PORTAL TEMPLATES)... 7 3.1 Activate the Portal Modules for your site... 7 3.2 Define Portal-enabled templates... 8 4 PORTAL JAVASCRIPT API... 9 4.1 Portal JavaScript API... 9 4.1.1 How to retrieve the widget API object... 9 4.1.2 How to load the edit view of the widget manually... 10 4.1.3 How to delete a widget... 10 4.1.4 How to retrieve the list of widget types allowed in the current portal... 10 4.1.5 How to add a new widget... 11 4.1.6 How to retrieve the tabs of the portal... 11 4.1.7 How to load a specific widget in a specific portal template... 12 4.1.8 How to instantiate a user portal from the Portal model... 13 4.2 Portal Taglib... 13 4.3 PortalContext... 14 4.4 More examples... 14 2002 2016 Jahia Solutions Group SA Page 2 / 15

1 INTRODUCTION Jahia Digital Experience Manager is a platform for managing a variety of digital initiatives in a productive and secure fashion. Initiatives such as building websites, mobile sites, intranets and portals, all of which can interact with visitors in order to deliver the best user experience possible. This guide presents some technical features of Portal Factory, a new, advanced portal generation and management interface, available as an Add-on for Jahia Digital Experience Manager. Portal Factory allows you to create Portal models for your site and give your users access to one or more Portals based on these models. They can also under circumstances customize these portals within the limits you define. In this documentation, you will learn how to create custom Portal Widgets, how to use Portals in an existing Jahia Digital Experience Manager, and how to interact with the Portal JavaScript API. Explanations remain simple and factual, so this guide can help developers and web masters to get acquainted rapidly to the tools they will use. For general administration and usage of Portal Models and User Portals, please refer to the Portal Factory User Guide, available on the Jahia Web Site. 2002 2016 Jahia Solutions Group SA Page 3 / 15

2 CUSTOM PORTAL WIDGETS You can create your own custom widgets and use them in any Portal. To do so, your widgets' content needs to respect a precise structure. 2.1 DEFINITIONS A widget need to have its own definition and the mixin that specifies it as a portal widget. [jnt:documentbrowserwidget] > jnt:content, jmix:portalwidget - rootpath (string) = "/sites" indexed=no autocreated In blue the mixin jmix:portalwidget specifies that this component is a portal widget, and that its use is allowed in portals. In orange, the property option autocreated is useful for the widget, because when a widget is added to a portal page, the edit view of the widget is displayed but at this state the node is created and it is not sure which properties are initialized. The user is able to customize the properties, but if the property is not found in the views of your widget it is possible to get e eptions. That s h we choose to put this option so this property is auto created at creation of the node. You can also catch the exception when a property is not yet created in your views, but the approach is trickier to handle. Same caution applies with mandatory properties. There is another mixin that can be put on your widget node type: [jnt:scriptgadgetwidget] > jnt:content, jmix:portalwidget, jmix:portalgadget - j:script (string, richtext) = "" indexed=no autocreated In blue, the mixin jmix:portalgadget is used to specify that this specific widget component needs to be used without AJAX. By default, all portal widgets are loaded using AJAX, but some widgets use dynamic JavaScript includes or need to be loaded at the same time as the page. In order to achieve that, you can add this mixin to prevent the AJAX behavior on this type of widget. For now, that's all you need to know about the widgets node type definition. 2002 2016 Jahia Solutions Group SA Page 4 / 15

If you wish to delve deeper into writing Portal Widgets, you can take a look at all the default widgets brought by the module Portal factory - widgets https://github.com/jahia/portal-factory_widgets and that you can see in the Portal Widget Zap. 2.2 VIEWS Widget components have specific portal views; in the current portal implementation, the views used in the widgets (in the User Portal) are the following: helloworldwidget.portal.view.jsp: the default view for a widget helloworldwidget.portal.edit.jsp: the edit view for a widget (optional) helloworldwidget.portal.full.jsp: the full view for a widget (optional) The following view is used in the core Portal Model view: helloworldwidget.portal.model.jsp : the view with the specific model form, that allows to edit portal widget model properties. (properties used at the user portal instantiation, that are not propagated to the user instance widget.) There is no limit on the views you can use for a widget, since the JavaScript portal API allows you to load whichever view you want. You can also create your own views and just call the portal function widget.load( view ). In the current implementation, we chose to prefix all the portal-specific views with portal but this is not mandatory. 2.3 SKINS Skins are the different layouts used for a widget. You can create your own skins as well. The only thing you need to do to create a new skin is to create a view for the portalwidget node type that looks like portalwidget.box.<skin name>.jsp For example: portalwidget.box.advanced_purple.jsp portalwidget.box.advanced_blue.jsp portalwidget.box.advanced_green.jsp This naming convention uses Jahia's default wrapper system. 2002 2016 Jahia Solutions Group SA Page 5 / 15

In the current portal implementation, the skins implement some features like: minimize/maximize the widget load the edit view when possible load the full view. But you can create your own custom skins that fits your needs. 2002 2016 Jahia Solutions Group SA Page 6 / 15

3 USING PORTALS IN YOUR SITE (PORTAL TEMPLATES) To be able to use Portals in an existing Jahia Digital Experience Manager Web Site, Portal Factory Modules must be activated for this site Specific portal templates including portal content must be created through the Studio and added to your site. 3.1 ACTIVATE THE PORTAL MODULES FOR YOUR SITE In order for Portals to work on your site, you first need to install and activate the Jahia Portal Factory modules through the Studio. Make sure the modules are installed in the following order, as dependencies could prevent them from working correctly otherwise. 1. Portal factory - core: https://github.com/jahia/portal-factory_corethis is the core module for the portal, it contains the JavaScript Portal API and the portal taglib, all the filters, actions, scripts, and views necessary to the portal to work correctly. 2. Portal factory - user portal: https://github.com/jahia/portal-factory_user-portal These are the components related to the portal for end-users. These components rely on the portal JavaScript API and the portal taglib. The user portal contains: a. Portal toolbar: This toolbar displays the tabs and the actions available to create and edit portals b. User s portal list: A simple component displaying all the portals accessible by the current user. c. Portal widget zap: A component displaying all the drag&droppable widgets in the portal. 3. Portal factory - widgets: https://github.com/jahia/portal-factory_widgets This is the portal widgets sample. (twitter widget, rss feed widget, script widget, document browser widget, etc ). 2002 2016 Jahia Solutions Group SA Page 7 / 15

3.2 DEFINE PORTAL-ENABLED TEMPLATES To be able to activate portals in your site, you need to have specific templates that drives the portal tabs. Those templates must contain contain portal area(s). Portal areas are special areas designed to allow the drag and drap of widgets within. Adding these templates is required to be able to create a portal model. Portal models are explained in the Portal Factory User Guide on the Jahia website. To learn how to create a portal template, you can explore the source code of some existing Portal templates in the module called 'Portal factory - default templates' : https://github.com/jahia/portalfactory_default-templates This is the default template set that can be used directly to start creating portals in a blank site. For more information about creating your own templates, a video Portal documentation - how to template portals will be available on the Jahia Web Site. 2002 2016 Jahia Solutions Group SA Page 8 / 15

4 PORTAL JAVASCRIPT API A portalcontext Java Bean is available in all portal components; it is added automatically on portal pages and widget views. Java Bean is serialized in Javascript and also available in the portal JavaScript API. 4.1 PORTAL JAVASCRIPT API The portal JavaScript API is available in any page of your portal. A Jahia render filter adds automatically the necessary JavaScript to the page, so you do not have anything to do manually to use it. The portal API is made of 3 objects: Portal: the portal itself. Some actions are possible directly on this object like init drag&drop, add new widget, get widget types, Area: a column of the portal. Nothing special here, just that you can access the jquery object of this area. Widget: a portal widget. You can access this object through the Portal object. The actions possible on this object are: load a specific view for the current widget, update the widget, delete it, In the following sections we will see some examples. 4.1.1 How to retrieve the widget API object If you do not know the widget html ID, you can use a sub html element to retrieve the parent widget object: var widget = portal.getcurrentwidget("html SUBCHILD ID"); If you know the html ID of the widget, you can use this function: var widget = portal.getwidget("widget HTML ID"); 2002 2016 Jahia Solutions Group SA Page 9 / 15

4.1.2 How to load the edit view of the widget manually Use the function load. This function takes the view string name as first parameter. You can add an optional callback as second parameter. widget.load("portal.edit") Note: you can use the same function to load any widget view. 4.1.3 How to delete a widget To delete a widget, call the deletewidget function from the portal object: portal.deletewidget(widget); 4.1.4 How to retrieve the list of widget types allowed in the current portal You can call the portalwidgettypes function from the portal object. In order to be able to retrieve this information, you need to have Write permissions on the Portal tab : portal.portalwidgettypes The array of portal widget types displays the following format: [{ name: "jnt:bookmarkswidget", displayablename: "My bookmarks widget", views: [ { path: "/modules/portalfactory_widgets/jnt_bookmarkswidget/html/bookmarkswidget.portal.edit.jsp", key: "portal.edit" }, { path: "/modules/portalfactory_widgets/jnt_bookmarkswidget/html/bookmarkswidget.portal.view.jsp", key: "portal.view" } ] },...] 2002 2016 Jahia Solutions Group SA Page 10 / 15

4.1.5 How to add a new widget The simplest way to add a new widget is the following; the widget will be added to the first column of the current tab: portal.addnewwidget("widget node type", "Widget desired name"); but if you wish to connect a draggable to the portal sortable areas, more code is needed : Add the following data to your draggable element: <div data-widget_nodetype="widget NODE TYPE" data-widget_view="widget VIEW" class="widget_external_drop">draggable new widget</div> This is the minimal code needed on the draggable element. The data attributes name are constants in the portal API. The missing part is the connector code to the draggable areas: element.draggable({ connecttosortable: Jahia.Portal.default.sortable_options.connectWith, helper: "clone" }); Where 'element' is the previous div. You need to set this minimal option to the draggable function. The connecttosortable is mandatory, you need to specify the sortable areas selector, for simply we have store the sortable class selector in a constant of the portal API. The helper clone is also mandatory, because a clone of the div will be created and the portal API will replace it with the widget and the view you previously specify in the data of your div. To have a closer look at the code, you can take a look at how it is done in the component Portal Widgets Zap in the module portal-factory_user-portal. 4.1.6 How to retrieve the tabs of the portal For better performance, the JavaScript AJAX calls to query the portal tabs has been removed, to avoid an overload of HTTP calls when many users are using portals at the same time. So we add a JCR query manually in the Portal Toolbar component and iterate on each portal tab node. The upside to this approach is that the toolbar is cached per user. Users may see different portal tabs according to accessibility options on portal tabs. 2002 2016 Jahia Solutions Group SA Page 11 / 15

In the Portal Toolbar component, we add information to the portal JavaScript object to store the result of the query. <c:set var="portalnode" value="${rendercontext.mainresource.node.parent}"/> <script type="text/javascript"> portal.portaltabs = []; var portaltab = {}; <c:foreach items="${portalnode.nodes}" var="portaltab"> <c:if test="${jcr:isnodetype(portaltab, 'jnt:portaltab')}"> <template:addcachedependency path="${portaltab.path}"/> <c:set var="iscurrent" value="${portaltab.identifier eq rendercontext.mainresource.node.identifier}"/> portaltab = { path:"${portaltab.path}", displayablename: "${portaltab.displayablename}", accessibility: "${not empty portaltab.properties['j:accessibility']? portaltab.properties['j:accessibility'].string : 'me'}", skinkey: "${portaltab.properties['j:widgetskin'].string}", templatekey: "${portaltab.properties['j:templatename'].string}", current: ${iscurrent}, url: "<c:url value="${url.baselive}${portaltab.path}.html"/>" } portal.portaltabs.push(portaltab); <c:if test="${iscurrent}"> portal.portalcurrenttab = portaltab; </c:if> </c:if> </c:foreach> </script> 4.1.7 How to load a specific widget in a specific portal template Like the full view for the widgets, you may need to load a widget in a specific template. To do that you can use the loadincurrenttab function: portal.loadincurrenttab("widget node identifier", "widget view", "widget state", "widget need to be loaded alone", "portal template"); This function allows to load a widget in the current tab; you can use the parameters: 2002 2016 Jahia Solutions Group SA Page 12 / 15

- widget node identifier: the jcr node id of the widget (you can get it on the widget API object) - widget view: the widget view to use for the widget (you can get the list of the widget views using portal functions) - widget state: it s a flag for identify the state of the widget, you can specify whatever you want, for the full view I use the full state, so I know if the widget is actually display full or not, to be able to get back to normal. - widget need to be loaded alone: is a boolean that tell the portal to only load this widget when is set to true, or to also load the others widgets available in the current page. - portal template: finally, the portal tab template you want to use to display the widget. You can take a look at the JavaScript portalwidgetwrapper.js in the module portal-factory_widgets. This is the controller for all the widgets in the current implementation. The function is used to load widgets in full state. 4.1.8 How to instantiate a user portal from the Portal model Just call the function: portal.initportalfrommodel(); You can use a callback as parameter. 4.2 PORTAL TAGLIB Portal Factory comes with a JSP taglib available to help you get some portal related information and objects in your JSPs. In order to use it, you need to add the dependency to portal-fatory_core module in your own module and add the following import in your JSP headers: <%@ taglib prefix="portal" uri="http://www.jahia.org/tags/portallib" %> A useful function is: userportalsbysite: returns all visible portals for the current user for the given site 2002 2016 Jahia Solutions Group SA Page 13 / 15

4.3 PORTALCONTEXT The portalcontext is a Java Bean available in all JSP and render scripts used for portal components. To access this portalcontext in your render scripts for your content, you need to add explicitly the mixin: jmix:portalcontextwatcher to your content type. By default, it is accessible in widget views. The portal toolbar is a sample component that uses portalcontext, to display or hide specific information. You can take a look at the Java Bean org.jahia.modules.portal.service.bean.portalcontext.java private String path; private String identifier; private String tabpath; private String tabidentifier; private String modelpath; private String modelidentifier; private String fulltemplate; private String baseurl; private List<PortalKeyNameObject> portaltabskins; private List<PortalKeyNameObject> portaltabtemplates; private SortedSet<PortalWidgetType> portalwidgettypes; private boolean islock; private boolean ismodel; private boolean iscustomizable; private boolean iseditable; private boolean isenabled; private boolean isdebug; private int siteid; All this information is available from the portalcontext, and since it is serialized and used in the Ja a ript API, it s also a aila le in Ja a ript lient ode. 4.4 MORE EXAMPLES For more code samples, you can dig into the portal JavaScript API from the Portal Factory sources. There, you will find some JS documentation on functions. The file is located in the module portalfactory_core and is named: jahia-portal.js You can also take a look at the different portal components like the Portal toolbar, Portal Widgets Zap, to be found in the module portal-factory_user-portal. 2002 2016 Jahia Solutions Group SA Page 14 / 15

And finally you can explore the code of all the sample widgets that are in the module portalfactory_widgets. Most of them are AngularJS applications and use the portal JavaScript API to perform actions in the portal. 2002 2016 Jahia Solutions Group SA Page 15 / 15