use of com.github.openjson.JSONObject in project openmeetings by apache.
the class OmAjaxClientInfoBehavior method renderHead.
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forReference(MAIN_JS)));
response.render(new PriorityHeaderItem(JavaScriptHeaderItem.forScript(String.format("OmUtil.init(%s)", new JSONObject().put("debug", DEVELOPMENT == Application.get().getConfigurationType())), "om-util-init")));
}
use of com.github.openjson.JSONObject in project openmeetings by apache.
the class WbPanel method internalWbLoad.
@Override
void internalWbLoad(StringBuilder sb) {
Long langId = rp.getClient().getUser().getLanguageId();
if (!wbm.contains(roomId) && rp.getRoom().getFiles() != null && !rp.getRoom().getFiles().isEmpty()) {
if (wbm.tryLock(roomId)) {
try {
TreeMap<Long, List<BaseFileItem>> files = new TreeMap<>();
for (RoomFile rf : rp.getRoom().getFiles()) {
List<BaseFileItem> bfl = files.get(rf.getWbIdx());
if (bfl == null) {
files.put(rf.getWbIdx(), new ArrayList<>());
bfl = files.get(rf.getWbIdx());
}
bfl.add(rf.getFile());
}
Whiteboards _wbs = wbm.get(roomId, langId);
for (Map.Entry<Long, List<BaseFileItem>> e : files.entrySet()) {
Whiteboard wb = wbm.add(roomId, langId);
_wbs.setActiveWb(wb.getId());
for (BaseFileItem fi : e.getValue()) {
sendFileToWb(fi, false);
}
}
} finally {
wbm.unlock(roomId);
}
}
}
Whiteboards wbs = wbm.get(roomId, langId);
loadWhiteboards(sb, rp.getClient(), wbs, wbm.list(roomId));
JSONObject wbj = getWbJson(wbs.getActiveWb());
sb.append("WbArea.activateWb(").append(wbj).append(");");
Whiteboard wb = wbs.get(wbs.getActiveWb());
if (wb != null) {
sb.append("WbArea.setSlide(").append(wbj.put(ATTR_SLIDE, wb.getSlide())).append(");");
}
sb.append("WbArea.loadVideos();");
}
use of com.github.openjson.JSONObject in project openmeetings by apache.
the class WbPanel method clearAll.
private void clearAll(Long roomId, long wbId) {
Whiteboard wb = wbm.get(roomId).get(wbId);
if (wb == null) {
return;
}
JSONArray arr = getArray(wb.toJson(), null);
if (arr.length() != 0) {
addUndo(wb.getId(), new UndoObject(UndoObject.Type.remove, arr));
}
wb = wbm.clear(roomId, wbId);
sendWbAll(WbAction.clearAll, new JSONObject().put("wbId", wbId));
sendWbAll(WbAction.setSize, getAddWbJson(wb));
}
use of com.github.openjson.JSONObject in project openmeetings by apache.
the class WbWebSocketHelper method patchUrls.
private static JSONObject patchUrls(BaseFileItem fi, Client c, JSONObject _f) {
// deep copy to ensure thread safety
JSONObject f = new JSONObject(_f.toString());
switch(fi.getType()) {
case Video:
f.put(PARAM__SRC, patchUrl(f.getString(PARAM__SRC), c));
f.put(PARAM__POSTER, patchUrl(f.getString(PARAM__POSTER), c));
break;
case Recording:
f.put(PARAM__SRC, patchUrl(f.getString(PARAM__SRC), c));
f.put(PARAM__POSTER, patchUrl(f.getString(PARAM__POSTER), c));
break;
case Presentation:
f.put(PARAM__SRC, patchUrl(f.getString(PARAM__SRC), c));
break;
default:
f.put(PARAM_SRC, patchUrl(f.getString(PARAM_SRC), c));
break;
}
return f;
}
use of com.github.openjson.JSONObject in project openmeetings by apache.
the class WbWebSocketHelper method addFileUrl.
public static JSONObject addFileUrl(String ruid, JSONObject _file, BaseFileItem fi, Client c) {
JSONObject file = new JSONObject(_file.toString(new NullStringer()));
final FileSystemResourceReference ref;
final PageParameters pp = new PageParameters().add("id", fi.getId()).add("ruid", ruid).add("wuid", _file.optString("uid"));
if (c != null) {
pp.add("uid", c.getUid());
}
file.put("deleted", !fi.exists());
switch(fi.getType()) {
case Video:
ref = new RoomResourceReference();
file.put(PARAM__SRC, urlFor(ref, pp));
file.put(PARAM__POSTER, urlFor(new RoomPreviewResourceReference(), pp));
break;
case Recording:
ref = new Mp4RecordingResourceReference();
file.put(PARAM__SRC, urlFor(ref, pp));
file.put(PARAM__POSTER, urlFor(new PngRecordingResourceReference(), pp));
break;
case Presentation:
ref = new RoomResourceReference();
file.put(PARAM__SRC, urlFor(ref, pp));
break;
default:
ref = new RoomResourceReference();
file.put(PARAM_SRC, urlFor(ref, pp));
break;
}
return file;
}
Aggregations