org.olat.core.commons.modules.singlepage
Class SinglePageController

java.lang.Object
  extended by org.olat.core.gui.control.DefaultController
      extended by org.olat.core.commons.modules.singlepage.SinglePageController
All Implemented Interfaces:
Controller, ControllerEventListener, Disposable, CloneableController

public class SinglePageController
extends DefaultController
implements CloneableController

Description:
Wrapper controller that shows local html pages from the given folder / filename

Initial Date: Dec 16, 2004 EVENTS: to listening controllers: - OlatCmdEvent (which has to be accepted by calling accept() on the event) - NewInlineUriEvent if the user changed the page by clicking on a link

Author:
gnaegi

Constructor Summary
SinglePageController(UserRequest ureq, WindowControl wControl, boolean inIframe, VFSContainer rootContainer, java.lang.String fileName, java.lang.String currentUri, boolean allowRelativeLinks, boolean showHomeLink)
           
SinglePageController(UserRequest ureq, WindowControl wControl, boolean inIframe, VFSContainer rootContainer, java.lang.String fileName, java.lang.String currentUri, boolean allowRelativeLinks, boolean showHomeLink, OLATResourceable contextResourcable)
          Constructor for the generic single page controller.
SinglePageController(UserRequest ureq, WindowControl wControl, boolean inIframe, VFSContainer rootContainer, java.lang.String fileName, java.lang.String currentUri, boolean allowRelativeLinks, OLATResourceable ores)
          Constructor for the generic single page controller.
 
Method Summary
 void allowPageEditing()
          When you call this method the edit mode will be enabled.
 Controller cloneController(UserRequest ureq, WindowControl control)
           
 void event(UserRequest ureq, Component source, Event event)
          abstract event method for subclasses.
 void event(UserRequest ureq, Controller source, Event event)
          the only method of the interface controllereventlistener.
 void setAllowDownload(boolean allow)
           
 void setInternalLinkTreeModel(CustomLinkTreeModel customLinkTreeModel)
          Set the internal link tree model that should be used in the HTML editor to display links
 void setScaleFactorAndHeight(float scaleFactor, int displayHeight, boolean hideOverflow)
          Set a scale factor to enlarge / shrink the entire page.
 
Methods inherited from class org.olat.core.gui.control.DefaultController
addControllerListener, addLoggingResourceable, dispatchEvent, dispatchEvent, dispose, getControllerCount, getInitialComponent, getUserActivityLogger, getWindowControlForDebug, isDisposed, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.olat.core.gui.control.Controller
addControllerListener, dispatchEvent, dispose, getInitialComponent, getUserActivityLogger, getWindowControlForDebug, isDisposed
 

Constructor Detail

SinglePageController

public SinglePageController(UserRequest ureq,
                            WindowControl wControl,
                            boolean inIframe,
                            VFSContainer rootContainer,
                            java.lang.String fileName,
                            java.lang.String currentUri,
                            boolean allowRelativeLinks,
                            OLATResourceable ores)
Constructor for the generic single page controller. displays the html page (or any file if in iframe mode) and, if not on the first page and not in iframe mode, offers a button to return to the start page. (useful for a "home" button)

You can call the allowPageEditing after this construtor to allow users to edit the page

Parameters:
folderPath - The course folder which contains the single page html file
inIframe - if true, the contents are rendered within an iframe
fileName - the relative filePath in the material folder starting with a slash, e.g. /welcome.html or /docu/info.html
rootContainer - the root from which to resolve the files (like "the htdocs directory")
currentUri - if not null, the start page is set to this uri (instead of the fileName arg). relative to the -corrected- rootcontainer if !allowRelativeLinks
allowRelativeLinks - if true, an initial uri of /folder/a.html allows navigating till "/", if false, only navigating in /folder/ and subfolders of this folder is allowed

SinglePageController

public SinglePageController(UserRequest ureq,
                            WindowControl wControl,
                            boolean inIframe,
                            VFSContainer rootContainer,
                            java.lang.String fileName,
                            java.lang.String currentUri,
                            boolean allowRelativeLinks,
                            boolean showHomeLink)
Parameters:
ureq -
wControl -
inIframe -
rootContainer -
fileName -
currentUri -
allowRelativeLinks -
showHomeLink -

SinglePageController

public SinglePageController(UserRequest ureq,
                            WindowControl wControl,
                            boolean inIframe,
                            VFSContainer rootContainer,
                            java.lang.String fileName,
                            java.lang.String currentUri,
                            boolean allowRelativeLinks,
                            boolean showHomeLink,
                            OLATResourceable contextResourcable)
Constructor for the generic single page controller. displays the html page (or any file if in iframe mode) and, if not on the first page and not in iframe mode, offers a button to return to the start page. (useful for a "home" button)

You can call the allowPageEditing after this construtor to allow users to edit the page

Parameters:
folderPath - The course folder which contains the single page html file
inIframe - if true, the contents are rendered within an iframe
fileName - the relative filePath in the material folder starting with a slash, e.g. /welcome.html or /docu/info.html
rootContainer - the root from which to resolve the files (like "the htdocs directory")
currentUri - if not null, the start page is set to this uri (instead of the fileName arg). relative to the -corrected- rootcontainer if !allowRelativeLinks
allowRelativeLinks - if true, an initial uri of /folder/a.html allows navigating till "/", if false, only navigating in /folder/ and subfolders of this folder is allowed
showHomeLink - true enables the home link icon and link which is added to the SP, false removes icon and link.
Method Detail

allowPageEditing

public void allowPageEditing()
When you call this method the edit mode will be enabled. By default no edit is possible, you have to call this method after constrution time explicitly


setAllowDownload

public void setAllowDownload(boolean allow)

event

public void event(UserRequest ureq,
                  Controller source,
                  Event event)
Description copied from class: DefaultController
the only method of the interface controllereventlistener. always gets called when a controller we 'subscribed' to fires an event. we provide a default implementation here since there are many controllers which are standalone and need no subcontrollers

See Also:
DefaultController.event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)

event

public void event(UserRequest ureq,
                  Component source,
                  Event event)
Description copied from class: DefaultController
abstract event method for subclasses. the event received from the component we are listening to are always rerouted to this method here, except when the component has been disposed, in which case the events are simply ignored.

See Also:
DefaultController.event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)

setInternalLinkTreeModel

public void setInternalLinkTreeModel(CustomLinkTreeModel customLinkTreeModel)
Set the internal link tree model that should be used in the HTML editor to display links

Parameters:
customLinkTreeModel -

cloneController

public Controller cloneController(UserRequest ureq,
                                  WindowControl control)
Specified by:
cloneController in interface CloneableController
See Also:
CloneableController.cloneController(org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl)

setScaleFactorAndHeight

public void setScaleFactorAndHeight(float scaleFactor,
                                    int displayHeight,
                                    boolean hideOverflow)
Set a scale factor to enlarge / shrink the entire page. This is handy when a preview of a page should be displayed. E.g: 2 will scale the page by factor 2, 0.5 will shrink the page by factor 2

Parameters:
scaleFactor - > 0 or 1: don't scale; < 1: shrink page; > 1 enlarge page.
displayHeight - > 0: size to fit; > 0: fixed size in pixel
hideOverflow - true: don't show scroll-bars; false: default behavior with scroll-bars