<?php require_once('../../../Connections/book.php'); ?><?php require_once('../../../Connections/session_admin.php'); ?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<title>Создание файла с сылками группы</title>
<link rel="stylesheet" href="../css/style.css" type="text/css" media="all" />
<link rel="stylesheet" href="../spaw-php-2081-gpl/spaw2/wysiwyg.css" type="text/css" media="all" />
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/animatedcollapse.js"></script>
</head>

<body>
<script type="text/javascript" src="../js/wz_tooltip.js"></script>
<script type="text/javascript" src="../js/tip_followscroll.js"></script>
<script type="text/javascript" src="../js/tip_centerwindow.js"></script>


<?
$q_cf_num="количество";
if(!isset($_GET['id_group'])) die(" Не указан идентификатор "); else echo $_GET['id_group'];
if(!is_numeric($_GET['id_group'])) die(" Идентификатор группы должен быть числом ");
///////////////////////////////////////////////////////////////////////////////////////////////////////
$q="SELECT * FROM dop_files_group WHERE id_group='".$_GET['id_group']."'";
$q=mysql_query($q);
$q_num=mysql_num_rows($q);
if($q_num>0)
{
	while($r=mysql_fetch_array($q))
	{
	extract($r);
	}  // while($r=mysql_fetch_array($q))
} else die(" Такой группы не найдено ");  // if($q_num>0)
$GROUP_dir="../../GROUP/".$real_group_glava;
if(!is_dir($GROUP_dir)) { mkdir($GROUP_dir,0777); }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$file_path=$sait_address.$book_folder."dop/GROUP/".$real_group_glava."/".$id_group.".html"; //echo code_link($file_path);
$view_patch=$sait_address.$book_folder."design/view_group.gif";
$view_patch_attr=getimagesize($view_patch);
// $file_path=code_link($file_path);
?>
<img src="<?=$view_patch?>" <?=$view_patch_attr[3]?> border="0" style="cursor:pointer;" onMouseOver="Tip('<iframe name=group_files id=group_files src=<?=$sait_address.$book_folder?>dop/GROUP/<?=$real_group_glava?>/<?=$id_group?>.html width=1000 height=500></iframe>', CLOSEBTNTEXT, ' Нажми и закрой [X]', CLICKSTICKY, true,  CLOSEBTN, true,OFFSETX,-50,OFFSETY,5,EXCLUSIVE,true, TITLE,'<a target=group_files href=<?=$sait_address.$book_folder?>dop/GROUP/<?=$real_group_glava?>/<?=$id_group?>.html class=\'group_links\'>Список файлов группы</a>')" onMouseOut="UnTip()" style="cursor:pointer;">
<hr>
<?
$a=0;
$q_cf="SELECT * FROM dop_files WHERE glava_group='$id_group'";
$q_cf=mysql_query($q_cf);
$q_cf_num=mysql_num_rows($q_cf);
if($q_cf_num>0)
{
	$begin_group_files="
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\" />
<title>Священный вертеп. Лео Таксиль.</title>
<link rel=\"stylesheet\" href=\"../../../css/style.css\" type=\"text/css\" media=\"all\" />
<link rel=\"stylesheet\" href=\"../../../css/wysiwyg.css\" type=\"text/css\" media=\"all\" />
<script type=\"text/javascript\" src=\"../../../js/jquery.min.js\"></script>
<script type=\"text/javascript\" src=\"../../../js/animatedcollapse.js\"></script>
</head>

<body>
<script type='text/javascript' src='../../../js/wz_tooltip.js'></script>
<script type='text/javascript' src='../../../js/tip_followscroll.js'></script>
<script type='text/javascript' src='../../../js/tip_centerwindow.js'></script>
";

$html_group_files="<table width='100%'>";
while($rl=mysql_fetch_array($q_cf))
{
if($rl['real_glava']!=$rl['glava']) $rl['glava']=$rl['real_glava'];
	// echo "<h1>".$rl['real_glava']."</h1>";
$a++;
$file_path=$sait_address.$book_folder."dop/".$rl['glava']."/".$rl['file_name'];
$code_link_file_path=code_link($file_path);

$html_group_files.="<tr><td width=\"10\" valign=\"top\" class=\"num_file_style\">".$a."</td><td>";

 if($rl['file_type']=='jpg'||$rl['file_type']=='jpeg'||$rl['file_type']=='gif'||$rl['file_type']=='png'||$rl['file_type']=='JPG'||$rl['file_type']=='JPEG'||$rl['file_type']=='GIF'||$rl['file_type']=='PNG') 
 {
	 $prev_img="../../../dop/IMG/".$rl['glava']."/prev_w100/".$rl['file_name'];
		$prev_big_img="../../../dop/IMG/".$rl['glava']."/big_h600/".$rl['file_name'];
		$prev_big_img2="../../../dop/IMG/".$rl['glava']."/big_h400/".$rl['file_name']; // echo $prev_big_img2;
		$original_img="../../../dop/".$rl['glava']."/".$rl['file_name'];
if(!is_file($prev_big_img)) {
	if(is_file($prev_big_img2)) {
$prev_big_img=$prev_big_img2;	
} else $prev_big_img= $original_img;
}
		
		
	 if(is_file($original_img))
	{
		
		if(is_file($prev_img)) $img_attr=getimagesize($prev_img);
		if(is_file($prev_big_img)) $big_img_attr=getimagesize($prev_big_img); $big_img_attr=getimagesize($prev_big_img);
		if(is_file($original_img)) $orig_img_attr=getimagesize($original_img);


$html_group_files.="<img align=left class=\"photo\" src=\"".code_link($prev_img)."\" ".$img_attr['3']." style=\"cursor:pointer;\" onMouseOver=\"Tip('";
if(is_file($prev_big_img)) { 
$html_group_files.="<img src=".code_link($prev_big_img)." width=".$big_img_attr['0']." height=".$big_img_attr['1'].""; 
} 
  else { 
  if(is_file($original_img)) 
  { 
  $html_group_files.="<img vspace='10' hspace='10' src=".$original_img." width=".$orig_img_attr['0']." height=".$orig_img_attr['1'].">";
	 } // if(is_file($original_img)) {
	 }  // else {
	 }  // if(is_file($prev_big_img)) {
 
$html_group_files.="',CLOSEBTNTEXT, 'Первый Клик фиксирует. Второй - по центру.', CLICKSTICKY, true, CLICKCLOSE, true, CLOSEBTN, true,OFFSETX,-50,EXCLUSIVE,true,TITLE,'";
if(is_file($prev_big_img)) { 
$html_group_files.="  >>> <a target=_blank href=".$original_img."> оригинал (".$orig_img_attr['0']." X ".$orig_img_attr['1'].") </a>";
$html_group_files.="', BGCOLOR,'#ffffff')\" onClick=\"Tip('";
if(is_file($prev_big_img)) { $html_group_files.="<img src=".code_link($prev_big_img)." width=".$big_img_attr['0']." height=".$big_img_attr['1']."";
 } 
	 else {  if(is_file($original_img)) { $html_group_files.="<img src=".$original_img." width=".$orig_img_attr['0']." height=".$orig_img_attr['1'].">"; 
	 } // if(is_file($original_img)) {
	 }  // else {
	 $html_group_files.="', CLOSEBTNTEXT, 'ЗАКРЫТЬ [X]',STICKY, true, CENTERWINDOW, true, CENTERALWAYS,true, CLOSEBTN, true,EXCLUSIVE,true,TITLE,'";
if(is_file($prev_big_img)) { 
$html_group_files.="  >>> <a target=_blank href=".$original_img."> оригинал (".$orig_img_attr['0']." X ".$orig_img_attr['1'].") </a>"; 
} /* else { if(is_file($original_img)) echo \" это оригинал \"; else echo \" картинка не найдена \";  } */ 
$html_group_files.="', BGCOLOR, '#ffffff')\" onMouseOut=\"UnTip()\"/>";

	} // if(is_file($file_path))
 } // if($file_type=='jpg'||$file_type=='jpeg'||$file_type=='gif'||$file_type=='png'||$file_type=='JPG'||$file_type=='JPEG'||$file_type=='GIF'||$file_type=='PNG') 


$html_group_files.="<a href='".$code_link_file_path."' target='_blank'>";
$html_group_files.="<img src='".$sait_address.$book_folder."design/new_page.png' width='10' height='10' border='0'/></a>&nbsp;&nbsp;";
$html_group_files.="<b><a href='$file_path'>";
if(empty($rl['file_title'])) $html_group_files.=$rl['file_name']; else $html_group_files.=$rl['file_title'];
$html_group_files.="</a></b> ";
$html_group_files.=$rl['file_title_dop'];


if($rl['file_type']=='flv') {
	 $html_group_files.="<hr>";
	$video_file=$sait_address.$book_folder."dop/".$rl['glava']."/".$rl['file_name']; //echo $video_file;
	$video_img_file=$sait_address.$book_folder."dop/VIDEO_IMG/".$rl['glava']."/".$rl['video_img'];
$html_group_files.="
<embed src='".$sait_address.$book_folder."mp3/player-viral.swf' height='300' width='600' allowscriptaccess='always' allowfullscreen='true' flashvars=\"&dock=false&autostart=false&file=".$video_file."&image=".$video_img_file."\"/></embed>
"; 
} // if($file_type!='flv') {
	
 
if(!empty($rl['desc_file']))
{
 
$html_group_files.="<br />
  <script type=\"text/javascript\">
animatedcollapse.addDiv('file".$rl['id_df']."', 'fade=1')
animatedcollapse.ontoggle=function($, divobj, state){  
}
animatedcollapse.init()
</script>";

$html_group_files.="<a href=\"javascript:animatedcollapse.toggle('file".$rl['id_df']."')\" class=\"show_hide_div\">
<div class=\"show_hide_div\">&nbsp;&nbsp;Показать / Скрыть цитаты из файла.&nbsp;&nbsp;</div></a> 
 
<div id=\"file".$rl['id_df']."\" style=\"width: 100%; display:none;\" class=\"txt\">
<div class=\"zitata\" width=\"100%\">
 ".$rl['desc_file']."
</div>
<!--<table width=\"80%\" class=\"zitata\">
      <tbody>
        <tr>
          <td class=\"laquo-raquo\">«</td>
          <td width=\"80%\" class=\"zitata_text\">".$rl['desc_file']."</td>
          <td class=\"laquo-raquo\">»</td>
        </tr>
      </tbody>
    </table> -->


<br /> 
    <a href=\"javascript:animatedcollapse.toggle('file".$rl['id_df']."')\" class=\"show_hide_div\">&nbsp;&nbsp;Скрыть&nbsp;&nbsp;</a> 
</div>";
 
}  // if(!empty($rl['desc_file']))
 
 
 $html_group_files.="</td></tr>";

}  // while($rl=mysql_fetch_array($q_list))
$html_group_files.="</table>";
$end_group_files="</body></html>";
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$write_file="../".$real_group_glava."/".$id_group.".html";
$fp=fopen($write_file,"w");
$fw=fwrite($fp,$begin_group_files.$html_group_files.$end_group_files);
$fc=fclose($fp);
} // if($q_cf_num>0)
?>
<?
if(isset($_GET['no_show'])) die("</body></html>");
?>
<? 
// echo $html_group_files
?>
<?
if(isset($html_group_files))
{
echo $html_group_files;
?>
<hr>
<textarea name="" cols="43" rows="5"><img src="<?=$view_patch?>" <?=$view_patch_attr[3]?> border="0" style="cursor:pointer;" onMouseOver="Tip('<iframe name=group_files id=group_files src=<?=$sait_address.$book_folder?>dop/GROUP/<?=$real_group_glava?>/<?=$id_group?>.html width=1000 height=500></iframe>', CLOSEBTNTEXT, ' Нажми и закрой [X]', CLICKSTICKY, true,  CLOSEBTN, true,OFFSETX,-50,OFFSETY,5,EXCLUSIVE,true, TITLE,'<a target=group_files href=<?=$sait_address.$book_folder?>dop/GROUP/<?=$real_group_glava?>/<?=$id_group?>.html class=\'group_links\'>Список файлов группы</a>')" onMouseOut="UnTip()" style="cursor:pointer;"></textarea>
<?
} else echo " Нет файлов "; // if(isset($html_group_files))
?>

</body>
</html>