コード例 #1
0
ファイル: WSTreeView.cs プロジェクト: sherryswall/busiblocks
    public void DeleteCategory(string Id)
    {
        // Need to figure out if this is a comms block category or a doco block category.
        if (!string.IsNullOrEmpty(Id))
        {
            BusiBlocks.CommsBlock.News.Category news = null;

            try
            {
                news = NewsManager.GetCategory(Id);
            }
            catch (NewsCategoryNotFoundException) { }
            if (news != null)
            {
                NewsManager.DeleteCategory(news);
            }
            else
            {
                BusiBlocks.DocoBlock.Category doco = null;

                try
                {
                    doco = DocoManager.GetCategory(Id);
                }
                catch (DocoCategoryNotFoundException) { }
                if (doco != null)
                {
                    DocoManager.DeleteCategory(doco);
                }
            }
        }
    }
コード例 #2
0
    /// <summary>
    ///
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="nodeType"></param>
    /// <param name="isAdmin"></param>
    /// <param name="showNodeItems"></param>
    /// <param name="userAdminList"></param>
    protected void AddParentNode <T>(T nodeType, bool isAdmin, bool showNodeItems, IList <T> userAdminList, string personId)
    {
        var    tempNodeType = typeof(T);
        string nodeText     = "";
        string nodeID;
        var    t = nodeType;

        List <T> temp = new List <T>();

        // todo the following code is dodgey. The check for a parent needs to be handled better.
        switch (tempNodeType.Name)
        {
        case "Category":
            if (tempNodeType.FullName.Contains("News"))
            {
                if ((nodeType as BusiBlocks.CommsBlock.News.Category).ParentCategory == null)
                {
                    return;
                }
                nodeText = (nodeType as BusiBlocks.CommsBlock.News.Category).ParentCategory.Name;
                BusiBlocks.CommsBlock.News.Category x = NewsManager.GetCategoryByName(nodeText, true);
                t = (T)Convert.ChangeType(x, typeof(T));
            }
            else if (tempNodeType.FullName.Contains("Doco"))
            {
                if ((nodeType as BusiBlocks.DocoBlock.Category).ParentCategory == null)
                {
                    return;
                }
                nodeText = (nodeType as BusiBlocks.DocoBlock.Category).ParentCategory.DisplayName;
                nodeID   = (nodeType as BusiBlocks.DocoBlock.Category).ParentCategory.Id;
                BusiBlocks.DocoBlock.Category x = DocoManager.GetCategory(nodeID);
                t = (T)Convert.ChangeType(x, typeof(T));
            }
            break;

        case "Region":
            nodeText = (nodeType as Region).ParentRegion.Name;
            break;

        default:
            break;
        }

        if (RadTreeView1.FindNodeByText(nodeText) != null)
        {
            AddSubNode(nodeType, isAdmin, showNodeItems, userAdminList, personId);
        }
        else
        {
            //Add the parent node that does not have a parent node to a list.
            temp.Add(nodeType);
            AddParentNode(t, isAdmin, showNodeItems, userAdminList, personId);

            foreach (T item in temp)
            {
                AddSubNode(item, isAdmin, showNodeItems, userAdminList, personId);
            }
        }
    }
