Creates info panel for OUs.<p>


@param ou to get panel for
@return CmsResourceInfo
501979
public static CmsResourceInfo getOUInfo(CmsOrganizationalUnit ou) {

        String style = OpenCmsTheme.ICON_OU;
        if (ou.hasFlagWebuser()) {
            style = OpenCmsTheme.ICON_OU_WEB;
        }
        CmsCssIcon image = new CmsCssIcon(style);
        return new CmsResourceInfo(
            ou.getDisplayName(A_CmsUI.get().getLocale()),
            ou.getDescription(A_CmsUI.get().getLocale()),
            image);
    }
1151681
public String buildProjectInformation() {

        StringBuffer result = new StringBuffer(32);

        try {
            String[] localizedObject = new String[] {getCms().getRequestContext().getCurrentProject().getName()};
            List<String> resources = getCms().readProjectResources(getCms().getRequestContext().getCurrentProject());
            Iterator<String> i = resources.iterator();
            result.append(dialogBlockStart(key(Messages.GUI_COPYTOPROJECT_RESOURCES_0)));
            if (resources.size() > 0) {
                // at least one resource in current project
                result.append(key(Messages.GUI_COPYTOPROJECT_PART_1, localizedObject));
                result.append("<ul style=\"margin-top: 3px; margin-bottom: 3px;\">\n");
                String siteRoot = getCms().getRequestContext().getSiteRoot();
                while (i.hasNext()) {
                    // create resource list
                    String resName = i.next();
                    if (resName.startsWith(siteRoot)) {
                        // remove current site root from resource name
                        resName = resName.substring(siteRoot.length());
                    }
                    result.append("\t<li>");
                    result.append(resName);
                    result.append("</li>\n");
                }
                result.append("</ul>\n");
            } else {
                // no resources in current project
                result.append(key(Messages.GUI_COPYTOPROJECT_NOPART_1, localizedObject));
            }
            result.append(dialogBlockEnd());
            result.append(dialogSpacer());
        } catch (CmsException e) {
            // error reading project resources, should not happen
            if (LOG.isInfoEnabled()) {
                LOG.info(e.getLocalizedMessage());
            }
        }

        // determine resource name to show
        String resName = getParamResource();
        try {
            CmsResource res = getCms().readResource(getParamResource(), CmsResourceFilter.ALL);
            if (res.isFolder() && !resName.endsWith("/")) {
                resName += "/";
            }
        } catch (CmsException e) {
            // error reading resource, should not happen
            if (LOG.isInfoEnabled()) {
                LOG.info(e.getLocalizedMessage());
            }
        }
        // show confirmation question
        String[] localizedObject = new String[] {resName, getCms().getRequestContext().getCurrentProject().getName()};
        result.append(key(Messages.GUI_COPYTOPROJECT_PROJECT_CONFIRMATION_2, localizedObject));
        return result.toString();
    }
744531
public I_CmsEditHandler getEditHandler(CmsObject cms) {

        String schema = getSchema();

        try {
            CmsXmlContentDefinition contentDefinition = CmsXmlContentDefinition.unmarshal(cms, schema);
            // get the content handler for the resource type to create
            I_CmsXmlContentHandler handler = contentDefinition.getContentHandler();
            return handler.getEditHandler();

        } catch (CmsXmlException e) {
            LOG.error(e.getMessage(), e);
        }
        return null;
    }
