jAPS – Plugin jpcalendar

Do It The jAPS Way

Rinaldo Bonazzo

English version in DocBook 4.5 
AgileTec s.r.l.

Giovanni Cocco

Pre-release revision, update to 2.0.8, update to 2.0.10 
Tzente 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-02-24

Revision History
Revision 0.82010-02-24GC

Revision for jAPS 2.0.10 version, and plugin 1.2 version.

Revision 0.72009-10-13GC

Revision for jAPS 2.0.8 version, and plugin 1.1 version.

Revision 0.62009-09-14GC

Pre-release revision.

Revision 0.52009-07-06RB

Change chapters sequences

Revision 0.42009-07-01RB

inserted table Characteristics summary as request by the standard documentation

Revision 0.32009-06-22RB

Use of filename tag to describe correct folder name and use of myportal in place of WEBAPPNAME

Revision 0.22009-03-27RB

First Docbook Version

Abstract

The purpose of this document is to provide a complete description of the Plugin "jpcalendar" structure.


List of Tables

2.1. Characteristics summary

Chapter 1. Scope of the document

Introduction

The purpose of this document is to provide a complete description of the Plugin "jpcalendar" structure.

Target audience

This document is intended for those who wish to know the capabilities of the jAPSPlugin "jpcalendar" 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: the Java platform, the Eclipse IDE, the Apache Tomcat servlet engine, the PosgreSQL DBMS.

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. Characteristics of the Plugin

Characteristics of the Plugin

The Plugin jpcalendar displays a monthly calendar. The days of the month are displayed with the following criteria:

  • today's date is displayed in bold format

  • the days without events are shown in normal format

  • the days with events are displayed in underlined format

    These days are a link to the page, responsible to display the events of the day selected.

today's date

If today's date has events it will be displayed in the bold and underlined format

Table 2.1. Characteristics summary

CodeNameTypePlugin versionjAPS 2.0 version
jpcalendarCalendarPurePlugin1.22.0.10, 2.0.8
jpcalendarCalendarPurePlugin1.12.0.8

Chapter 3. Installation and Integration

Installation and Integration

Specifications

The plugin has the characteristic of PurePlugin, its installation does not change any functionality in the system. The module presents a set of interfaces for the Front-End, payable through Showlet External Framework. These interfaces do not contain any graphical element. In this way it's possible to decorate it in any specific instance of jAPS 2.0.

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/sql
The directory src/sql contains SQL script to execute in your db
src/java
The directory src/java contains the java code and the jUnit test
src/webapp
The directory src/webapp contains files to import in your existing project or portal

Integration in a Production Environment

The following activities are to be carried out after the stop of the Web Application.

To install the plugin in a production Web Application based on jAPS 2.0 and declared compatible with the plugin. Perform the following steps (From this point on, we will assume that your new portal is called myportal):

  • Copy the contents of the folder src/webapp/WEB-INF/lib of the package as supplied within the folder myportal/WebContent/WEB-INF/lib in production.

  • Copy the contents of the folder src/webapp/WEB-INF/plugins of the package as supplied within the folder myportal/WebContent/WEB-INF/plugins in production.

  • After configuration of params CONTENT_TYPE_ID, NOME_ATTRIBUTO_DATA_INIZIO e NOME_ATTRIBUTO_DATA_FINE and verified valued for version (it must be equal to configVersion of systemParams, the script is designed assuming the version production), perform tasks detailed in the file portScript.sql (present in the folder src/sql) in the db port , in a standard configuration the db has name myportalPort.

Installation in a Development Environment

To install the plugin in an Eclipse project based on jAPS 2.0 and declared compatible with the plugin, Perform the following steps (From this point on, we will assume that your new project is called myproject):

  • Copy the contents of the folder src/webapp/WEB-INF/plugins of the package as supplied within the folder myproject/WebContent/WEB-INF/plugins/.

  • After configuration of params CONTENT_TYPE_ID, NOME_ATTRIBUTO_DATA_INIZIO e NOME_ATTRIBUTO_DATA_FINE and verified valued for version (it must be equal to configVersion of systemParams, the script is designed assuming the version production), perform tasks detailed in the file portScript.sql (present in the folder src/sql) in the db port , in a standard configuration the db has name myprojectPort.

  • Perform tasks detailed in the file portTestScript.sql (present in the folder src/sql) in the test db port, in a standard configuration the db has name myprojecttestPort.

  • Copy the contents of the folder src/java/main/com/agiletec/plugins/ in the folder myproject/src/com/agiletec/plugins/, create the directory plugins if not exists.

  • Copy the contents of the folder src/java/test/test/com/agiletec/plugins/ in the folder myproject/src/test/com/agiletec/plugins/, create the directory plugins if not exists.

