Package io.goobi.viewer.managedbeans
Class CmsPageEditBean
java.lang.Object
io.goobi.viewer.managedbeans.CmsPageEditBean
- All Implemented Interfaces:
Serializable
JSF backing bean for creating and editing CMS pages including content and metadata.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent.createAndOpenNewPage(String title, String relatedPI) Create a new CMSPage based on the given template. title and relatedPI are set on the page if given Opens the view to create/edit the cmsPagebooleandeleteComponent(CMSComponent component) deleteComponent.booleandeletePage(CMSPage page) Deletes given CMS page from the database.Action method for deleting selectedPage from the database.getAndResetSelectedWidgets.getAvailableComponents.Get the list of metadata fields which may be displayed.Getter for the fieldpageEditState.Getter for the fieldselectedComponent.Getter for the fieldselectedPage.getSelectedPageId.getSelectedWidgets.Getter for the fieldsidebarWidgets.Getter for the fieldtemplateName.booleanisEditMode.booleanisSaveAsTemplate.booleanisTemplateLockComponents.booleanmayRemoveCategoryFromPage.voidresetSelectedWidgets.voidsavePageAndForwardToEdit.voidAdds the current page to the database, if it doesn't exist or updates it otherwise.voidsetEditMode(boolean editMode) Setter for the fieldeditMode.voidsetNewSelectedPage.voidsetNewSelectedPage(Long templateId) setNewSelectedPage.voidsetPageEditState(CMSPageEditState pageEditState) Setter for the fieldpageEditState.voidsetSaveAsTemplate(boolean saveAsTemplate) Setter for the fieldsaveAsTemplate.voidsetSelectedComponent(String selectedComponent) Setter for the fieldselectedComponent.voidsetSelectedPage(CMSPage currentPage) Setter for the fieldselectedPage.voidsetSelectedPageId.voidsetSidebarWidgets(Map<WidgetDisplayElement, Boolean> sidebarWidgets) Setter for the fieldsidebarWidgets.voidsetTemplateLockComponents(boolean templateLockComponents) Setter for the fieldtemplateLockComponents.voidsetTemplateName(String templateName) Setter for the fieldtemplateName.voidsetup()setup.
-
Constructor Details
-
CmsPageEditBean
public CmsPageEditBean()
-
-
Method Details
-
setup
setup. -
savePageAndForwardToEdit
savePageAndForwardToEdit.- Throws:
DAOException- if any.
-
saveSelectedPage
Adds the current page to the database, if it doesn't exist or updates it otherwise.- Throws:
DAOException- if any.
-
deleteSelectedPage
Action method for deleting selectedPage from the database.- Returns:
- Return view
- Throws:
DAOException- if any.
-
deletePage
Deletes given CMS page from the database.- Parameters:
page- Page to delete- Returns:
- true if deletion was successful; false otherwise
- Throws:
DAOException- if any.
-
setSelectedPage
Setter for the fieldselectedPage.- Parameters:
currentPage- CMS page to select; null clears the selection- Throws:
DAOException- if any.
-
getSelectedPageId
getSelectedPageId.- Returns:
- ID of selectedPage
-
setSelectedPageId
setSelectedPageId.- Parameters:
id- string representation of the CMS page database ID- Throws:
DAOException
-
getSelectedPage
Getter for the fieldselectedPage.- Returns:
- the CMS page currently selected for editing
-
createAndOpenNewPage
Create a new CMSPage based on the given template. title and relatedPI are set on the page if given Opens the view to create/edit the cmsPage- Parameters:
title- The title to be used for the current locale, optionalrelatedPI- The PI of a related work, optional- Returns:
- the absolute URL to the new CMS page creation view with optional title and PI query parameters
-
getSidebarWidgets
Getter for the fieldsidebarWidgets.- Returns:
- a map of sidebar widget display elements to their selection state
-
setSidebarWidgets
Setter for the fieldsidebarWidgets.- Parameters:
sidebarWidgets- map of widgets to their selection state
-
getSelectedWidgets
getSelectedWidgets.- Returns:
- a list of sidebar widget display elements that are currently selected for the CMS page
-
resetSelectedWidgets
public void resetSelectedWidgets()resetSelectedWidgets. -
getAndResetSelectedWidgets
getAndResetSelectedWidgets.- Returns:
- a list of the currently selected sidebar widgets, after which all selections are cleared
-
getSelectedComponent
Getter for the fieldselectedComponent.- Returns:
- the template filename of the selected component to add
-
setSelectedComponent
Setter for the fieldselectedComponent.- Parameters:
selectedComponent- template filename of the component to add
-
getAvailableComponents
getAvailableComponents.- Parameters:
page- CMS page used to filter out incompatible paged components- Returns:
- a list of select items representing CMS components available for the given page, grouped by type
-
getAvailableMetadataFields
Get the list of metadata fields which may be displayed. This is the main metadata list- Returns:
- the main metadata list
-
mayRemoveCategoryFromPage
mayRemoveCategoryFromPage.- Parameters:
cat- category whose removal eligibility is being checked- Returns:
- false only if the user has limited privileges for categories and only one category is set for the selected page
- Throws:
DAOException- if any.
-
isEditMode
public boolean isEditMode()isEditMode.- Returns:
- true if an existing CMS page is being edited (as opposed to creating a new one), false otherwise
-
setEditMode
public void setEditMode(boolean editMode) Setter for the fieldeditMode.- Parameters:
editMode- true when editing an existing page; false for new pages
-
setNewSelectedPage
public void setNewSelectedPage()setNewSelectedPage. -
setNewSelectedPage
setNewSelectedPage.- Parameters:
templateId- database ID of the page template to base the new page on
-
getPageEditState
Getter for the fieldpageEditState.- Returns:
- the current state of the CMS page edit UI
-
setPageEditState
Setter for the fieldpageEditState.- Parameters:
pageEditState- active section of the page edit UI
-
deleteComponent
deleteComponent.- Parameters:
component- CMS component to remove from the selected page- Returns:
- true if the component was successfully removed from the page, false otherwise
-
addComponent
public void addComponent()addComponent. -
setSaveAsTemplate
public void setSaveAsTemplate(boolean saveAsTemplate) Setter for the fieldsaveAsTemplate.- Parameters:
saveAsTemplate- true to save the current page as a template after saving
-
isSaveAsTemplate
public boolean isSaveAsTemplate()isSaveAsTemplate.- Returns:
- true if the current page should be saved as a template, false otherwise
-
setTemplateName
Setter for the fieldtemplateName.- Parameters:
templateName- display name for the template to be created
-
getTemplateName
Getter for the fieldtemplateName.- Returns:
- the template name, falling back to the selected page title if blank
-
isTemplateLockComponents
public boolean isTemplateLockComponents()isTemplateLockComponents.- Returns:
- true if components are locked when the page template is applied, false otherwise
-
setTemplateLockComponents
public void setTemplateLockComponents(boolean templateLockComponents) Setter for the fieldtemplateLockComponents.- Parameters:
templateLockComponents- true to prevent component editing in pages based on this template
-