<!-- MODULE: view-code -->

<?php quick_help(txt('view-code', 'quick-help: view-code')); ?>

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

/**
 * Backend template
 *
 * @category   Module (view-code)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-06-06
 */

	if(!isset($module_settings['view-code']['attributes'])) $module_settings['view-code']['attributes'] = '';
	if(!isset($module_settings['view-code']['content'])) $module_settings['view-code']['content'] = '';
	
?>

<form accept-charset="utf-8" method="post" action="index.php?backend=edit-content&amp;page=<?php echo $_GET['page']; ?>&amp;module-to-edit=<?php echo $_GET['module-to-edit']; ?>&amp;module-position=<?php echo $_GET['module-position']; ?>" onsubmit="return this.confirm">
	<?php include($system_data['folder']['modules'] . 'module-properties/backend-template.tpl'); ?>
	
	<?php connector('view-code backend before'); ?>
	
	<h4><?php echo txt('view-code', 'title: view-code'); ?></h4>
	
	<p>
		<label><?php echo txt('view-code', 'Attribute für PRE'); ?>:</label>
		<input type="text" name="attributes" value="<?php echo $module_settings['view-code']['attributes']; ?>">
	</p>
	
	<p>
		<label><?php echo txt('view-code', 'Souce Code'); ?>:</label>
		<textarea wrap="off" style="white-space: nowrap; height: 250px" name="textfield" id="textfield" cols="50" rows="10"><?php echo $module_settings["view-code"]["content"]; ?></textarea>
	</p>
	
	<p>
		<input type="checkbox" id="textarea-wordwrap" onclick="toggleTextareaWrap(this, document.getElementById('textfield'))">
		<label class="checkbox" for="textarea-wordwrap"><?php echo txt('view-code', 'Zeilenumbruch'); ?></label>
	</p>
	
	<?php connector('view-code backend after'); ?>
	
	<!-- Save -->
	<input name="save_view_code" type="hidden">
	<input id="save" name="save_content" type="submit" value="<?php echo txt('view-code', 'Speichern'); ?>">
	<input id="delete" name="delete_content" type="submit" value="<?php echo txt('view-code', 'Löschen'); ?>" onclick="this.form.confirm = window.confirm('<?php echo txt('view-code', 'Soll das Inhaltselement wirklich gelöscht werden?'); ?>')">
</form>

<script type="text/javascript">
	var toggleTextareaWrap = function(inputElement, textareaElement) {
		var wrapValue = inputElement.checked ? 'soft' : 'off';
	
		textareaElement.wrap = wrapValue;
	
		if(MoreCSS.browser() != 'MSIE') {
			var textareaValue = textareaElement.value;
			var textareaNode = textareaElement.cloneNode(false);
			textareaNode.setAttribute('wrap', wrapValue);
			textareaElement.parentNode.replaceChild(textareaNode, textareaElement);
			textareaNode.value = textareaValue;
		}
	};
</script>