<h3 class="page"><a href="<?php echo $tpl['link']($_GET['q_pageless']); ?>"><?php echo __('Liens externes'); ?></a></h3>

<div id="obj_mini_links_js">
<?php include('object_select.tpl.php'); ?>
	<span class="sep">&nbsp; | &nbsp;</span>
	<p>
		<a class="js show_all" href="javascript:;"><?php echo __('Tout montrer'); ?></a>
		-
		<a class="js hide_all" href="javascript:;"><?php echo __('Tout cacher'); ?></a>
	</p>
	<span class="sep">&nbsp; | &nbsp;</span>
	<p>
		<span class="icon icon_add"><a class="js" id="link_add" href="javascript:;"><?php echo __('Ajouter un nouveau lien'); ?></a></span>
	</p>
</div>

<form id="obj_mini_form" action="<?php echo $tpl['current_url_pageless']; ?>" method="post">
	<div>
<?php foreach ($tpl['links'] as &$i) : ?>
		<div id="i_<?php echo $i['id']; ?>" class="obj_mini <?php if ($i['activated']) : ?>selected<?php endif; ?> selectable_class">
			<div class="obj_mini_body">
				<p class="obj_mini_selectable selectable_zone">
					<input
						class="selectable"
						<?php if ($i['activated']) : ?>checked="checked"<?php endif; ?>
						name="items[<?php echo $i['id']; ?>][activated]"
						type="checkbox">
				</p>
				<p class="obj_mini_sortable">
					<img
						src="<?php echo $tpl['admin']['style']['path']; ?>/icons/16x16/move-up-down.png"
						height="16"
						width="16">
				</p>
				<p class="obj_mini_title">
					<span><?php echo $i['title']; ?></span>
				</p>
				<p class="obj_mini_action">
					<span class="icon icon_edit" data-action="edit">
						<a class="js" href="javascript:;">
							<span><?php echo __('Éditer'); ?></span>
						</a>
					</span>
				</p>
				<p class="obj_mini_action">
					<span class="icon icon_delete" data-action="delete">
						<a class="js" href="javascript:;">
							<span><?php echo __('Supprimer'); ?></span>
						</a>
					</span>
				</p>
			</div>
			<div class="obj_mini_edit">
				<p>
					<label for="link_title_<?php echo $i['id']; ?>"><?php echo __('Titre :'); ?></label>
					<input
						id="link_title_<?php echo $i['id']; ?>"
						name="items[<?php echo $i['id']; ?>][title]"
						type="text"
						maxlength="64"
						size="40"
						value="<?php echo $i['title']; ?>">
				</p>
				<p>
					<label for="link_url_<?php echo $i['id']; ?>"><?php echo __('URL :'); ?></label>
					<input
						id="link_url_<?php echo $i['id']; ?>"
						name="items[<?php echo $i['id']; ?>][url]"
						type="text"
						maxlength="256"
						size="40"
						value="<?php echo $i['url']; ?>">
				</p>
				<p>
					<label for="link_desc_<?php echo $i['id']; ?>"><?php echo __('Description :'); ?></label>
					<textarea
						id="link_desc_<?php echo $i['id']; ?>"
						name="items[<?php echo $i['id']; ?>][desc]"
						maxlength="128"
						rows="4"
						cols="40"><?php echo $i['desc']; ?></textarea>
				</p>
			</div>
		</div>
<?php endforeach; ?>
	</div>
	<div id="submit">
		<div>
			<input name="anticsrf" type="hidden" value="<?php echo $tpl['anticsrf'](); ?>">
			<input name="serial" type="hidden">
			<input type="submit" value="<?php echo __('Enregistrer'); ?>">
		</div>
	</div>
</form>

<script nonce="<?php echo CSP_NONCE; ?>" type="text/javascript">
var link_html =
'<div id="i_{id}" class="obj_mini selected selectable_class">\
	<div class="obj_mini_body">\
		<p class="obj_mini_selectable selectable_zone">\
			<input\
				class="selectable"\
				checked="checked"\
				name="items[{id}][activated]"\
				type="checkbox"\>\
		<\/p>\
		<p class="obj_mini_sortable">\
			<img\
				src="{style_path}\/icons\/16x16\/move-up-down.png"\
				height="16"\
				width="16"\>\
		<\/p>\
		<p class="obj_mini_title">\
			<span><?php echo __('Nouveau lien') ?><\/span>\
		<\/p>\
		<p class="obj_mini_action">\
			<span class="icon icon_edit" data-action="edit">\
				<a class="js" href="javascript:;">\
					<span><?php echo __('Éditer') ?><\/span>\
				<\/a>\
			<\/span>\
		<\/p>\
		<p class="obj_mini_action">\
			<span class="icon icon_delete" data-action="delete">\
				<a class="js" href="javascript:;">\
					<span><?php echo __('Supprimer') ?><\/span>\
				<\/a>\
			<\/span>\
		<\/p>\
	<\/div>\
	<div class="obj_mini_edit">\
		<p>\
			<label for="link_title_{id}"><?php echo __('Titre :') ?><\/label>\
			<input\
				id="link_title_{id}"\
				name="items[{id}][title]"\
				type="text"\
				maxlength="64"\
				size="40"\
				value=""\>\
		<\/p>\
		<p>\
			<label for="link_url_{id}"><?php echo __('URL :') ?><\/label>\
			<input\
				id="link_url_{id}"\
				name="items[{id}][url]"\
				type="text"\
				maxlength="256"\
				size="40"\
				value=""\>\
		<\/p>\
		<p>\
			<label for="link_desc_{id}"><?php echo __('Description :') ?><\/label>\
			<textarea\
				id="link_desc_{id}"\
				name="items[{id}][desc]"\
				maxlength="128"\
				rows="4"\
				cols="40"><\/textarea>\
		<\/p>\
	<\/div>\
<\/div>';
</script>