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

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

	include_txt($modules['list-news']['key'], $modules['list-news']['languages']);

/**
 * Save module to page
 *
 * @category   Module (list-news)
 * @author     Nico Wenig <nico.wenig@yellowgreen.de>
 * @version	   2009-06-26
 */
	
	if(isset($_POST['save_list_news'])) {
		// Parse data
		$_POST['latest'] = intval($_POST['latest']) == '' ? 10 : intval($_POST['latest']);
		$_POST['pages-number'] = intval($_POST['pages-number']) == '' ? 10 : intval($_POST['pages-number']);
		$_POST['show-author'] = isset($_POST['show-author']) ? 1 : 0;
		$_POST['show-date'] = isset($_POST['show-date']) ? 1 : 0;
		$_POST['show-teaser'] = isset($_POST['show-teaser']) ? 1 : 0;

		// Create module section
		$module_content_to_save = '
			<!-- MODULE: list-news -->
			
			<?php
				$module_settings["list-news"] = 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) . '",

					"mode" => "' . $_POST['mode'] . '",
					"archive page" => "' . clean_string($_POST['archive-page'], true) . '",
					"latest" => "' . $_POST['latest'] . '",
					"pages" => "' . $_POST['pages-number'] . '",
					"show author" => "' . $_POST['show-author'] . '",
					"show date" => "' . $_POST['show-date'] . '",
					"show teaser" => "' . $_POST['show-teaser'] . '"
				);

				' . connector('list-news backend save') . '
				include_module("list-news", false);
			?>
		';
	}

?>