Opens the edit site dialog.<p>

@param siteRoot the site root of the site to edit, if <code>null</code>
505728
public void openEditDialog(String siteRoot) {

        CmsEditSiteForm form;
        String caption;
        if (siteRoot != null) {
            form = new CmsEditSiteForm(m_rootCms, this, siteRoot);
            caption = CmsVaadinUtils.getMessageText(
                Messages.GUI_SITE_CONFIGURATION_EDIT_1,
                m_sitesTable.getContainer().getItem(siteRoot).getItemProperty(TableProperty.Title).getValue());
        } else {
            form = new CmsEditSiteForm(m_rootCms, this);
            caption = CmsVaadinUtils.getMessageText(Messages.GUI_SITE_ADD_0);
        }
        openDialog(form, caption);
    }
326547
public void updateSitePath(String sitePath) {

        String oldPath = getSitePath();
        getListItemWidget().setSubtitleLabel(sitePath);
        for (Widget child : getChildren()) {
            ((CmsGalleryTreeItem)child).updateParentPath(sitePath, oldPath);
        }
    }
950969
private void siteSelected(String site) {
		if (!site.equals(currentSite)) {
			this.sessionsModel = extension.getHttpSessionsSite(site).getModel();
			this.getHttpSessionsTable().setModel(this.sessionsModel);

			this.setSessionsTableColumnSizes();

			currentSite = site;
		}
	}
592241
private void setTemplate(CmsResource siteRootResource) {

        try {
            m_cms.lockResource(siteRootResource);
            // add template  property
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_template)) {
                CmsProperty prop = new CmsProperty(CmsPropertyDefinition.PROPERTY_TEMPLATE, m_template, m_template);
                m_cms.writePropertyObject(siteRootResource.getRootPath(), prop);
            }
            m_cms.unlockResource(siteRootResource);
        } catch (CmsException e) {
            LOG.error("Error on adding template", e);
        }
    }
1236578
public void setRootNode(TreeElement rootNode)
    {
        _rootNode = rootNode;
        if (rootNode.getName() == null) {
            rootNode.setName("0");
        }
    }
75326
public void clear(CmsObject cms, String siteRoot) {

        CmsUser originalUser = m_map.getIfPresent(siteRoot);
        if ((originalUser == null) || !originalUser.equals(cms.getRequestContext().getCurrentUser())) {
            return;
        }
        m_map.invalidate(siteRoot);
    }
568401
void submit() {

        List<String> siteRootsToDelete = new ArrayList<String>();
        for (CmsSite site : m_sitesToDelete) {

            String currentSite = A_CmsUI.getCmsObject().getRequestContext().getSiteRoot();
            if (currentSite.equals(site.getSiteRoot())) {
                A_CmsUI.getCmsObject().getRequestContext().setSiteRoot("");
            }
            siteRootsToDelete.add(site.getSiteRoot());
        }
        m_manager.deleteElements(siteRootsToDelete);
        if (m_deleteResources.getValue().booleanValue()) {
            for (CmsSite site : m_sitesToDelete) {
                try {
                    m_manager.getRootCmsObject().lockResource(site.getSiteRoot());
                } catch (CmsException e) {
                    LOG.error("unable to lock resource");
                }
                try {
                    m_manager.getRootCmsObject().deleteResource(
                        site.getSiteRoot(),
                        CmsResource.DELETE_PRESERVE_SIBLINGS);
                    try {
                        m_manager.getRootCmsObject().unlockResource(site.getSiteRoot());
                    } catch (CmsLockException e) {
                        LOG.info("Unlock failed.", e);
                    }
                } catch (CmsException e) {
                    //ok, resource was not published and can not be unlocked anymore..
                }
            }
        }
    }
