<!--<?php
include_once PrintEot('m_header');
print <<<EOT
-->
<div class="infobox pr cc">
	<div class="p10">
		<table border="0" class="vt" cellpadding="0" cellspacing="0">
			<tr>
				<td width="65"><a href="{$thisbase}q=user"><img src="$faceimg" class="portrait-m"/></a></td>
				<td>
					<p class="pd8">
						<span class="b f14 pdr">{$username}</span>
						<a href="{$thisbase}q=user">返回首页</a>
					</p>
                    <div class="tabA" style="position:absolute;bottom:-1px;padding-left:0;width:600px;">
                        <ul>
<!--
EOT;
if ($u == $winduid) {print <<<EOT
-->
                            <li id="q_index"><a href="{$thisbase}q=$q">我的相册</a></li>
                            <li id="q_friend"><a href="{$thisbase}q=$q&a=friend">好友相册</a></li>
                            <li id="q_upload"><a href="{$thisbase}q=$q&a=upload">上传照片</a></li>
                            <li id="q_create"><a href="{$thisbase}q=$q&a=create">创建相册</a></li>
<!--
EOT;
} else {print <<<EOT
-->
								<li><a href="{$basename}q=write&u=$u">记录</a></li>
								<li class="current"><a href="{$basename}q=photos&u=$u">相册</a></li>
								<li><a href="{$basename}q=share&u=$u">分享</a></li>
								<li><a href="{$basename}q=article&u=$u">帖子</a></li>
								<li><a href="{$basename}q=friend&u=$u">好友</a></li>
								<li><a href="{$basename}q=groups&u=$u">群组</a></li>
<!--
EOT;
}print <<<EOT
-->
                        </ul>
                	</div>
<script language="JavaScript">
function ajaxurl(o) {
	read.obj = o;
	ajax.send(o.href,'',ajax.get);
	return false;
}
setCurrent('q_{$a_key}','q_index','current');
</script>
                </td>
			</tr>
		</table>
	</div>

  </div>
<div class="wrapB cc">
<!--
EOT;
if (empty($a) || $a == 'friend') {print <<<EOT
-->

			<div class="table-list table-list-B">
<!--
EOT;
if (!empty($albumdb)) {
foreach ($albumdb as $key => $value) {
$prviteimg = $value['private']==1?'lock':'key';
if ($value['private']==1) {
	$prviteimg = "<img src=\"$imgpath/pwicon/lock.png\" title=\"仅好友可见\"/>";
} else {
	$prviteimg = "";
}
print <<<EOT
-->
			<div class="w180 bgB boxB">
				<div class="p10">
					<p class="tac">
						<a href="{$thisbase}q=$q&a=album&aid=$value[aid]&u=$value[ownerid]"><img src="$value[lastphoto]" width="145" height="100" /></a>
					</p>
					<p class="mt8">
						<span class="fr">$prviteimg</span>
						<a href="{$thisbase}q=$q&a=album&aid=$value[aid]&u=$value[ownerid]" class="b">{$value[aname]}</a>
					</p>
					<p class="mt8">
<!--
EOT;
if ($value['ownerid'] == $winduid) {print <<<EOT
-->
						<a href="{$thisbase}q=$q&a=upload&aid=$value[aid]">上传照片</a> | <a href="{$thisbase}q=$q&a=editalbum&aid=$value[aid]" onclick="return ajaxurl(this);">编辑相册</a>| <a href="{$thisbase}q=$q&a=delalbum&aid=$value[aid]" onclick="return ajaxurl(this)" title="删除相册" class="o-del gray">删除</a>
<!--
EOT;
} else {print <<<EOT
-->
						<a href="{$thisbase}q=user&u=$value[ownerid]">$value[owner]</a><br />
<!--
EOT;
}print <<<EOT
-->
					</p>
					<p>共{$value[photonum]}张照片</p>
					<p class="gray f10">更新：$value[lasttime]</p>
				</div>
			</div>
<!--
EOT;
}} else {print <<<EOT
-->
			<div class="p10 bdbA mt8">暂时没有相册信息</div>
<!--
EOT;
}print <<<EOT
-->
		</div>
<!--
EOT;
} elseif ($a == 'album') {print <<<EOT
-->
		<style style="text/css">.vphoto{max-width:100px}</style>
<div id="share_album" style="display:none">
	<div class="h b">分享</div>
	<div class="menu-text">
		<ul class="nemu-list cc">
			<li>
				<span class="gray1">摘要：</span>
				<div class="fl exp bgC">
					分享了一个相册
					<p>
					<img src="$album[lastphoto]" width="100">所属：$username
					</p>
				</div>
			</li>
		</ul>
		<div class="c"></div>
		<ul class="nemu-list cc">
			<li>
				<span class="gray1">描述：</span>
				<textarea style="width:330px;height:60px;"></textarea>
			</li>
		</ul>
		<div class="menu-bt tac">
			<input class="bt3" type="button" value=" 确 定 " style="width:80px;" onclick="postShareOtherType('album','$aid');">
			&nbsp;
			<input class="bt2" type="button" value="取消" onclick="closep();"/>
		</div>
	</div>
</div>
		<div class="list-img list-img-A mt8">
			<a class="a-reply fr" href="#" onclick="shareOtherType('share_album');return false;">分享<span>+</span></a>
			<p class="text">
<!--
EOT;
if ($album['ownerid'] == $winduid) {print <<<EOT
-->
			$album[aname] $album[photonum] 张照片
			| <a href="{$thisbase}q=$q&a=editalbum&aid=$aid" onclick="return ajaxurl(this)">编辑相册</a>
			| <a href="{$thisbase}q=$q&a=delalbum&aid=$aid" onclick="return ajaxurl(this)" title="删除相册" class="o-del gray">删除</a>
			| <a href="{$thisbase}q=$q&a=upload&aid=$aid">上传更多照片</a>
			| <a href="{$thisbase}q=$q">返回所有相册</a>
<!--
EOT;
} else {print <<<EOT
-->
			$album[owner]的相册 - $album[aname] $album[photonum] 张照片
			| <a href="{$thisbase}q=$q&a=friend">返回好友相册</a>
<!--
EOT;
}print <<<EOT
-->
			</p>


			<div class="mt8">
<!--
EOT;
if ($cnpho) {
foreach ($cnpho as $key => $value) {print <<<EOT
-->
			<dl	class="o-imgbox fl" onMouseOver="this.className='o-imgbox2 fl';" onMouseOut="this.className='o-imgbox fl';">
				<dt class="tac" style="overflow:hidden;width:165px;height:125px;">
				<table cellpadding="0" cellspacing="0" width="100%" height="100%">
					<tr>
						<td>
							<a href="{$thisbase}q=$q&a=view&pid=$value[pid]">
								<img src="$value[path]" border="0" class="vphoto" />
							</a>
						</td>
					</tr>
				</table>
				</dt>
<!--
EOT;
if ($album['ownerid'] == $winduid || $groupid==3) {print <<<EOT
-->
				<dd>
					<span class="fr"><a href="{$thisbase}q=$q&a=editphoto&pid=$value[pid]">编辑</a> <a style="cursor: pointer;" onclick="pwConfirm('是否确认删除',this,function(){ajaxdel('$value[pid]')});" title="删除" class="o-del gray">删除</a></span>
				</dd>
<!--
EOT;
}print <<<EOT
-->
			</dl>
<!--
EOT;
}}else{print <<<EOT
-->
			<div class="list-img list-img-A">相册暂时没有照片</div>
<!--
EOT;
}print <<<EOT
-->
			</div>
			<div class="c"></div>
		<div class="list-img cc list-img-A mt8"><p class="text">$album[aintro]</p></div>
	</div>
<!--
EOT;
} elseif ($a == 'view') {print <<<EOT
-->
<style type="text/css">
.photo-current .current{border:3px solid #999;}
</style>
		<div class="contentC-side">
            <div class="boxB cc bgB tac" style="margin-top:30px;">
				<table cellpadding="0" cellspacing="0" width="100%" height="100%">
                	<tr>
                    	<td class="tal pdD bdbA boxC" height="25">相册 <a class="b" href="{$thisbase}q=$q&a=album&aid=$photo[aid]">$photo[aname]</a></td>
                    </tr>
                	<tr>
                    	<td height="15" style="padding-top:5px;"><a href="{$thisbase}q=$q&a=pre&pid=$photo[pid]" onclick="return ajaxpage(this.href,'pre');">上一张</a></td>
                    </tr>
                    <tr>
                    	<td height="330" class="photo-current">
<!--
EOT;
foreach($nearphoto as $value){
$ifsel = $pid == $value[pid] ? 'class="current"' : '';
print <<<EOT
-->
							<div class="mt8"><a href="{$thisbase}q=$q&a=view&pid=$value[pid]"><img src="$value[path]" onload="if(this.width>100){this.width = 100;} else if(this.height>100){this.height=100;}" $ifsel /></a></div>
<!--
EOT;
}print <<<EOT
-->
						</td>
                    </tr>
                    <tr>
                    	<td height="25"><a href="{$thisbase}q=$q&a=next&pid=$photo[pid]" onclick="return ajaxpage(this.href,'next');">下一张</a></td>
                    </tr>
				</table>
            </div>
        </div>



<style style="text/css">.vphoto{max-width:530px}</style>
		<div class="cc mt8 fl" style="width:540px;">
			<p>
<!--
EOT;
if($photo['ownerid'] == $winduid){print <<<EOT
-->
			$photo[aname] {$photo[photonum]} 张照片中的第 {$num} 张
<!--
EOT;
}else{print <<<EOT
-->
			$photo[uploader]的相册 - $photo[aname] {$photo[photonum]} 张照片中的第 {$num} 张
<!--
EOT;
}print <<<EOT
-->

			 | <a href="{$thisbase}q=$q&a=album&aid=$photo[aid]">返回相册</a></p><br />
			<div class="tac"><img src="$photo[path]" class="vphoto" /></div>
			<p class="text p10">
				<a class="a-reply fr" href="javascript:;" onclick="shareOtherType('share_photo');return false;">分享<span>+</span></a>
<!--
EOT;
if($photo['pname']){print <<<EOT
-->
				$photo[pname]<br />
<!--
EOT;
}print <<<EOT
-->
				$photo[pintro]<br />
<!--
EOT;
if($photo['ownerid'] == $winduid || $groupid==3){print <<<EOT
-->
			<a href="{$thisbase}q=$q&a=editphoto&pid=$photo[pid]">编辑照片</a> | <a style="cursor: pointer;" onclick="pwConfirm('是否确认删除',this,function(){ajaxdel('$value[pid]')});" title="删除" class="o-del gray">删除</a><br />
<!--
EOT;
}print <<<EOT
-->
				<span class="gray">上传于 {$photo[uptime]}</span>
			</p>
		</div>
<div class="c"></div>
<div id="share_photo" style="display:none">
	<div class="h b">分享</div>
	<div class="menu-text">
		<ul class="nemu-list cc">
			<li>
				<span class="gray1">摘要：</span>
				<div class="fl exp bgC">
					分享了一张照片
					<p>
					<img src="$photo[path]" width="100">所属：$username
					</p>
				</div>
			</li>
		</ul>
		<div class="c"></div>
		<ul class="nemu-list cc">
			<li>
				<span class="gray1">描述：</span>
				<textarea style="width:330px;height:60px;"></textarea>
			</li>
		</ul>
		<div class="menu-bt tac">
			<input class="bt3" type="button" value=" 确 定 " style="width:80px;" onclick="postShareOtherType('photo','$photo[pid]');">
			&nbsp;
			<input class="bt2" type="button" value="取消" onclick="closep();"/>
		</div>
	</div>
</div>
<script language="JavaScript" src="mode/o/js/comment.js"></script>
		<div class="cc p10">
		<div id="com_photo_{$pid}">
			<P>
				<a style="cursor: pointer;" class="flatcmt-get" onclick="javascript:showCommList('photo','$pid','com_photo_{$pid}',this)">回复($photo[c_num])</a>
			</p>
		</div>
	</div>
<!--
EOT;
} elseif ($a == 'editphoto') {print <<<EOT
-->
		<div class="list-img boxB bgB cc mt8 table-list">
			<p class="text">编辑照片 | <a href="{$thisbase}q=$q&a=view&pid=$pid">返回照片</a></p>
			<form action="{$thisbase}q=$q&a=$a" method="post">
				<input type="hidden" name="step" value="3" />
				<input type="hidden" name="pid" value="$pid" />
				<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td width="30%" align="right" class="gray">选择相册</td>
						<td><select name="aid">{$options}</select></td>
					</tr>
					<tr>
						<td align="right" class="gray">描述</td>
						<td style="width:700px;margin:20px auto;"><textarea name="pintro"  style="width:350px;height:70px">$photo[pintro]</textarea></td>
					</tr>
					<tr>
						<td></td>
						<td><input class="bt3" type="submit" value="编辑照片" /></td>
					</tr>
				</table>
			</form>
		</div>
<!--
EOT;
} elseif ($a == 'upload') {print <<<EOT
-->
		<div class="list-img boxB bgB cc mt8 table-list">
			<!-- <p class="text">上传新照片 | <a href="{$thisbase}q=$q">返回我的相册</a></p> -->
			<form action="{$thisbase}q=$q&a=$a" enctype="multipart/form-data" method="post">
				<input type="hidden" name="step" value="3" />
				<div class="fr">单张照片不得大于{$o_maxfilesize}kb</div>
				<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td align="right" class="gray">上传照片</td>
						<td><input type="file" name="photo_1" /></td>
					</tr>
					<tr>
						<td align="right" class="gray">描述</td>
						<td><textarea name="pintro[1]" style="width:350px;height:40px"></textarea></td>
					</tr>

					<tr>
						<td align="right" class="gray">上传照片</td>
						<td><input type="file" name="photo_2" /></td>
					</tr>
					<tr>
						<td align="right" class="gray">描述</td>
						<td><textarea name="pintro[2]" style="width:350px;height:40px"></textarea></td>
					</tr>

					<tr>
						<td align="right" class="gray">上传照片</td>
						<td><input type="file" name="photo_3" /></td>
					</tr>
					<tr>
						<td align="right" class="gray">描述</td>
						<td><textarea name="pintro[3]" style="width:350px;height:40px"></textarea></td>
					</tr>


					<tr>
						<td width="30%" align="right" class="gray">选择相册</td>
						<td><select name="aid" style="width:200px;">{$options}</select></td>
					</tr>
					<tr>
						<td></td>
						<td><input class="bt3" type="submit" value="上传照片" /></td>
					</tr>

				</table>
			</form>
		</div>
<!--
EOT;
} elseif ($a == 'create' || $a == 'edit') {print <<<EOT
-->
		<div class="list-img boxB bgB cc mt8 table-list">
			<p class="text">
<!--
EOT;
if ($a == 'create') {print <<<EOT
-->
				创建新相册
<!--
EOT;
} else {print <<<EOT
-->
				编辑相册
<!--
EOT;
}print <<<EOT
-->
				| <a href="{$thisbase}q=$q">返回我的相册</a>
			</p>
			<form action="{$thisbase}q=$q&a=$a" method="post">
			<input type="hidden" name="step" value="3" />
			<input type="hidden" name="aid" value="$aid" />
				<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td width="30%" align="right" class="gray">相册名</td>
						<td><input maxlength="50" type="text" name="aname" value="$rt[aname]" /></td>
					</tr>
					<tr>
						<td align="right" class="gray">描述</td>
						<td>
							<textarea id="aintro" name="aintro" style="width:350px;height:70px">{$rt[aintro]}</textarea>
							<p class="maxlength-hint warning" id="extra_warning" style="display: none;"></p>
						</td>
					</tr>
					<tr>
						<td align="right" class="gray">可见度</td>
						<td><select name="private"><option value="0" $select_0>全站用户可见</option><option value="1" $select_1>仅好友可见</option></select></td>
					</tr>
					<tr>
						<td></td>
						<td><input class="bt3" type="submit" value="创建相册" /></td>
					</tr>
				</table>
			</form>
		</div>
<script language="Javascript">
function objChange(obj, func){
	if (typeof(obj) == 'string') {
		obj = document.getElementById(obj);
	}
	if (is_ie) {
		obj.onpropertychange = func;
		return;
	}
	if (document.addEventListener) {
		obj.addEventListener("input", func, false);
		return;
	} else if (document.attachEvent) {
		obj.attachEvent("onpropertychange",func);
		return;
	}
}

function extraChange() {
	var text = document.getElementById('aintro');
	var strleng = text.value.length;
	var warning = document.getElementById('extra_warning');
	if (strleng>200) {
		warning.innerHTML = '内容超出 <font color="red">'+(strleng-200)+'</font> 字，请酌情删减后提交。';
		warning.style.display = '';
	} else {
		warning.style.display = 'none';
	}
}
objChange('aintro',extraChange);
</script>
<!--
EOT;
}print <<<EOT
-->
	</div>
	<div class="sidebarC fr"></div>
</div>
<script language="JavaScript">
function ajaxpage(url,type) {
	ajax.send(url,'',function() {
		var rText = ajax.request.responseText.split('\\t');
		if (rText[0] == 'ok') {
			if (rText[1]) {
				window.location.href = '{$thisbase}q=$q&a=view&pid=' + rText[1];
			} else {
				ajax.request.responseText = type == 'next' ? '已经是最后一张照片了' : '已经是第一张照片了';
				ajax.guide();
			}
		} else {
			ajax.guide();
		}
	});
	return false;
}
function ajaxdel(pid) {
	ajax.send('mode.php?m=o&q=photos&a=delphoto&pid='+pid,'',function() {
		var rText = ajax.request.responseText.split('\t');
		if (rText[0] == 'ok') {
			window.location = 'mode.php?m=o&q=photos&a=album&aid='+rText[1];
		} else {
			ajax.guide();
		}
	})
	return false;
}
</script>
<!--
EOT;
?>-->