From bb1a47aa810d34a2e4e5b205f9e02465c3f51eba Mon Sep 17 00:00:00 2001 From: perploug Date: Wed, 2 Oct 2013 19:22:54 +0200 Subject: [PATCH] Permissions dialog polish --- src/Umbraco.Web.UI/umbraco/dialogs/cruds.aspx | 27 ++++----- .../umbraco/dialogs/cruds.aspx | 27 ++++----- .../umbraco/dialogs/cruds.aspx.cs | 56 ++++++++++++------- .../umbraco/dialogs/cruds.aspx.designer.cs | 23 ++++---- 4 files changed, 71 insertions(+), 62 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/cruds.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/cruds.aspx index d8e3131a6f..fd7621f677 100644 --- a/src/Umbraco.Web.UI/umbraco/dialogs/cruds.aspx +++ b/src/Umbraco.Web.UI/umbraco/dialogs/cruds.aspx @@ -8,21 +8,18 @@ - - - - - - - - - -
- -   or   - <%=umbraco.ui.Text("general", "cancel", this.getUser())%> - -
+
+ + + + + + +
+
\ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx index d8e3131a6f..fd7621f677 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx @@ -8,21 +8,18 @@ - - - - - - - - - -
- -   or   - <%=umbraco.ui.Text("general", "cancel", this.getUser())%> - -
+
+ + + + + + +
+
\ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs index 7a96b7ae3e..0759b77783 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs @@ -8,6 +8,7 @@ using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; +using System.Collections.Generic; namespace umbraco.dialogs { @@ -41,36 +42,46 @@ namespace umbraco.dialogs node = new cms.businesslogic.CMSNode(int.Parse(helper.Request("id"))); - HtmlTable ht = new HtmlTable(); - ht.CellPadding = 4; + HtmlTable ht = new HtmlTable(); + ht.Attributes.Add("class", "table"); + + HtmlTableRow names = new HtmlTableRow(); + + var corner = new HtmlTableCell("th"); + corner.Style.Add("border", "none"); + names.Cells.Add(corner); - HtmlTableRow captions = new HtmlTableRow(); - captions.Cells.Add(new HtmlTableCell()); ArrayList actionList = BusinessLogic.Actions.Action.GetAll(); + Dictionary permissions = new Dictionary(); + + 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); + + HtmlTableRow permission = new HtmlTableRow(); + HtmlTableCell label = new HtmlTableCell(); + label.InnerText = ui.Text("actions", a.Alias); + permission.Cells.Add(label); + permissions.Add(a.Alias, permission); } } - ht.Rows.Add(captions); + + ht.Rows.Add(names); + 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); + HtmlTableCell hc = new HtmlTableCell("th"); + hc.InnerText = u.Name; + hc.Style.Add("text-align", "center"); + hc.Style.Add("border", "none"); + names.Cells.Add(hc); foreach (interfaces.IAction a in BusinessLogic.Actions.Action.GetAll()) { @@ -80,17 +91,22 @@ namespace umbraco.dialogs { if (u.GetPermissions(node.Path).IndexOf(a.Letter) > -1) c.Checked = true; - HtmlTableCell cell = new HtmlTableCell(); + + HtmlTableCell cell = new HtmlTableCell(); cell.Style.Add("text-align", "center"); cell.Controls.Add(c); - permissions.Add(c); - hr.Cells.Add(cell); + + permissions[a.Alias].Cells.Add(cell); } } - ht.Rows.Add(hr); } } + + //add all collected rows + foreach (var perm in permissions.Values) + ht.Rows.Add(perm); + PlaceHolder1.Controls.Add(ht); } @@ -128,7 +144,7 @@ namespace umbraco.dialogs //FeedBackMessage.Text = "
" + ui.Text("rights") + " " + ui.Text("ok") + "
"; feedback1.type = umbraco.uicontrols.Feedback.feedbacktype.success; feedback1.Text = ui.Text("rights") + " " + ui.Text("ok"); - pane_form.Visible = false; + PlaceHolder1.Visible = false; panel_buttons.Visible = false; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.designer.cs index 633eb38373..0c8fa6d2d0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.designer.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.4200 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,15 +12,6 @@ namespace umbraco.dialogs { public partial class cruds { - /// - /// feedback1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Feedback feedback1; - /// /// pane_form control. /// @@ -31,6 +21,15 @@ namespace umbraco.dialogs { /// protected global::umbraco.uicontrols.Pane pane_form; + /// + /// feedback1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.uicontrols.Feedback feedback1; + /// /// PlaceHolder1 control. /// @@ -47,7 +46,7 @@ namespace umbraco.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Panel panel_buttons; + protected global::System.Web.UI.HtmlControls.HtmlGenericControl panel_buttons; /// /// Button1 control.