コード例 #3
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        try
        {
            string id = Request["id"];

            Category         category;
            IList <Category> categories = GetAllViewableCategories();

            //Edit
            if (id != null)
            {
                category             = DocoManager.GetCategory(id);
                category.DisplayName = txtDisplayName.Text;
            }
            else //New
            {
                category = DocoManager.CreateCategory(txtDisplayName.Text);
            }

            Category parentCategory = categories[cmbParentCategory.SelectedIndex];
            // The parent category can be assiged as the same category, do not allow this.
            // Also do not allow the root category (with parent null) to be changed.
            if (!parentCategory.Id.Equals(category.Id) && category.ParentCategory != null)
            {
                category.ParentCategory = categories[cmbParentCategory.SelectedIndex];
            }
            category.Description = txtDescription.Text;
            DocoManager.UpdateCategory(category);
            IList <Access> currentAccess = AccessManager.GetItemAccess(category.Id);

            foreach (Access access in currentAccess)
            {
                AccessManager.RemoveAccess(access.Id);
            }

            foreach (Access a in AccessControl1.AccessList)
            {
                a.Id       = null;
                a.ItemId   = category.Id;
                a.ItemType = ItemType.DocoCategory;
                AccessManager.AddAccess(a);
            }

            ((IFeedback)this.Page.Master).QueueFeedback(
                BusiBlocksConstants.Blocks.Documents.LongName,
                "Category",
                Feedback.Actions.Saved,
                category.DisplayName
                );

            Navigation.Admin_ManageDoco().Redirect(this);
        }
        catch (Exception ex)
        {
            throw ex;
            ((IFeedback)Master).SetException(GetType(), ex);
        }
    }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            string id = Request["id"];
            string parentCategoryId = Request["parentCategory"];

            // Find all the categories which this user has permission to view.
            IList <Category> viewableCategories = GetAllViewableCategories();
            cmbParentCategory.DataSource    = viewableCategories;
            cmbParentCategory.DataTextField = "Breadcrumb";
            cmbParentCategory.DataBind();

            //Edit
            if (id != null)
            {
                Category category = DocoManager.GetCategory(id);

                if (category.ParentCategory == null)
                {
                    cmbParentCategory.SelectedIndex = -1;
                }
                else
                {
                    IEnumerable <int> index =
                        from x in viewableCategories
                        where x.Id.Equals(category.ParentCategory.Id)
                        select viewableCategories.IndexOf(x);

                    if (index.Any())
                    {
                        cmbParentCategory.SelectedIndex = index.First();
                    }
                }

                txtDisplayName.Text       = category.DisplayName;
                AccessControl1.CategoryId = category.Id;
                txtDescription.Text       = category.Description;
            }
            else //New
            {
                if (!string.IsNullOrEmpty(parentCategoryId))
                {
                    // Populate the parent category combo with this category.

                    IEnumerable <int> index =
                        from x in viewableCategories
                        where x.Id.Equals(parentCategoryId)
                        select viewableCategories.IndexOf(x);

                    if (index.Any())
                    {
                        cmbParentCategory.SelectedIndex = index.First();
                    }
                }
            }
        }
        txtDisplayName.Focus();
    }
コード例 #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(CategoryId))
     {
         Category category = DocoManager.GetCategory(CategoryId);
         //sectionApprove.Visible = !category.AutoApprove; -- uncomment once the Acknowledge feature is available.
         pmm.LoadPermissionsView(category.Id, category.DisplayName);
     }
 }
コード例 #6
0
    protected void AddCategoryClick(object sender, EventArgs e)
    {
        string categoryName     = popAddCategory.Value;
        string categoryId       = popAddCategory.ReferrerId;
        string categoryTypeName = string.Empty;

        // Need to figure out if this is a comms block category or a doco block category.
        if (!string.IsNullOrEmpty(categoryId))
        {
            BusiBlocks.CommsBlock.News.Category news = null;
            try
            {
                news             = NewsManager.GetCategory(categoryId);
                categoryTypeName = news.GetType().Name;
            }
            catch (NewsCategoryNotFoundException) { }
            if (news != null)
            {
                BusiBlocks.CommsBlock.News.Category childCategory = NewsManager.CreateCategory(categoryName);
                childCategory.ParentCategory = news;
                NewsManager.UpdateCategory(childCategory);
                this.PopulateTreeView <BusiBlocks.CommsBlock.News.Category>(NewsManager.GetAllCategories(), true, false, string.Empty);
            }
            else
            {
                BusiBlocks.DocoBlock.Category doco = null;
                try
                {
                    doco             = DocoManager.GetCategory(categoryId);
                    categoryTypeName = doco.GetType().Name;
                }
                catch (DocoCategoryNotFoundException) { }
                if (doco != null)
                {
                    BusiBlocks.DocoBlock.Category childDocoCategory = DocoManager.CreateCategory(categoryName);
                    childDocoCategory.ParentCategory = doco;
                    DocoManager.UpdateCategory(childDocoCategory);
                    this.PopulateTreeView <BusiBlocks.DocoBlock.Category>(DocoManager.GetAllCategories(), true, false, string.Empty);
                }
            }
            RadTreeView1.DataBind();
            RadTreeView1.FindNodeByText(categoryName).ExpandParentNodes();
            RadTreeView1.FindNodeByText(categoryName).Selected = true;

            ((IFeedback)this.Page.Master).ShowFeedback(
                BusiBlocksConstants.Blocks.Administration.LongName,
                categoryTypeName,
                Feedback.Actions.Created,
                categoryName
                );
        }
    }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewState["RefUrl"] = Request.UrlReferrer.ToString();
        }
        //check previous page's URL for the id if Id hasn't been brought forward.
        if (Request.UrlReferrer.Query.Contains("?id"))
        {
            CategoryId = Request.UrlReferrer.Query.Substring(Request.UrlReferrer.Query.IndexOf("id") + 3);
        }
        else
        {
            CategoryId = Request["id"]; //check for id in URL
        }
        if (!string.IsNullOrEmpty(CategoryId))
        {
            Category category = null;
            if (!string.IsNullOrEmpty(CategoryId))
            {
                category = DocoManager.GetCategory(CategoryId);
            }

            if (!SecurityHelper.CanUserView(User.Identity.Name, category.Id))
            {
                // If the user cannot view the category, then return silently.
                object refUrl = ViewState["RefUrl"];
                if (refUrl != null)
                {
                    Response.Redirect((string)refUrl);
                }
            }

            lblDisplayName.InnerText = category.DisplayName;

            HtmlLink link = new HtmlLink();
            link.Href = Navigation.Doco_CategoryRss(CategoryId).GetServerUrl(true);
            link.Attributes.Add("rel", "alternate");
            link.Attributes.Add("type", "application/rss+xml");
            link.Attributes.Add("title", "Category " + category.DisplayName + " Announcements");
            Header.Controls.Add(link);
            //commenting this till the Creation row is finalised.
            string URL    = Navigation.Doco_NewArticle(CategoryId).GetAbsoluteClientUrl(true);
            bool   Access = SecurityHelper.CanUserEdit(Page.User.Identity.Name, category.Id);

            newLink = new Navigation.NavigateNewItem(URL, Access);

            pmm.LoadPermissionsView(category.Id, category.DisplayName);
            LoadList(category);
        }
    }
