<?php
/*
 * 注意：此文件由tpl_engine编译型模板引擎编译生成。
 * 如果您的模板要进行修改，请修改 templates/default/modules/share/share_list.html
 * 如果您的模型要进行修改，请修改 models/modules/share/share_list.php
 *
 * 修改完成之后需要您进入后台重新编译，才会重新生成。
 * 如果您开启了debug模式运行，那么您可以省去上面这一步，但是debug模式每次都会判断程序是否更新，debug模式只适合开发调试。
 * 如果您正式运行此程序时，请切换到service模式运行！
 * 
 * 如有您有问题请到官方论坛（http://tech.jooyea.com/bbs/）提问，谢谢您的支持。
 */
?><?php
	//引入公共模块
	require("foundation/fpages_bar.php");
	require("foundation/module_users.php");
	require("foundation/arecent_affair.php");
	require("foundation/module_share.php");
	
	//语言包引入
	$s_langpackage=new sharelp;
	$rf_langpackage=new recaffairlp;
	$mn_langpackage=new menulp;
	
	//变量区
	$url_uid=short_check(get_argg('user_id'));
	$ses_uid=get_sess_userid();
	$mod=short_check(get_argg('m'));
	
	//当前页面参数
	$page_num=trim(get_argg('page'));
	
	//引入模块公共权限过程文件
	$is_login_mode='';
	$is_self_mode='partLimit';
	require("foundation/auser_validate.php");
	
	//数据表定义
	$t_share=$tablePreStr."share";
	$t_users=$tablePreStr."users";
	dbtarget('r',$dbServs);
	$dbo=new dbex;
	
	$share_rs=array();
	switch($mod){
		case "mine":
		$id_cols="user_id=$ses_uid";
		break;
		default:
		$id_cols="user_id=$userid";
		break;
	}
	$order_by="order by add_time desc";
	$type='getRs';
	$dbo->setPages($set_page_data_num,$page_num);//设置分页	
	$share_rs=get_db_data($dbo,$t_share,$id_cols,$order_by,$type);
	$page_total=$dbo->totalPage;//分页总数
	
	$button_show_mine="";
	$button_show_his="content_none";
	if($is_self=='Y'){
	  $str_title=$s_langpackage->s_mine;
	}else{
		$holder_name=get_hodler_name($dbo,$t_users,$url_uid);
		$str_title=str_replace("{holder}",$holder_name,$s_langpackage->s_who_share);
		$button_show_mine="content_none";
		$button_show_his="";
	}
	
	//控制数据显示
	$content_data_none="content_none";
	$content_data_set="";
	$isNull=0;
	if(empty($share_rs)){
	$isNull=1;
	$content_data_none="";
	$content_data_set="content_none";
	}
?>
<!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 type='text/javascript' src="servtools/ajax_client/ajax.js"></SCRIPT>
<SCRIPT language=JavaScript src="skin/default/js/jooyea.js"></SCRIPT>
<script type='text/javascript'>
	parent.guide("share");
	
	function fixImage(i,w,h){
		return true;
	}
	
	function add_out_share(){
		var point=Get_mouse_position("frame");
		var point_iframe=Get_mouse_position("loc");
		var outer_re=document.getElementById("add_outer_share").value;
		var reg_http=/^http:\/\//i;
		if(trim(outer_re)&&trim(outer_re)!='http://'){
			if(!reg_http.test(outer_re)){
				var h_head="http://";
				var outer_re=h_head+outer_re;
			}
			var xmlhttp=InitAjax();
			xmlhttp.open("post","do.php?act=share_get_info");
			xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
			xmlhttp.onreadystatechange=function(){
				if(xmlhttp.readyState==4&&xmlhttp.status==200){
					document.getElementById("share_window").style.display='none';
					var return_str=xmlhttp.responseText;
					var	return_text=return_str.replace(/[\s\n\r]/g,"");
					var return_array=return_text.split("^");
					s_title='';
					if(return_array[1]){
						s_title=return_array[1];
					}
					if(return_array[0]){
						type_id=return_array[0];
						parent.show_share(type_id,0,s_title,outer_re,point);
					}
				}else{
					document.getElementById("share_window").style.display='';
					document.getElementById("share_window").style.top=point_iframe[1]-50+"px";
					document.getElementById("share_window").style.left=point_iframe[0]-300+"px";
					document.getElementById("share_window").innerHTML="<div class='share_pop'><img src='skin/<?php echo $skinUrl;?>/images/loading.gif'><span>数据加载中...</span></div>";
				}
			}
			xmlhttp.send("outer_link="+outer_re);
		}else{
				parent.Dialog.alert('<?php echo $s_langpackage->s_no_right;?>');
		}
	}
	
	function share_com(share_id,mod_id,type_id,start_num,end_num,ref_type){
		var obj_share=$('content_share_'+share_id);
		if(obj_share.style.display=='none'){
			obj_share.style.display='';
			parent.get_mod_com(mod_id,type_id,start_num,end_num,ref_type);
		}else{
			obj_share.style.display='none';
		}
	}
	
