use of org.olat.modules.vitero.model.ViteroBooking in project openolat by klemens.
the class ViteroManager method slayZombies.
public void slayZombies() {
List<Property> properties = propertyManager.listProperties(null, null, null, VMS_CATEGORY_ZOMBIE, null);
for (Property property : properties) {
try {
String bookingStr = property.getTextValue();
ViteroBooking booking = deserializeViteroBooking(bookingStr);
deleteBooking(booking);
} catch (VmsNotAvailableException e) {
// try later
log.debug("Cannot clean-up vitero room, vms not available");
} catch (Exception e) {
log.error("", e);
}
}
}
use of org.olat.modules.vitero.model.ViteroBooking in project openolat by klemens.
the class ViteroBookingEditController method formOK.
@Override
protected void formOK(UserRequest ureq) {
String name = groupName.getValue();
booking.setGroupName(name);
Date begin = beginChooser.getDate();
booking.setStart(begin);
int beginBuffer = 0;
if (beginBufferEl.isOneSelected()) {
beginBuffer = Integer.parseInt(beginBufferEl.getSelectedKey());
}
booking.setStartBuffer(beginBuffer);
Date end = endChooser.getDate();
booking.setEnd(end);
int endBuffer = 0;
if (endBufferEl.isOneSelected()) {
endBuffer = Integer.parseInt(endBufferEl.getSelectedKey());
}
booking.setEndBuffer(endBuffer);
int roomSize = -1;
if (roomSizeEl.isOneSelected()) {
roomSize = Integer.parseInt(roomSizeEl.getSelectedKey());
}
booking.setRoomSize(roomSize);
boolean auto = autoSignIn.isMultiselect() && autoSignIn.isSelected(0);
booking.setAutoSignIn(auto);
try {
if (booking.getBookingId() >= 0) {
ViteroBooking updatedBooking = viteroManager.updateBooking(group, ores, subIdentifier, booking);
if (updatedBooking != null) {
showInfo("booking.ok");
fireEvent(ureq, Event.DONE_EVENT);
} else {
showError("error.unkown");
}
} else {
ViteroStatus status = viteroManager.createBooking(group, ores, subIdentifier, booking);
if (status.isOk()) {
showInfo("booking.ok");
fireEvent(ureq, Event.DONE_EVENT);
} else {
showError(status.getError().i18nKey());
}
}
} catch (VmsNotAvailableException e) {
showError(VmsNotAvailableException.I18N_KEY);
}
}
use of org.olat.modules.vitero.model.ViteroBooking in project openolat by klemens.
the class ViteroBookingsAdminController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == tableCtr) {
if (event instanceof TableEvent) {
TableEvent e = (TableEvent) event;
int row = e.getRowId();
ViteroBooking booking = (ViteroBooking) tableCtr.getTableDataModel().getObject(row);
if ("delete".equals(e.getActionId())) {
confirmDeleteVitero(ureq, booking);
} else if ("infos".equals(e.getActionId())) {
openInfoBox(ureq, booking);
} else if ("resource".equals(e.getActionId())) {
openResource(ureq, booking);
}
}
} else if (source == dialogCtr) {
if (DialogBoxUIFactory.isOkEvent(event)) {
ViteroBooking booking = (ViteroBooking) dialogCtr.getUserObject();
deleteBooking(booking);
}
} else if (source == cmc) {
removeAsListenerAndDispose(infoController);
removeAsListenerAndDispose(cmc);
} else if (source == infoController) {
cmc.deactivate();
removeAsListenerAndDispose(infoController);
removeAsListenerAndDispose(cmc);
reloadModel();
}
}
use of org.olat.modules.vitero.model.ViteroBooking in project openolat by klemens.
the class ViteroBookingsEditController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == cmc) {
removeAsListenerAndDispose(bookingController);
removeAsListenerAndDispose(cmc);
} else if (source == bookingController) {
if (Event.DONE_EVENT.equals(event)) {
fireEvent(ureq, event);
}
cmc.deactivate();
removeAsListenerAndDispose(bookingController);
removeAsListenerAndDispose(cmc);
reloadModel();
} else if (source == dialogCtr) {
if (DialogBoxUIFactory.isOkEvent(event)) {
ViteroBooking booking = (ViteroBooking) dialogCtr.getUserObject();
deleteBooking(booking);
}
} else if (source == warningGroupCtr) {
removeAsListenerAndDispose(warningGroupCtr);
warningGroupCtr = null;
}
}
use of org.olat.modules.vitero.model.ViteroBooking in project openolat by klemens.
the class ViteroBookingsEditController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == newButton) {
newBooking(ureq);
} else if (source == occupiedRoomsLink) {
occupiedRooms(ureq);
} else if (source instanceof FormLink) {
for (BookingDisplay display : bookingDisplays) {
if (display.getDeleteButton() == source) {
confirmDeleteBooking(ureq, display);
break;
} else if (display.getEditButton() == source) {
ViteroBooking viteroBooking = display.getMeeting();
editBooking(ureq, viteroBooking);
break;
} else if (display.getUsersButton() == source) {
ViteroBooking viteroBooking = display.getMeeting();
usersBooking(ureq, viteroBooking);
break;
} else if (display.getGroupButton() == source) {
ViteroBooking viteroBooking = display.getMeeting();
openGroup(ureq, viteroBooking);
break;
}
}
reloadModel();
}
super.formInnerEvent(ureq, source, event);
}
Aggregations