コード例 #8
0
    /// <summary>
    /// Retrieve all the articles.
    /// </summary>
    private void LoadArticles()
    {
        var articles = new List <Article>();

        // Get eligible document categories
        // todo Refactor Versioning so that I can pass the categories that I'm interested in (viewable news categories),
        // and then it returns be all the versionItems that are in those categories.
        IList <Access> accessibleList = AccessManager.GetUsersAccessibleItems(Page.User.Identity.Name, BusiBlocks.ItemType.DocoCategory, BusiBlocks.AccessType.View);

        foreach (Access accessItem in accessibleList)
        {
            Category category = DocoManager.GetCategory(accessItem.ItemId);
            articles.AddRange(DocoManager.GetArticles(category, ArticleStatus.EnabledAndApproved, false)
                              .Where(x => x.RequiresAck)
                              .Distinct(new KeyEqualityComparer <Article>(x => x.Name)));
        }

        // Filter articles to only include those that have not been viewed or ack'd
        var itemsToList = new List <Article>();

        foreach (Article article in articles)
        {
            if (!itemsToList.Exists(i => i.Id == article.Id))
            {
                if (article.RequiresAck)
                {
                    if (article.Acknowledged)
                    {
                        continue;
                    }
                }
                else
                {
                    if (article.Viewed)
                    {
                        continue;
                    }
                }
                //restricting to display only 5 items for each dashboard.
                if (itemsToList.Count < 5)
                {
                    itemsToList.Add(article);
                }
            }
        }

        lblNoResults.Visible    = itemsToList.Count == 0;
        listRepeater.DataSource = itemsToList;
        listRepeater.DataBind();
    }
コード例 #9
0
ファイル: WSTreeView.cs プロジェクト: sherryswall/busiblocks
    public void DeleteCategory(string Id, string treeViewName)
    {
        switch (treeViewName)
        {
        case "News":
            BusiBlocks.CommsBlock.News.Category newsCategory = NewsManager.GetCategory(Id);
            NewsManager.DeleteCategory(newsCategory);
            break;

        case "Doco":
            BusiBlocks.DocoBlock.Category docoCategory = DocoManager.GetCategory(Id);
            DocoManager.DeleteCategory(docoCategory);
            break;

        default:
            break;
        }
    }
