
<%@ Register TagPrefix="uc1" TagName="UIHead" Src="Controls/UIHead.ascx" %>
<%@ Register TagPrefix="uc1" TagName="UIFrameTop" Src="Controls/UIFrameTop.ascx" %>
<%@ Register TagPrefix="uc1" TagName="UIFrameLeft" Src="Controls/UIFrameLeft.ascx" %>
<%@ Page CodeBehind="Album_List.aspx.cs" Language="c#" AutoEventWireup="True" Inherits="Typhoto.Album_List" enableViewState="False"%>
<%@ Register TagPrefix="webdiyer" Namespace="Wuqi.Webdiyer" Assembly="AspNetPager" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
  <HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">

<script language="JAVASCRIPT">
function checkAll()
{
	var objID;
	objID=document.all.Album;
	for (var i=0 ;i<objID.length-1;i++)
	{
		if(objID[i].checked)
		{
			objID[i].checked=false;
			AddRemoveValues(objID[i]); 
			
		}
		else
		{
			objID[i].checked=true;
			AddRemoveValues(objID[i]);
		}
	}
}
function AddRemoveValues(oChk) { 
if(oChk.checked)
document.Form1.HdnSelectedValues.value += "," + oChk.value; 
else
document.Form1.HdnSelectedValues.value = document.Form1.HdnSelectedValues.value.replace("," + oChk.value,""); 
}
function removechild(delid)
{
	if ((document.Form1.HdnSelectedValues.value=="") && (delid==""))
	{
		alert('请勾选后再进行操作');
		return;
	}
	if (confirm('确定删除选定的相册？将连同其中的照片一同删除'))
	{
		var dll=document.getElementById("content");
		cleanWhitespace(dll);
		objID=document.all.Album;
		for (var i=objID.length-2 ;i>=0;i--)
		{
			if(((delid=="") && (objID[i].checked)) || ((delid!="") && (objID[i].value==delid)))
			{
				dll.removeChild(dll.childNodes[i]);
			}
		}
		if (delid=="") Typhoto.Album_List.DeleteAlbum(document.Form1.HdnSelectedValues.value);
		else Typhoto.Album_List.DeleteAlbum(","+delid);
	}
}
function cleanWhitespace(element) {
	for (var i = 0; i < element.childNodes.length; i++) {
		var node = element.childNodes[i];
		if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) 
		node.parentNode.removeChild(node);
	}
}
function editname(order,id) {
	var v=document.getElementById("m"+order).innerHTML;
	document.getElementById("n"+order).innerHTML="<input name='t"+id+"' type='text' id='t"+id+"' value='"+document.getElementById("m"+order).innerHTML+"' size='16'><br><input type='button' name='button' id='button' value='保存' onclick=\"Rename('"+order+"','"+id+"')\"><input type='button' name='button2' id='button2' value='取消' onclick=\"RenameOK('"+order+"','"+id+"','"+v+"')\">";
}
function Rename(order,id) {
	Typhoto.Album_List.Rename(id,document.getElementById("t"+id).value,RenameOK(order,id,document.getElementById("t"+id).value));
}
function RenameOK(order,id,name) {
	document.getElementById("n"+order).innerHTML="<div onMouseOver=\"this.className='editbak'\" onMouseOut=\"this.className='editbak1'\" id='m"+order+"' title='点击即可编辑' onClick=\"javascript:editname('"+order+"','"+id+"')\">"+name+"</div>";
}
</script>
</HEAD>
<body class=body_1 scroll=no>
<table height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
  <tr>
    <td height=60><uc1:uihead id=UIHead1 runat="server"></uc1:uihead></td></tr>
  <tr>
    <td height=10><uc1:uiframetop id=UIFrameTop1 runat="server"></uc1:uiframetop></td></tr>
  <tr>
    <td>
      <table height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0 
      >
        <tr>
          <td class=frame_left_1 vAlign=top width=193><uc1:uiframeleft id=UIFrameLeft1 runat="server" Current="MyAlbum"></uc1:uiframeleft></td>
          <td class=frame_body_1 vAlign=top>
            <form id=Form1 name=Form1 runat=server>
            <table height="100%" cellSpacing=0 cellPadding=0 width="100%" 
            border=0>
              <tr>
                <td height=32>
                  <div class=main_tool_1 style="WIDTH: 100%" 
                  >
                  <table cellSpacing=0 cellPadding=0 width="100%" border=0 
                  >
                    <tr>
                      <td><input class=button1 id=bDelete type=button value=" 删 除 " onClick="removechild('')">
                      <input class=button1 id=bBatch type=button value="批 处 理" onClick="javascript:if (document.Form1.HdnSelectedValues.value!='')window.location='Album_Batch.aspx?dirid='+document.Form1.HdnSelectedValues.value.substr(1);else alert('请先勾选要处理的相册！');">
                        &nbsp;排序：							
												<asp:DropDownList id=sort runat="server" AutoPostBack="True">
