<?php echo Wo_LoadPage('forum/headers/header'); ?>
<div role="tabpanel" class="tab-pane active list-group" id="forumsadd"> 
	<div class="blocksubhead"><i class="fa fa-pencil" aria-hidden="true"></i> <?php echo $wo['lang']['edit_topic']; ?> (<?php echo $wo['thread']['headline']; ?>)</div>
	<div class="col-md-12" id="editopic-alert"></div>
	<div class="col-md-12">
		<form class="form" id="editopic" method="post">
			<div class="form-group">
				<label for="headline" class="col-md-2"><?php echo $wo['lang']['subject']; ?>:</label>
				<div class="col-md-10">
					<input type="text" class="form-control" name="headline" id="headline" value="<?php echo $wo['thread']['orginal_headline']; ?>">
				</div>
				<div class="clear"></div>
			</div>

			<div class="form-group">
				<label for="topicpostcont" class="col-md-2"><?php echo $wo['lang']['edit']; ?>:</label>
				<div class="col-md-10">
					<textarea id="topicpostcont" name="topicpost"><?php echo br2nlf($wo['thread']['post']); ?></textarea>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
			</div>
	        <div class="form-group">
	          <label class="col-md-2"></label>
	          <div class="col-sm-10">
	             <button type="submit" class="btn btn-main">
	             <i class="fa fa-floppy-o progress-icon" data-icon="floppy-o"></i> <?php echo $wo['lang']['save']; ?>
	             </button>
	          </div>
	          <div class="clear"></div>
	        </div>
		</form>
	</div>
	<div class="clear"></div>
</div>
<script>
jQuery(document).ready(function($) {

	$('#editopic').ajaxForm({

	      url: Wo_Ajax_Requests_File()  +  '?f=editopic&tid=<?php echo $wo['thread']['id']; ?>&hash=' + $('.main_session').val(),
	      beforeSend: function() {
	        Wo_progressIconLoader($('#editopic').find('button'));
	      },
	      success: function(data) {
	        scrollToTop();
	        if (data['status'] == 200) {
	        	
	         	$("#editopic-alert").html('<div class="alert alert-success">'+ data['message'] +'</div>');
	          	window.location = data['url'];
	        } else {
	        	
	         	$("#editopic-alert").html('<div class="alert alert-danger">' + data['message'] + '</div>');
	        } 
	        Wo_progressIconLoader($('#editopic').find('button'));
	      }
	});

	$("#topicpostcont").bbcode()
	$("#topicpostcont").autogrow({vertical: true, horizontal: false});

});
</script>

<?php echo Wo_LoadPage('forum/headers/footer'); ?>