public async Task <string> GetAncestorPathAsync(string Path, int Levels, bool LevelIsRelative = true, int MinAbsoluteLevel = 2)
        {
            string[] PathParts = TreePathUtils.EnsureSingleNodePath(Path).Split("/".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            if (LevelIsRelative)
            {
                // Handle minimum absolute level
                if ((PathParts.Length - Levels + 1) < MinAbsoluteLevel)
                {
                    Levels -= MinAbsoluteLevel - (PathParts.Length - Levels + 1);
                }
                return(TreePathUtils.GetParentPath(TreePathUtils.EnsureSingleNodePath(Path), Levels));
            }

            // Since first 'item' in path is actually level 2, reduce level by 1 to match counts
            Levels--;
            if (PathParts.Count() > Levels)
            {
                return("/" + string.Join("/", PathParts.Take(Levels)));
            }
            else
            {
                return(TreePathUtils.EnsureSingleNodePath(Path));
            }
        }
Esempio n. 2
0
    protected void form_OnBeforeValidate(object sender, EventArgs e)
    {
        // Get single node path
        string path = TreePathUtils.EnsureSingleNodePath(form.FieldControls["ScopePath"].Value.ToString());

        // Ensure slash at the beginning
        if (!string.IsNullOrEmpty(path) && !path.StartsWithCSafe("/"))
        {
            path = "/" + path;
        }

        form.FieldControls["ScopePath"].Value = path;
    }
        public async Task <IEnumerable <NavigationItem> > GetSecondaryNavItemsAsync(string StartingPath, PathSelectionEnum PathType = PathSelectionEnum.ChildrenOnly, string[] PageTypes = null, string OrderBy = null, string WhereCondition = null, int MaxLevel = -1, int TopNumber = -1)
        {
            List <HierarchyTreeNode> HierarchyNodes = new List <HierarchyTreeNode>();

            Dictionary <int, HierarchyTreeNode> NodeIDToHierarchyTreeNode = new Dictionary <int, HierarchyTreeNode>();
            List <TreeNode>        NewNodeList = new List <TreeNode>();
            IEnumerable <TreeNode> Nodes       = _GeneralDocumentRepo.GetDocumentsByPath(
                TreePathUtils.EnsureSingleNodePath(StartingPath),
                PathType,
                OrderBy,
                WhereCondition,
                MaxLevel,
                TopNumber,
                new string[] { nameof(TreeNode.DocumentName), nameof(TreeNode.ClassName), nameof(TreeNode.DocumentCulture), nameof(TreeNode.NodeID), nameof(TreeNode.DocumentID), nameof(TreeNode.DocumentGUID), nameof(TreeNode.NodeParentID), nameof(TreeNode.NodeLevel), nameof(TreeNode.NodeGUID), nameof(TreeNode.NodeAliasPath) },
                PageTypes
                )
                                                 .Select(x => (TreeNode)x);

            // populate ParentNodeIDToTreeNode
            foreach (TreeNode Node in Nodes)
            {
                NodeIDToHierarchyTreeNode.Add(Node.NodeID, new HierarchyTreeNode(Node));
                NewNodeList.Add(Node);
            }

            // Populate the Children of the TypedResults
            foreach (TreeNode Node in NewNodeList)
            {
                // If no parent exists, add to top level
                if (!NodeIDToHierarchyTreeNode.ContainsKey(Node.NodeParentID))
                {
                    HierarchyNodes.Add(NodeIDToHierarchyTreeNode[Node.NodeID]);
                }
                else
                {
                    // Otherwise, add to the parent element.
                    NodeIDToHierarchyTreeNode[Node.NodeParentID].Children.Add(NodeIDToHierarchyTreeNode[Node.NodeID]);
                }
            }

            // Convert to Model
            List <NavigationItem> Items = new List <NavigationItem>();

            foreach (var HierarchyNavTreeNode in HierarchyNodes)
            {
                // Call the check to set the Ancestor is current
                Items.Add(_helper.GetTreeNodeToNavigationItem(HierarchyNavTreeNode));
            }
            return(Items);
        }
Esempio n. 4
0
    /// <summary>
    /// Initialize inner controls
    /// </summary>
    /// <param name="path">Node alias path</param>
    private void InitializeInnerControls(string path)
    {
        // Ensure single node path
        pathElem.Value = TreePathUtils.EnsureSingleNodePath(path);

        // Only child documents
        if (path.EndsWithCSafe("/%"))
        {
            rbChildren.Checked = true;
        }
        else
        {
            LoadOtherValues();
        }
    }
Esempio n. 5
0
    /// <summary>
    /// Formats path
    /// </summary>
    /// <param name="path">Node alias path</param>
    private string FormatPath(string path)
    {
        // Get single node path
        path = TreePathUtils.EnsureSingleNodePath(path);

        // Ensure slash at the beginning
        if (!string.IsNullOrEmpty(path) && !path.StartsWithCSafe("/"))
        {
            path = "/" + path;
        }

        // Include children if set
        if (rbChildren.Checked)
        {
            path = ((path != null) ? path.TrimEnd('/') : "") + "/%";
        }

        return(path);
    }
 /// <summary>
 /// Initializes control properties.
 /// </summary>
 protected void SetupControl()
 {
     if (StopProcessing)
     {
         // Do nothing
     }
     else
     {
         if (string.IsNullOrEmpty(Path))
         {
             Path = DocumentContext.CurrentAliasPath;
         }
         Path                          = TreePathUtils.EnsureSingleNodePath(Path);
         srcAttach.Path                = Path;
         srcAttach.OrderBy             = OrderBy;
         srcAttach.TopN                = SelectTopN;
         srcAttach.WhereCondition      = WhereCondition;
         srcAttach.SelectedColumns     = Columns;
         srcAttach.FilterName          = ValidationHelper.GetString(GetValue("WebPartControlID"), ID);
         srcAttach.SourceFilterName    = FilterName;
         srcAttach.GetBinary           = false;
         srcAttach.AttachmentGroupGUID = AttachmentGroupGUID;
         if (string.IsNullOrEmpty(CultureCode))
         {
             srcAttach.CultureCode = DocumentContext.CurrentDocumentCulture.CultureCode;
         }
         else
         {
             srcAttach.CultureCode = CultureCode;
         }
         srcAttach.CombineWithDefaultCulture = CombineWithDefaultCulture;
         srcAttach.CheckPermissions          = CheckPermissions;
         srcAttach.CacheItemName             = CacheItemName;
         srcAttach.CacheMinutes          = CacheMinutes;
         srcAttach.CacheDependencies     = CacheDependencies;
         srcAttach.LoadPagesIndividually = LoadPagesIndividually;
     }
 }
Esempio n. 7
0
    /// <summary>
    /// Initialize inner controls
    /// </summary>
    /// <param name="path">Node alias path</param>
    private void InitializeInnerControls(string path)
    {
        // Ensure single node path
        pathElem.Value = TreePathUtils.EnsureSingleNodePath(path);

        // Only child documents
        if (path.EndsWithCSafe("/%"))
        {
            rbChildren.Checked = true;
        }
        else
        {
            // Only document
            if (ValidationHelper.GetBoolean(Form.Data["ScopeExcludeChildren"], false))
            {
                rbDoc.Checked = true;
            }
            // Document including children
            else
            {
                rbDocAndChildren.Checked = true;
            }
        }
    }
    /// <summary>
    /// OnExternalDataBound event handler
    /// </summary>
    protected object OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        switch (sourceName.ToLowerCSafe())
        {
        case "aliaspath":
            return(TreePathUtils.EnsureSingleNodePath((string)parameter));

        case "classdisplayname":
            string docType = ValidationHelper.GetString(parameter, "");
            if (docType == "")
            {
                return(Control.GetString("general.selectall"));
            }
            return(HTMLHelper.HTMLEncode(docType));

        case "scopecultureid":
            int cultureId = ValidationHelper.GetInteger(parameter, 0);
            if (cultureId > 0)
            {
                return(CultureInfoProvider.GetCultureInfo(cultureId).CultureName);
            }
            else
            {
                return(Control.GetString("general.selectall"));
            }

        case "scopeexcluded":
        {
            bool allowed = !ValidationHelper.GetBoolean(parameter, false);
            return(UniGridFunctions.ColoredSpanAllowedExcluded(allowed));
        }

        case "coverage":
        {
            DataRowView drv      = (DataRowView)parameter;
            string      alias    = ValidationHelper.GetString(drv.Row["ScopeStartingPath"], "");
            bool        children = !ValidationHelper.GetBoolean(drv.Row["ScopeExcludeChildren"], false);

            // Only child documents
            if (alias.EndsWithCSafe("/%"))
            {
                return(Control.GetString("workflowscope.children"));
            }
            else
            {
                // Only document
                if (!children)
                {
                    return(Control.GetString("workflowscope.doc"));
                }
                // Document including children
                else
                {
                    return(Control.GetString("workflowscope.docandchildren"));
                }
            }
        }

        default:
            return(parameter);
        }
    }
    /// <summary>
    /// Initializes control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
            ucAttachments.StopProcessing = true;
        }
        else
        {
            ucAttachments.GetBinary = false;

            // Basic control properties
            ucAttachments.HideControlForZeroRows = HideControlForZeroRows;
            ucAttachments.ZeroRowsText           = ZeroRowsText;

            // Data source properties
            ucAttachments.WhereCondition            = WhereCondition;
            ucAttachments.OrderBy                   = OrderBy;
            ucAttachments.FilterName                = FilterName;
            ucAttachments.CacheItemName             = CacheItemName;
            ucAttachments.CacheDependencies         = CacheDependencies;
            ucAttachments.CacheMinutes              = CacheMinutes;
            ucAttachments.AttachmentGroupGUID       = AttachmentGroupGUID;
            ucAttachments.CheckPermissions          = CheckPermissions;
            ucAttachments.CombineWithDefaultCulture = CombineWithDefaultCulture;
            if (string.IsNullOrEmpty(CultureCode))
            {
                ucAttachments.CultureCode = DocumentContext.CurrentDocumentCulture.CultureCode;
            }
            else
            {
                ucAttachments.CultureCode = CultureCode;
            }

            ucAttachments.Path     = TreePathUtils.EnsureSingleNodePath(MacroResolver.ResolveCurrentPath(Path));
            ucAttachments.SiteName = SiteName;
            ucAttachments.TopN     = TopN;


            #region "Repeater template properties"

            // Apply transformations if they exist
            ucAttachments.TransformationName = TransformationName;
            ucAttachments.AlternatingItemTransformationName = AlternatingItemTransformationName;
            ucAttachments.FooterTransformationName          = FooterTransformationName;
            ucAttachments.HeaderTransformationName          = HeaderTransformationName;
            ucAttachments.SeparatorTransformationName       = SeparatorTransformationName;

            #endregion


            // UniPager properties
            ucAttachments.PageSize       = PageSize;
            ucAttachments.GroupSize      = GroupSize;
            ucAttachments.QueryStringKey = QueryStringKey;
            ucAttachments.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
            ucAttachments.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
            ucAttachments.HidePagerForSinglePage           = HidePagerForSinglePage;
            switch (PagingMode.ToLowerCSafe())
            {
            case "postback":
                ucAttachments.PagingMode = UniPagerMode.PostBack;
                break;

            default:
                ucAttachments.PagingMode = UniPagerMode.Querystring;
                break;
            }


            #region "UniPager template properties"

            // UniPager template properties
            ucAttachments.PagesTemplate         = PagesTemplate;
            ucAttachments.CurrentPageTemplate   = CurrentPageTemplate;
            ucAttachments.SeparatorTemplate     = SeparatorTemplate;
            ucAttachments.FirstPageTemplate     = FirstPageTemplate;
            ucAttachments.LastPageTemplate      = LastPageTemplate;
            ucAttachments.PreviousPageTemplate  = PreviousPageTemplate;
            ucAttachments.NextPageTemplate      = NextPageTemplate;
            ucAttachments.PreviousGroupTemplate = PreviousGroupTemplate;
            ucAttachments.NextGroupTemplate     = NextGroupTemplate;
            ucAttachments.LayoutTemplate        = LayoutTemplate;

            #endregion
        }
    }
    /// <summary>
    /// Initializes control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            // Do nothing
            ucDataSource.StopProcessing = true;
        }
        else
        {
            ucRepeater.DataBindByDefault = false;
            ucPager.PageControl          = ucRepeater.ID;

            ucDataSource.GetBinary = false;

            // Basic control properties
            ucRepeater.HideControlForZeroRows = HideControlForZeroRows;
            ucRepeater.ZeroRowsText           = ZeroRowsText;

            // Data source properties
            ucDataSource.WhereCondition            = WhereCondition;
            ucDataSource.OrderBy                   = OrderBy;
            ucDataSource.FilterName                = FilterName;
            ucDataSource.CacheItemName             = CacheItemName;
            ucDataSource.CacheDependencies         = CacheDependencies;
            ucDataSource.CacheMinutes              = CacheMinutes;
            ucDataSource.AttachmentGroupGUID       = AttachmentGroupGUID;
            ucDataSource.CheckPermissions          = CheckPermissions;
            ucDataSource.CombineWithDefaultCulture = CombineWithDefaultCulture;

            if (string.IsNullOrEmpty(CultureCode))
            {
                ucDataSource.CultureCode = DocumentContext.CurrentDocumentCulture.CultureCode;
            }
            else
            {
                ucDataSource.CultureCode = CultureCode;
            }

            ucDataSource.Path     = TreePathUtils.EnsureSingleNodePath(MacroResolver.ResolveCurrentPath(Path));
            ucDataSource.SiteName = SiteName;
            ucDataSource.TopN     = TopN;

            // UniPager properties
            ucPager.PageSize       = PageSize;
            ucPager.GroupSize      = GroupSize;
            ucPager.QueryStringKey = QueryStringKey;
            ucPager.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
            ucPager.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
            ucPager.HidePagerForSinglePage           = HidePagerForSinglePage;

            switch (PagingMode.ToLowerCSafe())
            {
            case "postback":
                ucPager.PagerMode = UniPagerMode.PostBack;
                break;

            default:
                ucPager.PagerMode = UniPagerMode.Querystring;
                break;
            }

            // Effect properties
            ucRepeater.ItemHTMLBefore        = ItemHTMLBefore;
            ucRepeater.ItemHTMLAfter         = ItemHTMLAfter;
            ucRepeater.ItemHTMLSeparator     = ItemHTMLSeparator;
            ucRepeater.HideLayoutForZeroRows = HideLayoutForZeroRows;
            ucRepeater.ScriptFiles           = ScriptFiles;
            ucRepeater.InitScript            = InitScript;
            ucRepeater.CSSFiles  = CSSFiles;
            ucRepeater.InlineCSS = InlineCSS;

            // Setup repeater and pager templates
            SetupTemplates();
        }
    }
