use of org.olat.admin.landingpages.model.Rules in project OpenOLAT by OpenOLAT.
the class LandingPagesModule method init.
@Override
public void init() {
String rulesObj = getStringPropertyValue(CONFIG_RULES, true);
if (StringHelper.containsNonWhitespace(rulesObj)) {
rules = (Rules) rulesXStream.fromXML(rulesObj);
} else {
rules = new Rules();
rules.setRules(new ArrayList<Rule>(1));
}
}
use of org.olat.admin.landingpages.model.Rules in project OpenOLAT by OpenOLAT.
the class LandingPagesAdminController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("landingpages.title");
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.position.i18nKey(), RCols.position.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.role.i18nKey(), RCols.role.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.userAttributeKey.i18nKey(), RCols.userAttributeKey.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.userAttributeValue.i18nKey(), RCols.userAttributeValue.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.landingPage.i18nKey(), RCols.landingPage.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.landingPageChooser.i18nKey(), RCols.landingPageChooser.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("up", -1, "up", new StaticFlexiCellRenderer("", "up", "o_icon o_icon-lg o_icon_move_up", translate("up"))));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("down", -1, "down", new StaticFlexiCellRenderer("", "down", "o_icon o_icon-lg o_icon_move_down", translate("down"))));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("add", translate("add"), "add"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("delete", translate("delete"), "delete"));
// pack the rules
Rules rules = lpModule.getRules();
List<Rule> ruleList = new ArrayList<>(rules.getRules());
if (ruleList.isEmpty()) {
ruleList.add(new Rule());
}
List<RuleWrapper> wrappers = new ArrayList<>();
int i = 0;
for (Rule rule : ruleList) {
wrappers.add(initRuleWrapper(++i, rule, formLayout));
}
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("rules", wrappers);
}
model = new RulesDataModel(columnsModel, wrappers);
tableEl = uifactory.addTableElement(getWindowControl(), "rules", model, getTranslator(), formLayout);
tableEl.setCustomizeColumns(false);
tableEl.setRendererType(FlexiTableRendererType.classic);
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add("buttons", buttonLayout);
saveButton = uifactory.addFormSubmitButton("save", buttonLayout);
}
use of org.olat.admin.landingpages.model.Rules in project openolat by klemens.
the class LandingPagesAdminController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("landingpages.title");
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.position.i18nKey(), RCols.position.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.role.i18nKey(), RCols.role.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.userAttributeKey.i18nKey(), RCols.userAttributeKey.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.userAttributeValue.i18nKey(), RCols.userAttributeValue.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.landingPage.i18nKey(), RCols.landingPage.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RCols.landingPageChooser.i18nKey(), RCols.landingPageChooser.ordinal()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("up", -1, "up", new StaticFlexiCellRenderer("", "up", "o_icon o_icon-lg o_icon_move_up", translate("up"))));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("down", -1, "down", new StaticFlexiCellRenderer("", "down", "o_icon o_icon-lg o_icon_move_down", translate("down"))));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("add", translate("add"), "add"));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("delete", translate("delete"), "delete"));
// pack the rules
Rules rules = lpModule.getRules();
List<Rule> ruleList = new ArrayList<>(rules.getRules());
if (ruleList.isEmpty()) {
ruleList.add(new Rule());
}
List<RuleWrapper> wrappers = new ArrayList<>();
int i = 0;
for (Rule rule : ruleList) {
wrappers.add(initRuleWrapper(++i, rule, formLayout));
}
if (formLayout instanceof FormLayoutContainer) {
FormLayoutContainer layoutCont = (FormLayoutContainer) formLayout;
layoutCont.contextPut("rules", wrappers);
}
model = new RulesDataModel(columnsModel, wrappers);
tableEl = uifactory.addTableElement(getWindowControl(), "rules", model, getTranslator(), formLayout);
tableEl.setCustomizeColumns(false);
tableEl.setRendererType(FlexiTableRendererType.classic);
FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add("buttons", buttonLayout);
saveButton = uifactory.addFormSubmitButton("save", buttonLayout);
}
use of org.olat.admin.landingpages.model.Rules in project openolat by klemens.
the class LandingPagesAdminController method formOK.
@Override
protected void formOK(UserRequest ureq) {
int rowCount = model.getRowCount();
List<Rule> ruleList = new ArrayList<Rule>(rowCount);
for (int i = 0; i < rowCount; i++) {
ruleList.add(model.getObject(i).save());
}
Rules rules = new Rules();
rules.setRules(ruleList);
lpModule.setRules(rules);
}
use of org.olat.admin.landingpages.model.Rules in project OpenOLAT by OpenOLAT.
the class LandingPagesAdminController method formOK.
@Override
protected void formOK(UserRequest ureq) {
int rowCount = model.getRowCount();
List<Rule> ruleList = new ArrayList<Rule>(rowCount);
for (int i = 0; i < rowCount; i++) {
ruleList.add(model.getObject(i).save());
}
Rules rules = new Rules();
rules.setRules(ruleList);
lpModule.setRules(rules);
}
Aggregations