Search in sources :

Example 1 with GenericMainController

use of org.olat.core.gui.control.generic.layout.GenericMainController in project OpenOLAT by OpenOLAT.

the class IQManager method createLockedMessageController.

private GenericMainController createLockedMessageController(UserRequest ureq, WindowControl wControl, String fullName) {
    // wrap simple message into mainLayout
    GenericMainController glc = new GenericMainController(ureq, wControl) {

        @Override
        public void init(UserRequest uureq) {
            Panel empty = new Panel("empty");
            setTranslator(Util.createPackageTranslator(this.getClass(), uureq.getLocale()));
            Controller contentCtr = MessageUIFactory.createInfoMessage(uureq, getWindowControl(), translate("status.currently.locked.title"), translate("status.currently.locked", fullName));
            // auto dispose later
            listenTo(contentCtr);
            Component resComp = contentCtr.getInitialComponent();
            LayoutMain3ColsController columnLayoutCtr = new LayoutMain3ColsController(uureq, getWindowControl(), empty, resComp, /*do not save no prefs*/
            null);
            // auto dispose later
            listenTo(columnLayoutCtr);
            putInitialPanel(columnLayoutCtr.getInitialComponent());
        }

        @Override
        protected Controller handleOwnMenuTreeEvent(Object uobject, UserRequest uureq) {
            // no menutree means no menu events.
            return null;
        }
    };
    glc.init(ureq);
    return glc;
}
Also used : Panel(org.olat.core.gui.components.panel.Panel) GenericMainController(org.olat.core.gui.control.generic.layout.GenericMainController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) GenericMainController(org.olat.core.gui.control.generic.layout.GenericMainController) IQEditController(org.olat.course.nodes.iq.IQEditController) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) Controller(org.olat.core.gui.control.Controller) Component(org.olat.core.gui.components.Component) UserRequest(org.olat.core.gui.UserRequest)

Example 2 with GenericMainController

use of org.olat.core.gui.control.generic.layout.GenericMainController in project OpenOLAT by OpenOLAT.

the class RepositoyUIFactory method createRepoEntryDisabledDueToSecurityMessageController.

/**
 * Create main controller that does nothing but displaying a message that
 * this resource is disabled due to security constraints
 *
 * @param ureq
 * @param wControl
 * @return
 */
public static GenericMainController createRepoEntryDisabledDueToSecurityMessageController(UserRequest ureq, WindowControl wControl) {
    // wrap simple message into mainLayout
    GenericMainController glc = new GenericMainController(ureq, wControl) {

        @Override
        public void init(UserRequest uureq) {
            Panel empty = new Panel("empty");
            setTranslator(Util.createPackageTranslator(RepositoryModule.class, uureq.getLocale()));
            MessageController contentCtr = MessageUIFactory.createInfoMessage(uureq, getWindowControl(), translate("security.disabled.title"), translate("security.disabled.info"));
            // auto dispose later
            listenTo(contentCtr);
            Component resComp = contentCtr.getInitialComponent();
            LayoutMain3ColsController columnLayoutCtr = new LayoutMain3ColsController(uureq, getWindowControl(), empty, resComp, /*do not save no prefs*/
            null);
            // auto dispose later
            listenTo(columnLayoutCtr);
            putInitialPanel(columnLayoutCtr.getInitialComponent());
        }

        @Override
        protected Controller handleOwnMenuTreeEvent(Object uobject, UserRequest uureq) {
            // no menutree means no menu events.
            return null;
        }
    };
    glc.init(ureq);
    return glc;
}
Also used : Panel(org.olat.core.gui.components.panel.Panel) MessageController(org.olat.core.gui.control.generic.messages.MessageController) GenericMainController(org.olat.core.gui.control.generic.layout.GenericMainController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Component(org.olat.core.gui.components.Component) UserRequest(org.olat.core.gui.UserRequest) RepositoryModule(org.olat.repository.RepositoryModule)

Example 3 with GenericMainController

use of org.olat.core.gui.control.generic.layout.GenericMainController in project OpenOLAT by OpenOLAT.

the class IQManager method createIQDisplayController.

/**
 * IMS QTI Display Controller used for IMS course node run view, or for the direct launching from learning resources.
 *
 * concurrent access check needed -> Editor may save (commit changes) while displaying reads old/new data mix (files and xml structure)
 *
 * @param res
 * @param resolver
 * @param type
 * @param secCallback
 * @param ureq
 * @param wControl
 * @return
 */
public MainLayoutController createIQDisplayController(OLATResourceable res, Resolver resolver, String type, IQSecurityCallback secCallback, UserRequest ureq, WindowControl wControl) {
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(res, OlatResourceableType.iq));
    // -- 99% of cases   -- 2) qti is ready to be run as test/survey
    if (CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(res, null)) {
        LockResult lockEntry = CoordinatorManager.getInstance().getCoordinator().getLocker().aquirePersistentLock(res, ureq.getIdentity(), null);
        String fullName = userManager.getUserDisplayName(lockEntry.getOwner());
        GenericMainController glc = createLockedMessageController(ureq, wControl, fullName);
        return glc;
    } else {
        Controller controller = new IQDisplayController(resolver, type, secCallback, ureq, wControl);
        // fxdiff BAKS-7 Resume function
        OLATResourceableListeningWrapperController dwc = new OLATResourceableListeningWrapperController(ureq, wControl, res, controller, null, ureq.getIdentity());
        return dwc;
    }
}
Also used : LockResult(org.olat.core.util.coordinate.LockResult) GenericMainController(org.olat.core.gui.control.generic.layout.GenericMainController) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) GenericMainController(org.olat.core.gui.control.generic.layout.GenericMainController) IQEditController(org.olat.course.nodes.iq.IQEditController) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) Controller(org.olat.core.gui.control.Controller)

