|
From: Paulo H. S. de S. <ph...@us...> - 2004-05-26 00:07:08
|
Update of /cvsroot/uts/uts/src/www In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27485/src/www Modified Files: apontar.php arquivo.php display.php download.php formApontar.php home.php login.php logout.php utils.php Added Files: TODO formOpcoes.php opcoes.php Log Message: - adicionado formulario para configuracao de diretorios padrao - reforma no telgo.paramount.py - display.php e download.php nao dependem mais de paths, tudo usa as configuracoes da sessao Index: login.php =================================================================== RCS file: /cvsroot/uts/uts/src/www/login.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** login.php 31 Mar 2004 16:54:28 -0000 1.3 --- login.php 26 May 2004 00:06:57 -0000 1.4 *************** *** 8,11 **** --- 8,13 ---- } + include_once("utils.php"); + session_start(); *************** *** 20,31 **** $_SESSION['filter'] = array(); - $_SESSION['bf_dir'] = "/data1/indus/andre/uts" . "/imagens"; - $_SESSION['bf_name'] = "imagem-" . $_POST['user'] . "-" . strftime("%d%m%Y", time()); - - $_SESSION['bf_fullpath'] = $_SESSION['bf_dir'] . "/" . $_SESSION['bf_name']; - // create user image space //mkdir($_SESSION['bf_dir'], 0777); Header("Location: home.php"); --- 22,30 ---- $_SESSION['filter'] = array(); // create user image space //mkdir($_SESSION['bf_dir'], 0777); + updateFilename("/home/indus/henrique/uts", "imagem", "%Y%m%d%H%M%S"); + Header("Location: home.php"); Index: arquivo.php =================================================================== RCS file: /cvsroot/uts/uts/src/www/arquivo.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** arquivo.php 26 Mar 2004 02:09:03 -0000 1.2 --- arquivo.php 26 May 2004 00:06:57 -0000 1.3 *************** *** 10,13 **** --- 10,15 ---- clearstatcache(); + include_once("utils.php"); + ?> *************** *** 42,51 **** <? ! $dir = 'imagens'; ! $dh = opendir($dir); ! while (false !== ($filename = readdir($dh))) { ! if((strstr($filename, ".fits")) && (strstr($filename, $_SESSION['bf_name']))) ! $files[] = $filename; } --- 44,56 ---- <? ! $dir = $_SESSION['bf_dir']; ! if (file_exists($dir)) { ! $dh = opendir($dir); ! ! while (false !== ($filename = readdir($dh))) { ! if((strstr($filename, ".fits")) && (strstr($filename, $_SESSION['bf_name']))) ! $files[] = $filename; ! } } *************** *** 61,65 **** for ($i = 0; $i < count($files); $i++) { ! $stat = stat("imagens/" . $filename); if($i % 2) { --- 66,70 ---- for ($i = 0; $i < count($files); $i++) { ! $stat = stat($_SESSION['bf_dir'] . "/" . $files[$i]); if($i % 2) { *************** *** 75,81 **** ?> <td><?=$files[$i]?></td> ! <td><?=$stat['size']?> bytes</td> ! <td align="center"><a class="ph "href="display.php?filename=imagens/<?=$files[$i]?>">:: mostrar ::</a></td> ! <td align="center"><a class="ph "href="download.php?filename=imagens/<?=$files[$i]?>">:: download ::</a></td> </tr> <? --- 80,86 ---- ?> <td><?=$files[$i]?></td> ! <td><?=byte_format($stat['size'])?></td> ! <td align="center"><a class="ph "href="display.php?filename=<?=$files[$i]?>">:: mostrar ::</a></td> ! <td align="center"><a class="ph "href="download.php?filename=<?=$files[$i]?>">:: download ::</a></td> </tr> <? --- NEW FILE: TODO --- - pagina com opcoes para download (.fits, .fits.gz, .fits.bz2, cabecalhos, etc) Index: formApontar.php =================================================================== RCS file: /cvsroot/uts/uts/src/www/formApontar.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** formApontar.php 29 Jan 2004 03:03:23 -0000 1.1.1.1 --- formApontar.php 26 May 2004 00:06:57 -0000 1.2 *************** *** 37,41 **** <td height="34"><a href="ajuda.php#RA">RA</a>:</td> <td height="34"> ! <input type="text" name="ra" maxlenght="20" class="txt"> </td> </tr> --- 37,41 ---- <td height="34"><a href="ajuda.php#RA">RA</a>:</td> <td height="34"> ! <input type="text" name="ra" maxlenght="20" class="txt" tabindex="1"> </td> </tr> *************** *** 44,48 **** <td><a href="ajuda.php#DEC">DEC</a>:</td> <td> ! <input type="text" name="dec" maxlenght="20" class="txt"> </td> </tr> --- 44,48 ---- <td><a href="ajuda.php#DEC">DEC</a>:</td> <td> ! <input type="text" name="dec" maxlenght="20" class="txt" tabindex="2"> </td> </tr> *************** *** 51,55 **** <td><a href="ajuda.php#epoca">Época</a>:</td> <td> ! <select name="epoca" class="txt"> <option value="J2000">J2000</option> </select> --- 51,55 ---- <td><a href="ajuda.php#epoca">Época</a>:</td> <td> ! <select name="epoca" class="txt" tabindex="3"> <option value="J2000">J2000</option> </select> *************** *** 60,64 **** <td><a href="ajuda.php#numexp">Número de exposições:</a>:</td> <td> ! <input type="text" name="num_exp" maxlenght="20" class="txt"> </td> </tr> --- 60,64 ---- <td><a href="ajuda.php#numexp">Número de exposições:</a>:</td> <td> ! <input type="text" name="num_exp" maxlenght="20" class="txt" tabindex="4"> </td> </tr> *************** *** 67,71 **** <td><a href="ajuda.php#tempo_integracao">Tempo de exposição</a>:</td> <td> ! <input type="text" name="exp_time" maxlenght="20" class="txt"> </td> </tr> --- 67,71 ---- <td><a href="ajuda.php#tempo_integracao">Tempo de exposição</a>:</td> <td> ! <input type="text" name="exp_time" maxlenght="20" class="txt" tabindex="5"> </td> </tr> *************** *** 74,78 **** <td><a href="ajuda.php#filtro">Filtro</a>:</td> <td> ! <select name="filtro" class="txt"> <option value="clear">Clear</option> <option value="red">Red</option> --- 74,78 ---- <td><a href="ajuda.php#filtro">Filtro</a>:</td> <td> ! <select name="filtro" class="txt" tabindex="6"> <option value="clear">Clear</option> <option value="red">Red</option> *************** *** 93,97 **** <td align="center"> <div align="left"> ! <input type="submit" name="get_now" value="Observar"> </div> </td> --- 93,97 ---- <td align="center"> <div align="left"> ! <input type="submit" name="get_now" value="Observar" tabindex="6"> </div> </td> *************** *** 101,104 **** --- 101,105 ---- <p align="center"><a href="home.php">::: voltar :::</a></p> + </form> Index: utils.php =================================================================== RCS file: /cvsroot/uts/uts/src/www/utils.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** utils.php 26 Mar 2004 02:09:03 -0000 1.2 --- utils.php 26 May 2004 00:06:57 -0000 1.3 *************** *** 21,25 **** $servers = array(); ! exec("/home/indus/henrique/ssl/bin/spmtable $server", $spmout); if(count($spmout) < 4) { --- 21,25 ---- $servers = array(); ! exec("spmtable $server", $spmout); if(count($spmout) < 4) { *************** *** 50,53 **** --- 50,114 ---- } + function dumpSession() { + + echo "<div id='debug' class='debug'>"; + echo "<pre>"; + print_r($_SESSION); + echo "</pre>"; + echo "</div>"; + + } + + function updateFilename($dir, $name, $index) { + + if(!$dir) + $dir = $_SESSION['bf_dir']; + + if(!$name) + $dir = $_SESSION['bf_name']; + + if(!$index) + $dir = $_SESSION['bf_index']; + + $_SESSION['bf_dir'] = $dir; + $_SESSION['bf_name'] = $name; + $_SESSION['bf_index'] = $index; + + $_SESSION['bf_fullpath'] = $_SESSION['bf_dir'] . "/" . $_SESSION['bf_name'] . "-" . $_SESSION['user'] . "-". strftime($_SESSION['bf_index'], time()); + } + + function formatSize($size) { + + # format a file size adding kb, Mb, Gb + + $res = $size / 1024.0; + + if ($res >= 1024.0) { + + $res = $res / 1024.0; + + return floor($res) . " Mb"; + + } else { + + return floor($res) . " kb"; + + } + + } + + function byte_format($input, $dec=0) + { + $prefix_arr = array("", "K", "M", "G", "T"); + $value = round($input, $dec); + while ($value>1024) + { + $value /= 1024; + $i++; + } + $return_str = round($value, $dec).$prefix_arr[$i]; + return $return_str; + } + ?> --- NEW FILE: formOpcoes.php --- <? session_start(); if(!$_SESSION['user']) { session_destroy(); Header("Location: index.php"); } ?> <html> <head> <title>Observatórios Virtuais ::: Opções</title> <style type="text/css"> <!-- body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; text-decoration: none} .botao { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; text-decoration: none; border-style: solid } .tabelaH { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; text-decoration: none ; background-color: #666666; color: #FFFFFF;text-align: center} .txt { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; text-decoration: none; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px ; background-color: #CCCCCC} #exemplo { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px; text-decoration: none ; background-color: #FFFFFF; color: #000000; text-align: center; border-style: dashed; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px } --> </style> </head> <body bgcolor="#000000" text="#FFFFFF" link="#CCCCCC" vlink="#CCCCCC"> <center> <h3><img src="ovlogo.jpg" width="145" height="105"><br> <br> Opções</h3> </center> <div id="exemplo"> <p>O nome é formado da seguinte forma: <b>[/diretorio_padrão]/[nome_da_imagem]-usuario-[formato_da_data]</b>.<br> Os campos cercados por [ e ] podem ser alterados pelo formulário abaixo. </div> <form name="opcoes" action="opcoes.php" method="GET"> <input type="hidden" name="back" value="<?=$_SERVER['HTTP_REFERER']?>"> <table align="center"> <tr> <td class="tabelaH" colspan="2">Imagens e diretórios</td> </tr> <tr> <td>Diretório padrão:</td> <td><input type="text" name="dir" maxlenght="256" size="50" class="txt" tabindex="1" value="<?=$_SESSION['bf_dir']?>"></td> </tr> <tr> <td>Nome da imagem:</td> <td><input type="text" name="name" maxlenght="256" size="50" class="txt" tabindex="2" value="<?=$_SESSION['bf_name']?>"></td> </tr> <tr> <td><a href="http://www.php.net/strftime">Formato da data</a>:</td> <td><input type="text" name="index" maxlenght="256" size="50" class="txt" tabindex="3" value="<?=$_SESSION['bf_index']?>"></td>> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td align="center"> <div align="left"> </div> </td> <td align="center"> <div align="left"> <input type="submit" name="get_now" value="Salvar" tabindex="4"> </div> </td> </tr> </table> <p align="center"><a href="home.php">::: voltar :::</a></p> </form> </body> </html> Index: home.php =================================================================== RCS file: /cvsroot/uts/uts/src/www/home.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** home.php 29 Jan 2004 03:03:26 -0000 1.1.1.1 --- home.php 26 May 2004 00:06:57 -0000 1.2 *************** *** 20,23 **** --- 20,24 ---- .tabelaOn { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; text-decoration: none ; background-color: #999999} .tabelaOff { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; text-decoration: none ; background-color: #CCCCCC} + .debug { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; text-decoration: none ; background-color: #FFFFFF; color: #000000} --> </style> *************** *** 30,33 **** --- 31,50 ---- <p><a href="formApontar.php">::: apontar e integrar :::</a></p> <p><a href="arquivo.php">::: arquivo :::</a></p> + <p><a href="formOpcoes.php">::: opções :::</a></p> + + <? + + if ($_GET['opcoes']) { + ?> + + <div align="center">Opções salvas!</div> + + <? + + } + + ?> + + <table width="70%" border="0" class="tabela"> <tr class="tabelaH"> *************** *** 79,82 **** --- 96,111 ---- <p> </p> </div> + + + <? + + if ($_GET['debug']) { + include_once("utils.php"); + dumpSession(); + } + + ?> + + </body> </html> Index: display.php =================================================================== RCS file: /cvsroot/uts/uts/src/www/display.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** display.php 26 Mar 2004 02:09:03 -0000 1.1 --- display.php 26 May 2004 00:06:57 -0000 1.2 *************** *** 10,20 **** // tenta converter o arquivo caso nao exista um ! $fits_file = $_GET['filename']; ! $target_file = "imagens/" . basename($fits_file, ".fits") . ".jpg"; if(!file_exists($target_file)) { ! exec("convert $fits_file $target_file &> /dev/null", $tmp, $ret); } --- 10,25 ---- // tenta converter o arquivo caso nao exista um ! $fits_file = $_SESSION['bf_dir'] . "/" . $_GET['filename']; ! $target_file = $_SESSION['bf_dir'] . "/" . basename($fits_file, ".fits") . ".jpg"; + $cmd = "convert $fits_file $target_file"; if(!file_exists($target_file)) { ! exec($cmd, $tmp, $ret); ! ! //echo "<pre>"; ! //print_r($tmp); ! //echo "</pre>"; } *************** *** 44,48 **** <? ! if($ret) { ?> <img src="default.png"> --- 49,53 ---- <? ! if(!file_exists($target_file)) { ?> <img src="default.png"> *************** *** 50,54 **** } else { ?> ! <img src="<?=$target_file?>"> <? } --- 55,59 ---- } else { ?> ! <img src="file://<?=$target_file?>"> <? } Index: logout.php =================================================================== RCS file: /cvsroot/uts/uts/src/www/logout.php,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** logout.php 29 Jan 2004 03:03:26 -0000 1.1.1.1 --- logout.php 26 May 2004 00:06:57 -0000 1.2 *************** *** 10,14 **** } - session_start(); session_destroy(); --- 10,13 ---- --- NEW FILE: opcoes.php --- <? session_start(); if(!$_SESSION['user']) { session_destroy(); Header("Location: index.php"); } include_once("utils.php"); updateFilename($_GET['dir'], $_GET['name'], $_GET['index']); Header("Location:home.php?opcoes=1"); ?> Index: apontar.php =================================================================== RCS file: /cvsroot/uts/uts/src/www/apontar.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** apontar.php 26 Mar 2004 02:09:03 -0000 1.2 --- apontar.php 26 May 2004 00:06:57 -0000 1.3 *************** *** 11,15 **** ! $servers = getServers("octans"); if(!$servers) { --- 11,15 ---- ! $servers = getServers("localhost"); if(!$servers) { *************** *** 18,21 **** --- 18,23 ---- } + updateFilename(); + $sync = new Syncd(); $sync->setInteractive(TRUE); Index: download.php =================================================================== RCS file: /cvsroot/uts/uts/src/www/download.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** download.php 26 Mar 2004 02:09:03 -0000 1.1 --- download.php 26 May 2004 00:06:57 -0000 1.2 *************** *** 8,16 **** } ! $len = filesize($_GET['filename']); header("Content-type: image/fits"); header("Content-Length: $len"); ! header("Content-Disposition: inline; filename=" . $_GET['filename']); ! readfile($_GET['filename']); ?> \ No newline at end of file --- 8,19 ---- } ! $file = $_SESSION['bf_dir'] . "/" . $_GET['filename']; ! ! ! $len = filesize($file); header("Content-type: image/fits"); header("Content-Length: $len"); ! header("Content-Disposition: attachment; filename=$file"); ! readfile($file); ?> \ No newline at end of file |