<%--
//-----------------------------------------------------------
// 文件名称: Picture_Picture_Manage.aspx
// 类 名 称: Picture_Picture_Manage.aspx.cs
// 描    述: 图片管理
// 修改标识: Modify By 钟治宇 2008-11-21
// 修改内容: 添加水印属性 ,方法,事件        //2008-11-21添加了一个控件
//-----------------------------------------------------------
--%>
<%@ page language="C#" autoeventwireup="true" inherits="V5Shop.Admin.Picture_Picture_Manage, V5Shop.Shop.Picture" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %>

<%@ Register Src="control/ManageHeader.ascx" TagName="ManageHeader" TagPrefix="uc3" %>
<%@ Register Src="control/PageBottom.ascx" TagName="PageBottom" TagPrefix="uc2" %>
<%@ Register Src="control/HiddenField.ascx" TagName="HiddenField" TagPrefix="uc1" %>
<%@ Register TagPrefix="V5Shop" Namespace="V5Shop.Control" Assembly="V5Shop.Control" %>
<!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/css.css" rel="stylesheet" type="text/css">
    <link href="css/css_list.css" rel="stylesheet" type="text/css">
    <link href="css/control.css" rel="stylesheet" type="text/css">
    <meta   http-equiv="PRAGMA"   content="no-cache" />   
    <script type="text/javascript" language="javascript" src="js/Common.js"></script>
