{#
/**
 * @module          wysiwyg
 * @author          LEPTON Project
 * @copyright       2010-2025 LEPTON Project
 * @link            https://lepton-cms.org
 * @license         https://gnu.org/licenses/gpl-3.0.html
 * @license_terms   please see info.php of this module
 *
 */
 #}
{% autoescape false %}
<!-- Output by Twig :: module "wysiwyg" -->
<div class="ui basic segment">				
	<h3 class="ui header">{{ oWGH.language.all_courses }}</h3>
	<form class="ui form" name="wysiwyg_history" action="{{ LEPTON_URL }}/modules/wysiwyg/history.php" method="post">
		<input type="hidden" name="page_id" value="{{ page_id }}" />
		<input type="hidden" name="section_id" value="{{ section_id }}" />
		<table class="ui striped celled table">
		  <thead>
			<tr>
			  <th class="one wide single line">{{ oWGH.language.header1 }}</th>
			  <th>{{ oWGH.language.date }}</th>
			  <th>{{ oWGH.language.comment }}</th>
			  <th>{{ oWGH.language.saved_by }}</th>
			  <th>{{ oWGH.language.pushed_by }}</th>					  
			  <th class="one wide single line">{{ oWGH.language.action }}</th>
			</tr>
		  </thead>
		  <tbody>
			{% for item in all_histories %}
			<tr>
				<td>{{ item.id }}</td>
				<td>{{ item.date|date("d.m.Y H:i:s") }}</td>
				<td>{{ item.comment }}</td>
				<td>{{ item.user_id_display_name }}</td>							
				<td>{{ item.user_id_hist_display_name }} </td>						
				<td class="single line">
					<button class="ui basic button blank" type="submit" name="view_version" value="{{ item.id }}" title="{{ oWGH.language.version_view }}" formaction="{{ oWGH.action_url }}&leptoken={{ leptoken }}" onclick="displayPreview({{ item.id }});return false;" formmethod="post"><i class="big blue tv icon"></i></button>
					<button class="ui basic button blank" type="submit" name="restore_version" value="{{ item.id }}" title="{{ oWGH.language.version_restore }}" formaction="{{ oWGH.action_url }}&leptoken={{ leptoken }}" formmethod="post"><i class="big green history icon"></i></button>
					<button class="ui basic button blank" type="submit" name="delete_version" value="{{ item.id }}" title="{{ oWGH.language.version_delete }}" formaction="{{ oWGH.action_url }}&leptoken={{ leptoken }}" formmethod="post" onclick = "return history_delete({{ item.id }},'{{ item.date|date("d.m.Y h:m:s") }}',this);"><i class="big red remove icon"></i></button>								
				</td>
			</tr>
			{% endfor %}
		  </tbody>
		</table>
		<div class="ui two column stackable grid">								
			<div class="column">
				<button class="negative ui button" type="reset" name="reset"  onclick="window.history.back();">{{ TEXT.CANCEL }}</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/wysiwyg/preview.php?pid='+iItemID});
}
// end a.1
	function history_delete(id,date,ref){
		var form_ref = ref.form;
		if(confirm('{{ oWGH.language.want_delete }} "'+date+'" {{ oWGH.language.want_really }}?')) {
		form_ref.submit();
		return true;
		} else {
		return false;
		}
	}
</script>
<!-- end Twig -->
{% endautoescape %}