<?php
include("./newlib/img.php");
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////
function startElement($parser, $name, $attrs)
{
global $currentTag;
global $depth;
$currentTag = $name;
for ($i = 0; $i < $depth[$parser]; $i++) {
echo " ";
}
// echo "$parser, $name, $attrs , $attrs[0] : $attrs[1] <br>";
$depth[$parser]++;
}
function endElement($parser, $name)
{
global $depth;
$depth[$parser]--;
}
function characterData($parser, $data)
{
global $var_sql,$var_t;
global $title,$wdate,$body;
global $currentTag;
switch ($currentTag) {
case "PUBLISHDATE":
$data=trim($data);
if($data) {
$wdate .=$data;
// echo" $data <br> ";
}
break;
case "HEADLINE":
$data=trim($data);
if($data) {
$title .=$data;
// echo" $data <br> ";
}
break;
case "AUTHOR":
if($data) {
$data=trim($data);
$body2 .=$data;
//echo" $body <br> ";
}
break;
case "ORGFILENAME":
if($data) {
$data=trim($data);
$body .=$data;
// echo" $body <br> ";
}
break;
}
$var_t++;
}
/////////////////////////////////////////////////////////////////////////////////////
//$file = "testxml.xml";
$depth = array();
$currentTag = "";
$var_t=1;
$title="";
$wdate="";
$body="";
$body2="";
////////////////////////////////////////////////////////////
?>
<html>
<head>
<title>전체기사목록</title>
<meta http-equiv='Content-Type' content='text/html; charset=euc-kr'>
<style type='text/css'>
<!--
-->
</style>
<script language='JavaScript'>
<!--
function schang() {
var a;
a=document.news_checkbox.section_level.options[document.news_checkbox.section_level.selectedIndex].value;
location.href="<?=$PHP_SELF?>?section="+a;
}
function newslevel_chang() {
var a ;
var t=0;
for( var i=0 ; i<document.news_checkbox.elements.length; i++ ) {
if(document.news_checkbox.elements[i].checked == true ) {
t++;
}
}
if(t =="0") {
alert(' 1개이상은 선택을 해야 합니다. ');
return;
} else {
a=document.news_checkbox.news_level.options[document.news_checkbox.news_level.selectedIndex].value;
document.news_checkbox.news_level_value.value=a;
document.news_checkbox.mode.value='news_level_mode';
document.news_checkbox.section.value='<?echo"$section"?>';
document.news_checkbox.submit();
}
}
function select_all()
{
var i;
for(i=0; i<document.news_checkbox.elements.length; i++)
document.news_checkbox.elements[i].checked = false;
}
function reverse()
{
var i;
for(i=0; i<document.news_checkbox.elements.length; i++)
if (document.news_checkbox.elements[i].name.indexOf(
'@'))
document.news_checkbox.elements[i].checked = !document.news_checkbox.elements[i].checked;
}
function checked_del() {
var t=0;
for( var i=0 ; i<document.news_checkbox.elements.length; i++ ) {
if(document.news_checkbox.elements[i].checked == true ) {
t++;
}
}
if(t =="0") {
alert(' 1개이상은 선택을 해야 합니다. ');
return;
} else {
if(confirm('DB에 입력 하시겠습니까?')) {
document.news_checkbox.mode.value='checked_del';
document.news_checkbox.submit();
} else {
return;
}
}
}
//-->
</script>
<link rel='stylesheet' href='css/admin.css' type='text/css'>
</head>
<body>
<form action='img_xml_move.php' name=news_checkbox method=post>
<input type="hidden" name="mode">
<input type="hidden" name="news_level_value">
<input type="hidden" name="section" >
<input type="hidden" name="page" value='<?echo("$page");?>'>
<a href=javascript:reverse();><img src='./admin/img/all_select.gif' border=0></a><a href=javascript:select_all();>
<img src='./admin/img/non_select.gif' border=0></a>
<a href='javascript:checked_del()'>DB로 변환</a>
<?
$t=1;
$dir_ls_list="./data/ccilbo_com/image/";
$dir_xml_data="./data/ccilbo_com/xml/";
$dir_list=opendir($dir_ls_list);
while($f_name_list=readdir($dir_list)) {
$t++;
if($f_name_list=="." || $f_name_list=="..") {
} else {
//echo("$f_name_list<br>");
$f_l_name=get_last_file_name($f_name_list);
// xml 시작
if($f_l_name=="xml" || $f_l_name=="XML") {
$file=$dir_ls_list.$f_name_list;
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "characterData");
if (!($fp = fopen($file, "r"))) {
die("XML 입력을 열 수 없습니다.");
}
while ($data = fread($fp, 4096)) {
if (!xml_parse($xml_parser, $data, feof($fp))) {
echo("XML 에러: 파일이름: $f_name_list <br>");
}
}
xml_parser_free($xml_parser);
$f_f_name=explode(".",$f_name_list);
$org_l_name=get_last_file_name($body);
$lnk_file_name=$f_f_name[0].".".$org_l_name;
if($org_l_name=="eps" || $org_l_name=="EPS") {
$img_view_var="<a href='$dir_ls_list/$lnk_file_name' target=_blank>$lnk_file_name</a>";
} else {
$img_view_var="<img src='$dir_ls_list/$lnk_file_name' width=200>";
}
echo("<table border=1><tr><td> 제목: $title <input type='checkbox' name='news_checked[]' value='$f_name_list'> </td>
</tr> <tr><td> 날짜: $wdate 등록자: $body2 파일명: $body : $org_l_name </td>
</tr> <tr><td> $img_view_var
</td>
</tr>
</table>
");
unset($title);
unset($wdate);
unset($body);
//unset($body2);
// xml 끝
}
}
if($t==20) {
exit;
}
}
?>
</form>