<%@ Page Language="C#" AutoEventWireup="true" Codebehind="AlbumAdd.aspx.cs" Inherits="JuSNS.Web.user.Album.AlbumAdd" %>
<!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 id="ptitle" runat="server">上传照片</title>
<link href="../../template/<% Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/css/base.css" id="skinpath" type="text/css" rel="stylesheet" />
<script language="javascript" type="text/javascript" src="../../js/ajax.js"></script>
<script language="javascript" type="text/javascript" src="../../js/public.js"></script>
<script language="javascript" type="text/javascript">
    function chkform2(form)
    {
        form.submit.disabled=true;
        var err="";
        if(form.title.value=="")
        {
            err+="<li>相册的名称不能为空"
        }
        if(err=="")
        {
            return true;
        }
        else
        {
            err="<ul>"+err+"</ul>";
            var node=document.getElementById("ERRMSG");
            if(node)
            {
                node.parentNode.removeChild(node);
            }
            var pos=document.getElementById("photo-upload-page");
            var div=document.createElement("div");
            div.setAttribute("id","ERRMSG");
            div.className="msg-error";
            div.innerHTML=err;
            pos.insertAdjacentElement("beforeBegin",div);
            form.submit.disabled=false;
            return false;
        }
    }
    
    function chkphotoadd(obj)
    {
        
        var form=obj;
        form.submit.disabled=true;
        var err="";
        if(form.r.value=="")
        {
            err+="<li>你还没有建立任何相册，请先建立相册"
        }
        if(err=="")
        {
            var hurl="photoadd.aspx?r="+form.r.value;
            location.href=hurl;            
            return false;
        }
        else
        {
            err="<ul>"+err+"</ul>";
            var node=document.getElementById("ERRMSG");
            if(node)
            {
                node.parentNode.removeChild(node);
            }
            var pos=document.getElementById("photo-upload-page");
            var div=document.createElement("div");
            div.setAttribute("id","ERRMSG");
            div.className="msg-error";
            div.innerHTML=err;
            pos.insertAdjacentElement("beforeBegin",div);
            form.submit.disabled=false;
            return false;
        }
    }
    </script>
</head>
<body>
 <!--头部-->
<%=this.GetHtmlShort()%> 
<div id="divhead">
    <%=this.GetHtmlHead()%>
</div>

<div id="divbody">
    <div id="body_first">
        <div class="body_menu"> 
        <%=this.GetHtmlLeft()%>
        </div>
    </div>
    <div id="body_sec">
            <div id="body_mid"> 
                <div class="body_frame"> 
                    <div class="body_frame_otherinfo">
	                        <div class="title">
                                <div class="l"><img src="../../template/<%Response.Write(JuSNS.Config.UiConfig.SkinStyle); %>/images/site/album.gif" align="absmiddle" /> <span class="shenlan bold font14 ocolor">上传照片</span></div>
                                <div class="r"><a href="javascript:window.history.back();" title="返回上一页">返回上一页</a></div>
                                <div class="c"></div>
                            </div>
            		       
                            <div class="nav-menu">
                                <ul>
                                 <li><a href="../album/photos.aspx">好友最新照片</a></li>
                                 <li><a href="../album/?a=all">好友最新相册</a></li>
                                  <li><a href="../album/?r[0]=<%=UserID %>">我的相册</a></li>
                                  <li ><a href="../album/quan.aspx?a=all">最近被圈好友</a></li>
                                  <li><a href="../album/?a=userall" title="所有人的相册">随便看看</a></li>
                                  <li class="current"><a href="../album/albumadd.aspx" title="上传照片">上传照片</a></li>
                                </ul>
                            </div>        
                     </div>   
                     
                     <div class="body_sec_all">
                          <% if (!string.IsNullOrEmpty(Convert.ToString(Session["ErrMSG"])))
                           { %>
                            <div class="msg-error" id="ERRMSG">
                                <% =Session["ErrMSG"] %>
                            </div>
                            <% } %>
                            <div class="cpstr"  id="photo-upload-page">
                                <div class="cpstr" sect:link="选择相册">
                                    <div class="bold font14 pstr">上传照片到现有相册</div>
                                    <form id="Form1" action="photoadd.aspx" name="form1" method="get" runat="server" onsubmit="return chkphotoadd(this)" >
                                    <div class="content">
                                                <label class="f-label">选择相册</label>
                                                <input type="hidden" name="u" id="u" value="<% =this.UserID %>" />
                                                <input type="hidden" name="a" value="uploader" />
                                                <asp:DropDownList ID="r" runat="server" CssClass="s40"></asp:DropDownList>
                                     </div>
                                     <div class="content pstr">
                                                <label class="f-label">&nbsp;</label>
                                                <input type="submit" name="submit" class="f-button" value="选择相册上传相片" />
                                                <input type="button" class="f-reset" value="取消" onclick="window.location='/home/album/?r=<%=this.UserID %>'" />
                                    </div>
                                    </form>
                            </div>
                             <div class="spline"></div> 
                            <div class="line"></div>
                                <div  class="cpstr" sect:link="创建相册">
                                   <div class="bold font14 pstr">或者创建新相册</div>
                                    <form action="AlbumAdd.aspx" name="form2" method="post" class="nf" onsubmit="return chkform2(this)">
                                    <div class="content">
                                            <label class="f-label">相册名</label>
                                            <input type="text" class="f-text s40" name="title" maxlength="30" />
                                     </div>
                                     <div class="content">    
                                            <label class="f-label">描述</label>
                                            <textarea name="desc" class="f-text s40" rows="5" maxlength="1000"></textarea>
                                     </div>
                                     <div class="content">
                                            <label class="f-label">可见度</label>
                                            <select name="attr">
                                                <option value="0" selected="selected">全站用户可见</option>
                                                <option value="1">相同网络用户及好友可见</option>
                                                <option value="2">仅好友可见</option>
                                                <option value="3">仅自己可见</option>
                                            </select>
                                     </div>
                                    <div class="content  pstr">
                                            <label class="f-label">&nbsp;</label>
                                            <input type="submit" class="f-button" name="submit" value="创建相册上传相片" />
                                            <input type="button" class="f-reset" value="取消" onclick="window.location='/home/album/?r=<%=UserID%>'" />
                                    </div>
                                    </form>
                                   </div>
                            </div>
                           <div class="spline"></div> 
                     </div>
                     </div>
                   <!--底部-->
                 <div class="divbottom">
                  <%=this.GetHtmlFoot()%>
                  </div>                           
                </div>
         </div>
</div>
                     
</body>
</html>
