cmspublishproject.java
来自「找了很久才找到到源代码」· Java 代码 · 共 945 行 · 第 1/3 页
JAVA
945 行
}
result.append("<input type='checkbox' name='");
result.append(PARAM_PUBLISHSIBLINGS);
result.append("' value='true' onclick=\"reloadReport();\"");
if (Boolean.valueOf(getParamPublishsiblings()).booleanValue()) {
result.append(" checked='checked'");
}
result.append("> ");
result.append(key(Messages.GUI_PUBLISH_ALLSIBLINGS_0));
result.append("<br>\n");
} else {
result.append("<input type='hidden' name='");
result.append(PARAM_PUBLISHSIBLINGS);
result.append("' value='");
result.append(Boolean.valueOf(getParamPublishsiblings()));
result.append("'");
if (Boolean.valueOf(getParamPublishsiblings()).booleanValue()) {
result.append(" checked='checked'");
}
result.append(">\n");
}
if (showOptionSubresources) {
// at least one folder is selected, show "publish subresources" checkbox
result.append("<input type='checkbox' name='");
result.append(PARAM_SUBRESOURCES);
result.append("' value='true' onclick=\"reloadReport();\"");
if (Boolean.valueOf(getParamSubresources()).booleanValue()) {
result.append(" checked='checked'");
}
result.append("> ");
if (isMultiOperation()) {
result.append(key(Messages.GUI_PUBLISH_MULTI_SUBRESOURCES_0));
} else {
result.append(key(Messages.GUI_PUBLISH_SUBRESOURCES_0));
}
result.append("<br>\n");
} else {
result.append("<input type='hidden' name='");
result.append(PARAM_SUBRESOURCES);
result.append("' value='");
result.append(Boolean.valueOf(getParamSubresources()));
result.append("'");
if (Boolean.valueOf(getParamSubresources()).booleanValue()) {
result.append(" checked='checked'");
}
result.append(">\n");
}
// code for the 'publish related resources' button
boolean disabled = false;
if ((OpenCms.getWorkplaceManager().getDefaultUserSettings().getPublishRelatedResources() == CmsDefaultUserSettings.PUBLISH_RELATED_RESOURCES_MODE_FORCE)
&& !OpenCms.getRoleManager().hasRole(getCms(), CmsRole.VFS_MANAGER)) {
disabled = true;
}
result.append("<input type='checkbox' name='");
result.append(PARAM_RELATEDRESOURCES);
result.append("' value='true' onclick=\"reloadReport();\"");
if (Boolean.valueOf(getParamRelatedresources()).booleanValue()) {
result.append(" checked='checked'");
}
if (disabled) {
result.append(" disabled='disabled'");
}
result.append("> ");
result.append(key(Messages.GUI_PUBLISH_RELATED_RESOURCES_0));
result.append("<br>\n");
result.append("</p>\n");
return result.toString();
}
/**
* Returns the list of the resources to publish with broken relations.<p>
*
* @return the list of the resources to publish with broken relations
*/
public CmsPublishBrokenRelationsList getBrokenRelationsList() {
return new CmsPublishBrokenRelationsList(getJsp(), getParentFolder());
}
/**
* Returns if a resource will be directly published.<p>
*
* @return <code>"true"</code> if a resource will be directly published
*/
public String getParamDirectpublish() {
return m_paramDirectpublish;
}
/**
* @see org.opencms.workplace.CmsDialog#getParamFramename()
*/
public String getParamFramename() {
String fn = super.getParamFramename();
// to correctly return after publish project
if ((fn == null) && !isDirectPublish()) {
fn = "body";
}
return fn;
}
/**
* Returns the value for the progress key.<p>
*
* @return the value for the progress key
*/
public String getParamProgresskey() {
return m_paramProgresskey;
}
/**
* Returns the value of the project id which will be published.<p>
*
* @return the String value of the project id
*/
public String getParamProjectid() {
return m_paramProjectid;
}
/**
* Returns the value of the project name which will be published.<p>
*
* @return the String value of the project name
*/
public String getParamProjectname() {
return m_paramProjectname;
}
/**
* Returns if siblings of the resource should be published.<p>
*
* @return <code>"true"</code> (String) if siblings of the resource should be published
*/
public String getParamPublishsiblings() {
return m_paramPublishsiblings;
}
/**
* Returns the value of the related resources parameter.<p>
*
* @return the value of the related resources parameter
*/
public String getParamRelatedresources() {
return m_paramRelatedresources;
}
/**
* Returns the value of the subresources parameter.<p>
*
* @return the value of the sub resources parameter
*/
public String getParamSubresources() {
return m_paramSubresources;
}
/**
* Returns the progress bar for the dialog.<p>
*
* @return the progress bar for the dialog
*/
public CmsProgressWidget getProgress() {
return m_progress;
}
/**
* Unlocks all selected resources, will be called by the JSP page.<p>
*
* @return <code>true</code> if everything went ok
*
* @throws JspException if there is some problem including the error page
*/
public CmsPublishList getPublishList() throws JspException {
CmsPublishList publishList = null;
if (isDirectPublish()) {
// get the offline resource(s) in direct publish mode
List publishResources = new ArrayList(getResourceList().size());
Iterator i = getResourceList().iterator();
while (i.hasNext()) {
String resName = (String)i.next();
try {
publishResources.add(getCms().readResource(resName, CmsResourceFilter.ALL));
} catch (CmsException e) {
addMultiOperationException(e);
}
}
try {
boolean publishSubResources = Boolean.valueOf(getParamSubresources()).booleanValue();
boolean publishSiblings = Boolean.valueOf(getParamPublishsiblings()).booleanValue();
// create publish list for direct publish
publishList = OpenCms.getPublishManager().getPublishList(
getCms(),
publishResources,
publishSiblings,
publishSubResources);
} catch (CmsException e) {
addMultiOperationException(e);
}
} else {
try {
// be careful #getParamProjectid() is always the current project
publishList = OpenCms.getPublishManager().getPublishList(getCms());
} catch (CmsException e) {
addMultiOperationException(e);
}
}
try {
// throw exception for errors unlocking resources
checkMultiOperationException(Messages.get(), Messages.ERR_PUBLISH_LIST_CREATION_0);
} catch (Throwable e) {
publishList = null;
// error while unlocking resources, show error screen
includeErrorpage(this, e);
}
getSettings().setPublishList(publishList);
return publishList;
}
/**
* Returns the list with the resources to publish.<p>
*
* @return the list with the resources to publish
*
* @throws JspException if creation of publish list fails
*/
public CmsPublishResourcesList getPublishResourcesList() throws JspException {
if (getPublishList() != null) {
return new CmsPublishResourcesList(
getJsp(),
getParentFolder(),
Boolean.valueOf(getParamRelatedresources()).booleanValue());
}
return null;
}
/**
* Returns <code>true</code> if the resources to be published will generate broken links.<p>
*
* @return <code>true</code> if the resources to be published will generate broken links
*/
public boolean hasBrokenLinks() {
// CmsPublishBrokenRelationsList list = new CmsPublishBrokenRelationsList(getJsp(), getParentFolder());
// list.refreshList();
return (getBrokenRelationsList().getList().getTotalSize() > 0);
}
/**
* Returns <code>true</code> if the current user is allowed
* to publish the selected resources.<p>
*
* @return <code>true</code> if the current user is allowed
* to publish the selected resources
*/
public boolean isCanPublish() {
return OpenCms.getWorkplaceManager().getDefaultUserSettings().isAllowBrokenRelations()
|| OpenCms.getRoleManager().hasRole(getCms(), CmsRole.VFS_MANAGER);
}
/**
* Returns <code>true</code> if the selection has blocking locks.<p>
*
* @return <code>true</code> if the selection has blocking locks
*/
public boolean isLockStateOk() {
org.opencms.workplace.commons.CmsLock lockDialog = new org.opencms.workplace.commons.CmsLock(getJsp());
lockDialog.setParamIncluderelated(CmsStringUtil.TRUE);
lockDialog.setBlockingFilter(getBlockingFilter());
if (!isDirectPublish()) {
lockDialog.setParamResource("/");
}
if (!lockDialog.getBlockingLockedResources().isEmpty()) {
// blocking locks found, so show them
return false;
}
if (!isDirectPublish()) {
// is publish project operation no resource iteration possible
return true;
}
// flag to indicate that all resources are exclusive locked
boolean locked = true;
// flag to indicate that all resources are unlocked
boolean unlocked = true;
Iterator i = getResourceList().iterator();
while (i.hasNext()) {
String resName = (String)i.next();
try {
CmsLock lock = getCms().getLock(getCms().readResource(resName, CmsResourceFilter.ALL));
if (!lock.isUnlocked()) {
unlocked = false;
if (locked
&& !lock.isOwnedInProjectBy(
getCms().getRequestContext().currentUser(),
getCms().getRequestContext().currentProject())) {
// locks of another users or locked in another project are blocking
locked = false;
}
}
} catch (CmsException e) {
// error reading a resource, should usually never happen
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?