Chapter 4. Configuration

Configuration

In the next paragraphs we will see the steps for the plugin configuration.

Steps of configuration

Configure a contentType (DB portalNamePort, table sysconfig, item 'contentTypes') that contains 2 attributes of type Date, for the start date and the end date.

Modify the following query in relation with the inserted contentType (see previous paragraph) and execute it in the db portalNamePort, is possible to modify the config directly on the database if already loaded on it

			
				INSERT INTO sysconfig (version, item, descr, config) 
				VALUES ('production', 'jpcalendar_Config', 'Configurazione Calendario', 
				'<calendarConfig>
				<contentType code="<CONTENT_TYPE_ID>" />
				<dateAttributes>
				<start name="<START_DATE_ATTRIBUTE>" />
				<end name="<END_DATE_ATTRIBUTE>" />
				</dateAttributes>
				</calendarConfig>');
			
			

Example 4.1. Configuration example

Suppose that you have inside the portal the following contentType

			
		    <contenttype typecode="EVN" typedescr="Evento" viewpage="newsview" 
		    listmodel="12" defaultmodel="2">
			<attributes>
			    <attribute name="DataInizio" attributetype="Date" indexingtype="text" 
			    searcheable="true" required="true" />
			    <attribute name="DataFine" attributetype="Date" indexingtype="text" 
			    searcheable="true" required="true" />
			    <attribute name="Luogo" attributetype="Longtext" indexingtype="text" 
			    searcheable="true"/>
			    <attribute name="Oggetto" attributetype="Hypertext" indexingtype="text" 
			    searcheable="true"/>
			    <attribute name="CorpoTesto" attributetype="Hypertext" 
			    indexingtype="text" searcheable="true"/>
			    <attribute name="Immagine" attributetype="Image"/>
			    <list name="ListaLinkCorrelati" attributetype="Monolist" 
			    nestedtype="Link"/>
			    <list name="ListaAllegati" attributetype="Monolist" aaaa
			    nestedtype="Attach"/>
			</attributes>
		    </contenttype>			
			
			

The query will be:

			
				INSERT INTO sysconfig (version, item, descr, config) 
				VALUES ('production', 'jpcalendar_Config', 'Configurazione Calendario', 
				'<calendarConfig>
				<contentType code="EVN" />
				<dateAttributes>
				<start name="DataInizio" />
				<end name="DataFine" />
				</dateAttributes>
				</calendarConfig>');
			
			


in the table showletcatalog in the db portalNamePort, create the showlet records.

			
		INSERT INTO showletcatalog(
            code, titles, parameters, plugincode, parenttypecode, defaultconfig, locked)
    		VALUES ('jpcalendar_calendar', '<?xml version="1.0" encoding="UTF-8"?>
			<properties>
			<property key="en">Calendar</property>
			<property key="it">Calendario</property>
			</properties>', NULL, 'jpcalendar', NULL, NULL, 1);
		INSERT INTO showletcatalog(
            code, titles, parameters, plugincode, parenttypecode, defaultconfig, locked)
    		VALUES ('jpcalendar_dailyEvents', '<?xml version="1.0" encoding="UTF-8"?>
			<properties>
			<property key="en">Events of the Day</property>
			<property key="it">Eventi del giorno</property>
			</properties>', NULL, 'jpcalendar', NULL, NULL, 1);
			

Configuration pages

To use the jpcalendar plugin you need to create a page containing the showlet jpcalendar_calendar and one other page containing the showlet jpcalendar_dailyEvents. The showlet jpcalendar_calendar need to be suitably modified:

Example 4.2. Example of changing the showlet jpcalendar_calendar.jsp

in the original jpcalendar_calendar.jsp, change

			
		    <c:if test="${giorno.hasEvents}">
		    	<a href="<wp:url page="codice_pagina_eventi_del_giorno" >...		
			
			

With:

			
				<c:if test="${giorno.hasEvents}"><a href="<wp:url page="listaEventi" >
			
			


The page listaEventi must contain the showlet Events of the Day (jpcalendar_dailyEvents.jsp). It's possibly to customize the label used by the tag “wp:i18n”.

In the row

				<wp:content contentId="${content}" modelId="XX"/>
				

of the page Events of the Day configure the proper modelId (XX) for the list view of events.