<%@ Page Language="C#" MasterPageFile="~/Admin/MainPage.Master"  AutoEventWireup="true" CodeBehind="templet_list.aspx.cs" Inherits="PPFOR.Admin.DesignCenter.Publish.templet_list"  Title="模板列表"%>

<asp:Content ID="Content1" ContentPlaceHolderID="PPFOR_mainContent" runat="server">   
<script src="../../JS/gridview.js" type="text/javascript"></script>  
<script src="../../JS/popupWindow.js" type="text/javascript"></script> 
<script language="javascript" type="text/javascript">
function showCreateNewFolder()
{
    var objNew=document.getElementById("displayCreateFolder");
    if(objNew!=null)
    {
        if(objNew.style.display=="")
        {
            objNew.style.display="none";
        }else{
            objNew.style.display="";
            document.getElementById("<%= PPFOR_newFolderName.ClientID %>").value='';
        }
    }
}
function checkIsSelectedAny(formname,msg)
{
     var objCheckBox;
     var myform=document.forms.namedItem(formname);
     if(myform!=null && myform.length>0)
     {
        msg=msg||false;
         for(var i=0;i<myform.length;i++)
         {              
             if(myform.elements[i].type=="checkbox" && myform.elements[i].checked)
             {
                 return !msg||confirm(msg);
             }
         }        
     }
     alert("请先选择目录或文件！");
     return false;
}
function openWindowForEdit(url)
{
    popupWindow(url, "90%", "90%");
}
</script>
<form id="form1" runat="server">
 <table width="100%" border="0" cellpadding="0" cellspacing="0" class="fortable">
    <tr>
        <td>
            <asp:Button ID="PPFOR_copyTemplet" CssClass="inputbutton" runat="server" Text="拷贝" OnClick="PPFOR_copyTempletClick" />
            <asp:Button ID="PPFOR_deleteTemplet" CssClass="inputbutton" runat="server" Text="删除" OnClick="PPFOR_deleteTempletClick" />
            <input name="create" type="button" class="inputbutton" onclick="showCreateNewFolder()" onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'" value="创建目录" />
            <asp:Button ID="PPFOR_uploadFile" Enabled="false" CssClass="inputbutton" runat="server" Text="导入文件"/>
        </td>
    </tr>
    <tr id="displayCreateFolder" style="display:none;">
        <td>新目录名称：<asp:TextBox ID="PPFOR_newFolderName" runat="server"></asp:TextBox>        
        <asp:Button ID="PPFOR_createNewFolder" CssClass="inputbutton" runat="server" Text="确定" ValidationGroup="createFolder" OnClick="PPFOR_createNewFolderClick"/>        
        <input type="button" class="inputbutton" onmouseover="this.className='inputbutton_hover'" onmouseout="this.className='inputbutton'" onclick="showCreateNewFolder()" value="取消" />
             <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="PPFOR_newFolderName" runat="server" ValidationGroup="createFolder" ValidationExpression='^[^/\\<>*?:"|]{1,100}$' Display="Dynamic" SetFocusOnError="true" >不允许包含以下字符之一：/\:<>?*"|</asp:RegularExpressionValidator>
             <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="PPFOR_newFolderName" ValidationGroup="createFolder" Display="Dynamic" SetFocusOnError="true">目录名不允许为空</asp:RequiredFieldValidator>
     </td>
    </tr>
    <tr>
    <td valign="middle">
        当前目录：<asp:Label ID="PPFOR_currentPath" runat="server" Font-Names="Verdana" Font-Size="12px"></asp:Label><br />
    </td>       
    </tr>
    </table>
    <br />
        <asp:GridView ID="GridView1" runat="server"  CssClass="forgridview" DataKeyNames="Name" AutoGenerateColumns="False" Width="100%" OnRowCommand="GridView1_RowCommand" OnRowCancelingEdit="GridView1_RowCancelEdit" OnRowEditing="GridView1_RowEditing" OnRowDeleting="GridView1_RowDelete" OnRowUpdating="GridView1_RowUpdate" OnRowDataBound="GridView1_RowDataBound"  AllowPaging="false" CellPadding="0" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="0px"  EmptyDataText="还没有添加模板文件">
            <Columns>
                <asp:TemplateField HeaderStyle-Font-Bold="false" ItemStyle-BorderWidth="1px">
                    <ItemTemplate>
                        <asp:CheckBox ID="PPFOR_selectFolder" runat="server" />
                    </ItemTemplate>
                    <HeaderTemplate>
                        <asp:CheckBox ID="PPFOR_selectAll" runat="server" />
                    </HeaderTemplate>
                    <ItemStyle Width="3%" Wrap="False" HorizontalAlign="Center" />
                </asp:TemplateField>
                <asp:TemplateField HeaderText="名称" HeaderStyle-Font-Bold="false">
                    <ItemTemplate>
                        <asp:LinkButton ID="PFPOR_open" runat="server" CommandName="open" CommandArgument='<%# Eval("Name") %>' Text='<%# Eval("Name") %>'></asp:LinkButton>
                    </ItemTemplate>                    
                    <EditItemTemplate>
                    <asp:TextBox Text='<%# Eval("Name") %>' ID="PFPOR_newName" runat="server"></asp:TextBox>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="PFPOR_newName" runat="server" ValidationExpression='^[^/\\<>*?:"|]{1,100}$' Display="Dynamic" SetFocusOnError="true" ><br />不允许包含以下字符之一：/\:<>?*"|</asp:RegularExpressionValidator>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="PFPOR_newName" Display="Dynamic" SetFocusOnError="true"><br />目录或文件名不允许为空</asp:RequiredFieldValidator>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="Type" ReadOnly="true" HeaderText="类型" HeaderStyle-Font-Bold="false"  HeaderStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="center" Wrap="False" />                    
                </asp:BoundField>
                <asp:BoundField ReadOnly="true" DataField="Size" HeaderText="大小(KB)" HeaderStyle-Font-Bold="false"  HeaderStyle-HorizontalAlign="Center">
                    <ItemStyle HorizontalAlign="center" Wrap="False" />
                </asp:BoundField>
                <asp:BoundField ReadOnly="true" DataField="LastWriteDate" HeaderText="最后修改时间" HeaderStyle-Font-Bold="false"  >
                    <ItemStyle Wrap="False" />
                </asp:BoundField>
                <asp:CommandField HeaderText="操作" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Font-Bold="false"  ShowEditButton="true" ShowDeleteButton="true" DeleteText="删除" EditText="改名" UpdateText="确定" CancelText="取消" />
            </Columns>
             <FooterStyle BackColor="#990000" ForeColor="White" /> 
             <RowStyle Wrap="False" Font-Bold="false" BackColor="#ffffff"/> 
             <HeaderStyle BackColor="#F5F5F5" Font-Bold="false" ForeColor="#000000" />
             <AlternatingRowStyle BackColor="#F5F5F5" />
        </asp:GridView>
</form>
</asp:Content>