<%@ page language="C#" autoeventwireup="true" inherits="Admin_FunctionEdit, App_Web_qxuvifui" %>


<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>

<!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 id="Head1" runat="server">
    <title>功能编辑</title>
    <link href="../CSS/All.css" rel="stylesheet" type="text/css" />
    <script src="../JS/jquery.uploadify-v2.1.0/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../JS/Calendar.js" type="text/javascript"></script>
    <script src="../JS/jquery.MultiFile.pack.js" type="text/javascript"></script>  
    <link href="../JS/jquery.uploadify-v2.1.0/example/css/default.css" rel="stylesheet" type="text/css" />
    <link href="../JS/jquery.uploadify-v2.1.0/uploadify.css"  rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../JS/jquery.uploadify-v2.1.0/swfobject.js">
    </script>
    <script type="text/javascript" src="../JS/jquery.uploadify-v2.1.0/jquery.uploadify.v2.1.0.min.js">
    </script>
    <style>
        .division th {
        background:none repeat scroll 0 0 #E2E8EB;
        border-right:1px solid #CCCCCC;
        font-size:10pt;
        text-align:right;
        font-weight:500;
        width:140px;

        }
        .division {
            background:none repeat scroll 0 0 #FFFFFF;
            border-color:#CCCCCC #BEC6CE #BEC6CE #CCCCCC;
            border-style:solid;
            border-width:1px 2px 2px 1px;
            line-height:150%;
            padding:5px;
            white-space:normal;
            margin:5;
       }
       .division td, .division th{
            border-color:#FFFFFF #DBE2E7 #DDDDDD #FFFFFF;
            border-left:1px solid #FFFFFF;
            border-right:1px solid #DBE2E7;
            border-style:solid;
            border-width:1px;

       }
       h5{
        margin:0;
        padding:5px;
        background-color:#E2E8EB;
        font-size:11pt;
       }
       .division .font1{
        font-weight: bold;
        color: #696969
       }
     
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div >
            <h5>
                上传附件列表</h5>
            <div class="division">
                <table border="0" cellpadding="0" cellspacing="0"  width="100%">
                    <tr>
                        <td>
                            
                            <div>
                                <div id="fileQueue" style="width: 406px; height: 138px">
                                </div>
                                <input id="uploadify" name="uploadify" type="file" />
                                <p>
                                    <button class="btn" onclick="javascript:$('#uploadify').uploadifyUpload()">上传</button>
                                    <button class="btn" style=" margin-left:30px" onclick="javascript:$('#uploadify').uploadifyClearQueue()">取消上传</button>
                                    
                                </p>
                            </div>
                           
                            <div style="border: 3px solid rgb(153, 153, 153);  padding:10px" >
                                <asp:Repeater ID="rptAccessory" runat="server" EnableViewState="false" >
                                <HeaderTemplate> 
                                <table id="AccessoryList" border="0" cellpadding="0" cellspacing="0"  width="100%">
                                
                                </HeaderTemplate>
                                 <ItemTemplate>
                                 <tr id="item_<%#Eval("CID") %>" >
                                 <td style=" border-bottom:dotted 1px #543419">
                                  <a href='<%=this.ResolveUrl("~/ProjectAccessory/") %><%#Eval("FilePath") %>' ><%#Eval("FileName") %></a>
                                     <input  style=" width:20px" type="button" value="x" class="btn"  onclick="deleteAccessory('<%#Eval("CID") %>','<%#Eval("FileName") %>')" />
                                 <br />
                                 </td>
                                 </tr>
                                 </ItemTemplate>
                                 <FooterTemplate>
                                 </table>
                                 </FooterTemplate>
                                </asp:Repeater>
                            </div>
                          
                        </td>
                        <td>
                        
                    </tr>
                </table>
            </div>
            
            <h5>
                描述</h5>
            <div class="division">
                <table border="0" cellpadding="0" cellspacing="0"  width="100%">
                    <tr>
                        <th style="width: 96px">
                            &nbsp;功能描述：</th>
                        <td>
                            <asp:TextBox ID="txtBeizhu" runat="server" MaxLength="255" Width="400px"></asp:TextBox></td>
                    </tr>
                </table>
            </div>
            <h5>功能需求</h5>
            <div class="division">
                <table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td>
                            <FCKeditorV2:FCKeditor ID="fckEidter" runat="server" Height="400px">
                            </FCKeditorV2:FCKeditor>
                        </td>
                    </tr>
                </table>
            </div>
        <div align="center" style="width: 100%; background-color: lightgrey">
            &nbsp;
            <asp:Button ID="btnSubmit" runat="server" CssClass="btn" OnClick="btnSubmit_Click" Text="保存并返回"
                Width="115px" />
            <asp:Button ID="btnback" runat="server" CssClass="btn" OnClick="btnback_Click" Text="返回"
                Width="115px" /></div>
            
        </div>
    </form>
    

<script type="text/javascript" > 
$(function(){ 
     $("#uploadify").uploadify({
                'uploader': '../JS/jquery.uploadify-v2.1.0/uploadify.swf',
                'script': 'ashx/UploadHandler.ashx',
                'cancelImg': '../JS/jquery.uploadify-v2.1.0/cancel.png',
                'queueID': 'fileQueue',
                'auto': false,
                'multi': true,
                'scriptData': {'cid':'<%=ViewState["cid"] %>'},
                'onComplete':function (event,queueId,fileObj,response,data)
                    {
                         $("#AccessoryList").append(response);
                    }
            });
});

function deleteAccessory(cid,filename){
 
    $.ajax({
           type: "POST",
           dataType:"text",
           processData:false,
           async:false,
           url: "ashx/FunctionAccessoryDelete.ashx",
           data: "cid="+cid+"&filename="+escape(filename),
           success: function(msg){
              if(msg=="-1"){
                alert("删除失败！");
              }else if(msg=="2"){
                alert("已删除数据记录但未能删除该文件！");
                 $("#item_"+cid).remove();

     
              }else{
                $("#item_"+cid).remove();
              }
           },
           error:function (XMLHttpRequest, textStatus, errorThrown) { 
            alert("加载功能需求列表失败 "+textStatus +" "+errorThrown+" "+XMLHttpRequest);
           }
    }); 
    
}
</script>
</body>
</html>
