<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>写书</title>
		<script src="/plugin/jquery/jquery.js"></script>
		<link href="/plugin/dt-ui/dt-ui-pc.css" rel="stylesheet"  />
		<link href="<?php echo $this->_var['skins']; ?>book/write.css" rel="stylesheet" />
	</head>
 
	<body>
		<div id="top" class="topbox">
			<div class="title"><?php echo $this->_var['book']['title']; ?></div>
			<a href="/module.php?m=book&a=show&bookid=<?php echo $this->_var['book']['bookid']; ?>" style="font-size: 16px;" target="_blank">查看</a>
		</div>
		<div id="leftbox" class="menulist">
				 <div id="menuEdit" bookid="<?php echo $this->_var['book']['bookid']; ?>">编辑章节</div>
				 <div class="js-go pd-5 flex" pid="0" vid="0" >
					 <div class="flex-1">新增章节</div>
					 <div class="js-go menulist-add" pid=0" vid="0">+</div>
				 </div>
				<?php $_from = $this->_var['artlist']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'a');if (count($_from)):
    foreach ($_from AS $this->_var['a']):
?>
					<div class="aitem" id="aitem<?php echo $this->_var['a']['id']; ?>" >
						<div class="atitle "  >
							<div class="flex-1 js-go" vid="<?php echo $this->_var['a']['id']; ?>"><?php echo $this->_var['a']['title']; ?></div>
							<div class="js-go menulist-add" pid="<?php echo $this->_var['a']['id']; ?>" vid="0">+</div>
						</div>
						<?php if ($this->_var['a']['child']): ?>
							<?php $_from = $this->_var['a']['child']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'b');if (count($_from)):
    foreach ($_from AS $this->_var['b']):
?>
							<div class="bitem" id="bitem<?php echo $this->_var['b']['id']; ?>" >
								<div class="btitle" vid="<?php echo $this->_var['b']['id']; ?>" >
									<div class="flex-1 js-go" vid="<?php echo $this->_var['b']['id']; ?>"><?php echo $this->_var['b']['title']; ?></div>
									<div class="js-go menulist-add" pid="<?php echo $this->_var['b']['id']; ?>" vid="0">+</div>
								</div>
								<?php if ($this->_var['b']['child']): ?>
									<?php $_from = $this->_var['b']['child']; if (!is_array($_from) && !is_object($_from)) { $_from=array();}; $this->push_vars('', 'c');if (count($_from)):
    foreach ($_from AS $this->_var['c']):
?>
									<div id="citem<?php echo $this->_var['c']['id']; ?>" class="citem js-go" vid="<?php echo $this->_var['c']['id']; ?>"  ><?php echo $this->_var['c']['title']; ?></div>
									<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
								<?php endif; ?>
								</div>
							<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
						<?php endif; ?>
					</div>
				<?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
			</div>
		<div id="rightbox" >
				<iframe id="iframe" ></iframe>
			</div>
		<div class="tanbox-bg"></div>	
		<div id="artbox" class="tanbox">
			<div class="row"><input class="text" type="text" name="title" id="add-title"  /></div>
			<div class="btns">
				<div class="btn btn-submit" id="add-submit">添加</div>
				<div class="btn btn-submit" id="add-cancel">取消</div>
			</div>
			
		</div>	
		<script>
			var bookid="<?php echo $this->_var['book']['bookid']; ?>";
			$(document).on("click",".js-go",function(){
				var id=$(this).attr("vid");
				var pid=$(this).attr("pid")
				$(".js-go").removeClass("active");
				$(this).addClass("active");
				var url="/moduleadmin.php?m=book_article&a=add&bookid="+bookid+"&pid="+pid+"&id="+id;
				var iframe='<iframe id="iframe" src="'+url+'"></iframe>';
				$("#rightbox").html(iframe);
			})
			 
			$(document).on("click","#menuEdit",function(){
				var bookid=$(this).attr("bookid");
				var url="/moduleadmin.php?m=book&a=menu&bookid="+bookid;
				var iframe='<iframe id="iframe" src="'+url+'"></iframe>';
				$("#rightbox").html(iframe);
			})
		</script>
	</body>
</html>