コード例 #10
0
ファイル: WSTreeView.cs プロジェクト: sherryswall/busiblocks
    public void EditCategory(string Id, string Name, string treeViewName)
    {
        switch (treeViewName)
        {
        case "News":
            BusiBlocks.CommsBlock.News.Category category = NewsManager.GetCategory(Id);
            category.Name = Name;
            NewsManager.UpdateCategory(category);
            break;

        case "Doco":
            BusiBlocks.DocoBlock.Category docoCategory = DocoManager.GetCategory(Id);
            docoCategory.DisplayName = Name;
            DocoManager.UpdateCategory(docoCategory);
            break;

        default:
            break;
        }
    }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var articlesIManage = new List <Article>();
        var accesses        = new List <Access>();

        // Go through each group I watch
        foreach (Access access in Profile.ManagedGroups.Accesses)
        {
            accesses.AddRange(AccessManager.GetItemsMatchingAccess(access, BusiBlocks.ItemType.DocoCategory, BusiBlocks.AccessType.View));
        }

        foreach (Access access in accesses)
        {
            articlesIManage.AddRange(DocoManager.GetArticles(DocoManager.GetCategory(access.ItemId), ArticleStatus.EnabledAndApproved, false));
        }

        listDocAckRepeater.DataSource = articlesIManage.Where(delegate(Article article) { return(article.RequiresAck); });
        listDocAckRepeater.DataBind();

        listDocViewedRepeater.DataSource = articlesIManage.Where(delegate(Article article) { return(!article.RequiresAck); });
        listDocViewedRepeater.DataBind();
    }
コード例 #12
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtTitle.Text.Length >= 100)
            {
                ((IFeedback)Page.Master).SetError(GetType(), "The document name must be less than 100 characters long");
                return;
            }
            Category category = DocoManager.GetCategory(CategoryId);

            //check for uploaded or online

            bool isUploaded    = rbListDocoType.SelectedValue.ToLower().Equals("uploaded") ? true : false;
            bool isAckRequired = rblAcknowledge.SelectedValue.ToLower().Equals("required") ? true : false;

            bool isNumbChaps = false;

            if (!isUploaded)
            {
                isNumbChaps = rblChapNumbs.SelectedValue.ToLower().Equals("yes") ? true : false;
            }
            if (isUploaded)
            {
                if (!fuUpload.HasFile)
                {
                    ((IFeedback)Page.Master).SetError(GetType(), "You must add a file for an uploaded document");
                    return;
                }
            }

            if (SecurityHelper.CheckWriteAccess(Page.User.Identity.Name, category.Id))
            {
                // Check whether this article name is in use, because there is a unique name restriction.
                Article oldArticle = DocoManager.GetArticleByName(txtTitle.Text, false);
                if (oldArticle != null)
                {
                    ((IFeedback)Page.Master).SetError(GetType(), "An document with this name already exists. You must have a unique name for the document");
                    return;
                }

                string owner = Utilities.GetUserName(Page.User.Identity.Name);
                DocoManager.CreateArticle(category, owner, txtTitle.Text, !string.IsNullOrEmpty(fuUpload.FileName) ? fuUpload.FileName : string.Empty,
                                          txtTitle.Text, txtDescription.Text, null, isUploaded, true,
                                          isNumbChaps, isAckRequired);

                ((IFeedback)Page.Master).QueueFeedback(
                    BusiBlocksConstants.Blocks.Documents.LongName,
                    "Document",
                    Feedback.Actions.Saved,
                    txtTitle.Text
                    );
            }
            else
            {
                throw new InvalidPermissionException("insert an article");
            }

            if (isUploaded)
            {
                string path =
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Resource.NewObjectPath,
                        _root,
                        category.Id);

                UploadFile(category.Id);
                Navigation.Doco_Default().Redirect(this);
            }
            else
            {
                // Edit the online article.
                Navigation.Doco_ViewArticle(txtTitle.Text, 0, category.Id, "draft").Redirect(this);
            }
        }
        catch (Exception ex)
        {
            throw ex;
            ((IFeedback)Master).SetException(GetType(), ex);
        }
    }