<asp:ListItem Value="ID|Desc">按创建日期[最近的]</asp:ListItem>
<asp:ListItem Value="ID|ASC">按创建日期[最早的]</asp:ListItem>
<asp:ListItem Value="UpdateTime|DESC">按最后上传日期[最近的]</asp:ListItem>
<asp:ListItem Value="UpdateTime|ASC">按最后上传日期[最早的]</asp:ListItem>
<asp:ListItem Value="Photocount|Desc">按图片数量[最多的]</asp:ListItem>
<asp:ListItem Value="Photocount|ASC">按图片数量[最少的]</asp:ListItem>
<asp:ListItem Value="dirname|asc">按名称[升序]</asp:ListItem>
<asp:ListItem Value="dirname|Desc">按名称[降序]</asp:ListItem>
</asp:DropDownList></td>
                      <td align=right><input class=text1 
                        id=tKey type=text size=20 
                        runat="server">
                      <input class=button1 type=button value=" 查 询 " name=bSearch id=Button1 runat="server" onserverclick="Button1_ServerClick"> 
                      </td></tr></table></div></td></tr>
              <tr>
                <td class=main_title_1 height=32>
                  <table cellSpacing=2 cellPadding=3 width="100%" border=0 
                  >
                    <tr>
                      <td><IMG src="images/icon_album.gif" align=absMiddle > &nbsp;我的相册&nbsp;<%=search%></td>
                      <td align=right width=120><A href="javascript:history.back();" ><IMG src="images/link_back.gif" align=absMiddle ></A></td></tr></table></td></tr>
              <tr>
                <td class=main_content_1>
                  <div class=main_content_2 id="content"><asp:repeater id=dAlbums runat="server" EnableViewState="False">
<ItemTemplate>
															<div class="album" title='<%# DataBinder.Eval(Container.DataItem, "dirname") %>'>
																<table border="0" cellpadding="0" cellspacing="0" height="120px" class="pic" >
																	<tr height="5px">
																	  <td align="center" style="vertical-align:top"><div align=left title='<%# ShowAtt(DataBinder.Eval(Container.DataItem, "share").ToString()) %>'><img src='images/priv_<%# DataBinder.Eval(Container.DataItem, "Share") %>.gif'></div></td>
																	</tr>
															    <tr>
																	  <td align="center" style="vertical-align:center">
																		  <a href='Album_Photos.aspx?DirID=<%# DataBinder.Eval(Container.DataItem, "id") %>'>
																  <img src='<%# ShowFace(DataBinder.Eval(Container.DataItem, "Face").ToString()) %>' border="0"> </a>																		</td>
																	</tr>
																</table>
															  <div class="title">
															    <div id='n<%# Container.ItemIndex + 1 %>'><div onMouseOver="this.className='editbak'" onMouseOut="this.className='editbak1'" id='m<%# Container.ItemIndex + 1 %>' title="点击即可编辑" onClick='javascript:editname("<%# Container.ItemIndex + 1 %>","<%# DataBinder.Eval(Container.DataItem, "id") %>")'><%# DataBinder.Eval(Container.DataItem, "DirName") %></div></div>
																 <input name="Album" value='<%# DataBinder.Eval(Container.DataItem, "id") %>' type="checkbox" onClick="AddRemoveValues(this)"> [<%# DataBinder.Eval(Container.DataItem, "photocount") %>张]&nbsp;<a href='Album_Detail.aspx?DirID=<%# DataBinder.Eval(Container.DataItem, "id") %>'><img src="Images/edit.gif" width="12" height="12" border="0" align="absmiddle"></a>&nbsp;<a href="javascript:void(0)" onClick='removechild("<%# DataBinder.Eval(Container.DataItem, "id") %>");'><img src="Images/icon_delete.gif" width="12" height="12" border="0" align="absmiddle"></a></div></div>
</ItemTemplate>
													</asp:repeater><input name="Album" type="checkbox" style="DISPLAY:none"></div></td></tr>
              <tr>
                <td class=main_title_1 height=32>
                  <table width="100%">
                    <tr>
                      <td width="10%"><input id=bAll onClick="checkAll()" type=checkbox name=bAll> <label for=bAll><b>全 
                        选</b></label> <span id=lStat 
                        runat="server"></span></td>
                      <td align=right width="90%"><webdiyer:AspNetPager id="Pager" runat="server" PageSize="24" HorizontalAlign="Right" AlwaysShow="True" ShowCustomInfoSection="Left" NumericButtonCount="15" ShowBoxThreshold="21" FirstPageText="<font face=webdings>9</font>" PrevPageText="<font face=webdings>3</font>" NextPageText="<font face=webdings>4</font>" LastPageText="<font face=webdings>:</font>" Height="20px" onpagechanged="Pager_PageChanged"></webdiyer:AspNetPager></td>
                    </tr></table></td></tr></table>                    <INPUT id="HdnSelectedValues" type="hidden" name="HdnSelectedValues"></form></td></tr></table></td></tr></table>
	</body>
</HTML>
