📄 cmsdialog.java
字号:
}
/**
* Returns the http URI of the current dialog, to be used
* as value for the "action" attribute of a html form.<p>
*
* This URI is the real one.<p>
*
* @return the http URI of the current dialog
*/
public String getDialogRealUri() {
return getJsp().link(getJsp().getRequestContext().getUri());
}
/**
* Returns the http URI of the current dialog, to be used
* as value for the "action" attribute of a html form.<p>
*
* This URI could not be really the real one... <p>
*
* @return the http URI of the current dialog
*/
public String getDialogUri() {
if (!useNewStyle()) {
return getDialogRealUri();
} else {
return CmsToolManager.linkForToolPath(getJsp(), getCurrentToolPath());
}
}
/**
* Returns the custom mapping for the online help.<p>
*
* @return the custom mapping for the online help
*/
public String getOnlineHelpUriCustom() {
if (m_onlineHelpUriCustom == null) {
return null;
}
StringBuffer result = new StringBuffer(m_onlineHelpUriCustom.length() + 4);
result.append("\"");
result.append(m_onlineHelpUriCustom);
result.append("\"");
return result.toString();
}
/**
* Returns the value of the action parameter,
* or null if this parameter was not provided.<p>
*
* The action parameter is very important,
* it will select the dialog action to perform.
* The value of the {@link #getAction()} method will be
* initialized from the action parameter.<p>
*
* @return the value of the action parameter
*/
public String getParamAction() {
return m_paramAction;
}
/**
* Returns the value of the closelink parameter,
* or null if this parameter was not provided.<p>
*
* @return the value of the closelink parameter
*/
public String getParamCloseLink() {
if ((m_paramCloseLink == null) || "null".equals(m_paramCloseLink)) {
return null;
}
return m_paramCloseLink;
}
/**
* Returns the value of the dialogtype parameter,
* or null if this parameter was not provided.<p>
*
* This parameter is very important.
* It must match to the localization keys,
* e.g. "copy" for the copy dialog.<p>
*
* This parameter must be set manually by the subclass during
* first initialization.<p>
*
* @return the value of the dialogtype parameter
*/
public String getParamDialogtype() {
return m_paramDialogtype;
}
/**
* Returns the value of the frame name parameter.<p>
*
* @return the value of the errorstack parameter
*/
public String getParamFramename() {
if ((m_paramFrameName != null) && !"null".equals(m_paramFrameName)) {
return m_paramFrameName;
} else {
return null;
}
}
/**
* Returns the ispopup parameter.<p>
*
* Use this parameter to indicate that the dialog is shown in a popup window.<p>
*
* @return the ispopup parameter
*/
public String getParamIsPopup() {
return m_paramIsPopup;
}
/**
* Returns the value of the message parameter,
* or null if this parameter was not provided.<p>
*
* The message parameter is used on dialogs to
* show any text message.<p>
*
* @return the value of the message parameter
*/
public String getParamMessage() {
return m_paramMessage;
}
/**
* Returns the value of the originalparams parameter.<p>
*
* This stores the request parameter values from a previous dialog, if necessary.<p>
*
* @return the value of the originalparams parameter
*/
public String getParamOriginalParams() {
return m_paramOriginalParams;
}
/**
* Returns the value of the preactiondone parameter.<p>
*
* @return the value of the preactiondone parameter
*/
public String getParamPreActionDone() {
return m_paramPreActionDone;
}
/**
* Returns the value of the redirect flag parameter.<p>
*
* @return the value of the redirect flag parameter
*/
public String getParamRedirect() {
return m_paramRedirect;
}
/**
* Returns the value of the file parameter,
* or null if this parameter was not provided.<p>
*
* The file parameter selects the file on which the dialog action
* is to be performed.<p>
*
* @return the value of the file parameter
*/
public String getParamResource() {
if ((m_paramResource != null) && !"null".equals(m_paramResource)) {
return m_paramResource;
} else {
return null;
}
}
/**
* Returns the value of the title parameter,
* or null if this parameter was not provided.<p>
*
* This parameter is used to build the title
* of the dialog. It is a parameter so that the title
* can be passed to included elements.<p>
*
* @return the value of the title parameter
*/
public String getParamTitle() {
return m_paramTitle;
}
/**
* Gets a formatted file state string.<p>
*
* @return formatted state string
* @throws CmsException if something goes wrong
*/
public String getState() throws CmsException {
if (CmsStringUtil.isNotEmpty(getParamResource())) {
CmsResource file = getCms().readResource(getParamResource(), CmsResourceFilter.ALL);
if (getCms().isInsideCurrentProject(getParamResource())) {
return key(Messages.getStateKey(file.getState()));
} else {
return key(Messages.GUI_EXPLORER_STATENIP_0);
}
}
return "+++ resource parameter not found +++";
}
/**
* Checks if the current resource has lock state exclusive or inherited.<p>
*
* This is used to determine whether the dialog shows the option to delete all
* siblings of the resource or not.
*
* @return true if lock state is exclusive or inherited, otherwise false
*/
public boolean hasCorrectLockstate() {
org.opencms.lock.CmsLock lock = null;
try {
// get the lock state for the current resource
lock = getCms().getLock(getParamResource());
} catch (CmsException e) {
// error getting lock state, log the error and return false
LOG.error(e.getLocalizedMessage(getLocale()), e);
return false;
}
// check if autolock feature is enabled
boolean autoLockFeature = lock.isNullLock() && OpenCms.getWorkplaceManager().autoLockResources();
return autoLockFeature || lock.isExclusive() || lock.isInherited();
}
/**
* Checks if this resource has siblings.<p>
*
* @return true if this resource has siblings
*/
public boolean hasSiblings() {
try {
return getCms().readResource(getParamResource(), CmsResourceFilter.ALL).getSiblingCount() > 1;
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(getLocale()), e);
return false;
}
}
/**
* Builds the start html of the page, including setting of DOCTYPE and
* inserting a header with the content-type.<p>
*
* @return the start html of the page
*/
public String htmlStart() {
return pageHtml(HTML_START, null);
}
/**
* Builds the start html of the page, including setting of DOCTYPE and
* inserting a header with the content-type.<p>
*
* This overloads the default method of the parent class.<p>
*
* @param helpUrl the key for the online help to include on the page
* @return the start html of the page
*/
public String htmlStart(String helpUrl) {
return pageHtml(HTML_START, helpUrl);
}
/**
* Builds the start html of the page, including setting of DOCTYPE and
* inserting a header with the content-type.<p>
*
* @param helpUrl the key for the online help to include on the page
* @param title the title for the page
* @return the start html of the page
*/
public String htmlStart(String helpUrl, String title) {
return pageHtml(HTML_START, helpUrl, title);
}
/**
* Builds the start html of the page, including setting of DOCTYPE,
* inserting a header with the content-type and choosing an individual style sheet.<p>
*
* @param title the title for the page
* @param stylesheet the style sheet to include
* @return the start html of the page
*/
public String htmlStartStyle(String title, String stylesheet) {
return pageHtmlStyle(HTML_START, title, stylesheet);
}
/**
* Displays the throwable on the error page and logs the error.<p>
*
* @param wp the workplace class
* @param t the throwable to be displayed on the error page
* @throws JspException if the include of the error page jsp fails
*/
public void includeErrorpage(CmsWorkplace wp, Throwable t) throws JspException {
CmsLog.getLog(wp).error(Messages.get().getBundle().key(Messages.ERR_WORKPLACE_DIALOG_0), t);
getJsp().getRequest().setAttribute(SESSION_WORKPLACE_CLASS, wp);
getJsp().getRequest().setAttribute(ATTRIBUTE_THROWABLE, t);
getJsp().include(FILE_DIALOG_SCREEN_ERRORPAGE);
}
/**
* Returns the "isPopup" flag.<p>
*
* @return the "isPopup" flag
*/
public boolean isPopup() {
return Boolean.valueOf(getParamIsPopup()).booleanValue();
}
/**
* Returns if the dialog is called in direct edit mode before the editor is opened.<p>
*
* @return true if the dialog is called in direct edit mode before the editor is opened
*/
public boolean isPreEditor() {
return CmsPreEditorAction.isPreEditorMode(this);
}
/**
* Builds the start html of the page, including setting of DOCTYPE and
* inserting a header with the content-type.<p>
*
* This overloads the default method of the parent class.<p>
*
* @param segment the HTML segment (START / END)
* @param helpUrl the url for the online help to include on the page
* @return the start html of the page
*/
public String pageHtml(int segment, String helpUrl) {
return pageHtml(segment, helpUrl, null);
}
/**
* Builds the start html of the page, including setting of DOCTYPE and
* inserting a header with the content-type.<p>
*
* This overloads the default method of the parent class.<p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -