use of org.olat.core.gui.control.winmgr.JSCommand in project openolat by klemens.
the class FIBEditorController method feedbackToTextElement.
private void feedbackToTextElement(String responseIdentifier, String solution) {
try {
JSONObject jo = new JSONObject();
jo.put("responseIdentifier", responseIdentifier);
jo.put("data-qti-solution", solution);
Command jsc = new JSCommand("try { tinymce.activeEditor.execCommand('qtiUpdateTextEntry', false, " + jo.toString() + "); } catch(e){if(window.console) console.log(e) }");
getWindowControl().getWindowBackOffice().sendCommandTo(jsc);
} catch (JSONException e) {
logError("", e);
}
}
use of org.olat.core.gui.control.winmgr.JSCommand in project openolat by klemens.
the class WeeklyCalendarController method doPrint.
private void doPrint(Date from, Date to) {
StringBuilder sb = new StringBuilder();
sb.append("window.open('" + printUrl + "/print.html', '_print','height=800,left=100,top=100,width=800,toolbar=no,titlebar=0,status=0,menubar=yes,location= no,scrollbars=1');");
printMapper.setFrom(from);
printMapper.setTo(to);
printMapper.setCalendarWrappers(calendarWrappers);
getWindowControl().getWindowBackOffice().sendCommandTo(new JSCommand(sb.toString()));
}
use of org.olat.core.gui.control.winmgr.JSCommand in project OpenOLAT by OpenOLAT.
the class ShareLinkController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
UserSession usess = ureq.getUserSession();
if (source == shareLinkVC && "setLandingPage".equals(event.getCommand()) && usess != null && usess.isAuthenticated()) {
HistoryPoint p = usess.getLastHistoryPoint();
if (p != null && StringHelper.containsNonWhitespace(p.getBusinessPath())) {
List<ContextEntry> ces = p.getEntries();
String landingPage = BusinessControlFactory.getInstance().getAsURIString(ces, true);
int start = landingPage.indexOf("/url/");
if (start != -1) {
// start with / after /url
landingPage = landingPage.substring(start + 4);
}
// update user prefs
Preferences prefs = usess.getGuiPreferences();
prefs.put(WindowManager.class, "landing-page", landingPage);
prefs.save();
getWindowControl().getWindowBackOffice().sendCommandTo(new JSCommand("showInfoBox(\"" + translate("info.header") + "\",\"" + translate("landingpage.set.message") + "\");"));
}
}
}
use of org.olat.core.gui.control.winmgr.JSCommand in project OpenOLAT by OpenOLAT.
the class WeeklyCalendarController method doPrint.
private void doPrint(Date from, Date to) {
StringBuilder sb = new StringBuilder();
sb.append("window.open('" + printUrl + "/print.html', '_print','height=800,left=100,top=100,width=800,toolbar=no,titlebar=0,status=0,menubar=yes,location= no,scrollbars=1');");
printMapper.setFrom(from);
printMapper.setTo(to);
printMapper.setCalendarWrappers(calendarWrappers);
getWindowControl().getWindowBackOffice().sendCommandTo(new JSCommand(sb.toString()));
}
use of org.olat.core.gui.control.winmgr.JSCommand in project OpenOLAT by OpenOLAT.
the class ValidatingVisitor method setTitle.
/**
* @param title The new title of this window (for browser history)
*/
public void setTitle(Translator translator, String newTitle) {
this.title = translator.translate("page.appname") + " - " + newTitle;
StringBuilder sb = new StringBuilder();
sb.append("document.title = \"");
sb.append(Formatter.escapeDoubleQuotes(this.title));
sb.append("\";");
JSCommand jsc = new JSCommand(sb.toString());
if (getWindowBackOffice() != null) {
getWindowBackOffice().sendCommandTo(jsc);
}
}
Aggregations