<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UploadPhoto.aspx.cs" Inherits="Admin_UploadPhoto" %>
<%@ Register Assembly="Controls" Namespace="Spaces.Controls" TagPrefix="cc1" %>
<%@ Import Namespace ="Spaces" %>
<!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>
    <title>无标题页</title>
    <link href="Admin.css" rel="stylesheet" type="text/css">
  
    <script src="<%=Globals.ApplicationPath %>/Include/js/dialog.js" type="text/javascript"></script>

    <script src="<%=Globals.ApplicationPath %>/Include/js/base.js" type="text/javascript"></script>
</head>
<body>
 
    <table cellspacing="0" cellpadding="0" width="640"
        align="center" border="0">
        <tbody>
            <tr>
                <td>&nbsp;
                    </td>
            </tr>
            <tr>
                <td>
                    <table cellspacing="0" cellpadding="0" width="100%" border="0">
                        <tbody>
                            <tr>
                                <td width="3" height="3">
                                    <img height="3" src="img/O_angle_up_left.gif" width="3" /></td>
                                <td width="100%" bgcolor="#acd373">
                                    </td>
                                <td width="3">
                                    <img height="3" src="img/O_angle_up_right.gif" width="3" /></td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td bgcolor="#acd373" height=30>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffffff"><B><%=Globals.Text["albumadmin_admin"]%></B></font> 
                    </td>
            </tr>
            <tr>
                <td class="form_border">
                    <table cellspacing="0" cellpadding="0" width="100%" border="0">
                        <tbody>
                            <tr>
                                <td width="20">&nbsp;
                                    </td>
                                <td>&nbsp;
                                    </td>
                                <td width="20">&nbsp;
                                    </td>
                            </tr>
                            <tr>
                                <td>&nbsp;
                                    </td>
                                <td>
                                    <table   cellspacing="0" cellpadding="0" width="100%"
                                        border="0">
                                        <tbody>
                                            <tr>
                                                <td align="right">
                                                    <font color="#ff6600"><a href="editPost.aspx"></a></font>                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <fieldset>
                                                        <legend>&nbsp;<%=Globals.Text["albumadmin_upphoto"]%>&nbsp;</legend>
                                                        <div align="right">
                                                            <%=Globals.Text["albumadmin_up"]%><br />
                                                            <br />
                                                        </div>
                                                    </fieldset>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td height="5">
                                                <table><tr>
                                                <td><a href="PhotoClassEdit.aspx"><%=Globals.Text["albumadmin_new"]%></a></td>
                                                <td><a href="UploadPhoto.aspx"><%=Globals.Text["albumadmin_upphoto"]%></a></td>
                                                <td><a href="AlbumList.aspx"><%=Globals.Text["albumadmin_seephoto"]%></a></td>
                                                </tr></table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
        <table width="100%"  border="0" cellspacing="0" cellpadding="3"   bgcolor="#FFFFFF">
            <tr>
                <td colspan="2" align="center" bgcolor="#669900">&nbsp;</td>
            </tr>
            <tr bgcolor="#EEF5E2">
                <td>
                
                 <form name="form1"   runat=server   method="post"  enctype="multipart/form-data">
                    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="3" class="">



 <tr>
                  <td width="15%"><%=Globals.Text["albumadmin_photoname"]%></td>
                  <td width="85%">
                      <asp:TextBox ID="txtName" runat="server" CssClass="input"></asp:TextBox> <%=Globals.Text["albumadmin_size12"]%></td>
                </tr>
				<tr>
                  <td>
                      <%=Globals.Text["albumadmin_tags"]%></td>
                  <td height="25">
                      <asp:TextBox ID="txtTags" runat="server" CssClass="input"></asp:TextBox>
                    &nbsp;<input type=button class="input"  onclick="openWindow('<%=Globals.ApplicationPath %>/include/TagSelector.aspx?TagEditor=SelectTags','210','350','选择标签', '选择标签');" value="选择.."  />
                                                            <%=Globals.Text["EditPost_key"]%>&nbsp;
                                                            <cc1:SelectAllTags ID="hidTags" runat="server"  TagType="Photo" MaxTagNums="50"  ClearCache="true" />
                                                             <script language="JavaScript" type="text/javascript" src="<%=Globals.ApplicationPath %>/Include/TagEditor.js"></script>
                                                            <script language="javascript">var SelectTags= new TagEditor('SelectTags', '<%=hidTags.ClientID %>', '<%=txtTags.ClientID %>');
                                                            
                                                            </script>
                      <%=Globals.Text["albumadmin_tag"]%></td>
				</tr>
				<tr>
                  <td><%=Globals.Text["albumadmin_locality"]%></td>
                  <td>
                      <asp:DropDownList ID="dropAlbumList" runat="server" CssClass="input">
                      </asp:DropDownList>
                    
                  　  &nbsp;<a href="PhotoClassEdit.aspx" ><%=Globals.Text["albumadmin_new"]%></a>               </td>
				</tr>
			<tr>
          <td height="21">
              <asp:Literal ID="txtOpt" runat="server"></asp:Literal> </td>
          <td>
          <div> <div id="divImg"><p><asp:Image runat="Server"  ID="imgPhoto"/>&nbsp;<input type="checkbox" runat="server" id="chkUpdate" onclick="chkM();"/><%=Globals.Text["albumadmin_renew"]%>..</p> </div>
              <div id="divUpload"><input id="File1" name="file1" runat="server" type="file"  class="input" onchange="javascript:FileChange(this.value);"  />&nbsp;<img id="srcimg" style="display:none" onload="javascript:DrawImage(this);" /></div>
              </div>
              </td>
        </tr>
		
		 <tr>
                  <td><%=Globals.Text["albumadmin_depict"]%></td>
                  <td colspan="3">
                      <asp:TextBox ID="txtDesc" runat="server" Rows="4" Columns="50" TextMode=MultiLine CssClass="input"></asp:TextBox>
                  
                  
                  </tr>
                <tr>
                  <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                <td colspan="1">&nbsp;</td>
                  <td colspan="1" align="left">
                       &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<cc1:XButton ID="photoBtn" runat="server" ResourceName="btn_Finish" OnClientClick="return chkPhoto();"  CssClass="input" OnClick="photoBtn_Click" />
                        
                   
                    </td></tr>
				
             
            </table>
                 </form>
                 <script>
                 function chkPhoto()
                 {
                 var name=$('<%=txtName.ClientID %>');
                 if(name.value.trim()=='')
                 {
                   alert('请输入照片名称');
                   return false;
                 } 
                  var tags=$('<%=txtTags.ClientID %>');
                 if(tags.value.trim()=='')
                 {
                   alert('请输入至少一个标签');
                   return false;
                 } 
                 var aclass=$('<%=dropAlbumList.ClientID %>');
                 if(aclass.value=='-1')
                 {
                  alert('请选择相册分类!');
                   return false;
                 }
                 var file=$('file1');
                 
                 if(! isUpdate||(isUpdate&&$('<%=chkUpdate.ClientID %>').checked))
                 {
                 if(file.value.trim()=='')
                 {
                  alert('请选择图片文件!');
                   return false;
                   }
                   if(navigator.userAgent.toLowerCase().indexOf('7.0')>1)
                     return true;
                    if(!flag) 
                  {
               alert('图片文件格式不正确!');
                   return false;
                   }
                   return true;
                 }
   
 /* 
     */



      
                 }
              
