/** * Returns a link <i>from</i> the URI stored in the provided OpenCms user context * <i>to</i> the given VFS resource, for use on web pages.<p> * * The result will contain the configured context path and * servlet name, and in the case of the "online" project it will also be rewritten according to * to the configured static export settings.<p> * * Should the current site of the given OpenCms user context <code>cms</code> be different from the * site root of the given resource, the result will contain the full server URL to the target resource.<p> * * Please note the above text describes the default behavior as implemented by * {@link CmsDefaultLinkSubstitutionHandler}, which can be fully customized using the * {@link I_CmsLinkSubstitutionHandler} interface.<p> * * @param cms the current OpenCms user context * @param resource the VFS resource the link should point to * * @return a link <i>from</i> the URI stored in the provided OpenCms user context * <i>to</i> the given VFS resource, for use on web pages */ public String substituteLink(CmsObject cms, CmsResource resource) { return substituteLinkForRootPath(cms, resource.getRootPath()); }
/** * Returns a link <i>from</i> the URI stored in the provided OpenCms user context * <i>to</i> the given VFS resource, for use on web pages.<p> * * The result will contain the configured context path and * servlet name, and in the case of the "online" project it will also be rewritten according to * to the configured static export settings.<p> * * Should the current site of the given OpenCms user context <code>cms</code> be different from the * site root of the given resource, the result will contain the full server URL to the target resource.<p> * * Please note the above text describes the default behavior as implemented by * {@link CmsDefaultLinkSubstitutionHandler}, which can be fully customized using the * {@link I_CmsLinkSubstitutionHandler} interface.<p> * * @param cms the current OpenCms user context * @param resource the VFS resource the link should point to * * @return a link <i>from</i> the URI stored in the provided OpenCms user context * <i>to</i> the given VFS resource, for use on web pages */ public String substituteLink(CmsObject cms, CmsResource resource) { return substituteLinkForRootPath(cms, resource.getRootPath()); }
/** * @see org.opencms.gwt.CmsGwtActionElement#exportAll() */ @Override public String exportAll() throws Exception { StringBuffer sb = new StringBuffer(); sb.append(super.export()); String prefetchedData = exportDictionary( CmsCntPageData.DICT_NAME, I_CmsContainerpageService.class.getMethod("prefetch"), getCntPageData()); sb.append(prefetchedData); sb.append(exportModuleScriptTag(GWT_MODULE_NAME)); sb.append("<script type=\"text/javascript\" src=\""); sb.append( OpenCms.getLinkManager().substituteLinkForRootPath( getCmsObject(), "/system/workplace/editors/tinymce/opencms_plugin.js")); sb.append("\"></script>\n<style type=\"text/css\">\n html {\n overflow-y: scroll;\n }\n</style>"); return sb.toString(); }
/** * @see org.opencms.gwt.shared.rpc.I_CmsVfsService#substituteLinkForRootPath(java.lang.String, java.lang.String) */ public String substituteLinkForRootPath(String currentSiteRoot, String rootPath) throws CmsRpcException { String result = null; try { CmsObject cms = OpenCms.initCmsObject(getCmsObject()); cms.getRequestContext().setSiteRoot(currentSiteRoot); result = OpenCms.getLinkManager().substituteLinkForRootPath(cms, rootPath); } catch (CmsException e) { error(e); } return result; }
/** * Returns the ident-icon path for the given user.<p> * * @param cms the cms context * @param user the user * @param big <code>true</code> to retrieve the big icon * * @return the icon path */ private String getIconPath(CmsObject cms, CmsUser user, boolean big) { String userIconPath = (String)user.getAdditionalInfo(USER_IMAGE_INFO); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(userIconPath)) { userIconPath += big ? "" : "?__scale=h:32,w:32,t:2"; return OpenCms.getLinkManager().substituteLinkForRootPath(cms, userIconPath); } boolean isAdmin = OpenCms.getRoleManager().hasRole(cms, user.getName(), CmsRole.ADMINISTRATOR); String name = user.getName() + Boolean.toString(isAdmin); String rfsName = toRfsName(name, big); String path = toPath(name, big); if (!m_cache.hasCacheContent(rfsName)) { BufferedImage icon = m_renderer.render(name, isAdmin, big ? 96 : 32); try { m_cache.saveCacheFile(rfsName, getImageBytes(icon)); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); } } return path; }
result.setAliasLockOwner(otherLockOwner.getName()); result.setDownloadUrl(OpenCms.getLinkManager().substituteLinkForRootPath(cms, ALIAS_DOWNLOAD_PATH)); return result; } catch (Throwable e) {
/** * @see org.opencms.ui.editors.I_CmsEditor#initUI(org.opencms.ui.apps.I_CmsAppUIContext, org.opencms.file.CmsResource, java.lang.String) */ public void initUI(I_CmsAppUIContext context, CmsResource resource, String backLink) { m_resource = resource; CmsObject cms = A_CmsUI.getCmsObject(); String sitepath = cms.getSitePath(m_resource); String link = OpenCms.getLinkManager().substituteLinkForRootPath(cms, getEditorUri()); m_frame = new CmsBrowserFrame(); m_frame.setDescription("Editor"); m_frame.setName("edit"); m_frame.setSource(new ExternalResource(link + "?resource=" + sitepath + "&backlink=" + backLink)); m_frame.setSizeFull(); context.showInfoArea(false); context.hideToolbar(); m_frame.addStyleName("o-editor-frame"); context.setAppContent(m_frame); context.setAppTitle( CmsVaadinUtils.getMessageText( Messages.GUI_CONTENT_EDITOR_TITLE_2, resource.getName(), CmsResource.getParentFolder(sitepath))); m_editorState = new CmsEditorStateExtension(m_frame); }
String aliasImportUrl = OpenCms.getLinkManager().substituteLinkForRootPath(cms, ALIAS_IMPORT_PATH); boolean canEditAliases = OpenCms.getAliasManager().hasPermissionsForMassEdit(cms, siteRoot); List<CmsListInfoBean> subsitemapFolderTypeInfos = collectSitemapTypeInfos(cms, configData);