Search in sources :

Example 1 with HistoryTableDateModel

use of org.olat.modules.wiki.versioning.HistoryTableDateModel in project OpenOLAT by OpenOLAT.

the class WikiMainController method selectTab.

private void selectTab(UserRequest ureq, String command, String compName, WikiPage page, Wiki wiki) {
    // first release a potential lock on this page. only when the edit tab
    // is acitve
    // a lock will be created. in all other cases it is save to release an
    // existing lock
    doReleaseEditLock();
    if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED)) {
        updatePageContext(ureq, page);
    }
    if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_article")) {
    /**
     *********************************************************************
     * tabbed pane change to article
     *********************************************************************
     */
    // if(page.getContent().equals(""))
    // wikiArticleComp.setVisible(false);
    // FIXME:guido: ... && comp == articleContent)) etc.
    } else if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_edit")) {
        /**
         *********************************************************************
         * tabbed pane change to edit tab
         *********************************************************************
         */
        wikiEditForm.resetUpdateComment();
        updateFileAndLinkList(wiki);
        // try to edit acquire lock for this page
        tryToSetEditLock(page, ureq, ores);
    } else if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_versions")) {
        /**
         *********************************************************************
         * tabbed pane change to versioning tab
         *********************************************************************
         */
        versioningTableModel = new HistoryTableDateModel(wiki.getHistory(page), getTranslator());
        removeAsListenerAndDispose(versioningTableCtr);
        versioningTableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
        listenTo(versioningTableCtr);
        versioningTableModel.addColumnDescriptors(versioningTableCtr);
        versioningTableCtr.setTableDataModel(versioningTableModel);
        versioningTableCtr.modelChanged();
        versioningTableCtr.setSortColumn(1, false);
        versioningContent.put("versions", versioningTableCtr.getInitialComponent());
        versioningContent.contextPut("diffs", diffs);
    } else if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_discuss")) {
        /**
         *********************************************************************
         * tabbed pane change to discussion tab
         *********************************************************************
         */
        Forum forum = null;
        if (page.getForumKey() > 0) {
            forum = ForumManager.getInstance().loadForum(Long.valueOf(page.getForumKey()));
        }
        if (forum == null) {
            forum = ForumManager.getInstance().addAForum();
            page.setForumKey(forum.getKey().longValue());
            WikiManager.getInstance().updateWikiPageProperties(ores, page);
        }
        ForumCallback forumCallback = securityCallback.getForumCallback();
        ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(forum);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
        removeAsListenerAndDispose(forumController);
        forumController = new ForumController(ureq, bwControl, forum, forumCallback, false);
        listenTo(forumController);
        discussionContent.put("articleforum", forumController.getInitialComponent());
    }
    OLATResourceable pageRes = OresHelper.createOLATResourceableTypeWithoutCheck("path=" + page.getPageName());
    WindowControl wc = addToHistory(ureq, pageRes, null);
    OLATResourceable tabOres = tabs.getTabResource();
    addToHistory(ureq, tabOres, null, wc, true);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) TableController(org.olat.core.gui.components.table.TableController) ForumCallback(org.olat.modules.fo.ForumCallback) HistoryTableDateModel(org.olat.modules.wiki.versioning.HistoryTableDateModel) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry) ForumController(org.olat.modules.fo.ui.ForumController) Forum(org.olat.modules.fo.Forum)

Example 2 with HistoryTableDateModel

use of org.olat.modules.wiki.versioning.HistoryTableDateModel in project openolat by klemens.

the class WikiMainController method selectTab.

private void selectTab(UserRequest ureq, String command, String compName, WikiPage page, Wiki wiki) {
    // first release a potential lock on this page. only when the edit tab
    // is acitve
    // a lock will be created. in all other cases it is save to release an
    // existing lock
    doReleaseEditLock();
    if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED)) {
        updatePageContext(ureq, page);
    }
    if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_article")) {
    /**
     *********************************************************************
     * tabbed pane change to article
     *********************************************************************
     */
    // if(page.getContent().equals(""))
    // wikiArticleComp.setVisible(false);
    // FIXME:guido: ... && comp == articleContent)) etc.
    } else if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_edit")) {
        /**
         *********************************************************************
         * tabbed pane change to edit tab
         *********************************************************************
         */
        wikiEditForm.resetUpdateComment();
        updateFileAndLinkList(wiki);
        // try to edit acquire lock for this page
        tryToSetEditLock(page, ureq, ores);
    } else if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_versions")) {
        /**
         *********************************************************************
         * tabbed pane change to versioning tab
         *********************************************************************
         */
        versioningTableModel = new HistoryTableDateModel(wiki.getHistory(page), getTranslator());
        removeAsListenerAndDispose(versioningTableCtr);
        versioningTableCtr = new TableController(tableConfig, ureq, getWindowControl(), getTranslator());
        listenTo(versioningTableCtr);
        versioningTableModel.addColumnDescriptors(versioningTableCtr);
        versioningTableCtr.setTableDataModel(versioningTableModel);
        versioningTableCtr.modelChanged();
        versioningTableCtr.setSortColumn(1, false);
        versioningContent.put("versions", versioningTableCtr.getInitialComponent());
        versioningContent.contextPut("diffs", diffs);
    } else if (command.equals(TabbedPaneChangedEvent.TAB_CHANGED) && compName.equals("vc_discuss")) {
        /**
         *********************************************************************
         * tabbed pane change to discussion tab
         *********************************************************************
         */
        Forum forum = null;
        if (page.getForumKey() > 0) {
            forum = ForumManager.getInstance().loadForum(Long.valueOf(page.getForumKey()));
        }
        if (forum == null) {
            forum = ForumManager.getInstance().addAForum();
            page.setForumKey(forum.getKey().longValue());
            WikiManager.getInstance().updateWikiPageProperties(ores, page);
        }
        ForumCallback forumCallback = securityCallback.getForumCallback();
        ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(forum);
        WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ce, getWindowControl());
        removeAsListenerAndDispose(forumController);
        forumController = new ForumController(ureq, bwControl, forum, forumCallback, false);
        listenTo(forumController);
        discussionContent.put("articleforum", forumController.getInitialComponent());
    }
    OLATResourceable pageRes = OresHelper.createOLATResourceableTypeWithoutCheck("path=" + page.getPageName());
    WindowControl wc = addToHistory(ureq, pageRes, null);
    OLATResourceable tabOres = tabs.getTabResource();
    addToHistory(ureq, tabOres, null, wc, true);
}
Also used : OLATResourceable(org.olat.core.id.OLATResourceable) TableController(org.olat.core.gui.components.table.TableController) ForumCallback(org.olat.modules.fo.ForumCallback) HistoryTableDateModel(org.olat.modules.wiki.versioning.HistoryTableDateModel) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry) ForumController(org.olat.modules.fo.ui.ForumController) Forum(org.olat.modules.fo.Forum)

Aggregations

TableController (org.olat.core.gui.components.table.TableController)2 WindowControl (org.olat.core.gui.control.WindowControl)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 ContextEntry (org.olat.core.id.context.ContextEntry)2 Forum (org.olat.modules.fo.Forum)2 ForumCallback (org.olat.modules.fo.ForumCallback)2 ForumController (org.olat.modules.fo.ui.ForumController)2 HistoryTableDateModel (org.olat.modules.wiki.versioning.HistoryTableDateModel)2