use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project OpenOLAT by OpenOLAT.
the class GoToRecordingsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.name.i18nHeaderKey(), RecordingsCols.name.ordinal(), true, RecordingsCols.name.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.start.i18nHeaderKey(), RecordingsCols.start.ordinal(), true, RecordingsCols.start.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.end.i18nHeaderKey(), RecordingsCols.end.ordinal(), true, RecordingsCols.end.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
tableModel = new GoToRecordingsTableModel(columnsModel);
GoToError error = new GoToError();
List<GoToRecordingsG2T> recordings = meetingMgr.getRecordings(meeting, error);
if (recordings == null) {
recordings = new ArrayList<>(1);
}
tableModel.setObjects(recordings);
tableEl = uifactory.addTableElement(getWindowControl(), "recordings", tableModel, getTranslator(), formLayout);
tableEl.setEmtpyTableMessageKey("recordings.empty");
tableEl.setCustomizeColumns(false);
}
use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project OpenOLAT by OpenOLAT.
the class GoToRecordingsController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (tableEl == source) {
if (event instanceof SelectionEvent) {
SelectionEvent se = (SelectionEvent) event;
if ("select".equals(se.getCommand())) {
GoToRecordingsG2T recording = tableModel.getObject(se.getIndex());
doView(ureq, recording);
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project OpenOLAT by OpenOLAT.
the class GoToMeetingManagerImpl method getRecordings.
@Override
public List<GoToRecordingsG2T> getRecordings(GoToMeeting meeting, GoToError error) {
try (CloseableHttpClient httpClient = HttpClientBuilder.create().build()) {
GoToOrganizer organizer = meeting.getOrganizer();
String url = gotoTrainingUrl + "/trainings/" + meeting.getMeetingKey() + "/recordings";
HttpGet get = new HttpGet(url);
get.addHeader("Accept", "application/json");
get.addHeader("Authorization", "OAuth oauth_token=" + organizer.getAccessToken());
get.addHeader("Content-type", "application/json");
HttpResponse response = httpClient.execute(get);
int status = response.getStatusLine().getStatusCode();
if (status == 200) {
// deleted
String content = EntityUtils.toString(response.getEntity());
List<GoToRecordingsG2T> recordings = GoToJsonUtil.parseRecordings(content);
return recordings;
} else {
logGoToError("getRecordings", response, error);
return null;
}
} catch (Exception e) {
log.error("", e);
return null;
}
}
use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project openolat by klemens.
the class GoToRecordingsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// add the table
FlexiTableColumnModel columnsModel = FlexiTableDataModelFactory.createFlexiTableColumnModel();
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.name.i18nHeaderKey(), RecordingsCols.name.ordinal(), true, RecordingsCols.name.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.start.i18nHeaderKey(), RecordingsCols.start.ordinal(), true, RecordingsCols.start.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel(RecordingsCols.end.i18nHeaderKey(), RecordingsCols.end.ordinal(), true, RecordingsCols.end.name()));
columnsModel.addFlexiColumnModel(new DefaultFlexiColumnModel("select", translate("select"), "select"));
tableModel = new GoToRecordingsTableModel(columnsModel);
GoToError error = new GoToError();
List<GoToRecordingsG2T> recordings = meetingMgr.getRecordings(meeting, error);
if (recordings == null) {
recordings = new ArrayList<>(1);
}
tableModel.setObjects(recordings);
tableEl = uifactory.addTableElement(getWindowControl(), "recordings", tableModel, getTranslator(), formLayout);
tableEl.setEmtpyTableMessageKey("recordings.empty");
tableEl.setCustomizeColumns(false);
}
use of org.olat.modules.gotomeeting.model.GoToRecordingsG2T in project openolat by klemens.
the class GoToJsonUtil method parseRecordings.
/*
{
"recordingList": [
{
"recordingId": 0,
"name": "string",
"description": "string",
"registrationUrl": "string",
"downloadUrl": "string",
"startDate": "2016-03-31T14:00:00Z",
"endDate": "2016-03-31T15:00:00Z"
}
],
"trainingKey": 0
}
*/
protected static final List<GoToRecordingsG2T> parseRecordings(String content) {
try {
List<GoToRecordingsG2T> recordings = new ArrayList<>();
JSONObject jsonObj = new JSONObject(content);
JSONArray jsonArr = jsonObj.getJSONArray("recordingList");
for (int i = jsonArr.length(); i-- > 0; ) {
JSONObject recordingJson = jsonArr.getJSONObject(i);
GoToRecordingsG2T recording = new GoToRecordingsG2T();
recording.setRecordingId(recordingJson.optString("recordingId", null));
recording.setName(recordingJson.optString("name", null));
recording.setDescription(recordingJson.optString("description", null));
recording.setRegistrationUrl(recordingJson.optString("registrationUrl", null));
recording.setDownloadUrl(recordingJson.optString("downloadUrl", null));
String startDate = recordingJson.optString("startDate", null);
Date start = parseRecordingDateTime(startDate);
recording.setStartDate(start);
String endDate = recordingJson.optString("endDate", null);
Date end = parseRecordingDateTime(endDate);
recording.setEndDate(end);
recordings.add(recording);
}
return recordings;
} catch (Exception e) {
log.error("", e);
return null;
}
}
Aggregations