Switch Contribution Mode programmatically

There is two main modes when using Oracle WebCenter Portal:

  • Edit mode: To edit the pages through Oracle Composer. (CTRL + Shift + E)
  • Contribution mode: To edit the content from Oracle WebCenter Content. (CTRL + Shift + C)

In case of the Edit Mode you can access programmatically using public API or the OOTB Change Mode (Button, Link).

However, Contribution Mode doesn't provide a public way to do it.

Using the following code will do the work:

 

import oracle.adfinternal.view.page.editor.bean.PageEditorPanelBean;
import oracle.adfinternal.view.page.editor.utils.Utility;
 
 
if (ModeContext.getCurrent().isInEditMode()) {
    return;
}
 
PageEditorPanelBean pgEditorPanelBean = PageEditorPanelBean.getCurrentInstance();
 
pgEditorPanelBean.toggleCCView();
 
Utility.refreshPageCustomizable();

 

Now you can add this code to an actionListener or Java Script key event in order to switch Contribution Mode ON/OFF.

 

Contribution Mode Button
Contribution Mode Button

 

Note: This code uses adfinternal libraries. It is not recommended using internal libraries and JDeveloper will warn and mark as error the imports. Just use adfinternal classes if there isn't another way to do the work.

 

Warning Internal Libraries
Warning Internal Libraries

  Whitepaper. Migration to WebCenter Sites