/** * Deletes a temporary file from the OpenCms VFS, needed when exiting an editor.<p> */ protected void deleteTempFile() { try { // switch to the temporary file project switchToTempProject(); // delete the temporary file getCms().deleteResource(getParamTempfile(), CmsResource.DELETE_PRESERVE_SIBLINGS); } catch (CmsException e) { // should usually never happen if (LOG.isInfoEnabled()) { LOG.info(e); } } finally { try { // switch back to the current project switchToCurrentProject(); } catch (CmsException e) { // should usually never happen if (LOG.isInfoEnabled()) { LOG.info(e); } } } }
/** * Returns a cloned cms instance that prevents the time range resource filter check.<p> * * Use it always for unmarshalling and file writing.<p> * * @return a cloned cms instance that prevents the time range resource filter check * * @throws CmsException if something goes wrong */ protected CmsObject getCloneCms() throws CmsException { CmsObject cloneCms = OpenCms.initCmsObject(getCms()); cloneCms.getRequestContext().setRequestTime(CmsResource.DATE_RELEASED_EXPIRED_IGNORE); return cloneCms; }
/** * Deletes a temporary file from the OpenCms VFS, needed when exiting an editor.<p> */ protected void deleteTempFile() { try { // switch to the temporary file project switchToTempProject(); // delete the temporary file getCms().deleteResource(getParamTempfile(), CmsResource.DELETE_PRESERVE_SIBLINGS); } catch (CmsException e) { // should usually never happen if (LOG.isInfoEnabled()) { LOG.info(e); } } finally { try { // switch back to the current project switchToCurrentProject(); } catch (CmsException e) { // should usually never happen if (LOG.isInfoEnabled()) { LOG.info(e); } } } }
List<Locale> locales = OpenCms.getLocaleManager().getAvailableLocales(getCms(), resourceName); List<String> options = new ArrayList<String>(locales.size()); List<String> selectList = new ArrayList<String>(locales.size()); try { CmsResource res = getCms().readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION); String temporaryFilename = CmsWorkplace.getTemporaryFileName(resourceName); if (getCms().existsResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION)) { res = getCms().readResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION); CmsFile file = getCms().readFile(res); CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file); contentLocales = xmlContent.getLocales(); } catch (CmsException e) {
List locales = OpenCms.getLocaleManager().getAvailableLocales(getCms(), resourceName); List options = new ArrayList(locales.size()); List selectList = new ArrayList(locales.size()); try { CmsResource res = getCms().readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION); String temporaryFilename = CmsWorkplace.getTemporaryFileName(resourceName); if (getCms().existsResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION)) { res = getCms().readResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION); CmsFile file = getCms().readFile(res); CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file); contentLocales = xmlContent.getLocales(); } catch (CmsException e) {
/** * Returns a cloned cms instance that prevents the time range resource filter check.<p> * * Use it always for unmarshalling and file writing.<p> * * @return a cloned cms instance that prevents the time range resource filter check * * @throws CmsException if something goes wrong */ protected CmsObject getCloneCms() throws CmsException { if (m_cloneCms == null) { m_cloneCms = OpenCms.initCmsObject(getCms()); m_cloneCms.getRequestContext().setRequestTime(CmsResource.DATE_RELEASED_EXPIRED_IGNORE); } return m_cloneCms; }
CmsResource res = getCms().readResource(filename, CmsResourceFilter.IGNORE_EXPIRATION); if (getCms().existsResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION)) { res = getCms().readResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION); CmsFile file = getCms().readFile(res); CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file); int locales = xmlContent.getLocales().size();
CmsResource res = getCms().readResource(filename, CmsResourceFilter.IGNORE_EXPIRATION); if (getCms().existsResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION)) { res = getCms().readResource(temporaryFilename, CmsResourceFilter.IGNORE_EXPIRATION); CmsFile file = getCms().readFile(res); CmsXmlContent xmlContent = CmsXmlContentFactory.unmarshal(getCms(), file); int locales = xmlContent.getLocales().size();
/** * @see org.opencms.workplace.CmsWorkplace#checkLock(String, CmsLockType) */ @Override public void checkLock(String resource, CmsLockType type) throws CmsException { CmsResource res = getCms().readResource(resource, CmsResourceFilter.ALL); CmsLock lock = getCms().getLock(res); if (!lock.isNullLock()) { setParamModified(Boolean.TRUE.toString()); } // for resources with siblings make sure all sibling have at least a // temporary lock if ((res.getSiblingCount() > 1) && (lock.isInherited())) { super.checkLock(resource, CmsLockType.TEMPORARY); } else { super.checkLock(resource, type); } }
/** * @see org.opencms.workplace.CmsWorkplace#checkLock(String, CmsLockType) */ @Override public void checkLock(String resource, CmsLockType type) throws CmsException { CmsResource res = getCms().readResource(resource, CmsResourceFilter.ALL); CmsLock lock = getCms().getLock(res); if (!lock.isNullLock()) { setParamModified(Boolean.TRUE.toString()); } // for resources with siblings make sure all sibling have at least a // temporary lock if ((res.getSiblingCount() > 1) && (lock.isInherited())) { super.checkLock(resource, CmsLockType.TEMPORARY); } else { super.checkLock(resource, type); } }
String filename = CmsEncoder.decode(paramValue, getCms().getRequestContext().getEncoding()); if (PARAM_TEMPFILE.equals(paramName) || CmsStringUtil.isEmpty(getParamTempfile())) { setFileEncoding(getFileEncoding(getCms(), filename)); return CmsEncoder.decode(paramValue, getCms().getRequestContext().getEncoding());
String filename = CmsEncoder.decode(paramValue, getCms().getRequestContext().getEncoding()); if (PARAM_TEMPFILE.equals(paramName) || CmsStringUtil.isEmpty(getParamTempfile())) { setFileEncoding(getFileEncoding(getCms(), filename)); return CmsEncoder.escapeXml(CmsEncoder.decode(paramValue, getCms().getRequestContext().getEncoding()));
/** * Creates a temporary file which is needed while working in an editor with preview option.<p> * * @return the file name of the temporary file * @throws CmsException if something goes wrong */ protected String createTempFile() throws CmsException { return OpenCms.getWorkplaceManager().createTempFile(getCms(), getParamResource(), getSettings().getProject()); }
/** * Creates a temporary file which is needed while working in an editor with preview option.<p> * * @return the file name of the temporary file * @throws CmsException if something goes wrong */ protected String createTempFile() throws CmsException { return OpenCms.getWorkplaceManager().createTempFile(getCms(), getParamResource(), getSettings().getProject()); }
/** * Returns the editor action for a "cancel" button.<p> * * This overwrites the cancel method of the CmsDialog class.<p> * * Always use this value, do not write anything directly in the html page.<p> * * @return the default action for a "cancel" button */ public String buttonActionCancel() { String target = null; if (Boolean.valueOf(getParamDirectedit()).booleanValue()) { // editor is in direct edit mode if (CmsStringUtil.isNotEmpty(getParamBacklink())) { // set link to the specified back link target target = getParamBacklink(); } else { // set link to the edited resource target = getParamResource(); } } else { // in workplace mode, show explorer view target = OpenCms.getLinkManager().substituteLink(getCms(), CmsFrameset.JSP_WORKPLACE_URI); } return "onclick=\"top.location.href='" + getJsp().link(target) + "';\""; }
/** * Returns the editor action for a "cancel" button.<p> * * This overwrites the cancel method of the CmsDialog class.<p> * * Always use this value, do not write anything directly in the html page.<p> * * @return the default action for a "cancel" button */ public String buttonActionCancel() { String target = null; if (Boolean.valueOf(getParamDirectedit()).booleanValue()) { // editor is in direct edit mode if (CmsStringUtil.isNotEmpty(getParamBacklink())) { // set link to the specified back link target target = getParamBacklink(); } else { // set link to the edited resource target = getParamResource(); } } else { // in workplace mode, show explorer view target = OpenCms.getLinkManager().substituteLink(getCms(), CmsWorkplace.JSP_WORKPLACE_URI); } return "onclick=\"top.location.href='" + getJsp().link(target) + "';\""; }
try { if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getParamResource())) { editedResource = getCms().readResource(getParamResource());
CmsObject cms = getCms(); CmsFile tempFile; List<CmsProperty> properties;
CmsObject cms = getCms(); CmsFile tempFile; List properties;