Performs the comment images operation.
<p>

@return true, if the resources were successfully processed, otherwise false
@throws CmsException if commenting is not successful
352053
protected boolean performDialogOperation() throws CmsException {

        // lock the folder
        checkLock(getParamResource());

        Iterator<CmsResource> i = getResources().iterator();
        // loop over all image resources to change the properties
        CmsResource res;
        while (i.hasNext()) {
            res = i.next();
            String imageName = res.getName();
            String propertySuffix = "" + imageName.hashCode();

            String property;
            I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(res);
            CmsExplorerTypeSettings settings = getSettingsForType(type.getTypeName());
            Iterator<String> itProperties = settings.getProperties().iterator();
            while (itProperties.hasNext()) {
                property = itProperties.next();
                CmsProperty currProperty = getCms().readPropertyObject(res, property, false);
                String newValue = getJsp().getRequest().getParameter(property + propertySuffix);
                writeProperty(res, property, newValue, currProperty);
            }
        }

        // unlock the folder
        CmsObject cms = getCms();
        cms.unlockResource(getParamResource());
        return true;
    }
559901
protected boolean isOperationOnFolder() {

        Iterator<String> i = getResourceList().iterator();
        while (i.hasNext()) {
            String resName = i.next();
            try {
                CmsResource curRes = getCms().readResource(resName, CmsResourceFilter.ALL);
                if (curRes.isFolder()) {
                    // found a folder
                    return true;
                }
            } catch (CmsException e) {
                // can usually be ignored
                if (LOG.isInfoEnabled()) {
                    LOG.info(e.getLocalizedMessage());
                }
            }
        }
        return false;
    }
176300
@Override
    protected boolean performDialogOperation() throws CmsException {

        // check if the current resource is a folder for single operation
        boolean isFolder = isOperationOnFolder();
        // on folder deletion or multi operation display "please wait" screen, not for simple file deletion
        if ((isMultiOperation() || isFolder) && !DIALOG_WAIT.equals(getParamAction())) {
            // return false, this will trigger the "please wait" screen
            return false;
        }

        // determine the correct delete option
        CmsResourceDeleteMode deleteOption = Boolean.valueOf(getParamDeleteSiblings()).booleanValue()
        ? CmsResource.DELETE_REMOVE_SIBLINGS
        : CmsResource.DELETE_PRESERVE_SIBLINGS;

        Iterator<String> i = getResourceList().iterator();
        // iterate the resources to delete
        while (i.hasNext()) {
            String resName = i.next();
            try {
                performSingleDeleteOperation(resName, deleteOption);
            } 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_DELETE_MULTI_0);

        return true;
    }
681642
protected void checkPermissionsForMassEdit(CmsObject cms) throws CmsException {

        OpenCms.getRoleManager().checkRoleForResource(cms, CmsRole.ADMINISTRATOR, "/");
    }
11554
protected static boolean isFolder(CmsResource resource) throws CmsLoaderException {

        I_CmsResourceType resourceType = OpenCms.getResourceManager().getResourceType(resource.getTypeId());
        return resourceType.isFolder();
    }
256957
protected void performRestoreOperation() throws CmsException {

        CmsUUID structureId = new CmsUUID(getSelectedItem().get(LIST_COLUMN_STRUCTURE_ID).toString());
        int version = Integer.parseInt(getSelectedItems().get(0).getId());
        if (version == CmsHistoryResourceHandler.PROJECT_OFFLINE_VERSION) {
            // it is not possible to restore the offline version
            return;
        }
        CmsResource res = getCms().readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
        checkLock(getCms().getSitePath(res));
        getCms().restoreResourceVersion(res.getStructureId(), version);
    }
1199467
public boolean hasMoreAdminOUs() throws CmsException {

        List<CmsOrganizationalUnit> orgUnits = getOrgUnits();

        if (orgUnits == null) {
            return false;
        }
        if (orgUnits.size() <= 1) {
            return false;
        }
        return true;
    }
58436
public boolean hasCorrectLockstate() {

        org.opencms.lock.CmsLock lock = null;
        try {
            // get the lock state for the current resource
            lock = getCms().getLock(getParamResource());
        } catch (CmsException e) {
            // error getting lock state, log the error and return false
            LOG.error(e.getLocalizedMessage(getLocale()), e);
            return false;
        }
        // check if auto lock feature is enabled
        boolean autoLockFeature = lock.isNullLock() && OpenCms.getWorkplaceManager().autoLockResources();
        return autoLockFeature || lock.isExclusive() || lock.isInherited();
    }
