<?php
// $Id: content_typed.menu.php,v 1.3 2003/09/29 06:45:56 eddieajau Exp $
/**
* Administrator menu typed content event handler
* @package Mambo Open Source
* @Copyright (C) 2000 - 2003 Miro International Pty Ltd
* @ All rights reserved
* @ Mambo Open Source is Free Software
* @ Released under GNU/GPL License: http://www.gnu.org/copyleft/gpl.html
* @version $Revision: 1.3 $
**/

// ensure this file is being included by a parent file
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

//$types[] = mosHTML::makeOption( 'new_item', 'Content Item' );
$types[] = mosHTML::makeOption( 'content_typed', 'Typed Content' );

$reqpath = "$mosConfig_absolute_path/administrator/components/com_menus/content_typed";
require_once( "$reqpath/content_typed.class.php" );
require_once( "$reqpath/content_typed.menu.html.php" );

$cid = mosGetParam( $_POST, 'cid', array(0) );
if (!is_array( $cid )) {
	$cid = array(0);
}

switch ($task) {
	case "content_typed":
		// this is the new item, ie, the same name as the menu `type`
		content_typed_menu::edit( 0, $menutype, $option );
		break;

	case "edit":
		content_typed_menu::edit( $cid[0], $menutype, $option );
		break;

	case "save":
		content_typed_menu::save( $option );
		break;

	case "publish":
	case "unpublish":
		// synchronise the publishing of the content item
		// $menu object and $publish have already been defined when this file
		// is included
		if ($msg = content_typed_menu::publish( $menu, ($task == 'publish') )) {
			echo "<script> alert('$msg'); window.history.go(-1); </script>\n";
			exit();
		}
		break;

	case "remove":
		if ($msg = content_typed_menu::remove( $menu )) {
			echo "<script> alert('$msg'); window.history.go(-1); </script>\n";
			exit();
		}
		break;
}
?>