</script>
</head>
<body>
	
<div id='share_window' style='display:none;' class='ajax_window'></div>	
<div class="main_right_title">
	<span class="main_title_dot10"></span>
	<span class="main_title_txt"><?php echo $str_title;?></span>
</div>
<!--按钮控制!-->
<div id="tabsB" class=<?php echo $button_show_mine;?>>
	<ul>
    <li><a href="?app=share_list" title="<?php echo $s_langpackage->s_mine;?>" class="nowbutl"><span class="nowbutr"><?php echo $s_langpackage->s_mine;?></span></a></li>
    <li><a href="?app=share_friend" title="<?php echo $s_langpackage->s_friend;?>"><span><?php echo $s_langpackage->s_friend;?></span></a></li>
  </ul>
	<div class="share_box right">
		<span onclick="add_out_share();"><?php echo $s_langpackage->s_add_out;?></span>
		<input type='text' id='add_outer_share' value="http://" />
	</div>
</div>
		
<!--按钮控制!-->
	<div class="container <?php echo $button_show_his;?>">
		<div class="rs_head"><?php echo str_replace("{num}",count($share_rs),$s_langpackage->s_num);?></div>
	</div>
	<?php foreach($share_rs as $rs){?>
	<div class="listbody share_listbody">
		<div class="listtit">
	   	<span class="right">
	      <a id="restore_share_<?php echo $rs["s_id"];?>" href='javascript:share_com(<?php echo $rs["s_id"];?>,<?php echo $rs["s_id"];?>,5,0,10,0);'><?php echo $s_langpackage->s_com;?><lable id="total_num_<?php echo $rs['s_id'];?>">（<?php echo $rs['comments'];?>）</lable></a>
				<?php if($rs['user_id']==$ses_uid){?>
				<a href="do.php?act=share_del&share_id=<?php echo $rs['s_id'];?>"><?php echo $s_langpackage->s_del;?></a>
				<?php }?>
				<?php if($rs['user_id']!=$ses_uid&&$ses_uid){?>
				<a href='javascript:void(0)' onclick=parent.show_share(<?php echo $rs['type_id'];?>,<?php echo $rs['s_id'];?>,"<?php echo $rs['s_title'];?>","<?php echo $rs['out_link'];?>"); class="fenxiang"> <?php echo $mn_langpackage->mn_share;?></a>
				<a class="jubao" href="javascript:void(0);" onclick='parent.report(8,<?php echo $rs["user_id"];?>,<?php echo $rs["s_id"];?>);'><?php echo $mn_langpackage->mn_report;?></a>
				<?php }?>
	    </span>
      <a href="home.php?h=<?php echo $rs['user_id'];?>" target="_blank" class="strong"><?php echo filt_word($rs['user_name']);?></a><?php echo $rf_langpackage->rf_share;?><?php echo $rf_langpackage->{'rf_s_type_'.$rs['type_id']};?>
    </div>
	<div class="listbody"><?php echo show_affair($rs['add_time'],filt_word($rs['content']));?></div></div>
	</div>
		<div class="clear"></div>
		<div class="share_reply" style="display:none;" id='content_share_<?php echo $rs["s_id"];?>'>
			<div class="replytip"></div>
			<div id='show_5_<?php echo $rs["s_id"];?>'></div>
			<?php if($ses_uid!=''){?>
			<div class="reply">
				<img src='<?php echo get_sess_userico();?>' />
				<textarea maxlength="160" onkeyup="return isMaxLen(this)"  style="height:50px" id="reply_5_<?php echo $rs['s_id'];?>_input"></textarea>
				<div class="replybt">
					<input class="left button2" onclick="parent.restore_com(<?php echo $rs['user_id'];?>,5,<?php echo $rs['s_id'];?>);show('face_list_menu',200)" type="submit" name="button" id="button" value="<?php echo $s_langpackage->s_refer;?>" />
					<a id="reply_a_<?php echo $rs['s_id'];?>_input" class="right" href="javascript:void(0);" onclick=" showFace(this,'face_list_menu','reply_5_<?php echo $rs['s_id'];?>_input');"><?php echo $s_langpackage->s_face;?></a> 
				</div>
				<div class="clear"></div>
</div>
			<?php }?>
		</div>
		<!-- face begin -->
		<div id="face_list_menu" class="emBg" style="display:none;z-index:100;"></div>
		<!-- face end -->
	<?php }?>
	<?php echo page_show($isNull,$page_num,$page_total);?>
  <div class="guide_info <?php echo $content_data_none;?>"><?php echo $s_langpackage->s_his_none;?></div>
</body>
</html>