<%@ Page Language="C#" AutoEventWireup="false" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Controls" Assembly="Hishop.Web.Controls" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Management" Assembly="Hishop.Web.Management" %>
<%@ Register TagPrefix="Hishop" Namespace="Hishop.Web.Validator" Assembly="Hishop.Web.Validator" %>
<%@ Register TagPrefix="UI" Namespace="ASPNET.WebControls" Assembly="ASPNET.WebControls" %>
<%@ Import Namespace="Hishop.SystemServices" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <Hishop:HeadContainer ID="HeadContainer1" runat="server" />
    <Hishop:PageTitle ID="PageTitle1" runat="server" />
    <link rel="stylesheet" href="../../utility/validate/pagevalidator.css" type="text/css" />
    <link rel="stylesheet" href="../css/Hishopv5.css" type="text/css" />
    <script type="text/javascript" src="../../utility/jquery-1.3.2.min.js"></script>
    <script type="text/javascript" src="../../utility/validate/pagevalidator.js"></script>
    
    <script type="text/javascript" src="../js/Hishopv5.js"></script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <div class="PageTitleArea">
                <div class="PageTitle">
                   <asp:Literal ID="lblPageTitle" runat="server" Text="<%$ Resources:Votes,IDS_PageTitle %>"></asp:Literal>
                </div>
                <div style="width: 80%;">
                    <asp:Literal ID="lblPageDesc" runat="server" Text="<%$ Resources:Votes,IDS_PageDesc %>"></asp:Literal>
                </div>
            </div>
            
            <Hishop:Votes ID="Votes" runat="server">
            <SkinTemplate>
        <Hishop:StatusMessage id="Status" runat="server" Visible="False" />
<fieldset class="AdminSearchform">
    <legend>
        <asp:Literal ID="litSearchTitle" Text="<%$ Resources:Votes,IDS_Literal_SearchTitle %>" runat="server"></asp:Literal>
    </legend>                
    <table width="5%" border="0" cellspacing="0" cellpadding="0" style="margin-left:18px">
        <tr>
            <td class="searchTableLeftTD">
                <nobr><asp:Label ID="lblVoteName" runat="server" Text="<%$Resources:Votes,IDS_Label_VoteName %>"></asp:Label></nobr>
            </td>
            <td class="searchTableControlTD">
                <Hishop:DefaultButtonTextBox ID="txtVoteName" runat="server" Button="btnQueryVote"></Hishop:DefaultButtonTextBox>
            </td>
            <td class="searchTableLeftTD">
                <nobr><asp:Label ID="lblPageSize" runat="server" Text="<%$ Resources:Votes,IDS_Label_PageSize %>"></asp:Label></nobr>
            </td>
            <td class="searchTableControlTD">
                <Hishop:PageSizeDropDownList ID="dropPageSize" runat="server"></Hishop:PageSizeDropDownList>
            </td>  
           <td class="bottonTD" >
                <asp:Button ID="btnQueryVote" runat="server" Text="<%$ Resources:Votes,IDS_Button_QueryVote %>" CssClass="inp_L1"/>
            </td>
        </tr>
    </table>
</fieldset>
<div class="grdGroupFormList"> 
            <div class="grdHeaderStyle">
               <ul>                                                          
                 <li class="userGroupCheckAll"><a href="#" onclick="CheckClickAll()"><asp:Label ID="CheckAll" runat="server" Text="<%$ Resources:Resources, IDS_Label_CheckAll %>" ></asp:Label></a></li>
                 <li class="spirtLines">|</li>
                 <li class="userGroupReverseCheck"><a  href="#" onclick="CheckReverse()"><asp:Label ID="lblCheckRecerse" runat="server" Text="<%$ Resources:Resources, IDS_Label_CheckReverse %>"></asp:Label></a></li>
                 <li class="spirtLines">|</li>
                 <li class="userGroupDelCheck"><Hishop:DeleteImageLinkButton ID="lkbDeleteCheck" runat="server" Text="<%$Resources:Resources, IDS_Button_DeleteCheck %>" /></li>			                 
               </ul>
            </div>
            <div class="grdGroupList">
                <asp:DataList ID="dlstVote" runat="server" Width="100%" DataKeyField="VoteId">
                    <HeaderTemplate>
                    <table class="GridViewStyle" id="GridViewTable" cellspacing="0" border="0" style="border-collapse: collapse;" width="100%">
                      <tr class="GridViewHeaderStyle">
                        <th scope="col" style="width: 30px;"><span><asp:Literal ID="lblChoise" Text="<%$Resources:ExceptionsReports,IDS_Header_Choise%>" runat="server"></asp:Literal></span></th>
                        <th scope="col" style="width: 30px;"><span><asp:Literal ID="lblOpen" Text="<%$Resources:ExceptionsReports,IDS_Header_Open%>" runat="server"></asp:Literal></span></th>
                        <th style="width: 40%;"><span><asp:Literal ID="litVoteName" runat="server" Text="<%$ Resources:Votes,IDS_Header_VoteName %>"></asp:Literal></span></th>
                        <th style="width: 13%;"><span><asp:Literal ID="litMaxCheck" runat="server" Text="<%$ Resources:Votes,IDM_grdMaxChick %>"></asp:Literal></span></th>
                        <th style="width: 13%;"><span><asp:Literal ID="litVoteCount" runat="server" Text="<%$ Resources:Votes,IDM_grdVoteCounts %>"></asp:Literal></span></th>
                        <th style="width: 13%;"><span><asp:Literal ID="litIsBackup" runat="server" Text="<%$ Resources:Votes,IDS_Header_IsBackup %>"></asp:Literal></span></th>
                        <th style="width: 13%;"><span><asp:Literal ID="Literal1" runat="server" Text="<%$ Resources:Resources, IDS_Header_Options %>"></asp:Literal></span></th>
                      </tr>
                </HeaderTemplate>
                <ItemTemplate>
                  <tr class="grdrow">
                    <td style="width: 5px;"><asp:CheckBox ID="checkboxCol" runat="server"></asp:CheckBox></td>
                    <td style="width: 5px; vertical-align: middle; padding-left: 8px;"><img id="themesImg" src="../../utility/pics/plus.gif" onclick="errorEventTable(this);" /></td>
                    <td style="width: 250px;">
                        <asp:Label ID="lblVoteName" runat="server" Text='<%# Eval("VoteName") %>'></asp:Label>
                    </td>
                    <td><asp:Label ID="lblMaxCheck" runat="server" Text='<%# Eval("MaxCheck") %>' ></asp:Label></td>
                    <td><asp:Label ID="lblVoteCounts" runat="server" Text='<%# Eval("VoteCounts") %>' ></asp:Label></td>
                    <td>
                        <asp:ImageButton ID="lmgbtnIsBackup" runat="server" CommandName="IsBackup" ImageUrl='<%# (bool)Eval("IsBackup") ? "../../utility/pics/true.gif" : "../../utility/pics/false.gif" %>'></asp:ImageButton>
                    </td>
                    <td>
                       <asp:HyperLink ID="lkbVoteName" runat="server" CssClass="SmallCommonTextButton" Text="<%$ Resources:Votes, IDS_FormField_VoteItmes %>"  NavigateUrl='<%# Globals.GetSiteUrls().UrlData.FormatUrl("admin_VoteItems",Eval("VoteId"))%>'></asp:HyperLink>
                       <asp:LinkButton ID="lkbEdit" runat="server" CssClass="SmallCommonTextButton"  CommandName="Edit" Text="<%$ Resources:Votes, IDS_FormField_EditVote%>"></asp:LinkButton>
                       <Hishop:DeleteImageLinkButton ID="lkbDelete" CssClass="SmallCommonTextButton" runat="server"  CommandName="Delete" Text="<%$ Resources:Votes, IDS_FormField_DeleteVote %>" />

                    </td>
                  </tr>
                  <tr class="grdrow" style="display: none;" >
                    <td style="width: 5px;"></td>
                    <td style="width: 5px; vertical-align: middle; padding-left: 8px;"></td>
                    <td colspan="4">                       
                        <asp:GridView ID="grdVoteItem" runat="server" AutoGenerateColumns="false" ShowHeader="true" DataKeyNames="VoteItemId" CssClass="GridViewStyle" GridLines="None" RowStyle-CssClass="grdrow" HeaderStyle-CssClass="GridViewHeaderStyle" >                                                        
                        <Columns>                                       
			                <asp:TemplateField HeaderText="<%$ Resources:VoteItems, IDM_grdVoteItmeName %>" ControlStyle-Width="100px">
			                    <ItemTemplate>
			                        <asp:Label ID="lblVoteItemName" runat="server" Text='<%# Eval("VoteItemName") %>'></asp:Label>
			                    </ItemTemplate>
			                    <EditItemTemplate>
			                        <Hishop:HtmlDecodeTextBox ID="txtVoteItemName" runat="server" Text='<%# Eval("VoteItemName") %>' />
			                    </EditItemTemplate>
			                </asp:TemplateField>
			                <asp:TemplateField HeaderText="<%$ Resources:VoteItems,IDS_grdVoteItmeLenth %>" >
                                <ItemTemplate>
                                    <img width='<%# string.Format("{0}px", Eval("Lenth")) %>' height="15" class="votelenth"/>
                                </ItemTemplate>
                            </asp:TemplateField>    
                            <asp:TemplateField HeaderText="<%$ Resources:VoteItems,IDS_grdVoteItmePercentage %>" >
                                <ItemTemplate>
                                    <asp:Label ID="lblPercentage" runat="server" Text='<%# string.Format("{0}%", Eval("Percentage")) %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>  
                            <asp:BoundField HeaderText="<%$ Resources:VoteItems,IDS_grdVoteItmeCount %>" DataField="ItemCount"  ReadOnly="true" />
                        </Columns>
                </asp:GridView>
                    </td>
                    <td></td>
                  </tr>
                </ItemTemplate>
                
                <EditItemTemplate>
                  <tr class="grdrow">
                    <td style="width: 5px;">
                        <asp:CheckBox ID="checkboxCol" runat="server"></asp:CheckBox></td>
                    <td style="width: 5px; vertical-align: middle; padding-left: 8px;">
                        <img id="themesImg" src="../../utility/pics/plus.gif" onclick="errorEventTable(this);" /></td>
                    <td style="width: 250px;">
                        <Hishop:HtmlDecodeTextBox ID="txtVoteName" runat="server" Text='<%# Eval("VoteName") %>' />
                        
                    </td>
                    <td><asp:TextBox ID="txtMaxCheck" runat="server" Text='<%# Eval("MaxCheck") %>'></asp:TextBox></td>
                    <td><asp:Label ID="lblEditVoteCounts" runat="server" Text='<%# Eval("VoteCounts") %>' ></asp:Label></td>
                    <td>
                        <asp:ImageButton ID="lmgbtnIsBackup1" runat="server" CommandName="IsBackup" ImageUrl='<%# (bool)Eval("IsBackup") ? "../../utility/pics/true.gif" : "../../utility/pics/false.gif" %>'></asp:ImageButton>
                    </td>
                    <td>
                        <asp:HyperLink ID="lkbVoteName" runat="server" CssClass="SmallCommonTextButton" Text="<%$ Resources:Votes, IDS_FormField_VoteItmes %>"  NavigateUrl='<%# Globals.GetSiteUrls().UrlData.FormatUrl("admin_VoteItems",Eval("VoteId"))%>'></asp:HyperLink>
                        <asp:LinkButton ID="lkbUpdate" CssClass="SmallCommonTextButton" runat="server" CommandName="Update" Text="<%$ Resources:Resources, IDS_Button_Update %>" CommandArgument='<%# Eval("VoteId") %>'></asp:LinkButton>
                        <asp:LinkButton ID="lkbCancel" CssClass="SmallCommonTextButton" runat="server" CommandName="Cancel" Text="<% $Resources:Resources, IDS_Button_Cancel %>"></asp:LinkButton>
                    </td>
                  </tr>
                </EditItemTemplate>
                <FooterTemplate>
                    </table>
                </FooterTemplate>
              </asp:DataList>
            </div>
            <!--分页开始-->
            <div class="grdGroupTabhead">
                  <UI:Pager runat="server" ListToPaging="dlstVote" ID="pager" />
            </div>
            <!--添加/修改投票标题-->
            <div class="grdHeaderStyle" style="cursor:pointer;" onclick="expItemsTable('addItemsTable');">
                <ul>
                    <li class="addProductTmpt">
                        <asp:Literal ID="litAddVote" Text='<%$Resources:Votes,IDS_Literal_AddVote %>' runat="server"></asp:Literal>
                   </li>
                </ul>
            </div>
            <table style="width: 100%;" cellspacing="0" cellpadding="0" class="formTableList" id="addItemsTable">
                <tr>
                    <td class="leftTD"><asp:Label ID="lblVoteId" runat="server" Visible="false"></asp:Label>
                        <nobr><asp:Label id="lblAddVoteName" runat="server"  Text="<%$ Resources:Votes,IDS_Label_VoteName%>"></asp:Label></nobr>
                    </td>
                    <td class="rightTD">
                        <Hishop:DefaultButtonTextBox ID="txtAddVoteName" runat="server" Button="btnAddProductTemplet"></Hishop:DefaultButtonTextBox>
                    </td>
                    <td class="rightTD">
                        <div id="txtAddVoteNameTip" runat="server"></div>
                        <Hishop:ValidateTarget ID="ValidateAddName" ContainerId="ValidatorContainer" runat="server" ControlToValidate="txtAddVoteName" Description="<%$ Resources:Votes,IDS_Help_Name %>" Nullable="false">
                            <Validators>
                                <Hishop:InputStringClientValidator ErrorMessage="<%$ Resources:Votes, IDS_Help_Name %>" LowerBound="1" UpperBound="100" />
                            </Validators>
                        </Hishop:ValidateTarget>		            
                    </td>
                </tr>
                <tr>
                    <td class="leftTD"><nobr>
                        <asp:Label id="Label3" runat="server"  Text="<%$ Resources:Votes,IDS_Header_IsBackup%>"></asp:Label></nobr>
                    </td>
                    <td class="rightTD"><asp:CheckBox ID="checkIsBackup" runat="server" /></td>
                    <td class="rightTD">
                        <div class="msgNormal">
                            <asp:Literal ID="lblIsBackup" runat="server" Text="<%$Resources:Votes,IDS_help_Backup %>" />
                        </div>
                    </td>
                </tr>
                <tr>
                    <td class="leftTD">
                        <nobr><asp:Label ID="Label5" runat="server" Text="<%$Resources:Votes,IDS_Label_MaxCheck %>"></asp:Label></nobr>
                    </td>
                    <td class="rightTD">
                        <asp:TextBox ID="txtMaxCheck" runat="server" Text="1" />
                    </td>
                    <td class="rightTD">
                        <div id="txtMaxCheckTip" runat="server"></div>
                        <Hishop:ValidateTarget ID="validateMaxCheck"  ContainerId="ValidatorContainer" runat="server" ControlToValidate="txtMaxCheck" 
                            Description="<%$ Resources:Votes, IDS_help_Max%>" Nullable="false">
                            <Validators>
                                <Hishop:InputNumberClientValidator ErrorMessage="<%$ Resources:Votes, IDS_help_Max%>" />
                                <Hishop:NumberRangeClientValidator ErrorMessage="<%$ Resources:Votes, IDS_Invalid_VoteMax_FormatError%>" MinValue="1"  MaxValue="100" />
                            </Validators>
                        </Hishop:ValidateTarget> 
                    </td>
                </tr>
                <tr>
                <!-- 投票选项 -->
                <td class="leftTD">
                    <asp:Label ID="lblValues" runat="server" Text="<%$ Resources:Votes,IDS_FromField_lblValue %>"></asp:Label></td>
                <td class="rightTD">
                    <asp:TextBox ID="txtValues" runat="server" Width="300" Height="100" TextMode="MultiLine"></asp:TextBox>
                </td>
                <td class="rightTD">
                    <div id="txtValuesTip" runat="server">
                    </div>
                    <Hishop:ValidateTarget ID="ValidateTargetValues" runat="server" ControlToValidate="txtValues"
                        ContainerId="ValidatorContainer" Description="<%$ Resources:Votes,IDS_FromField_lblValueHelp %>"
                        Nullable="false">
                        <Validators>
                            <Hishop:InputStringClientValidator  UpperBound="200" ErrorMessage="<%$ Resources:Votes,IDS_FromField_lblValueHelp %>" />
                        </Validators>
                    </Hishop:ValidateTarget>
                </td>
            </tr>
                <tr>
                    <td class="bottonLeftTD">&nbsp;</td>
                    <td class="rightTD">
                        <asp:Button ID="btnAddVote"  runat="server" Text="<%$ Resources:Votes, IDS_Button_AddVote %>"  OnClientClick="return PageIsValid()"  CssClass="inp_L1"/>                        
                    </td>
                    <td class="rightTD">&nbsp;</td>
                </tr>
            </table>
</div>

<script>
	var isIE = !!document.all;
	function errorEventTable(tableObject){		
	    tableObject.runat="server";	
		if (isIE){
			var nextNodeObject = tableObject.parentNode.parentNode.nextSibling;
		}
		else{
			var nextNodeObject = tableObject.parentNode.parentNode.nextSibling.nextSibling;
		}
		(nextNodeObject.style.display == "none")?nextNodeObject.style.display = "":nextNodeObject.style.display = "none";
		(nextNodeObject.style.display == "none")?tableObject.src = '<%= Globals.ApplicationPath + "/utility/pics/plus.gif" %>':tableObject.src ='<%= Globals.ApplicationPath + "/utility/pics/minus.gif" %>';
	}
</script>
            </SkinTemplate>
            </Hishop:Votes>
            
        </div>
        <br />
        <div class="botCopyInfo">
            <hr style="width:500px;" />
            <Hishop:SiteCopyright runat="server" />
        </div>
        <br />
        <Hishop:ValidatorContainer runat="server" ID="ValidatorContainer" />
    </form>
</body>
</html>
