Skip to content
Snippets Groups Projects
Commit c7dac598 authored by srosse's avatar srosse
Browse files

OO-3831: add a column identifier in the calendars list

parent aa0376d7
No related branches found
No related tags found
No related merge requests found
Showing
with 187 additions and 190 deletions
...@@ -211,6 +211,7 @@ table.add=+ ...@@ -211,6 +211,7 @@ table.add=+
table.delete=- table.delete=-
table.header.aggregated.feed=Aggregiert table.header.aggregated.feed=Aggregiert
table.header.color=Farbe table.header.color=Farbe
table.header.identifier=Kennzeichen
table.header.name=Name table.header.name=Name
table.header.tools=<i class\="o_icon o_icon-lg o_icon_actions"> </i> table.header.tools=<i class\="o_icon o_icon-lg o_icon_actions"> </i>
table.header.type=Typ table.header.type=Typ
......
...@@ -257,6 +257,7 @@ table.add=+ ...@@ -257,6 +257,7 @@ table.add=+
table.delete=- table.delete=-
table.header.aggregated.feed=Aggregated table.header.aggregated.feed=Aggregated
table.header.color=Color table.header.color=Color
table.header.identifier=Identifier
table.header.name=Name table.header.name=Name
table.header.tools=<i class\="o_icon o_icon-lg o_icon_actions"> </i> table.header.tools=<i class\="o_icon o_icon-lg o_icon_actions"> </i>
table.header.type=Type table.header.type=Type
......
...@@ -211,6 +211,7 @@ table.add=+ ...@@ -211,6 +211,7 @@ table.add=+
table.delete=- table.delete=-
table.header.aggregated.feed=Agr\u00E9g\u00E9 table.header.aggregated.feed=Agr\u00E9g\u00E9
table.header.color=Couleur table.header.color=Couleur
table.header.identifier=Identifiant
table.header.name=Nom table.header.name=Nom
table.header.tools=<i class\="o_icon o_icon-lg o_icon_actions"> </i> table.header.tools=<i class\="o_icon o_icon-lg o_icon_actions"> </i>
table.header.type=Type table.header.type=Type
......
...@@ -113,16 +113,12 @@ public class CalendarPersonalConfigurationController extends FormBasicController ...@@ -113,16 +113,12 @@ public class CalendarPersonalConfigurationController extends FormBasicController
//add the table //add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel(); FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.type.i18nKey(), ConfigCols.type.ordinal(), columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.type, new CalendarTypeClassRenderer()));
true, ConfigCols.type.name(), new CalendarTypeClassRenderer())); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.cssClass));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.cssClass.i18nKey(), ConfigCols.cssClass.ordinal(), columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.name));
true, ConfigCols.cssClass.name())); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.identifier));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.name.i18nKey(), ConfigCols.name.ordinal(), columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.visible));
true, ConfigCols.name.name())); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.aggregated));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.visible.i18nKey(), ConfigCols.visible.ordinal(),
true, ConfigCols.visible.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.aggregated.i18nKey(), ConfigCols.aggregated.ordinal(),
true, ConfigCols.aggregated.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.feed.i18nKey(), ConfigCols.feed.ordinal())); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.feed.i18nKey(), ConfigCols.feed.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.tools.i18nKey(), ConfigCols.tools.ordinal())); columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(ConfigCols.tools.i18nKey(), ConfigCols.tools.ordinal()));
......
...@@ -23,6 +23,7 @@ import java.util.List; ...@@ -23,6 +23,7 @@ import java.util.List;
import org.olat.core.commons.persistence.SortKey; import org.olat.core.commons.persistence.SortKey;
import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableDataModel; import org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiTableDataModel;
import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiSortableColumnDef;
import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel; import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel;
import org.olat.core.gui.components.form.flexible.impl.elements.table.SortableFlexiTableDataModel; import org.olat.core.gui.components.form.flexible.impl.elements.table.SortableFlexiTableDataModel;
...@@ -63,7 +64,8 @@ public class CalendarPersonalConfigurationDataModel extends DefaultFlexiTableDat ...@@ -63,7 +64,8 @@ public class CalendarPersonalConfigurationDataModel extends DefaultFlexiTableDat
switch(ConfigCols.values()[col]) { switch(ConfigCols.values()[col]) {
case type: return row.getWrapper(); case type: return row.getWrapper();
case name: return row.getDisplayName(); case name: return row.getDisplayName();
case cssClass: return row.getColorLink();//.getCssClass(); case identifier: return row.getIdentifier();
case cssClass: return row.getColorLink();
case visible: return row.getVisibleLink(); case visible: return row.getVisibleLink();
case aggregated: return row.getAggregatedLink(); case aggregated: return row.getAggregatedLink();
case feed: return row.getFeedLink(); case feed: return row.getFeedLink();
...@@ -72,9 +74,10 @@ public class CalendarPersonalConfigurationDataModel extends DefaultFlexiTableDat ...@@ -72,9 +74,10 @@ public class CalendarPersonalConfigurationDataModel extends DefaultFlexiTableDat
return null; return null;
} }
public enum ConfigCols { public enum ConfigCols implements FlexiSortableColumnDef {
type("table.header.type"), type("table.header.type"),
name("table.header.name"), name("table.header.name"),
identifier("table.header.identifier"),
cssClass("table.header.color"), cssClass("table.header.color"),
visible("table.header.visible"), visible("table.header.visible"),
aggregated("table.header.aggregated.feed"), aggregated("table.header.aggregated.feed"),
...@@ -90,5 +93,20 @@ public class CalendarPersonalConfigurationDataModel extends DefaultFlexiTableDat ...@@ -90,5 +93,20 @@ public class CalendarPersonalConfigurationDataModel extends DefaultFlexiTableDat
public String i18nKey() { public String i18nKey() {
return i18nKey; return i18nKey;
} }
@Override
public String i18nHeaderKey() {
return i18nKey;
}
@Override
public boolean sortable() {
return this != tools && this != feed;
}
@Override
public String sortKey() {
return name();
}
} }
} }
...@@ -64,6 +64,10 @@ public class CalendarPersonalConfigurationRow { ...@@ -64,6 +64,10 @@ public class CalendarPersonalConfigurationRow {
public String getDisplayName() { public String getDisplayName() {
return wrapper.getDisplayName(); return wrapper.getDisplayName();
} }
public String getIdentifier() {
return wrapper.getIdentifier();
}
public String getCssClass() { public String getCssClass() {
return wrapper.getCssClass(); return wrapper.getCssClass();
......
...@@ -55,6 +55,7 @@ public class KalendarRenderWrapper { ...@@ -55,6 +55,7 @@ public class KalendarRenderWrapper {
public static final int ACCESS_READ_ONLY = 1; public static final int ACCESS_READ_ONLY = 1;
private String displayName; private String displayName;
private String identifier;
private Kalendar kalendar; private Kalendar kalendar;
private LinkProvider linkProvider; private LinkProvider linkProvider;
...@@ -76,15 +77,14 @@ public class KalendarRenderWrapper { ...@@ -76,15 +77,14 @@ public class KalendarRenderWrapper {
* @param calendarColor * @param calendarColor
* @param access * @param access
*/ */
public KalendarRenderWrapper(Kalendar kalendar, String displayName) { public KalendarRenderWrapper(Kalendar kalendar, String displayName, String identifier) {
this.kalendar = kalendar; this(kalendar, null, displayName, identifier);
this.displayName = displayName;
setConfiguration(null);
} }
public KalendarRenderWrapper(Kalendar kalendar, CalendarUserConfiguration config, String displayName) { public KalendarRenderWrapper(Kalendar kalendar, CalendarUserConfiguration config, String displayName, String identifier) {
this.kalendar = kalendar; this.kalendar = kalendar;
this.displayName = displayName; this.displayName = displayName;
this.identifier = identifier;
setConfiguration(config); setConfiguration(config);
} }
...@@ -115,6 +115,14 @@ public class KalendarRenderWrapper { ...@@ -115,6 +115,14 @@ public class KalendarRenderWrapper {
this.displayName = displayName; this.displayName = displayName;
} }
public String getIdentifier() {
return identifier;
}
public void setIdentifier(String identifier) {
this.identifier = identifier;
}
public int getAccess() { public int getAccess() {
return access; return access;
} }
......
...@@ -45,7 +45,7 @@ public interface BusinessGroup extends BusinessGroupShort, Persistable, CreateIn ...@@ -45,7 +45,7 @@ public interface BusinessGroup extends BusinessGroupShort, Persistable, CreateIn
/** regular expression to check for valid group names */ /** regular expression to check for valid group names */
// commas are not allowed. name is used in course conditions for weak binding // commas are not allowed. name is used in course conditions for weak binding
public final static String VALID_GROUPNAME_REGEXP = "^[^,\"]*$"; public static final String VALID_GROUPNAME_REGEXP = "^[^,\"]*$";
/** the max length for the group name.*/ /** the max length for the group name.*/
public static final int MAX_GROUP_NAME_LENGTH = 255; public static final int MAX_GROUP_NAME_LENGTH = 255;
......
...@@ -52,7 +52,6 @@ import java.util.concurrent.CountDownLatch; ...@@ -52,7 +52,6 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.infinispan.manager.EmbeddedCacheManager;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Assume; import org.junit.Assume;
import org.junit.Test; import org.junit.Test;
...@@ -89,8 +88,7 @@ public class ICalFileCalendarManagerTest extends OlatTestCase { ...@@ -89,8 +88,7 @@ public class ICalFileCalendarManagerTest extends OlatTestCase {
private final void emptyCalendarCache() { private final void emptyCalendarCache() {
CoordinatorManager coordinator = CoreSpringFactory.getImpl(CoordinatorManager.class); CoordinatorManager coordinator = CoreSpringFactory.getImpl(CoordinatorManager.class);
Cacher cacher = coordinator.getCoordinator().getCacher(); Cacher cacher = coordinator.getCoordinator().getCacher();
EmbeddedCacheManager cm = cacher.getCacheContainer(); cacher.getCacheContainer().getCache("CalendarManager@calendar").clear();
cm.getCache("CalendarManager@calendar").clear();
} }
@Test @Test
...@@ -328,6 +326,8 @@ public class ICalFileCalendarManagerTest extends OlatTestCase { ...@@ -328,6 +326,8 @@ public class ICalFileCalendarManagerTest extends OlatTestCase {
File newCalendarFile = new File(calendarFile.getParentFile(), calendarFile.getName()); File newCalendarFile = new File(calendarFile.getParentFile(), calendarFile.getName());
InputStream in = CalendarImportTest.class.getResourceAsStream("cal_without_dtend.ics"); InputStream in = CalendarImportTest.class.getResourceAsStream("cal_without_dtend.ics");
FileUtils.copyInputStreamToFile(in, newCalendarFile); FileUtils.copyInputStreamToFile(in, newCalendarFile);
in.close();
//to be sure //to be sure
emptyCalendarCache(); emptyCalendarCache();
//load the calendar //load the calendar
...@@ -474,6 +474,8 @@ public class ICalFileCalendarManagerTest extends OlatTestCase { ...@@ -474,6 +474,8 @@ public class ICalFileCalendarManagerTest extends OlatTestCase {
File newCalendarFile = new File(calendarFile.getParentFile(), calendarFile.getName()); File newCalendarFile = new File(calendarFile.getParentFile(), calendarFile.getName());
InputStream in = CalendarImportTest.class.getResourceAsStream("cal_without_dtend.ics"); InputStream in = CalendarImportTest.class.getResourceAsStream("cal_without_dtend.ics");
FileUtils.copyInputStreamToFile(in, newCalendarFile); FileUtils.copyInputStreamToFile(in, newCalendarFile);
in.close();
//to be sure //to be sure
emptyCalendarCache(); emptyCalendarCache();
//load the calendar //load the calendar
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment