public static void UpdateCruds(BusinessLogic.User User, Cms.BusinessLogic.CMSNode Node, string Permissions) { // delete all settings on the node for this user Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(GlobalSettings.DbDSN, CommandType.Text, "delete from umbracoUser2NodePermission where userId = @userId and nodeId = @nodeId", new SqlParameter("@userId", User.Id), new SqlParameter("@nodeId", Node.Id)); // Loop through the permissions and create them foreach (char c in Permissions.ToCharArray()) { MakeNew(User, Node, c); } }
protected override void Render(System.Web.UI.HtmlTextWriter writer) { string tempTitle = ""; string deleteLink = " <a href=\"javascript:" + this.ClientID + "_clear();\" style=\"color: red\">" + UI.Text("delete") + "</a> "; try { if (this.Text != "") { tempTitle = new Cms.BusinessLogic.CMSNode(int.Parse(this.Text)).Text; } } catch {} writer.WriteLine("<script language=\"javascript\">\nfunction " + this.ClientID + "_chooseId() {" + "\nshowPopWin('" + GlobalSettings.Path + "/dialogs/treePicker.aspx?useSubModal=true&appAlias=media', 350, 300, " + ClientID + "_saveId)" + // "\nvar treePicker = window.showModalDialog(, 'treePicker', 'dialogWidth=350px;dialogHeight=300px;scrollbars=no;center=yes;border=thin;help=no;status=no') " + "\n}" + "\nfunction " + ClientID + "_saveId(treePicker) {" + "\nsetTimeout('" + ClientID + "_saveIdDo(' + treePicker + ')', 200);" + "\n}" + "\nfunction " + ClientID + "_saveIdDo(treePicker) {" + "\nif (treePicker != undefined) {" + "\ndocument.getElementById(\"" + this.ClientID + "\").value = treePicker;" + "\nif (treePicker > 0) {" + "\nproxies.CMSNode.GetNodeName.func = " + this.ClientID + "_updateContentTitle;" + "\nproxies.CMSNode.GetNodeName('" + BasePages.BasePage.UmbracoUserContextID + "', treePicker);" + "\n} "+ "\n}" + "\n} "+ "\nfunction " + this.ClientID + "_updateContentTitle(retVal) {" + "\ndocument.getElementById(\"" + this.ClientID + "_title\").innerHTML = \"<strong>\" + retVal + \"</strong>" + deleteLink.Replace("\"", "\\\"") + "\";" + "\n}" + "\nfunction " + this.ClientID + "_clear() {" + "\ndocument.getElementById(\"" + this.ClientID + "_title\").innerHTML = \"\";" + "\ndocument.getElementById(\"" + this.ClientID + "\").value = \"\";" + "\n}" + "\n</script>"); // Clear remove link if text if empty if (this.Text == "") { deleteLink = ""; } writer.WriteLine("<span id=\"" + this.ClientID + "_title\"><b>" + tempTitle + "</b>" + deleteLink + "</span><a href=\"javascript:" + this.ClientID + "_chooseId()\">" + UI.Text("choose") + "...</a> <input type=\"hidden\" id=\"" + this.ClientID + "\" Name=\"" + this.ClientID + "\" value=\"" + this.Text + "\">"); base.Render(writer); }
protected override void Render(System.Web.UI.HtmlTextWriter writer) { string tempTitle = ""; string deleteLink = " <a href=\"javascript:" + this.ClientID + "_clear();\" style=\"color: red\">" + UI.Text("delete") + "</a> "; try { if (this.Text != "") { tempTitle = new Cms.BusinessLogic.CMSNode(int.Parse(this.Text)).Text; } } catch {} writer.WriteLine("<script language=\"javascript\">\nfunction " + this.ClientID + "_chooseId() {" + "\nshowPopWin('" + GlobalSettings.Path + "/dialogs/treePicker.aspx?useSubModal=true&appAlias=media', 350, 300, " + ClientID + "_saveId)" + // "\nvar treePicker = window.showModalDialog(, 'treePicker', 'dialogWidth=350px;dialogHeight=300px;scrollbars=no;center=yes;border=thin;help=no;status=no') " + "\n}" + "\nfunction " + ClientID + "_saveId(treePicker) {" + "\nsetTimeout('" + ClientID + "_saveIdDo(' + treePicker + ')', 200);" + "\n}" + "\nfunction " + ClientID + "_saveIdDo(treePicker) {" + "\nif (treePicker != undefined) {" + "\ndocument.getElementById(\"" + this.ClientID + "\").value = treePicker;" + "\nif (treePicker > 0) {"+ "\nproxies.CMSNode.GetNodeName.func = " + this.ClientID + "_updateContentTitle;" + "\nproxies.CMSNode.GetNodeName('" + BasePages.BasePage.UmbracoUserContextID + "', treePicker);" + "\n} " + "\n}"+ "\n} " + "\nfunction " + this.ClientID + "_updateContentTitle(retVal) {"+ "\ndocument.getElementById(\"" + this.ClientID + "_title\").innerHTML = \"<strong>\" + retVal + \"</strong>" + deleteLink.Replace("\"", "\\\"") + "\";" + "\n}"+ "\nfunction " + this.ClientID + "_clear() {"+ "\ndocument.getElementById(\"" + this.ClientID + "_title\").innerHTML = \"\";"+ "\ndocument.getElementById(\"" + this.ClientID + "\").value = \"\";"+ "\n}"+ "\n</script>"); // Clear remove link if text if empty if (this.Text == "") deleteLink = ""; writer.WriteLine("<span id=\"" + this.ClientID + "_title\"><b>" + tempTitle + "</b>" + deleteLink + "</span><a href=\"javascript:" + this.ClientID + "_chooseId()\">" + UI.Text("choose") + "...</a> <input type=\"hidden\" id=\"" + this.ClientID + "\" Name=\"" + this.ClientID + "\" value=\"" + this.Text + "\">"); base.Render (writer); }
public static void MakeNew(BusinessLogic.User User, Cms.BusinessLogic.CMSNode Node, char PermissionKey) { Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(GlobalSettings.DbDSN, CommandType.Text, "if not exists(select userId from umbracoUser2nodePermission where userId = @userId and nodeId = @nodeId and permission = @permission) insert into umbracoUser2nodePermission (userId, nodeId, permission) values (@userId, @nodeId, @permission)", new SqlParameter("@userId", User.Id), new SqlParameter("@nodeId", Node.Id), new SqlParameter("@permission", PermissionKey.ToString())); }