/** * Returns a flag indicating if the site is the shared site. * * @return <code>true</code> if the site is the shared site, * or <code>false</code> if it is not the shared site. */ public boolean isSharedSite() { return OpenCms.getSiteManager().getSharedFolder().equals(m_siteRoot + "/"); }
/** * Gets all resources from the folder tree beneath the base folder or the shared folder which have a given type.<p> * * @param type the type to filter by * * @return the list of resources with the given type * * @throws CmsException if something goes wrong */ private List<CmsResource> getDetailResources(I_CmsResourceType type) throws CmsException { String typeName = type.getTypeName(); if (!m_detailResources.containsKey(typeName)) { List<CmsResource> result = new ArrayList<CmsResource>(); CmsResourceFilter filter = CmsResourceFilter.DEFAULT_FILES.addRequireType(type); List<CmsResource> siteFiles = m_guestCms.readResources(m_siteRoot, filter, true); result.addAll(siteFiles); String shared = CmsFileUtil.removeTrailingSeparator(OpenCms.getSiteManager().getSharedFolder()); if (shared != null) { List<CmsResource> sharedFiles = m_guestCms.readResources(shared, filter, true); result.addAll(sharedFiles); } m_detailResources.put(typeName, result); } return m_detailResources.get(typeName); }
String sharedFolder = OpenCms.getSiteManager().getSharedFolder(); if (sharedFolder != null) { result.add(sharedFolder);
/** * Returns the site title.<p> * * @param cms the cms context * @param resource the site root resource * * @return the title * * @throws CmsException in case reading the title property fails */ public String getSiteTitle(CmsObject cms, CmsResource resource) throws CmsException { String title = cms.readPropertyObject(resource, CmsPropertyDefinition.PROPERTY_TITLE, false).getValue(); if (title == null) { title = resource.getRootPath(); } if (resource.getRootPath().equals(getSharedFolder())) { title = SHARED_FOLDER_TITLE; } return title; }
if (targetSiteRoot == null) { if (OpenCms.getSiteManager().startsWithShared(explorerRootPath)) { targetSiteRoot = OpenCms.getSiteManager().getSharedFolder(); } else { targetSiteRoot = "";
siteRoot += "/"; String regex = "^(/system/|" + OpenCms.getSiteManager().getSharedFolder() + "|" + siteRoot + ").*";
|| formatterBean.getLocation().startsWith(OpenCms.getSiteManager().getSharedFolder()); if (!systemOrShared) { String formatterSubSite = CmsResource.getParentFolder(
String sharedFolder = OpenCms.getSiteManager().getSharedFolder(); if (sharedFolder != null) { retValue.append("sharedFolderName = '" + sharedFolder + "';");
/** * Adds the shared folder.<p> */ public void addSharedSite() { String shared = OpenCms.getSiteManager().getSharedFolder(); if (shared.endsWith("/")) { // IMPORTANT: remove last "/". // Otherwise the version without slash will be added as well when you are in the shared folder currently. shared = shared.substring(0, shared.length() - 1); } if ((shared != null) && m_cms.existsResource(shared, CmsResourceFilter.ONLY_VISIBLE_NO_DELETED)) { addOption( Type.shared, shared, org.opencms.workplace.Messages.get().getBundle( OpenCms.getWorkplaceManager().getWorkplaceLocale(m_cms)).key( org.opencms.workplace.Messages.GUI_SHARED_TITLE_0)); } }
/** * Reads the contents of a given type and stores them in a path map.<p> * * @param type the type for which to read the contents * @return the path map containing the contents */ private CmsPathMap<CmsResource> readPathMapForType(I_CmsResourceType type) { List<CmsResource> result = new ArrayList<CmsResource>(); CmsResourceFilter filter = CmsResourceFilter.DEFAULT_FILES.addRequireType(type); try { List<CmsResource> siteFiles = m_guestCms.readResources(m_siteRoot, filter, true); result.addAll(siteFiles); } catch (CmsException e) { LOG.error("XML sitemap generator error: " + e.getLocalizedMessage(), e); } String shared = CmsFileUtil.removeTrailingSeparator(OpenCms.getSiteManager().getSharedFolder()); if (shared != null) { try { List<CmsResource> sharedFiles = m_guestCms.readResources(shared, filter, true); result.addAll(sharedFiles); } catch (CmsException e) { LOG.error("XML sitemap generator error: " + e.getLocalizedMessage(), e); } } CmsPathMap<CmsResource> resultMap = new CmsPathMap<CmsResource>(); for (CmsResource resource : result) { resultMap.add(resource.getRootPath(), resource); } return resultMap; }
if (OpenCms.getSiteManager().getSharedFolder() != null) { extendPathFilter(terms, OpenCms.getSiteManager().getSharedFolder());
String shared = OpenCms.getSiteManager().getSharedFolder(); List<CmsResource> sharedGalleries = getCmsObject().readResources( shared,
/** * Gets the common site root of a set of resources.<p> * @param resourceSet the resources * * @return the common site root (may also be the shared folder or root folder) */ protected String getCommonSite(Collection<CmsResource> resourceSet) { String commonPath = getCommonAncestorPath(resourceSet); String result = null; CmsSiteManagerImpl siteManager = OpenCms.getSiteManager(); if (siteManager.startsWithShared(commonPath)) { result = siteManager.getSharedFolder(); } else { String siteRoot = siteManager.getSiteRoot(CmsStringUtil.joinPaths(commonPath, "/")); if (siteRoot == null) { result = "/"; } else { result = siteRoot; } } return result; }
String siteRoot = null; if (OpenCms.getSiteManager().startsWithShared(rootPath)) { siteRoot = OpenCms.getSiteManager().getSharedFolder(); } else { String tempSiteRoot = OpenCms.getSiteManager().getSiteRoot(rootPath);
targetCms.getRequestContext().setSiteRoot(site.getSiteRoot()); } else if (OpenCms.getSiteManager().startsWithShared(m_targetFolder.getRootPath())) { targetCms.getRequestContext().setSiteRoot(OpenCms.getSiteManager().getSharedFolder());
/** * @see org.opencms.ui.I_CmsDialogContext#focus(org.opencms.util.CmsUUID) */ @Override public void focus(CmsUUID cmsUUID) { try { CmsObject cms = A_CmsUI.getCmsObject(); CmsResource res = cms.readResource(cmsUUID, CmsResourceFilter.ALL); String rootPath = res.getRootPath(); String siteRoot = OpenCms.getSiteManager().getSiteRoot(rootPath); String sitePath = null; if (siteRoot == null) { if (OpenCms.getSiteManager().startsWithShared(rootPath)) { siteRoot = OpenCms.getSiteManager().getSharedFolder(); sitePath = CmsResource.getParentFolder( rootPath.substring(OpenCms.getSiteManager().getSharedFolder().length())); } else { sitePath = CmsResource.getParentFolder(rootPath); siteRoot = ""; } } else { CmsObject otherSiteCms = OpenCms.initCmsObject(cms); otherSiteCms.getRequestContext().setSiteRoot(siteRoot); sitePath = otherSiteCms.getRequestContext().removeSiteRoot(CmsResource.getParentFolder(rootPath)); } m_explorer.changeSite(siteRoot, sitePath, true); } catch (CmsException e) { CmsErrorDialog.showErrorDialog(e); } }
/** * Returns the workplace link.<p> * * @param cms the cms context * @param resourceRootFolder the resource folder root path * * @return the workplace link */ public static String getVaadinWorkplaceLink(CmsObject cms, String resourceRootFolder) { CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(resourceRootFolder); String siteRoot = site != null ? site.getSiteRoot() : OpenCms.getSiteManager().startsWithShared(resourceRootFolder) ? OpenCms.getSiteManager().getSharedFolder() : ""; String link = getFileExplorerLink(cms, siteRoot) + cms.getRequestContext().removeSiteRoot(resourceRootFolder); return link; }
path = m_currentCms.getRequestContext().removeSiteRoot(path); } else if (OpenCms.getSiteManager().startsWithShared(path)) { getSiteSelector().setValue(OpenCms.getSiteManager().getSharedFolder()); } else if (path.startsWith(CmsWorkplace.VFS_PATH_SYSTEM)) { getSiteSelector().setValue("");
siteRoot = OpenCms.getSiteManager().getSharedFolder(); } else { String tempSiteRoot = OpenCms.getSiteManager().getSiteRoot(rootPath);
resourceStr = CmsStringUtil.joinPaths(OpenCms.getSiteManager().getSharedFolder(), resourceStr);