1134865
public static CmsResourceInfo createSitemapResourceInfo(CmsResource resource, CmsSite baseSite) {

        String title = resource.getName();
        String path = resource.getRootPath();

        CmsResourceInfo info = new CmsResourceInfo();
        CmsResourceUtil resUtil = new CmsResourceUtil(A_CmsUI.getCmsObject(), resource);

        CmsObject cms = A_CmsUI.getCmsObject();
        try {
            Map<String, CmsProperty> props = CmsProperty.toObjectMap(cms.readPropertyObjects(resource, false));
            CmsProperty navtextProp = props.get(CmsPropertyDefinition.PROPERTY_NAVTEXT);
            CmsProperty titleProp = props.get(CmsPropertyDefinition.PROPERTY_TITLE);

            if ((navtextProp != null) && (navtextProp.getValue() != null)) {
                title = navtextProp.getValue();
            } else if ((titleProp != null) && (titleProp.getValue() != null)) {
                title = titleProp.getValue();
            }
        } catch (Exception e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
        info.getTopLine().setValue(title);
        if (baseSite != null) {
            String siteRoot = baseSite.getSiteRoot();
            if (path.startsWith(siteRoot)) {
                path = path.substring(siteRoot.length());
                path = CmsStringUtil.joinPaths("/", path);
            }
        }
        info.getBottomLine().setValue(path);
        Resource icon = CmsResourceIcon.getSitemapResourceIcon(
            A_CmsUI.getCmsObject(),
            resUtil.getResource(),
            IconMode.localeCompare);
        info.getResourceIcon().initContent(resUtil, icon, null, true, false);
        return info;
    }
173894
protected void init(String ou, Window window) {

        try {
            displayResourceInfoDirectly(
                Collections.singletonList(
                    CmsAccountsApp.getOUInfo(
                        OpenCms.getOrgUnitManager().readOrganizationalUnit(A_CmsUI.getCmsObject(), ou))));
        } catch (CmsException e) {
            //
        }

        m_ou = ou;
        m_window = window;
        getDownloadButton().setEnabled(true);
        initDownloadButton();

        getCloseButton().addClickListener(event -> window.close());
    }
1252253
public String getAssignedOu() {

        try {
            CmsOrganizationalUnit ou;
            if (!isNewProject()) {
                ou = OpenCms.getOrgUnitManager().readOrganizationalUnit(getCms(), m_project.getOuFqn());
            } else {
                ou = OpenCms.getRoleManager().getOrgUnitsForRole(getCms(), CmsRole.PROJECT_MANAGER, true).get(0);
            }
            return ou.getDisplayName(getLocale());
        } catch (CmsException e) {
            return null;
        }
    }
762039
public String getSelectedEditorUri() {

        // get the handler class from the OpenCms runtime property
        I_CmsEditorHandler editorClass = OpenCms.getWorkplaceManager().getEditorHandler();

        // the resourcenameparameter could be encoded, so decode it
        String resource = getParamResource();
        resource = CmsEncoder.unescape(resource, CmsEncoder.ENCODING_UTF_8);
        if (editorClass == null) {
            // error getting the dialog class, return to file list
            return CmsWorkplace.FILE_EXPLORER_FILELIST;
        }
        // get the dialog URI from the class defined in the configuration
        String editorUri = null;
        try {
            editorUri = editorClass.getEditorUri(resource, getJsp());
            if (editorUri == null) {
                // no valid editor was found, show the error dialog
                throw new CmsWorkplaceException(Messages.get().container(Messages.ERR_NO_EDITOR_FOUND_0));
            }
        } catch (CmsException e) {
            showErrorDialog(getJsp(), e);
        }
        return editorUri;
    }
377227
private CmsNewResourceInfo createNavigationLevelTypeInfo() throws CmsException {

        String name = CmsResourceTypeFolder.getStaticTypeName();
        Locale locale = getWorkplaceLocale();
        String subtitle = Messages.get().getBundle(getWorkplaceLocale()).key(Messages.GUI_NAVIGATION_LEVEL_SUBTITLE_0);
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(subtitle)) {
            subtitle = CmsWorkplaceMessages.getResourceTypeName(locale, name);
        }
        CmsNewResourceInfo result = new CmsNewResourceInfo(
            CmsResourceTypeFolder.getStaticTypeId(),
            name,
            Messages.get().getBundle(getWorkplaceLocale()).key(Messages.GUI_NAVIGATION_LEVEL_TITLE_0),
            subtitle,
            getCmsObject().readResource(SUB_LEVEL_REDIRECT_COPY_PAGE).getStructureId(),
            false,
            subtitle);
        result.setBigIconClasses(CmsIconUtil.ICON_NAV_LEVEL_BIG);
        result.setCreateParameter(CmsJspNavBuilder.NAVIGATION_LEVEL_FOLDER);
        return result;
    }
1255643
public CmsElementOptionButton createOptionForElement(CmsContainerPageElementPanel element) {

        if (!isOptionAvailable(element)) {
            return null;
        }
        CmsElementOptionButton button = new CmsElementOptionButton(this, element);
        button.addClickHandler(m_elementClickHandler);
        return button;
    }
