Changeset 2775
- Timestamp:
- 09/22/10 21:43:13 (3 years ago)
- Location:
- alternc-philesight/trunk
- Files:
-
- 3 edited
-
usr/lib/alternc/philesight (modified) (5 diffs)
-
var/alternc/bureau/admin/philesight_view.php (modified) (1 diff)
-
var/alternc/bureau/class/philesight.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
alternc-philesight/trunk/usr/lib/alternc/philesight
r2764 r2775 13 13 [ "--dump", "-u", GetoptLong::NO_ARGUMENT ], 14 14 [ "--one-file-system", "-1", GetoptLong::NO_ARGUMENT ], 15 [ "--help", "-h", GetoptLong::NO_ARGUMENT ] 15 [ "--help", "-h", GetoptLong::NO_ARGUMENT ], 16 [ "--find", "-f", GetoptLong::REQUIRED_ARGUMENT ] 16 17 ) 17 18 … … 28 29 puts " --one-file-system Skip mount points" 29 30 puts " --skip <path> Skip given filename in index mode" 31 puts " --find x,y Determine path from x,y" 30 32 puts 31 33 puts "Examples:" … … 49 51 arg_skip = "" 50 52 arg_drawfile = "" 51 53 arg_x = "" 54 arg_y = "" 52 55 53 56 opts.each do |opt, arg| … … 78 81 mode = "dump" 79 82 83 when "--find" 84 mode = "find" 85 if(arg =~ /(\d+),(\d+)/) then 86 arg_x = $1.to_i 87 arg_y = $2.to_i 88 end 80 89 else 81 90 usage … … 111 120 t.index(arg_index_dir, arg_skip, arg_one_fs) 112 121 122 when "find" 123 puts t.find(arg_path, arg_x, arg_y) 113 124 else 114 125 usage() -
alternc-philesight/trunk/var/alternc/bureau/admin/philesight_view.php
r2773 r2775 43 43 <br /> 44 44 <?php 45 # Get parameters from environment and CGI.45 $phil = new Philesight(); 46 46 47 $phil = new Philesight(); 48 $phil->initialize(); 47 # Get parameters from environment and CGI. 48 # Get path by default 49 $path = $_GET['path'] ? $_GET['path'] : "/"; 50 51 # ISMAP image maps do not return a proper CGI parameter, but only the 52 # coordinates appended after a question mark. If this is found in the 53 # QUERY_STRING, assume the 'find' command 54 55 $qs = $_SERVER["QUERY_STRING"]; 56 if (qs && preg_match("/\?(\d+,\d+)/",$qs,$matches)) { 57 $coordinates = $matches['1']; 58 $path = $phil->find_path($path,$coordinates); 59 } 60 61 $phil->initialize($path); 49 62 ?> 50 63 </body> -
alternc-philesight/trunk/var/alternc/bureau/class/philesight.php
r2774 r2775 25 25 private $path_db = '/var/alternc/philesight/server.db'; 26 26 27 public function initialize() { 28 echo $this->do_image('/'); 27 public function initialize($path) { 28 29 $path = $path ? $path : "/"; 30 echo "<a href='".$_SERVER['PHP_SELF']."?path=".$path."&'>"; 31 echo $this->do_image($path); 32 echo "</a>"; 29 33 } 30 34 … … 52 56 */ 53 57 protected function run_command($command) { 58 54 59 $descriptorspec = array( 55 60 1 => array('pipe', 'w'), … … 72 77 73 78 protected function do_image($path = "/") { 74 75 $fname = $this->run("--db ".$this->path_db." --path ".$path." --draw /tmp/page.png");76 79 $file = '/tmp/page.png'; 80 $fname = $this->run("--db '".$this->path_db."' --path '".trim($path)."' --draw '".$file."'"); 77 81 $image = imagecreatefrompng($file); 78 82 imagealphablending($image, false); … … 85 89 ob_end_clean(); 86 90 imagedestroy($image); 87 return "<img src='data:image/png;base64,".base64_encode($content)."' />"; 91 return "<img src='data:image/png;base64,".base64_encode($content)."' ismap='ismap' alt='".$path."'/>"; 92 } 93 94 public function find_path($path_parent = "/",$coordinates) { 95 $path = $this->run("--db ".$this->path_db." --path ".$path_parent." --find ".$coordinates); 96 return $path; 88 97 } 89 98 }
Note: See TracChangeset
for help on using the changeset viewer.
