Location: PHPKode > projects > Phpress > phpress/displaymain.php
<?
/*
    Copyright (C)2004-2007  Matthieu Perez - hide@address.com

    This file is part of PhPress.

    PhPress is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    PhPress is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with PhPress.  If not, see <http://www.gnu.org/licenses/>.
*/
//displaymain.php
// display pages
session_start();

require 'program/common/constantes.php' ;
require LANG_PATH . $lang ."/msg.php";
require PROG_COM_PATH .'functions_mysql.php';
require PROG_COM_PATH . 'functions_common.php';
require 'program/html/default.css';
require PROG_COM_PATH . 'get_filename.php';
   
///////////////////////////////////////////////////////////////////////
// PNG
//
if($display_img_ext=="PNG")
//else
{
   // get the size of png file
   $png_size_request="SELECT PNG_Width, PNG_Height, Status FROM Pages WHERE FileName='$filename' ";
   $png_size_query_result=sql_request($db, $png_size_request) ;
   $png_size_result=mysql_fetch_array($png_size_query_result);
   $png_width=$png_size_result[0];                
   $png_height=$png_size_result[1];
   $png_status=$png_size_result[2];
   
 // display format :
   if($zoom_ratio)
   {
   $display_png_width_zoomed=(int)($png_width * $zoom_ratio / 100);
   $display_png_height_zoomed=(int)($png_height * $zoom_ratio / 100);
   }
   else
   {
   setcookie("zoom_ratio", "100") ;
   $display_png_width_zoomed=$png_width;
   $display_png_height_zoomed=$png_height;
   }
   
   // set autoscroll :
   $scroll_x=(int)($ximg * $zoom_ratio / 100);
   $scroll_y=(int)($yimg * $zoom_ratio / 100);
           
//////////////////////////////////
// analysis display  :
//////////////////////////////////
//print "program=$program ( Analysis )";
   if($program=='Analysis')
   {

   // create the image with colored shapes
    $tmpimg="users/$user/tmp/tmp-$filename.png";
    //print "tmpimg=$tmpimg";

   if(!file_exists($tmpimg)) 
   {
   include PROG_ANA_PATH . 'create_image.php' ;
   }
   
   if($working=='reload')
   {
   setcookie("working", "0");
   include PROG_ANA_PATH . 'create_image.php' ;
   print '
      <script language=\'javascript\'>
          close("blocks_mainframe.php", "blocks_mainframe") ;
          parent.frames[\'displaymain\'].location=\'displaymain.php\';   
parent.frames[\'displaymenu\'].location=\'displaymenu.php\';   
          </script>';
      }  
 
     // image path 
    $tmpimg="users/$user/tmp/tmp-$filename.png";
   
   print '
   <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
   <META HTTP-EQUIV="Cache-Control" CONTENT="must-revalidate, max-age=1">
   <body>
   <a href ="map.php" >    
   <IMG style="cursor:pointer;cursor:crosshair" src="'. $tmpimg . '" type="image/png" width="'.$display_png_width_zoomed.'" height="'.$display_png_height_zoomed.'" border="0" ismap onload=\'window.scrollTo('.$scroll_x.','.$scroll_y.')\' >';
   
   // open the block dialog when working phase = 5
      if($working=='5')
      {
      // open the new block dialog
      print '<br>
          <script language=\'javascript\'>
          open("blocks_mainframe.php", "blocks_mainframe" );  
          </script>';  
      }
   }
   
   // basical png display (should be upgraded later and should use the same routine than the analysis mode, but without writing rights, of course)
   else
   { 
   print '<a href ="map.php" >    
   <IMG style="cursor:pointer;cursor:crosshair" src="'. $display_img_png_path . '" type="image/png" width="'.$display_png_width_zoomed.'" height="'.$display_png_height_zoomed.'" border="0" ismap onload=\'window.scrollTo('.$scroll_x.','.$scroll_y.')\'>';
   }

}

// TIF :
// nota : lots of browsers doesn't support tiff format natively
if($display_img_ext=="TIF")
{
print '<script language=\'javascript\'>
	parent.frames[\'displaymain\'].location=\''.$display_img_tif_path.'\';
	</script>';
}
?>
Return current item: Phpress