|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.opencms.workplace.CmsWorkplace
org.opencms.workplace.tools.CmsToolDialog
org.opencms.workplace.CmsDialog
org.opencms.workplace.galleries.A_CmsAjaxGallery
public abstract class A_CmsAjaxGallery
Provides the general helper methods to generate the content of a gallery dialog used in the XML content editors, WYSIWYG editors and context menu. It
It is also used for AJAX requests to dynamically switch galleries or categories and get additional information for the currently active item of the dialog.
Extend this class for every gallery type (e.g. image gallery or download gallery) to build.
Field Summary | |
---|---|
static java.lang.String |
DIALOG_CHANGEITEMLINKURL
Request parameter value for the action: change the item link url value. |
static java.lang.String |
DIALOG_CHANGEITEMTITLE
Request parameter value for the action: change the item title property value. |
static java.lang.String |
DIALOG_GETACTIVEITEM
Request parameter value for the action: get the currently active item object. |
static java.lang.String |
DIALOG_GETCATEGORIES
Request parameter value for the action: get the category selection list. |
static java.lang.String |
DIALOG_GETGALLERIES
Request parameter value for the action: get the gallery selection list. |
static java.lang.String |
DIALOG_GETGALLERY
Request parameter value for the action: get a specific gallery. |
static java.lang.String |
DIALOG_GETITEMS
Request parameter value for the action: get the items for a gallery or category. |
static java.lang.String |
DIALOG_LIST
Request parameter value for the action: list gallery items. |
static java.lang.String |
LISTMODE_CATEGORY
The list mode name "category" for getting the items. |
static java.lang.String |
LISTMODE_GALLERY
The list mode name "gallery" for getting the items. |
protected java.lang.String |
m_galleryTypeParams
The optional parameters for the gallery from the XML configuration. |
static java.lang.String |
MODE_EDITOR
Request parameter value for the dialog mode: editor. |
static java.lang.String |
MODE_VIEW
Request parameter value for the dialog mode: view. |
static java.lang.String |
MODE_WIDGET
Request parameter value for the dialog mode: widget. |
static java.lang.String |
PARAM_DIALOGMODE
Request parameter name for the dialog mode (widget or editor). |
static java.lang.String |
PARAM_EDITEDRESOURCE
Request parameter name for the edited resource. |
static java.lang.String |
PARAM_FIELDID
Request parameter name for the input field id. |
static java.lang.String |
PARAM_GALLERYPATH
Request parameter name for the gallery path. |
static java.lang.String |
PARAM_ITEMPATH
Request parameter name for the active item path. |
static java.lang.String |
PARAM_PARAMS
Request parameter name for the dialog initialization parameters. |
static java.lang.String |
PARAM_STARTUPFOLDER
Request parameter name for the startup folder. |
static java.lang.String |
PARAM_STARTUPTYPE
Request parameter name for the startup type. |
static java.lang.String |
PATH_GALLERIES
The galleries path in the workplace containing the JSPs. |
static java.lang.String |
RETURNVALUE_NONE
Value that is returned if no result was found. |
Fields inherited from class org.opencms.workplace.tools.CmsToolDialog |
---|
PARAM_BASE, PARAM_FORCE, PARAM_PATH, PARAM_ROOT, PARAM_STYLE, STYLE_NEW |
Constructor Summary | |
---|---|
A_CmsAjaxGallery()
Public empty constructor, required for createInstance(String, CmsJspActionElement) . |
|
A_CmsAjaxGallery(CmsJspActionElement jsp)
Public constructor with JSP action element. |
|
A_CmsAjaxGallery(javax.servlet.jsp.PageContext context,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Public constructor with JSP variables. |
Method Summary | |
---|---|
protected void |
buildJsonActiveItem(java.lang.String itemUrl)
Builds the Javascript to set the currently active item object. |
protected void |
buildJsonCategoryList()
Builds the JSON code for the category list as JSON array. |
protected void |
buildJsonGalleryItem(java.lang.String galleryUrl)
Creates a JSON object with the information found on the given gallery URL. |
protected void |
buildJsonGalleryList()
Builds the JSON code for the gallery list as JSON array. |
protected void |
buildJsonItemCommonPart(JSONObject jsonObj,
CmsResource res,
java.lang.String sitePath)
Fills the JSON object with the information used for all resource types. |
protected JSONObject |
buildJsonItemObject(CmsResource res)
Returns a JSON object containing information of the given resource for usage in the gallery. |
protected abstract void |
buildJsonItemSpecificPart(JSONObject jsonObj,
CmsResource res,
java.lang.String sitePath)
Fills the JSON object with the specific information used for this resource type. |
protected void |
buildJsonResourceItems(java.util.List resourceitems,
java.lang.String parentFolder)
Builds the JSON code to create items for the folder. |
protected void |
changeItemLinkUrl(java.lang.String itemUrl)
Changes the content of the CmsResource. |
protected void |
changeItemTitle(java.lang.String itemUrl)
Changes the title property value of the given item. |
static A_CmsAjaxGallery |
createInstance(java.lang.String galleryTypeName,
CmsJspActionElement jsp)
Creates a new gallery instance of the given gallery type name. |
void |
displayDialog()
Called from the JSP that is used for the AJAX requests to OpenCms. |
protected java.util.List |
getCategoryItems()
Returns the resource items for the selected category. |
java.util.List |
getGalleries()
Returns a list of galleries which have the required gallery type id. |
static java.util.List |
getGalleries(int galleryTypeId,
CmsObject cms)
Returns a list of galleries which have the required gallery type id. |
java.util.List |
getGalleryItems()
Returns a list of gallery items (resources) for the currently selected gallery and resource type id. |
abstract int |
getGalleryItemsTypeId()
Returns the type id of the gallery items that should be listed. |
abstract int |
getGalleryTypeId()
Returns the type id of this gallery instance. |
abstract java.lang.String |
getGalleryTypeName()
Returns the type name of this gallery instance. |
java.lang.String |
getGalleryTypeParams()
Returns the (optional) parameters of this gallery instance. |
java.lang.String |
getParamDialogMode()
Returns the current mode of the dialog. |
java.lang.String |
getParamFieldId()
Returns the input field ID when in widget mode. |
java.lang.String |
getParamGalleryPath()
Returns the path of the gallery to display. |
java.lang.String |
getParamListMode()
Returns the list mode for getting the items, either LISTMODE_CATEGORY or LISTMODE_GALLERY . |
java.lang.String |
getParamPropertyValue()
Returns the property value parameter. |
CmsResourceTypeFolderExtended |
getResourceType()
Returns the extended folder resource type this gallery is based on. |
void |
init()
Initialization method that is called after the gallery instance has been created. |
static void |
initGallery(CmsDialog wp)
Initializes the gallery dialog before redirecting. |
protected void |
initWorkplaceRequestValues(CmsWorkplaceSettings settings,
javax.servlet.http.HttpServletRequest request)
Analyzes the request for workplace parameters and adjusts the workplace settings accordingly. |
boolean |
isModeEditor()
Returns if the dialog mode is the "editor" mode. |
boolean |
isModeView()
Returns if the dialog mode is the "view" mode. |
boolean |
isModeWidget()
Returns if the dialog mode is the "widget" mode. |
void |
setParamDialogMode(java.lang.String dialogMode)
Sets the current mode of the dialog. |
void |
setParamFieldId(java.lang.String fieldId)
Sets the input field ID if in widget mode. |
void |
setParamGalleryPath(java.lang.String galleryPath)
Sets the path of the gallery to display. |
void |
setParamListMode(java.lang.String paramListMode)
Sets the list mode for getting the items, either LISTMODE_CATEGORY or LISTMODE_GALLERY . |
void |
setParamPropertyValue(java.lang.String paramPropertyValue)
Sets the property value parameter. |
void |
setResourceType(CmsResourceTypeFolderExtended type)
Sets the extended folder resource type this gallery is based on. |
protected void |
writeTitleProperty(CmsResource res)
Changes the value of the property title for the specified resource. |
Methods inherited from class org.opencms.workplace.tools.CmsToolDialog |
---|
dialogTitle, getAdminTool, getCurrentToolPath, getParamBase, getParamForce, getParamPath, getParamRoot, getParamStyle, getParentPath, getToolManager, iconsBlockArea, iconsBlockAreaEnd, iconsBlockAreaStart, initAdminTool, pageBody, pageHtmlStyle, setParamBase, setParamForce, setParamPath, setParamRoot, setParamStyle, useNewStyle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DIALOG_CHANGEITEMLINKURL
public static final java.lang.String DIALOG_CHANGEITEMTITLE
public static final java.lang.String DIALOG_GETACTIVEITEM
public static final java.lang.String DIALOG_GETCATEGORIES
public static final java.lang.String DIALOG_GETGALLERIES
public static final java.lang.String DIALOG_GETGALLERY
public static final java.lang.String DIALOG_GETITEMS
public static final java.lang.String DIALOG_LIST
public static final java.lang.String LISTMODE_CATEGORY
public static final java.lang.String LISTMODE_GALLERY
public static final java.lang.String MODE_EDITOR
public static final java.lang.String MODE_VIEW
public static final java.lang.String MODE_WIDGET
public static final java.lang.String PARAM_DIALOGMODE
public static final java.lang.String PARAM_EDITEDRESOURCE
public static final java.lang.String PARAM_FIELDID
public static final java.lang.String PARAM_GALLERYPATH
public static final java.lang.String PARAM_ITEMPATH
public static final java.lang.String PARAM_PARAMS
public static final java.lang.String PARAM_STARTUPFOLDER
public static final java.lang.String PARAM_STARTUPTYPE
public static final java.lang.String PATH_GALLERIES
public static final java.lang.String RETURNVALUE_NONE
protected java.lang.String m_galleryTypeParams
Constructor Detail |
---|
public A_CmsAjaxGallery()
createInstance(String, CmsJspActionElement)
.
public A_CmsAjaxGallery(CmsJspActionElement jsp)
jsp
- an initialized JSP action elementpublic A_CmsAjaxGallery(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
context
- the JSP page contextreq
- the JSP requestres
- the JSP responseMethod Detail |
---|
public static A_CmsAjaxGallery createInstance(java.lang.String galleryTypeName, CmsJspActionElement jsp)
galleryTypeName
- the gallery type name to create the instance forjsp
- an initialized JSP action element
public static java.util.List getGalleries(int galleryTypeId, CmsObject cms)
galleryTypeId
- type id of the gallerycms
- the initialized CmsObject for the current user
public static void initGallery(CmsDialog wp)
wp
- the workplace objectpublic void displayDialog()
public java.util.List getGalleries()
public java.util.List getGalleryItems()
public abstract int getGalleryItemsTypeId()
In case of downloadgallery use '-1' to list all resources excluding folders.
public abstract int getGalleryTypeId()
public abstract java.lang.String getGalleryTypeName()
public java.lang.String getGalleryTypeParams()
public java.lang.String getParamDialogMode()
This is necessary to distinguish between widget mode, view mode and editor mode.
public java.lang.String getParamFieldId()
public java.lang.String getParamGalleryPath()
public java.lang.String getParamListMode()
LISTMODE_CATEGORY
or LISTMODE_GALLERY
.
public java.lang.String getParamPropertyValue()
public CmsResourceTypeFolderExtended getResourceType()
public void init()
It can be overwritten in the inherited class, e.g. CmsAjaxImageGallery.init()
.
public boolean isModeEditor()
true
if the dialog mode is the "editor" mode, otherwise false
public boolean isModeView()
true
if the dialog mode is the "view" mode, otherwise false
public boolean isModeWidget()
true
if the dialog mode is the "editor" mode, otherwise false
public void setParamDialogMode(java.lang.String dialogMode)
This is necessary to distinguish between widget mode and editor mode.
dialogMode
- the current mode of the dialogpublic void setParamFieldId(java.lang.String fieldId)
fieldId
- the input field IDpublic void setParamGalleryPath(java.lang.String galleryPath)
galleryPath
- the path of the gallery to displaypublic void setParamListMode(java.lang.String paramListMode)
LISTMODE_CATEGORY
or LISTMODE_GALLERY
.
paramListMode
- the list mode for getting the itemspublic void setParamPropertyValue(java.lang.String paramPropertyValue)
paramPropertyValue
- the property value parameter to setpublic void setResourceType(CmsResourceTypeFolderExtended type)
type
- the extended folder resource type this gallery is based onprotected void buildJsonActiveItem(java.lang.String itemUrl)
itemUrl
- the URL of the currently selected itemprotected void buildJsonCategoryList()
protected void buildJsonGalleryItem(java.lang.String galleryUrl)
galleryUrl
- the given gallery URLprotected void buildJsonGalleryList()
protected void buildJsonItemCommonPart(JSONObject jsonObj, CmsResource res, java.lang.String sitePath)
sitepath
: site path to the resource.linkpath
: substituted url of the resource.title
: title property of the resource.size
: size of the resource in kb.datecreated
: the creation date of the resource.datelastmodified
: the modification date.state
: the state of the resource, new or changed.lockedby
: indicates if the resource is locked by another user.editable
: editable flag to determine if item is editable and can be lockes by the user.writepermission
: flag to indicate if the user has write permissions for given resource.directpublish
: flag to indicate if the user has write direct publish permission for given resource.description
: description property of the resource.
jsonObj
- containing information used by all possible resourceres
- the resource to create the object fromsitePath
- site path to the objectprotected JSONObject buildJsonItemObject(CmsResource res)
The content of the JSON object consists of a common and a specific part of the given resource.
res
- the resource to create the object from
protected abstract void buildJsonItemSpecificPart(JSONObject jsonObj, CmsResource res, java.lang.String sitePath)
jsonObj
- containing information used by all possible resourceres
- the resource to create the object fromsitePath
- site path to the objectprotected void buildJsonResourceItems(java.util.List resourceitems, java.lang.String parentFolder)
resourceitems
- the file resource to build the displayed itemsparentFolder
- the parent folder of the collected files (for a gallery)protected void changeItemLinkUrl(java.lang.String itemUrl)
This function should be overwritten in CmsAjaxLinkGallery
.
itemUrl
- the item URLprotected void changeItemTitle(java.lang.String itemUrl)
itemUrl
- the item URL on which the title is changedprotected java.util.List getCategoryItems()
protected void initWorkplaceRequestValues(CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request)
CmsWorkplace
initWorkplaceRequestValues
in class CmsDialog
settings
- the workplace settingsrequest
- the current requestCmsWorkplace.initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
protected void writeTitleProperty(CmsResource res)
res
- the resource to change the property value
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |