<?php if(!defined('master_script')) die();

/**
 * Toolbar
 *
 * @category   Extensions (toolbar)
 * @author     Nico Wenig
 * @version	   2010-07-06
 */

?>

<!-- EXTENSION: toolbar -->

<div id="toolbar">
	<ul class="menu">
	    <li><a href="index.php?backend=widgets"><img src="<?php echo $system_data['folder']['backend']; ?>toolbar/symbol-widgets.png" width="40" height="40" alt="<?php echo txt('toolbar', 'Widgets'); ?>"><br><?php echo txt('toolbar', 'Widgets'); ?></a></li>
	    <li><a href="index.php?backend=edit-page&amp;page&amp;pagetype=standard"><img src="<?php echo $system_data['folder']['backend']; ?>toolbar/symbol-new-page.png" width="40" height="40" alt="<?php echo txt('toolbar', 'Neue Seite'); ?>"><br><?php echo txt('toolbar', 'Neue Seite'); ?></a></li>
	    <?php if($_SESSION['user'] == sha1($administrator_name)) { ?><li><a href="index.php?backend=settings"><img src="<?php echo $system_data['folder']['backend']; ?>toolbar/symbol-settings.png" width="40" height="40" alt="<?php echo txt('toolbar', 'Einstellungen'); ?>"><br><?php echo txt('toolbar', 'Einstellungen'); ?></a></li><?php } ?>
	</ul>

	<?php connector('toolbar before'); ?>
	
	<ul class="actions">
	    <li id="save-button" style="display: none"><a href="#save" title="<?php echo txt('toolbar', 'ALT / CTRL + S'); ?>"><img src="<?php echo $system_data['folder']['backend']; ?>toolbar/symbol-save.png" width="40" height="40" alt="<?php echo txt('toolbar', 'Speichern'); ?>"><br><?php echo txt('toolbar', 'Speichern'); ?></a></li>
	    <?php if($_SESSION['user'] == sha1($administrator_name)) { ?><li id="delete-button" style="display: none"><a href="#delete"><img src="<?php echo $system_data['folder']['backend']; ?>toolbar/symbol-delete.png" width="40" height="40" alt="<?php echo txt('toolbar', 'Löschen'); ?>"><br><?php echo txt('toolbar', 'Löschen'); ?></a></li><?php } ?>
	    <li id="back-button" style="display: none"><a href="#back"><img src="<?php echo $system_data['folder']['backend']; ?>toolbar/symbol-back.png" width="40" height="40" alt="<?php echo txt('toolbar', 'Zurück'); ?>"><br><?php echo txt('toolbar', 'Zurück'); ?></a></li>
		<?php connector('toolbar actions after'); ?>
	</ul>

	<ul class="meta">
	    <li><a href="<?php echo (isset($_GET['page']) && $_GET['page'] != '') ? $system_data['frontend']['href attribute'] . $_GET['page'] : './'; ?>" target="_blank"><img src="<?php echo $system_data['folder']['backend']; ?>toolbar/symbol-frontend.png" width="40" height="40" alt="<?php echo txt('toolbar', 'Website'); ?>"><br><?php echo txt('toolbar', 'Website'); ?></a></li>
	    <li><a href="index.php?backend=help"><img src="<?php echo $system_data['folder']['backend']; ?>toolbar/symbol-help.png" width="40" height="40" alt="<?php echo txt('toolbar', 'Hilfe'); ?>"><br><?php echo txt('toolbar', 'Hilfe'); ?></a></li>
	    <?php if($_SESSION['user'] == sha1($administrator_name)) { ?><li><a href="index.php?backend=users"><img src="<?php echo $system_data['folder']['backend']; ?>toolbar/symbol-users.png" width="40" height="40" alt="<?php echo txt('toolbar', 'Benutzer'); ?>"><br><?php echo txt('toolbar', 'Benutzer'); ?></a></li><?php } ?>
	    <li><a href="index.php?backend&amp;logout"><img src="<?php echo $system_data['folder']['backend']; ?>toolbar/symbol-logout.png" width="40" height="40" alt="<?php echo txt('toolbar', 'Abmelden'); ?>"><br><?php echo txt('toolbar', 'Abmelden'); ?></a></li>
		<?php connector('toolbar meta after'); ?>
	</ul>
</div>

<script type="text/javascript">
	// Key events
	var toolbar_getKeyCode = function(event) {
		event = event || window.event;
		var key = event.keyCode;
		
		if(key == 83 && (event.ctrlKey == true || event.altKey == true)) toolbar_save();
	}
	
	document.onkeydown = toolbar_getKeyCode;
	
	// Save
	var toolbar_save = function() {
		if(document.getElementById("save")) document.getElementById("save").click();
	};
</script>