<?php
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/../include/pub_datalist_dm.php");
setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/");
CheckPurview('story_books');
if(!isset($action)) $action = '';
if(!isset($keyword)) $keyword = "";
if(!isset($bid)) $bid = 0;
if(!empty($bookid)) $bid = $bookid;


$dsql = new DedeSql(false);

$addquery = " id>0 ";
$orderby = " order by id desc ";
if($keyword!="") $addquery .= " And (bookname like '%$keyword%' Or chaptername like '%$keyword%') ";
if($bid!=0) $addquery .= " And bookid='$bid' ";

$query = "
   Select * From #@__story_chapter where $addquery $orderby
";

//echo $query;

$dlist = new DataList();
$dlist->pageSize = 20;
$dlist->SetParameter("keyword",$keyword);
$dlist->SetParameter("bid",$bid);
$dlist->SetSource($query);
include(dirname(__FILE__)."/templets/story_list_chapter.htm");
$dlist->Close();
$dsql->Close();
?>