<?php /*SVN-1324(5.0.09)*/
$SID = $cst->get("SID");
$mode = $cst->get("mode");
$meri = $cst->get("meri");
$user = $cst->get("user");
$ln = $cst->get("locale_name");
$lo = $cst->get("locale_obj");
$index = $cst->get("index");
$mutp = $cst->get("mutp");
$mdir = $cst->get("mdir");
$mtype = $index["PGTYPE"];
// HTML ENGINE BEGIN 
$hstr = "<div class=\"CS-postcontent\">";
if (!empty($index["PGTBCOR"]) || !empty($index["PGTFCOR"]) || 
	!empty($index["PGDBCOR"]) || !empty($index["PGDFCOR"]) || !empty($index["PGCBCOR"])) {
	$hstr .= "<style>";
	if (!empty($index["PGTBCOR"])) $hstr .= ".proj_".$mode."_rt_th{background-color:".$index["PGTBCOR"].";}";
	if (!empty($index["PGTFCOR"])) $hstr .= ".proj_".$mode."_rt_th td{color:".$index["PGTFCOR"].";}";
	if (!empty($index["PGDBCOR"])) $hstr .= ".proj_".$mode."_rt_td{background-color:".$index["PGDBCOR"].";}";
	if (!empty($index["PGDFCOR"])) $hstr .= ".proj_".$mode."_rt_td td{color:".$index["PGDFCOR"].";}";
	if (!empty($index["PGCBCOR"])) $hstr .= ".proj_".$mode."_rtc_td{background-color:".$index["PGCBCOR"].";}";
	if (!empty($index["PGCBCOR"]) && 
		!empty($index["PGDFCOR"])) $hstr .= ".proj_".$mode."_rtc_td td{color:".$index["PGDFCOR"].";}";
	$hstr .= "</style>";
}
$hstr .="<div id=\"".$mtype."\">".
			"<div data-role=\"collapsible\" id=\"colapi_search_".$mtype."\">".
				"<h4>".$lo->text("MENU_".$mode)."</h4>".
				"<div class=\"proj_all_dtdiv dtdiv_".$mtype."\">";
if ($index["MODNAME"] == "CSSETUP" || $index["MODNAME"] == "CSWEB_TMP") {
	$hstr .=		"<input type=\"hidden\" id=\"detail_items_".$mtype."\" value=\"\">";
}
if ($index["MODNAME"] == "CSWEB_BUP") {
	$hstr .=		"<div class=\"proj_all_dultab\">".
						"<div class=\"proj_all_dlitab proj_ret_dlitab dlitab_ret_search\" style=\"background-color: #838383;\">".
							"<a href=\"#\" style=\"color: #EEEEEE;\" onclick=\"change_view_page_two('.dtdiv_".$mtype." .proj_ret_dlitab','.dtdiv_".$mtype." .dlitab_ret_search','.dtdiv_".$mtype." .proj_ret_ddiv','.dtdiv_".$mtype." .ddiv_ret_search');\">".$lo->text("ADV_QUERY")."</a>".
						"</div>".
						"<div class=\"proj_all_dlitab proj_ret_dlitab dlitab_ret_bthupd\" style=\"background-color: #FFFFFF;\">".
							"<a href=\"#\" style=\"color: #AAAAAA;\" onclick=\"change_view_page_two('.dtdiv_".$mtype." .proj_ret_dlitab','.dtdiv_".$mtype." .dlitab_ret_bthupd','.dtdiv_".$mtype." .proj_ret_ddiv','.dtdiv_".$mtype." .ddiv_ret_bthupd');\">".$lo->text("BATCH_UPDATE")."</a>".
						"</div>".
					"</div>";
}
$hstr .= 			"<div class=\"proj_all_ddiv proj_ret_ddiv ddiv_ret_search\" id=\"".$index["PGSDIV"]."\"></div>";
if ($index["MODNAME"] == "CSWEB_BUP") {
	$hstr .=		"<div class=\"proj_all_ddiv proj_ret_ddiv ddiv_ret_bthupd\" id=\"batch_update_".$mtype."\" style=\"display: none;\"></div>";
}
$hstr .=		"</div>".
			"</div>".
			"<hr>".
			"<div id=\"".$index["PGLDIV"]."\"></div>".
		"</div>".
	"</div>".
	"<script>".
	"/* JQM 小部件UI優化 */\$('#".$mtype."').enhanceWithin();";
