use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.
the class ViteroBookingsEditController method reloadModel.
protected void reloadModel() {
try {
bookingDisplays.clear();
List<ViteroBooking> bookings = viteroManager.getBookings(group, ores, subIdentifier);
int i = 0;
for (ViteroBooking booking : bookings) {
BookingDisplay display = new BookingDisplay(booking);
if (!readOnly) {
display.setDeleteButton(uifactory.addFormLink("delete_" + i++, "delete", "delete", flc, Link.BUTTON));
display.setEditButton(uifactory.addFormLink("edit_" + i++, "edit", "edit", flc, Link.BUTTON));
}
display.setUsersButton(uifactory.addFormLink("users_" + i++, "users", "users", flc, Link.BUTTON));
display.setGroupButton(uifactory.addFormLink("group_" + i++, "group.open", "group.open", flc, Link.BUTTON));
bookingDisplays.add(display);
}
flc.contextPut("bookingDisplays", bookingDisplays);
} catch (VmsNotAvailableException e) {
showError(VmsNotAvailableException.I18N_KEY);
}
}
use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.
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);
}
use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
the class ViteroBookingsController 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 ("start".equals(e.getActionId())) {
openVitero(ureq, booking);
} else if ("signin".equals(e.getActionId())) {
signInVitero(ureq, booking);
} else if ("signout".equals(e.getActionId())) {
signOutVitero(ureq, booking);
} else if ("opengroup".equals(e.getActionId())) {
openGroup(ureq, booking);
}
}
} else if (source == cmc) {
removeAsListenerAndDispose(cmc);
viteroGroupVC = null;
cmc = null;
}
super.event(ureq, source, event);
}
use of org.olat.modules.vitero.model.ViteroBooking in project OpenOLAT by OpenOLAT.
the class ViteroBookingWebService method getRooms.
/**
* returns the list of booking of the resource.
*
* @response.representation.200.qname {http://www.example.com}viteroBookingVO
* @response.representation.200.mediaType application/xml, application/json
* @response.representation.200.doc This is the list of all bookings of a resource
* @response.representation.200.example {@link org.olat.modules.vitero.restapi.Examples#SAMPLE_ViteroBookingVO}
* @return The list of vitero booking
*/
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getRooms() {
try {
List<ViteroBooking> bookings = viteroManager.getBookings(null, ores, subIdentifier);
ViteroBookingVO[] bookingVos = new ViteroBookingVO[bookings.size()];
int count = 0;
for (ViteroBooking booking : bookings) {
bookingVos[count++] = new ViteroBookingVO(booking);
}
return Response.ok(bookingVos).build();
} catch (VmsNotAvailableException e) {
log.error("", e);
return handleNotAvailableException();
}
}
Aggregations