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

/**
 * Default data
 *
 * @category   Module (view-code)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-12-07
 */
	
	$modules['view-code']['version'] = '1.1';
	$modules['view-code']['author'] = 'Nico Wenig';
	$modules['view-code']['support'] = 'mailto:nico.wenig@yellowgreen.de';
	$modules['view-code']['pagemap version'] = '0.4';
	$modules['view-code']['for'] = 'all';
	$modules['view-code']['key'] = 'view-code';
	$modules['view-code']['path'] = $system_data['folder']['modules'] . $modules['view-code']['key'] . '/';
	$modules['view-code']['languages'] = $system_data['folder']['modules'] . $modules['view-code']['key'] . '/languages/';
	$modules['view-code']['protected'] = 0;
	$modules['view-code']['preview'] = 1;
	
	include_txt($modules['view-code']['key'], $modules['view-code']['languages']);

/**
 * Save module to page
 *
 * @category   Module (view-code)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-04-17
 */

	if(isset($_POST['save_view_code'])) {
		// Parse data
		$_POST['textfield'] = ascii_encode(str_replace("\r\n", "\n", stripslashes(trim($_POST['textfield']))));
		
		// Create module section
		$module_content_to_save = '
			<!-- MODULE: view-code -->
			
			<?php
				$module_settings["view-code"] = array(
					"language" => "' . clean_string($_POST['language'], true) . '",
					"margin top" => ' . intval($_POST['margin_top']) . ',
					"margin left" => ' . intval($_POST['margin_left']) . ',
					"css class" => "' . clean_string($_POST['css_class'], true) . '",
					"css id" => "' . clean_string($_POST['css_id'], true) . '",
					
					"attributes" => "' . clean_string($_POST['attributes']) . '",
					"content" => "' . $_POST['textfield'] . '"
				);

				' . connector('view-code backend save') . '
				include_module("view-code");
			?>
		';
	}

?>