function FileChange(Value){
 
var img=$('srcimg');//$('<%=imgPhoto.ClientID %>');
 img.width=32;
 img.height=32;
 img.alt="";
 img.src=Value;
 
}
var flag=false;
function DrawImage(ImgD){
   var image=new Image();
   image.src=ImgD.src;
   if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= 120/80){
     if(image.width>120){  
     ImgD.width=120;
     ImgD.height=(image.height*120)/image.width;
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     ImgD.alt=image.width+"×"+image.height;
     }
    else{
     if(image.height>80){  
     ImgD.height=80;
     ImgD.width=(image.width*80)/image.height;     
     }else{
     ImgD.width=image.width;  
     ImgD.height=image.height;
     }
     ImgD.alt=image.width+"×"+image.height;
     }
    }
    if(flag) 
     ImgD.style.display='';
     else
     ImgD.style.display='none';

   }
   var isUpdate=false; 
 function init()
 {
  isUpdate=<%=(PhotoID>0)?"true":"false" %>;
 var v=$('divImg');
 var u=$('divUpload');
 if(isUpdate)
 {
   v.style.display='';
   u.style.display='none';
   }
   else
   {   v.style.display='none';
     u.style.display='';
   }
 
 }
 function chkM()
 {
  var c=$('<%=chkUpdate.ClientID %>');
   var u=$('divUpload');
  if(c.checked)
  { u.style.display='';
  if(parent)
  parent.iframeResize();
  }
   else
   {
   u.style.display='none';
   }
 }
 init();
                 </script>
                </td>
            </tr>
        </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="height: 15px">
                                                    <!-- 功能列表 -->
                                                    <!-- /功能列表 -->
                                                    <!-- 分类列表 -->
                                                    <!-- /分类列表 -->
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </td>
                                <td>&nbsp;
                                    </td>
                            </tr>
                            <tr>
                                <td>&nbsp;
                                    </td>
                                <td>&nbsp;
                                    </td>
                                <td>&nbsp;
                                    </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            <tr>
                <td align="center" bgcolor="#e3f0d0" height="30">
                    &nbsp;&nbsp;
                </td>
            </tr>
         
        </tbody>
    </table>
   
</body>
</html>
<asp:literal runat="server" iD="Message"></asp:literal>