if (!empty($index["MODNAME"])) $hstr .= "if(typeof retmsg_popup_box == 'function'){retmsg_popup_box('','".$SID."','".$mode."');}";
switch ($index["MODNAME"]) {
	case "CSEXE_M":
	case "CSEXE_MD":
	case "CSEXE_MDS":
		$hstr .="var shfm = 'search_form_".$mtype."';".
				"function get_detail_".$mtype."(act,ERI,num){".
					"loading_create('');".
					"\$('#colapi_search_".$mtype."').collapsible('collapse');".
					"\$('#colapi_search_".$mtype."').collapsible('disable');".
					"if (num) \$('#result_num_".$mtype."').val(num);".
					"var url = '".$mdir."/".$mode."/detail.php?sid=".$SID."&mode=".$mode."&mutp=".$mutp."&act='+act+'&ERI='+ERI;".
					"var data = 'exec='+EncodeURLutf8(\$('#search_exec_".$mtype."').val())+".
							  "'&qwe='+EncodeURLutf8(\$('#search_where_".$mtype."').val())+".
							  "'&sor='+EncodeURLutf8(\$('#search_order_".$mtype."').val())+".
							  "'&itms='+EncodeURLutf8(\$('#detail_items_".$mtype."').val());".
					"post_redirect('".$index["PGLDIV"]."',data,url);".
				"}".
				"function flowmap_sub(ERI,TYPE){".
					"if (TYPE == 'log') {".
						"load_popup_box('".PATH_MODULE."FLOWLOG/index.php?sid=".$SID."&mode=FLOWLOG&MERI='+ERI,'".$lo->text("MENU_FLOWLOG")."',0,0);".
					"} else if (TYPE == 'file') {".
						"load_popup_box('core/cw5e_upload.php?sid=".$SID."&mode=".$mode."&list=A&type=L&mteri='+ERI,'Upload_List',0,0);".
					"}".
				"}";
		$hstr .="\$.ajaxSetup({async:false});".
				"post_redirect('".$index["PGSDIV"]."',".$index["PGWHERE"].",'core/cw5e_result_sh.php?sid=".$SID."&mode=".$mode."&mtype=".$mtype."&aid=".$index["QUERYSDC"]."&fdname=".$index["FDNAME"]."&bid=".$index["REPORTSDC"]."&del=".$index["PGDEL"]."&scrut=".$index["PGSCRT"]."&print=".$index["PGPNT"]."&xml=".$index["PGXML"]."&shfm='+EncodeURLutf8(shfm));";
		if (empty($meri)) {
			$hstr .="post_redirect('".$index["PGLDIV"]."',".$index["PGWHERE"].",'core/cw5e_result_lt.php?sid=".$SID."&mode=".$mode."&mtype=".$mtype."&aid=".$index["QUERYSDC"]."&fdname=".$index["FDNAME"]."&bid=".$index["REPORTSDC"]."&ccv=".urlencode($index["CCVVAL"])."&edtype=".$index["EDTYPE"]."&srgpd=".$index["SRGFD"]."&rqqty=".$index["RQQTY"]."&paqty=".$index["PAQTY"]."&new=".$index["PGNEW"]."&del=".$index["PGDEL"]."&scrut=".$index["PGSCRT"]."&print=".$index["PGPNT"]."&xml=".$index["PGXML"]."&file=".$index["PGFILE"]."&ffd=".$index["PGFKEY"]."&log=".$index["PGLOGE"]."&lfd=".$index["PGLKEY"]."&check=".$index["PGCHECK"]."&div=".$index["PGLDIV"]."&vtype=".$index["PGVIEW"]."&view=".$index["PGLIST"]."&shfm='+EncodeURLutf8(shfm));";
		} else {
			$hstr .="post_redirect('".$index["PGLDIV"]."',".$index["PGWHERE"].",'core/cw5e_result_lt.php?sid=".$SID."&mode=".$mode."&mtype=".$mtype."&aid=".$index["QUERYSDC"]."&fdname=".$index["FDNAME"]."&bid=".$index["REPORTSDC"]."&ccv=".urlencode($index["CCVVAL"])."&edtype=".$index["EDTYPE"]."&srgpd=".$index["SRGFD"]."&rqqty=".$index["RQQTY"]."&paqty=".$index["PAQTY"]."&new=".$index["PGNEW"]."&del=".$index["PGDEL"]."&scrut=".$index["PGSCRT"]."&print=".$index["PGPNT"]."&xml=".$index["PGXML"]."&file=".$index["PGFILE"]."&ffd=".$index["PGFKEY"]."&log=".$index["PGLOGE"]."&lfd=".$index["PGLKEY"]."&check=".$index["PGCHECK"]."&div=".$index["PGLDIV"]."&vtype=".$index["PGVIEW"]."&view=0&shfm='+EncodeURLutf8(shfm));".
					"\$('#colapi_search_".$mtype."').collapsible('collapse');".
					"\$('#colapi_search_".$mtype."').collapsible('disable');".
					"mode_feedpage_change('','".$SID."','".$mode."','newp','".$meri."','search_exec_,search_where_,search_order_,detail_items_','".$index["PGLDIV"]."','".$mtype."','".$mutp."');";
		}
		$hstr .="\$.ajaxSetup({async:true});";
		break;
	case "CSQUERY":
		$hstr .="var shfm = 'search_form_".$mtype."';".
				"\$.ajaxSetup({async:false});".
				"post_redirect('".$index["PGSDIV"]."',".$index["PGWHERE"].",'core/cw5e_result_sh.php?sid=".$SID."&mode=".$mode."&mtype=".$mtype."&aid=".$index["QUERYSDC"]."&fdname=".$index["FDNAME"]."&bid=".$index["REPORTSDC"]."&del=".$index["PGDEL"]."&scrut=".$index["PGSCRT"]."&print=".$index["PGPNT"]."&shfm='+EncodeURLutf8(shfm));".
				"post_redirect('".$index["PGLDIV"]."',".$index["PGWHERE"].",'core/cw5e_result_lt.php?sid=".$SID."&mode=".$mode."&mtype=".$mtype."&aid=".$index["QUERYSDC"]."&fdname=".$index["FDNAME"]."&bid=".$index["REPORTSDC"]."&ccv=".urlencode($index["CCVVAL"])."&edtype=".$index["EDTYPE"]."&srgpd=".$index["SRGFD"]."&rqqty=".$index["RQQTY"]."&paqty=".$index["PAQTY"]."&new=".$index["PGNEW"]."&del=".$index["PGDEL"]."&scrut=".$index["PGSCRT"]."&print=".$index["PGPNT"]."&file=".$index["PGFILE"]."&ffd=".$index["PGFKEY"]."&log=".$index["PGLOGE"]."&lfd=".$index["PGLKEY"]."&check=".$index["PGCHECK"]."&div=".$index["PGLDIV"]."&vtype=".$index["PGVIEW"]."&view=".$index["PGLIST"]."&gtbv=0&shfm='+EncodeURLutf8(shfm));".
				"\$.ajaxSetup({async:true});".
				"function get_detail_".$mtype."(act,ERI,num){/* 無動作 */}".
				"function flowmap_sub(ERI,TYPE){".
					"if (TYPE == 'log') {".
						"load_popup_box('".PATH_MODULE."FLOWLOG/index.php?sid=".$SID."&mode=FLOWLOG&MERI='+ERI,'".$lo->text("MENU_FLOWLOG")."',0,0);".
					"} else if (TYPE == 'file') {".
						"load_popup_box('core/cw5e_upload.php?sid=".$SID."&mode=".$mode."&list=A&type=L&mteri='+ERI,'Upload_List',0,0);".
					"}".
				"}";
		break;
	case "CSWEB_BUP":
		$hstr .="var shfm = 'search_form_".$mtype."';".
				"\$.ajaxSetup({async:false});".
				"post_redirect('".$index["PGSDIV"]."',".$index["PGWHERE"].",'core/cw5e_result_sh.php?sid=".$SID."&mode=".$mode."&mtype=".$mtype."&aid=".$index["QUERYSDC"]."&fdname=".$index["FDNAME"]."&bid=".$index["REPORTSDC"]."&del=".$index["PGDEL"]."&scrut=".$index["PGSCRT"]."&print=".$index["PGPNT"]."&shfm='+EncodeURLutf8(shfm));".
				"post_redirect('".$index["PGLDIV"]."',".$index["PGWHERE"].",'core/cw5e_result_lt.php?sid=".$SID."&mode=".$mode."&mtype=".$mtype."&aid=".$index["QUERYSDC"]."&fdname=".$index["FDNAME"]."&bid=".$index["REPORTSDC"]."&ccv=".urlencode($index["CCVVAL"])."&edtype=".$index["EDTYPE"]."&srgpd=".$index["SRGFD"]."&rqqty=".$index["RQQTY"]."&paqty=".$index["PAQTY"]."&new=".$index["PGNEW"]."&del=".$index["PGDEL"]."&scrut=".$index["PGSCRT"]."&print=".$index["PGPNT"]."&file=".$index["PGFILE"]."&ffd=".$index["PGFKEY"]."&log=".$index["PGLOGE"]."&lfd=".$index["PGLKEY"]."&check=".$index["PGCHECK"]."&div=".$index["PGLDIV"]."&vtype=".$index["PGVIEW"]."&view=".$index["PGLIST"]."&gtbv=0&shfm='+EncodeURLutf8(shfm));".
				"create_modedetail('#batch_update_".$mtype."','core/cw5e_engine_detail.php?sid=".$SID."&mode=".$mode."&mutp=".$mutp."&mtype=".$mtype."&act=ctbudui','');".
				"\$.ajaxSetup({async:true});".
				"function get_detail_".$mtype."(act,ERI,num){/* 無動作 */}".
				"function flowmap_sub(ERI,TYPE){".
					"if (TYPE == 'log') {".
						"load_popup_box('".PATH_MODULE."FLOWLOG/index.php?sid=".$SID."&mode=FLOWLOG&MERI='+ERI,'".$lo->text("MENU_FLOWLOG")."',0,0);".
					"} else if (TYPE == 'file') {".
						"load_popup_box('core/cw5e_upload.php?sid=".$SID."&mode=".$mode."&list=A&type=L&mteri='+ERI,'Upload_List',0,0);".
					"}".
				"}";
		break;
	case "CSSETUP":
		$hstr .="\$('#colapi_search_".$mtype."').collapsible('collapse');".
				"\$('#colapi_search_".$mtype."').collapsible('disable');".
				"var url = '".$mdir."/".$mode."/detail.php?sid=".$SID."&mode=".$mode."&mutp=".$mutp."&act=setupview&ERI=';".
				"var data = 'itms='+EncodeURLutf8(\$('#detail_items_".$mtype."').val());".
				"\$.ajaxSetup({async:false});".
				"post_redirect('".$index["PGLDIV"]."',data,url);".
				"\$.ajaxSetup({async:true});";
		break;
	case "CSWEB_TMP":
		$hstr .="\$('#colapi_search_".$mtype."').collapsible('collapse');".
				"\$('#colapi_search_".$mtype."').collapsible('disable');".
				"var url = '".$mdir."/".$mode."/detail.php?sid=".$SID."&mode=".$mode."&mutp=".$mutp."&act=tempview&ERI=';".
				"var data = 'itms='+EncodeURLutf8(\$('#detail_items_".$mtype."').val());".
				"\$.ajaxSetup({async:false});".
				"post_redirect('".$index["PGLDIV"]."',data,url);".
				"\$.ajaxSetup({async:true});";
		break;
	default:
		$hstr .="\$('#".$index["PGLDIV"]."').html('未設定相關模組之底層功能!');";
		break;
}
$hstr .="/* 控制首頁版面 foot 高度 */".
	"if(\$('#content').height() <= 550){\$('#page_body').height(585);}else{\$('#page_body').height(\$('#content').height()+35);}";
if (!empty($index["PGFATP"]) && empty($meri)) {
	$hstr .="\$('#colapi_search_".$mtype."').collapsible('expand');".
			"setTimeout(function(){\$('#K_".$index["PGFAQ"]."').focus();},500);";
}
$hstr .="</script>";
// HTML ENGINE END 
echo $hstr;
?>