<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Admin/AdminMain.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcEnterprise.Models.CustomFormData.RowModel>>" %>

<asp:Content ID="Content0" ContentPlaceHolderID="HeadContent" runat="server">
    <link href="../../Content/Skin/Pager.css" rel="stylesheet" type="text/css" />
    <script src="../../Scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/Admin.js" type="text/javascript"></script>
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    数据列表
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%
    var searchText = Request.QueryString["searchText"];
	var tableName = Request.QueryString["tablename"];
%>
<div id="ajaxLoading">loading...</div>
<div id="requestAjaxText">
    <form action="" id="searchForm" method="get">
    <label>查找：</label>
	<input type="hidden" name="tablename" value="<%= tableName %>" />
    <input type="text" name="searchText" id="searchText" /> <input type="submit" value="查找" />
    <% if (!string.IsNullOrEmpty(searchText))
       {%>
    <input type="submit" value="全部显示" />
    <%}%>
    </form>
    <form method="post" id="MultiOperationForm" action="?action=MultiOperation&tablename=<%= tableName %>">
    <table>
        <tr>
            <th>
                信息
            </th>
            <th style="width: 60px">
                操作
            </th>
            <th style="width: 30px">
                <input type="checkbox" id="cb_ReverseSelection" />
            </th>
        </tr>
        <%
            foreach (var item in Model)
            { %>
		<tr>
			<td>
				<%
				var l = item.Content.IndexOf("|ffcms.com|");
				item.Content = item.Content.Substr(0, l).Replace(":ffcms.com:","：");
				%>
				<a href="<%= Url.Action("CustomFormDataView", new { ID = item.ID,tableName=tableName })%>" title="查看详细信息"><%= Html.Encode(item.Content,searchText) %></a>
			</td>
			<td>
				<a href="<%= Url.Action("CustomFormDataView", new { ID = item.ID,tableName=tableName })%>" title="查看详细信息">查看</a>
				<a href="javascript:;" onclick="deleteModel(this,'<%= item.ID %>');">删除</a>
			</td>
			<td>
				<input type="checkbox" name="cb_id" value="<%= item.ID %>" />
			</td>
		</tr>
        <% 
			} %>
        <tr>
            <td colspan="8" style="text-align: right">
                执行
                <select name="OpType">
                    <option value="2">删除</option>
                </select>
                <input type="submit" value="操作" />
            </td>
        </tr>
    </table>
    </form>
    <%= Html.Pager(3) %>
</div>
<br class="clearfloat" />
<script src="../../Scripts/jquery.ReverseSelection.js" type="text/javascript"></script>
<script type="text/javascript">
	$.initReverseSelection(); //初始反选功能
	$(function () {
		$("#MultiOperationForm").submit(function () {
			if ($("select[name='OpType']").val() == 2) {
				if (!confirm("确认删除？")) {
					return false;
				}
			}
		});
	});
</script>
</asp:Content>

