jAPS 2.0 - Plugin Share With

Do It The jAPS Way

Andrea Dessì

First complete version of this document 
AgileTec s.r.l.

Legal Notice

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the Appendix entitled "GNU Free Documentation License".

The copyright holders make no representation about the suitability of this Document for any purpose. It is provided “as is” without expressed or implied warranty. If you modify this Document in any way, identify your resulting Document as a variant of this Document.

2010-04-02

Revision History
Revision 0.22010-02-22AD

Update for jAPS 2.0.10

Revision 0.12009-06-19AD

First draft

Abstract

Documentation Plugin Share With


List of Tables

2.1. Summary of characteristics

List of Examples

4.1. Array of services

Chapter 1.  Scope of the document

Introduction

The purpose of this document is to provide a complete description of the Plugin "Share With" (jpsharewith) structure.

Target Audience

This document is intended for those who wish to know the capabilities of the jAPSPlugin "Share With" (jpsharewith) and is considering the possible integration into a running production environment or in its Development Environment (IDE Eclipse Project).

The document is addressed to both System Administrators and java Developers.

Prerequisites

In order to take maximum advantage from the present document, it is necessary to have basic knowledge about:

  • jAPS 2.0 and its architecture
  • Page Models and Showlets in jAPS 2.0
  • SQL language and PostgreSQL

Resources

Additional informations may be obtained through the following mailing-lists:

Is it also possible to refer to the documentation found in the:

jAPS 2.0 Project - Developer Website

Chapter 2. Specifications

Table of Contents

Specifications

Specifications

The target of the Share With Plugin is to create shortcuts, useful to users, that allow sharing jAPS pages with social network.

The module in for of Showlet. Through CMS will be possible to publish Share With - Condividi Con Showlet in the pages Frames.

The Showlet will show in the page a list of links to the social network configurated sites. Each link will be preconfigured with the current URL and title of the page acting as a shortcut for bookmarking and posting in the external sites.

The list of the social networks, so the list of links, is customizable. See chapter Configuration for further informations.

Table 2.1. Summary of characteristics

CodeNameTypePlugin VersionjAPS 2.0 Version
jpsharewithShare WithPurePlugin1.12.0.10, 2.0.8

Chapter 3. Installation and Integration

Installation of the Share With plugin

Technical Specification

This Plugin is a PurePlugin, its installation doesn't modify any existing system function already present.

It works through a Showlet.

The package

The package contains:

Readme
It is a brief description of the Plugin and its license
doc
The directory doc contains this document
src/java
The directory src/java contains the java source files
src/sql
The directory src/sql contains the SQL script to execute in your db
src/webapp
The directory src/webapp contains files to import in your existing project or portal

Installation in a Development Environment

To perform the installation in a development environment follow this procedure:

  1. Execute the script src/sql/portScript.sql in the Port database of your application

  2. Copy content from src/webapp/ of the package in the directory WebContent of your project.

  3. Copy content from src/java/main/ of the package in the directory src of your project.

Js in Page Models

Ensure to have two outputHeadInfo tags in the Page Models (inside tag head) like following code

<wp:outputHeadInfo type="JS"> 
	<script type="text/javascript" src="<wp:resourceURL />static/js/<wp:printHeadInfo />"></script>
</wp:outputHeadInfo>
<wp:outputHeadInfo type="JS_RAW">
    <script type="text/javascript">
        <wp:printHeadInfo />
    </script>
</wp:outputHeadInfo>
				

Integration in Production Environment

Procedure for integration in a Production Environment is similar to Installation in a Development Environment procedure.

The only difference is to copy src/webapp/ from the package in the root of deployied portal.

From now we will use the name myportal when referring to your deployed jAPS.

  1. Execute src/sql/portScript.sql SQL script in your Port database (example myportalPort)

  2. Copy content of src/webapp/ of the provided package into myportal/ directory (example /usr/local/tomcat/webapps/myportal/)

  3. If necessary reload jAPS configuration from CMS or restart the webapp

Js in Page Models

Ensure to have two outputHeadInfo tags in the Page Models (inside tag head) like following code

<wp:outputHeadInfo type="JS"> 
    <script type="text/javascript" src="<wp:resourceURL />static/js/<wp:printHeadInfo />"></script>
</wp:outputHeadInfo>
<wp:outputHeadInfo type="JS_RAW"> 
    <script type="text/javascript">
        <wp:printHeadInfo />
    </script>
</wp:outputHeadInfo>
				

Chapter 4. Configuration

It is possible to customize the list of social network.

Edit file WebContent/resources/plugins/jpsharewith/static/js/jpsharewith_buttons.js from your Eclipse project (or myportal/resources/plugins/jpsharewith/static/js/jpsharewith_buttons.js if working in already deployed webapp.

The plugin requires a JavaScript array of objects and every object with three properties: title, link e image.

title
It's the name or the title of the external service. Example "Google Bookmarks" or "Facebook".
link
It's the URL for needed for sharing the current page. You must parametrize the URL using two special characters: $TITLE$ and $URL$. $TITLE$ will return the title of page user is visiting and $URL$ will return the full url of the page.
image

It's the name of the image file placed in the title left side.

You have to put image files in WebContent/resources/plugins/jpsharewith/static/img directory of your Eclipse project (or myportal/resources/plugins/jpsharewith/static/img if working with a deployed webapp)

It's possible to add items to the list simply adding record to the JavaScript array. Every record is surrounded by curly brackets. Please see the following example.

Example 4.1. Array of services

var    jpsharewith_buttons = [
    {service1},
    {service2},
    {service3}
];
		

Replace every service with a structure like this:

'title' : 'TITLE OF THE SERVICE',
        'link'  : 'http://www.example.com/share?urlToShare=§URL§&titleToShare=§TITLE§',
        'image' : 'example.png'
		

The resulting code is:

var	jpsharewith_buttons = [
	{
		'title' : 'Service 1',
    	'link'  : 'http://www.site1.com/share?urlToShare=§URL§&titleToShare=§TITLE§',
    	'image' : 'serv1.png'
	},
	{
		'title' : 'Service 2',
    	'link'  : 'http://www.site2.net/share?urlToShare=§URL§&titleToShare=§TITLE§',
    	'image' : 'serv2.png'
	},
	{
		'title' : 'Service 3',
    	'link'  : 'http://www.site3.net/share?urlToShare=§URL§&titleToShare=§TITLE§',
    	'image' : 'serv3.png'
	}
];