615386
protected function saveLocalizationCommonSettingsAction()
	{
		$localization = $this->getPageLocalization();
		$input = $this->getRequestInput();

		//@TODO: create some simple objects for save post data with future validation implementation?

		$title = trim($input->get('title'));
		if (empty($title)) {
			throw new CmsException(null, 'Title cannot be empty.');
		}

		$localization->setTitle($title);

		$localization->setVisibleInMenu(
				$input->filter('is_visible_in_menu', null, false, FILTER_VALIDATE_BOOLEAN)
		);

		$localization->setVisibleInSitemap(
				$input->filter('is_visible_in_sitemap', null, false, FILTER_VALIDATE_BOOLEAN)
		);

		$localization->setIncludedInSearch(
				$input->filter('include_in_search', null, false, FILTER_VALIDATE_BOOLEAN)
		);

		$localization->setChangeFrequency($input->get('page_change_frequency'));

		$localization->setPagePriority($input->get('page_priority'));
	}
1202004
protected static boolean generateBlockComment(String comment, PyAppendable it) {
		final String cmt = comment == null ? null : comment.trim();
		if (!Strings.isEmpty(cmt)) {
			assert cmt != null;
			for (final String line : cmt.split("[\n\r\f]+")) {  //$NON-NLS-1$
				it.append("# ").append(line).newLine(); //$NON-NLS-1$
			}
			return true;
		}
		return false;
	}
734568
protected boolean performDialogOperation() throws CmsException {

        // display "please wait" screen before renaming the images
        if (!DIALOG_WAIT.equals(getParamAction())) {
            // return false, this will trigger the "please wait" screen
            return false;
        }

        // lock the image gallery folder
        checkLock(getParamResource());

        // get all image resources of the folder
        int imageId = OpenCms.getResourceManager().getResourceType(
            CmsResourceTypeImage.getStaticTypeName()).getTypeId();
        CmsResourceFilter filter = CmsResourceFilter.IGNORE_EXPIRATION.addRequireType(imageId);
        List<CmsResource> images = getCms().readResources(getParamResource(), filter, false);

        // determine start count
        int count = 1;
        try {
            count = Integer.parseInt(getParamStartcount());
        } catch (Exception e) {
            // ignore this exception
        }

        // create number printer instance
        PrintfFormat numberFormat = new PrintfFormat("%0." + getParamPlaces() + "d");

        // create image galler folder name
        String folder = getParamResource();
        if (!folder.endsWith("/")) {
            folder += "/";
        }

        Iterator<CmsResource> i = images.iterator();
        // loop over all image resource to change
        while (i.hasNext()) {
            CmsResource res = i.next();
            String oldName = CmsResource.getName(res.getRootPath());
            CmsProperty titleProperty = getCms().readPropertyObject(res, CmsPropertyDefinition.PROPERTY_TITLE, false);
            String oldTitle = titleProperty.getValue();

            // store image name suffix
            int lastDot = oldName.lastIndexOf('.');
            String suffix = "";
            String oldNameWithoutSuffix = oldName;
            if (lastDot > -1) {
                suffix = oldName.substring(lastDot);
                oldNameWithoutSuffix = oldName.substring(0, lastDot);
            }

            // determine new image name
            String newName = "";
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getParamPrefix()) && !"null".equals(getParamPrefix())) {
                newName += getParamPrefix();
            }
            // create image number
            String imageNumber = numberFormat.sprintf(count);
            newName += imageNumber + suffix;

            if (!newName.equals(oldName)) {
                // only rename resources which have a new resource name
                if (getCms().existsResource(folder + newName, CmsResourceFilter.ALL)) {
                    // target resource exists, interrupt & show error
                    throw new CmsException(
                        Messages.get().container(
                            Messages.ERR_MOVE_FAILED_TARGET_EXISTS_2,
                            getCms().getSitePath(res),
                            folder + newName));
                }

                // determine the new title property value
                if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(oldTitle)) {
                    if (oldTitle.equals(oldNameWithoutSuffix)) {
                        if (Boolean.valueOf(getParamRemovetitle()).booleanValue()) {
                            // remove the title property value
                            if (oldTitle.equals(titleProperty.getStructureValue())) {
                                titleProperty.setStructureValue(CmsProperty.DELETE_VALUE);
                            }
                            if (oldTitle.equals(titleProperty.getResourceValue())) {
                                titleProperty.setResourceValue(CmsProperty.DELETE_VALUE);
                            }
                        } else {
                            // set the title property to the new resource name
                            if (oldTitle.equals(titleProperty.getStructureValue())) {
                                titleProperty.setStructureValue(getParamPrefix() + imageNumber);
                            } else if (oldTitle.equals(titleProperty.getResourceValue())) {
                                titleProperty.setResourceValue(getParamPrefix() + imageNumber);
                            }
                        }
                        // write changed title property
                        getCms().writePropertyObject(getCms().getSitePath(res), titleProperty);
                    }
                }

                // now rename the resource
                getCms().renameResource(folder + oldName, folder + newName);
            }

            // increase image counter
            count++;
        }

        return true;
    }
245713
protected void performSingleDeleteOperation(String resource, CmsResourceDeleteMode deleteOption)
    throws CmsException {

        // lock resource if autolock is enabled
        checkLock(resource);
        // delete the resource
        getCms().deleteResource(resource, deleteOption);
    }
