<%template _header%>
<!--header end-->

<!--TheCurrent start-->
<div id="foruminfo">
	<div class="userinfo">
		<h2><a href="{config.forumurl}" class="home">{config.forumtitle}</a> <span><a href="usercp.aspx">用户中心</a></span><strong>管理相册</strong></h2>	</div>
	<div class="forumstats">
		<div id="search">
				<%template _quicksearch%>
		</div>
	</div>
</div>
<!--TheCurrent end-->

<!--主体-->
<script type="text/javascript">
	function checkPublicAndPrivate(val)
	{
		if(val == 0)
		{
			$('password').value = '';
			$('password').readOnly = true;
		}
		else
		{
			$('password').readOnly = false;
			$('password').focus();
		}
	}
	function submitForm()
	{
		
		if($("albumtitle").value == "")
		{
			alert("相册名称不能为空!");
			return false;
		}
		if($("albumcate").value == "")
		{
			alert("请选择相册分类!");
			return false;
		}
		if($("albumdescription").value.length > 200) 
		{
			alert('链接描述长度最大为200字'); 
			return false;
		}
		if($("private").checked && $("password").value == "")
		{
			alert("选择私人相册必须拥有一个授权密码!");
			return false;
		}
		return true;
	}
	function delAlert(title)
	{
		if(!confirm("你真的要删除 " + title + " 吗？删除的相册与相册内的图片将无法恢复!"))
		{
			event.cancelBubble = true;
			return false;				
		}
	}
</script>
<div class="controlpannel">
   <%template _menu%>
	<div class="pannelcontent">
		<div class="pcontent">
			<div class="panneldetail">
				<%template _albummenu%>	
				<div class="pannelbody">
					<div class="pannellist">
					<%if {page_err}==0%>
						<%if ispost%>
							<%template _msgbox%>
						<%else%>
						<div class="compartline">&nbsp;</div>
							<ul id="photo">
							 <%loop singleAlbumInfo albumInfoArray%>
							<li>
								<div class="pictureimg">
									<a href='usercpspacemanagephoto.aspx?albumid={singleAlbumInfo[Albumid]}' title='点击管理相册内容'>
									<img src='{singleAlbumInfo[Logo]}' alt='相片' border='0' title='{singleAlbumInfo[Description]}' style='border: 1px solid #ccc; padding:4px' />
									</a>
									<%if {singleAlbumInfo[Type]}!="0"%>
									<span style='position:relative;left:-30px;top:0px;z-index:1'><img src='{spaceurl}space/manage/images/lock.gif' width='21' height='30'  title="私有相册" alt="私有相册"></span>
									<%/if%>
								</div>
								<h4>{singleAlbumInfo[Title]}</h4>
								<p class="fontfamily">创建时间：{singleAlbumInfo[Createdatetime]}</p>
								<p>{singleAlbumInfo[Imgcount]}张图片  <a href='usercpspacemanagealbum.aspx?page={pageid}&mod=edit&albumid={singleAlbumInfo[Albumid]}#edit'>编辑</a>
								&nbsp;&nbsp;<a href='usercpspacemanagealbum.aspx?mod=delete&albumid={singleAlbumInfo[Albumid]}' onclick='return delAlert("{singleAlbumInfo[Title]}")'>删除</a><p>
							</li>
							<%/loop%>
							</ul>
							<div class="compartline">&nbsp;</div>
						</div>
							<div class="forumpages">
  								<div class="forumpagesnumbers">
								<table border="0" cellpadding="0" cellspacing="0" ID="Table2" style="border-top:none;">
									<tr>
										<td class="forumallpages"><strong>{pageid}</strong>/&nbsp;&nbsp;{pagecount}&nbsp;&nbsp;页</td>
										<td width="10" style="border-bottom:none;">&nbsp;</td>
										<td class="forumallpages">{pagenumbers}</td>
										<td class="forumallpages">跳转<input name="gopage" type="text" id="gopage" onKeyDown="if(event.keyCode==13) {
								window.location='usercpspacemanagealbum.aspx?page=' + this.value;}"  size="4" maxlength="9"  class="colorblue2"/>页</td>
									</tr>
								</table>
								</div>
								<div class="pagesothers">
									<%if {allownewalbum}%>
										<a href="###" onclick="BOX_show('neworeditalbum');" class="submitbutton"><strong>新建{config.albumname}</strong></a>
									<%/if%>
						</div>	
						<%/if%>
						</div>
					<%else%>
					<%template _usercperrmsgbox%>
					<%/if%>
			  </div>
			</div>
		</div>
	</div>
</div>
<!--主体-->
</div>
<%template _copyright%>
<div id="BOX_overlay" style="background: #000; position: absolute; z-index:100; filter:alpha(opacity=50);-moz-opacity: 0.6;opacity: 0.6;"></div>
<%if {page_err}==0 && {allownewalbum}%>						
<script type="text/javascript" src="templates/{templatepath}/album.js"></script>
	<div id="neworeditalbum" style="display: none; background :#fff; padding:10px; border:1px solid #999; width:400px;">
	<form action="" method="post" id="Form1">
		<h3 style="line-height:270%;margin-top:15px;"><a name="edit" />{mod}</a></h3>
		<div class="CompartLine">&nbsp;</div>
			<label for="albumtitle">相册名称:</label>
			<input name="albumtitle" type="text" id="albumtitle" size="40" class="colorblue"
				onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" maxlength="50" value="{title}"/>
				<input type="hidden" name="albumid" value="{albumid}" ID="Hidden1">
				<input type="hidden" name="active" id="active" value=""><br />
			<label for="albumcate">相册分类:</label>
			<select name="albumcate" id="albumcate" value="{title}">
				<option value=""></option>
				<%loop (AlbumCategoryInfo) albumcate albumcates%>
					<option value="{albumcate.albumcateid}"
					<%if {albumcateid}=={albumcate.albumcateid}%>
					selected
					<%/if%>
					>{albumcate.title}</option>
				<%/loop%>
			</select><br />
			<label for="albumdescription">描&nbsp;&nbsp;&nbsp;&nbsp;述:</label>
			<textarea name="albumdescription" cols="40" rows="6" id="albumdescription" class="colorblue" onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" style="width:80%;margin-left:10px;">{description}</textarea><br />
			<div style="line-height:240%;">
			<label for="public">是否公开:</label>
			<input id="public" type="radio" name="type" value="0" onclick='checkPublicAndPrivate(0)'
			<%if type==0%>
			 checked="checked"
									 <%/if%>>公开相册&nbsp;&nbsp;&nbsp;
			<input id="private" type="radio" name="type" value="1" onclick='checkPublicAndPrivate(1)'
			<%if type==1%>
			 checked="checked"
			 <%/if%>>私人相册<br /> 
			 </div>
			<label for="password">密&nbsp;&nbsp;&nbsp;&nbsp;码：</label>
			 <input name="password" type="text" id="password" size="40" class="colorblue"
				onfocus="this.className='colorfocus';" onblur="this.className='colorblue';" maxlength="50" value="{albumpassword}"<%if type==0%>
			 readonly="readonly"
			 <%/if%>/><br /><br />
<div align="center">
<input type="submit" name="Submit" value="确定" class="sbutton" onclick="return submitForm()" /> &nbsp; <input type="button" name="Submit" value="取消" class="sbutton" onclick="window.location='usercpspacemanagealbum.aspx';" />
</div>
							</form>
						</div>
						<%if {albumid}!=0%>
							<script type="text/javascript">BOX_show('neworeditalbum');</script>
						<%/if%>
						<%/if%>
<%template _footer%>