226752
public static List<String> getManagableOUs(CmsObject cms) {

        List<String> ous = new ArrayList<String>();
        try {
            for (CmsRole role : OpenCms.getRoleManager().getRolesOfUser(
                cms,
                cms.getRequestContext().getCurrentUser().getName(),
                "",
                true,
                false,
                true)) {
                if (role.getRoleName().equals(CmsRole.ACCOUNT_MANAGER.getRoleName())) {
                    if (role.getOuFqn().equals("")) {
                        ous.add(0, role.getOuFqn());
                    } else {
                        ous.add(role.getOuFqn());
                    }
                }
            }
        } catch (CmsException e) {
            //
        }
        return ous;
    }
976131
public String[] getResourceInfo(CmsResource resource) {

        String rootPath = resource.getRootPath();
        String title = "-";

        try {
            CmsProperty titleProp = m_adminCms.readPropertyObject(
                resource,
                CmsPropertyDefinition.PROPERTY_TITLE,
                false);
            if (!titleProp.isNullProperty()) {
                title = titleProp.getValue();
            }
        } catch (CmsException e) {
            // ignore
        }
        return new String[] {rootPath, title};
    }
909942
public CmsOrganizationalUnit createWebOU(String ouFqn, String description, boolean hideLogin) {

        try {
            return OpenCms.getOrgUnitManager().createOrganizationalUnit(
                m_cms,
                ouFqn,
                description,
                (hideLogin ? CmsOrganizationalUnit.FLAG_HIDE_LOGIN : 0) | CmsOrganizationalUnit.FLAG_WEBUSERS,
                null);
        } catch (CmsException e) {
            // TODO Auto-generated catch block
            m_shell.getOut().println(
                getMessages().key(Messages.GUI_SHELL_WEB_OU_CREATION_FAILED_2, ouFqn, description));
            return null;
        }
    }
1113364
protected CmsObject getCms() {

        if (m_cms == null) {
            try {
                m_cms = OpenCms.initCmsObject(A_CmsUI.getCmsObject());
                m_cms.getRequestContext().setSiteRoot("");
            } catch (CmsException e) {
                return null;
            }
        }
        return m_cms;
    }
1272527
public CmsUploadProgessInfo getInfo() {

        if (m_finished) {
            return new CmsUploadProgessInfo(
                getItem(),
                (int)getPercent(),
                UPLOAD_STATE.finished,
                getContentLength(),
                getBytesRead());
        }
        return new CmsUploadProgessInfo(
            getItem(),
            (int)getPercent(),
            UPLOAD_STATE.running,
            getContentLength(),
            getBytesRead());
    }
797357
protected Panel createResourceListPanel(String caption, List<CmsResource> resources) {

        Panel result = null;
        if (CmsStringUtil.isEmptyOrWhitespaceOnly(caption)) {
            result = new Panel();
        } else {
            result = new Panel(caption);
        }
        result.addStyleName("v-scrollable");
        result.setSizeFull();
        VerticalLayout resourcePanel = new VerticalLayout();
        result.setContent(resourcePanel);
        resourcePanel.addStyleName(OpenCmsTheme.REDUCED_MARGIN);
        resourcePanel.addStyleName(OpenCmsTheme.REDUCED_SPACING);
        resourcePanel.setSpacing(true);
        resourcePanel.setMargin(true);
        for (CmsResource resource : resources) {
            resourcePanel.addComponent(new CmsResourceInfo(resource));
        }
        return result;
    }
1212467
public static CmsImportExportUserDialog getExportUserDialogForGroup(
        CmsUUID groupID,
        String ou,
        Window window,
        boolean allowTechnicalFieldsExport) {

        CmsImportExportUserDialog res = new CmsImportExportUserDialog(ou, groupID, window, allowTechnicalFieldsExport);
        return res;
    }
831861
public Map<CmsUUID, CmsElementView> getElementViews(CmsObject cms) {

        CmsConfigurationCache cache = getCache(isOnline(cms));
        List<CmsElementView> viewList = Lists.newArrayList();
        viewList.addAll(cache.getState().getElementViews().values());
        viewList.addAll(OpenCms.getWorkplaceManager().getExplorerTypeViews().values());
        Collections.sort(viewList, new ElementViewComparator());
        Map<CmsUUID, CmsElementView> result = Maps.newLinkedHashMap();
        for (CmsElementView viewValue : viewList) {
            result.put(viewValue.getId(), viewValue);
        }
        return result;
    }