<!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><?php echo htmlspecialchars($userinfo['screen_name']);?>的微博<?php echo V('-:tpl/title');?></title>
<link href="<?php echo W_BASE_URL;?>css/base.css" rel="stylesheet" type="text/css" />
<link href="<?php echo W_BASE_URL;?>css/skin_<?php echo SITE_SKIN_TYPE;?>/skin.css" rel="stylesheet" type="text/css" />
</head>
<body id="comments">
	<div id="wrapper">
    <!-- header -->
    <?php include APP::tplFile('header');?>
    <!-- end header -->
        <div id="container">
        	<div class="sidebar">
            	<?php include APP::tplFile('intro');?> 
                <div class="user-sidebar">
                	<div class="sidebar-head"><?php echo htmlspecialchars($userinfo['screen_name']);?>的粉丝（<?php echo empty($userinfo['followers_count']) ? 0 : $userinfo['followers_count'];?>）</div>
                    <ul>
						<?php if ($followers):?>
						<?php foreach ($followers as $item):?>
                    	<li>
                        	<a href="<?php  echo URL('ta',array('id' => $item['id']));?>"><img src="<?php echo APP::F('profile_image_url', $item['profile_image_url']);?>" alt="<?php echo htmlspecialchars($item['screen_name']);?>" title="<?php echo htmlspecialchars($item['screen_name']);?>" /></a>
                            <p><a href="<?php echo URL('ta',array('id' => $item['id']));?>" title="<?php echo htmlspecialchars($item['screen_name']);?>"><?php echo htmlspecialchars($item['screen_name']);?></a></p>
                        </li>
						<?php endforeach;?>
						<?php endif;?>
                    </ul>
					<?php if ($userinfo['followers_count'] > 9):?>
					<a class="more-user" href="<?php if ($userinfo['id'] == $uid):?><?php echo URL('index.fans');?><?php else:?><?php echo URL('ta.fans','id=' . $userinfo['id']);?><?php endif;?>">更多</a>
					<?php endif;?>
                </div>   
            </div>
            <div class="main">
            	<div class="title-box">
                    <h3><?php if ($uid == $userinfo['id']):?>我<?php else:?><?php echo htmlspecialchars($userinfo['screen_name']);?><?php endif;?>的微博</h3>
                    <div class="feed-list mblog-list"  id="content">
                        <div class="feed-content">
                            <p class="feed-main"><?php echo APP::F('format_text', $mblog_info['text']);?></p>
							<?php if ($mblog_info['thumbnail_pic']): ?>
								<div class="preview-img">
									<div class="feed-img"><img class="zoom-move" src="<?php echo $mblog_info['thumbnail_pic'];?>" rel=4 alt="" /></div>
								</div>
							<?php endif;?>
							<?php if ($mblog_info['retweeted_status']):?>
                            <div class="box-style">
                                	<div class="box-t skin-bg"><span class="skin-bg"></span></div>
                                    <div class="forward box-content showbox-f">
                                        <p><a href="<?php echo URL('ta', array('id' => $mblog_info['retweeted_status']['user']['id']));?>">@<?php echo htmlspecialchars($mblog_info['retweeted_status']['user']['screen_name']);?></a>：<?php echo APP::F('format_text', $mblog_info['retweeted_status']['text']);?>
										<span>
					<a href="<?php  echo URL('show',array('id' => $mblog_info['retweeted_status']['id']));?>">原文转发<?php if ($batch_counts[$mblog_info['retweeted_status']['id']]['rt'] > 0):?>(<?php echo $batch_counts[$mblog_info['retweeted_status']['id']]['rt'];?>)<?php endif;?></a>|
					<a href="<?php  echo URL('show',array('id' => $mblog_info['retweeted_status']['id']));?>">原文评论<?php if ($batch_counts[$mblog_info['retweeted_status']['id']]['comments'] > 0):?>(<?php echo $batch_counts[$mblog_info['retweeted_status']['id']]['comments'];?>)<?php endif;?></a>
										</span></p>
										<?php if ($mblog_info['retweeted_status']['thumbnail_pic']): ?>
                                        <div class="preview-img">
                                            <div class="feed-img"><img class="zoom-move" src="<?php echo $mblog_info['retweeted_status']['thumbnail_pic'];?>" alt="" /></div>
                                        </div>
										<?php endif;?>

                                    </div>
                                    <div class="box-b skin-bg"><span class="skin-bg"></span></div>
                                    <span class="box-arrow skin-bg"></span>
                                </div>
							<?php endif;?>
                            <div class="feed-info">
                                <p>
								<?php if ($tab != 'favs'):?>
									<?php if ($uid == $mblog_info['user']['id']):?>
									<a href="#" rel="<?php echo $mblog_info['id']?>"  id="delete">删除</a>|
									<?php endif;?>
								<?php endif;?>
								<a href="#" rel=1 id="forward">转发<?php if ($batch_counts[$mblog_info['id']]['rt'] > 0):?>(<?php echo $batch_counts[$mblog_info['id']]['rt'];?>)<?php endif;?></a>|
								<?php if ($tab == 'favs'):?>
								<a href="#" rel=20 id="delFavroite">取消收藏</a>|
								<?php else:?>
								<a href="#" rel=2 id="favorite">收藏</a>|
								<?php endif;?>
								
								<a href="javascript:;" rel=3 id="commentBtn">评论<?php if ($batch_counts[$mblog_info['id']]['comments'] > 0):?>(<?php echo $batch_counts[$mblog_info['id']]['comments'];?>)<?php endif;?></a>
								</p>
                                <span><a href="<?php  echo URL('show',array('id' => $mblog_info['id']));?>"><?php echo APP::F('format_time', $mblog_info['created_at']);?></a> 来自 <?php echo $mblog_info['source'];?></span>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="add-comment">
                	<p class="title">发表评论</p>
                    <div class="post-comment-main">
                        <a href="javascript:;" class="choose-emotion all-bg"></a>
                        <div class="comment-r">
                        	<textarea class="comment-textarea"></textarea>
                            <div>
                            	<a href="javascript:;" class="general-btn"><span>评论</span></a>                       			
                                <span class="keyin-tips">还可以输入<span>140</span>个字</span>
                                <label><input type="checkbox">同时发一条微博</label>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="comment-list all-comment">
                    <div class="list-footer">
                    	<div class="page">
                        	<a id="prePageBtn" class="general-btn" href="javascript:;"><span>上一页</span></a><a id="nextPageBtn" class="general-btn" href="javascript:;"><span>下一页</span></a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- footer -->
		<?php include APP::tplFile('footer');?>
        <!-- end footer -->
    </div>
