<?php
/*
 * 注意：此文件由tpl_engine编译型模板引擎编译生成。
 * 如果您的模板要进行修改，请修改 templates/default/modules/users/user_ico.html
 * 如果您的模型要进行修改，请修改 models/modules/users/user_ico.php
 *
 * 修改完成之后需要您进入后台重新编译，才会重新生成。
 * 如果您开启了debug模式运行，那么您可以省去上面这一步，但是debug模式每次都会判断程序是否更新，debug模式只适合开发调试。
 * 如果您正式运行此程序时，请切换到service模式运行！
 * 
 * 如有您有问题请到官方论坛（http://tech.jooyea.com/bbs/）提问，谢谢您的支持。
 */
?><?php 
	//引入模块公共方法文件
	require("foundation/module_album.php");
	
	//语言包引入
	$u_langpackage=new userslp;
	
	//变量获得
	$user_id =get_sess_userid();
	$album_id=short_check(get_argg('album_id'));
	
	//表声明区
	$t_album = $tablePreStr."album";
	
	$dbo = new dbex;
	//读写分离定义函数
	dbtarget('r',$dbServs);

?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/row_menus.css">
<link rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/iframe.css">
<SCRIPT language=JavaScript src="servtools/ajax_client/ajax.js"></SCRIPT>
<script type='text/javascript'>
	parent.guide("user_set");
function change_ico(){
	if(document.getElementById('advance_ico').style.display==''){
		document.getElementById('advance_ico').style.display='none';
		document.getElementById('normal_ico').style.display='';
	}else{
		document.getElementById('advance_ico').style.display='';
		document.getElementById('normal_ico').style.display='none';		
	}
}
</script>
</head>
<body>
  <div class="main_right_title">
     <span class="main_title_dot9"></span>
     <span class="main_title_txt"><?php echo $u_langpackage->u_conf;?></span>
  </div>


	<div id="tabsB">
		<ul>
			<li><a href="?app=user_info" title="<?php echo $u_langpackage->u_info;?>"><span><?php echo $u_langpackage->u_info;?></span></a></li>
			<li><a href="?app=user_ico" title="<?php echo $u_langpackage->u_icon;?>" class="nowbutl"><span class="nowbutr"><?php echo $u_langpackage->u_icon;?></span></a></li>
			<li><a href="?app=user_integral" title="<?php echo $u_langpackage->u_integral;?>"><span><?php echo $u_langpackage->u_integral;?></span></a></li>
			<li><a href="?app=user_pw_change" title="<?php echo $u_langpackage->u_pw;?>"><span><?php echo $u_langpackage->u_pw;?></span></a></li>
			<li><a href="?app=user_dressup" title="<?php echo $u_langpackage->u_dressup;?>"><span><?php echo $u_langpackage->u_dressup;?></span></a></li>
		</ul>
	</div>
	
	<div class="container">
		<div class="rs_head"><?php echo $u_langpackage->u_set_ico;?></div>
	</div>
	
	<table class='rs_list' cellpadding="0" cellspacing="0">
		<tr>
			<td><?php echo $u_langpackage->u_ico_now;?>：</td>
			<td><img src="<?php echo str_replace('_small','',get_sess_userico());?>" class="user_ico"></td>
		</tr>
		<tr>
			<td><?php echo $u_langpackage->u_ico_spc;?>：</td>
			<td><?php echo $u_langpackage->u_ico_siz;?></td>
		</tr>
	</table>
	
	<table class='rs_list tleft' id='advance_ico' cellpadding="0" cellspacing="0" style="display:none">
		<tr>
			<td><?php echo $u_langpackage->u_set_advanceway;?></td>
			<td class="tright"><a href='javascript:change_ico()'><?php echo $u_langpackage->u_normal_ico;?></a></td>
		</tr>
		
		<tr>
			<td colspan=2>
				<form name="form2" method="post" action="do.php?act=user_ico_upload" enctype="multipart/form-data">
					<input type="hidden" name='type' value='ico'/>
					<input type="file" name="attach[]" class="button"/>
					<input class="upload_button" type="submit" name="submit" class="button" id="UploadButton2" value=" 上传 "  />            	      	
				</form>
			</td>
		</tr>
	</table>	
	
	<table id="normal_ico" class='rs_list tleft bnone' cellpadding="0" cellspacing="0">             
		<tr>
			<td><?php echo $u_langpackage->u_set_way;?></td>
			<td class="tright"><a href='javascript:change_ico()'><?php echo $u_langpackage->u_advance_ico;?></a></td>
		</tr>
		<tr>
			<td colspan=2><?php echo $u_langpackage->u_b;?></td>
		</tr>
		<tr>
			<td colspan=2>
				<form name="form1" method="post" action="do.php?act=user_ico_upload" enctype="multipart/form-data">
					<input type="hidden" name='type' value='photo' />
					<input type="file" name="attach[]" class="button" />
					<input type="submit" class="upload_button" name="submit" class="button" id="UploadButton" value=" 上传 " />
				</form>            	
			</td>
		</tr>
		<tr>
			<td colspan=2><?php echo $u_langpackage->u_c;?></td>
		</tr>
		<tr>
			<td colspan=2><?php echo $u_langpackage->u_cho_alb;?>:
				<?php album_name($dbo,$t_album,$user_id,$album_id);?>
       	       
				<script type='text/javascript'>
					var album_select=document.getElementById("album_name");
					album_select.onchange=list_album_photos;	
													
					function trim(str){  //删除左右两端的空格
						return str.replace(/(^\s*)|(\s*$)|(　*)/g , "");
					}
								
					function list_album_photos()
					{ 
						//获取接受返回信息层 
						var album_select_val=document.getElementById("album_name").value;
						var photos_list=document.getElementById("photos_list");
							
						if(album_select_val==""){
							return false;
							}else{							
								photos_list.innerHTML="<?php echo $u_langpackage->u_data;?>";							
								var url="?app=user_ico_select&album_id="+album_select_val;											
								ajax=InitAjax();//实例化Ajax 								
								ajax.open("GET", url, true);//通过Post方式打开连接 						
								ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); //定义传输的文件HTTP头信息 
								ajax.send(null); //发送POST数据 
							  ajax.onreadystatechange = function() { 
							  //如果执行状态成功，那么就把返回信息写到指定的层里 
								if(ajax.readyState==4&&ajax.status==200) { 
									photos_list.innerHTML=ajax.responseText; 							         
									}
								}
							}			  
						} 
					</script>
					<div id='photos_list'></div>
			</td>
		</tr>
	</table>
</body>
</html>
