Skip to content

Commit

Permalink
LSNBLDR-829 Refactor calendar event types and fix lessons pop-up issu…
Browse files Browse the repository at this point in the history
…es. (sakaiproject#4702)

With changes following Matthew's feedback.
  • Loading branch information
RebeccaMiller-Which authored and ern committed Aug 29, 2017
1 parent d8aa22e commit 06db328
Show file tree
Hide file tree
Showing 36 changed files with 282 additions and 784 deletions.
2 changes: 0 additions & 2 deletions calendar/calendar-bundles/resources/calendar.properties
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,6 @@ view.for = For

group = Group

## These definitions are used by the eventLegend macro
##
view.legend = Legend
view.calevents = List of Events
gen.eventtype.list.summary = List of event types in the calendar
Expand Down
2 changes: 0 additions & 2 deletions calendar/calendar-bundles/resources/calendar_ca.properties
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,6 @@ view.for=Per

group=Grup

## These definitions are used by the eventLegend macro
##
view.legend=Llegenda
view.calevents=Llista d'esdeveniments
gen.eventtype.list.summary=Llista de tipus d'esdeveniments del calendari
Expand Down
2 changes: 0 additions & 2 deletions calendar/calendar-bundles/resources/calendar_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,6 @@ view.for = F\u00fcr

group = Gruppe

## These definitions are used by the eventLegend macro
##
view.legend = Legende
view.calevents = Ereignisliste
gen.eventtype.list.summary = Liste der Ereignistypen im Kalender
Expand Down
2 changes: 0 additions & 2 deletions calendar/calendar-bundles/resources/calendar_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,6 @@ view.for=Para

group=Grupo

## These definitions are used by the eventLegend macro
##
view.legend=Leyenda
view.calevents=Lista de Eventos
gen.eventtype.list.summary=Lista de tipos de eventos de la agenda
Expand Down
2 changes: 0 additions & 2 deletions calendar/calendar-bundles/resources/calendar_fr_FR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,6 @@ view.for=Destinataire(s)

group=Groupe

## These definitions are used by the eventLegend macro
##
view.legend=L\u00e9gende
view.calevents=Liste des \u00e9v\u00e9nements
gen.eventtype.list.summary=Liste des types d\u2019\u00e9v\u00e8nements dans le calendrier
Expand Down
2 changes: 0 additions & 2 deletions calendar/calendar-bundles/resources/calendar_hi_IN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,6 @@ view.for=\u0915\u0947 \u0932\u093f\u090f

group=\u0938\u092e\u0942\u0939

## These definitions are used by the eventLegend macro
##
view.legend=\u092e\u0941\u0926\u094d\u0930\u093e\u0932\u0947\u0916
view.calevents=\u0918\u091f\u0928\u093e\u0913\u0902 \u0915\u0940 \u0938\u0942\u091a\u0940
gen.eventtype.list.summary=\u0915\u0948\u0932\u0947\u0902\u0921\u0930 \u092e\u0947\u0902 \u0918\u091f\u0928\u093e \u092a\u094d\u0930\u0915\u093e\u0930\u094b\u0902 \u0915\u0940 \u0938\u0942\u091a\u0940
Expand Down
2 changes: 0 additions & 2 deletions calendar/calendar-bundles/resources/calendar_it.properties
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,6 @@ view.for = Per

group = Gruppo

## These definitions are used by the eventLegend macro
##
view.legend = Legenda
view.calevents = Elenco di eventi
gen.eventtype.list.summary = Elenco di tipi di evento nel calendario
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,6 @@ view.for = Dla
group = Grupy
groups = Grup

## These definitions are used by the eventLegend macro
##
view.legend = Legenda
view.calevents = Lista wydarze\u0144
gen.eventtype.list.summary = Lista rodzaj\u00F3w wydarze\u0144 w kalendarzu
Expand All @@ -398,7 +396,7 @@ sched.for = Harmonogram dla

# ImportException error messages

err_no_dur = Nie okre\u015Blono czasu trwania w wierszu #{0}.
err_no_dur = Nie okre\u015Blono czasu trwania w wierszu #{0}.
Dokonaj odpowiednich zmian w szablonie i zapisz go ponownie.

err_no_start = Nie okre\u015Blono daty rozpocz\u0119cia w wierszu #{0}. Dokonaj odpowiednich zmian w szablonie i zapisz go ponownie.
Expand Down
2 changes: 0 additions & 2 deletions calendar/calendar-bundles/resources/calendar_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,6 @@ view.for = Para

group = Grupo

## These definitions are used by the eventLegend macro
##
view.legend = Legenda
view.calevents = Lista de Eventos
gen.eventtype.list.summary =Lista dos tipos de eventos no calend\u00e1rio
Expand Down
2 changes: 0 additions & 2 deletions calendar/calendar-bundles/resources/calendar_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,6 @@ view.for=\u4E3A

group=\u5206\u7EC4

## These definitions are used by the eventLegend macro
##
view.legend=\u56FE\u4F8B
view.calevents=\u4E8B\u4EF6\u5217\u8868
gen.eventtype.list.summary=\u5728\u65E5\u7A0B\u4E0A\u663E\u793A\u6240\u6709\u7C7B\u578B\u7684\u4E8B\u4EF6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6508,52 +6508,10 @@ protected void generateXMLEvent(Document doc, Element parent, CalendarEvent even
}

protected String getEventDescription(String type){
ResourceLoader rl = new ResourceLoader("calendar");
if ((type!=null) && (type.trim()!="")){
if (type.equals("Academic Calendar"))
return rl.getString("legend.key1");
else if (type.equals("Activity"))
return rl.getString("legend.key2");
else if (type.equals("Cancellation"))
return rl.getString("legend.key3");
else if (type.equals("Class section - Discussion"))
return rl.getString("legend.key4");
else if (type.equals("Class section - Lab"))
return rl.getString("legend.key5");
else if (type.equals("Class section - Lecture"))
return rl.getString("legend.key6");
else if (type.equals("Class section - Small Group"))
return rl.getString("legend.key7");
else if (type.equals("Class session"))
return rl.getString("legend.key8");
else if (type.equals("Computer Session"))
return rl.getString("legend.key9");
else if (type.equals("Deadline"))
return rl.getString("legend.key10");
else if (type.equals("Exam"))
return rl.getString("legend.key11");
else if (type.equals("Meeting"))
return rl.getString("legend.key12");
else if (type.equals("Multidisciplinary Conference"))
return rl.getString("legend.key13");
else if (type.equals("Quiz"))
return rl.getString("legend.key14");
else if (type.equals("Special event"))
return rl.getString("legend.key15");
else if (type.equals("Web Assignment"))
return rl.getString("legend.key16");
else if (type.equals("Formative Assessment"))
return rl.getString("legend.key17");
else if (type.equals("Submission Date"))
return rl.getString("legend.key18");
else if (type.equals("Tutorial"))
return rl.getString("legend.key19");
else if (type.equals("Workshop"))
return rl.getString("legend.key20");
else
return rl.getString("legend.key2");
return CalendarEventType.getLocalizedLegendFromEventType(type);
}else{
return rl.getString("legend.key2");
return CalendarEventType.getLocalizedLegendFromEventType("Activity");
}
}
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.Stack;
import java.util.Vector;

import org.sakaiproject.util.CalendarEventType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.sakaiproject.calendar.api.Calendar;
Expand Down Expand Up @@ -912,49 +913,10 @@ else if (intervalColumn != null && intervalColumn.equals(column.getColumnHeader(
else if (ITEM_TYPE_PROPERTY_NAME.equals(column.getColumnHeader())){
String cellValue = column.getCellValue();
if (cellValue!=null){
if (cellValue.equals("event.activity")){
mapCellValue = "Activity";
}else if (cellValue.equals("event.exam")){
mapCellValue="Exam";
}else if (cellValue.equals("event.meeting")){
mapCellValue="Meeting";
}else if (cellValue.equals("event.academic.calendar")){
mapCellValue="Academic Calendar";
}else if (cellValue.equals("event.cancellation")){
mapCellValue="Cancellation";
}else if (cellValue.equals("event.discussion")){
mapCellValue="Class section - Discussion";
}else if (cellValue.equals("event.lab")){
mapCellValue="Class section - Lab";
}else if (cellValue.equals("event.lecture")){
mapCellValue="Class section - Lecture";
}else if (cellValue.equals("event.smallgroup")){
mapCellValue="Class section - Small Group";
}else if (cellValue.equals("event.class")){
mapCellValue="Class session";
}else if (cellValue.equals("event.computer")){
mapCellValue="Computer Session";
}else if (cellValue.equals("event.deadline")){
mapCellValue="Deadline";
}else if (cellValue.equals("event.formative")){
mapCellValue="Formative Assessment";
}else if (cellValue.equals("event.conference")){
mapCellValue="Multidisciplinary Conference";
}else if (cellValue.equals("event.quiz")){
mapCellValue="Quiz";
}else if (cellValue.equals("event.special")){
mapCellValue="Special event";
}else if (cellValue.equals("event.submission")){
mapCellValue="Submission Date";
}else if (cellValue.equals("event.tutorial")){
mapCellValue="Tutorial";
}else if (cellValue.equals("event.assignment")){
mapCellValue="Web Assignment";
}else if (cellValue.equals("event.workshop")){
mapCellValue="Workshop";
}else{
mapCellValue = cellValue;
}
CalendarEventType.getEventTypeFromImportType(cellValue);
}
else {
mapCellValue = cellValue;
}
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -67,6 +66,7 @@
import org.sakaiproject.util.CalendarChannelReferenceMaker;
import org.sakaiproject.util.CalendarReferenceToChannelConverter;
import org.sakaiproject.util.CalendarUtil;
import org.sakaiproject.util.CalendarEventType;
import org.sakaiproject.util.EntryProvider;
import org.sakaiproject.util.MergedList;
import org.sakaiproject.util.MergedListEntryProviderFixedListWrapper;
Expand Down Expand Up @@ -95,6 +95,8 @@ public class CalendarBean {
/** Resource bundle */
private transient ResourceLoader msgs = new ResourceLoader("calendar");

private CalendarUtil calendarUtil = new CalendarUtil();

/** Bean members */
private String viewMode = MODE_MONTHVIEW;
private String prevViewMode = null;
Expand Down Expand Up @@ -152,9 +154,6 @@ public CalendarBean(){
}

public String getInitValues() {
// reload localized event types
EventTypes.reloadLocalization();

long lastModified = PrefsBean.getPreferenceLastModified();
if(lastModifiedPrefs != lastModified)
readPreferences();
Expand Down Expand Up @@ -364,7 +363,7 @@ private List getDayEvents(CalendarEventVector dayEventVector) {
EventSummary es = new EventSummary();
es.setDisplayName(e.getDisplayName());
es.setType(e.getType());
es.setTypeLocalized(EventTypes.getLocalizedEventType(e.getType()));
es.setTypeLocalized(calendarUtil.getLocalizedEventType(e.getType()));
es.setCalendarRef(e.getCalendarReference());
es.setEventRef(e.getId());
es.setUrl(e.getUrl());
Expand Down Expand Up @@ -745,7 +744,7 @@ public EventSummary getSelectedEvent() {
selectedEvent.setDisplayName(event.getDisplayName());
selectedEvent.setDate(event.getRange());
selectedEvent.setType(event.getType());
selectedEvent.setTypeLocalized(EventTypes.getLocalizedEventType(event.getType()));
selectedEvent.setTypeLocalized(calendarUtil.getLocalizedEventType(event.getType()));
selectedEvent.setDescription(event.getDescriptionFormatted());
selectedEvent.setLocation(event.getLocation());
Site site = M_ss.getSite(calendar.getContext());
Expand Down Expand Up @@ -839,31 +838,16 @@ private String buildEventUrl(Site site, String eventRef) {
}
}

public synchronized Map<String, String> getEventIconMap() {
if(eventIconMap == null || eventIconMap.size() == 0){
eventIconMap = new HashMap<String, String>();
eventIconMap.put("Academic Calendar", "<span class=\"icon icon-calendar-academic-calendar\"></span>");
eventIconMap.put("Activity", "<span class=\"icon icon-calendar-activity\"></span>");
eventIconMap.put("Cancellation", "<span class=\"icon icon-calendar-cancellation\"></span>");
eventIconMap.put("Class section - Discussion", "<span class=\"icon icon-calendar-class-section-discussion\"></span>");
eventIconMap.put("Class section - Lab", "<span class=\"icon icon-calendar-class-section-lab\"></span>");
eventIconMap.put("Class section - Lecture", "<span class=\"icon icon-calendar-class-section-lecture\"></span>");
eventIconMap.put("Class section - Small Group", "<span class=\"icon icon-calendar-class-section-small-group\"></span>");
eventIconMap.put("Class session", "<span class=\"icon icon-calendar-class-session\"></span>");
eventIconMap.put("Computer Session", "<span class=\"icon icon-calendar-computer-session\"></span>");
eventIconMap.put("Deadline", "<span class=\"icon icon-calendar-deadline\"></span>");
eventIconMap.put("Exam", "<span class=\"icon icon-calendar-exam\"></span>");
eventIconMap.put("Formative Assessment", "<span class=\"icon icon-calendar-formative-assessment\"></span>");
eventIconMap.put("Meeting", "<span class=\"icon icon-calendar-meeting\"></span>");
eventIconMap.put("Multidisciplinary Conference", "<span class=\"icon icon-calendar-multidisciplinary-conference\"></span>");
eventIconMap.put("Quiz", "<span class=\"icon icon-calendar-quiz\"></span>");
eventIconMap.put("Special event", "<span class=\"icon icon-calendar-special-event\"></span>");
eventIconMap.put("Submission Date", "<span class=\"icon icon-calendar-submission-date\"></span>");
eventIconMap.put("Tutorial", "<span class=\"icon icon-calendar-tutorial\"></span>");
eventIconMap.put("Web Assignment", "<span class=\"icon icon-calendar-web-assignment\"></span>");
eventIconMap.put("Workshop", "<span class=\"icon icon-calendar-workshop\"></span>");
public Map<String, String> getEventIconMap() {
Map<String, String> spanIconMap = new HashMap<>();
Map<String, String> iconMap = CalendarEventType.getIcons();
Set<String> eventKeys = iconMap.keySet();
for (String eventType: eventKeys)
{
spanIconMap.put(eventType, "<span class=\"icon " + iconMap.get(eventType) + "\"></span>");
}
return eventIconMap;

return spanIconMap;
}

public String getImgLocation() {
Expand Down
Loading

0 comments on commit 06db328

Please sign in to comment.