Ejemplo n.º 1
0
        public static string PageExpander(this HtmlHelper htmlHelper, Node node, Node activeNode)
        {
            UrlHelper urlHelper = new UrlHelper(htmlHelper.ViewContext.RequestContext);

            if (node.ChildNodes.Count > 0)
            {
                TagBuilder expanderImage = new TagBuilder("img");

                if (node.Level < 1 || (node.IsInPath(activeNode)))
                {
                    expanderImage.AddCssClass("children-visible");
                    expanderImage.Attributes.Add("src", urlHelper.Content("~/manager/Content/Images/collapse.png"));
                }
                else
                {
                    expanderImage.AddCssClass("children-hidden");
                    expanderImage.Attributes.Add("src", urlHelper.Content("~/manager/Content/Images/expand.png"));
                }
                expanderImage.Attributes.Add("alt", "toggle");
                return expanderImage.ToString();
            }
            else
            {
                TagBuilder expanderSpan = new TagBuilder("span");
                string className = "no-children";
                expanderSpan.AddCssClass(className);
                return expanderSpan.ToString();
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Delete a node. Also clean up any references in custom menu's first.
 /// </summary>
 /// <param name="node"></param>
 public virtual void DeleteNode(Node node)
 {
     string hql = "select m from CustomMenu m join m.Nodes n where n.Id = :nodeId";
     IQuery q = this._activeSession.CreateQuery(hql);
     q.SetInt32("nodeId", node.Id);
     IList menus = q.List();
     foreach (CustomMenu menu in menus)
     {
         // HACK: due to a bug with proxies IList.Remove(object) always removes the first object in
         // the list. Also IList.IndexOf always returns 0. Therefore, we'll loop through the collection
         // and find the right index. Btw, when turning off proxies everything works fine.
         int positionFound = -1;
         for (int i = 0; i < menu.Nodes.Count; i++)
         {
             if (((Node)menu.Nodes[i]).Id == node.Id)
             {
                 positionFound = i;
                 break;
             }
         }
         if (positionFound > -1)
         {
             menu.Nodes.RemoveAt(positionFound);
         }
         UpdateObject(menu);
     }
     DeleteObject(node);
 }
Ejemplo n.º 3
0
        public void DeleteNode(Node node)
        {
            IList menus = this._siteStructureDao.GetMenusByParticipatingNode(node);

            foreach (CustomMenu menu in menus)
            {
                // HACK: due to a bug with proxies IList.Remove(object) always removes the first object in
                // the list. Also IList.IndexOf always returns 0. Therefore, we'll loop through the collection
                // and find the right index. Btw, when turning off proxies everything works fine.
                int positionFound = -1;
                for (int i = 0; i < menu.Nodes.Count; i++)
                {
                    if (((Node)menu.Nodes[i]).Id == node.Id)
                    {
                        positionFound = i;
                        break;
                    }
                }
                if (positionFound > -1)
                {
                    menu.Nodes.RemoveAt(positionFound);
                }
                this._commonDao.SaveOrUpdateObject(menu);
            }
            this._commonDao.DeleteObject(node);
        }
        /// <summary>
        /// Default constructor calls base constructor with parameters for templatecontrol, 
        /// templatepath and stylesheet.
        /// </summary>
        public ModuleAdminBasePage()
            : base("ModuleAdminTemplate.ascx", "~/Controls/", "~/Admin/Css/Admin.css")
        {
            this._node = null;
            this._section = null;

            this._moduleLoader = Container.Resolve<ModuleLoader>();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Default constructor calls base constructor with parameters for templatecontrol, 
        /// templatepath and stylesheet.
        /// </summary>
        public ModuleAdminBasePage()
            : base("ModuleAdminTemplate.ascx", "~/Modules/Shared/WebForms/Controls/", "~/Modules/Shared/WebForms/Css/ModuleAdmin.css")
        {
            this._node = null;
            this._section = null;

            this._moduleLoader = Container.Resolve<ModuleLoader>();
            this._searchService = Container.Resolve<ISearchService>();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public AdminBasePage()
        {
            this._activeNode = null;

            this._siteService = Container.Resolve<ISiteService>();
            this._nodeService = Container.Resolve<INodeService>();
            this._sectionService = Container.Resolve<ISectionService>();
            this._moduleLoader = Container.Resolve<ModuleLoader>();
        }
Ejemplo n.º 7
0
        public IList GetMenusByParticipatingNode(Node node)
        {
            ISession session = this._sessionManager.OpenSession();

            string hql = "select m from CustomMenu m join m.Nodes n where n.Id = :nodeId";
            IQuery q = session.CreateQuery(hql);
            q.SetInt32("nodeId", node.Id);
            return q.List();
        }
 public Node CreateRootNode(Site site, Node newNode)
 {
     // ShortDescription is equal to language part of culture by default.
         CultureInfo ci = new CultureInfo(newNode.Culture);
         newNode.ShortDescription = ci.TwoLetterISOLanguageName;
         newNode.Site = site;
         newNode.Position = site.RootNodes.Count;
         site.RootNodes.Add(newNode);
         this._commonDao.SaveObject(newNode);
         return newNode;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Get the full url of a Node with the host url resolved via the Site property.
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public static string GetFullUrlFromNodeViaSite(Node node)
 {
     if (! node.IsExternalLink)
     {
         return Text.EnsureTrailingSlash(node.Site.SiteUrl) + node.Id.ToString() + "/view.aspx";
     }
     else
     {
         return null;
     }
 }
 public Node CreateNode(Node parentNode, Node newNode)
 {
     newNode.ParentNode = parentNode;
         newNode.Site = parentNode.Site;
         newNode.CreateShortDescription();
         newNode.Culture = parentNode.Culture;
         newNode.Position = parentNode.ChildNodes.Count;
         newNode.CopyRolesFromParent();
         parentNode.ChildNodes.Add(newNode);
         this._commonDao.SaveObject(newNode);
         return newNode;
 }
        /// <summary>
        /// Default constructor.
        /// </summary>
        public AdminBasePage()
        {
            this._activeNode = null;

            this._siteService = Container.Resolve<ISiteService>();
            this._userService = Container.Resolve<IUserService>();
            this._nodeService = Container.Resolve<INodeService>();
            this._sectionService = Container.Resolve<ISectionService>();
            this._moduleTypeService = Container.Resolve<IModuleTypeService>();
            this._moduleLoader = Container.Resolve<ModuleLoader>();
            this._templateService = Container.Resolve<ITemplateService>();
            this._fileService = Container.Resolve<IFileService>();
        }
        protected void BuildIndexByNode(Node node)
        {
            foreach (Section section in node.Sections)
            {
                //handle ContentItems
                IList<ContentItem> contentItems = this._contentItemService.FindContentItemsBySection(section);
                try
                {
                    foreach (ContentItem contentItem in contentItems)
                    {
                        if (contentItem is ISearchableContent)
                        {
                            this._searchService.UpdateContent(contentItem);
                        }
                    }
                }
                catch (Exception ex)
                {
                    log.Error(String.Format("Indexing ContentItems of Section {0} - {1} failed.", section.Id, section.Title), ex);
                }

                //handle SearchContents
                ModuleBase module = null;
                try
                {
                    module = base.ModuleLoader.GetModuleFromSection(section);
                }
                catch (Exception ex)
                {
                    log.Error(String.Format("Unable to create Module for Section {0} - {1}.", section.Id, section.Title), ex);
                }

                if (module is ISearchable)
                {
                    ISearchable searchableModule = (ISearchable)module;
                    try
                    {
                        List<SearchContent> searchContents = new List<SearchContent>(searchableModule.GetAllSearchableContent());
                        this._searchService.UpdateContent(searchContents);
                    }
                    catch (Exception ex)
                    {
                        log.Error(String.Format("Indexing SearchContents of Section {0} - {1} failed.", section.Id, section.Title), ex);
                    }
                }
            }
            foreach (Node childNode in node.ChildNodes)
            {
                BuildIndexByNode(childNode);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        public PageEngine()
        {
            this._activeNode = null;
            this._activeSection = null;
            this._templateControl = null;
            this._shouldLoadContent = true;

            // Get services from the container. Ideally, it should be possible to register the aspx page in the container
            // to automatically resolve dependencies but there were memory issues with registering pages in the container.
            this._moduleLoader = Container.Resolve<ModuleLoader>();
            this._nodeService = Container.Resolve<INodeService>();
            this._siteService = Container.Resolve<ISiteService>();
            this._sectionService = Container.Resolve<ISectionService>();
        }
Ejemplo n.º 14
0
        public static ContainerElement PageListItem(this HtmlHelper htmlHelper, Node node, Node activeNode)
        {
            TagBuilder tagBuilder = new TagBuilder("li");

            tagBuilder.Attributes["id"] = "page-" + node.Id;
            tagBuilder.Attributes["class"] = String.Empty;
            if (node.ParentNode != null)
            {
                tagBuilder.Attributes["class"] += "parent-" + node.ParentNode.Id;
            }
            HttpResponseBase httpResponse = htmlHelper.ViewContext.HttpContext.Response;
            httpResponse.Write(tagBuilder.ToString(TagRenderMode.StartTag));
            return new ContainerElement(httpResponse, "li");
        }
Ejemplo n.º 15
0
 private Control CreateDisplayNode(Node node)
 {
     string nodeText;
     string imgUrl;
     // Display root nodes with their culture.
     if (node.Level == 0)
     {
         nodeText = node.Title + " (" + node.Culture + ")";
         imgUrl = "../Images/home.gif";
     }
     else
     {
         nodeText = node.Title;
         if (node.ShowInNavigation)
         {
             imgUrl = "../Images/doc2.gif";
         }
         else
         {
             imgUrl = "../Images/doc2-disabled.gif";
         }
     }
     int indent = node.Level * 20 + 20;
     HtmlGenericControl container = new HtmlGenericControl("div");
     container.Attributes.Add("class", "node");
     container.Attributes.Add("style", String.Format("padding-left: {0}px", indent.ToString()));
     Image img = new Image();
     img.ImageUrl = imgUrl;
     img.ImageAlign = ImageAlign.Left;
     img.AlternateText = "Node";
     container.Controls.Add(img);
     if (this._page.ActiveNode != null && node.Id == this._page.ActiveNode.Id)
     {
         Label lbl = new Label();
         lbl.CssClass = "nodeActive";
         lbl.Text = nodeText;
         container.Controls.Add(lbl);
     }
     else
     {
         HyperLink hpl = new HyperLink();
         hpl.Text = nodeText;
         hpl.NavigateUrl = String.Format("../NodeEdit.aspx?NodeId={0}", node.Id.ToString());
         hpl.CssClass = "nodeLink";
         container.Controls.Add(hpl);
     }
     return container;
 }
Ejemplo n.º 16
0
        private void AddSearchableModuleForNode(Node node, IList<ISearchable> searchableModules)
        {
            foreach (Section section in node.Sections)
            {
                ISearchable module = this._moduleLoader.GetModuleFromSection(section) as ISearchable;

                if (module != null)
                {
                    searchableModules.Add(module);
                }
            }
            foreach (Node childNode in node.ChildNodes)
            {
                AddSearchableModuleForNode(childNode, searchableModules);
            }
        }
Ejemplo n.º 17
0
 private void AddLanguageLink(string culture, Node node, HtmlGenericControl listControl, string languageAsText, bool showImage)
 {
     if (node.Culture != base.PageEngine.RootNode.Culture)
     {
         HtmlGenericControl listItem = new HtmlGenericControl("li");
         HyperLink hpl = new HyperLink();
         hpl.NavigateUrl = UrlUtil.GetUrlFromNode(node);
         hpl.Text = languageAsText;
         if (showImage)
         {
             string countryCode = Globalization.GetCountryFromCulture(culture).ToLower();
             string imageUrl = this.TemplateSourceDirectory + String.Format("/Images/flags/{0}.png", countryCode);
             Image image = new Image();
             image.ImageUrl = imageUrl;
             image.AlternateText = languageAsText;
             hpl.ToolTip = languageAsText;
             hpl.Controls.Add(image);
         }
         listItem.Controls.Add(hpl);
         listControl.Controls.Add(listItem);
     }
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Renders an icon image tag for a Page.
        /// </summary>
        /// <param name="htmlHelper"></param>
        /// <param name="node"></param>
        /// <returns></returns>
        public static string PageImage(this HtmlHelper htmlHelper, Node node)
        {
            UrlHelper urlHelper = new UrlHelper(htmlHelper.ViewContext.RequestContext);

            string imageTag = "<img src=\"{0}\" class=\"handle\" alt=\"{1}\" />";
            if (node.IsRootNode)
            {
                imageTag = String.Format(imageTag, urlHelper.Content("~/manager/Content/Images/house.png"), "home");
            }
            else if (node.IsExternalLink)
            {
                imageTag = String.Format(imageTag, urlHelper.Content("~/manager/Content/Images/page_link.png"), "page-link");
            }
            else if (! node.ShowInNavigation)
            {
                imageTag = String.Format(imageTag, urlHelper.Content("~/manager/Content/Images/page_white.png"), "page-hidden");
            }
            else
            {
                imageTag = String.Format(imageTag, urlHelper.Content("~/manager/Content/Images/page.png"), "page");
            }
            return imageTag;
        }
Ejemplo n.º 19
0
        public IList GetMenusByRootNode(Node rootNode)
        {
            ISession session = this._sessionManager.OpenSession();

            string hql = "from CustomMenu m where m.RootNode.Id = :rootNodeId";
            IQuery q = session.CreateQuery(hql);
            q.SetInt32("rootNodeId", rootNode.Id);
            q.SetCacheable(true);
            q.SetCacheRegion("Menus");
            return q.List();
        }
Ejemplo n.º 20
0
        public IList GetSortedSectionsByNode(Node node)
        {
            ISession session = this._sessionManager.OpenSession();

            string hql = "from Section s where s.Node.Id = :nodeId order by s.PlaceholderId, s.Position ";
            IQuery q = session.CreateQuery(hql);
            q.SetInt32("nodeId", node.Id);
            return q.List();
        }
Ejemplo n.º 21
0
        private Control CreateDisplayNode(Node node)
        {
            string nodeText;
                string adminUrl = UrlHelper.GetSiteUrl() + "/Admin/";
                string imgFolder = UrlHelper.GetSiteUrl() + "/Admin/Images/";
                string imgUrl;
                // Display root nodes with their culture.
                if (node.Level == 0)
                {
                    nodeText = node.Title + " (" + node.Culture + ")";
                    imgUrl = imgFolder + "sitepage-home.png";
                }
                else
                {
                    nodeText = node.Title;
                    if (node.ShowInNavigation)
                    {
                        imgUrl = imgFolder + "sitepage-smaller.png";
                    }
                    else
                    {
                        imgUrl = imgFolder + "sitepage-disabled-smaller.png";
                    }
                }

                HtmlGenericControl nodeli = new HtmlGenericControl("li");

                if (node.Level == 0)
                {
                    nodeli.Attributes.Add("class", "rootnode");
                }
                else
                {
                    nodeli.Attributes.Add("class", "node");
                }
                nodeli.Attributes.Add("site", node.Site.Id.ToString());
                nodeli.Attributes.Add("node", node.Id.ToString());

                Image img = new Image();
                img.ImageUrl = imgUrl;
                img.ImageAlign = ImageAlign.Left;
                img.AlternateText = "Node";
                nodeli.Controls.Add(img);

                if (this.ActiveNode != null && node.Id == this.ActiveNode.Id)
                {
                    Label lpl = new Label();
                    lpl.Text = nodeText;
                    lpl.CssClass = "nodeActive";
                    nodeli.Controls.Add(lpl);
                }
                else
                {
                    HyperLink hpl = new HyperLink();
                    hpl.Text = nodeText;
                    hpl.NavigateUrl = String.Format("{0}NodeEdit.aspx?SiteId={1}&NodeId={2}", adminUrl, node.Site.Id.ToString(), node.Id.ToString());
                    hpl.CssClass = "nodeLink";
                    nodeli.Controls.Add(hpl);
                }

                return nodeli;
        }
Ejemplo n.º 22
0
 private Control CreateDisplayChild(Node node)
 {
     HtmlGenericControl siteul = new HtmlGenericControl("ul");
         DisplayNodes(node.ChildNodes, siteul);
         return siteul;
 }
Ejemplo n.º 23
0
        private void CopySectionsFromNode(Node node, Node nodeTarget)
        {
            foreach (Section section in node.Sections)
                {
                    Section newsection = new Section();
                    newsection.Node = nodeTarget;
                    newsection.CacheDuration = section.CacheDuration;

                    foreach (KeyValuePair<string, Section> entry in section.Connections)
                    {
                        newsection.Connections.Add(entry.Key, entry.Value);
                    }

                    newsection.ModuleType = section.ModuleType;
                    newsection.PlaceholderId = section.PlaceholderId;
                    newsection.Position = section.Position;

                    // copy module settings
                    foreach (DictionaryEntry sectionitem in section.Settings)
                    {
                        newsection.Settings.Add(sectionitem.Key, sectionitem.Value);
                    }

                    // newsection.Settings = section.Settings;

                    if (section.ModuleType.Name.ToLower() == "html")
                    {
                    }

                    newsection.ShowTitle = section.ShowTitle;
                    newsection.Title = section.Title;

                    newsection.CopyRolesFromNode();
                    newsection.CalculateNewPosition();

                    //nodeTarget.Sections.Add(newsection);

                    SectionService.SaveSection(newsection);

                }
        }
Ejemplo n.º 24
0
        private void BuildNodeTree(Node activeNode)
        {
            this.ActiveNode = activeNode;

                IList sites = SiteService.GetAllSites();
                DisplaySites(sites);
        }
Ejemplo n.º 25
0
        public ReturnObject PasteNode(int sourceSiteId, int sourceNodeId, int destinationSiteId, int destinationNodeId, bool showAll)
        {
            try
                {
                    this.ShowAll = showAll;
                    this.SourceNode = this.NodeService.GetNodeById(sourceNodeId);
                    this.DestinationNode = this.NodeService.GetNodeById(destinationNodeId);

                    ////When source is in root and destination is root do not count SourceNode in the collection. To complete paste and reorder use below code.
                    //int newPosition = (this.DestinationNode.ParentNode == null && this.SourceNode.ParentNode.ParentNode == null) ? this.DestinationNode.ChildNodes.Count - 1 : this.DestinationNode.ChildNodes.Count;
                    ////or...
                    ////When source is in root and destination is root throw 'Node already exists' exception
                    int newPosition;
                    if (this.DestinationNode.ParentNode == null && this.SourceNode.ParentNode.ParentNode == null)
                    {
                        throw new Exception("Node already exists in destination.");
                    }
                    else
                    {
                        newPosition = this.DestinationNode.ChildNodes.Count;
                    }

                    SourceNode.ParentNode.ChildNodes.Remove(SourceNode);
                    ReOrderNodePositions(SourceNode.ParentNode.ChildNodes, SourceNode.Position);
                    SourceNode.ParentNode = this.DestinationNode;
                    if (SourceNode.ParentNode != null)
                    {
                        SourceNode.ParentNode.ChildNodes.Add(SourceNode);
                    }

                    SourceNode.Position = newPosition;
                    CommonDao.Flush();

                    string Details = "Node '" + this.SourceNode.Title + "' has been paste to '" + this.DestinationNode.Title + "'";

                    //Build sites list
                    BuildNodeTree(this._destinationNode);
                    string sitesHTMLTW = RenderControlString(plhNodes);

                    return new ReturnObject() { Success = true, SiteId = destinationSiteId, NodeId = destinationNodeId, Details = Details, SitesHTML = sitesHTMLTW };
                }
                catch (System.Exception excep)
                {
                    //Build sites list
                    BuildNodeTree(this._sourceNode);
                    string sitesHTMLTW = RenderControlString(plhNodes);

                    string Details = "Error: Node '" + this.SourceNode.Title + "' has been paste to '" + this.DestinationNode.Title + "'. " + excep.Message;
                    return new ReturnObject() { Success = false, SiteId = destinationSiteId, NodeId = destinationNodeId, Details = excep.Message, SitesHTML = sitesHTMLTW };
                }
        }
Ejemplo n.º 26
0
        public ReturnObject PasteCopyNode(int sourceSiteId, int sourceNodeId, int destinationSiteId, int destinationNodeId, bool showAll)
        {
            this.ShowAll = showAll;

                this.SourceNode = this.NodeService.GetNodeById(sourceNodeId);
                this.DestinationNode = this.NodeService.GetNodeById(destinationNodeId);

                try
                {
                    CommonDao.RemoveQueryFromCache("Nodes");
                    Node node = NodeService.CopyNode(this.SourceNode.Id, this.DestinationNode.Id);

                    CommonDao.Flush();
                    CommonDao.RemoveCollectionFromCache("Cuyahoga.Core.Domain.Node.ChildNodes");

                    string Details = "A copy of node '" + this.SourceNode.Title + "' has been made at node '" + this.DestinationNode.Title + "'.";

                    //Build sites list
                    BuildNodeTree(this._destinationNode);
                    string sitesHTMLTW = RenderControlString(plhNodes);

                    return new ReturnObject() { Success = true, SiteId = destinationSiteId, NodeId = destinationNodeId, Details = Details, SitesHTML = sitesHTMLTW };
                }
                catch (Exception ee)
                {
                    //Build sites list
                    BuildNodeTree(this._sourceNode);
                    string sitesHTMLTW = RenderControlString(plhNodes);

                    string Details = "Error: A copy of node '" + this.SourceNode.Title + "' has not been made at node '" + this.DestinationNode.Title + "'. " + ee.Message;
                    return new ReturnObject() { Success = false, SiteId = destinationSiteId, NodeId = destinationNodeId, Details = Details, SitesHTML = sitesHTMLTW };
                }
        }
Ejemplo n.º 27
0
        public ReturnObject MoveNode(int sourceSiteId, int sourceNodeId, string direction, bool showAll)
        {
            this.ShowAll = showAll;
                this.SourceNode = this.NodeService.GetNodeById(sourceNodeId);

                IList<Node> rootNodes = this.SourceNode.Site.RootNodes.OrderBy(x => x.Position) as IList<Node>;

                NodePositionMovement npm = new NodePositionMovement();
                switch (direction)
                {
                    case "up":
                        npm = NodePositionMovement.Up;
                        break;
                    case "down":
                        npm = NodePositionMovement.Down;
                        break;
                    case "left":
                        npm = NodePositionMovement.Left;
                        break;
                    case "right":
                        npm = NodePositionMovement.Right;
                        break;
                }

                try
                {
                    CommonDao.RemoveQueryFromCache("Nodes");

                    this.SourceNode.Move(rootNodes, npm);
                    //this.NodeService.SaveNode(this.SourceNode);

                    CommonDao.Flush();

                    if (npm == NodePositionMovement.Left || npm == NodePositionMovement.Right)
                    CommonDao.RemoveCollectionFromCache("Cuyahoga.Core.Domain.Node.ChildNodes");

                    string Details = "Node '" + this.SourceNode.Title + "' has been moved " + direction;

                    //Build sites list
                    BuildNodeTree(this.SourceNode);
                    string sitesHTMLTW = RenderControlString(plhNodes);

                    return new ReturnObject() { Success = true, SiteId = sourceSiteId, NodeId = sourceNodeId, Details = Details, SitesHTML = sitesHTMLTW };
                }
                catch (System.Exception excep)
                {
                    //Build sites list
                    BuildNodeTree(this.SourceNode);
                    string sitesHTMLTW = RenderControlString(plhNodes);

                    string Details = "Error: Node: '" + this.SourceNode.Title + "' has not been moved " + direction + ". " + excep.Message;
                    return new ReturnObject() { Success = false, SiteId = sourceSiteId, NodeId = sourceNodeId, Details = Details, SitesHTML = sitesHTMLTW };
                }
        }
Ejemplo n.º 28
0
        public ReturnObject DeleteNode(int sourceSiteId, int sourceNodeId, bool showAll)
        {
            this.ShowAll = showAll;
                CommonDao.RemoveQueryFromCache("Nodes");

                this.SourceNode = this.NodeService.GetNodeById(sourceNodeId);

                int destinationSiteId = sourceSiteId;
                int destinationNodeId = this.SourceNode.ParentNode != null ? this.SourceNode.ParentNode.Id : 0;

                try
                {
                    this.NodeService.DeleteNode(this.SourceNode);
                    CommonDao.Flush();

                    string Details = "Node '" + this.SourceNode.Title + "' of site '" + this.SourceNode.Site.Name +"' has been deleted.";

                    //Build sites list
                    BuildNodeTree(this.SourceNode.ParentNode);
                    string sitesHTMLTW = RenderControlString(plhNodes);

                    return new ReturnObject() { Success = true, SiteId = destinationSiteId, NodeId = destinationNodeId, Details = Details, SitesHTML = sitesHTMLTW };
                }
                catch (System.Exception excep)
                {
                    //Build sites list
                    BuildNodeTree(this.SourceNode);
                    string sitesHTMLTW = RenderControlString(plhNodes);

                    string Details = "Error: Node '" + this.SourceNode.Title + "' of site '" + this.SourceNode.Site.Name + "' could not be deleted. " + excep.Message;
                    return new ReturnObject() { Success = false, SiteId = destinationSiteId, NodeId = destinationNodeId, Details = Details, SitesHTML = sitesHTMLTW };
                }
        }
Ejemplo n.º 29
0
 private void InitNode()
 {
     this._shortDescription = null;
     this._parentNode = null;
     this._template = null;
     this._childNodes = null;
     this._sections = null;
     this._position = -1;
     this._trail = null;
     this._showInNavigation = true;
     this._sections = new ArrayList();
     this._nodePermissions = new ArrayList();
 }
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.Title = "Attach section";
     if (Context.Request.QueryString["SectionId"] != null)
     {
         // Get section data
         this._activeSection = SectionService.GetSectionById(Int32.Parse(Context.Request.QueryString["SectionId"]));
     }
     if (!this.IsPostBack)
     {
         BindSectionControls();
         BindSites();
     }
     else
     {
         if (this.ddlSites.SelectedIndex > -1)
         {
             this._selectedSite = SiteService.GetSiteById(Int32.Parse(this.ddlSites.SelectedValue));
         }
         if (this.lbxAvailableNodes.SelectedIndex > -1)
         {
             this._selectedNode =  NodeService.GetNodeById(Int32.Parse(this.lbxAvailableNodes.SelectedValue));
         }
     }
 }