/** * Returns the most possible right resource name.<p> * * @return the most possible right resource name */ private String getResourceName() { String resource = getItem().get(m_resColumnPathId).toString(); if (!getWp().getCms().existsResource(resource, CmsResourceFilter.DEFAULT)) { String siteRoot = OpenCms.getSiteManager().getSiteRoot(resource); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(siteRoot)) { resource = resource.substring(siteRoot.length()); } if (!getWp().getCms().existsResource(resource, CmsResourceFilter.DEFAULT)) { resource = null; } } return resource; } }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#isVisible() */ @Override public boolean isVisible() { if (getResourceName() != null) { try { // if resource type if editable if (OpenCms.getWorkplaceManager().getEditorHandler().getEditorUri( getResourceName(), getWp().getJsp()) != null) { // check lock state CmsLock lock = getResourceUtil().getLock(); if (lock.isNullLock() || lock.isOwnedBy((getWp().getCms().getRequestContext().getCurrentUser()))) { return isEnabled(); } } } catch (Throwable e) { // ignore } } return !isEnabled(); }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#getIconPath() */ @Override public String getIconPath() { String iconpath = super.getIconPath(); if (iconpath == null) { if (isEnabled()) { iconpath = "list/resource_edit.png"; } else { iconpath = "list/resource_edit_disabled.png"; } } return iconpath; }
/** * @see org.opencms.workplace.list.I_CmsListDirectAction#setItem(org.opencms.workplace.list.CmsListItem) */ @Override public void setItem(CmsListItem item) { m_resourceUtil = ((A_CmsListExplorerDialog)getWp()).getResourceUtil(item); super.setItem(item); }
CmsListDirectAction editAction = new CmsListEditResourceAction(LIST_ACTION_EDIT, LIST_COLUMN_NAME); editAction.setEnabled(true); editIconCol.addDirectAction(editAction); CmsListDirectAction noEditAction = new CmsListEditResourceAction(LIST_ACTION_EDIT + "d", LIST_COLUMN_NAME); noEditAction.setEnabled(false); editIconCol.addDirectAction(noEditAction);
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#getIconPath() */ @Override public String getIconPath() { String iconpath = super.getIconPath(); if (iconpath == null) { if (isEnabled()) { iconpath = "list/resource_edit.png"; } else { iconpath = "list/resource_edit_disabled.png"; } } return iconpath; }
/** * @see org.opencms.workplace.list.I_CmsListDirectAction#setItem(org.opencms.workplace.list.CmsListItem) */ @Override public void setItem(CmsListItem item) { m_resourceUtil = ((A_CmsListExplorerDialog)getWp()).getResourceUtil(item); super.setItem(item); }
CmsListDirectAction editAction = new CmsListEditResourceAction(LIST_ACTION_EDIT, LIST_COLUMN_NAME); editAction.setEnabled(true); editIconCol.addDirectAction(editAction); CmsListDirectAction noEditAction = new CmsListEditResourceAction(LIST_ACTION_EDIT + "d", LIST_COLUMN_NAME); noEditAction.setEnabled(false); editIconCol.addDirectAction(noEditAction);
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#isVisible() */ @Override public boolean isVisible() { if (getResourceName() != null) { try { // if resource type if editable if (OpenCms.getWorkplaceManager().getEditorHandler().getEditorUri(getResourceName(), getWp().getJsp()) != null) { // check lock state CmsLock lock = getResourceUtil().getLock(); if (lock.isNullLock() || lock.isOwnedBy((getWp().getCms().getRequestContext().currentUser()))) { return isEnabled(); } } } catch (Throwable e) { // ignore } } return !isEnabled(); }
/** * Returns the most possible right resource name.<p> * * @return the most possible right resource name */ private String getResourceName() { String resource = getItem().get(m_resColumnPathId).toString(); if (!getWp().getCms().existsResource(resource, CmsResourceFilter.DEFAULT)) { String siteRoot = OpenCms.getSiteManager().getSiteRoot(resource); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(siteRoot)) { resource = resource.substring(siteRoot.length()); } if (!getWp().getCms().existsResource(resource, CmsResourceFilter.DEFAULT)) { resource = null; } } return resource; } }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#getHelpText() */ @Override public CmsMessageContainer getHelpText() { CmsMessageContainer helptext = super.getHelpText(); if (helptext == null) { if (isEnabled()) { helptext = Messages.get().container(Messages.GUI_EDITRESOURCE_ACTION_HELP_0); } else { helptext = Messages.get().container(Messages.GUI_EDITRESOURCE_DISABLED_ACTION_HELP_0); } } return helptext; }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#getName() */ @Override public CmsMessageContainer getName() { CmsMessageContainer name = super.getName(); if (name == null) { if (isEnabled()) { name = Messages.get().container(Messages.GUI_EDITRESOURCE_ACTION_NAME_0); } else { name = Messages.get().container(Messages.GUI_EDITRESOURCE_DISABLED_ACTION_NAME_0); } } return name; }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#getHelpText() */ @Override public CmsMessageContainer getHelpText() { CmsMessageContainer helptext = super.getHelpText(); if (helptext == null) { if (isEnabled()) { helptext = Messages.get().container(Messages.GUI_EDITRESOURCE_ACTION_HELP_0); } else { helptext = Messages.get().container(Messages.GUI_EDITRESOURCE_DISABLED_ACTION_HELP_0); } } return helptext; }
/** * @see org.opencms.workplace.tools.I_CmsHtmlIconButton#getName() */ @Override public CmsMessageContainer getName() { CmsMessageContainer name = super.getName(); if (name == null) { if (isEnabled()) { name = Messages.get().container(Messages.GUI_EDITRESOURCE_ACTION_NAME_0); } else { name = Messages.get().container(Messages.GUI_EDITRESOURCE_DISABLED_ACTION_NAME_0); } } return name; }