Search in sources :

Example 26 with JSCommand

use of org.olat.core.gui.control.winmgr.JSCommand in project openolat by klemens.

the class RunMainController method updateCourseDataAttributes.

private void updateCourseDataAttributes(CourseNode calledCourseNode) {
    StringBuilder sb = new StringBuilder();
    sb.append("try {var oocourse = jQuery('.o_course_run');");
    if (calledCourseNode == null) {
        sb.append("oocourse.removeAttr('data-nodeid');");
    } else {
        sb.append("oocourse.attr('data-nodeid','");
        sb.append(Formatter.escapeDoubleQuotes(calledCourseNode.getIdent()));
        sb.append("');");
    }
    sb.append("oocourse=null;}catch(e){}");
    JSCommand jsc = new JSCommand(sb.toString());
    WindowControl wControl = getWindowControl();
    if (wControl != null && wControl.getWindowBackOffice() != null) {
        wControl.getWindowBackOffice().sendCommandTo(jsc);
    }
    // course title already set by BaseFullWebappController on tab activate
    if (calledCourseNode != null) {
        String newTitle = courseTitle + " - " + calledCourseNode.getShortTitle();
        getWindowControl().getWindowBackOffice().getWindow().setTitle(getTranslator(), newTitle);
    }
}
Also used : JSCommand(org.olat.core.gui.control.winmgr.JSCommand) WindowControl(org.olat.core.gui.control.WindowControl)

Aggregations

JSCommand (org.olat.core.gui.control.winmgr.JSCommand)26 WindowControl (org.olat.core.gui.control.WindowControl)4 ContextEntry (org.olat.core.id.context.ContextEntry)4 HistoryPoint (org.olat.core.id.context.HistoryPoint)4 JSONException (org.json.JSONException)2 JSONObject (org.json.JSONObject)2 Command (org.olat.core.gui.control.winmgr.Command)2 ScrollTopCommand (org.olat.core.gui.control.winmgr.ScrollTopCommand)2 UserSession (org.olat.core.util.UserSession)2 Preferences (org.olat.core.util.prefs.Preferences)2 AssessmentItemSession (org.olat.ims.qti21.AssessmentItemSession)2