Commit 166b3e6a by nilu

list and edit notification screens

parent db8c7c5b
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au"><NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_notification_template</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="notification_type" type="String" nullable="false" length="200"/>
<column name="days_after" type="Long" nullable="false"/>
<column name="notification_content" type="CLOB" nullable="false"/>
</NODE>
</NODE></OBJECTS>
\ No newline at end of file
-- DROP TABLE tl_notification_template;
CREATE TABLE tl_notification_template (
object_id int NOT NULL ,
object_last_updated_date datetime DEFAULT getdate() NOT NULL ,
object_created_date datetime DEFAULT getdate() NOT NULL
,
notification_type varchar(200) NOT NULL,
days_after numeric(12) NOT NULL,
notification_content text NOT NULL
);
ALTER TABLE tl_notification_template ADD
CONSTRAINT PK_tl_notification_template PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- DROP TABLE tl_notification_template;
CREATE TABLE tl_notification_template (
object_id number(12) NOT NULL ,
object_last_updated_date date DEFAULT SYSDATE NOT NULL ,
object_created_date date DEFAULT SYSDATE NOT NULL
,
notification_type varchar2(200) NOT NULL,
days_after number(12) NOT NULL,
notification_content clob NOT NULL
);
ALTER TABLE tl_notification_template ADD
CONSTRAINT PK_tl_notification_template PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
-- @AutoRun
-- drop table tl_notification_template;
CREATE TABLE tl_notification_template (
object_id numeric(12) NOT NULL ,
object_last_updated_date timestamp DEFAULT NOW() NOT NULL ,
object_created_date timestamp DEFAULT NOW() NOT NULL
,
notification_type varchar(200) NOT NULL,
days_after numeric(12) NOT NULL,
notification_content text NOT NULL
);
ALTER TABLE tl_notification_template ADD
CONSTRAINT pk_tl_notification_template PRIMARY KEY
(
object_id
) ;
\ No newline at end of file
package performa.orm;
import java.io.*;
import java.util.*;
import oneit.appservices.config.*;
import oneit.logging.*;
import oneit.objstore.*;
import oneit.utils.*;
import performa.orm.types.*;
import performa.orm.*;
public class NotificationTemplate extends BaseNotificationTemplate
{
private static final long serialVersionUID = 0L;
// This constructor should not be called
public NotificationTemplate ()
{
// Do not add any code to this, always put it in initialiseNewObject
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<BUSINESSCLASS name="NotificationTemplate" package="performa.orm">
<IMPORT value="performa.orm.types.*"/>
<IMPORT value="performa.orm.*"/>
<TABLE name="tl_notification_template" tablePrefix="object" polymorphic="FALSE">
<ATTRIB name="NotificationType" type="NotificationType" dbcol="notification_type" mandatory="true" defaultValue="NotificationType.TRIAL" attribHelper="EnumeratedAttributeHelper" />
<ATTRIB name="DaysAfter" type="Integer" dbcol="days_after" mandatory="true" defaultValue="0" />
<ATTRIB name="NotificationContent" type="String" dbcol="notification_content" mandatory="true" />
</TABLE>
<SEARCH type="All" paramFilter="tl_notification_template.object_id is not null" />
</BUSINESSCLASS>
</ROOT>
\ No newline at end of file
package performa.orm.types;
import java.util.*;
import oneit.utils.*;
/**
* This class was generated using constGen.bat.
* DO NOT MODIFY THIS CODE.
* Edit the associated .xml file, and regenerate this file
* constGen (directory) (file minus extension)
* e.g. constGen C:\...\sql FieldType
*/
public class NotificationType extends AbstractEnumerated
{
public static final EnumeratedFactory FACTORY_NotificationType = new NotificationTypeFactory();
public static final NotificationType CLOSED_JOB = new NotificationType ("CLOSED_JOB", "CLOSED_JOB", "Closed Job", false);
public static final NotificationType TRIAL = new NotificationType ("TRIAL", "TRIAL", "Trial", false);
private static final NotificationType[] allNotificationTypes =
new NotificationType[] { CLOSED_JOB,TRIAL};
private static NotificationType[] getAllNotificationTypes ()
{
return allNotificationTypes;
}
private NotificationType (String name, String value, String description, boolean disabled)
{
super (name, value, description, disabled);
}
public static final Comparator COMPARE_BY_POSITION = new CompareEnumByPosition (allNotificationTypes);
static
{
defineAdditionalData ();
}
public boolean isEqual (NotificationType other)
{
return this.name.equals (other.name);
}
public Enumeration getAllInstances ()
{
return NotificationType.getAll ();
}
private Object readResolve() throws java.io.ObjectStreamException
{
return NotificationType.forName (this.name);
}
public EnumeratedFactory getFactory ()
{
return FACTORY_NotificationType;
}
public static NotificationType forName (String name)
{
if (name == null) { return null; }
NotificationType[] all = getAllNotificationTypes();
int enumIndex = AbstractEnumerated.getIndexForName (all, name);
return all[enumIndex];
}
public static NotificationType forValue (String value)
{
if (value == null) { return null; }
NotificationType[] all = getAllNotificationTypes();
int enumIndex = AbstractEnumerated.getIndexForValue (getAllNotificationTypes (), value);
return all[enumIndex];
}
public static java.util.Enumeration getAll ()
{
return AbstractEnumerated.getAll (getAllNotificationTypes());
}
public static NotificationType[] getNotificationTypeArray ()
{
return (NotificationType[])getAllNotificationTypes().clone ();
}
public static void defineAdditionalData ()
{
}
static class NotificationTypeFactory implements EnumeratedFactory
{
public AbstractEnumerated getForName (String name)
{
return NotificationType.forName (name);
}
public AbstractEnumerated getForValue (String name)
{
return NotificationType.forValue (name);
}
public Enumeration getAll ()
{
return NotificationType.getAll ();
}
}
public Map getAdditionalAttributes ()
{
Map attribs = new HashMap ();
return attribs;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<ROOT>
<CONSTANT package="performa.orm.types" name="NotificationType">
<VALUE name="CLOSED_JOB" value="CLOSED_JOB" description="Closed Job"/>
<VALUE name="TRIAL" value="TRIAL" description="Trial" />
</CONSTANT>
</ROOT>
......@@ -28,6 +28,14 @@
<INHERITS factory="Named" nodename="CoreORMAdmin"/>
</NODE>
<NODE name="editNotificationTemplate_jsp" factory="Participant">
<INHERITS factory="Named" nodename="CoreORMAdmin"/>
</NODE>
<NODE name="listNotificationTemplates_jsp" factory="Participant">
<INHERITS factory="Named" nodename="CoreORMAdmin"/>
</NODE>
<NODE name="test_imap_jsp" factory="Participant">
<INHERITS factory="Named" nodename="CoreORMAdmin"/>
<FORM name="*.runEmailFetcher" factory="Participant" class="performa.form.RunEmailFetcherFP"/>
......
......@@ -8,8 +8,9 @@
<!-- <TOPMENU name="MENU.TEST_ANALYSIS" desc="Test Analysis" sortOrder="100" factory="Participant" class="oneit.servlets.jsp.ui.DefaultUICustomiser$Element"
link="/extensions/performa/testAnalysis.jsp"/> -->
<CHILD name="Performa.SetupPlans" desc="Setup Plans" sortOrder="10" toplevel="ADMIN" priv="admin" link="/extensions/performa/setupPlans.jsp" factory="Participant" class="oneit.servlets.jsp.ui.DefaultUICustomiser$Element" />
<CHILD name="Performa.MessageTemplate" desc="Message Template" sortOrder="20" toplevel="ADMIN" priv="admin" link="/extensions/performa/listMessageTemplate.jsp" factory="Participant" class="oneit.servlets.jsp.ui.DefaultUICustomiser$Element" />
<CHILD name="Performa.SetupPlans" desc="Setup Plans" sortOrder="10" toplevel="ADMIN" priv="admin" link="/extensions/performa/setupPlans.jsp" factory="Participant" class="oneit.servlets.jsp.ui.DefaultUICustomiser$Element" />
<CHILD name="Performa.MessageTemplate" desc="Message Template" sortOrder="20" toplevel="ADMIN" priv="admin" link="/extensions/performa/listMessageTemplate.jsp" factory="Participant" class="oneit.servlets.jsp.ui.DefaultUICustomiser$Element" />
<CHILD name="Performa.NotificationTemplate" desc="Notification Template" sortOrder="30" toplevel="ADMIN" priv="admin" link="/extensions/performa/listNotificationTemplates.jsp" factory="Participant" class="oneit.servlets.jsp.ui.DefaultUICustomiser$Element" />
</NODE>
</NODE>
......
......@@ -18,11 +18,6 @@
%><%@include file="/saferedirect.jsp"%><%
}
if (toRedirect)
{
%><%@include file="/saferedirect.jsp"%><%
}
Debug.assertion(messageTemplate != null, "MessageTemplate is null in Edit Message Template", "404");
String continuePage = "editMessageTemplate.jsp?MessageTemplateID=" + messageTemplate.getObjectID();
......
<%@ page extends="oneit.servlets.jsp.FormJSP" %>
<%@ include file="/setuprequest.jsp" %>
<%@ include file="inc/stdimports.jsp" %>
<%@ include file="/editor/stdimports.jsp" %>
<%@ page import="oneit.business.content.editor.gui.*" %>
<%! protected String getName (ServletConfig config) { return "editNotificationTemplate_jsp"; } %>
<%
ORMProcessState process = (ORMProcessState) ProcessDecorator.getDefaultProcess(request);
ObjectTransaction objTran = process.getTransaction ();
boolean toRedirect = GenericObjDF.getOrCreateObject (request, "NotificationTemplate", NotificationTemplate.REFERENCE_NotificationTemplate);
NotificationTemplate notificationTemplate = (NotificationTemplate) process.getAttribute("NotificationTemplate");
if (toRedirect)
{
%><%@include file="/saferedirect.jsp"%><%
}
Debug.assertion(notificationTemplate != null, "NotificationTemplate is null in Edit Notification Template", "404");
String continuePage = "editNotificationTemplate.jsp?NotificationTemplateID=" + notificationTemplate.getObjectID();
request.setAttribute("oneit.pageFormDetails", CollectionUtils.mapEntry("name", "NotificationTemplate").mapEntry("enctype", "multipart/form-data").toMap());
request.setAttribute("oneit.pageHeaderTitle", "Notification Template");
%>
<%@include file="/editor/header.jsp" %>
<oneit:layout_total widths="<%= new double[] {2, 6, 4} %>" skin="bootstrap">
<oneit:skin tagName="layout_row">
<oneit:layout_label width="1">
<oneit:ormlabel obj="<%= notificationTemplate %>" field="DaysAfter"/>
</oneit:layout_label>
<oneit:layout_field width="1">
<oneit:ormInput obj="<%= notificationTemplate %>" attributeName="DaysAfter"/>
</oneit:layout_field>
</oneit:skin>
<oneit:skin tagName="layout_row">
<oneit:layout_label width="1">
<oneit:ormlabel obj="<%= notificationTemplate %>" field="NotificationContent"/>
</oneit:layout_label>
<oneit:layout_field width="1">
<tagfile:htmleditor obj="<%= notificationTemplate %>" attribName="NotificationContent" id="texteditor"
toolbarSet="<%= EditorGUIOptions.Default %>"/>
</oneit:layout_field>
</oneit:skin>
</oneit:layout_total>
<div class="bottomButtons" hidden="true">
<oneit:button value="Save" name="save" cssClass="BUTTON_PRIMARY"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", "listNotificationTemplates.jsp").toMap() %>"/>
<oneit:button value="Cancel" name="cancel" cssClass="BUTTON_SECONDARY" showIfReadOnly="true"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", "listNotificationTemplates.jsp")
.mapEntry (UpdateMappedObjFP.FAIL_VALIDATION_ERRORS, Boolean.FALSE)
.toMap() %>"/>
</div>
<%@include file="/editor/footer.jsp" %>
\ No newline at end of file
<%@ page extends="oneit.servlets.jsp.FormJSP" %>
<%@ include file="/setuprequest.jsp" %>
<%@ include file="inc/stdimports.jsp" %>
<%@ include file="/editor/stdimports.jsp" %>
<%@ page import="oneit.utils.filter.CollectionFilter"%>
<%! protected String getName (ServletConfig config) { return "listNotificationTemplates_jsp"; } %>
<%
ORMProcessState process = (ORMProcessState) ProcessDecorator.getDefaultProcess(request);
ObjectTransaction objTran = process.getTransaction ();
NotificationTemplate[] notificationTemplates = NotificationTemplate.SearchByAll().search(objTran);
process.setAttribute ("NotificationTemplates", notificationTemplates);
request.setAttribute("oneit.pageFormDetails", CollectionUtils.mapEntry("name", "listNotificationTemplate").mapEntry("enctype", "multipart/form-data").toMap());
request.setAttribute("oneit.pageHeaderTitle", "List Notification Template");
%>
<%@include file="/editor/header.jsp" %>
<style>
.tbl-width{width:50%}
</style>
<%
if (notificationTemplates != null && notificationTemplates.length > 0)
{
List<NotificationTemplate> closedJob = (List<NotificationTemplate>) CollectionFilter.filter(Arrays.asList(notificationTemplates), NotificationTemplate.SearchByAll().andNotificationType(new EqualsFilter<>(NotificationType.CLOSED_JOB)));
if(closedJob != null && !closedJob.isEmpty())
{
%>
<oneit:skin tagName="layout_fieldset" legend="Closed Job Notification Settings">
<oneit:skin tagName="layout_search_results">
<oneit:table name="NotificationTemplateTable" sortable="true" cssClass="cougartable tbl-width" notgrid="true">
<oneit:colheader label="Days After" width="16" />
<oneit:colheader label="Notification Content" width="80" />
<oneit:colheader label="" width="4" cssClass="nosort nofilter" />
<%
for (NotificationTemplate notTemp : closedJob)
{
%>
<oneit:row rowObj="<%= notTemp %>">
<oneit:col><oneit:toString value="<%= notTemp.getDaysAfter() %>" mode="Integer" /></oneit:col>
<oneit:col><oneit:toString value="<%= notTemp.getNotificationContent() %>" mode="TidyHTML" /></oneit:col>
<oneit:col><a class="data-link " href="editNotificationTemplate.jsp?NotificationTemplateID=<%= notTemp.getObjectID() %>">>></a></oneit:col>
</oneit:row>
<%
}
%>
</oneit:table>
</oneit:skin>
</oneit:skin>
<%
}
List<NotificationTemplate> trial = (List<NotificationTemplate>) CollectionFilter.filter(Arrays.asList(notificationTemplates), NotificationTemplate.SearchByAll().andNotificationType(new EqualsFilter<>(NotificationType.TRIAL)));
if(trial != null && !trial.isEmpty())
{
%>
<oneit:skin tagName="layout_fieldset" legend="Trial Notification Settings">
<oneit:skin tagName="layout_search_results">
<oneit:table name="NotificationTemplateTable" sortable="true" cssClass="cougartable tbl-width" notgrid="true">
<oneit:colheader label="Days After" width="16" />
<oneit:colheader label="Notification Content" width="80" />
<oneit:colheader label="" width="4" cssClass="nosort nofilter" />
<%
for (NotificationTemplate notTemp : trial)
{
%>
<oneit:row rowObj="<%= notTemp %>">
<oneit:col><oneit:toString value="<%= notTemp.getDaysAfter() %>" mode="Integer" /></oneit:col>
<oneit:col><oneit:toString value="<%= notTemp.getNotificationContent() %>" mode="TidyHTML" /></oneit:col>
<oneit:col><a class="data-link " href="editNotificationTemplate.jsp?NotificationTemplateID=<%= notTemp.getObjectID() %>">>></a></oneit:col>
</oneit:row>
<%
}
%>
</oneit:table>
<oneit:button value="Add Trial Notification Template" cssClass="btn-primary" name="gotoPage"
requestAttribs="<%= CollectionUtils.mapEntry("nextPage", "editNotificationTemplate.jsp")
.mapEntry("ignoreProcess", Boolean.TRUE)
.toMap() %>" />
</oneit:skin>
</oneit:skin>
<%
}
}
%>
<%@include file="/editor/footer.jsp" %>
\ No newline at end of file
<?xml version="1.0"?>
<!-- @AutoRun -->
<OBJECTS name="">
<NODE name="Script" factory="Vector">
<NODE name='insertOp' factory='Participant' class='oneit.sql.transfer.InsertOperation'>
<tableName factory='String'>tl_notification_template</tableName>
<value name='object_id' factory='Participant' class='oneit.sql.transfer.DBTransferer$ObjectID'/>
<value name='object_last_updated_date' class='oneit.sql.transfer.DBTransferer$Timestamp'/>
<value name='object_created_date' class='oneit.sql.transfer.DBTransferer$Timestamp'/>
<value name='notification_type' factory='String'>CLOSED_JOB</value>
<value name='days_after' factory='Integer'>14</value>
<value name='notification_content' factory='String'>Please shortlist job applications</value>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!-- @AutoRun -->
<OBJECTS name="" xmlns:oneit="http://www.1iT.com.au">
<NODE name="Script" factory="Vector">
<NODE name="DDL" factory="Participant" class="oneit.sql.transfer.DefineTableOperation">
<tableName factory="String">tl_notification_template</tableName>
<column name="object_id" type="Long" nullable="false" length="11"/>
<column name="object_last_updated_date" type="Date" nullable="false" length="22"/>
<column name="object_created_date" type="Date" nullable="false" length="22"/>
<column name="notification_type" type="String" nullable="false" length="200"/>
<column name="days_after" type="Long" nullable="false"/>
<column name="notification_content" type="CLOB" nullable="false"/>
</NODE>
</NODE>
</OBJECTS>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment