<%@ page language="C#" autoeventwireup="true" validaterequest="false" inherits="ColumnManage_ContentList, App_Web_o7zimql7" %>

<!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 runat="server">
    <title>栏目内容列表</title>
    <link rel="stylesheet" href="../style/Common.css" />
    <link rel="stylesheet" href="../Style/Dialog.css" />

    <script type="text/javascript" src="../Script/Common.js"></script>
    <script type="text/javascript">
var btnEdit, btnDelete;
var CheckBoxes=[];
function Page_Init()
    {
	btnDelete = $('btnDelete');

	var inputs = document.getElementsByTagName('INPUT');
	for( var i=0, j=0; i<inputs.length; i++ ){
	    var input= inputs[i];
	    if( input.type=='checkbox' && !input.onclick ){
	        CheckBoxes[j++] = input;
	        input.onclick = FreshButton;
	    }
	}
    }

var SiteName, ColName;
function Page_Load()
    {
	SiteName = Common.GetQueryString('sitename');
	ColName = Common.GetQueryString('colname');

	FreshButton();
    }
function FreshButton()
    {
	var count = 0;
	for( var i=0; i<CheckBoxes.length; i++ ){
	    var chk = CheckBoxes[i];
	    if( chk && chk.checked ) {
	        count++;
	        if( count >= 2 ) break;
	    }
	}
	btnDelete.disabled = true;
	if( count>=1 ){
	    btnDelete.disabled = false;
	}
    }
function btnAdd_Click()
    {
	var url = new UrlText( '../PartConfig/ContentEdit.aspx', ['optype', 'addcontent'] );
	url.Add( ['colname', ColName], ['sitename', SiteName], 'uni' );
	var ret = Common.ShowDialog( 3, url.Text, null, {width:760, height:500, offset:true} );
//	if( /^ok/i.test(ret) ){
//	    location.reload( true );
//	    alert(ret)
//	}
    }
//, EditRow = -2;
//	        var hfRec = chk.nextSibling.nextSibling;
//	        EditRow = hfRec.value;
//	btnEdit = $('btnEdit');
//	btnEdit.disabled = true;
//	    if( count == 1 )
//	        btnEdit.disabled = false;
//function btnEdit_Click()
//    {
//	var url = new UrlText( 'ContentEdit.aspx', ['optype', 'editcontent'] );
//	url.Add( ['colname', ColName], ['sitename', SiteName], ['recid', EditRow ], 'uni' );
//	var ret = Common.ShowDialog( 1, url.Text, null, {width:760, height:500, offset:true} );
//	if( /^ok/i.test(ret) )
//	    location.reload( true );
//    }
//	alert( hfRec.nodeName+'   '+hfRec.value );	
function btnRowEdit_Click( obj )
    {
	var hfRec = obj.parentNode.parentNode.childNodes[0].childNodes[2];
	var row = hfRec.value;
	
	var url = new UrlText( '../PartConfig/ContentEdit.aspx', ['optype', 'editcontent'] );
	url.Add( ['colname', ColName], ['sitename', SiteName], ['recid', row ], 'uni' );
	var ret = Common.ShowDialog( 3, url.Text, null, {width:760, height:500, offset:true} );
//	if( /^ok/i.test(ret) ){
//	    alert(ret)
//	    location.reload( true );
//	    window.Reload();
//	}
    }
    </script>
</head>
<body><form id="form1" runat="server">

    <asp:Literal ID="ltrScript" runat="server" />

    <div class="TopArea">
        <h1>已绑定栏目的内容
            <asp:Label ID="lbColumnPath" runat="server" Text="[]" CssClass="Notes" />
        </h1>
        <div class="HeadLogo"></div>
    </div>

    <div class="ContentArea">
        <asp:GridView ID="gvContentList" runat="server" CellPadding="1"  CellSpacing="1"  CssClass="DataTable" PageSize="10"
                OnRowCreated="gvContentList_RowCreated" OnPageIndexChanging="gvContentList_PageIndexChanging" >
            <Columns>
                <asp:TemplateField HeaderText="">
                    <HeaderTemplate>
                        <asp:CheckBox ID="allCheck" runat="server" OnCheckedChanged="allCheck_CheckedChanged" AutoPostBack="True" />
                    </HeaderTemplate>
                    <ItemTemplate >
                        <asp:CheckBox ID="ItemCheck" runat="server"/>
                        <input id="hfRecId" type="hidden" runat="server" value='<%# DataBinder.Eval(Container.DataItem,"索引标识")%>'  /> 
                    </ItemTemplate>
                    <ItemStyle CssClass="checkCol" />
                </asp:TemplateField>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:Button ID="btnRowEdit" runat="server" Text="编辑" OnClientClick="btnRowEdit_Click(this);" OnClick="btnRowEdit_Click" />
                    </ItemTemplate>
                    <ItemStyle Width="20"/>
                </asp:TemplateField>
            </Columns>   
            <AlternatingRowStyle CssClass="Alternating" />
        </asp:GridView>

        <div>
            <asp:Button ID="btnAdd" runat="server" CssClass="Button" Text="添加内容" OnClientClick="btnAdd_Click();" OnClick="btnAdd_Click" Enabled="false" />
            <asp:Button ID="btnDelete" runat="server" CssClass="Button" Text="删除内容" OnClientClick="return confirm('您确认要删除这些吗?')" OnClick="btnDelete_Click" Enabled="false" />
            <%--<input id="btnAdd" type="button" value="添加内容" class="Button" onclick="btnAdd_Click();" disabled="disabled" runat="server" />--%>
            <%--<input id="btnEdit" type="button" value="编辑内容" class="Button" onclick="btnEdit_Click();" disabled="disabled" />--%>
            <%--<asp:Button ID="btnEdit" runat="server" CssClass="Button" Text="编辑内容" OnClick="btnEdit_Click" Enabled="false" />--%>
            <%--<asp:Button ID="btnHide" runat="server" CssClass="Button" Text="隐藏内容" OnClick="btnHide_Click" Enabled="false"/>&nbsp;&nbsp;&nbsp;--%>
            <%--<asp:Button ID="btnExpose" runat="server" CssClass="Button" Text="显示内容"  OnClick="btnExpose_Click" Enabled="false" />--%>
        </div>
    </div>

    <div class="BottomArea">
        <span class="LeftBlock">
            <asp:Label ID="lbInfo" runat="server" ForeColor="Red"/>
        </span>
        <span class="RightBlock">
            <%--<asp:Button ID="btnSave" runat="server" CssClass="Button" Text="保存" OnClick="btnSave_Click" Enabled="true" />--%>
            <input id="btnCancel" class="Button" type="button" value="关闭" onclick="window.close();" />
        </span>
    </div>

</form>
<script type="text/javascript">
try{ Page_Init(); }catch(ex){;}
try{ if( Page_Resize ) window.onresize=Page_Resize; }catch(ex){;}
try{ if( Page_Load ) window.onload=Page_Load; }catch(ex){;}
</script>
</body>
</html>
        
