--- trunk/www/working/printable.php 2010/09/20 18:49:07 131
+++ trunk/www/working/printable.php 2010/09/21 13:14:15 132
@@ -1,9 +1,3 @@
-
-
-
-.*#";
+$numMatch = preg_match($eReg,$file,$matches);
+if($numMatch > 0)
+ $bottomNav = $matches[0];
+// echo $bottomNav;
// Remove text starting from line 1 to
// line containing tag
@@ -68,6 +75,15 @@
.newcode{font-family : "Courier New", Courier, monospace; font-weight: bold; background-color: #F2F2F2; border: solid 1px #DEDEDE;padding: 20pt;}
.note{margin-top: 30pt; margin-bottom: 30pt; text-align: left; background-color: #FFEFEF; border: double 3px; border-color: #FFD5D5;}
.otherpage{border: solid 1px darkgoldenrod; padding: 20pt; background-color: lemonchiffon;}
+.docline-top {color: #990000 ; font-weight: bold; display:block;}
+.docline-top a{color: #990000; font-weight: bold;}
+.docline-bottom {color: #990000 ; font-weight: bold; display:block;}
+.docline-bottom a{color: #990000; font-weight: bold;}
+
+@media print {
+.docline-top {display: none;}
+.docline-bottom {display: none;}
+}
@@ -75,7 +91,7 @@
]*>\^\]#i";
$file = preg_replace($eReg,"",$file);
@@ -100,21 +116,55 @@
$file = preg_replace($eReg,"",$file);
$eReg = "##is";
$file = preg_replace($eReg,"",$file);
-//
+
$eReg = "#[^<]*
#";
$file = preg_replace($eReg,"
",$file);
-//
+
$eReg = "##";
$file = preg_replace($eReg,"",$file);
-//
-//
+
+
$file = str_replace("position: absolute; left: 0px;","position: absolute; left: 40pt;",$file);
$file = str_replace("position: absolute; right: 0px;","position: absolute; right: 40pt;",$file);
$eReg = "#Clonezilla-SysRescCD
(.*)
#i";
$file = preg_replace($eReg,"
Clonezilla-SysRescCD
$1
",$file);
+
+// Place top navigation
+if(! empty($topNav)){
+ $eReg = "#
#";
+ $file = preg_replace($eReg, $topNav."\n
", $file);
+}
+$file = preg_replace( "#id=\"docline-top\"#" , "align=\"center\" class=\"docline-top\"" , $file );
+
+// Place bottom navigation
+if(! empty($bottomNav)){
+ $eReg = "##i";
+ $file = preg_replace($eReg, $bottomNav."\n", $file);
+}
+$file = preg_replace( "#id=\"docline-bottom\"#" , "align=\"center\" class=\"docline-bottom\"" , $file );
+
+// Remove extra tags
+$file = preg_replace( "#
#" , "" , $file );
+$file = preg_replace( "#
#" , "" , $file );
+
+
+$file = preg_replace( "#href=\"\"#i" , "href=\"printable.php?index.html\"" , $file );
+
+// Convert href="XXX.html#YYY" to href="printable.php?XXX.html#YYY"
+$eReg = "@href=\"([^hf][^t][^t]?[^p][^s]?[^\"]*)\"@i";
+//$eReg = "@href=\"([:alpha:]]\.html#?[^\"]*\")@i";
+$file = preg_replace( $eReg, "href=\"printable.php?$1\"" , $file );
+
+// Convert href="#YYY" to href="printable.php?XXX.html#YYY"
+// Because of previous conversion, the link is now:
+// href="printable.php?#YYY"
+$eReg = "@href=\"printable.php\?(#[^\"]*)\"@i";
+$file = preg_replace( $eReg, "href=\"printable.php?".$pageUrlName."$1\"" , $file );
+
echo $file;
+
// echo "
// ";