Author: solomax
Date: Thu Nov 27 07:21:38 2014
New Revision: 1642040
URL: http://svn.apache.org/r1642040
Log:
[OPENMEETINGS-1130] email creation is moved to templates
Added:
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/AbstractAppointmentTemplate.java
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CanceledAppointmentTemplate.html
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CanceledAppointmentTemplate.java
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CreatedAppointmentTemplate.html
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CreatedAppointmentTemplate.java
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/UpdatedAppointmentTemplate.html
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/UpdatedAppointmentTemplate.java
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/AbstractAppointmentTemplate.java
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CanceledAppointmentTemplate.html
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CanceledAppointmentTemplate.java
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.html
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.java
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/UpdatedAppointmentTemplate.html
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/UpdatedAppointmentTemplate.java
Modified:
openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/data/conference/InvitationManager.java
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/InvitationTemplate.html
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/InvitationTemplate.java
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/EmailManager.java
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/FeedbackTemplate.java
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/InvitationTemplate.html
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/InvitationTemplate.java
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactTemplate.java
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java
Modified:
openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/data/conference/InvitationManager.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/data/conference/InvitationManager.java?rev=1642040&r1=1642039&r2=1642040&view=diff
==============================================================================
---
openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/data/conference/InvitationManager.java
(original)
+++
openmeetings/branches/3.0.x/src/main/java/org/apache/openmeetings/data/conference/InvitationManager.java
Thu Nov 27 07:21:38 2014
@@ -42,12 +42,15 @@ import org.apache.openmeetings.db.entity
import org.apache.openmeetings.db.util.TimezoneUtil;
import org.apache.openmeetings.mail.MailHandler;
import org.apache.openmeetings.mail.SMSHandler;
-import org.apache.openmeetings.util.CalendarPatterns;
import org.apache.openmeetings.util.LinkHelper;
import org.apache.openmeetings.util.crypt.MD5;
import org.apache.openmeetings.util.crypt.ManageCryptStyle;
import org.apache.openmeetings.util.mail.IcalHandler;
+import org.apache.openmeetings.web.mail.template.AbstractAppointmentTemplate;
+import org.apache.openmeetings.web.mail.template.CanceledAppointmentTemplate;
+import org.apache.openmeetings.web.mail.template.CreatedAppointmentTemplate;
import org.apache.openmeetings.web.mail.template.InvitationTemplate;
+import org.apache.openmeetings.web.mail.template.UpdatedAppointmentTemplate;
import org.apache.wicket.util.string.Strings;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
@@ -195,118 +198,6 @@ public class InvitationManager implement
}
}
- private String formatSubject(Long langId, Appointment a, TimeZone tz) {
- String message = fieldManager.getString(1151L, langId) + " " +
a.getTitle();
-
- message += " "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz);
-
- message += " - "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz);
-
- return message;
- }
-
- private String formatMessage(Long langId, Appointment a, TimeZone tz,
String invitorName) {
- String message = fieldManager.getString(1151L, langId) + " " +
a.getTitle();
-
- if (!Strings.isEmpty(a.getDescription())) {
- message += fieldManager.getString(1152L, langId) +
a.getDescription();
- }
-
- message += "<br/>"
- + fieldManager.getString(1153L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)
- + "<br/>";
-
- message += fieldManager.getString(1154L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz) +
"<br/>";
-
- message += fieldManager.getString(1156L, langId) + invitorName
+ "<br/>";
-
- return message;
- }
-
- private String formatCancelSubject(Long langId, Appointment a, TimeZone
tz) {
- String message = fieldManager.getString(1157L, langId) +
a.getTitle();
-
- message += " "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)
- + " - "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz);
-
- return message;
- }
-
- private String formatCancelMessage(Long langId, Appointment a, TimeZone
tz, String invitorName) {
- try {
- String message = fieldManager.getString(1157L, langId)
+ a.getTitle();
-
- if (!Strings.isEmpty(a.getDescription())) {
- message += fieldManager.getString(1152L,
langId) + a.getDescription();
- }
-
- message += "<br/>"
- + fieldManager.getString(1153L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)
- + "<br/>";
-
- message += fieldManager.getString(1154L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)
- + "<br/>";
-
- message += fieldManager.getString(1156L, langId) +
invitorName + "<br/>";
-
- return message;
- } catch (Exception err) {
- log.error("Could not format cancel message", err);
- return "Error formatCancelMessage";
- }
- }
-
- private String formatUpdateSubject(Long langId, Appointment a, TimeZone
tz) {
- String message = fieldManager.getString(1155L, langId) + " " +
a.getTitle();
-
- message += " "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)
- + " - "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz);
-
- return message;
- }
-
- private String formatUpdateMessage(Long langId, Appointment a, TimeZone
tz, String invitorName) {
- try {
- String message = fieldManager.getString(1155L, langId)
+ " " + a.getTitle();
-
- if (!Strings.isEmpty(a.getDescription())) {
- message += fieldManager.getString(1152L,
langId) + a.getDescription();
- }
-
- message += "<br/>"
- + fieldManager.getString(1153L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)
- + "<br/>";
-
- message += fieldManager.getString(1154L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)
- + "<br/>";
-
- message += fieldManager.getString(1156L, langId) +
invitorName + "<br/>";
-
- return message;
- } catch (Exception err) {
- log.error("Could not format update message", err);
- return "Error formatUpdateMessage";
- }
- }
-
/**
* @author vasya
*
@@ -321,34 +212,29 @@ public class InvitationManager implement
String invitorName = owner.getFirstname() + " " +
owner.getLastname();
Long langId = mm.getUser().getLanguage_id();
TimeZone tz = timezoneUtil.getTimeZone(mm.getUser());
- String subject = null;
- String message = null;
+ AbstractAppointmentTemplate t = null;
switch (type) {
case Cancel:
- subject = formatCancelSubject(langId, a, tz);
- message = formatCancelMessage(langId, a, tz,
invitorName);
+ t = new CanceledAppointmentTemplate(langId, a,
tz, invitorName);
break;
case Create:
- subject = formatSubject(langId, a, tz);
- message = formatMessage(langId, a, tz,
invitorName);
+ t = new CreatedAppointmentTemplate(langId, a,
tz, invitorName);
break;
case Update:
default:
- subject = formatUpdateSubject(langId, a, tz);
- message = formatUpdateMessage(langId, a, tz,
invitorName);
+ t = new UpdatedAppointmentTemplate(langId, a,
tz, invitorName);
break;
}
- sendInvitionLink(mm.getInvitation(), type, subject, message,
ical);
+ sendInvitionLink(mm.getInvitation(), type, t.getSubject(),
t.getEmail(), ical);
}
public void sendInvitionLink(Invitation i, MessageType type, String
subject, String message, boolean ical) throws Exception {
- String invitation_link =
LinkHelper.getInvitationLink(configDao.getBaseUrl(), i);
+ String invitation_link = type == MessageType.Cancel ? null :
LinkHelper.getInvitationLink(configDao.getBaseUrl(), i);
User owner = i.getInvitedBy();
String invitorName = owner.getFirstname() + " " +
owner.getLastname();
- boolean isCanceled = (type==MessageType.Cancel);
- String template =
InvitationTemplate.getEmail(i.getInvitee().getLanguage_id(), invitorName,
message, invitation_link, isCanceled);
+ String template = new
InvitationTemplate(i.getInvitee().getLanguage_id(), invitorName, message,
invitation_link).getEmail();
String email = i.getInvitee().getAdresses().getEmail();
String replyToEmail = owner.getAdresses().getEmail();
Added:
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/AbstractAppointmentTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/AbstractAppointmentTemplate.java?rev=1642040&view=auto
==============================================================================
---
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/AbstractAppointmentTemplate.java
(added)
+++
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/AbstractAppointmentTemplate.java
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,26 @@
+package org.apache.openmeetings.web.mail.template;
+
+import java.util.TimeZone;
+
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+
+public abstract class AbstractAppointmentTemplate extends
AbstractTemplatePanel {
+ private static final long serialVersionUID = 1L;
+ protected long langId;
+ protected Appointment a;
+ protected TimeZone tz;
+
+ public AbstractAppointmentTemplate(Long langId, Appointment a, TimeZone
tz, String invitorName) {
+ super(TemplatePage.COMP_ID);
+ this.langId = langId == null ? 1 : langId;
+ this.a = a;
+ this.tz = tz;
+ ensureApplication(langId);
+ }
+
+ public String getEmail() {
+ return renderPanel(this).toString();
+ }
+
+ public abstract String getSubject();
+}
Added:
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CanceledAppointmentTemplate.html
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CanceledAppointmentTemplate.html?rev=1642040&view=auto
==============================================================================
---
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CanceledAppointmentTemplate.html
(added)
+++
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CanceledAppointmentTemplate.html
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+<wicket:panel>
+ <span wicket:id="titleLbl"></span> <span wicket:id="title"></span>
+ <div wicket:id="descContainer">
+ <span wicket:id="descLbl"></span> <span
wicket:id="desc"></span>
+ </div>
+ <br/>
+ <span wicket:id="startLbl"></span> <span
wicket:id="start"></span><br/>
+ <span wicket:id="endLbl"></span> <span wicket:id="end"></span><br/>
+ <span wicket:id="invitorLbl"></span> <span
wicket:id="invitor"></span><br/>
+</wicket:panel>
+</html>
Added:
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CanceledAppointmentTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CanceledAppointmentTemplate.java?rev=1642040&view=auto
==============================================================================
---
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CanceledAppointmentTemplate.java
(added)
+++
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CanceledAppointmentTemplate.java
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.web.mail.template;
+
+import static org.apache.openmeetings.web.app.Application.getBean;
+
+import java.util.TimeZone;
+
+import org.apache.openmeetings.db.dao.label.FieldLanguagesValuesDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.util.CalendarPatterns;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.util.string.Strings;
+
+public class CanceledAppointmentTemplate extends AbstractAppointmentTemplate {
+ private static final long serialVersionUID = 1L;
+
+ public CanceledAppointmentTemplate(Long langId, Appointment a, TimeZone
tz, String invitorName) {
+ super(langId, a, tz, invitorName);
+
+ FieldLanguagesValuesDao dao =
getBean(FieldLanguagesValuesDao.class);
+ add(new Label("titleLbl", dao.getString(1157L, langId)));
+ add(new Label("title", a.getTitle()));
+ add(new WebMarkupContainer("descContainer")
+ .add(new Label("descLbl", dao.getString(1152L, langId)))
+ .add(new Label("desc", a.getDescription()))
+ .setVisible(!Strings.isEmpty(a.getDescription()))
+ );
+ add(new Label("startLbl", dao.getString(1153L, langId)));
+ add(new Label("start",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)));
+ add(new Label("endLbl", dao.getString(1154L, langId)));
+ add(new Label("end",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)));
+ add(new Label("invitorLbl", dao.getString(1156L, langId)));
+ add(new Label("invitor", invitorName));
+ }
+
+ @Override
+ public String getSubject() {
+ FieldLanguagesValuesDao dao =
getBean(FieldLanguagesValuesDao.class);
+ StringBuilder sb = new StringBuilder();
+ sb.append(dao.getString(1157L, langId)).append("
").append(a.getTitle())
+ .append("
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(),
tz))
+ .append(" -
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(),
tz));
+
+ return sb.toString();
+ }
+}
Added:
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CreatedAppointmentTemplate.html
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CreatedAppointmentTemplate.html?rev=1642040&view=auto
==============================================================================
---
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CreatedAppointmentTemplate.html
(added)
+++
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CreatedAppointmentTemplate.html
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+<wicket:panel>
+ <span wicket:id="titleLbl"></span> <span wicket:id="title"></span>
+ <div wicket:id="descContainer">
+ <span wicket:id="descLbl"></span> <span
wicket:id="desc"></span>
+ </div>
+ <br/>
+ <span wicket:id="startLbl"></span> <span
wicket:id="start"></span><br/>
+ <span wicket:id="endLbl"></span> <span wicket:id="end"></span><br/>
+ <span wicket:id="invitorLbl"></span> <span
wicket:id="invitor"></span><br/>
+</wicket:panel>
+</html>
Added:
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CreatedAppointmentTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CreatedAppointmentTemplate.java?rev=1642040&view=auto
==============================================================================
---
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CreatedAppointmentTemplate.java
(added)
+++
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/CreatedAppointmentTemplate.java
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.web.mail.template;
+
+import static org.apache.openmeetings.web.app.Application.getBean;
+
+import java.util.TimeZone;
+
+import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
+import org.apache.openmeetings.db.dao.label.FieldLanguagesValuesDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.util.CalendarPatterns;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.util.string.Strings;
+
+public class CreatedAppointmentTemplate extends AbstractAppointmentTemplate {
+ private static final long serialVersionUID = 1L;
+
+ private String getTitleLbl(FieldLanguagesValuesDao dao) {
+ return dao.getString(1151L, langId).replaceAll("\\$APP_NAME",
getBean(ConfigurationDao.class).getAppName());
+ }
+
+ public CreatedAppointmentTemplate(Long langId, Appointment a, TimeZone
tz, String invitorName) {
+ super(langId, a, tz, invitorName);
+
+ FieldLanguagesValuesDao dao =
getBean(FieldLanguagesValuesDao.class);
+ add(new Label("titleLbl", getTitleLbl(dao)));
+ add(new Label("title", a.getTitle()));
+ add(new WebMarkupContainer("descContainer")
+ .add(new Label("descLbl", dao.getString(1152L, langId)))
+ .add(new Label("desc", a.getDescription()))
+ .setVisible(!Strings.isEmpty(a.getDescription()))
+ );
+ add(new Label("startLbl", dao.getString(1153L, langId)));
+ add(new Label("start",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)));
+ add(new Label("endLbl", dao.getString(1154L, langId)));
+ add(new Label("end",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)));
+ add(new Label("invitorLbl", dao.getString(1156L, langId)));
+ add(new Label("invitor", invitorName));
+ }
+
+ @Override
+ public String getSubject() {
+ FieldLanguagesValuesDao dao =
getBean(FieldLanguagesValuesDao.class);
+ StringBuilder sb = new StringBuilder();
+ sb.append(getTitleLbl(dao)).append(" ").append(a.getTitle())
+ .append("
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(),
tz))
+ .append(" -
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(),
tz));
+
+ return sb.toString();
+ }
+}
Modified:
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/InvitationTemplate.html
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/InvitationTemplate.html?rev=1642040&r1=1642039&r2=1642040&view=diff
==============================================================================
---
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/InvitationTemplate.html
(original)
+++
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/InvitationTemplate.html
Thu Nov 27 07:21:38 2014
@@ -20,14 +20,15 @@
-->
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
- <b><wicket:ommessage key="500"/></b><br />
- <wicket:ommessage key="501"/> <span wicket:id="user"></span><br/>
- <wicket:ommessage key="502"/> <span wicket:id="message"></span><br/>
-
- <span wicket:id="comment_for_link1"></span><br/>
- <a wicket:id="invitation_link1"><wicket:ommessage key="504"/></a><br/>
- <br/><br/>
- <span wicket:id="comment_for_link2"></span><br/>
- <span wicket:id="invitation_link2"></span>
+ <b><span wicket:id="titleLbl"></span></b><br />
+ <span wicket:id="userLbl"></span> <span wicket:id="user"></span><br/>
+ <span wicket:id="messageLbl"></span> <span
wicket:id="messageLbl"></span><br/>
+ <div wicket:id="links">
+ <span wicket:id="comment_for_link1"></span><br/>
+ <a wicket:id="invitation_link1"><span
wicket:id="clickMe"></span></a><br/>
+ <br/><br/>
+ <span wicket:id="comment_for_link2"></span><br/>
+ <span wicket:id="invitation_link2"></span>
+ </div>
</wicket:panel>
-</html>
\ No newline at end of file
+</html>
Modified:
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/InvitationTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/InvitationTemplate.java?rev=1642040&r1=1642039&r2=1642040&view=diff
==============================================================================
---
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/InvitationTemplate.java
(original)
+++
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/InvitationTemplate.java
Thu Nov 27 07:21:38 2014
@@ -18,37 +18,37 @@
*/
package org.apache.openmeetings.web.mail.template;
-import org.apache.openmeetings.web.app.WebSession;
+import static org.apache.openmeetings.web.app.Application.getBean;
+
+import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
+import org.apache.openmeetings.db.dao.label.FieldLanguagesValuesDao;
+import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.ExternalLink;
public class InvitationTemplate extends AbstractTemplatePanel {
private static final long serialVersionUID = 1L;
- public InvitationTemplate(String id, String user, String message,
String link, boolean isCanceled) {
- super(id);
- add(new Label("user", user));
+ public InvitationTemplate(Long langId, String invitorName, String
message, String link) {
+ super(TemplatePage.COMP_ID);
+ ensureApplication(langId);
+
+ FieldLanguagesValuesDao dao =
getBean(FieldLanguagesValuesDao.class);
+ add(new Label("titleLbl", dao.getString(500,
langId).replaceAll("\\$APP_NAME",
getBean(ConfigurationDao.class).getAppName())));
+ add(new Label("userLbl", dao.getString(501, langId)));
+ add(new Label("user", invitorName));
add(new Label("message", message).setEscapeModelStrings(false));
- Label commentForLink1 = new Label("comment_for_link1",
WebSession.getString(503));
- commentForLink1.setVisible(!isCanceled);
- add(commentForLink1);
- ExternalLink externalLink1 = new
ExternalLink("invitation_link1", link);
- externalLink1.setVisible(!isCanceled);
- add(externalLink1);
- Label commentForLink2 = new Label("comment_for_link2",
WebSession.getString(505));
- commentForLink2.setVisible(!isCanceled);
- add(commentForLink2);
- Label externalLink2 = new Label("invitation_link2", link);
-
externalLink2.setEscapeModelStrings(false).setVisible(!isCanceled);
- add(externalLink2);
+
+ add(new WebMarkupContainer("links")
+ .add(new Label("comment_for_link1", dao.getString(503,
langId)))
+ .add(new ExternalLink("invitation_link1", link).add(new
Label("clickMe", dao.getString(504, langId))))
+ .add(new Label("comment_for_link2", dao.getString(505,
langId)))
+ .add(new Label("invitation_link2", link))
+ .setVisible(link != null)
+ );
}
- public static String getEmail(String user, String message, String link)
{
- return getEmail(-1, user, message, link, false);
- }
-
- public static String getEmail(long langId, String user, String message,
String link, boolean isCanceled) {
- ensureApplication(langId);
- return renderPanel(new InvitationTemplate(TemplatePage.COMP_ID,
user, message, link, isCanceled)).toString();
+ public String getEmail() {
+ return renderPanel(this).toString();
}
}
Added:
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/UpdatedAppointmentTemplate.html
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/UpdatedAppointmentTemplate.html?rev=1642040&view=auto
==============================================================================
---
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/UpdatedAppointmentTemplate.html
(added)
+++
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/UpdatedAppointmentTemplate.html
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+<wicket:panel>
+ <span wicket:id="titleLbl"></span> <span wicket:id="title"></span>
+ <div wicket:id="descContainer">
+ <span wicket:id="descLbl"></span> <span
wicket:id="desc"></span>
+ </div>
+ <br/>
+ <span wicket:id="startLbl"></span> <span
wicket:id="start"></span><br/>
+ <span wicket:id="endLbl"></span> <span wicket:id="end"></span><br/>
+ <span wicket:id="invitorLbl"></span> <span
wicket:id="invitor"></span><br/>
+</wicket:panel>
+</html>
Added:
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/UpdatedAppointmentTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/UpdatedAppointmentTemplate.java?rev=1642040&view=auto
==============================================================================
---
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/UpdatedAppointmentTemplate.java
(added)
+++
openmeetings/branches/3.0.x/src/web/java/org/apache/openmeetings/web/mail/template/UpdatedAppointmentTemplate.java
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.web.mail.template;
+
+import static org.apache.openmeetings.web.app.Application.getBean;
+
+import java.util.TimeZone;
+
+import org.apache.openmeetings.db.dao.label.FieldLanguagesValuesDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.util.CalendarPatterns;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.util.string.Strings;
+
+public class UpdatedAppointmentTemplate extends AbstractAppointmentTemplate {
+ private static final long serialVersionUID = 1L;
+
+ public UpdatedAppointmentTemplate(Long langId, Appointment a, TimeZone
tz, String invitorName) {
+ super(langId, a, tz, invitorName);
+
+ FieldLanguagesValuesDao dao =
getBean(FieldLanguagesValuesDao.class);
+ add(new Label("titleLbl", dao.getString(1155L, langId)));
+ add(new Label("title", a.getTitle()));
+ add(new WebMarkupContainer("descContainer")
+ .add(new Label("descLbl", dao.getString(1152L, langId)))
+ .add(new Label("desc", a.getDescription()))
+ .setVisible(!Strings.isEmpty(a.getDescription()))
+ );
+ add(new Label("startLbl", dao.getString(1153L, langId)));
+ add(new Label("start",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)));
+ add(new Label("endLbl", dao.getString(1154L, langId)));
+ add(new Label("end",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)));
+ add(new Label("invitorLbl", dao.getString(1156L, langId)));
+ add(new Label("invitor", invitorName));
+ }
+
+ @Override
+ public String getSubject() {
+ FieldLanguagesValuesDao dao =
getBean(FieldLanguagesValuesDao.class);
+ StringBuilder sb = new StringBuilder();
+ sb.append(dao.getString(1155L, langId)).append("
").append(a.getTitle())
+ .append("
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(),
tz))
+ .append(" -
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(),
tz));
+
+ return sb.toString();
+ }
+}
Modified:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/EmailManager.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/EmailManager.java?rev=1642040&r1=1642039&r2=1642040&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/EmailManager.java
(original)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/EmailManager.java
Thu Nov 27 07:21:38 2014
@@ -19,6 +19,7 @@
package org.apache.openmeetings.service.mail;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static
org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicationName;
import org.apache.openmeetings.core.IApplication;
import org.apache.openmeetings.core.IWebSession;
@@ -63,7 +64,7 @@ public class EmailManager {
log.debug("sendMail:: username = {}, email = {}", username,
email);
Integer sendEmailAtRegister =
configurationDao.getConfValue("sendEmailAtRegister", Integer.class, "0");
- String link =
((IApplication)Application.get()).urlForActivatePage(new
PageParameters().add("u", hash));
+ String link =
((IApplication)Application.get(wicketApplicationName)).urlForActivatePage(new
PageParameters().add("u", hash));
if (sendEmailAtRegister == 1) {
mailHandler.send(email, getString(512)
Added:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/AbstractAppointmentTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/AbstractAppointmentTemplate.java?rev=1642040&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/AbstractAppointmentTemplate.java
(added)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/AbstractAppointmentTemplate.java
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,26 @@
+package org.apache.openmeetings.service.mail.template;
+
+import java.util.TimeZone;
+
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+
+public abstract class AbstractAppointmentTemplate extends
AbstractTemplatePanel {
+ private static final long serialVersionUID = 1L;
+ protected long langId;
+ protected Appointment a;
+ protected TimeZone tz;
+
+ public AbstractAppointmentTemplate(Long langId, Appointment a, TimeZone
tz, String invitorName) {
+ super(TemplatePage.COMP_ID);
+ this.langId = langId == null ? 1 : langId;
+ this.a = a;
+ this.tz = tz;
+ ensureApplication(langId);
+ }
+
+ public String getEmail() {
+ return renderPanel(this).toString();
+ }
+
+ public abstract String getSubject();
+}
Added:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CanceledAppointmentTemplate.html
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CanceledAppointmentTemplate.html?rev=1642040&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CanceledAppointmentTemplate.html
(added)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CanceledAppointmentTemplate.html
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+<wicket:panel>
+ <span wicket:id="titleLbl"></span> <span wicket:id="title"></span>
+ <div wicket:id="descContainer">
+ <span wicket:id="descLbl"></span> <span
wicket:id="desc"></span>
+ </div>
+ <br/>
+ <span wicket:id="startLbl"></span> <span
wicket:id="start"></span><br/>
+ <span wicket:id="endLbl"></span> <span wicket:id="end"></span><br/>
+ <span wicket:id="invitorLbl"></span> <span
wicket:id="invitor"></span><br/>
+</wicket:panel>
+</html>
Added:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CanceledAppointmentTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CanceledAppointmentTemplate.java?rev=1642040&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CanceledAppointmentTemplate.java
(added)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CanceledAppointmentTemplate.java
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.service.mail.template;
+
+import static
org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicationName;
+
+import java.util.TimeZone;
+
+import org.apache.openmeetings.core.IApplication;
+import org.apache.openmeetings.db.dao.label.FieldLanguagesValuesDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.util.CalendarPatterns;
+import org.apache.wicket.Application;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.util.string.Strings;
+
+public class CanceledAppointmentTemplate extends AbstractAppointmentTemplate {
+ private static final long serialVersionUID = 1L;
+
+ public CanceledAppointmentTemplate(Long langId, Appointment a, TimeZone
tz, String invitorName) {
+ super(langId, a, tz, invitorName);
+
+ FieldLanguagesValuesDao dao =
((IApplication)Application.get(wicketApplicationName)).getOmBean(FieldLanguagesValuesDao.class);
+ add(new Label("titleLbl", dao.getString(1157L, langId)));
+ add(new Label("title", a.getTitle()));
+ add(new WebMarkupContainer("descContainer")
+ .add(new Label("descLbl", dao.getString(1152L, langId)))
+ .add(new Label("desc", a.getDescription()))
+ .setVisible(!Strings.isEmpty(a.getDescription()))
+ );
+ add(new Label("startLbl", dao.getString(1153L, langId)));
+ add(new Label("start",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)));
+ add(new Label("endLbl", dao.getString(1154L, langId)));
+ add(new Label("end",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)));
+ add(new Label("invitorLbl", dao.getString(1156L, langId)));
+ add(new Label("invitor", invitorName));
+ }
+
+ @Override
+ public String getSubject() {
+ FieldLanguagesValuesDao dao =
((IApplication)Application.get(wicketApplicationName)).getOmBean(FieldLanguagesValuesDao.class);
+ StringBuilder sb = new StringBuilder();
+ sb.append(dao.getString(1157L, langId)).append("
").append(a.getTitle())
+ .append("
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(),
tz))
+ .append(" -
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(),
tz));
+
+ return sb.toString();
+ }
+}
Added:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.html
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.html?rev=1642040&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.html
(added)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.html
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+<wicket:panel>
+ <span wicket:id="titleLbl"></span> <span wicket:id="title"></span>
+ <div wicket:id="descContainer">
+ <span wicket:id="descLbl"></span> <span
wicket:id="desc"></span>
+ </div>
+ <br/>
+ <span wicket:id="startLbl"></span> <span
wicket:id="start"></span><br/>
+ <span wicket:id="endLbl"></span> <span wicket:id="end"></span><br/>
+ <span wicket:id="invitorLbl"></span> <span
wicket:id="invitor"></span><br/>
+</wicket:panel>
+</html>
Added:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.java?rev=1642040&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.java
(added)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/CreatedAppointmentTemplate.java
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.service.mail.template;
+
+import static
org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicationName;
+
+import java.util.TimeZone;
+
+import org.apache.openmeetings.core.IApplication;
+import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
+import org.apache.openmeetings.db.dao.label.FieldLanguagesValuesDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.util.CalendarPatterns;
+import org.apache.wicket.Application;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.util.string.Strings;
+
+public class CreatedAppointmentTemplate extends AbstractAppointmentTemplate {
+ private static final long serialVersionUID = 1L;
+
+ private String getTitleLbl(IApplication app, FieldLanguagesValuesDao
dao) {
+ return dao.getString(1151L, langId).replaceAll("\\$APP_NAME",
app.getOmBean(ConfigurationDao.class).getAppName());
+ }
+
+ public CreatedAppointmentTemplate(Long langId, Appointment a, TimeZone
tz, String invitorName) {
+ super(langId, a, tz, invitorName);
+ IApplication app =
((IApplication)Application.get(wicketApplicationName));
+
+ FieldLanguagesValuesDao dao =
app.getOmBean(FieldLanguagesValuesDao.class);
+ add(new Label("titleLbl", getTitleLbl(app, dao)));
+ add(new Label("title", a.getTitle()));
+ add(new WebMarkupContainer("descContainer")
+ .add(new Label("descLbl", dao.getString(1152L, langId)))
+ .add(new Label("desc", a.getDescription()))
+ .setVisible(!Strings.isEmpty(a.getDescription()))
+ );
+ add(new Label("startLbl", dao.getString(1153L, langId)));
+ add(new Label("start",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)));
+ add(new Label("endLbl", dao.getString(1154L, langId)));
+ add(new Label("end",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)));
+ add(new Label("invitorLbl", dao.getString(1156L, langId)));
+ add(new Label("invitor", invitorName));
+ }
+
+ @Override
+ public String getSubject() {
+ IApplication app =
((IApplication)Application.get(wicketApplicationName));
+
+ FieldLanguagesValuesDao dao =
app.getOmBean(FieldLanguagesValuesDao.class);
+ StringBuilder sb = new StringBuilder();
+ sb.append(getTitleLbl(app, dao)).append("
").append(a.getTitle())
+ .append("
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(),
tz))
+ .append(" -
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(),
tz));
+
+ return sb.toString();
+ }
+}
Modified:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/FeedbackTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/FeedbackTemplate.java?rev=1642040&r1=1642039&r2=1642040&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/FeedbackTemplate.java
(original)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/FeedbackTemplate.java
Thu Nov 27 07:21:38 2014
@@ -18,6 +18,8 @@
*/
package org.apache.openmeetings.service.mail.template;
+import static
org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicationName;
+
import org.apache.openmeetings.core.IApplication;
import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
import org.apache.wicket.Application;
@@ -29,7 +31,7 @@ public class FeedbackTemplate extends Ab
public FeedbackTemplate(String id, String username, String email,
String message) {
super(id);
- add(new Label("appname",
((IApplication)Application.get()).getOmBean(ConfigurationDao.class).getAppName()));
+ add(new Label("appname",
((IApplication)Application.get(wicketApplicationName)).getOmBean(ConfigurationDao.class).getAppName()));
add(new Label("username", username));
add(new Label("email", email));
add(new Label("message", message));
Modified:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/InvitationTemplate.html
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/InvitationTemplate.html?rev=1642040&r1=1642039&r2=1642040&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/InvitationTemplate.html
(original)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/InvitationTemplate.html
Thu Nov 27 07:21:38 2014
@@ -20,14 +20,15 @@
-->
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
- <b><wicket:ommessage key="500"/></b><br />
- <wicket:ommessage key="501"/> <span wicket:id="user"></span><br/>
- <wicket:ommessage key="502"/> <span wicket:id="message"></span><br/>
-
- <span wicket:id="comment_for_link1"></span><br/>
- <a wicket:id="invitation_link1"><wicket:ommessage key="504"/></a><br/>
- <br/><br/>
- <span wicket:id="comment_for_link2"></span><br/>
- <span wicket:id="invitation_link2"></span>
+ <b><span wicket:id="titleLbl"></span></b><br />
+ <span wicket:id="userLbl"></span> <span wicket:id="user"></span><br/>
+ <span wicket:id="messageLbl"></span> <span
wicket:id="messageLbl"></span><br/>
+ <div wicket:id="links">
+ <span wicket:id="comment_for_link1"></span><br/>
+ <a wicket:id="invitation_link1"><span
wicket:id="clickMe"></span></a><br/>
+ <br/><br/>
+ <span wicket:id="comment_for_link2"></span><br/>
+ <span wicket:id="invitation_link2"></span>
+ </div>
</wicket:panel>
-</html>
\ No newline at end of file
+</html>
Modified:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/InvitationTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/InvitationTemplate.java?rev=1642040&r1=1642039&r2=1642040&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/InvitationTemplate.java
(original)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/InvitationTemplate.java
Thu Nov 27 07:21:38 2014
@@ -18,37 +18,40 @@
*/
package org.apache.openmeetings.service.mail.template;
-import org.apache.openmeetings.service.mail.EmailManager;
+import static
org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicationName;
+
+import org.apache.openmeetings.core.IApplication;
+import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
+import org.apache.openmeetings.db.dao.label.FieldLanguagesValuesDao;
+import org.apache.wicket.Application;
+import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.ExternalLink;
public class InvitationTemplate extends AbstractTemplatePanel {
private static final long serialVersionUID = 1L;
- public InvitationTemplate(String id, String user, String message,
String link, boolean isCanceled) {
- super(id);
- add(new Label("user", user));
+ public InvitationTemplate(Long langId, String invitorName, String
message, String link) {
+ super(TemplatePage.COMP_ID);
+ ensureApplication(langId);
+ IApplication a =
((IApplication)Application.get(wicketApplicationName));
+
+ FieldLanguagesValuesDao dao =
a.getOmBean(FieldLanguagesValuesDao.class);
+ add(new Label("titleLbl", dao.getString(500,
langId).replaceAll("\\$APP_NAME",
a.getOmBean(ConfigurationDao.class).getAppName())));
+ add(new Label("userLbl", dao.getString(501, langId)));
+ add(new Label("user", invitorName));
add(new Label("message", message).setEscapeModelStrings(false));
- Label commentForLink1 = new Label("comment_for_link1",
EmailManager.getString(503));
- commentForLink1.setVisible(!isCanceled);
- add(commentForLink1);
- ExternalLink externalLink1 = new
ExternalLink("invitation_link1", link);
- externalLink1.setVisible(!isCanceled);
- add(externalLink1);
- Label commentForLink2 = new Label("comment_for_link2",
EmailManager.getString(505));
- commentForLink2.setVisible(!isCanceled);
- add(commentForLink2);
- Label externalLink2 = new Label("invitation_link2", link);
-
externalLink2.setEscapeModelStrings(false).setVisible(!isCanceled);
- add(externalLink2);
+
+ add(new WebMarkupContainer("links")
+ .add(new Label("comment_for_link1", dao.getString(503,
langId)))
+ .add(new ExternalLink("invitation_link1", link).add(new
Label("clickMe", dao.getString(504, langId))))
+ .add(new Label("comment_for_link2", dao.getString(505,
langId)))
+ .add(new Label("invitation_link2", link))
+ .setVisible(link != null)
+ );
}
- public static String getEmail(String user, String message, String link)
{
- return getEmail(-1, user, message, link, false);
- }
-
- public static String getEmail(long langId, String user, String message,
String link, boolean isCanceled) {
- ensureApplication(langId);
- return renderPanel(new InvitationTemplate(TemplatePage.COMP_ID,
user, message, link, isCanceled)).toString();
+ public String getEmail() {
+ return renderPanel(this).toString();
}
}
Modified:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactTemplate.java?rev=1642040&r1=1642039&r2=1642040&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactTemplate.java
(original)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactTemplate.java
Thu Nov 27 07:21:38 2014
@@ -18,6 +18,8 @@
*/
package org.apache.openmeetings.service.mail.template;
+import static
org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicationName;
+
import org.apache.openmeetings.core.IApplication;
import org.apache.openmeetings.db.entity.user.User;
import org.apache.wicket.Application;
@@ -33,7 +35,7 @@ public class RequestContactTemplate exte
add(new Label("addedLastName", userToAdd.getLastname()));
add(new Label("firstName", user.getFirstname()));
add(new Label("lastName", user.getLastname()));
- add(new ExternalLink("link",
((IApplication)Application.get()).getOmContactsLink()));
+ add(new ExternalLink("link",
((IApplication)Application.get(wicketApplicationName)).getOmContactsLink()));
}
public static String getEmail(User userToAdd, User user) {
Added:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/UpdatedAppointmentTemplate.html
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/UpdatedAppointmentTemplate.html?rev=1642040&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/UpdatedAppointmentTemplate.html
(added)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/UpdatedAppointmentTemplate.html
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<html xmlns:wicket="http://wicket.apache.org">
+<wicket:panel>
+ <span wicket:id="titleLbl"></span> <span wicket:id="title"></span>
+ <div wicket:id="descContainer">
+ <span wicket:id="descLbl"></span> <span
wicket:id="desc"></span>
+ </div>
+ <br/>
+ <span wicket:id="startLbl"></span> <span
wicket:id="start"></span><br/>
+ <span wicket:id="endLbl"></span> <span wicket:id="end"></span><br/>
+ <span wicket:id="invitorLbl"></span> <span
wicket:id="invitor"></span><br/>
+</wicket:panel>
+</html>
Added:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/UpdatedAppointmentTemplate.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/UpdatedAppointmentTemplate.java?rev=1642040&view=auto
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/UpdatedAppointmentTemplate.java
(added)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/UpdatedAppointmentTemplate.java
Thu Nov 27 07:21:38 2014
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") + you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.service.mail.template;
+
+import static
org.apache.openmeetings.util.OpenmeetingsVariables.wicketApplicationName;
+
+import java.util.TimeZone;
+
+import org.apache.openmeetings.core.IApplication;
+import org.apache.openmeetings.db.dao.label.FieldLanguagesValuesDao;
+import org.apache.openmeetings.db.entity.calendar.Appointment;
+import org.apache.openmeetings.util.CalendarPatterns;
+import org.apache.wicket.Application;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.util.string.Strings;
+
+public class UpdatedAppointmentTemplate extends AbstractAppointmentTemplate {
+ private static final long serialVersionUID = 1L;
+
+ public UpdatedAppointmentTemplate(Long langId, Appointment a, TimeZone
tz, String invitorName) {
+ super(langId, a, tz, invitorName);
+
+ FieldLanguagesValuesDao dao =
((IApplication)Application.get(wicketApplicationName)).getOmBean(FieldLanguagesValuesDao.class);
+ add(new Label("titleLbl", dao.getString(1155L, langId)));
+ add(new Label("title", a.getTitle()));
+ add(new WebMarkupContainer("descContainer")
+ .add(new Label("descLbl", dao.getString(1152L, langId)))
+ .add(new Label("desc", a.getDescription()))
+ .setVisible(!Strings.isEmpty(a.getDescription()))
+ );
+ add(new Label("startLbl", dao.getString(1153L, langId)));
+ add(new Label("start",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)));
+ add(new Label("endLbl", dao.getString(1154L, langId)));
+ add(new Label("end",
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)));
+ add(new Label("invitorLbl", dao.getString(1156L, langId)));
+ add(new Label("invitor", invitorName));
+ }
+
+ @Override
+ public String getSubject() {
+ FieldLanguagesValuesDao dao =
((IApplication)Application.get(wicketApplicationName)).getOmBean(FieldLanguagesValuesDao.class);
+ StringBuilder sb = new StringBuilder();
+ sb.append(dao.getString(1155L, langId)).append("
").append(a.getTitle())
+ .append("
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(),
tz))
+ .append(" -
").append(CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(),
tz));
+
+ return sb.toString();
+ }
+}
Modified:
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java
URL:
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java?rev=1642040&r1=1642039&r2=1642040&view=diff
==============================================================================
---
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java
(original)
+++
openmeetings/trunk/singlewebapp/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java
Thu Nov 27 07:21:38 2014
@@ -45,8 +45,11 @@ import org.apache.openmeetings.db.entity
import org.apache.openmeetings.db.entity.user.User;
import org.apache.openmeetings.db.entity.user.User.Type;
import org.apache.openmeetings.db.util.TimezoneUtil;
+import
org.apache.openmeetings.service.mail.template.AbstractAppointmentTemplate;
+import
org.apache.openmeetings.service.mail.template.CanceledAppointmentTemplate;
+import
org.apache.openmeetings.service.mail.template.CreatedAppointmentTemplate;
import org.apache.openmeetings.service.mail.template.InvitationTemplate;
-import org.apache.openmeetings.util.CalendarPatterns;
+import
org.apache.openmeetings.service.mail.template.UpdatedAppointmentTemplate;
import org.apache.openmeetings.util.crypt.MD5;
import org.apache.openmeetings.util.crypt.ManageCryptStyle;
import org.apache.openmeetings.util.mail.IcalHandler;
@@ -77,119 +80,6 @@ public class InvitationManager implement
@Autowired
private ConfigurationDao configDao;
-
- private String formatSubject(Long langId, Appointment a, TimeZone tz) {
- String message = langDao.getString(1151L, langId) + " " +
a.getTitle();
-
- message += " "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz);
-
- message += " - "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz);
-
- return message;
- }
-
- private String formatMessage(Long langId, Appointment a, TimeZone tz,
String invitorName) {
- String message = langDao.getString(1151L, langId) + " " +
a.getTitle();
-
- if (!Strings.isEmpty(a.getDescription())) {
- message += langDao.getString(1152L, langId) +
a.getDescription();
- }
-
- message += "<br/>"
- + langDao.getString(1153L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)
- + "<br/>";
-
- message += langDao.getString(1154L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz) +
"<br/>";
-
- message += langDao.getString(1156L, langId) + invitorName +
"<br/>";
-
- return message;
- }
-
- private String formatCancelSubject(Long langId, Appointment a, TimeZone
tz) {
- String message = langDao.getString(1157L, langId) +
a.getTitle();
-
- message += " "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)
- + " - "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz);
-
- return message;
- }
-
- private String formatCancelMessage(Long langId, Appointment a, TimeZone
tz, String invitorName) {
- try {
- String message = langDao.getString(1157L, langId) +
a.getTitle();
-
- if (!Strings.isEmpty(a.getDescription())) {
- message += langDao.getString(1152L, langId) +
a.getDescription();
- }
-
- message += "<br/>"
- + langDao.getString(1153L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)
- + "<br/>";
-
- message += langDao.getString(1154L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)
- + "<br/>";
-
- message += langDao.getString(1156L, langId) +
invitorName + "<br/>";
-
- return message;
- } catch (Exception err) {
- log.error("Could not format cancel message", err);
- return "Error formatCancelMessage";
- }
- }
-
- private String formatUpdateSubject(Long langId, Appointment a, TimeZone
tz) {
- String message = langDao.getString(1155L, langId) + " " +
a.getTitle();
-
- message += " "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)
- + " - "
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz);
-
- return message;
- }
-
- private String formatUpdateMessage(Long langId, Appointment a, TimeZone
tz, String invitorName) {
- try {
- String message = langDao.getString(1155L, langId) + " "
+ a.getTitle();
-
- if (!Strings.isEmpty(a.getDescription())) {
- message += langDao.getString(1152L, langId) +
a.getDescription();
- }
-
- message += "<br/>"
- + langDao.getString(1153L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getStart(), tz)
- + "<br/>";
-
- message += langDao.getString(1154L, langId)
- + ' '
- +
CalendarPatterns.getDateWithTimeByMiliSecondsAndTimeZone(a.getEnd(), tz)
- + "<br/>";
-
- message += langDao.getString(1156L, langId) +
invitorName + "<br/>";
-
- return message;
- } catch (Exception err) {
- log.error("Could not format update message", err);
- return "Error formatUpdateMessage";
- }
- }
-
/**
* @author vasya
*
@@ -205,41 +95,36 @@ public class InvitationManager implement
String invitorName = owner.getFirstname() + " " +
owner.getLastname();
Long langId = mm.getUser().getLanguageId();
TimeZone tz = timezoneUtil.getTimeZone(mm.getUser());
- String subject = null;
- String message = null;
+ AbstractAppointmentTemplate t = null;
switch (type) {
case Cancel:
- subject = formatCancelSubject(langId, a, tz);
- message = formatCancelMessage(langId, a, tz,
invitorName);
+ t = new CanceledAppointmentTemplate(langId, a,
tz, invitorName);
break;
case Create:
- subject = formatSubject(langId, a, tz);
- message = formatMessage(langId, a, tz,
invitorName);
+ t = new CreatedAppointmentTemplate(langId, a,
tz, invitorName);
break;
case Update:
default:
- subject = formatUpdateSubject(langId, a, tz);
- message = formatUpdateMessage(langId, a, tz,
invitorName);
+ t = new UpdatedAppointmentTemplate(langId, a,
tz, invitorName);
break;
}
- sendInvitionLink(mm.getInvitation(), type, subject, message,
ical);
+ sendInvitionLink(mm.getInvitation(), type, t.getSubject(),
t.getEmail(), ical);
}
public void sendInvitionLink(Invitation i, MessageType type, String
subject, String message, boolean ical) throws Exception {
- String invitation_link =
((IApplication)Application.get(wicketApplicationName)).getOmInvitationLink(configDao.getBaseUrl(),
i); //TODO check for exceptions
+ String invitation_link = type == MessageType.Cancel ? null :
((IApplication)Application.get(wicketApplicationName)).getOmInvitationLink(configDao.getBaseUrl(),
i); //TODO check for exceptions
User owner = i.getInvitedBy();
String invitorName = owner.getFirstname() + " " +
owner.getLastname();
- boolean isCanceled = (type == MessageType.Cancel);
- String template =
InvitationTemplate.getEmail(i.getInvitee().getLanguageId(), invitorName,
message, invitation_link, isCanceled);
+ String template = new
InvitationTemplate(i.getInvitee().getLanguageId(), invitorName, message,
invitation_link).getEmail();
String email = i.getInvitee().getAdresses().getEmail();
String replyToEmail = owner.getAdresses().getEmail();
if (ical) {
String username = i.getInvitee().getLogin();
boolean isOwner =
owner.getId().equals(i.getInvitee().getId());
- IcalHandler handler = new IcalHandler(isCanceled ?
IcalHandler.ICAL_METHOD_CANCEL : IcalHandler.ICAL_METHOD_REQUEST);
+ IcalHandler handler = new
IcalHandler(MessageType.Cancel == type ? IcalHandler.ICAL_METHOD_CANCEL :
IcalHandler.ICAL_METHOD_REQUEST);
HashMap<String, String> attendeeList =
handler.getAttendeeData(email, username, isOwner);