User Tools

Site Tools


cern:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
cern:index [2018/05/02 11:45] iwncern:index [2020/05/13 11:50] iwn
Line 1: Line 1:
-Include this file in each directory of your website to display plots in a nice and searchable way ([[cern:website|full instructions]]). Made by Giovanni.+Include this file in each directory of your website to display plots in a nice and searchable way ([[cern:website|full instructions]]). Made by Giovanni. (Replace the location of your website's icon ''favicon.ico''.)
  
 <file bash index.php> <file bash index.php>
 +<?php
 +$pwd = preg_replace("|^\/((\w)\w+)\/|","/eos/user/$2/$1/www/",$_SERVER["REQUEST_URI"]);
 +$pwd = preg_replace("(\?.*)","",$pwd);
 +preg_match("|^\/(\w+)\/|",$_SERVER["REQUEST_URI"],$usr);
 +$pwdshort = preg_replace("(.*www/)","$usr[1]/",$pwd);
 +chdir($pwd);
 +?>
 <html> <html>
 <head> <head>
-<title><?php echo getcwd(); ?></title>+<title><?php echo $pwdshort; ?></title
 +<link rel="SHORTCUT ICON" type="image/x-icon" href="https://ineuteli.web.cern.ch/ineuteli/favicon.ico"/>
 <style type='text/css'> <style type='text/css'>
-body {+  body {
     font-family: "Candara", sans-serif;     font-family: "Candara", sans-serif;
     font-size: 9pt;     font-size: 9pt;
     line-height: 10.5pt;     line-height: 10.5pt;
-+  
-div.pic h3 {  +  div.pic h3 { 
-    font-size: 11pt;+    font-size: 9pt;
     margin: 0.5em 1em 0.2em 1em;     margin: 0.5em 1em 0.2em 1em;
-+  
-div.pic p {+  div.pic p {
     font-size: 11pt;     font-size: 11pt;
     margin: 0.2em 1em 0.1em 1em;     margin: 0.2em 1em 0.1em 1em;
-+  
-div.pic {+  div.pic {
     display: block;     display: block;
     float: left;     float: left;
Line 27: Line 35:
     text-align: center;     text-align: center;
     margin: 2px 10px 10px 2px;     margin: 2px 10px 10px 2px;
-    -moz-box-shadow: 7px 5px 5px rgb(80,80,80);    /* Firefox 3.5 */ +    -moz-box-shadow: 6px 4px 4px rgb(80,80,90);    /* Firefox 3.5 */ 
-    -webkit-box-shadow: 7px 5px 5px rgb(80,80,80); /* Chrome, Safari */ +    -webkit-box-shadow: 6px 4px 4px rgb(80,80,90); /* Chrome, Safari */ 
-    box-shadow: 7px 5px 5px rgb(80,80,80);         /* New browsers */  +    box-shadow: 6px 4px 4px rgb(80,80,90);         /* New browsers */  
     width: 320px;     width: 320px;
-+    min-height: 330px; 
-a { text-decoration: none; color: rgb(80,0,0); } +    max-height: 380px; 
-a:hover { text-decoration: underline; color: rgb(255,80,80); } +  
-div.dirlinks h2 {  margin-bottom: 4pt; margin-left: -24pt; color: rgb(80,0,0);  +  h1 { color: rgb(40,40,80);
-div.dirlinks {  margin: 0 24pt; }  +  h2 { padding-top: 5pt; } 
-div.dirlinks a {+  h2 a { color: rgb(20,20,100); }  
 +  h3 a { color: rgb(40,40,120);
 +  a { text-decoration: none; color: rgb(50,50,150); } 
 +  a:hover { text-decoration: underline; color: rgb(80,80,250); } 
 +  div.dirlinks h2 { padding-top: 0pt; margin-bottom: 4pt; margin-left: -15pt; color: rgb(20,20,80); } 
 +  div.dirlinks { margin: 0 15pt; }  
 +  div.dirlinks a {
     font-size: 11pt; font-weight: bold;     font-size: 11pt; font-weight: bold;
     padding: 0 0.5em;      padding: 0 0.5em; 
-}+  } 
 +  pre { 
 +    font-family: monospace; 
 +    max-width:1000px; 
 +    white-space: pre-wrap;     /* css-3 */ 
 +    white-space: -moz-pre-wrap !important; /* Mozilla */ 
 +    white-space: -pre-wrap;    /* Opera 4-6 */ 
 +    white-space: -o-pre-wrap;  /* Opera 7 */ 
 +    word-wrap:   break-word;   /* Internet Explorer 5.5+ */ 
 +  }
 </style> </style>
 </head> </head>
 <body> <body>
-<h1><?php echo getcwd(); ?></h1>+<h1><?php echo $pwd;?></h1> 
 +<!-- <h1><?php echo getcwd();?></h1> -->
 <?php <?php
 $has_subs = false; $has_subs = false;
-foreach (glob("*") as $filename) { +foreach(glob("*") as $filename){ 
-    if (is_dir($filename) && !preg_match("/^\..*|.*private.*/", $filename)) { +    if(is_dir($filename) && !preg_match("/^\..*|.*private.*/", $filename)){ 
-        $has_subs = true; +      $has_subs = true; 
-        break;+      break;
     }     }
 } }
-if ($has_subs) {+if($has_subs){
     print "<div class=\"dirlinks\">\n";     print "<div class=\"dirlinks\">\n";
     print "<h2>Directories</h2>\n";     print "<h2>Directories</h2>\n";
     print "<a href=\"../\">[parent]</a> ";     print "<a href=\"../\">[parent]</a> ";
-    foreach (glob("*") as $filename) { +    foreach(glob("*") as $filename){ 
-        if (is_dir($filename) && ($_SERVER['PHP_AUTH_USER'] == 'gpetrucc' || !preg_match("/^\..*|.*private.*/", $filename))) { +      if(is_dir($filename) && ($_SERVER['PHP_AUTH_USER'] == 'gpetrucc' || !preg_match("/^\..*|.*private.*/", $filename))){ 
-            print " <a href=\"$filename\">[$filename]</a>"; +          print " <a href=\"$filename\">[$filename]</a>"; 
-        }+      }
     }     }
 +    print "</div>";
 +}else{
 +    print "<div class=\"dirlinks\">\n";
 +    print "<h2><a href=\"../\">[parent]</a></h2>";
     print "</div>";     print "</div>";
 } }
  
-foreach (array("00_README.txt", "README.txt", "readme.txt") as $readme) { +foreach(array("00_README.txt", "README.txt", "readme.txt") as $readme){ 
-    if (file_exists($readme)) { +    if(file_exists($readme)){ 
-        print "<pre class='readme'>\n"; readfile($readme); print "</pre>";+        #print "<pre class='readme'>\n"; readfile($readme); print "</pre>"; 
 +        $readmeblock = file_get_contents($readme); 
 +        #$readmeblock = preg_replace("|\[\[([^\|\]]*)\|([^\|\]]*)\]\]|","<a href=\"$1\">$2</a>",$readmeblock); 
 +        $readmeblock = preg_replace("|\[\[((?:(?!\]\])[^\|])*)\|([^\|\]]*)\]\]|","<a href=\"$1\">$2</a>",$readmeblock); 
 +        $readmeblock = preg_replace("|\[\[([^\|\]]*)\]\]|","<a href=\"$1\">$1</a>",$readmeblock); 
 +        print "<pre class='readme'>\n"; print $readmeblock; print "</pre>";
     }     }
 } }
Line 72: Line 105:
  
 <h2><a name="plots">Plots</a></h2> <h2><a name="plots">Plots</a></h2>
-<p><form>Filter: <input type="text" name="match" size="30" value="<?php if (isset($_GET['match'])) print htmlspecialchars($_GET['match']);  ?>" /><input type="Submit" value="Go" /><input type="checkbox"  name="regexp" <?php if ($_GET['regexp']) print "checked=\"checked\""?> >RegExp</input></form></p>+<p><form>Filter: <input type="text" name="match" size="30" value="<?php if(isset($_GET['match'])) print htmlspecialchars($_GET['match']); ?>" /><input type="Submit" value="Go" /><input type="checkbox"  name="regexp" <?php if($_GET['regexp']) print "checked=\"checked\""?> >RegExp</input></form></p>
 <div> <div>
 <?php <?php
 $displayed = array(); $displayed = array();
-if ($_GET['noplots']) {+ 
 +if($_GET['noplots']){
     print "Plots will not be displayed.\n";     print "Plots will not be displayed.\n";
-} else { +}else{ 
-    $other_exts = array('.pdf', '.cxx', '.eps', '.root', '.txt', '.dir', '.info'); +    $other_exts = array('.pdf','.jpg','.jpeg','.jpg','.cxx','.eps','.root','.txt','.tex','.log','.dir','.info','.psd'); 
-    $filenames = glob("*.png"); sort($filenames); +    $filenames = glob("*.png"); natsort($filenames); 
-    foreach ($filenames as $filename) { +    foreach($filenames as $filename){ 
-        if (isset($_GET['match'])) { +        if(isset($_GET['match'])){ 
-             if (isset($_GET['regexp']) && $_GET['regexp']) { +          $keywords = split("+",$_GET['match']); 
-                if (!preg_match('/.*'.$_GET['match'].'.*/', $filename)) continue; +          //foreach($keywords as $keyword){ 
-             } else { +            if(isset($_GET['regexp']) && $_GET['regexp']){ 
-                if (!fnmatch('*'.$_GET['match'].'*', $filename)) continue; +              if(!preg_match('/.*'.$_GET['match'].'.*/', $filename)) continue; 
-             }+            }else{ 
 +              if(!fnmatch('*'.$_GET['match'].'*', $filename)) continue; 
 +            } 
 +          //}
         }         }
         array_push($displayed, $filename);         array_push($displayed, $filename);
-        $brfname = str_replace("_","_&shy;",$filename);+        $brfname = str_replace("_","_<wbr>",$filename); //&shy;
         print "<div class='pic'>\n";         print "<div class='pic'>\n";
         print "<h3><a href=\"$filename\">$brfname</a></h3>";         print "<h3><a href=\"$filename\">$brfname</a></h3>";
-        print "<a href=\"$filename\"><img src=\"$filename\" style=\"border: none; width: 300px; \"></a>";+        print "<a href=\"$filename\"><img src=\"$filename\" style=\"border: none; max-width: 300px; max-height: 360px; \"></a>";
         $others = array();         $others = array();
-        foreach ($other_exts as $ex) {+        foreach($other_exts as $ex){
             $other_filename = str_replace('.png', $ex, $filename);             $other_filename = str_replace('.png', $ex, $filename);
-            if (file_exists($other_filename)) { +            if(file_exists($other_filename)){ 
-                array_push($others, "<a class=\"file\" href=\"$other_filename\">[" . $ex . "]</a>"); +              array_push($others, "<a class=\"file\" href=\"$other_filename\">[" . $ex . "]</a>"); 
-                if ($ex != '.txt') array_push($displayed, $other_filename);+              if($ex != '.txt') array_push($displayed, $other_filename);
             }             }
         }         }
-        if ($others) print "<p>Also as ".implode(', ',$others)."</p>";+        if($others) print "<p>Also as ".implode(', ',$others)."</p>";
         print "</div>";         print "</div>";
     }     }
Line 108: Line 145:
 ?> ?>
 </div> </div>
 +
 <div style="display: block; clear:both;"> <div style="display: block; clear:both;">
 <h2><a name="files">Other files</a></h2> <h2><a name="files">Other files</a></h2>
 <ul> <ul>
-<? +<?php 
-foreach (glob("*") as $filename) { +foreach(glob("*") as $filename){ 
-    if ($_GET['noplots'] || !in_array($filename, $displayed)) { +    if($_GET['noplots'] || !in_array($filename, $displayed)){ 
-        if (isset($_GET['match'])) { +        if(isset($_GET['match'])){ 
-             if (isset($_GET['regexp']) && $_GET['regexp']) { +          if(isset($_GET['regexp']) && $_GET['regexp']){ 
-                if (!preg_match('/.*'.$_GET['match'].'.*/', $filename)) continue; +            if(!preg_match('/.*'.$_GET['match'].'.*/', $filename)) continue; 
-             } else { +          }else{ 
-                if (!fnmatch('*'.$_GET['match'].'*', $filename)) continue; +            if(!fnmatch('*'.$_GET['match'].'*', $filename)) continue; 
-             }+          }
         }         }
-        if (is_dir($filename)) { +        if(is_dir($filename)){ 
-            print "<li>[DIR] <a href=\"$filename\">$filename</a></li>"; +          print "<li>[DIR] <b><a href=\"$filename\">$filename</a></b></li>"; 
-        } else { +        }else{ 
-            print "<li><a href=\"$filename\">$filename</a></li>";+          print "<li><a href=\"$filename\">$filename</a></li>";
         }         }
     }     }
Line 131: Line 169:
 </ul> </ul>
 </div> </div>
 +<br>
 </body> </body>
 </html> </html>
 </file> </file>
cern/index.txt · Last modified: 2023/10/04 16:10 by iwn