コード例 #13
0
    protected void DeleteCategoryClick(object sender, EventArgs e)
    {
        string categoryName       = string.Empty;
        string categoryId         = popDeleteCategory.ReferrerId;
        string categoryTypeName   = string.Empty;
        string parentCategoryName = string.Empty;
        bool   deleteFailure      = false;

        // Need to figure out if this is a comms block category or a doco block category.
        if (!string.IsNullOrEmpty(categoryId))
        {
            BusiBlocks.CommsBlock.News.Category news = null;
            try
            {
                news = NewsManager.GetCategory(categoryId);
            }
            catch (NewsCategoryNotFoundException) { }
            if (news != null)
            {
                categoryTypeName = news.GetType().Name;
                categoryName     = news.Name;

                // Don't allow the root category to be deleted.
                if (news.ParentCategory == null)
                {
                    ((IFeedback)this.Page.Master).ShowFeedback(
                        BusiBlocksConstants.Blocks.Administration.LongName,
                        news.Name,
                        Feedback.Actions.Error,
                        "Cannot delete the highest level category"
                        );
                    return;
                }

                parentCategoryName = news.ParentCategory.Name;
                IList <BusiBlocks.CommsBlock.News.Item>     newsItems         = NewsManager.GetItems(news, true);
                IList <BusiBlocks.CommsBlock.News.Category> newsSubCategories = NewsManager.GetCategories(news.Id, true);
                // NewsManager.GetCategories returns the root category, so it will always have at least one item
                if (newsSubCategories.Count <= 1 && newsItems.Count == 0)
                {
                    NewsManager.DeleteCategory(news);
                    PopulateTreeView <BusiBlocks.CommsBlock.News.Category>(NewsManager.GetViewableCategories(Page.User.Identity.Name), true, false, string.Empty);
                }
                else
                {
                    deleteFailure = true;
                }
            }
            else
            {
                BusiBlocks.DocoBlock.Category doco = null;
                try
                {
                    doco = DocoManager.GetCategory(categoryId);
                }
                catch (DocoCategoryNotFoundException) { }

                if (doco != null)
                {
                    categoryTypeName   = doco.GetType().Name;
                    categoryName       = doco.DisplayName;
                    parentCategoryName = doco.ParentCategory.DisplayName;

                    IList <Article> docoItems = DocoManager.GetArticles(doco, ArticleStatus.All, true);
                    IList <BusiBlocks.DocoBlock.Category> docoSubCategories = DocoManager.GetAllCategoriesBelow(doco.Id);
                    if (docoSubCategories.Count == 0 && docoItems.Count == 0)
                    {
                        DocoManager.DeleteCategory(doco);
                        this.PopulateTreeView <BusiBlocks.DocoBlock.Category>(DocoManager.GetAllCategories(), true, false, string.Empty);
                    }
                    else
                    {
                        deleteFailure = true;
                    }
                }
            }
            RadTreeView1.DataBind();
        }
        //Displaying feedback.
        if (deleteFailure)
        {
            ((IFeedback)this.Page.Master).ShowFeedback(
                BusiBlocksConstants.Blocks.Administration.LongName,
                categoryTypeName,
                Feedback.Actions.Error,
                ErrorCategoryNotEmpty
                );
            RadTreeView1.FindNodeByText(categoryName).ExpandParentNodes();
            RadTreeView1.FindNodeByText(categoryName).Selected = true;
        }
        else
        {
            ((IFeedback)this.Page.Master).ShowFeedback(
                BusiBlocksConstants.Blocks.Administration.LongName,
                categoryTypeName,
                Feedback.Actions.Deleted,
                categoryName
                );
            RadTreeView1.FindNodeByText(parentCategoryName).ExpandParentNodes();
            RadTreeView1.FindNodeByText(parentCategoryName).Selected = true;
        }
    }
