Permissions dialog polish

This commit is contained in:
perploug
2013-10-02 19:22:54 +02:00
parent 6126a52156
commit bb1a47aa81
4 changed files with 71 additions and 62 deletions

View File

@@ -8,21 +8,18 @@
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc1:Feedback ID="feedback1" runat="server" />
<cc1:Pane ID="pane_form" runat="server">
<cc1:PropertyPanel runat="server">
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</cc1:PropertyPanel>
</cc1:Pane>
<asp:Panel ID="panel_buttons" runat="server" Visible="True">
<br />
<asp:Button ID="Button1" runat="server" Text="" OnClick="Button1_Click"></asp:Button>
&nbsp; <em>or </em>&nbsp; <a href="#" style="color: blue" onclick="UmbClientMgr.closeModalWindow()">
<%=umbraco.ui.Text("general", "cancel", this.getUser())%>
</a>
</asp:Panel>
<div class="umb-dialog-body form-horizontal">
<cc1:Pane ID="pane_form" runat="server">
<cc1:Feedback ID="feedback1" runat="server" />
<cc1:PropertyPanel runat="server">
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</cc1:PropertyPanel>
</cc1:Pane>
</div>
<div runat="server" ID="panel_buttons" class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<a href="#" class="btn btn-link" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("general", "cancel")%></a>
<asp:Button ID="Button1" runat="server" CssClass="btn btn-primary" OnClick="Button1_Click"></asp:Button>
</div>
</asp:Content>

View File

@@ -8,21 +8,18 @@
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<cc1:Feedback ID="feedback1" runat="server" />
<cc1:Pane ID="pane_form" runat="server">
<cc1:PropertyPanel runat="server">
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</cc1:PropertyPanel>
</cc1:Pane>
<asp:Panel ID="panel_buttons" runat="server" Visible="True">
<br />
<asp:Button ID="Button1" runat="server" Text="" OnClick="Button1_Click"></asp:Button>
&nbsp; <em>or </em>&nbsp; <a href="#" style="color: blue" onclick="UmbClientMgr.closeModalWindow()">
<%=umbraco.ui.Text("general", "cancel", this.getUser())%>
</a>
</asp:Panel>
<div class="umb-dialog-body form-horizontal">
<cc1:Pane ID="pane_form" runat="server">
<cc1:Feedback ID="feedback1" runat="server" />
<cc1:PropertyPanel runat="server">
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
</cc1:PropertyPanel>
</cc1:Pane>
</div>
<div runat="server" ID="panel_buttons" class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<a href="#" class="btn btn-link" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("general", "cancel")%></a>
<asp:Button ID="Button1" runat="server" CssClass="btn btn-primary" OnClick="Button1_Click"></asp:Button>
</div>
</asp:Content>

View File

@@ -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<string, HtmlTableRow> permissions = new Dictionary<string, HtmlTableRow>();
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 = "<div class=\"feedbackCreate\">" + ui.Text("rights") + " " + ui.Text("ok") + "</div>";
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;

View File

@@ -1,10 +1,9 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 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.
// </auto-generated>
//------------------------------------------------------------------------------
@@ -13,15 +12,6 @@ namespace umbraco.dialogs {
public partial class cruds {
/// <summary>
/// feedback1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Feedback feedback1;
/// <summary>
/// pane_form control.
/// </summary>
@@ -31,6 +21,15 @@ namespace umbraco.dialogs {
/// </remarks>
protected global::umbraco.uicontrols.Pane pane_form;
/// <summary>
/// feedback1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.uicontrols.Feedback feedback1;
/// <summary>
/// PlaceHolder1 control.
/// </summary>
@@ -47,7 +46,7 @@ namespace umbraco.dialogs {
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Panel panel_buttons;
protected global::System.Web.UI.HtmlControls.HtmlGenericControl panel_buttons;
/// <summary>
/// Button1 control.