<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Dairy.aspx.cs" Inherits="wormadmin_Diary" validateRequest="false" %>



<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>日记管理</title>
	<link rel="stylesheet" href="css/content.css" type="text/css" />
    <script language="javascript" type="text/javascript">
    function expandcollapse(obj,row)
    {
        var div = document.getElementById(obj);
        var img = document.getElementById('img' + obj);
        var pl = document.getElementById('showpl');
        
        if (div.style.display == "none")
        {
            div.style.display = "block";
            pl.value=obj;
            if (row == 'alt')
            {
                img.src = "images/minus.gif";
            }
            else
            {
                img.src = "images/minus.gif";
            }
            img.alt = "关闭";
        }
        else
        {
            div.style.display = "none";
            pl.value="";
            if (row == 'alt')
            {
                img.src = "images/plus.gif";
            }
            else
            {
                img.src = "images/plus.gif";
            }
            img.alt = "展开";
        }
    } 
    function showoff()
    {
        var pl = document.getElementById('showpl');
        var showdiv=document.getElementsByTagName('div');
        
        for(var i=1; i<showdiv.length; i++)   
        {
          if(showdiv[i].id==pl.value)
          {
          showdiv[i].style.display="block";
          }
        }
    }
    </script>

</head>
<body onload="showoff()">
    <form id="form1" runat="server">
      <table width="90%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="25"><strong>日记管理列表:<asp:TextBox ID="tsql" runat="server" style="display:none;"></asp:TextBox></strong></td>
        </tr>
      </table>
      <asp:TextBox ID="showpl" runat="server" Text='' style="display:none;"></asp:TextBox>
      <table width="90%" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td colspan="3">
              <asp:GridView ID="myGrid" runat="server" SkinId="blueGrid"
                   DataKeyNames="id" Width="825px"  OnRowDeleting="mydelete" AutoGenerateColumns="False" OnRowEditing="myedit" OnRowUpdating="myupdate" OnRowCancelingEdit="mycancel" OnRowDataBound="plbound">
                 
                  <Columns>
                      <asp:TemplateField HeaderText="评论" >
                          <ItemTemplate>
                               <a href="javascript:expandcollapse('div<%# Eval("id") %>', 'one');">
                               <img id="imgdiv<%# Eval("id") %>" alt="单击显示id为<%# Eval("id") %>的评论"  width="9px" border="0" src="images/plus.gif"/>
                               </a>
                               <asp:Label ID="idtemp" runat="server" Text='<%# Eval("id") %>' Visible="false"></asp:Label>
                          </ItemTemplate>
                      </asp:TemplateField>
                      
                      <asp:BoundField DataField="id" HeaderText="id" ReadOnly="True" SortExpression="id" />  
                       
                      <asp:TemplateField HeaderText="日记标题">
                      <ItemTemplate><%# strcut(Eval("dtitle").ToString(), 10)%></ItemTemplate>
                      <EditItemTemplate>
                        <asp:TextBox ID="dtitle" Text='<%# Eval("dtitle") %>' Width="100px" Height="13px" runat="server"></asp:TextBox>
                      </EditItemTemplate>
                      <FooterTemplate>
                        <asp:TextBox ID="dtitle" Text='' runat="server"></asp:TextBox>
                      </FooterTemplate>
                      </asp:TemplateField>   
                      
                      <asp:TemplateField HeaderText="日记分类">
                      <ItemTemplate><%# Eval("dclass")%></ItemTemplate>
                      <EditItemTemplate>
                        <asp:TextBox ID="tempclass" Text='<%# Eval("dclass") %>' Width="120px" Height="13px" runat="server" Visible="false"></asp:TextBox>
                          <asp:DropDownList ID="dlclass" runat="server">
                          </asp:DropDownList>
                      </EditItemTemplate>
                      <FooterTemplate>
                        <asp:TextBox ID="dBriefly" Text='' runat="server"></asp:TextBox>
                      </FooterTemplate>
                      </asp:TemplateField>
                      
                      <asp:TemplateField HeaderText="浏览次数">
                      <ItemTemplate><%# Eval("dbit")%></ItemTemplate>
                      <EditItemTemplate>
                        <asp:TextBox ID="dbit" Text='<%# Eval("dbit") %>' Width="40px" Height="13px" runat="server"></asp:TextBox>
                      </EditItemTemplate>
                      <FooterTemplate>
                        <asp:TextBox ID="dbit" Text='' runat="server"></asp:TextBox>
                      </FooterTemplate>
                          <ItemStyle Width="70px" />
                      </asp:TemplateField>
                      
                      <asp:TemplateField HeaderText="发表日期">
                      <ItemTemplate><%# short_time(Eval("dtime"))%></ItemTemplate>
                      <EditItemTemplate>
                        <asp:TextBox ID="dtime" Text='<%# short_time(Eval("dtime")) %>' Width="80px" Height="13px" runat="server"></asp:TextBox>
                      </EditItemTemplate>
                      <FooterTemplate>
                        <asp:TextBox ID="dtime" Text='' runat="server"></asp:TextBox>
                      </FooterTemplate>
                      </asp:TemplateField>
                      
                      <asp:TemplateField HeaderText="发布人">
                      <ItemTemplate><%# Eval("dwriter")%></ItemTemplate>
                      <EditItemTemplate>
                        <asp:TextBox ID="dwriter" Text='<%# Eval("dwriter") %>' Width="60px" Height="13px" runat="server"></asp:TextBox>
                      </EditItemTemplate>
                      <FooterTemplate>
                        <asp:TextBox ID="dwriter" Text='' runat="server"></asp:TextBox>
                      </FooterTemplate>
                      </asp:TemplateField>
                      
                      <asp:TemplateField HeaderText="日记置顶">
                      <ItemTemplate><asp:CheckBox ID="top" runat="server" Text="置顶" Enabled=false Checked=<%#  Convert.ToBoolean(Eval("dtop"))%>/></ItemTemplate>
                      <EditItemTemplate>
                          <asp:CheckBox ID="top" runat="server" Text="置顶" Checked=<%#  Convert.ToBoolean(Eval("dtop"))%>/>                      </EditItemTemplate>
                      <FooterTemplate>
                        <asp:TextBox ID="dtop" Text='' runat="server"></asp:TextBox>
                      </FooterTemplate>
                      </asp:TemplateField>
                      
                      <asp:CommandField HeaderText="快速编辑" ShowEditButton="True" />
                      
                      <asp:TemplateField HeaderText="内容编辑">
                      <ItemTemplate>
                          <a href="dairy_revise.aspx?myGridid=<%# Eval("id") %>">进入编辑</a>
                      </ItemTemplate>
                      <EditItemTemplate>
                          <a href="dairy_revise.aspx?myGridid=<%# Eval("id") %>">进入编辑</a>
                      </EditItemTemplate>
                      </asp:TemplateField>
                      
                      <asp:TemplateField HeaderText="删除">
                      <HeaderTemplate>
                          &nbsp;<asp:CheckBox ID="delall" runat="server" OnCheckedChanged="delall_CheckedChanged" Text="删除" AutoPostBack="True" />
                      </HeaderTemplate>
                      <ItemTemplate><asp:CheckBox ID="del" runat="server" Text=""/></ItemTemplate>
                      <EditItemTemplate>
                          <asp:CheckBox ID="del" runat="server" />
                      </EditItemTemplate>
                      <FooterTemplate>
                        <asp:TextBox ID="del" Text='' runat="server"></asp:TextBox>
                      </FooterTemplate>
                      </asp:TemplateField>
                      
                    <asp:TemplateField>
			        <ItemTemplate>
			            <tr>
                            <td colspan="100%">
                                <div id="div<%# Eval("id") %>" style="display:none;position:relative;left:15px;OVERFLOW: auto;WIDTH:97%" >
                                    <asp:GridView id="plGrid" runat="server" AutoGenerateColumns="False" Width="700px" DataKeyNames="id" SkinId="blueGrid" OnRowDeleting="pldelete" OnRowEditing="pledit" OnRowCancelingEdit="plcancel" OnRowUpdating="plupdating">
                                        <RowStyle BackColor="Gainsboro" />
                                        <AlternatingRowStyle BackColor="White" />
                                        <HeaderStyle BackColor="#0083C1" ForeColor="White"/>
                                        <FooterStyle BackColor="White" />
                                        <Columns>
                                            <asp:TemplateField HeaderText="ID" SortExpression="id">
                                                <ItemTemplate>
                                                    <asp:Label ID="keyid" Text='<%# Eval("id") %>' runat="server"></asp:Label>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <asp:Label ID="keyid" Text='<%# Eval("id") %>' runat="server"></asp:Label>
                                                </EditItemTemplate>
                                            </asp:TemplateField>
                                            
                                            <asp:TemplateField HeaderText="评论者" SortExpression="drwriter">
                                                <ItemTemplate>
                                                     <%# Eval("drwriter")%>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="drwriter" Text='<%# Eval("drwriter")%>' runat="server"></asp:TextBox>
                                                </EditItemTemplate>
                                            </asp:TemplateField>
                                            
                                            <asp:TemplateField HeaderText="评论内容" SortExpression="drcontent">
                                                <ItemTemplate>
                                                    <%# strcut(Eval("drcontent").ToString(), 8)%>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="drcontent" Text='<%# Eval("drcontent")%>' runat="server"></asp:TextBox>
                                                </EditItemTemplate>
                                            </asp:TemplateField>
                                            
                                            <asp:TemplateField HeaderText="评论屏蔽" SortExpression="drunable">
                                                <ItemTemplate>
                                                    <asp:CheckBox ID="drunable" runat="server" Text="屏蔽" Checked='<%#  Convert.ToBoolean(Eval("drunable"))%>' Enabled="false"/>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <asp:CheckBox ID="drunable" runat="server" Text="屏蔽" Checked='<%#  Convert.ToBoolean(Eval("drunable"))%>'/>
                                                </EditItemTemplate>
                                            </asp:TemplateField>
                                            
                                            <asp:TemplateField HeaderText="发表时间" SortExpression="drtime">
                                                <ItemTemplate>
                                                    <%# Eval("drtime")%>
                                                </ItemTemplate>
                                                <EditItemTemplate>
                                                    <asp:TextBox ID="drtime" Text='<%# Eval("drtime")%>' runat="server"></asp:TextBox>
                                                </EditItemTemplate>
                                            </asp:TemplateField>
                                            
                                            <asp:CommandField HeaderText="快速编辑" ShowEditButton="True" />
                                            
			                                <asp:TemplateField HeaderText="删除">
                                                 <ItemTemplate>
                                                    <asp:LinkButton ID="pldel" CommandName="Delete" runat="server" OnClientClick="javascript:{if(confirm('是否确认删除此留言?')){return true;}return false;}">删除</asp:LinkButton>
                                                 </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                   </asp:GridView>
                                   
                                </div>
                             </td>
                        </tr>
			        </ItemTemplate>			       
			        </asp:TemplateField>
                      
                  </Columns>
              </asp:GridView>
              
              </td>
        </tr>
        <tr>
          <td width="190" style="padding-top:10px;">
          <webdiyer:aspnetpager id="AspNetPager1" runat="server" custominfohtml="当前  <font color='red'><b>%CurrentPageIndex%</b></font>/%PageCount%页&nbsp;&nbsp;记录位置:%StartRecordIndex%-%EndRecordIndex%"
            custominfotextalign="Center" firstpagetext="首页" horizontalalign="Center" inputboxstyle="width:19px"
            lastpagetext="尾页" meta:resourcekey="AspNetPager1" nextpagetext="下页" onpagechanged="pagego"
            pagesize="12" prevpagetext="前页" showcustominfosection="Left" showinputbox="Always"
            shownavigationtooltip="True" style="font-size: 14px" width="400px" AlwaysShow="True"></webdiyer:aspnetpager></td>
          <td style="padding-left:10px; padding-top:10px; width: 34px;"><asp:Button ID="Button1" SkinID="blue" runat="server" OnClick="Button1_Click" Text="全选" />
          </td>
          <td width="422" style="padding-left:10px; padding-top:10px"><asp:Button ID="btdel" SkinID="blue" runat="server" Text="选中删除" OnClick="btdel_Click" OnClientClick="javascript:{if(confirm('删除日记会连同该日记的评论一起删除，是否确认删除此日记?')){return true;}return false;}" /></td>
        </tr>
      </table>
    </form>
</body>
</html>