1005778
private boolean comment( FormattableContainer container ) {
        char ch = read();
        switch( ch ) {
//            case '/': // line comments will be skip
//                reader.skipLine();
//                return true;
            case '*': // block comments
                StringBuilder builder = new StringBuilder();
                builder.append( "/*" );
                boolean wasAsterix = false;
                for( ;; ) {
                    ch = read();
                    builder.append( ch );
                    switch( ch ) {
                        case '*':
                            wasAsterix = true;
                            break;
                        case '/':
                            if( wasAsterix ) {
                                if( container != null ) {
                                    container.add( new Comment( trim( builder ) ) );
                                }
                                return true;
                            }
                            //$FALL-THROUGH$
                        default:
                            wasAsterix = false;
                    }
                }
            default:
                back( ch );
                return false;
        }
    }
839653
public void save() {

        CmsRpcAction<CmsAliasEditValidationReply> action = new CmsRpcAction<CmsAliasEditValidationReply>() {

            @Override
            public void execute() {

                start(200, false);

                CmsAliasSaveValidationRequest saveRequest = new CmsAliasSaveValidationRequest();
                saveRequest.setSiteRoot(m_siteRoot);
                List<CmsAliasTableRow> rows = m_view.getLiveData();
                saveRequest.setEditedData(rows);
                saveRequest.setRewriteData(m_view.getRewriteData());
                saveRequest.getDeletedIds().addAll(m_deletedIds);
                saveRequest.setOriginalData(m_initialData);
                getService().saveAliases(saveRequest, this);
            }

            @Override
            public void onResponse(CmsAliasEditValidationReply result) {

                stop(false);
                if (result == null) {
                    m_view.close();
                } else if (result.hasErrors()) {
                    m_view.update(result.getChangedRows());
                }
            }
        };
        action.execute();
    }
226568
protected void performSingleResourceOperation(String resourceName, int dialogAction) throws CmsException {

        // store original name to use for lock action
        String originalResourceName = resourceName;
        CmsResource res = getCms().readResource(resourceName, CmsResourceFilter.ALL);
        if (res.isFolder() && !resourceName.endsWith("/")) {
            resourceName += "/";
        }
        org.opencms.lock.CmsLock lock = getCms().getLock(res);
        // perform action depending on dialog uri
        switch (dialogAction) {
            case TYPE_LOCKCHANGE:
            case TYPE_LOCK:
                if (lock.isNullLock()) {
                    getCms().lockResource(originalResourceName);
                } else if (!lock.isDirectlyOwnedInProjectBy(getCms())) {
                    getCms().changeLock(resourceName);
                }
                break;
            case TYPE_UNLOCK:
            default:
                if (lock.isNullLock()) {
                    break;
                }
                if (lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) {
                    getCms().unlockResource(resourceName);
                }
        }
    }
844228
@Override
    protected boolean performDialogOperation() throws CmsException {

        // on folder touch or multi resource operation display "please wait" screen, not for simple file copy
        if (!DIALOG_WAIT.equals(getParamAction())) {
            // check if the "please wait" screen has to be shown
            if (isMultiOperation()) {
                // show please wait for every multi resource operation
                return false;
            } else {
                // check if the single resource is a folder
                CmsResource sourceRes = getCms().readResource(getParamResource(), CmsResourceFilter.ALL);
                if (sourceRes.isFolder()) {
                    return false;
                }
            }
        }

        // get the new timestamp for the resource(s) from request parameter
        long timeStamp = 0;
        boolean correctDate = false;
        try {
            if (CmsStringUtil.isNotEmpty(getParamNewtimestamp())) {
                timeStamp = CmsCalendarWidget.getCalendarDate(getMessages(), getParamNewtimestamp(), true);
                correctDate = true;
            }
        } catch (ParseException e) {
            throw new CmsException(Messages.get().container(Messages.ERR_PARSE_TIMESTAMP_1, getParamNewtimestamp()), e);
        }

        // get the flag if the touch is recursive from request parameter
        boolean touchRecursive = Boolean.valueOf(getParamRecursive()).booleanValue();
        // get the flag to the touch the content from request parameter
        boolean touchContent = Boolean.valueOf(getParamContent()).booleanValue();

        // now touch the resource(s)
        Iterator<String> i = getResourceList().iterator();
        while (i.hasNext()) {
            String resName = i.next();
            try {
                // lock resource if autolock is enabled
                checkLock(resName);
                touchSingleResource(getCms(), resName, timeStamp, touchRecursive, correctDate, touchContent);
            } catch (CmsException e) {
                // collect exceptions to create a detailed output
                addMultiOperationException(e);
            }
        }
        checkMultiOperationException(Messages.get(), Messages.ERR_TOUCH_MULTI_0);

        return true;
    }
1322633
private void initHasMasterMode() throws CmsException {

        if (hasDescriptor()
            && m_cms.hasPermissions(m_desc, CmsPermissionSet.ACCESS_WRITE, false, CmsResourceFilter.ALL)) {
            m_hasMasterMode = true;
        } else {
            m_hasMasterMode = false;
        }
    }