{#
/**
 *  @module         news
 *  @version        see info.php of this module
 *  @author         Ryan Djurovich, Rob Smith, Dietrich Roland Pehlke, Christian M. Stefan (Stefek), Jurgen Nijhuis (Argos), LEPTON Project
 *  @copyright      2004-2010 Ryan Djurovich, Rob Smith, Dietrich Roland Pehlke, Christian M. Stefan (Stefek), Jurgen Nijhuis (Argos) 
 *  @copyright      2010-2022 LEPTON Project 
 *  @license        GNU General Public License
 *  @license terms  see info.php of this module
 *  @platform       see info.php of this module
 * 
 */
 #}
{% autoescape false %}
<!-- Output by Twig :: module "news" -->
<div class="ui basic segment">				
	<h3 class="ui header">{{ oNP.language.all_courses }}</h3>
	<form class="ui form" name="news_history" action="{{ LEPTON_URL }}/modules/news/show_history.php" method="post">
		<input type="hidden" name="page_id" value="{{ page_id }}" />
		<input type="hidden" name="section_id" value="{{ section_id }}" />
		<input type="hidden" name="show_history" value="{{ show_history }}" />
		<input type="hidden" name="show_draft" value="{{ show_draft }}" />
		
		<table class="history_table">
		  <thead>
			<tr>
			  <th>{{ oNP.language.header1 }}</th>
			  <th>{{ oNP.language.date }}</th>
			  <th>{{ oNP.language.comment }}</th>
			  <th>{{ oNP.language.saved_by }}</th>
			  <th>{{ oNP.language.pushed_by }}</th>					  
			</tr>
		  </thead>
		  <tbody>
			{% for item in all_histories %}
			<tr>
				<td rowspan="2">{{ item.post_id }}</td>
				<td>{{ item.history_time|date("d.m.Y H:i:s") }}</td>
				<td>{{ item.history_comment }}</td>
				<td>{{ item.user_id_display_name }}</td>							
				<td>{{ item.user_id_hist_display_name }}</td>
			</tr>
			<tr>
				<td colspan="4">
					<button class="history_button" type="submit" name="view_version" value="{{ item.post_id }}" title="{{ oNP.language.version_view }}" formaction="{{ oNP.action_url }}show_history.php?leptoken={{ leptoken }}" onclick="displayPreview({{ item.post_id }});return false;" formmethod="post">{{ oNP.language.version_view }}</button>
					<button class="history_button" type="submit" name="restore_version" value="{{ item.post_id }}" title="{{ oNP.language.version_restore }}" formaction="{{ oNP.action_url }}modify_post.php?post_id={{ item.post_id }}&leptoken={{ leptoken }}" formmethod="post">{{ oNP.language.version_restore }}</button>
					<button class="history_button_delete" type="submit" name="delete_version" value="{{ item.post_id }}" title="{{ oNP.language.version_delete }}" formaction="{{ oNP.action_url }}show_history.php?leptoken={{ leptoken }}" formmethod="post" onclick = "return history_delete({{ item.post_id }},'{{ item.date|date("d.m.Y h:m:s") }}',this);">{{ oNP.language.version_delete }}</button>								
				</td>
			</tr>
			{% endfor %}
		  </tbody>
		</table>
		<div class="ui two column stackable grid">								
			<div class="column">
				<button class="delete" type="reset" name="reset"  onclick="window.history.back();">{{ TEXT.BACK }}</button>
			</div>
			<div class="column"></div>					
		</div>

		
	</form>
</div>

<link href="{{ LEPTON_URL }}/modules/lib_jquery/plugins/colorbox/colorbox.css" rel="stylesheet" />
<script type="text/javascript" src="{{ LEPTON_URL }}/modules/lib_jquery/plugins/colorbox/jquery.colorbox-min.js"></script>

<script>
// a.1
function displayPreview( iItemID ){
    $.colorbox({href:'{{ LEPTON_URL }}/modules/news/preview.php?pid='+iItemID});
}
// end a.1
	function history_delete(id,date,ref){
		var form_ref = ref.form;
		if(confirm('{{ oNP.language.want_delete }} "'+date+'" {{ oNP.language.want_really }}?')) {
		form_ref.submit();
		return true;
		} else {
		return false;
		}
	}
</script>
<!-- end Twig -->
{% endautoescape %}