override protected void OnInit(EventArgs e)
		{
			base.OnInit(e);

			node = new cms.businesslogic.CMSNode(int.Parse(helper.Request("id")));

			HtmlTable ht = new HtmlTable();
			ht.CellPadding = 4;

			HtmlTableRow captions = new HtmlTableRow();
			captions.Cells.Add(new HtmlTableCell());

            ArrayList actionList = BusinessLogic.Actions.Action.GetAll();
            foreach (interfaces.IAction a in actionList)
            {
				if (a.CanBePermissionAssigned) 
				{
					HtmlTableCell hc = new HtmlTableCell();
					hc.Attributes.Add("class", "guiDialogTinyMark");
					hc.Controls.Add(new LiteralControl(ui.Text("actions", a.Alias)));
					captions.Cells.Add(hc);
				}
			}
			ht.Rows.Add(captions);

			foreach (BusinessLogic.User u in BusinessLogic.User.getAll()) 
			{
				// Not disabled users and not system account
				if (!u.Disabled && u.Id > 0) 
				{
					HtmlTableRow hr = new HtmlTableRow();

					HtmlTableCell hc = new HtmlTableCell();
					hc.Attributes.Add("class", "guiDialogTinyMark");
					hc.Controls.Add(new LiteralControl(u.Name));
					hr.Cells.Add(hc);

					foreach (interfaces.IAction a in BusinessLogic.Actions.Action.GetAll()) 
					{
						CheckBox c = new CheckBox();
						c.ID = u.Id + "_" + a.Letter;
						if (a.CanBePermissionAssigned) 
						{
							if (u.GetPermissions(node.Path).IndexOf(a.Letter) > -1)
								c.Checked = true;
							HtmlTableCell cell = new HtmlTableCell();
							cell.Style.Add("text-align", "center");
							cell.Controls.Add(c);
							permissions.Add(c);
							hr.Cells.Add(cell);
						}
							
					}
					ht.Rows.Add(hr);
				}
			}
			PlaceHolder1.Controls.Add(ht);
		}
Exemple #2
0
        public SortNode GetNodes(int ParentId, string App)
        {
            if (BasePage.ValidateUserContextID(BasePage.umbracoUserContextID))
            {
                var parent = new SortNode {
                    Id = ParentId
                };

                var nodes   = new ArrayList();
                var cmsNode = new cms.businesslogic.CMSNode(ParentId);

                // Root nodes?
                if (ParentId == -1)
                {
                    if (App == "media")
                    {
                        foreach (cms.businesslogic.media.Media child in cms.businesslogic.media.Media.GetRootMedias())
                        {
                            nodes.Add(new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime));
                        }
                    }
                    else
                    {
                        foreach (Document child in Document.GetRootDocuments())
                        {
                            nodes.Add(new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime));
                        }
                    }
                }
                else
                {
                    // "hack for stylesheet"
                    if (App == "settings")
                    {
                        var styleSheet = new StyleSheet(cmsNode.Id);
                        foreach (var child in styleSheet.Properties)
                        {
                            nodes.Add(new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime));
                        }
                    }
                    else
                    {
                        //store children array here because iterating over an Array property object is very inneficient.
                        var children = cmsNode.Children;
                        foreach (cms.businesslogic.CMSNode child in children)
                        {
                            nodes.Add(new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime));
                        }
                    }
                }

                parent.SortNodes = (SortNode[])nodes.ToArray(typeof(SortNode));

                return(parent);
            }

            throw new ArgumentException("User not logged in");
        }
Exemple #3
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/nodesorter.asmx"));
            ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx"));

            int    ParentId = 0;
            string App      = umbraco.helper.Request("app");
            string icon     = "../images/umbraco/doc.gif";

            if (int.TryParse(umbraco.helper.Request("ID"), out ParentId))
            {
                if (ParentId == -1)
                {
                    if (App == "media")
                    {
                        icon = "../images/umbraco/mediaPhoto.gif";
                        foreach (cms.businesslogic.media.Media child in cms.businesslogic.media.Media.GetRootMedias())
                        {
                            _nodes.Add(createNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime, icon));
                        }
                    }
                    else
                    {
                        foreach (cms.businesslogic.web.Document child in cms.businesslogic.web.Document.GetRootDocuments())
                        {
                            _nodes.Add(createNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime, icon));
                        }
                    }
                }
                else
                {
                    // "hack for stylesheet"
                    cms.businesslogic.CMSNode n = new cms.businesslogic.CMSNode(ParentId);
                    if (App == "settings")
                    {
                        icon = "../images/umbraco/settingCss.gif";
                        StyleSheet ss = new StyleSheet(n.Id);
                        foreach (cms.businesslogic.web.StylesheetProperty child in ss.Properties)
                        {
                            _nodes.Add(createNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime, icon));
                        }
                    }
                    else
                    {
                        //store children array here because iterating over an Array property object is very inneficient.
                        var children = n.Children;
                        foreach (cms.businesslogic.CMSNode child in children)
                        {
                            _nodes.Add(createNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime, icon));
                        }
                    }
                }

                bindNodesToList(string.Empty);
            }
        }
        private string GetNodeName(int nodeId)
        {
            if (!AuthorizeRequest())
            {
                return(string.Empty);
            }
            var n = new cms.businesslogic.CMSNode(nodeId);

            return(n.Text);
        }
Exemple #5
0
        public SortNode GetNodes(int ParentId, string App)
        {
            if (BasePage.ValidateUserContextID(BasePage.umbracoUserContextID))
            {
                SortNode parent = new SortNode();
                parent.Id = ParentId;

                ArrayList _nodes = new ArrayList();
                cms.businesslogic.CMSNode n = new cms.businesslogic.CMSNode(ParentId);

                // Root nodes?
                if (ParentId == -1)
                {
                    if (App == "media")
                    {
                        foreach (cms.businesslogic.media.Media child in cms.businesslogic.media.Media.GetRootMedias())
                            _nodes.Add(new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime));
                    }
                    else
                        foreach (cms.businesslogic.web.Document child in cms.businesslogic.web.Document.GetRootDocuments())
                            _nodes.Add(new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime));
                }
                else
                {
                    // "hack for stylesheet"
                    if (App == "settings")
                    {
                        StyleSheet ss = new StyleSheet(n.Id);
                        foreach (cms.businesslogic.web.StylesheetProperty child in ss.Properties)
                            _nodes.Add(new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime));

                    }
                    else
                    {
                        //store children array here because iterating over an Array property object is very inneficient.
                        var children = n.Children;
                        foreach (cms.businesslogic.CMSNode child in children)
                        {
                            _nodes.Add(new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime));
                        }
                    }
                }

                parent.SortNodes = (SortNode[])_nodes.ToArray(typeof(SortNode));

                return parent;
            }

            throw new ArgumentException("User not logged in");
        }
Exemple #6
0
        public static void MakeNew(BusinessLogic.User User, cms.businesslogic.CMSNode Node, char PermissionKey)
        {
            IParameter[] parameters = new IParameter[] { SqlHelper.CreateParameter("@userId", User.Id),
                                                         SqlHelper.CreateParameter("@nodeId", Node.Id),
                                                         SqlHelper.CreateParameter("@permission", PermissionKey.ToString()) };

            // Method is synchronized so exists remains consistent (avoiding race condition)
            bool exists = SqlHelper.ExecuteScalar <int>("SELECT COUNT(userId) FROM umbracoUser2nodePermission WHERE userId = @userId AND nodeId = @nodeId AND permission = @permission",
                                                        parameters) > 0;

            if (!exists)
            {
                SqlHelper.ExecuteNonQuery("INSERT INTO umbracoUser2nodePermission (userId, nodeId, permission) VALUES (@userId, @nodeId, @permission)",
                                          parameters);
            }
        }
Exemple #7
0
        public SortNode GetNodes(int ParentId, string App)
        {
            if (BasePage.ValidateUserContextID(BasePage.umbracoUserContextID))
            {
                var parent = new SortNode {
                    Id = ParentId
                };
                var nodes         = new List <SortNode>();
                var entityService = base.ApplicationContext.Services.EntityService;

                // Root nodes?
                if (ParentId == -1)
                {
                    if (App == "media")
                    {
                        var rootMedia = entityService.GetRootEntities(UmbracoObjectTypes.Media);
                        nodes.AddRange(rootMedia.Select(media => new SortNode(media.Id, media.SortOrder, media.Name, media.CreateDate)));
                    }
                    else
                    {
                        var rootContent = entityService.GetRootEntities(UmbracoObjectTypes.Document);
                        nodes.AddRange(rootContent.Select(content => new SortNode(content.Id, content.SortOrder, content.Name, content.CreateDate)));
                    }
                }
                else
                {
                    // "hack for stylesheet"
                    if (App == "settings")
                    {
                        var cmsNode    = new cms.businesslogic.CMSNode(ParentId);
                        var styleSheet = new StyleSheet(cmsNode.Id);
                        nodes.AddRange(styleSheet.Properties.Select(child => new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime)));
                    }
                    else
                    {
                        var children = entityService.GetChildren(ParentId);
                        nodes.AddRange(children.Select(child => new SortNode(child.Id, child.SortOrder, child.Name, child.CreateDate)));
                    }
                }

                parent.SortNodes = nodes.ToArray();

                return(parent);
            }

            throw new ArgumentException("User not logged in");
        }
        public SortNode GetNodes(int ParentId, string App)
        {
            if (BasePage.ValidateUserContextID(BasePage.umbracoUserContextID))
            {
                var parent = new SortNode { Id = ParentId };
                var nodes = new List<SortNode>();
                var entityService = base.ApplicationContext.Services.EntityService;

                // Root nodes?
                if (ParentId == -1)
                {
                    if (App == "media")
                    {
                        var rootMedia = entityService.GetRootEntities(UmbracoObjectTypes.Media);
                        nodes.AddRange(rootMedia.Select(media => new SortNode(media.Id, media.SortOrder, media.Name, media.CreateDate)));
                    }
                    else
                    {
                        var rootContent = entityService.GetRootEntities(UmbracoObjectTypes.Document);
                        nodes.AddRange(rootContent.Select(content => new SortNode(content.Id, content.SortOrder, content.Name, content.CreateDate)));
                    }
                }
                else
                {
                    // "hack for stylesheet"
                    if (App == "settings")
                    {
                        var cmsNode = new cms.businesslogic.CMSNode(ParentId);
                        var styleSheet = new StyleSheet(cmsNode.Id);
                        nodes.AddRange(styleSheet.Properties.Select(child => new SortNode(child.Id, child.sortOrder, child.Text, child.CreateDateTime)));
                    }
                    else
                    {
                        var children = entityService.GetChildren(ParentId);
                        nodes.AddRange(children.Select(child => new SortNode(child.Id, child.SortOrder, child.Name, child.CreateDate)));
                    }
                }

                parent.SortNodes = nodes.ToArray();

                return parent;
            }

            throw new ArgumentException("User not logged in");
        }
        protected override string GetItemTitle()
        {
            string tempTitle = "";
            try
            {
                if (Value != "" && Value != "-1")
                {
                    tempTitle = new cms.businesslogic.CMSNode(int.Parse(Value)).Text;
                }
                else
                {
                    tempTitle = (!string.IsNullOrEmpty(TreeAlias) ? ui.Text(TreeAlias) : ui.Text(AppAlias));

                }
            }
            catch { }
            return tempTitle;
        }
Exemple #10
0
        protected override string GetItemTitle()
        {
            string tempTitle = "";

            try
            {
                if (Value != "" && Value != "-1")
                {
                    tempTitle = new cms.businesslogic.CMSNode(int.Parse(Value)).Text;
                }
                else
                {
                    tempTitle = (!string.IsNullOrEmpty(TreeAlias) ? ui.Text(TreeAlias) : ui.Text(AppAlias));
                }
            }
            catch { }
            return(tempTitle);
        }
        public string[] GetNodeBreadcrumbs(int nodeId)
        {
            AuthorizeRequest(true);

            var node   = new cms.businesslogic.CMSNode(nodeId);
            var crumbs = new System.Collections.Generic.List <string>()
            {
                node.Text
            };

            while (node != null && node.Level > 1)
            {
                node = node.Parent;
                crumbs.Add(node.Text);
            }
            crumbs.Reverse();
            return(crumbs.ToArray());
        }
Exemple #12
0
		protected void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
			if (helper.Request("nodeId") == "") 
			{
			
				string appType = ui.Text("sections", helper.Request("app")).ToLower();
                pane_chooseNode.Text = ui.Text("create", "chooseNode", appType, this.getUser()) + "?";

                DataBind();
			} 
			else 
			{
                int nodeId = int.Parse(helper.Request("nodeId"));
                //ensure they have access to create under this node!!
                if (helper.Request("app") == "media" || CheckCreatePermissions(nodeId))
                {
                    //pane_chooseName.Text = ui.Text("create", "updateData", this.getUser());
                    cms.businesslogic.CMSNode c = new cms.businesslogic.CMSNode(nodeId);
                    path.Value = c.Path;
                    pane_chooseNode.Visible = false;
                    panel_buttons.Visible = false;
                    pane_chooseName.Visible = true;
                    XmlDocument createDef = new XmlDocument();
                    XmlTextReader defReader = new XmlTextReader(Server.MapPath(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/config/create/UI.xml"));
                    createDef.Load(defReader);
                    defReader.Close();

                    // Find definition for current nodeType
                    XmlNode def = createDef.SelectSingleNode("//nodeType [@alias = '" + Request.QueryString["app"] + "']");
                    phCreate.Controls.Add(new UserControl().LoadControl(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + def.SelectSingleNode("./usercontrol").FirstChild.Value));
                }
                else
                {                    
                    PageNameHolder.type = umbraco.uicontrols.Feedback.feedbacktype.error;
                    PageNameHolder.Text = ui.GetText("rights") + " " + ui.GetText("error");
                    JTree.DataBind();
                }
			}
                        
		}
Exemple #13
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            if (helper.Request("nodeId") == "")
            {
                string appType = ui.Text("sections", helper.Request("app")).ToLower();
                pane_chooseNode.Text = ui.Text("create", "chooseNode", appType, this.getUser()) + "?";

                DataBind();
            }
            else
            {
                int nodeId = int.Parse(helper.Request("nodeId"));
                //ensure they have access to create under this node!!
                if (helper.Request("app") == "media" || CheckCreatePermissions(nodeId))
                {
                    //pane_chooseName.Text = ui.Text("create", "updateData", this.getUser());
                    cms.businesslogic.CMSNode c = new cms.businesslogic.CMSNode(nodeId);
                    path.Value = c.Path;
                    pane_chooseNode.Visible = false;
                    panel_buttons.Visible   = false;
                    pane_chooseName.Visible = true;
                    XmlDocument   createDef = new XmlDocument();
                    XmlTextReader defReader = new XmlTextReader(Server.MapPath(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/config/create/UI.xml"));
                    createDef.Load(defReader);
                    defReader.Close();

                    // Find definition for current nodeType
                    XmlNode def = createDef.SelectSingleNode("//nodeType [@alias = '" + Request.QueryString["app"] + "']");
                    phCreate.Controls.Add(new UserControl().LoadControl(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + def.SelectSingleNode("./usercontrol").FirstChild.Value));
                }
                else
                {
                    PageNameHolder.type = umbraco.uicontrols.Feedback.feedbacktype.error;
                    PageNameHolder.Text = ui.GetText("rights") + " " + ui.GetText("error");
                    JTree.DataBind();
                }
            }
        }
Exemple #14
0
 private string getNodeName(int NodeId)
 {
     cms.businesslogic.CMSNode n = new cms.businesslogic.CMSNode(NodeId);
     return n.Text;
 }
Exemple #15
0
 private string getNodeName(int NodeId)
 {
     legacyAjaxCalls.Authorize();
     cms.businesslogic.CMSNode n = new cms.businesslogic.CMSNode(NodeId);
     return(n.Text);
 }
Exemple #16
0
 private string getNodeName(int NodeId)
 {
     cms.businesslogic.CMSNode n = new cms.businesslogic.CMSNode(NodeId);
     return(n.Text);
 }
        public string[] GetNodeBreadcrumbs(int nodeId)
        {

            AuthorizeRequest(true);

            var node = new cms.businesslogic.CMSNode(nodeId);
            var crumbs = new System.Collections.Generic.List<string>() { node.Text };
            while (node != null && node.Level > 1)
            {
                node = node.Parent;
                crumbs.Add(node.Text);
            }
            crumbs.Reverse();
            return crumbs.ToArray();
        }
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);

            node = new cms.businesslogic.CMSNode(int.Parse(helper.Request("id")));

            HtmlTable ht = new HtmlTable();

            ht.CellPadding = 4;

            HtmlTableRow captions = new HtmlTableRow();

            captions.Cells.Add(new HtmlTableCell());

            ArrayList actionList = BusinessLogic.Actions.Action.GetAll();

            foreach (interfaces.IAction a in actionList)
            {
                if (a.CanBePermissionAssigned)
                {
                    HtmlTableCell hc = new HtmlTableCell();
                    hc.Attributes.Add("class", "guiDialogTinyMark");
                    hc.Controls.Add(new LiteralControl(ui.Text("actions", a.Alias)));
                    captions.Cells.Add(hc);
                }
            }
            ht.Rows.Add(captions);

            foreach (BusinessLogic.User u in BusinessLogic.User.getAll())
            {
                // Not disabled users and not system account
                if (!u.Disabled && u.Id > 0)
                {
                    HtmlTableRow hr = new HtmlTableRow();

                    HtmlTableCell hc = new HtmlTableCell();
                    hc.Attributes.Add("class", "guiDialogTinyMark");
                    hc.Controls.Add(new LiteralControl(u.Name));
                    hr.Cells.Add(hc);

                    foreach (interfaces.IAction a in BusinessLogic.Actions.Action.GetAll())
                    {
                        CheckBox c = new CheckBox();
                        c.ID = u.Id + "_" + a.Letter;
                        if (a.CanBePermissionAssigned)
                        {
                            if (u.GetPermissions(node.Path).IndexOf(a.Letter) > -1)
                            {
                                c.Checked = true;
                            }
                            HtmlTableCell cell = new HtmlTableCell();
                            cell.Style.Add("text-align", "center");
                            cell.Controls.Add(c);
                            permissions.Add(c);
                            hr.Cells.Add(cell);
                        }
                    }
                    ht.Rows.Add(hr);
                }
            }
            PlaceHolder1.Controls.Add(ht);
        }
 private string GetNodeName(int nodeId)
 {
     if (!AuthorizeRequest()) return string.Empty;
     var n = new cms.businesslogic.CMSNode(nodeId);
     return n.Text;
 }
Exemple #20
0
 private string getNodeName(int NodeId)
 {
     legacyAjaxCalls.Authorize();
     cms.businesslogic.CMSNode n = new cms.businesslogic.CMSNode(NodeId);
     return n.Text;
 }