<style type="text/css">
.zhuxiao { color:#087300}
.zhuxiao a:hover { color:#ff6600; text-decoration:none}
.zhuxiao a:active { color:#087300; text-decoration:underline}
.zhuxiao a:link { color:#087300; text-decoration:underline}
.zhuxiao a:visited { color:#000000; text-decoration:underline}
</style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <div id='dhtmltooltip' style="z-index:10001"><img id="tipimg" src="" /></div>
       <script language="javascript" src="js/showimg.js"></script>
    
        <div id="AlphaField" runat="server" style="background-color:#EEE;filter:alpha(opacity=50); position:absolute; left:0px; height:0px; width:100%; height:600px; z-index:9999; display:none; top: 0px;"></div>
        <uc3:ManageHeader ID="ManageHeader1" runat="server" />
        <img id="review" style="display:none; cursor:pointer; position:absolute; top:120px; left:50px;z-index:19999; border:solid 8px #000" alt="点击隐藏图片" onclick="HiddenImg(this)" />
        <div id="searcharea">
            <asp:Label ID="lblName" runat="server" Text="图片名称：" ForeColor="#4B6888" Font-Bold="true"></asp:Label>
                <asp:TextBox ID="txtName" Width="100px" runat="server"></asp:TextBox>

                <asp:Label ID="lblCategory" runat="server" Text="图片类别：" ForeColor="#4B6888" Font-Bold="true"></asp:Label>
                <asp:DropDownList ID="listCategory" runat="server"></asp:DropDownList>
                
                <asp:Button ID="btnSearch" runat="server" Text="查询" OnClick="btnSearch_Click" meta:resourcekey="btnSearchResource1" CssClass="button" />
            
        </div>
          
        <div id="content">
            <div id="tool">
              <input type="checkbox" class="checkbox" id="CheckAllBox" onclick="CheckAll()" /> 全选
        　    <asp:LinkButton ID="btnAdd" runat="server" ForeColor="#4B6888" OnClick="btnAdd_Click" meta:resourcekey="btnAddResource2" CausesValidation="false"><img src="images/icon/key_add.gif" /> 添加

</asp:LinkButton>
        　    <asp:LinkButton ID="btnEdit" runat="server" ForeColor="#4B6888" OnClick="btnEdit_Click" OnClientClick="return CheckEdit()" CausesValidation="false" meta:resourcekey="btnEditResource2"><img src="images/icon/key_edit.gif" /> 编辑</asp:LinkButton>
        　    <asp:LinkButton ID="btnDel" runat="server" ForeColor="#4B6888" OnClick="btnDel_Click" OnClientClick="return CheckDel()" CausesValidation="false" meta:resourcekey="btnDelResource2"><img src="images/icon/key_delete.gif" /> 删除</asp:LinkButton>
        　  </div>
            
            <asp:DataList ID="GridViewShow" Width="100%" runat="server" DataKeyField="id" GridLines="Horizontal" RepeatColumns="8" RepeatDirection="Horizontal">
                <ItemTemplate>
                    <table>
                        <tr>
                            <td>
                                <div><!--onclick="ddrivetip('../<%#Eval("Src")%>?d=' + Date(),'#ffffff')"   hideddrivetip();-->
                                    <img id="img_<%#Eval("ID") %>" style="cursor:pointer;" alt="点击查看原图" onclick="ddrivetip('../<%#Eval("Src")%>?d=' + Date(),'#ffffff')" onmousemove="this.parentNode.parentNode.style.backgroundColor='#006699'" onmouseout="this.parentNode.parentNode.style.backgroundColor='white';hideddrivetip();" width="88" height="88" />
                                    <script>document.getElementById('img_<%#Eval("ID") %>').src = '../<%#GetTmpImg(Eval("Src").ToString()) %>?d=' + Date();</script>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td align="center" style="width: 80px; border:1px gray dashed; background:#F9F9F9">
                                <input runat="server" class="checkbox" Value='<%# Eval("ID") %>' onmouseover="this.mouse='over'" onmouseout="this.mouse='out'" mouse="out" ID="CheckBoxID" type="checkbox" title='<%# "该图片上传于" + DataBinder.Eval(Container,"DataItem(date)","{0}") %>'>
                                <span title="<%#Eval("Name") %>" ><%#V5Shop.Common.utils.left(Eval("Name").ToString(),4) %></span>
                            </td>
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:DataList>
            
            <div>
                <div style="padding:10px 10px 30px; text-align:right; color:#000000"><font color="black">共 <asp:Label ID="lbmaxpage" runat="server" Text="1"></asp:Label> 页
                    , 当前第  <asp:Label ID="lbpage" runat="server" Text="1"></asp:Label>  页 &nbsp;&nbsp;
                    [ <asp:LinkButton ID="lbtnIndex" runat="server" Text="首页" style="color:Black;" OnClick="lbtnIndex_Click"></asp:LinkButton>
                    | <asp:LinkButton ID="lbtnLast" Enabled="false" runat="server" Text="上一页" style="color:Black;" OnClick="lbtnLast_Click"></asp:LinkButton>
                    | <asp:LinkButton ID="lbtnNext" runat="server" Text="下一页" style="color:Black;" OnClick="lbtnNext_Click"></asp:LinkButton>
                    | <asp:LinkButton ID="lbtnEnd" runat="server" Text="末页" style="color:Black;" OnClick="lbtnEnd_Click"></asp:LinkButton> ] 
                    页数:
                    <asp:DropDownList ID="ddlPageSelect" runat="server" OnSelectedIndexChanged="ddlPageSelect_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
			    </div>
            </div>
			<div style="padding:20px"><font color="#009900">此处图片不包括广告和模板图片，广告和模板图片可到“模板/标签系统”----<img src="images/arrow1b.gif" /><span class="zhuxiao"><a href="Template_Picture_Manage.aspx">模板图片管理</a></span></font></div>
            
            <asp:Panel ID="AddField" runat="server" Visible="false">
                <div align="center" style="position:absolute; left:200px; top:140px; border:solid 3px #B8C9D6; z-index:10000">
                <table width="340" cellpadding="0" cellspacing="0" bgcolor="#ffffff">
                  <tr>
                    <td height="30" colspan="2" style="height:36px; background:url(images/labelbg.gif)"><strong><font color="#000000">
                        <asp:Label ID="lblAdd" runat="server" Text="【 图片添加 】"></asp:Label>
                        <asp:Label ID="lblEdit" runat="server" Text="【 图片编辑 】" Visible="false"></asp:Label>
                    </font></strong></td>
                  </tr>
						<tr>
							<td height="30" align="right" bgcolor="#ffffff" style="width: 25%">
							<asp:Label ID="lblPictureCategory" runat="server" Text="图片类别：">
							</asp:Label>
							</td>
							<td bgcolor="#ffffff" align="left">
							<asp:DropDownList ID="listPictureCategory" runat="server">
							</asp:DropDownList>
							<input type="button" value="管理" onclick="window.location.href='Picture_Category_Manage.aspx'" class="button" />
							<span class="NeedMsg">*</span> </td>
						</tr>
						<tr>
							<td height="30" align="right" bgcolor="#ffffff" style="width: 25%">
							<asp:Label ID="Label1" runat="server" Text="图片名称：">
							</asp:Label>
							</td>
							<td bgcolor="#ffffff" align="left">
							<asp:TextBox ID="txtNameAdd" runat="server" MaxLength="20"></asp:TextBox>
							<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                                ControlToValidate="txtNameAdd" ErrorMessage="不能为空"></asp:RequiredFieldValidator>
							</td>
						</tr>
						<tr>
							<td height="30" align="right" bgcolor="#ffffff" style="width: 25%">
							<asp:Label ID="Label2" runat="server" Text="上传方式：">
							</asp:Label>
							</td>
							<td bgcolor="#ffffff" align="left">
							    <input type="radio" class="radio" name="UploadType" id="Type_1" value="0" onclick="HiddenField(this)" checked="checked" /><label for="Type_1">单图上传</label>
							    <input type="radio" class="radio" name="UploadType" id="Type_2" value="1" onclick="return HiddenField(this);" /><label id="Type_2_Label" for="Type_2">批量上传</label>
							</td>
						</tr>
						<tr id="UploadType_1">
							<td height="30" align="right" bgcolor="#ffffff" style="width: 25%">
							<asp:Label ID="lblSrc" runat="server" Text="上传图片：">
							</asp:Label>
							</td>
							<td bgcolor="#ffffff" align="left">
							<asp:FileUpload ID="fileSrc" runat="server" />
							<asp:Label ID="fileSrc_Text" runat="server" Text=""></asp:Label>
                            <input id="fileSrc_button" type="button" value="更改图片" class="button" visible="false" runat="server" onclick="ChangeImg('fileSrc', 'fileSrc_Text', 'fileSrc_button')" />
							</td>
						</tr>
						<tr id="UploadType_2" style="display:none;">
							<td height="30" align="right" bgcolor="#ffffff" style="width: 25%">
							<asp:Label ID="Label3" runat="server" Text="批量上传：">
							</asp:Label>
							</td>
							<td bgcolor="#ffffff" align="left">
							<input type="button" class="button" value="批量上传图片" onclick="OpenDialogLable('Template_Picture_Upload_Dialog.aspx',600,600)" />
							</td>
						</tr>
						<tr>
							<td height="30" align="right" bgcolor="#ffffff" style="width: 25%">
							<asp:Label ID="lblDescritpion" runat="server" Text="简单描述：">
							</asp:Label>
							</td>
							<td bgcolor="#ffffff" align="left">
							<asp:TextBox ID="txtDescription" TextMode="MultiLine" Width="200px" Height="40px" runat="server">
							</asp:TextBox>
                                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtDescription"
                                    ErrorMessage="长度必须在100字以内" ValidationExpression="^[\s\S]{0,250}$"></asp:RegularExpressionValidator>
							</td>
						</tr>
                    <tr>
                 <%--   //2008-11-21--%>
                        <td align="right" bgcolor="#ffffff" height="30" style="width: 25%">
                            是否添加水印：</td>
                        <td align="left" bgcolor="#ffffff">
                            <asp:DropDownList ID="DropDownList1" runat="server" Width="97px">
                                <asp:ListItem Value="1">不添加</asp:ListItem>
                                <asp:ListItem Value="2">文字水印</asp:ListItem>
                                <asp:ListItem Value="3">图片水印</asp:ListItem>
                            </asp:DropDownList></td>
                    </tr>
						<tr>
							<td height="30" align="right" bgcolor="#ffffff" style="width: 25%">
							</td>
							<td bgcolor="#ffffff" align="left">
							<asp:Button ID="btnAddSubmit" runat="server" Text="确定" OnClick="btnAddSubmit_Click" CssClass="button" />
							<asp:Button ID="btnEditSubmit" runat="server" Text="更新" OnClick="btnEditSubmit_Click" Visible="False" CssClass="button" />
							<asp:Button ID="btnCancel" runat="server" Text="取消" CausesValidation="false" OnClick="btnCancel_Click" CssClass="button" />
							<input id="iptReset" runat="server" type="reset" value="重置" class="button" />
							</td>
						</tr>
					</table>
				</div>
            </asp:Panel>
        </div>
        <%=clearjs %>
        
        <script type="text/javascript">
            
            //打开标签选择对话框
            function OpenDialogLable(url, w, h){
                if (navigator.appVersion.indexOf("MSIE") == -1){
                    this.returnAction=function(strResult){
                        if(strResult!=null){
                            
                        }
                    }
                    window.open("swfupload/" + url + 'f=<%=imagespath %>&sys=1&d=' + Date(),'newWin','modal=yes,width='+w+',height='+h+',top=200,left=300,resizable=no,scrollbars=yes');
                    return;
                }else{
                    this.returnAction=function(strResult){
                        if(strResult!=null){
                            
                        }
                    }
                    window.open("swfupload/" + url + 'f=<%=imagespath %>&sys=1&&d=' + Date(),'newWin','modal=yes,width='+w+',height='+h+',top=200,left=300,resizable=no,scrollbars=yes');
                    return;
                }
            }
	        var isFF = false;
	        if (navigator.appVersion.indexOf("MSIE") == -1){
		        //isFF = true;
		    }
		    
            function HiddenField(obj){
                var value = obj.value;
                //document.getElementById("UploadType_1").style.display = value == "0" ? "" : "none";
                //document.getElementById("UploadType_2").style.display = value == "1" ? "" : "none";
                if(value==1)
                {
                    if(document.getElementById("txtNameAdd").value=="")
                    {
                        alert("请先填写名称才能批量上传");
                        document.getElementsByName("UploadType")[0].checked=true;
                        return false;
                    }
                     else
                     {  
                        var strname=document.getElementById("txtNameAdd").value;
                        var categoryid=document.getElementById("listPictureCategory").value;
                        var description=document.getElementById("txtDescription").value;
                        document.getElementById("AlphaField").style.display="none";
                        OpenDialogLable("Template_Picture_Upload_Dialog.aspx?strname=" + strname + "&categoryid=" + categoryid + "&description=" + description + "&",600,600);
                        document.getElementById("AddField").style.display="none";
                        document.getElementById("AlphaField").style.display="none";
                    }
                }
            }
            
            if(isFF){
                document.getElementById("Type_2").disabled = true;
                document.getElementById("Type_2_Label").innerHTML += "(FF下无法使用图片批量上传功能)";
            }
            <%=HiddenMulti %>
	    </script>
        
        
        <div id="hiddenfield">
            <asp:HiddenField ID="CheckedIDS" runat="server" Value="0" />
            <asp:HiddenField ID="PageIndex" runat="server" Value="0"/>
            <asp:HiddenField ID="MaxPageIndex" runat="server" Value="0"/>
            <uc1:HiddenField ID="Alert" runat="server" />
        </div>
        <uc2:PageBottom ID="PageBottom1" runat="server" />
    </div>
    </form>
</body>
</html>
