 |
|
|  |
ÇöÀç µð·ºÅ丮(Æú´õ) ÆÄÀÏ ¸ñ·Ï º¸±â, PHP¼Ò½º |
|
|
 |
13³â Àü |
ÇöÀç µð·ºÅ丮(Æú´õ)¿¡ ÀÖ´Â ÆÄÀÏµé ¸ñ·ÏÀ» º¸¿©ÁÖ°í ¸µÅ©¸¦ ´Þ¾ÆÁÖ´Â ÀÛÀº PHP+JAVASCRIPT ÄÚµåÀÔ´Ï´Ù. º¸¿©ÁÙ ÆÄÀÏ È®ÀåÀÚ¸¦ Á¦ÇÑÇÒ ¼ö ÀÖ°í ¼±ÅÃÀûÀ¸·Î º¸¿©ÁÙ ¼ö ÀÖµµ·Ï µÇ¾î ÀÖ½À´Ï´Ù. PHP ·Î µð·ºÅ丮¿Í ÆÄÀϵéÀ» ¾î¶»°Ô ´Ù·ê ¼ö ÀÖ´Â Áö ¾Ë ¼ö ÀÖ´Â ¼Ò½ºÄÚµåÀ̸ç Àû´çÈ÷ °¡°øÇؼ ½Ç¹«¿¡µµ »ç¿ëÇÒ ¼öµµ ÀÖ°Ú½À´Ï´Ù.
<html>
<head>
<title>ÇöÀç Æú´õ ÆäÀÌÁö ¸ñ·Ï</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<style type="text/css">
A:link {color:#3366CC; text-decoration:none;}
A:active {color:#1F3174; text-decoration:none;}
A:visited {color:#999999; text-decoration:none;}
A:hover {color:#FF9966; text-decoration:underline;}
IMG { border: 0; }
body {margin:0px; padding:0px}
span {color:#7C9CA7; font:11px µ¸¿ò; line-height:19px;}
</style>
<body leftmargin="0" topmargin="0">
<table border=0 cellpadding=0 cellspacing=0><tr>
<td width=10></td>
<?
$start_page = "page_list.php";
$ext_array = array("php", "html", "htm", "gif", "jpg", "png");
$ext_max = count($ext_array);
$path = "./";
for ($n=0;$n<$ext_max;$n++) {
echo "<td><input type='checkbox' name='add_" . $ext_array[$n] . "' checked onclick='redisplay_page()'></td><td width=30><span>" . $ext_array[$n] . "</span></td>";
}
?>
</tr></table>
<script>
var files = Array();
<?
if ($dir = opendir($path)) {
while ($file = readdir($dir)){
if (is_dir($path.$file)) {
if ($file != '.' && $file != '..') {
if (file_exists("$file/$start_page")) {
echo "files[files.length]='$file/$start_page';\n";
}
} else {
}
} else {
if ($file!=$start_page){
$name_array = pathinfo($file);
$ext = $name_array['extension'];
if (strlen(str_replace($ext_array,"",$ext))==0) echo "files[files.length]='$file';\n";
}
}
}
closedir($dir);
}
?>
var stagex=10,stagey=20,x,y,n,z,cellw=220,cellh=20,obj,n;
function display_page() {
files.sort();
var i = 0, pass;
for (n=0;n<files.length;n++){
temp_arr = (files[n].replace(/ /gi,"%20").replace(/\\/gi,"/")).split(".");
temp_ext = temp_arr[temp_arr.length-1];
pass = 0;
switch (temp_ext){
<?
for ($n=0;$n<$ext_max;$n++) {
echo "case '".$ext_array[$n]."': if (!document.getElementsByName('add_".$ext_array[$n]."')[0].checked) pass = 1; break;\n";
}
?>
default : pass=1; break;
}
if (pass) continue;
//x = stagex + 1+(n % 4)*cellw;
//y = stagey + 1+ Math.floor(n/4) * cellh;
x = stagex + 1+ Math.floor(i/30) * cellw;
y = stagey + 1+ (i % 30) * cellh;
document.write('<div id="block_'+n+'" style="position:absolute; background-color:#efefef; z-index:'+z+'; left:'+x+'px; top:'+y+'px; width:'+(cellw-1)+'px; height:'+(cellh-1)+'px; padding-left:5px; display:block"><span>'+(10001+i).toString().substring(1)+': <a href="'+files[n]+'">'+files[n].replace('<?=$start_page;?>','')+'</a> <a href="'+files[n]+'" target=_blank>¡ã</a></span></div>');
i++;
}
}
function redisplay_page() {
var i = 0, pass, obj;
for (n=0;n<files.length;n++){
temp_arr = (files[n].replace(/ /gi,"%20").replace(/\\/gi,"/")).split(".");
temp_ext = temp_arr[temp_arr.length-1];
pass = 1;
switch (temp_ext){
<?
for ($n=0;$n<$ext_max;$n++) {
echo "case '".$ext_array[$n]."': if (!document.getElementsByName('add_".$ext_array[$n]."')[0].checked) pass = 0; break;\n";
}
?>
default : pass=1; break;
}
if (pass) {
//x = stagex + 1+(n % 4)*cellw;
//y = stagey + 1+ Math.floor(n/4) * cellh;
x = stagex + 1+ Math.floor(i/30) * cellw;
y = stagey + 1+ (i % 30) * cellh;
obj = document.getElementById('block_'+n);
obj.style.display='block';
obj.style.left = x;
obj.style.top = y;
i++;
} else {
document.getElementById('block_'+n).style.display='none';
}
}
}
display_page();
</script>
</body>
</html>
|
|
̵̧ : 621 |
̵̧
¸ñ·Ï
|
|
|  |
|