From: <ro...@us...> - 2006-08-10 17:39:21
|
Revision: 301 Author: rouquin Date: 2006-08-10 10:39:16 -0700 (Thu, 10 Aug 2006) ViewCVS: http://svn.sourceforge.net/tcdb/?rev=301&view=rev Log Message: ----------- A few minor changes. Renamed rights so that they are more understandable. Modified Paths: -------------- Website/Includes/Rights.ascx Website/Includes/Rights.ascx.cs Website/Includes/UserRoles.ascx.cs Modified: Website/Includes/Rights.ascx =================================================================== --- Website/Includes/Rights.ascx 2006-08-10 17:01:33 UTC (rev 300) +++ Website/Includes/Rights.ascx 2006-08-10 17:39:16 UTC (rev 301) @@ -49,15 +49,103 @@ Assigned to Roles:</label><br /> <asp:Literal ID="roleList" runat="server" OnInit="roleList_Init"></asp:Literal></div> </div> + <div class="cb"> + <asp:LinkButton ID="New" runat="server" CommandName="new" OnInit="New_Init">New</asp:LinkButton><asp:Label + ID="NewLbl" runat="server" Text=" | "></asp:Label><asp:LinkButton ID="Edit" + runat="server" CommandName="edit">Edit</asp:LinkButton> + </div> </div> <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"> </b></b> </div> </div> </ItemTemplate> + <EditItemTemplate> + <div class="cc"> + <div class="xsnazzy"> + <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"> + </b></b> + <div class="xboxcontent"> + <div class="ct"> + <div class="item"> + <label> + Name:</label> + <asp:TextBox ID="nameLabel" runat="server" Text='<%# Bind("rightsName") %>' Width="400"></asp:TextBox></div> + <div class="item"> + <label> + Code: </label> + <asp:TextBox ID="codeLabel" runat="server" Text='<%# Bind("rightsCode") %>' Width="200"></asp:TextBox></div> + <div class="hr"> + </div> + </div> + <div class="cm"> + <div class="item"> + <label> + Description:</label><br /> + <FTB:FreeTextBox ID="DescriptionBox" runat="server" SupportFolder="~/aspnet_client/FreeTextBox/" + Width="100%" Text='<%# Bind("rightsDescription") %>' Height="200px" EnableHtmlMode="true"> + </FTB:FreeTextBox> + </div> + <div class="hr"> + </div> + </div> + <div class="cb"> + <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" + Text="Update"> + </asp:LinkButton> | <asp:LinkButton ID="UpdateCancelButton" runat="server" + CausesValidation="False" CommandName="Cancel" Text="Cancel"> + </asp:LinkButton> + </div> + </div> + <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"> + </b></b> + </div> + </div> + </EditItemTemplate> + <InsertItemTemplate> + <div class="cc"> + <div class="xsnazzy"> + <b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"> + </b></b> + <div class="xboxcontent"> + <div class="ct"> + <div class="item"> + <label> + Name:</label> + <asp:TextBox ID="nameLabel" runat="server" Text='<%# Bind("rightsName") %>' Width="400"></asp:TextBox></div> + <div class="item"> + <label> + Code: </label> + <asp:TextBox ID="codeLabel" runat="server" Text='<%# Bind("rightsCode") %>' Width="200"></asp:TextBox></div> + <div class="hr"> + </div> + </div> + <div class="cm"> + <div class="item"> + <label> + Description:</label><br /> + <FTB:FreeTextBox ID="DescriptionBox" runat="server" SupportFolder="~/aspnet_client/FreeTextBox/" + Width="100%" Text='<%# Bind("rightsDescription") %>' Height="200px" EnableHtmlMode="true"> + </FTB:FreeTextBox> + </div> + <div class="hr"> + </div> + </div> + <div class="cb"> + <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" + Text="Insert" /> | <asp:LinkButton ID="UpdateCancelButton" runat="server" + CausesValidation="False" CommandName="Cancel" Text="Cancel" /> + </div> + </div> + <b class="xbottom"><b class="xb4"></b><b class="xb3"></b><b class="xb2"></b><b class="xb1"> + </b></b> + </div> + </div> + </InsertItemTemplate> </asp:FormView> <asp:ObjectDataSource ID="RightsDataSource" runat="server" SelectMethod="GetData" - TypeName="tcdbDataSetTableAdapters.db_rightsTableAdapter" InsertMethod="Insert" UpdateMethod="Update"> + TypeName="tcdbDataSetTableAdapters.db_rightsTableAdapter" InsertMethod="Insert" + UpdateMethod="Update"> <SelectParameters> <asp:SessionParameter Name="rightsID" SessionField="rightsID" Type="Int32" /> <asp:Parameter Name="rightsCode" Type="String" /> Modified: Website/Includes/Rights.ascx.cs =================================================================== --- Website/Includes/Rights.ascx.cs 2006-08-10 17:01:33 UTC (rev 300) +++ Website/Includes/Rights.ascx.cs 2006-08-10 17:39:16 UTC (rev 301) @@ -42,7 +42,7 @@ if (mode == "new" && m_user.HasRight(Constants.RIGHTS_DEV_ACCESS)) FormView1.ChangeMode(FormViewMode.Insert); - else if (mode == "edit" && (m_user.HasRight(Constants.RIGHTS_DEV_ACCESS) || m_user.HasRight(Constants.RIGHTS_ROLE_EDIT, Constants.PRODUCT_ANYID))) + else if (mode == "edit" && m_user.HasRight(Constants.RIGHTS_DEV_ACCESS)) FormView1.ChangeMode(FormViewMode.Edit); } @@ -85,22 +85,7 @@ editBtn.Visible = false; } } - protected void nameBox_Load(object sender, EventArgs e) - { - TextBox nameBox = (TextBox)FormView1.FindControl("nameBox"); - FreeTextBoxControls.FreeTextBox descriptionBox = (FreeTextBoxControls.FreeTextBox)FormView1.FindControl("descriptionBox"); - Label nameLbl = (Label)FormView1.FindControl("nameLbl"); - Label descriptionLbl = (Label)FormView1.FindControl("descriptionLbl"); - if (!m_user.HasRight(Constants.RIGHTS_DEV_ACCESS)) - { - nameBox.Visible = false; - descriptionBox.Visible = false; - nameLbl.Visible = true; - descriptionLbl.Visible = true; - } - } - protected void activeBox_Init(object sender, EventArgs e) { CheckBox activeBox = (CheckBox)sender; Modified: Website/Includes/UserRoles.ascx.cs =================================================================== --- Website/Includes/UserRoles.ascx.cs 2006-08-10 17:01:33 UTC (rev 300) +++ Website/Includes/UserRoles.ascx.cs 2006-08-10 17:39:16 UTC (rev 301) @@ -79,7 +79,6 @@ } Session["ProductUsers"] = ProductUsers; } - protected void UpdateRoleRights() { ListBox rightsList = (ListBox)UserRoleView.FindControl("assignedList"); @@ -112,14 +111,12 @@ Response.Redirect("~/Administration.aspx"); } } - protected void UserRoleView_ItemUpdated(object sender, FormViewUpdatedEventArgs e) { UpdateRoleRights(); Session.Remove("tableName"); Response.Redirect("~/Role.aspx?" + Constants.CODE_ROLE + "=" + roleID); } - protected void DeleteCmd(object sender, CommandEventArgs e) { tcdbDataSetTableAdapters.db_roleTableAdapter rAdapter = new tcdbDataSetTableAdapters.db_roleTableAdapter(); @@ -129,7 +126,6 @@ Session.Remove("tableName"); Response.Redirect("~/Administration.aspx"); } - protected void UserRoleView_ItemCommand(object sender, FormViewCommandEventArgs e) { if (UserRoleView.CurrentMode == FormViewMode.Insert && e.CommandName == "Cancel") @@ -142,6 +138,17 @@ } } + protected void EditAssignments_Command(object sender, CommandEventArgs e) + { + Response.Redirect("~/RoleAssignments.aspx?" + Constants.CODE_PRODUCT + "=" + productID + "&" + Constants.CODE_ROLE + "=" + roleID); + } + protected void NewRight_Init(object sender, EventArgs e) + { + LinkButton btn = (LinkButton)sender; + + if (!m_user.HasRight(Constants.RIGHTS_DEV_ACCESS)) + btn.Visible = false; + } protected void NewRight(object sender, CommandEventArgs e) { Response.Redirect("Right.aspx?mode=new&" + Constants.CODE_ROLE + "=" + roleID); @@ -181,14 +188,6 @@ } } - protected void NewRight_Init(object sender, EventArgs e) - { - LinkButton btn = (LinkButton)sender; - - if (!m_user.HasRight(Constants.RIGHTS_DEV_ACCESS)) - btn.Visible = false; - } - protected void New_Init(object sender, EventArgs e) { LinkButton newBtn = (LinkButton)sender; @@ -200,7 +199,6 @@ newLbl.Visible = false; } } - protected void Edit_Init(object sender, EventArgs e) { LinkButton editBtn = (LinkButton)sender; @@ -212,7 +210,6 @@ editLbl.Visible = false; } } - protected void Delete_Load(object sender, EventArgs e) { LinkButton deleteBtn = (LinkButton)sender; @@ -249,7 +246,6 @@ activeLbl.Visible = false; } } - protected void ActiveBox_CheckedChanged(object sender, EventArgs e) { CheckBox activeBox = (CheckBox)sender; @@ -305,12 +301,6 @@ } } } - - protected void EditAssignments_Command(object sender, CommandEventArgs e) - { - Response.Redirect("~/RoleAssignments.aspx?" + Constants.CODE_PRODUCT + "=" + productID + "&" + Constants.CODE_ROLE + "=" + roleID); - } - protected void AssignSelected(object sender, CommandEventArgs e) { ListBox unassigned = (ListBox)UserRoleView.FindControl("UnassignedList"); @@ -320,13 +310,12 @@ for (int index = indices.Length-1; index >= 0; index--) { ListItem item = unassigned.Items[indices[index]]; - + unassigned.Items.Remove(item); assigned.Items.Add(item); item.Selected = false; } } - protected void UnassignSelected(object sender, CommandEventArgs e) { ListBox unassigned = (ListBox)UserRoleView.FindControl("UnassignedList"); @@ -337,6 +326,11 @@ { ListItem item = assigned.Items[indices[index]]; + // Reset decoration + Right right = RightDB.GetRightInfo(Convert.ToInt32(item.Value)); + if (!right.ACTIVE) + item.Attributes.CssStyle.Add("text-decoration", "line-through"); + assigned.Items.Remove(item); unassigned.Items.Add(item); item.Selected = false; @@ -351,12 +345,12 @@ rightsList.Text = ""; foreach (Right right in rights) { - if (right.ACTIVE) - { - if (rightsList.Text != "") - rightsList.Text += ", "; + if (rightsList.Text != "") + rightsList.Text += ", "; + if (!right.ACTIVE) + rightsList.Text += "<font class='deleted'>"+ right.NAME +"</font>"; + else rightsList.Text += right.NAME; - } } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |