<?php

/*

		用户头像设置

*/

//载入全局配置和函数包
require_once dirname(__FILE__).'/../include/global.php';

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $_G['product']['charset'];?>" />
<title>更换头像 - Powered By VeryIDE</title>

<?php

echo loader_style(array(VI_BASE."style/dialog.css"),$_G['product']['charset'],$_G['product']['version']);

echo loader_script(array(VI_BASE."js/mo.js",VI_BASE."js/serv.dialog.js"),"utf-8",$_G['product']['version']);

?>

<script>

Mo.reader(function(){

	//高亮当前主题
	Mo("#avatar li").each( function(){

		if( Mo(this).attr("rel") == Mo.get('avatar') ){
			this.className = 'active';			
		}

	});
	
	//高亮选中主题
	Mo("#avatar li").bind( 'click', function( ele, index, e ){

		//设置主题
		parent.Serv.System.avatar( Mo(this).attr("rel") );
		
		//取消高亮所有主题
		Mo("#avatar li").attr({'class':''});
		
		//高亮当前主题
		var obj = Mo.Event( e ).element();
	
		if( obj == this || obj.parentNode == this ){
			this.className = 'active';
		}

	});
	
	//主框架载入事件
	Serv.Manager.Loaded();

});

</script>

</head>

<body>

	<div id="wrapper">

		<?php
	
		//未登录
		if( !$_SESSION['Manager']['id'] ){
	
			exit('<div id="state" class="failure">未登录，请先登录！</div>');
	
		}
	
		?>
	
		<ul id="avatar">
	
			<?php
			
			//遍历头像目录
			$root = VI_ROOT."image/avatar/";
			
			$list = loop_file( $root, array(), array('jpg') );
			
			foreach( $list as $file ){
				echo '<li rel="'.$file.'"><img src="'.VI_BASE.'image/avatar/'.$file.'" /> <br /> '.str_replace(".jpg","",ucfirst($file)).' </li>';
			}
	
			?>	
	
		</ul>
	
	</div>
	
</body>
</html>