Esempio n. 11
0
    /// <summary>
    /// Initializes the control properties.
    /// </summary>
    protected void SetupControl()
    {
        if (StopProcessing)
        {
            galleryElem.StopProcessing = true;
        }
        else
        {
            galleryElem.ControlContext = ControlContext;

            // Basic control properties
            galleryElem.HideControlForZeroRows = HideControlForZeroRows;
            galleryElem.ZeroRowsText           = ZeroRowsText;

            // Data source properties
            galleryElem.CombineWithDefaultCulture = CombineWithDefaultCulture;
            galleryElem.CultureCode = CultureCode;
            galleryElem.OrderBy     = OrderBy;
            galleryElem.TopN        = TopN;
            if (string.IsNullOrEmpty(Path))
            {
                Path = DocumentContext.CurrentAliasPath;
            }
            Path                            = TreePathUtils.EnsureSingleNodePath(Path);
            galleryElem.Path                = Path;
            galleryElem.SiteName            = SiteName;
            galleryElem.WhereCondition      = WhereCondition;
            galleryElem.AttachmentGroupGUID = AttachmentGroupGUID;
            galleryElem.FilterName          = FilterName;

            // System properties
            galleryElem.CacheItemName     = CacheItemName;
            galleryElem.CacheDependencies = CacheDependencies;
            galleryElem.CacheMinutes      = CacheMinutes;
            galleryElem.CheckPermissions  = CheckPermissions;
            if (ParentZone != null)
            {
                galleryElem.CheckCollision = ParentZone.RequiresWebPartManagement();
            }
            else
            {
                galleryElem.CheckCollision = PortalContext.IsDesignMode(PortalContext.ViewMode);
            }

            // UniPager properties
            galleryElem.PageSize       = PageSize;
            galleryElem.GroupSize      = GroupSize;
            galleryElem.QueryStringKey = QueryStringKey;
            galleryElem.DisplayFirstLastAutomatically    = DisplayFirstLastAutomatically;
            galleryElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
            galleryElem.HidePagerForSinglePage           = HidePagerForSinglePage;

            switch (PagingMode.ToLowerCSafe())
            {
            case "postback":
                galleryElem.PagingMode = UniPagerMode.PostBack;
                break;

            default:
                galleryElem.PagingMode = UniPagerMode.Querystring;
                break;
            }


            #region "UniPager template properties"

            // UniPager template properties
            galleryElem.PagesTemplate         = PagesTemplate;
            galleryElem.CurrentPageTemplate   = CurrentPageTemplate;
            galleryElem.SeparatorTemplate     = SeparatorTemplate;
            galleryElem.FirstPageTemplate     = FirstPageTemplate;
            galleryElem.LastPageTemplate      = LastPageTemplate;
            galleryElem.PreviousPageTemplate  = PreviousPageTemplate;
            galleryElem.NextPageTemplate      = NextPageTemplate;
            galleryElem.PreviousGroupTemplate = PreviousGroupTemplate;
            galleryElem.NextGroupTemplate     = NextGroupTemplate;
            galleryElem.LayoutTemplate        = LayoutTemplate;

            #endregion


            #region "Lightbox properties"

            galleryElem.LightBoxLoadDelay           = LightBoxLoadDelay;
            galleryElem.LightBoxPermanentNavigation = LightBoxPermanentNavigation;
            galleryElem.LightBoxNextImg             = LightBoxNextImg;
            galleryElem.LightBoxPrevImg             = LightBoxPrevImg;
            galleryElem.LightBoxCloseImg            = LightBoxCloseImg;
            galleryElem.LightBoxLoadingImg          = LightBoxLoadingImg;
            galleryElem.LightBoxBorderSize          = LightBoxBorderSize;
            galleryElem.LightBoxResizeSpeed         = LightBoxResizeSpeed;
            galleryElem.LightBoxHeight             = LightBoxHeight;
            galleryElem.LightBoxWidth              = LightBoxWidth;
            galleryElem.LightBoxAnimate            = LightBoxAnimate;
            galleryElem.LightBoxOverlayOpacity     = LightBoxOverlayOpacity;
            galleryElem.LightBoxExternalScriptPath = LightBoxExternalScriptPath;
            galleryElem.LightBoxGroup              = LightBoxGroup;

            #endregion


            // Transformation properties
            galleryElem.TransformationName             = TransformationName;
            galleryElem.AlternatingTransformationName  = AlternatingTransformationName;
            galleryElem.SelectedItemTransformationName = SelectedItemTransformationName;
            galleryElem.FooterTransformationName       = FooterTransformationName;
            galleryElem.HeaderTransformationName       = HeaderTransformationName;
            galleryElem.SeparatorTransformationName    = SeparatorTransformationName;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        pnlGeneral.GroupingText  = GetString("general.general");
        pnlAdvanced.GroupingText = GetString("general.advanced");

        // Set selector mode
        selectClassNames.UniSelector.SelectionMode = SelectionModeEnum.SingleDropDownList;
        selectClassNames.UniSelector.AllowAll      = true;

        string condition         = string.Empty;
        string startingAliasPath = string.Empty;
        bool   excludeChildren   = false;
        bool   exclude           = false;
        int    classId           = 0;
        int    cultureId         = 0;


        if (WorkflowScopeId > 0)
        {
            if (CurrentScopeInfo != null)
            {
                workflowId        = CurrentScopeInfo.ScopeWorkflowID;
                siteId            = CurrentScopeInfo.ScopeSiteID;
                startingAliasPath = CurrentScopeInfo.ScopeStartingPath;
                classId           = CurrentScopeInfo.ScopeClassID;
                cultureId         = CurrentScopeInfo.ScopeCultureID;
                excludeChildren   = CurrentScopeInfo.ScopeExcludeChildren;
                exclude           = CurrentScopeInfo.ScopeExcluded;
                condition         = CurrentScopeInfo.ScopeMacroCondition;
            }
        }
        else
        {
            workflowId = QueryHelper.GetInteger("workflowid", 0);
            siteId     = QueryHelper.GetInteger("siteid", 0);
        }

        // Check languages on site
        SiteInfo si = SiteInfoProvider.GetSiteInfo(siteId);

        if (si != null)
        {
            // Check whether workflow is enabled for specified site
            LicenseHelper.CheckFeatureAndRedirect(URLHelper.GetDomainName(si.DomainName), FeatureEnum.WorkflowVersioning);

            if (!CultureInfoProvider.LicenseVersionCheck(si.DomainName, FeatureEnum.Multilingual, VersionActionEnum.Edit))
            {
                ShowError(GetString("licenselimitation.siteculturesexceeded"));
                pnlForm.Enabled = false;
            }
            // Set selector's where condition
            selectClassNames.UniSelector.WhereCondition = "ClassID IN (SELECT ClassID FROM CMS_ClassSite WHERE SiteID=" + si.SiteID + ") AND ClassIsDocumentType = 1";
        }

        // Culture selector
        cultureSelector.UseCultureCode = false;
        cultureSelector.SpecialFields  = new string[, ] {
            { GetString("general.selectall"), "0" }
        };
        cultureSelector.SiteID = siteId;

        // Initialize condition resolver
        cbCondition.ResolverName      = "WorkflowBaseDocumentResolver";
        cbCondition.RuleCategoryNames = WorkflowObjectType.WORKFLOW;

        pathElem.SiteID = siteId;

        // Scripts for path selector
        if (!RequestHelper.IsPostBack())
        {
            cbCondition.Text = condition;
            pathElem.Value   = TreePathUtils.EnsureSingleNodePath(startingAliasPath);

            string className = DataClassInfoProvider.GetClassName(classId);
            if (!string.IsNullOrEmpty(className))
            {
                selectClassNames.Value = className;
            }

            // Show that the scope was created updated successfully
            if (QueryHelper.GetString("saved", string.Empty) == "1")
            {
                ShowChangesSaved();
            }

            cultureSelector.Value = cultureId;
            rbAllowed.Checked     = !exclude;
            rbExcluded.Checked    = exclude;

            // Only child documents
            if (startingAliasPath.EndsWithCSafe("/%"))
            {
                rbChildren.Checked = true;
            }
            else
            {
                // Only document
                if (excludeChildren)
                {
                    rbDoc.Checked = true;
                }
                // Document including children
                else
                {
                    rbDocAndChildren.Checked = true;
                }
            }
        }

        string workflowScopes    = GetString("Development-Workflow_Scope_New.Scopes");
        string workflowScopesUrl = "~/CMSModules/Workflows/Workflow_Scopes.aspx?workflowid=" + workflowId + "&siteid=" + siteId;
        string currentScope      = "";

        if (WorkflowScopeId > 0)
        {
            currentScope = GetString("Development-Workflow_Scope_New.ScopeID") + WorkflowScopeId;
        }
        else
        {
            currentScope = GetString("Development-Workflow_Scope_New.Scope");
        }

        // Initialize page title
        InitializeMasterPage(workflowScopes, workflowScopesUrl, currentScope);

        // Hide culture selector due to license restrictions
        plcCulture.Visible = LicenseHelper.CheckFeature(URLHelper.GetCurrentDomain(), FeatureEnum.Multilingual);
    }
    /// <summary>
    /// Saves data of edited workflow scope from TextBoxes into DB.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        string path = pathElem.Value.ToString().Trim();

        // Find whether required fields are not empty
        string result = new Validator().NotEmpty(path, GetString("Development-Workflow_Scope_Edit.RequiresStartingAliasPath")).Result;

        // Prepare path for further validation
        if (result == string.Empty)
        {
            // Ensure slash at the beginning
            if (!path.StartsWithCSafe("/"))
            {
                path = "/" + path;
            }

            string className = ValidationHelper.GetString(selectClassNames.Value, ALL_DOCTYPES);
            int    classId   = 0;
            if (className != ALL_DOCTYPES)
            {
                // Get class ID
                DataClassInfo dci = DataClassInfoProvider.GetDataClass(className);
                classId = dci.ClassID;
            }

            if (WorkflowScopeId > 0)
            {
                if (CurrentScopeInfo != null)
                {
                    if (rbChildren.Checked)
                    {
                        CurrentScopeInfo.ScopeStartingPath    = TreePathUtils.EnsureSingleNodePath(path).TrimEnd('/') + "/%";
                        CurrentScopeInfo.ScopeExcludeChildren = false;
                    }
                    else
                    {
                        CurrentScopeInfo.ScopeStartingPath    = TreePathUtils.EnsureSingleNodePath(path);
                        CurrentScopeInfo.ScopeExcludeChildren = rbDoc.Checked;
                    }
                    CurrentScopeInfo.ScopeClassID        = classId;
                    CurrentScopeInfo.ScopeID             = WorkflowScopeId;
                    CurrentScopeInfo.ScopeExcluded       = rbExcluded.Checked;
                    CurrentScopeInfo.ScopeMacroCondition = cbCondition.Text;
                    CurrentScopeInfo.ScopeCultureID      = ValidationHelper.GetInteger(cultureSelector.Value, 0);
                    WorkflowScopeInfoProvider.SetWorkflowScopeInfo(CurrentScopeInfo);
                    ShowChangesSaved();
                }
            }
            else
            {
                if (workflowId > 0)
                {
                    if (siteId > 0)
                    {
                        WorkflowScopeInfo wsi = new WorkflowScopeInfo();
                        if (rbChildren.Checked)
                        {
                            wsi.ScopeStartingPath    = TreePathUtils.EnsureSingleNodePath(path).TrimEnd('/') + "/%";
                            wsi.ScopeExcludeChildren = false;
                        }
                        else
                        {
                            wsi.ScopeStartingPath    = TreePathUtils.EnsureSingleNodePath(path);
                            wsi.ScopeExcludeChildren = rbDoc.Checked;
                        }
                        wsi.ScopeClassID        = classId;
                        wsi.ScopeCultureID      = ValidationHelper.GetInteger(cultureSelector.Value, 0);
                        wsi.ScopeExcluded       = rbExcluded.Checked;
                        wsi.ScopeMacroCondition = cbCondition.Text;
                        wsi.ScopeSiteID         = siteId;
                        wsi.ScopeWorkflowID     = workflowId;

                        WorkflowScopeInfoProvider.SetWorkflowScopeInfo(wsi);
                        URLHelper.Redirect("Workflow_Scope_Edit.aspx?scopeid=" + wsi.ScopeID + "&saved=1");
                    }
                    else
                    {
                        ShowError(GetString("Development-Workflow_Scope_Edit.NoSiteIdGiven"));
                    }
                }
                else
                {
                    ShowError(GetString("Development-Workflow_Scope_Edit.NoDocumentTypeGiven"));
                }
            }

            pathElem.Value = path;
        }
        else
        {
            ShowError(result);
        }
    }