<?php
//  ------------------------------------------------------------------------ //
// 本模組由 tad 製作
// 製作日期：2007-11-04
// $Id: newspaper.php,v 1.2 2008/05/14 01:31:48 tad Exp $
// ------------------------------------------------------------------------- //

/*-----------引入檔案區--------------*/
include "header.php";
/*-----------function區--------------*/


//列出newspaper資料
function list_one_newspaper($npsn=""){
	global $xoopsDB,$xoopsModule,$xoopsUser,$xoopsOption,$xoopsModuleConfig;
	$xoopsOption['template_main'] = "list_tpl.html";
	
	$newspaper_list=newspaper_set_select($xoopsModuleConfig['newspaper_select']);

	 $main="
		<link href='show_layer.css' rel='stylesheet' type='text/css' />
		<script src='class/show_layer.js'></script>
		$newspaper_list
		<iframe src='{$_SERVER['PHP_SELF']}?op=preview&npsn={$npsn}' style='width:100%;height:640px;border:0px solid gray;clear:both'>
		</iframe>
	 ";
	
	return $main;
}


/*-----------執行動作判斷區----------*/
$_REQUEST['op']=(empty($_REQUEST['op']))?"":$_REQUEST['op'];
switch($_REQUEST['op']){

	case "preview":
	$main=preview_newspaper($_GET['npsn']);
	break;
	
	default:
	$main=list_one_newspaper($_GET['npsn']);
	break;
}

/*-----------秀出結果區--------------*/
if($_REQUEST['op']=="preview"){
  echo $main;
}else{
	include XOOPS_ROOT_PATH."/header.php";
	$xoopsTpl->assign('xoops_showrblock', 0);
	$xoopsTpl->assign( "css" , "<link rel='stylesheet' type='text/css' media='screen' href='".XOOPS_URL."/modules/tadnews/module.css' />") ;
	$xoopsTpl->assign( "toolbar" , toolbar($interface_menu)) ;
	$xoopsTpl->assign( "content" , $main) ;
	include_once XOOPS_ROOT_PATH.'/footer.php';
}

?>
