<?php TPL::output('global/header.tpl.htm'); ?>

<div class="tny-basic main tny-clear"> 
	<h4 class="trends-H3 tdetails"><a class="btn-gray tny-right" href="topic/<?php echo $this->topic_info['url_token']; ?>">Back to detail »</a>Topic Edit</h4>
	<form id="tform" action="topic/ajax/edit_topic/" method="post" onsubmit="return false">
	<input type="hidden" name="topic_id" value="<?php echo $this->topic_info['topic_id']; ?>" />
	<div class="tny-left lsidebar noBg">
		<div class="tindex rel cMain bx">
			<h3 class="t_topad">
				<p class="ttitleInput"><span style="font-size:20px;color:#17344A !important;"><b><?php echo $this->topic_info['topic_title']; ?></b></span>
				<!--input type="text" name="topic_title" class="glotxtclass" style="width:460px;" onFocus="$.focus(this,'');" value="<?php echo $this->topic_info['topic_title']; ?>" /--></p>				
                <div class="trelated rel reTopic"><b class="abs x2">Related:</b>
                    <span id="PublicTopic" class="topic-rlt">
                    <?php if ($this->related_topics) { ?>
                        <?php foreach($this->related_topics as $key => $val){ ?>
                        <a href="topic/<?php echo $val['url_token']; ?>" class="glotopic umsg" data-message="&uid=<?php echo $val['topic_id']; ?>&card=topic"><?php echo $val['topic_title']; ?></a>
                        <?php } ?>
                    <?php } ?> 
                    </span>
                    <?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] OR ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic'])) { ?>
                    <span id="editor_topicBtns" onclick="$.editor_topic_x(this);" title="Topic Edit" class="q_editor tny-small">Topic Edit</span>
                    <div class="editor_input tny-hide rightSide " id="editor_input_handle" style="text-align:left;">
                    <p style="padding:5px 0; color:red; text-align:left;" id="tips_err"></p>
                    <input type="text" style="width:250px;" class="glotxtclass" value="Creating add related topic..." onKeyUp="$('#tips_err').hide();"  onfocus="$.focus(this,'Creating add related topic...');" maxlength="13" id="editor_input" >&nbsp;&nbsp;<a onclick="$.establish_topicx();" title="Make sure Add»" href="javascript:;" class="btn-blue2">Add»</a>&nbsp;&nbsp;<a href="javascript:;" onClick="$.exit_topic();" class="btn-gray2">Cancel</a>
	   </div>
	   <?php } ?>
    </div>
			</h3>
			
			<p class="topicHead abs" >
				<img id="topic_pic" src="<?php echo get_topic_pic_url('max', $this->topic_info['topic_pic']);?>" class="tny-radiu5" alt="<?php echo $this->topic_info['topic_title']; ?>" title="<?php echo $this->topic_info['topic_title']; ?>"/>
				<?php if ($this->user_info['permission']['is_administortar'] OR $this->user_info['permission']['is_moderator'] OR ($this->topic_info['topic_lock'] == 0 && $this->user_info['permission']['edit_topic'])) { ?><span title="Edit" class="q_editor tny-small tny-radiu3" id="topic_pic_uploader">Edit</span><?php } ?>
				
				<span id="uploading_status" style="display:none"><img src="<?php echo GET_STATIC_URL; ?>/common/load.gif" align="absmiddle"></span>
			</p>
		</div>
		
		<div class="topicTxtCon a_question">
			<div class="qsReplenish " id="tcontainer">
				<textarea name="topic_description" onfocus="$.focus(this,'For the above issues additional information ...',$.Q.replenish(this));" class="glotxtclass a_qstxt txtHeight advanced_editor" ><?php echo $this->topic_info['topic_description']; ?></textarea>
				
				<div class="t_topad tny-tr" id="markItUpBtn" style="padding-top:20px;">
					<a href="javascript:;" title="Complete" onclick="ajax_post($('#tform'));" class="btn-raplay2">Complete</a>
				</div>
			</div>
		</div>
	</div>
	</form>
	
	<div class="rsidebar"> 
		<div class="rightMain">
			<div class="interest-user topicpad">
              <h3>Guide on editing topic</h3>
              <div class="a_contxt">
                <p><b>● Related topic:</b> Add topic similar to this topic</p>
                <p><b>● Topic content:</b> Topic is TanyaCMS system used to organize the Content of a node is based on Content extracted knowledge points. Topic is discussed Content constitutes TanyaCMS system's basic unit, which is a variety of things and phenomena explanation of the concept. If you are against the very clear definition of the topic, please help refine the topic and to help users of the community's understanding of the topic. Thank you for your share and contribute!</p>
              </div>
            </div>
		</div>
	</div>
</div>


<script type="text/javascript">
	var TOPIC_ID = '<?php echo $this->topic_info['topic_id']; ?>';	
</script>

<script type="text/javascript" src="<?php echo GET_STATIC_URL; ?>/js/app/topic.js"></script>

<?php TPL::output('global/footer.tpl.htm'); ?>