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

Merge with 5f4ef4bac0a3c1e8ec66758a2d8a98623b461089

parents 3d37ecc7 2ecaa3c4
No related branches found
No related tags found
No related merge requests found
Showing
with 103 additions and 265 deletions
......@@ -61,7 +61,7 @@ public class DENDatesForm extends FormBasicController {
* @param layout (CREATE_DATES_LAYOUT, EDIT_SINGLE_DATE_LAYOUT, EDIT_MULTIPLE_DATES_LAYOUT)
*/
public DENDatesForm(UserRequest ureq, WindowControl wControl, Translator translator, int layout) {
super(ureq, wControl, "dateform");
super(ureq, wControl);
this.setTranslator(translator);
this.layout = layout;
......@@ -77,14 +77,14 @@ public class DENDatesForm extends FormBasicController {
showDurationTE = true;
showPauseTE = true;
showRetakeTE = true;
this.flc.contextPut("chelp", "ced-den-dates-creat.html");
setFormContextHelp("de.bps.course.nodes.den","ced-den-dates-creat.html","help.hover.den");
} else if(layout == EDIT_SINGLE_DATE_LAYOUT) {
showBeginDateChooser = true;
showDurationTE = true;
this.flc.contextPut("chelp", "ced-den-dates-singl.html");
setFormContextHelp("de.bps.course.nodes.den","ced-den-dates-singl.html","help.hover.den");
} else if(layout == EDIT_MULTIPLE_DATES_LAYOUT) {
showMoveTE = true;
this.flc.contextPut("chelp", "ced-den-dates-multi.html");
setFormContextHelp("de.bps.course.nodes.den","ced-den-dates-multi.html","help.hover.den");
}
initForm(this.flc, this, ureq);
......
......@@ -33,7 +33,8 @@ import org.olat.commons.calendar.model.KalendarEvent;
import org.olat.core.CoreSpringFactory;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.form.flexible.impl.components.SimpleText;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.table.Table;
import org.olat.core.gui.components.table.TableController;
import org.olat.core.gui.components.table.TableEvent;
......@@ -75,7 +76,7 @@ public class DENManageParticipantsController extends BasicController {
private VelocityContainer participantsVC;
private DENParticipantsTableDataModel participantsTableData;
private TableController tableManageParticipants;
private DENManageParticipantsForm formManageParticipants;
private Link addParticipantButton;
private UserSearchController userSearchCntrl;
private CloseableModalController userSearchCMC;
private KalendarEvent selectedEvent;
......@@ -119,10 +120,6 @@ public class DENManageParticipantsController extends BasicController {
removeAsListenerAndDispose(tableManageParticipants);
tableManageParticipants = null;
}
if(formManageParticipants != null) {
removeAsListenerAndDispose(formManageParticipants);
formManageParticipants = null;
}
}
@Override
......@@ -140,18 +137,13 @@ public class DENManageParticipantsController extends BasicController {
tableManageParticipants = denManager.createParticipantsTable(ureq, getWindowControl(), getTranslator(), participantsTableData);
listenTo(tableManageParticipants);
removeAsListenerAndDispose(formManageParticipants);
formManageParticipants = new DENManageParticipantsForm(ureq, getWindowControl());
listenTo(formManageParticipants);
participantsVC = createVelocityContainer("participants");
SimpleText dateTitle = new SimpleText("dateTitle", translate("dates.table.subject") + ": " + selectedEvent.getSubject());
DateFormat df = new SimpleDateFormat();
SimpleText dateTimeframe = new SimpleText("dateTimeframe", translate("dates.table.date") + ": " + df.format(selectedEvent.getBegin()) + " - " + df.format(selectedEvent.getEnd()));
participantsVC.put("dateTitle", dateTitle);
participantsVC.put("dateTimeframe", dateTimeframe);
participantsVC.contextPut("dateTitle", selectedEvent.getSubject());
participantsVC.contextPut("dateTimeframe", df.format(selectedEvent.getBegin()) + " - " + df.format(selectedEvent.getEnd()));
participantsVC.put("participantsTable", tableManageParticipants.getInitialComponent());
participantsVC.put("addParticipants", formManageParticipants.getInitialComponent());
addParticipantButton = LinkFactory.createButton("participants.add", participantsVC, this);
removeAsListenerAndDispose(manageParticipantsModalCntrl);
manageParticipantsModalCntrl = new CloseableModalController(getWindowControl(), "close", participantsVC, true, translate("dates.table.participant.manage"));
......@@ -177,17 +169,6 @@ public class DENManageParticipantsController extends BasicController {
showWarning("participants.message.empty");
}
}
} else if(source == formManageParticipants && event == DENManageParticipantsForm.ADD_PARTICIPANTS) {
//open user search controller to manually add users in date
removeAsListenerAndDispose(userSearchCntrl);
userSearchCntrl = new UserSearchController(ureq, getWindowControl(), true, true);
listenTo(userSearchCntrl);
removeAsListenerAndDispose(userSearchCMC);
userSearchCMC = new CloseableModalController(getWindowControl(), "close", userSearchCntrl.getInitialComponent());
listenTo(userSearchCMC);
userSearchCMC.activate();
} else if(source == userSearchCntrl) {
if(event == Event.CANCELLED_EVENT) {
userSearchCMC.deactivate();
......@@ -286,7 +267,18 @@ public class DENManageParticipantsController extends BasicController {
@Override
public void event(UserRequest ureq, Component source, Event event) {
// nothing to do
if(source == addParticipantButton) {
//open user search controller to manually add users in date
removeAsListenerAndDispose(userSearchCntrl);
userSearchCntrl = new UserSearchController(ureq, getWindowControl(), true, true);
listenTo(userSearchCntrl);
removeAsListenerAndDispose(userSearchCMC);
userSearchCMC = new CloseableModalController(getWindowControl(), "close", userSearchCntrl.getInitialComponent());
listenTo(userSearchCMC);
userSearchCMC.activate();
}
}
private void showError() {
......@@ -318,11 +310,8 @@ public class DENManageParticipantsController extends BasicController {
addedNotificationCtr = new MailNotificationEditController(getWindowControl(), ureq, mailTempl, false, false, true);
listenTo(addedNotificationCtr);
VelocityContainer sendNotificationVC = createVelocityContainer("sendnotification");
sendNotificationVC.put("notificationForm", addedNotificationCtr.getInitialComponent());
removeAsListenerAndDispose(notificationCmc);
notificationCmc = new CloseableModalController(getWindowControl(), "close", sendNotificationVC);
notificationCmc = new CloseableModalController(getWindowControl(), "close", addedNotificationCtr.getInitialComponent());
listenTo(notificationCmc);
notificationCmc.activate();
......@@ -334,10 +323,8 @@ public class DENManageParticipantsController extends BasicController {
addedNotificationCtr = new MailNotificationEditController(getWindowControl(), ureq, mailTempl, false, false, true);
listenTo(addedNotificationCtr);
VelocityContainer sendNotificationVC = createVelocityContainer("sendnotification");
sendNotificationVC.put("notificationForm", addedNotificationCtr.getInitialComponent());
removeAsListenerAndDispose(notificationCmc);
notificationCmc = new CloseableModalController(getWindowControl(), "close", sendNotificationVC);
notificationCmc = new CloseableModalController(getWindowControl(), "close", addedNotificationCtr.getInitialComponent());
listenTo(notificationCmc);
notificationCmc.activate();
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* BPS Bildungsportal Sachsen GmbH, http://www.bps-system.de
* <p>
*/
package de.bps.course.nodes.den;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.FormItemContainer;
import org.olat.core.gui.components.form.flexible.impl.FormBasicController;
import org.olat.core.gui.components.form.flexible.impl.FormEvent;
import org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
public class DENManageParticipantsForm extends FormBasicController {
public static final Event ADD_PARTICIPANTS = new Event("addParticipants");
private FormLinkImpl addParticipant;
public DENManageParticipantsForm(UserRequest ureq, WindowControl wControl) {
super(ureq, wControl);
initForm(this.flc, this, ureq);
}
@Override
protected void doDispose() {
//nothing
}
@Override
protected void formOK(UserRequest arg0) {
//nothing to do
}
@Override
protected void initForm(FormItemContainer formLayout, Controller listener,
UserRequest ureq) {
addParticipant = new FormLinkImpl("addParticipantsButton", ADD_PARTICIPANTS.getCommand(), "participants.add", Link.BUTTON);
formLayout.add(addParticipant);
}
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if(source == addParticipant) {
fireEvent(ureq, ADD_PARTICIPANTS);
}
}
}
......@@ -28,13 +28,8 @@ import org.olat.core.commons.services.notifications.SubscriptionContext;
import org.olat.core.commons.services.notifications.ui.ContextualSubscriptionController;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.form.flexible.FormItem;
import org.olat.core.gui.components.form.flexible.FormItemContainer;
import org.olat.core.gui.components.form.flexible.impl.FormBasicController;
import org.olat.core.gui.components.form.flexible.impl.FormEvent;
import org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer;
import org.olat.core.gui.components.form.flexible.impl.elements.FormLinkImpl;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.table.Table;
import org.olat.core.gui.components.table.TableController;
import org.olat.core.gui.components.table.TableEvent;
......@@ -71,7 +66,10 @@ public class DENRunController extends BasicController implements GenericEventLis
private DENRunTableDataModel runTableData;
private List<KalendarEvent> runTableDataList;
private TableController runDENTable;
private FormBasicController authorOptions;
private Link manageDatesBtn;
private Link enrollmentListBtn;
private CloseableModalController manageDatesModalCntrll, listParticipantsModalCntrll;
private DENManager denManager;
......@@ -119,10 +117,11 @@ public class DENRunController extends BasicController implements GenericEventLis
runVC.put("subscription", csc.getInitialComponent());
}
authorOptions = new AuthorOptionsForm(ureq, getWindowControl());
authorOptions.addControllerListener(this);
manageDatesBtn = LinkFactory.createButton("config.dates", runVC, this);
manageDatesBtn.setIconLeftCSS("o_icon o_icon-fw o_icon_calendar");
enrollmentListBtn = LinkFactory.createButton("run.enrollment.list", runVC, this);
enrollmentListBtn.setIconLeftCSS("o_icon o_icon-fw o_icon_user");
runVC.contextPut("showAuthorBtns", Boolean.TRUE);
runVC.put("authorOptions", authorOptions.getInitialComponent());
} else {
runVC.contextPut("showAuthorBtns", Boolean.FALSE);
}
......@@ -161,10 +160,6 @@ public class DENRunController extends BasicController implements GenericEventLis
removeAsListenerAndDispose(csc);
csc = null;
}
if(authorOptions != null) {
removeAsListenerAndDispose(authorOptions);
authorOptions = null;
}
if(runDENTable != null) {
removeAsListenerAndDispose(runDENTable);
runDENTable = null;
......@@ -185,7 +180,24 @@ public class DENRunController extends BasicController implements GenericEventLis
@Override
public void event(UserRequest ureq, Component source, Event event) {
//nothing to do
if(source == manageDatesBtn) {
//management of dates
removeAsListenerAndDispose(manageDatesModalCntrll);
DENManageDatesController datesCtr = new DENManageDatesController(ureq, getWindowControl(), ores, courseNode);
listenTo(datesCtr);
manageDatesModalCntrll = new CloseableModalController(getWindowControl(), "close", datesCtr.getInitialComponent(), true, translate("config.dates"));
manageDatesModalCntrll.activate();
listenTo(manageDatesModalCntrll);
} else if(source == enrollmentListBtn) {
//list of participants
removeAsListenerAndDispose(listParticipantsModalCntrll);
DENManageParticipantsController partsCtr = new DENManageParticipantsController(ureq, getWindowControl(), ores, courseNode);
listenTo(partsCtr);
listParticipantsModalCntrll = new CloseableModalController(getWindowControl(), "close", partsCtr.getInitialComponent(), true, translate("dates.table.list"));
listParticipantsModalCntrll.activate();
listenTo(listParticipantsModalCntrll);
}
}
@Override
......@@ -211,21 +223,7 @@ public class DENRunController extends BasicController implements GenericEventLis
NotificationsManager.getInstance().markPublisherNews(subsContext, ureq.getIdentity(), true);
// </OPAL-122>
}
} else if(authorOptions == source) {
if(event == AuthorOptionsForm.MANAGE_EVENT) {
//management of dates
DENManageDatesController datesCtr = new DENManageDatesController(ureq, getWindowControl(), ores, courseNode);
manageDatesModalCntrll = new CloseableModalController(getWindowControl(), "close", datesCtr.getInitialComponent(), true, translate("config.dates"));
manageDatesModalCntrll.addControllerListener(this);
manageDatesModalCntrll.activate();
} else if(event == AuthorOptionsForm.LIST_EVENT) {
//list of participants
DENManageParticipantsController partsCtr = new DENManageParticipantsController(ureq, getWindowControl(), ores, courseNode);
listParticipantsModalCntrll = new CloseableModalController(getWindowControl(), "close", partsCtr.getInitialComponent(), true, translate("dates.table.list"));
listParticipantsModalCntrll.addControllerListener(this);
listParticipantsModalCntrll.activate();
}
}
}
}
private void showError() {
......@@ -244,46 +242,3 @@ public class DENRunController extends BasicController implements GenericEventLis
}
}
class AuthorOptionsForm extends FormBasicController {
public static final Event MANAGE_EVENT = new Event("manage");
public static final Event LIST_EVENT = new Event("list");
private FormLinkImpl manageDatesBtn, enrollmentListBtn;
public AuthorOptionsForm(UserRequest ureq, WindowControl wControl) {
super(ureq, wControl);
initForm(this.flc, this, ureq);
}
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FormLayoutContainer horLayout = FormLayoutContainer.createHorizontalFormLayout("", getTranslator());
formLayout.add(horLayout);
manageDatesBtn = new FormLinkImpl("preferencesButton", MANAGE_EVENT.getCommand(), "config.dates", Link.BUTTON);
enrollmentListBtn = new FormLinkImpl("enrollmentListButton", LIST_EVENT.getCommand(), "run.enrollment.list", Link.BUTTON);
horLayout.add(manageDatesBtn);
horLayout.add(enrollmentListBtn);
}
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if(source == manageDatesBtn) {
fireEvent(ureq, AuthorOptionsForm.MANAGE_EVENT);
} else if(source == enrollmentListBtn) {
fireEvent(ureq, AuthorOptionsForm.LIST_EVENT);
}
}
@Override
protected void doDispose() {
//nothing to do
}
@Override
protected void formOK(UserRequest ureq) {
//nothing to do
}
}
......@@ -25,6 +25,7 @@ import java.util.List;
import org.olat.commons.calendar.model.KalendarEvent;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.table.DefaultTableDataModel;
import org.olat.core.gui.components.table.TableDataModelWithMarkableRows;
import org.olat.core.gui.translator.Translator;
import org.olat.core.id.Identity;
......@@ -34,7 +35,7 @@ import de.bps.course.nodes.DENCourseNode;
* TableDataModel for run view of date enrollment
* @author skoeber
*/
public class DENRunTableDataModel extends DefaultTableDataModel<KalendarEvent> {
public class DENRunTableDataModel extends DefaultTableDataModel<KalendarEvent> implements TableDataModelWithMarkableRows<KalendarEvent> {
public static final String CMD_ENROLL_IN_DATE = "cmd.enroll.in.date";
public static final String CMD_ENROLLED_CANCEL = "cmd.enrolled.cancel";
......@@ -67,6 +68,8 @@ public class DENRunTableDataModel extends DefaultTableDataModel<KalendarEvent> {
public int getColumnCount() {
return COLUMN_COUNT;
}
@Override
public Object getValueAt(int row, int col) {
......@@ -99,7 +102,7 @@ public class DENRunTableDataModel extends DefaultTableDataModel<KalendarEvent> {
return numStrBuf.toString();
case 6:
//status
Boolean isEnrolled = denManager.isEnrolledInDate(identity, event);
boolean isEnrolled = denManager.isEnrolledInDate(identity, event);
if(isEnrolled)
return translator.translate("dates.table.run.enrolled");
else if(denManager.isDateFull(event))
......@@ -124,4 +127,11 @@ public class DENRunTableDataModel extends DefaultTableDataModel<KalendarEvent> {
default: return "error";
}
}
@Override
public String getRowCssClass(int rowId) {
KalendarEvent event = getObject(rowId);
boolean isEnrolled = denManager.isEnrolledInDate(identity, event);
return (isEnrolled ? "o_row_selected" : "");
}
}
<div class="pull-right">$r.contextHelp("de.bps.course.nodes.den",$chelp,"help.hover.den")</div>
<table>
#if ($f.isVisible("subject"))
<tr valign="top">
<td>$r.render("subject_LABEL")
<td>#if($f.isMandatory("subject"))*#end</td>
<td>$r.render("subject")$r.render("subject_ERROR")</td>
</tr>
#end #if ($f.isVisible("begin"))
<tr valign="top">
<td>$r.render("begin_LABEL")</td>
<td>#if($f.isMandatory("begin"))*#end</td>
<td>$r.render("begin")$r.render("begin_EXAMPLE")$r.render("begin_ERROR")</td>
</tr>
#end #if ($f.isVisible("duration"))
<tr valign="top">
<td>$r.render("duration_LABEL")</td>
<td>#if($f.isMandatory("duration"))*#end</td>
<td>$r.render("duration")$r.render("duration_EXAMPLE")$r.render("duration_ERROR")</td>
</tr>
#end #if ($f.isVisible("pause"))
<tr valign="top">
<td>$r.render("pause_LABEL")</td>
<td>#if($f.isMandatory("pause"))*#end</td>
<td>$r.render("pause")$r.render("pause_EXAMPLE")$r.render("pause_ERROR")</td>
</tr>
#end #if ($f.isVisible("retake"))
<tr valign="top">
<td>$r.render("retake_LABEL")</td>
<td>#if($f.isMandatory("retake"))*#end</td>
<td>$r.render("retake")$r.render("retake_ERROR")</td>
</tr>
#end #if ($f.isVisible("participants"))
<tr valign="top">
<td>$r.render("participants_LABEL")</td>
<td>#if($f.isMandatory("participants"))*#end</td>
<td>$r.render("participants")$r.render("participants_ERROR")</td>
</tr>
#end #if ($f.isVisible("move"))
<tr valign="top">
<td>$r.render("move_LABEL")</td>
<td>#if($f.isMandatory("move"))*#end</td>
<td>$r.render("move")$r.render("move_EXAMPLE")$r.render("move_ERROR")</td>
</tr>
#end
</table>
<table>
#if ($f.isVisible("location"))
<tr valign="top">
<td>$r.render("location_LABEL")</td>
<td>#if($f.isMandatory("location"))*#end</td>
<td>$r.render("location")$r.render("location_ERROR")</td>
</tr>
#end #if ($f.isVisible("comment"))
<tr valign="top">
<td>$r.render("comment_LABEL")</td>
<td>#if($f.isMandatory("comment"))*#end</td>
<td>$r.render("comment")$r.render("comment_ERROR")</td>
</tr>
#end
</table>
<div class="o_button_group">
$r.render("submitBtn")
</div>
<div>
$r.render("dateTitle")
$r.render("dateTimeframe")
<div class="o_block">
<table class="table-condensed">
<tr>
<th>
$r.translate("dates.table.subject")
</th>
<td>
$dateTitle
</td>
</tr>
<tr>
<th>
$r.translate("dates.table.date")
</th>
<td>
$dateTimeframe
</td>
</tr>
</table>
</div>
<br>
<div>
$r.render("participantsTable")
</div>
<div>
$r.render("addParticipants")
$r.render("participantsTable")
<div class="o_button_group">
$r.render("participants.add")
</div>
\ No newline at end of file
#if ($r.available("subscription"))
<div class="clearfix">
$r.render("subscription")
</div>
#end
#if($showAuthorBtns)
$r.render("authorOptions")
<div class="o_button_group o_button_group_right">
<div class="btn-group">
$r.render("config.dates")
$r.render("run.enrollment.list")
</div>
</div>
#end
$r.render("datesTable")
\ No newline at end of file
<h4 class="o_icon_left_wrapper">
<span class="o_group_icon">
$title
</span>
<h4>
<i class="o_icon o_icon-fw o_icon_group"> </i>
$title
</h4>
$r.render("contactForm")
$r.render("notificationForm")
......@@ -244,23 +244,21 @@ public class TableRenderer extends DefaultComponentRenderer {
private void appendDataRows(final Renderer renderer, final StringOutput target, final URLBuilder ubu, Table table, boolean iframePostEnabled, int cols, boolean selRowUnSelectable, int selRowId,
int startRowId, int endRowId) {
String cssClass = "";
target.append("<tbody>");
long startRowLoop = 0;
if (log.isDebug()) {
startRowLoop = System.currentTimeMillis();
}
int lastVisibleRowId = endRowId - 1;
for (int i = startRowId; i < endRowId; i++) {
String cssClass = "";
// the position of the selected row in the tabledatamodel
int currentPosInModel = table.getSortedRow(i);
boolean isMark = selRowUnSelectable && (selRowId == currentPosInModel);
// VCRP-16
TableDataModel<?> model = table.getTableDataModel();
if (model instanceof TableDataModelWithMarkableRows) {
TableDataModelWithMarkableRows markableModel = (TableDataModelWithMarkableRows) model;
String rowCss = markableModel.getRowCssClass(i);
String rowCss = markableModel.getRowCssClass(currentPosInModel);
if (rowCss != null) {
cssClass += " " + rowCss;
}
......
......@@ -59,7 +59,9 @@
/*
* datepicker
*/
.ui-datepicker {
z-index: 2000 ! important;
@include box-shadow(0px 1px 5px -1px rgba(0,0,0,.15));
.ui-widget-header {
......
This diff is collapsed.
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