<?php 
$item = $mblog_info;
$json_element = array(
			'cr' => $item['created_at'], //create time
			'f' => $item['favorited'] ? 1: 0, //is favorited
			's' => $item['source'], //来源
			'tx' => $item['text'] //文本内容
//			,'c' => $item['truncated'] ? 1: 0 //内容是否被截断
		);

		if ($item['thumbnail_pic']) {
			$json_element['tp'] = $item['thumbnail_pic'];
			$json_element['mp'] = $item['bmiddle_pic'];
			$json_element['op'] = $item['original_pic'];
		}

		$user = $item['user'];

		$json_element['u'] = array(
//							'ct' => $user['city'],  //城市ID
//							'cr' => $user['created_at'], //创建时间
//							'ds' => $user['description']
			'id' => (string)$user['id'], //用户ID
//			'n' => $user['name'], //昵称名称
			'sn' => $user['screen_name'], //显示的名称
			'p' => $user['profile_image_url'],
			'v' => $user['verified'] ? 1: 0
		);

		//转发消息
		if ($item['retweeted_status']) {
			$rt = $item['retweeted_status'];

			$json_element['rt'] = array(
				'cr' => $rt['created_at'],
				'f' => $rt['favorited'],
				'id' => (string)$rt['id'],
				's' => $rt['source'],
				'tx' => $rt['text'],
				'fl' => $rt['fllowing'] ? 1: 0,
				'sn' => $rt['screen_name'],
				'u' => array(
					'id' => (string)$rt['user']['id'],
					'sn' => $rt['user']['screen_name'],
					'v' => $rt['user']['verified']? 1: 0,
					'p' => $rt['user']['profile_image_url']
				)
			);

			if ($rt['thumbnail_pic']) {
				$json_element['rt']['tp'] = $rt['thumbnail_pic'];
				$json_element['rt']['mp'] = $rt['bmiddle_pic'];
				$json_element['rt']['op'] = $rt['original_pic'];
			}
		}
?>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/common.js"></script>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/ui.js"></script>
<script type="text/javascript" src="<?php echo W_BASE_URL;?>js/mycomment.js"></script> 
<script type="text/javascript">

var XWEIBO_MLOG_ID = '<?php echo $id;?>';
var detail = <?php echo json_encode($json_element);?>;
var XWEIBO = {data: {},emotions: <?php echo json_encode(V('-:sinaWeiboEmotions'));?>, uid: '<?php echo $uid;?>', wbuid: '<?php echo $user['id'];?>'};
XWEIBO.data[XWEIBO_MLOG_ID] = detail;

$(document).ready(function() {
    XWB.commentList.init();
    XWB.bindSearch($('#search'), $('#searchSubmit'));
	$('#forward').click(function(e){
		XWB.showForward('<?php echo $mblog_info['id'];?>', detail, '<?php echo $uid;?>', function(){XWB.increaseText('转发', $('#forward'))});;
		e.preventDefault();
	});

	$('#favorite').click(function(e){
		XWB.addFavorite(XWEIBO_MLOG_ID, function(){
			$(e.target).replaceWith('<span>已收藏</span>');
		});
		e.preventDefault();
	});
	$('#delFavroite').click(function(e){
		XWB.delFavorite(XWEIBO_MLOG_ID);
		e.preventDefault();
	});
	$('#delete').click(function(e){
		XWB.del(XWEIBO_MLOG_ID);
		e.preventDefault();
	});

	XWB.init('show', $.extend(XWEIBO, {
		container: '#content',
		mid: XWEIBO_MLOG_ID,
		isForward: <?php echo isset($json_element['rt'])? 1: 0;?>
	}));
});
</script>
</body>
</html>