Example 4 with GenericMainController

use of org.olat.core.gui.control.generic.layout.GenericMainController in project openolat by klemens.

the class RepositoyUIFactory method createRepoEntryDisabledDueToSecurityMessageController.

/**
 * Create main controller that does nothing but displaying a message that
 * this resource is disabled due to security constraints
 *
 * @param ureq
 * @param wControl
 * @return
 */
public static GenericMainController createRepoEntryDisabledDueToSecurityMessageController(UserRequest ureq, WindowControl wControl) {
    // wrap simple message into mainLayout
    GenericMainController glc = new GenericMainController(ureq, wControl) {

        @Override
        public void init(UserRequest uureq) {
            Panel empty = new Panel("empty");
            setTranslator(Util.createPackageTranslator(RepositoryModule.class, uureq.getLocale()));
            MessageController contentCtr = MessageUIFactory.createInfoMessage(uureq, getWindowControl(), translate("security.disabled.title"), translate("security.disabled.info"));
            // auto dispose later
            listenTo(contentCtr);
            Component resComp = contentCtr.getInitialComponent();
            LayoutMain3ColsController columnLayoutCtr = new LayoutMain3ColsController(uureq, getWindowControl(), empty, resComp, /*do not save no prefs*/
            null);
            // auto dispose later
            listenTo(columnLayoutCtr);
            putInitialPanel(columnLayoutCtr.getInitialComponent());
        }

        @Override
        protected Controller handleOwnMenuTreeEvent(Object uobject, UserRequest uureq) {
            // no menutree means no menu events.
            return null;
        }
    };
    glc.init(ureq);
    return glc;
}
Also used : Panel(org.olat.core.gui.components.panel.Panel) MessageController(org.olat.core.gui.control.generic.messages.MessageController) GenericMainController(org.olat.core.gui.control.generic.layout.GenericMainController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) Component(org.olat.core.gui.components.Component) UserRequest(org.olat.core.gui.UserRequest) RepositoryModule(org.olat.repository.RepositoryModule)

Example 5 with GenericMainController

use of org.olat.core.gui.control.generic.layout.GenericMainController in project openolat by klemens.

the class IQManager method createIQDisplayController.

/**
 * IMS QTI Display Controller used for IMS course node run view, or for the direct launching from learning resources.
 *
 * concurrent access check needed -> Editor may save (commit changes) while displaying reads old/new data mix (files and xml structure)
 *
 * @param res
 * @param resolver
 * @param type
 * @param secCallback
 * @param ureq
 * @param wControl
 * @return
 */
public MainLayoutController createIQDisplayController(OLATResourceable res, Resolver resolver, String type, IQSecurityCallback secCallback, UserRequest ureq, WindowControl wControl) {
    ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrap(res, OlatResourceableType.iq));
    // -- 99% of cases   -- 2) qti is ready to be run as test/survey
    if (CoordinatorManager.getInstance().getCoordinator().getLocker().isLocked(res, null)) {
        LockResult lockEntry = CoordinatorManager.getInstance().getCoordinator().getLocker().aquirePersistentLock(res, ureq.getIdentity(), null);
        String fullName = userManager.getUserDisplayName(lockEntry.getOwner());
        GenericMainController glc = createLockedMessageController(ureq, wControl, fullName);
        return glc;
    } else {
        Controller controller = new IQDisplayController(resolver, type, secCallback, ureq, wControl);
        // fxdiff BAKS-7 Resume function
        OLATResourceableListeningWrapperController dwc = new OLATResourceableListeningWrapperController(ureq, wControl, res, controller, null, ureq.getIdentity());
        return dwc;
    }
}
Also used : LockResult(org.olat.core.util.coordinate.LockResult) GenericMainController(org.olat.core.gui.control.generic.layout.GenericMainController) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) GenericMainController(org.olat.core.gui.control.generic.layout.GenericMainController) IQEditController(org.olat.course.nodes.iq.IQEditController) OLATResourceableListeningWrapperController(org.olat.core.util.controller.OLATResourceableListeningWrapperController) MainLayoutController(org.olat.core.gui.control.generic.layout.MainLayoutController) Controller(org.olat.core.gui.control.Controller)

Aggregations

LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)6 GenericMainController (org.olat.core.gui.control.generic.layout.GenericMainController)6 UserRequest (org.olat.core.gui.UserRequest)4 Component (org.olat.core.gui.components.Component)4 Panel (org.olat.core.gui.components.panel.Panel)4 Controller (org.olat.core.gui.control.Controller)4 MainLayoutController (org.olat.core.gui.control.generic.layout.MainLayoutController)4 OLATResourceableListeningWrapperController (org.olat.core.util.controller.OLATResourceableListeningWrapperController)4 IQEditController (org.olat.course.nodes.iq.IQEditController)4 MessageController (org.olat.core.gui.control.generic.messages.MessageController)2 LockResult (org.olat.core.util.coordinate.LockResult)2 RepositoryModule (org.olat.repository.RepositoryModule)2