コード例 #14
0
    protected void CreateCategoryNode <T>(T category, bool isAdmin)
    {
        var    tempNode        = typeof(T);
        string nodeName        = string.Empty;
        string nodeId          = string.Empty;
        string nodeParentName  = string.Empty;
        string nodeParentId    = string.Empty;
        string createLink      = string.Empty;
        string createLinkText  = string.Empty;
        bool   hasAccess       = false;
        var    tempCategory    = category;
        string createLinkStyle = string.Empty;

        if (tempNode.FullName.Contains("News"))
        {
            nodeName = (category as BusiBlocks.CommsBlock.News.Category).Name;
            nodeId   = (category as BusiBlocks.CommsBlock.News.Category).Id;
            if ((category as BusiBlocks.CommsBlock.News.Category).ParentCategory != null)
            {
                nodeParentName = (category as BusiBlocks.CommsBlock.News.Category).ParentCategory.Name;
                nodeParentId   = (category as BusiBlocks.CommsBlock.News.Category).ParentCategory.Id;
            }
            BusiBlocks.CommsBlock.News.Category x = NewsManager.GetCategoryByName(nodeName, true);
            tempCategory = (T)Convert.ChangeType(x, typeof(T));

            createLink = Navigation.Communication_NewsCategoryNewItem(x).GetAbsoluteClientUrl(false);
        }
        else if (tempNode.FullName.Contains("Doco"))
        {
            nodeName = (category as BusiBlocks.DocoBlock.Category).DisplayName;
            nodeId   = (category as BusiBlocks.DocoBlock.Category).Id;
            if ((category as BusiBlocks.DocoBlock.Category).ParentCategory != null)
            {
                nodeParentName = (category as BusiBlocks.DocoBlock.Category).ParentCategory.DisplayName;
                nodeParentId   = (category as BusiBlocks.DocoBlock.Category).ParentCategory.Id;
            }
            BusiBlocks.DocoBlock.Category x = DocoManager.GetCategory(nodeId);
            tempCategory = (T)Convert.ChangeType(x, typeof(T));

            createLink = Navigation.Doco_NewArticle(nodeId).GetAbsoluteClientUrl(false);
        }

        if (RadTreeView1.FindNodeByText(nodeName) == null)
        {
            RadTreeNode node = new RadTreeNode(nodeName, nodeId);

            string itemCount = string.Empty;

            //create node icons and links for new item.
            if (CategoryType == "News")
            {
                node.ImageUrl = "../app_themes/default/icons/commCat.gif";
                var cat       = NewsManager.GetCategory(nodeId);
                var newsItems = NewsManager.GetItems(cat, false);
                itemCount = NewsManager.CountItems(newsItems, Page.User.Identity.Name).ToString();

                createLinkText  = "Announcement";
                createLinkStyle = "newAnnounce";
                createLink      = Navigation.Communication_NewsNewItem(NewsManager.GetCategory((category as BusiBlocks.CommsBlock.News.Category).Id)).GetAbsoluteClientUrl(false);
            }
            else if (CategoryType == "Doco")
            {
                node.ImageUrl   = "../App_Themes/Default/icons/folder.png";
                itemCount       = DocoManager.CountItems(nodeId, Page.User.Identity.Name, Utilities.GetUserName(Page.User.Identity.Name)).ToString();
                createLinkStyle = "newDoc";
                createLinkText  = "Document";
            }

            Panel p = new Panel();
            p.ID       = "pnlNode";
            p.CssClass = "tvNode";

            Label lblName = new Label();
            lblName.ID   = "lblDivNodeName";
            lblName.Text = nodeName + "&nbsp;(" + itemCount + ")&nbsp;";

            Label lblContextMenu = new Label();
            lblContextMenu.ID       = "lblContextMenu";
            lblContextMenu.CssClass = nodeId + "_tvContext hideElement";

            //if user can edit then no need to check for contribute.
            hasAccess = SecurityHelper.CheckWriteAccess(Page.User.Identity.Name, nodeId);

            nodeName = "\'" + Utilities.EscapeSpecialCharacters(nodeName) + "\'";

            if (isAdmin)
            {
                string url = tempNode.FullName.Contains("News") ? Navigation.Communication_NewsCategoryEditItem(nodeId).GetClientUrl(this, false) : Navigation.Admin_DocoDetails(nodeId).GetClientUrl(this, false);
                lblContextMenu.Text = "<a href=" + url + " class='edit'>Edit</a>&nbsp;";

                string ParentCatId = string.Empty;
                //if all categories are listed as one node i.e. as list then the root is always null.(caters for any node with null parent)
                if (nodeParentId != string.Empty)
                {
                    ParentCatId = nodeParentId;
                }

                lblContextMenu.Text += "<a href=# class='deleteitem' onclick=\"showDeleteCategoryPopup('Category','" + nodeId + "'," + nodeName + ",'','Delete');\">Delete</a>&nbsp;" +//delete link
                                       "<a href=# class='addCategory' onclick=\"showAddCategoryPopup('Category','" + nodeId + "',''," + nodeName + ",'Add');\">Add Category</a>";
            }
            else
            {
                if (hasAccess)
                {
                    lblContextMenu.Text = "<a href='" + createLink + "' class='" + createLinkStyle + "'>Create " + createLinkText + "</a>";
                }
            }

            p.Controls.Add(lblName);
            p.Controls.Add(lblContextMenu);
            node.Controls.Add(p);

            RadTreeNode tNode = RadTreeView1.FindNode(x => x.Text.Contains(nodeParentName));

            if (tNode == null)
            {
                RadTreeView1.Nodes.Add(node);
            }
            else if (nodeParentId != string.Empty)
            {
                if (tNode != null)
                {
                    RadTreeView1.FindNodeByText(nodeParentName).Nodes.Add(node);
                }
            }
            else
            {
                RadTreeView1.Nodes.Add(node);
            }
        }
    }