Adding the last elements from April site

This commit is contained in:
Rick Falkvinge
2011-12-10 15:47:36 +00:00
parent e6bee0d1d3
commit c714923743
13 changed files with 1269 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="AddMotion.aspx.cs" Inherits="Activizr.Pages.Governance.AddMotion" %>
<%@ Register src="~/Controls/v5/Pirates/ComboPerson.ascx" tagname="ComboPerson" tagprefix="act5" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
<script type="text/javascript">
$(document).ready(function() {
$('#MotionSubmittedMessage').fadeOut(7000);
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<div class="entrylabels" style="width:150px">
<asp:Label ID="LabelTitle" runat="server" /><br />
<asp:Label ID="LabelSubmitter" runat="server" /><br />
<div style="height:214px"><asp:Label ID="LabelText" runat="server" /></div>
<asp:Label ID="LabelDecisions" runat="server" />
</div>
<div class="entryfields">
<div style="height:30px; margin-top:4px"><asp:TextBox CssClass="textinput" ID="TextTitle" runat="server" /></div>
<div style="height:30px"><act5:ComboPerson ID="PersonSubmitter" runat="server" /></div>
<asp:TextBox CssClass="textinput" TextMode="MultiLine" Rows="10" ID="TextMotionText" runat="server" />&nbsp;<br />
<asp:TextBox CssClass="textinput" TextMode="MultiLine" Rows="5" ID="TextDecisionPoints" runat="server" />&nbsp;<br />
<div class="button-orange-encaps" style="float:right; margin-top:5px; margin-right:2px;margin-bottom:8px;">
<asp:Button ID="ButtonAddMotion" runat="server"
Text="Submit Motion" CssClass="button button-orange" OnClick="ButtonAddMotion_Click" />
</div>
<div id="MotionSubmittedMessage"><asp:Label ID="LabelMotionSaved" runat="server" Text="" /></div>
</div>
<div class="entryvalidation">
<asp:RequiredFieldValidator ID="ValidatorMotionTitleRequired" runat="server" Display="Dynamic" Text="Motion title required." ControlToValidate="TextTitle" EnableClientScript="false" />&nbsp;<br />
<asp:CustomValidator ID="ValidatorSubmitterRequired" runat="server" Display="Dynamic" Text="Submitter required." OnServerValidate="ValidatorSubmitterRequired_Validate" />&nbsp;<br />
<div style="height:214px"><asp:RequiredFieldValidator ID="ValidatorMotionTextRequired" runat="server" Display="Dynamic" Text="Motion text required." ControlToValidate="TextMotionText" EnableClientScript="false" /></div>
<asp:RequiredFieldValidator ID="RequiredMotionDecisionPoints" runat="server" Display="Dynamic" Text="Decision points required." ControlToValidate="TextDecisionPoints" EnableClientScript="false" />
</div>
<div class="break"></div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
<h2 class="blue"><asp:Label ID="LabelSidebarInfo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelSubmittingMotionInfo" runat="server" /> <b><asp:Label ID="LabelMeetingName" runat="server" /></b>. <a href="#"><asp:Label ID="LabelWrongMeeting" runat="server" /></a>
</div>
</div>
<h2 class="blue"><asp:Label ID="LabelSidebarActions" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<div class="link-row-encaps" onclick="document.location='/Pages/v5/Governance/ListMotions.aspx';" >
<div class="link-row-icon" style="background-image:url('/Images/PageIcons/iconshock-motions-16px.png')"></div>
<asp:Label ID="LabelActionListMotions" runat="server" />
</div>
</div>
</div>
<h2 class="orange"><asp:Label ID="LabelSidebarTodo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelActionItemsHere" runat="server" />
</div>
</div>
</asp:Content>
+119
View File
@@ -0,0 +1,119 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Activizr.Logic.Governance;
using Activizr.Logic.Pirates;
namespace Activizr.Pages.Governance
{
public partial class AddMotion : PageV5Base
{
private Meeting _meeting = Meeting.FromIdentity(1);
protected void Page_Load(object sender, EventArgs e)
{
// Stylize
this.PageIcon = "iconshock-motion-add";
this.TextTitle.Style[HtmlTextWriterStyle.Width] = "300px";
this.PersonSubmitter.Width = 304; // !?
this.TextMotionText.Style[HtmlTextWriterStyle.Width] = "300px";
this.TextDecisionPoints.Style[HtmlTextWriterStyle.Width] = "300px";
this.TextMotionText.Style[HtmlTextWriterStyle.Height] = "200px";
// Localize
this.PageTitle = Resources.Pages.Governance.AddMotion_PageTitle;
this.LabelMeetingName.Text = _meeting.Name;
this.LabelWrongMeeting.Text = Resources.Pages.Governance.AddMotion_WrongMeeting;
this.LabelSubmittingMotionInfo.Text = Resources.Pages.Governance.AddMotion_SubmittingMotionInfo;
this.LabelTitle.Text = Resources.Pages.Governance.AddMotion_Title;
this.LabelSubmitter.Text = Resources.Pages.Governance.AddMotion_Submitter;
this.LabelText.Text = Resources.Pages.Governance.AddMotion_Text;
this.LabelDecisions.Text = Resources.Pages.Governance.AddMotion_Decisions;
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Actions_Placeholder;
this.ButtonAddMotion.Text = Resources.Pages.Governance.AddMotion_SubmitMotion;
this.LabelActionListMotions.Text = Resources.Pages.Governance.ListMotions_PageTitle;
if (!Page.IsPostBack)
{
this.PersonSubmitter.SelectedPerson = _currentUser;
// HACK: Hardcode the presidency of this meeting
bool isPresidency = false;
switch (_currentUser.Identity)
{
case 1681: // Nils Agnesson
case 15719: // Andreas Bjärnemalm
case 1185: // Jonatan Kindh
case 7838: // Jörgen Lindell
case 16761: // Mikael Holm
case 14843: // Staffan Jonsson
case 71888: // Henrik Brändén
{
isPresidency = true;
break;
}
default:
{
break;
}
}
this.PersonSubmitter.Enabled = isPresidency;
this.TextTitle.Focus();
}
}
protected void ButtonAddMotion_Click(object sender, EventArgs e)
{
if (!Page.IsValid)
{
this.LabelMotionSaved.Text = string.Empty;
return; // Do nothing if validators fail the page
}
Motion newMotion = Motion.Create(_meeting, this.PersonSubmitter.SelectedPerson, _currentUser,
this.TextTitle.Text, this.TextMotionText.Text, this.TextDecisionPoints.Text);
this.LabelMotionSaved.Text = String.Format(Resources.Pages.Governance.AddMotion_MotionSubmittedAs,
newMotion.SequenceNumber);
this.TextDecisionPoints.Text = string.Empty;
this.TextMotionText.Text = string.Empty;
this.TextTitle.Text = string.Empty;
if (this.PersonSubmitter.Enabled)
{
this.PersonSubmitter.SelectedPerson = null;
}
this.TextTitle.Focus();
}
protected void ValidatorSubmitterRequired_Validate(object source, ServerValidateEventArgs args)
{
if (this.PersonSubmitter.SelectedPerson == null)
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
}
}
@@ -0,0 +1,70 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="AddMotionAmendment.aspx.cs" Inherits="Activizr.Pages.Governance.AddMotionAmendment" %>
<%@ Register src="~/Controls/v5/Pirates/ComboPerson.ascx" tagname="ComboPerson" tagprefix="act5" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
<script type="text/javascript">
$(document).ready(function() {
$('#AmendmentSubmittedMessage').fadeOut(7000);
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<div class="entrylabels" style="width:150px">
<asp:Label ID="LabelTitle" runat="server" /><br />
<asp:Label ID="LabelSubmitter" runat="server" /><br />
<div style="height:214px"><asp:Label ID="LabelText" runat="server" /></div>
<asp:Label ID="LabelDecision" runat="server" />
</div>
<div class="entryfields">
<div style="height:30px; margin-top:4px"><asp:TextBox CssClass="textinput" ID="TextTitle" runat="server" /></div>
<div style="height:30px"><act5:ComboPerson ID="PersonSubmitter" runat="server" /></div>
<asp:TextBox CssClass="textinput" TextMode="MultiLine" Rows="10" ID="TextAmendmentText" runat="server" />&nbsp;<br />
<asp:TextBox CssClass="textinput" TextMode="MultiLine" Rows="5" ID="TextDecisionPoint" runat="server" />&nbsp;<br />
<div class="button-orange-encaps" style="float:right; margin-top:5px; margin-right:2px;margin-bottom:8px;">
<asp:Button ID="ButtonAddMotionAmendment" runat="server"
Text="Submit Amendment" CssClass="button button-orange" OnClick="ButtonAddAmendment_Click" />
</div>
<div id="AmendmentSubmittedMessage"><asp:Label ID="LabelAmendmentSaved" runat="server" Text="" /></div>
</div>
<div class="entryvalidation">
<asp:RequiredFieldValidator ID="ValidatorAmendmentTitleRequired" runat="server" Display="Dynamic" Text="Amendment title required." ControlToValidate="TextTitle" EnableClientScript="false" />&nbsp;<br />
<asp:CustomValidator ID="ValidatorSubmitterRequired" runat="server" Display="Dynamic" Text="Submitter required." OnServerValidate="ValidatorSubmitterRequired_Validate" />&nbsp;<br />
<div style="height:214px"><asp:RequiredFieldValidator ID="ValidatorAmendmentTextRequired" runat="server" Display="Dynamic" Text="Amendment text required." ControlToValidate="TextAmendmentText" EnableClientScript="false" /></div>
<asp:RequiredFieldValidator ID="RequiredMotionDecisionPoint" runat="server" Display="Dynamic" Text="Decision required." ControlToValidate="TextDecisionPoint" EnableClientScript="false" />
</div>
<div class="break"></div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
<h2 class="blue"><asp:Label ID="LabelSidebarInfo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelSubmittingAmendmentInfo" runat="server" /> <b><asp:Label ID="LabelMotionName" runat="server" /></b>.
</div>
</div>
<h2 class="blue"><asp:Label ID="LabelSidebarActions" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<div class="link-row-encaps" onclick="document.location='/Pages/v5/Governance/ListMotions.aspx';" >
<div class="link-row-icon" style="background-image:url('/Images/PageIcons/iconshock-motions-16px.png')"></div>
<asp:Label ID="LabelActionListMotions" runat="server" />
</div>
</div>
</div>
<h2 class="orange"><asp:Label ID="LabelSidebarTodo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelActionItemsHere" runat="server" />
</div>
</div>
</asp:Content>
@@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Activizr.Logic.Governance;
namespace Activizr.Pages.Governance
{
public partial class AddMotionAmendment : PageV5Base
{
private Motion _motion;
protected void Page_Load(object sender, EventArgs e)
{
string motionIdString = Request.QueryString["MotionId"];
int motionId = Int32.Parse(motionIdString);
_motion = Motion.FromIdentity(motionId);
// Stylize
this.PageIcon = "iconshock-motion-amendment-add";
this.TextTitle.Style[HtmlTextWriterStyle.Width] = "300px";
this.PersonSubmitter.Width = 304; // !?
this.TextAmendmentText.Style[HtmlTextWriterStyle.Width] = "300px";
this.TextDecisionPoint.Style[HtmlTextWriterStyle.Width] = "300px";
this.TextAmendmentText.Style[HtmlTextWriterStyle.Height] = "200px";
// Localize
this.PageTitle = Resources.Pages.Governance.AddMotionAmendment_PageTitle;
this.LabelMotionName.Text = _motion.Title;
this.LabelSubmittingAmendmentInfo.Text = Resources.Pages.Governance.AddMotionAmendment_SubmittingAmendmentInfo;
this.LabelTitle.Text = Resources.Pages.Governance.AddMotionAmendment_Title;
this.LabelSubmitter.Text = Resources.Pages.Governance.AddMotionAmendment_Submitter;
this.LabelText.Text = Resources.Pages.Governance.AddMotionAmendment_Text;
this.LabelDecision.Text = Resources.Pages.Governance.AddMotionAmendment_Decision;
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Actions_Placeholder;
this.ButtonAddMotionAmendment.Text = Resources.Pages.Governance.AddMotionAmendment_SubmitAmendment;
this.LabelActionListMotions.Text = Resources.Pages.Governance.ListMotions_PageTitle;
if (!Page.IsPostBack)
{
this.PersonSubmitter.SelectedPerson = _currentUser;
// HACK: Hardcode the presidency of this meeting
bool isPresidency = false;
switch (_currentUser.Identity)
{
case 1681: // Nils Agnesson
case 15719: // Andreas Bjärnemalm
case 1185: // Jonatan Kindh
case 7838: // Jörgen Lindell
case 16761: // Mikael Holm
case 14843: // Staffan Jonsson
case 71888: // Henrik Brändén
{
isPresidency = true;
break;
}
default:
{
break;
}
}
this.PersonSubmitter.Enabled = isPresidency;
this.TextTitle.Focus();
}
}
protected void ValidatorSubmitterRequired_Validate(object source, ServerValidateEventArgs args)
{
if (this.PersonSubmitter.SelectedPerson == null)
{
args.IsValid = false;
}
else
{
args.IsValid = true;
}
}
protected void ButtonAddAmendment_Click(object sender, EventArgs e)
{
if (!Page.IsValid)
{
this.LabelAmendmentSaved.Text = string.Empty;
return; // Do nothing if validators fail the page
}
MotionAmendment newAmendment = MotionAmendment.Create(_motion, this.TextTitle.Text, this.TextAmendmentText.Text,
this.TextDecisionPoint.Text,
this.PersonSubmitter.SelectedPerson, _currentUser);
this.LabelAmendmentSaved.Text = String.Format(Resources.Pages.Governance.AddMotionAmendment_AmendmentSubmittedAs,
_motion.SequenceNumber, (char) ((int)('A') + newAmendment.SequenceNumber - 1));
this.TextDecisionPoint.Text = string.Empty;
this.TextAmendmentText.Text = string.Empty;
this.TextTitle.Text = string.Empty;
if (this.PersonSubmitter.Enabled)
{
this.PersonSubmitter.SelectedPerson = null;
}
this.TextTitle.Focus();
}
}
}
@@ -0,0 +1,66 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="ListMotions.aspx.cs" Inherits="Activizr.Pages.Governance.ListMotions" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<telerik:RadTreeList ID="GridMotions" runat="server" Width="100%" DataKeyNames="Identity" ParentDataKeyNames="ParentIdentity" AutoGenerateColumns="false" Skin="WebBlue" OnItemCreated="GridMotions_ItemCreated" OnNeedDataSource="GridMotions_NeedDataSource">
<Columns>
<telerik:TreeListBoundColumn HeaderText="#" DataField="Designation" UniqueName="ListMotions_Grid_Designation" HeaderStyle-Width="50px" ItemStyle-Width="50px" />
<telerik:TreeListTemplateColumn HeaderText="Title" UniqueName="ListMotions_Grid_Title" ItemStyle-Width="300px" HeaderStyle-Width="300px">
<ItemTemplate>
<asp:Literal ID="LiteralTitle" runat="server" />
</ItemTemplate>
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn HeaderText="Amendments" UniqueName="ListMotions_Grid_Amendments" ItemStyle-Width="75px" HeaderStyle-Width="75px">
<ItemTemplate>
<asp:Literal ID="LiteralAmendments" runat="server" />
</ItemTemplate>
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn HeaderText="Amended" UniqueName="ListMotions_Grid_Amended" ItemStyle-Width="60px" HeaderStyle-Width="60px">
<ItemTemplate>
&ndash;
</ItemTemplate>
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn HeaderText="Carried" UniqueName="ListMotions_Grid_Carried" ItemStyle-Width="60px" HeaderStyle-Width="60px">
<ItemTemplate>
&ndash;
</ItemTemplate>
</telerik:TreeListTemplateColumn>
</Columns>
</telerik:RadTreeList>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
<h2 class="blue"><asp:Label ID="LabelSidebarInfo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelSidebarLookingAt" runat="server" /> <b><asp:Label ID="LabelMeetingName" runat="server" /></b>. <a href="#"><asp:Label ID="LabelChangeMeeting" runat="server" /></a>
</div>
</div>
<h2 class="blue"><asp:Label ID="LabelSidebarActions" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<div class="link-row-encaps" onclick="document.location='/Pages/v5/Governance/AddMotion.aspx';" >
<div class="link-row-icon" style="background-image:url('/Images/PageIcons/iconshock-motion-add-16px.png')"></div>
<asp:Label ID="LabelActionAddMotion" runat="server" />
</div>
<div class="link-row-encaps" onclick="document.location='/Pages/v5/Governance/Vote.aspx';" >
<div class="link-row-icon" style="background-image:url('/Images/PageIcons/iconshock-vote-16px.png')"></div>
<asp:Label ID="LabelActionVote" runat="server" />
</div>
</div>
</div>
<h2 class="orange"><asp:Label ID="LabelSidebarTodo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelActionItemsHere" runat="server" />
</div>
</div>
</asp:Content>
@@ -0,0 +1,213 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Activizr.Logic.Governance;
using Telerik.Web.UI;
namespace Activizr.Pages.Governance
{
public partial class ListMotions : PageV5Base
{
private Meeting _meeting = Meeting.FromIdentity(1);
private Dictionary<int, MotionAmendments> _amendmentLookup;
public ListMotions()
{
}
protected void Page_Load(object sender, EventArgs e)
{
this.PageTitle = Resources.Pages.Governance.ListMotions_PageTitle;
this.PageIcon = "iconshock-motions";
this.LabelActionAddMotion.Text = Resources.Pages.Governance.AddMotion_PageTitle;
this.LabelActionVote.Text = Resources.Pages.Governance.Vote_PageTitle;
Localize();
if (!this.IsPostBack)
{
PopulateGrid();
this.GridMotions.DataBind();
}
((Activizr.MasterV5) Master).LanguageChanged += new EventHandler(Master_LanguageChanged);
}
private void Master_LanguageChanged(object sender, EventArgs e)
{
// Grid must be re-localized
LocalizeGrid();
PopulateGrid();
this.GridMotions.DataBind();
}
private void Localize()
{
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Actions_Placeholder;
this.LabelSidebarLookingAt.Text = Resources.Pages.Governance.ListMotions_Sidebar_Info;
this.LabelMeetingName.Text = _meeting.Name;
this.LabelChangeMeeting.Text = Resources.Pages.Global.Global_Change;
LocalizeGrid();
}
private void LocalizeGrid()
{
TreeListColumnsCollection columns = this.GridMotions.Columns;
foreach (TreeListColumn column in columns)
{
column.HeaderText = GetGlobalResourceObject("Pages.Governance", column.UniqueName).ToString();
}
}
private void PopulateGrid()
{
Motions motions = Motions.ForMeeting(_meeting);
MotionListRows rows = new MotionListRows();
MotionAmendments amendments = MotionAmendments.ForMeeting(_meeting);
_amendmentLookup = new Dictionary<int, MotionAmendments>();
foreach (Motion motion in motions)
{
MotionListRow newRow = new MotionListRow(motion.Identity, 0, motion.SequenceNumber.ToString(), motion.Title,
0, false, false);
rows.Add(newRow);
}
foreach (MotionAmendment amendment in amendments)
{
if (!_amendmentLookup.ContainsKey(amendment.MotionId))
{
_amendmentLookup[amendment.MotionId] = new MotionAmendments();
}
_amendmentLookup[amendment.MotionId].Add(amendment);
MotionListRow newRow = new MotionListRow(-amendment.Identity, amendment.MotionId, amendment.Designation, amendment.Title, 0, false, amendment.Carried);
rows.Add(newRow);
}
// TODO: Sort rows by identity
this.GridMotions.DataSource = rows;
// TODO: Store in session var to enable paging
}
protected void GridMotions_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
{
MotionListRow row = null;
if (!(e.Item is TreeListDataItem))
{
return;
}
row = ((TreeListDataItem) e.Item).DataItem as MotionListRow;
if (row == null)
{
return;
}
Literal literalAmendments = (Literal)e.Item.FindControl("LiteralAmendments");
Literal literalTitle = (Literal)e.Item.FindControl("LiteralTitle");
if (row.Identity > 0)
{
int amendmentCount = 0;
if (_amendmentLookup.ContainsKey(row.Identity))
{
amendmentCount = _amendmentLookup[row.Identity].Count;
}
literalAmendments.Text = String.Format("{0} (<a href=\"AddMotionAmendment.aspx?MotionId={1}\">{2}</a>)",
amendmentCount, row.Identity,
Resources.Pages.Governance.ListMotions_SubmitAmendment);
literalTitle.Text = String.Format("<a href=\"ViewMotion.aspx?MotionId={0}\">{1}</a>", row.Identity,
HttpUtility.HtmlEncode(row.Title));
}
else
{
literalAmendments.Text = string.Empty;
literalTitle.Text = HttpUtility.HtmlEncode(row.Title);
}
// 0 (<a href="AddMotionAmendment.aspx?MotionId=<%# Eval ("Identity") %>">Submit...</a>)
// <a href="ViewMotion.aspx?MotionId=<%# Eval("Identity") %>"><%# Eval("Title") %></a>
}
public class MotionListRow
{
public MotionListRow (int identity, int parentIdentity, string designation, string title, int amendmentCount, bool amended, bool carried)
{
this.identity = identity;
this.parentIdentity = parentIdentity;
this.designation = designation;
this.title = title;
this.amendmentCount = amendmentCount;
this.amended = amended;
this.carried = carried;
}
private int identity;
private int parentIdentity;
private string designation;
private string title;
private int amendmentCount;
private bool amended;
private bool carried;
public int ParentIdentity
{
get { return this.parentIdentity; }
}
public int Identity
{
get { return this.identity; }
}
public string Designation
{
get { return this.designation; }
}
public string Title
{
get { return this.title; }
}
}
public class MotionListRows: List<MotionListRow>
{
// empty class; we just want the name
}
protected void GridMotions_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
{
LocalizeGrid();
PopulateGrid(); // read this from session var instead, later
}
}
}
+79
View File
@@ -0,0 +1,79 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="ViewMotion.aspx.cs" Inherits="Activizr.Pages.Governance.ViewMotion" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<div>
<div class="displaylabel displayheader"><asp:Label ID="LabelMotionDesignation" runat="server" /></div><div class="displaysubstance displayheader"><b><asp:Label ID="LabelMotionTitle" runat="server" /></b></div>
<div class="break"></div>
</div>
<div>
<div class="displaylabel"><asp:Label ID="LabelMotionTextLabel" runat="server" /></div><div class="displaysubstance"><asp:Label ID="LabelMotionText" runat="server" /></div>
<div class="break"></div>
</div>
<div>
<div class="displaylabel"><asp:Label ID="LabelMotionDecisionsLabel" runat="server" /></div><div class="displaysubstance"><asp:Literal ID="LiteralMotionDecisions" runat="server" /></div>
<div class="break"></div>
</div>
<div style="margin-bottom:5px">
<div class="displaylabel"><asp:Label ID="LabelDiscussLabel" runat="server" /></div><div class="displaysubstance"><asp:HyperLink ID="LinkDiscussion" runat="server" NavigateUrl="#" /></div>
<div class="break"></div>
</div>
<asp:Repeater ID="RepeaterAmendments" runat="server">
<ItemTemplate>
<hr />
<div>
<div class="displaylabel"><%=GetGlobalResourceObject("Pages.Governance", "ViewMotion_Amendment").ToString() %> #<%# Eval("Designation") %></div><div class="displaysubstance"><%# Eval("Title") %></div>
<div class="break"></div>
</div>
<div>
<div class="displaylabel"><%=GetGlobalResourceObject("Pages.Governance", "ViewMotion_AmendmentText").ToString() %></div><div class="displaysubstance"><%# Eval("Text") %></div>
<div class="break"></div>
</div>
<div style="margin-bottom:5px">
<div class="displaylabel"><%=GetGlobalResourceObject("Pages.Governance", "ViewMotion_AmendmentProposedChange").ToString() %></div><div class="displaysubstance"><%# Eval("DecisionPoint") %></div>
<div class="break"></div>
</div>
</ItemTemplate>
</asp:Repeater>
<hr />
<div style="margin-bottom:5px">
<div class="displaylabel"><asp:Label ID="LabelAmendmentCount" runat="server" /></div><div class="displaysubstance"><asp:HyperLink ID="LinkAddAmendment" runat="server" NavigateUrl="#" /></div>
<div class="break"></div>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
<h2 class="blue"><asp:Label ID="LabelSidebarInfo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelViewingMotionInfo" runat="server" /> <b><asp:Label ID="LabelMeetingName" runat="server" /></b>. <a href="#"><asp:Label ID="LabelWrongMeeting" runat="server" /></a>
</div>
</div>
<h2 class="blue"><asp:Label ID="LabelSidebarActions" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<div class="link-row-encaps" onclick="document.location='/Pages/v5/Governance/ListMotions.aspx';" >
<div class="link-row-icon" style="background-image:url('/Images/PageIcons/iconshock-motions-16px.png')"></div>
<asp:Label ID="LabelActionListMotions" runat="server" />
</div>
</div>
</div>
<h2 class="orange"><asp:Label ID="LabelSidebarTodo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelActionItemsHere" runat="server" />
</div>
</div>
</asp:Content>
@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Activizr.Logic.Governance;
namespace Activizr.Pages.Governance
{
public partial class ViewMotion : PageV5Base
{
private Motion _motion;
private Meeting _meeting;
protected void Page_Load(object sender, EventArgs e)
{
string motionIdString = Request.QueryString["MotionId"];
int motionId = Int32.Parse(motionIdString);
_motion = Motion.FromIdentity(motionId);
_meeting = _motion.Meeting;
// TODO: Authorize
// TODO: Get # of posts in discussion thread
int discussionPostCount = 0;
// Localize
this.PageTitle = Resources.Pages.Governance.ViewMotion_PageTitle;
this.PageIcon = "iconshock-motion";
this.LabelActionListMotions.Text = Resources.Pages.Governance.ListMotions_PageTitle;
this.LabelDiscussLabel.Text = Resources.Pages.Governance.ViewMotion_Discuss;
this.LabelMotionDecisionsLabel.Text = Resources.Pages.Governance.ViewMotion_DecisionPoints;
this.LabelMotionDesignation.Text = String.Format(Resources.Pages.Governance.ViewMotion_MotionDesignation, _motion.SequenceNumber);
this.LabelMotionTextLabel.Text = Resources.Pages.Governance.ViewMotion_Text;
this.LabelViewingMotionInfo.Text = Resources.Pages.Governance.ViewMotion_ViewingMotionInfo;
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Actions_Placeholder;
// Fill in fields
this.LabelMeetingName.Text = _meeting.Name;
this.LabelMotionText.Text = _motion.Text;
this.LabelMotionTitle.Text = _motion.Title;
this.LinkDiscussion.Text = String.Format(Resources.Pages.Governance.ViewMotion_DiscussLink, discussionPostCount);
// construct motion text field (a literal, we make it an OL field, need to take care to HTML encode text)
string[] decisionPoints = _motion.DecisionPoints.Split('\r', '\n');
string literal = "<ol class=\"motion-proposed-decisions\">";
foreach (string decisionPoint in decisionPoints)
{
string proposedDecision = decisionPoint.Trim();
if (proposedDecision.Length > 0)
{
literal += "<li>" + HttpUtility.HtmlEncode(proposedDecision) + "</li>";
}
}
literal += "</ol>";
this.LiteralMotionDecisions.Text = literal;
MotionAmendments amendments = _motion.Amendments;
this.RepeaterAmendments.DataSource = amendments;
this.RepeaterAmendments.DataBind();
if (amendments.Count > 1)
{
this.LabelAmendmentCount.Text = String.Format(Resources.Pages.Governance.ViewMotion_AmendmentCountTwoPlus,
amendments.Count);
}
else if (amendments.Count == 1)
{
this.LabelAmendmentCount.Text = Resources.Pages.Governance.ViewMotion_AmendmentCountOne;
}
else // zero
{
this.LabelAmendmentCount.Text = Resources.Pages.Governance.ViewMotion_AmendmentCountZero;
}
this.LinkAddAmendment.NavigateUrl = "AddMotionAmendment.aspx?MotionId=" + _motion.Identity.ToString();
this.LinkAddAmendment.Text = Resources.Pages.Governance.ViewMotion_AddAmendment;
}
}
}
+60
View File
@@ -0,0 +1,60 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" CodeFile="Vote.aspx.cs" Inherits="Activizr.Pages.Governance.Vote" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<h2>SIMULERAT VÅRMÖTE 2011</h2>
<h3><asp:Label ID="LabelPointsOfOrderHeader" runat="server" /></h3>
<p><asp:Label ID="LabelPointsOfOrderTemp" runat="server" /></p>
<h3><asp:Label ID="LabelMotionsHeader" runat="server" /></h3>
<div style="float:left;padding-bottom:10px;width:200px"><asp:Label ID="LabelVoteAmendmentsLabel" runat="server" /><br /><asp:Label ID="LabelVoteMotionsLabel" runat="server" /></div>
<div style="float:left;padding-left:10px;padding-bottom:10px"><a href="VoteAmendments.aspx?MeetingId=1"><asp:Label ID="LabelVoteHere" runat="server" /></a><br />Öppnar 2011-04-25</div>
<div style="float:left;padding-left:10px;padding-bottom:10px">&nbsp;<br />&nbsp;</div>
<div class="break"></div>
<p><asp:LinkButton ID="LabelCreateVotingList" runat="server" /></p>
<h3><asp:Label ID="LabelElectionsHeader" runat="server" /></h3>
<div style="float:left;padding-bottom:10px;width:200px">Styrelsens sammankallande<br />Styrelsen t.o.m. 2013<br />Styrelsen t.o.m. 2012 (fyllnadsval)<br />Mötespresidium</div>
<div style="float:left;padding-left:10px;padding-bottom:10px">Öppnar 2011-05-03<br />Öppnar 2011-05-03<br />Öppnar 2011-05-03<br />Öppnar 2011-05-03</div>
<div style="float:left;padding-left:10px;padding-bottom:10px">&nbsp;<br />&nbsp;</div>
<div class="break"></div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
<h2 class="blue"><asp:Label ID="LabelSidebarInfo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelVotingInfo" runat="server" />
</div>
</div>
<h2 class="blue"><asp:Label ID="LabelSidebarActions" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<div class="link-row-encaps" onclick="document.location='/Pages/v5/Governance/ListMotions.aspx';" >
<div class="link-row-icon" style="background-image:url('/Images/PageIcons/iconshock-motions-16px.png')"></div>
<asp:Label ID="LabelActionListMotions" runat="server" />
</div>
</div>
</div>
<h2 class="orange"><asp:Label ID="LabelSidebarTodo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelActionItemsHere" runat="server" />
</div>
</div>
</asp:Content>
+43
View File
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Activizr.Logic.Governance;
namespace Activizr.Pages.Governance
{
public partial class Vote : PageV5Base
{
protected void Page_Load(object sender, EventArgs e)
{
int motionCount = Motions.ForMeeting(Meeting.FromIdentity(1)).Count;
int amendmentCount = MotionAmendments.ForMeeting(Meeting.FromIdentity(1)).Count;
this.PageTitle = Resources.Pages.Governance.Vote_PageTitle;
this.PageIcon = "iconshock-vote";
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Actions_Placeholder;
this.LabelActionListMotions.Text = Resources.Pages.Governance.ListMotions_PageTitle;
this.LabelVotingInfo.Text = String.Format(Resources.Pages.Governance.Vote_Info, _currentOrganization.Name);
this.LabelPointsOfOrderHeader.Text = Resources.Pages.Governance.Vote_PointsOfOrder;
this.LabelPointsOfOrderTemp.Text = Resources.Pages.Governance.Vote_PointsOfOrderTemp;
this.LabelVoteAmendmentsLabel.Text = String.Format(Resources.Pages.Governance.Vote_VoteOnAmendments,
amendmentCount);
this.LabelVoteMotionsLabel.Text = String.Format(Resources.Pages.Governance.Vote_VoteOnMotions, motionCount);
this.LabelCreateVotingList.Text = Resources.Pages.Governance.Vote_CreateVotingList;
this.LabelVoteHere.Text = Resources.Pages.Governance.Vote_VoteHere;
this.LabelElectionsHeader.Text = Resources.Pages.Governance.Vote_MeetingElections;
this.LabelMotionsHeader.Text = Resources.Pages.Governance.Vote_Motions;
}
}
}
@@ -0,0 +1,70 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" EnableEventValidation="false" AutoEventWireup="true" CodeFile="VoteAmendments.aspx.cs" Inherits="Activizr.Pages.Governance.VoteAmendments" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderHead" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderMain" Runat="Server">
<div style="float:right"><asp:DropDownList ID="DropRecommendations" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropRecommendations_SelectedIndexChanged" /></div><h2><asp:Label ID="LabelAmendmentsForMeeting" runat="server" /></h2>
<telerik:RadTreeList ID="GridAmendmentsVote" runat="server" Width="100%" DataKeyNames="Identity" ParentDataKeyNames="ParentIdentity" AutoGenerateColumns="false" Skin="WebBlue" OnItemCreated="GridAmendmentsVote_ItemCreated" OnNeedDataSource="GridAmendments_NeedDataSource">
<Columns>
<telerik:TreeListBoundColumn HeaderText="#" DataField="Designation" UniqueName="ListMotions_Grid_Designation" HeaderStyle-Width="70px" ItemStyle-Width="70px" />
<telerik:TreeListBoundColumn HeaderText="Title / Text" UniqueName="VoteAmendments_Grid_TitleText" ItemStyle-Width="400px" HeaderStyle-Width="400px" DataField="Text" />
<telerik:TreeListTemplateColumn HeaderText="Yes" UniqueName="VoteAmendments_Grid_Yes" ItemStyle-Width="30px" HeaderStyle-Width="30px" ItemStyle-BackColor="#CCFFCC" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" >
<ItemTemplate>
<asp:RadioButton ID="RadioYes" runat="server" />
</ItemTemplate>
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn HeaderText="No" UniqueName="VoteAmendments_Grid_No" ItemStyle-Width="30px" HeaderStyle-Width="30px" ItemStyle-BackColor="#FFD8D8" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:RadioButton ID="RadioNo" runat="server" />
</ItemTemplate>
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn HeaderText="Abstain" UniqueName="VoteAmendments_Grid_Abstain" ItemStyle-Width="30px" HeaderStyle-Width="30px" ItemStyle-BackColor="#F0F0DD" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:RadioButton ID="RadioAbstain" runat="server" />
</ItemTemplate>
</telerik:TreeListTemplateColumn>
<telerik:TreeListTemplateColumn HeaderText="Recommend" UniqueName="VoteAmendments_Grid_Recommend" ItemStyle-Width="50px" HeaderStyle-Width="50px">
<ItemTemplate>
<asp:Label ID="LabelRecommendation" runat="server" />
</ItemTemplate>
</telerik:TreeListTemplateColumn>
</Columns>
</telerik:RadTreeList>
<div style="float:right;margin-top:5px;margin-bottom:3px"><asp:Button ID="ButtonSaveVote" runat="server" Enabled="false" /></div>
<div class="break"></div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PlaceHolderSide" Runat="Server">
<h2 class="blue"><asp:Label ID="LabelSidebarInfo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelInfo" runat="server" />
</div>
</div>
<h2 class="blue"><asp:Label ID="LabelSidebarActions" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<div class="link-row-encaps" onclick="document.location='/Pages/v5/Governance/ListMotions.aspx';" >
<div class="link-row-icon" style="background-image:url('/Images/PageIcons/iconshock-motions-16px.png')"></div>
<asp:Label ID="LabelActionListMotions" runat="server" />
</div>
</div>
</div>
<h2 class="orange"><asp:Label ID="LabelSidebarTodo" runat="server" /><span class="arrow"></span></h2>
<div class="box">
<div class="content">
<asp:Label ID="LabelActionItemsHere" runat="server" />
</div>
</div>
</asp:Content>
@@ -0,0 +1,262 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Activizr.Logic.Governance;
using Activizr.Logic.Pirates;
using Telerik.Web.UI;
namespace Activizr.Pages.Governance
{
public partial class VoteAmendments : PageV5Base
{
private Meeting _meeting;
private string _selectedRecommendation;
protected void Page_Init (object sender, EventArgs e)
{
_selectedRecommendation = Request.Form["ctl00$PlaceHolderMain$DropRecommendations"];
if (String.IsNullOrEmpty(_selectedRecommendation))
{
_selectedRecommendation = "0";
}
/*
PopulateGrid();
this.GridAmendmentsVote.DataBind();*/
}
protected void Page_Load(object sender, EventArgs e)
{
string motionIdString = Request.QueryString["MeetingId"];
int meetingId = Int32.Parse(motionIdString);
_meeting = Meeting.FromIdentity(meetingId);
// TODO: Authorize
// Localize
this.PageTitle = Resources.Pages.Governance.VoteAmendments_PageTitle;
this.PageIcon = "iconshock-motion-amendments-vote";
this.LabelActionListMotions.Text = Resources.Pages.Governance.ListMotions_PageTitle;
// Fill in fields
LocalizeGrid();
Localize();
if (!Page.IsPostBack)
{
PopulateGrid();
PopulateRecommendations();
}
this.DropRecommendations.Style[HtmlTextWriterStyle.Position] = "relative";
this.DropRecommendations.Style[HtmlTextWriterStyle.Top] = "3px";
}
private void LocalizeGrid()
{
TreeListColumnsCollection columns = this.GridAmendmentsVote.Columns;
foreach (TreeListColumn column in columns)
{
column.HeaderText = GetGlobalResourceObject("Pages.Governance", column.UniqueName).ToString();
}
}
private void Localize()
{
this.LabelActionListMotions.Text = Resources.Pages.Governance.ListMotions_PageTitle;
this.LabelActionItemsHere.Text = Resources.Pages.Global.Sidebar_Actions_Placeholder;
this.LabelAmendmentsForMeeting.Text = _meeting.Name;
this.LabelSidebarInfo.Text = Resources.Pages.Global.Sidebar_Information;
this.LabelSidebarActions.Text = Resources.Pages.Global.Sidebar_Actions;
this.LabelSidebarTodo.Text = Resources.Pages.Global.Sidebar_Todo;
this.ButtonSaveVote.Text = Resources.Pages.Governance.VoteAmendments_SaveVote_Temp;
this.LabelInfo.Text = Resources.Pages.Governance.VoteAmendments_Info;
}
private void PopulateRecommendations()
{
this.DropRecommendations.Items.Clear();
this.DropRecommendations.Items.Add(new ListItem(Resources.Pages.Governance.VoteAmendments_SelectRecommendation, "0"));
this.DropRecommendations.Items.Add(new ListItem(Resources.Pages.Governance.VoteAmendments_BoardRecommendation, "-1"));
this.DropRecommendations.Items.Add(new ListItem("DinLista - " + _currentUser.Canonical, "3"));
this.DropRecommendations.Items.Add(new ListItem("TestList - Rick Falkvinge (#1)", "1"));
}
private void PopulateGrid()
{
// Use lazy method. This can be optimized plenty.
List<GridRowItem> items = new List<GridRowItem>();
Motions motions = Motions.ForMeeting(_meeting);
foreach (Motion motion in motions)
{
items.Add(new GridRowItem(String.Format(Resources.Pages.Governance.ViewMotion_MotionDesignation, motion.SequenceNumber), motion.Title, motion.Submitter, -motion.Identity, 0));
items.Add(new GridRowItem(Resources.Pages.Governance.VoteAmendments_Grid_Text, motion.Text, null, -motion.Identity + 210000, -motion.Identity));
items.Add(new GridRowItem(Resources.Pages.Governance.VoteAmendments_Grid_Decision, motion.DecisionPoints, null, -motion.Identity + 220000, -motion.Identity));
MotionAmendments amendments = MotionAmendments.ForMotion(motion);
foreach (MotionAmendment amendment in amendments)
{
items.Add(new GridRowItem("#" + amendment.Designation, amendment.Title, amendment.Submitter, amendment.Identity, 0));
items.Add(new GridRowItem(Resources.Pages.Governance.VoteAmendments_Grid_Rationale, amendment.Text, null,
amendment.Identity + 100000, amendment.Identity));
items.Add(new GridRowItem(Resources.Pages.Governance.VoteAmendments_Grid_Change,
amendment.DecisionPoint, null, amendment.Identity + 200000, amendment.Identity));
}
}
this.GridAmendmentsVote.DataSource = items;
}
public class GridRowItem
{
public GridRowItem(string designation, string text, Person submitter, int identity, int parentIdentity)
{
this.TextField = text;
this.DesignationField = designation;
this.Submitter = submitter;
this.IdentityField = identity;
this.ParentIdentityField = parentIdentity;
}
public string Title;
public string TextField;
public string DesignationField;
public Person Submitter;
public int IdentityField;
public int ParentIdentityField;
public int Identity
{
get { return this.IdentityField; }
}
public int ParentIdentity
{
get { return this.ParentIdentityField; }
}
public string Designation
{
get { return this.DesignationField;}
}
public string Text
{
get { return this.TextField; }
}
}
protected void GridAmendments_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
{
PopulateGrid();
}
protected void GridAmendmentsVote_ItemCreated(object sender, TreeListItemCreatedEventArgs e)
{
GridRowItem row = null;
if (!(e.Item is TreeListDataItem))
{
return;
}
row = ((TreeListDataItem)e.Item).DataItem as GridRowItem;
if (row == null)
{
return;
}
RadioButton radioYes = (RadioButton)e.Item.FindControl("RadioYes");
RadioButton radioNo = (RadioButton)e.Item.FindControl("RadioNo");
RadioButton radioAbstain = (RadioButton)e.Item.FindControl("RadioAbstain");
Label labelRecommendation = (Label)e.Item.FindControl("LabelRecommendation");
labelRecommendation.Style[HtmlTextWriterStyle.FontWeight] = "700";
labelRecommendation.Style[HtmlTextWriterStyle.Color] = "#880";
bool showButtons = false;
if (row.Identity > 0 && row.Identity < 100000)
{
showButtons = true;
string recommendation = Resources.Pages.Governance.VoteAmendments_Recommend_Abstain;
radioYes.GroupName =
radioNo.GroupName =
radioAbstain.GroupName = "Amendment" + row.Identity.ToString();
if (_selectedRecommendation != "0")
{
switch ((Convert.ToInt32(_selectedRecommendation) + row.Identity) % 3)
{
case 1:
recommendation = Resources.Pages.Governance.VoteAmendments_Recommend_Yes;
labelRecommendation.Style[HtmlTextWriterStyle.Color] = "#080";
break;
case 2:
recommendation = Resources.Pages.Governance.VoteAmendments_Recommend_No;
labelRecommendation.Style[HtmlTextWriterStyle.Color] = "#800";
break;
default:
break;
}
}
labelRecommendation.Text = recommendation;
// Repopulate the state directly from the form
string previousState = null;
foreach (string key in Request.Form.AllKeys)
{
if (key.EndsWith(radioYes.GroupName))
{
previousState = Request.Form[key];
}
}
if (!String.IsNullOrEmpty(previousState))
{
if (previousState == "RadioYes")
{
radioYes.Checked = true;
}
else if (previousState == "RadioNo")
{
radioNo.Checked = true;
}
else if (previousState == "RadioAbstain")
{
radioAbstain.Checked = true;
}
}
}
radioYes.Visible = showButtons;
radioNo.Visible = showButtons;
radioAbstain.Visible = showButtons;
labelRecommendation.Visible = showButtons;
}
protected void DropRecommendations_SelectedIndexChanged(object sender, EventArgs e)
{
PopulateGrid();
this.GridAmendmentsVote.DataBind();
}
}
}
File diff suppressed because one or more lines are too long