56919
@Override
    protected boolean performDialogOperation() throws CmsException {

        // check if the current resource is a folder for single operation
        boolean isFolder = isOperationOnFolder();

        // on folder copy display "please wait" screen, not for simple file copy
        if ((isMultiOperation() || isFolder) && !DIALOG_WAIT.equals(getParamAction())) {
            // return false, this will trigger the "please wait" screen
            return false;
        }

        // get the copy mode from request parameter value
        CmsResourceCopyMode copyMode = CmsResource.COPY_PRESERVE_SIBLING;
        try {
            copyMode = CmsResourceCopyMode.valueOf(Integer.parseInt(getParamCopymode()));
        } catch (Exception e) {
            // can usually be ignored
            if (LOG.isInfoEnabled()) {
                LOG.info(e.getLocalizedMessage());
            }
        }

        // check the overwrite options
        boolean overwrite = Boolean.valueOf(getParamOverwrite()).booleanValue();
        overwrite = ((isMultiOperation() && overwrite) || DIALOG_CONFIRMED.equals(getParamAction()));

        // calculate the target name
        String target = getParamTarget();
        if (target == null) {
            target = "";
        }

        String storedSiteRoot = null;
        try {
            // check if a site root was added to the target name
            String sitePrefix = "";
            if (OpenCms.getSiteManager().getSiteRoot(target) != null) {
                String siteRootFolder = getCms().getRequestContext().getSiteRoot();
                if (siteRootFolder.endsWith("/")) {
                    siteRootFolder = siteRootFolder.substring(0, siteRootFolder.length() - 1);
                }
                sitePrefix = siteRootFolder;
                storedSiteRoot = getCms().getRequestContext().getSiteRoot();
                getCms().getRequestContext().setSiteRoot("/");
            }

            Iterator<String> i = getResourceList().iterator();
            // iterate the resources to copy
            while (i.hasNext()) {
                String resName = i.next();
                try {
                    performSingleCopyOperation(resName, target, sitePrefix, copyMode, overwrite);
                } catch (CmsException e) {
                    if (isMultiOperation()) {
                        // collect exceptions to create a detailed output
                        addMultiOperationException(e);
                    } else {
                        // for single operation, throw the exception immediately
                        throw e;
                    }
                }
            }
            // check if exceptions occurred
            checkMultiOperationException(Messages.get(), Messages.ERR_COPY_MULTI_0);
        } finally {
            // restore the site root
            if (storedSiteRoot != null) {
                getCms().getRequestContext().setSiteRoot(storedSiteRoot);
            }
        }
        return true;
    }
798849
private CmsResource createSiteRootIfNeeded(String siteRoot) throws CmsException {

        CmsResource siteRootResource = null;

        // check if the site root already exists
        try {
            // take the existing site and do not perform any OU related actions
            if (m_cms.existsResource(siteRoot)) {
                siteRootResource = m_cms.readResource(siteRoot);
            } else {
                CmsResource onlineVersion = m_cmsOnline.readResource(siteRoot);
                siteRootResource = m_cms.readResource(onlineVersion.getStructureId());
            }

        } catch (CmsVfsResourceNotFoundException e) {
            // not create a new site folder and the according OU if option is checked checked
            getReport().println(
                Messages.get().container(Messages.RPT_SITE_CREATE_RESOURCES_0),
                I_CmsReport.FORMAT_DEFAULT);
            I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(
                CmsResourceTypeFolderSubSitemap.TYPE_SUBSITEMAP);
            siteRootResource = m_cms.createResource(siteRoot, type);
            CmsProperty folderTitle = new CmsProperty(
                CmsPropertyDefinition.PROPERTY_TITLE,
                m_site.getTitle(),
                m_site.getTitle());
            m_cms.writePropertyObject(siteRoot, folderTitle);

        }
        return siteRootResource;
    }
1225713
public void doEdit(final String filename, final CmsUUID structureId) {

        I_CmsEditableData editData = new I_CmsEditableData() {

            public String getContextId() {

                return "";
            }

            public String getEditId() {

                return null;
            }

            public String getElementId() {

                // TODO Auto-generated method stub
                return null;
            }

            public String getElementLanguage() {

                return null;
            }

            public String getElementName() {

                return null;
            }

            public String getNewLink() {

                return null;
            }

            public String getNewTitle() {

                return null;
            }

            public String getNoEditReason() {

                return null;
            }

            public String getPostCreateHandler() {

                return null;
            }

            public String getSitePath() {

                return filename;
            }

            public CmsUUID getStructureId() {

                return structureId;
            }

            public boolean hasEditHandler() {

                return false;
            }

            public boolean hasResource() {

                return true;
            }

            public boolean isUnreleasedOrExpired() {

                return false;
            }

            public void setSitePath(String sitePath) {

                // nothing to do
            }
        };
        if (m_useSelf) {
            FormElement form = CmsContentEditorDialog.generateForm(editData, false, "_self", null);
            RootPanel.getBodyElement().appendChild(form);
            form.submit();
        } else {

            I_CmsContentEditorHandler handler = new I_CmsContentEditorHandler() {

                @SuppressWarnings("synthetic-access")
                public void onClose(String sitePath, CmsUUID id, boolean isNew, boolean hasChangedSettings) {

                    if (!m_reload) {
                        return;
                    }

                    if (m_immediateReload) {
                        reloadTop();
                    }

                    // defer the window.location.reload until after the editor window has closed
                    // so we don't get another confirmation dialog
                    Timer timer = new Timer() {

                        @Override
                        public void run() {

                            reloadTop();

                        }

                    };
                    timer.schedule(10);
                }
            };
            CmsContentEditorDialog.get().openEditDialog(editData, false, null, new DialogOptions(), handler);
        }
    }
878712
public void openSettingsDailog() {

        CmsGlobalForm form = new CmsGlobalForm(this);
        openDialog(form, CmsVaadinUtils.getMessageText(Messages.GUI_SITE_GLOBAL_CONFIGURATION_0));
    }
1054658
private void checkPermissionsForMassEdit(CmsObject cms, String siteRoot) throws CmsException {

        String originalSiteRoot = cms.getRequestContext().getSiteRoot();
        try {
            cms.getRequestContext().setSiteRoot(siteRoot);
            checkPermissionsForMassEdit(cms);
        } finally {
            cms.getRequestContext().setSiteRoot(originalSiteRoot);
        }
    }
1311398
private void fillNodesInContext(SiteNode rootNode, List<SiteNode> nodesList) {
		@SuppressWarnings("unchecked")
		Enumeration<TreeNode> en = rootNode.children();
		while (en.hasMoreElements()) {
			SiteNode sn = (SiteNode) en.nextElement();
			if (isInContext(sn)) {
				nodesList.add(sn);
			}
			fillNodesInContext(sn, nodesList);
		}
	}
518182
private void fillNodesInScope(SiteNode rootNode, List<SiteNode> nodesList) {
		@SuppressWarnings("unchecked")
		Enumeration<TreeNode> en = rootNode.children();
		while (en.hasMoreElements()) {
			SiteNode sn = (SiteNode) en.nextElement();
			if (isInScope(sn))
				nodesList.add(sn);
			fillNodesInScope(sn, nodesList);
		}
	}
935793
protected void openEditDialog(boolean isNew, String mode, CmsEditHandlerData handlerDataForNew) {

        CmsContainerpageController.get().getContentEditorHandler().openDialog(
            m_editableData,
            isNew,
            m_parentResourceId,
            mode,
            handlerDataForNew);
    }
282659
public void addSite(String site) {
		if (siteModel.getIndexOf(site) < 0) {
			siteModel.addElement(site);
			if (currentSite == null) {
				// First site added, automatically select it
				siteModel.setSelectedItem(site);
			}
		}
	}
1179157
private void saveFavIcon(String siteRoot) {

        if (m_os == null) {
            return;
        }
        if (m_os.size() == 0) {
            return;
        }

        getReport().println(Messages.get().container(Messages.RPT_SITE_SET_FAVICON_0), I_CmsReport.FORMAT_DEFAULT);
        CmsResource favicon = null;
        try {
            favicon = m_cms.createResource(
                siteRoot + CmsSiteManager.FAVICON,
                OpenCms.getResourceManager().getResourceType(CmsResourceTypeImage.getStaticTypeName()));
        } catch (CmsVfsResourceAlreadyExistsException e) {
            //OK, Resource already there
            try {
                favicon = m_cms.readResource(siteRoot + CmsSiteManager.FAVICON);
            } catch (CmsException e2) {
                //no, it wasn't..
                getReport().println(
                    Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0),
                    I_CmsReport.FORMAT_ERROR);
                getReport().println(e);
                getReport().println(e2);
                return;
            }
        } catch (CmsIllegalArgumentException | CmsException e) {
            getReport().println(Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0), I_CmsReport.FORMAT_ERROR);
            getReport().println(e);
            return;
        }
        try {
            m_cms.lockResource(siteRoot + CmsSiteManager.FAVICON);
            CmsFile faviconFile = new CmsFile(favicon);
            faviconFile.setContents(m_os.toByteArray());
            m_cms.writeFile(faviconFile);
            m_cms.unlockResource(siteRoot + CmsSiteManager.FAVICON);
        } catch (CmsException e) {
            getReport().println(Messages.get().container(Messages.RPT_SITE_ERROR_FAVICON_0), I_CmsReport.FORMAT_ERROR);
            getReport().println(e);
            return;
        }

    }