Index: log.php
===================================================================
RCS file: /cvsroot/owl/owl-0.90/log.php,v
retrieving revision 1.11
diff -u -r1.11 log.php
--- log.php	6 Jun 2007 11:18:51 -0000	1.11
+++ log.php	15 Oct 2007 12:40:00 -0000
@@ -116,6 +116,7 @@
 // etc. and search for a log on Blah.doc (it brings up all 3 docs)
 // $sql->query("select * from $default->owl_files_table where filename LIKE '$filesearch[0]%$filesearch[1]' order by major_revision desc, minor_revision desc");
 // $SQL = "select * from $default->owl_files_table where filename LIKE '$filesearch[0]%$filesearch[1]' order by major_revision desc, minor_revision desc";
+// Fair portable way ? Filter "Blah_errors.doc" out il the while loop
 if ($default->owl_use_fs)
 {
    $sql->query("SELECT id FROM $default->owl_folders_table WHERE name='$default->version_control_backup_dir_name' and parent='$parent'");
@@ -130,7 +131,7 @@
    {
       $backup_parent = $parent;
    } 
-   $sql->query("SELECT * FROM $default->owl_files_table WHERE (filename LIKE '" . $firstpart . "\\_%" . $file_extension . "' OR filename = '$filename') AND (parent = '$backup_parent' OR parent = '$parent') ORDER BY major_revision desc, minor_revision desc");
+   $sql->query("SELECT * FROM $default->owl_files_table WHERE (filename LIKE '" . $firstpart . "\\_%" . $file_extension . "' AND parent='$backup_parent') OR (filename = '$filename' AND parent = '$parent') ORDER BY major_revision desc, minor_revision desc");
 } 
 else
 {
@@ -148,81 +149,88 @@
 $CountLines = 0;
 while ($sql->next_record())
 {
-   $choped = split("\.", $sql->f("filename"));
+   $filename = $sql->f("filename");
+   $major_revision = $sql->f("major_revision");
+   $minor_revision = $sql->f("minor_revision");
+   $choped = split("\.", $filename);
    $pos = count($choped);
    $ext = strtolower($choped[$pos-1]);
 
-   if ($default->owl_use_fs )
-   {
-      $sFilePattern =  preg_quote($firstpart) .  "\_[0-9]*\-[0-9]*$haveextension" . preg_quote($file_extension);
-
-      if(!ereg("$sFilePattern", $sql->f("filename")) and  $id != $sql->f("id"))
-      {
-         continue;
-      }
-   }
+   if (($filename == $firstpart.".".$file_extension) ||
+       ($filename == $firstpart."_".$major_revision."-".$minor_revision.".".$file_extension)) {
 
-   $CountLines++;
-   $PrintLines = $CountLines % 2;
-
-   if ($PrintLines == 0)
-   {
-      $sTrClass = "file1";
-      $sLfList = "lfile1";
-   }
-   else
-   {
-      $sTrClass = "file2";
-      $sLfList = "lfile1";
-   }
+     if ($default->owl_use_fs )
+       {
+	 $sFilePattern =  preg_quote($firstpart) .  "\_[0-9]*\-[0-9]*$haveextension" . preg_quote($file_extension);
+	 
+	 if(!ereg("$sFilePattern", $sql->f("filename")) and  $id != $sql->f("id"))
+	   {
+	     continue;
+	   }
+       }
+
+     $CountLines++;
+     $PrintLines = $CountLines % 2;
+
+     if ($PrintLines == 0)
+       {
+	 $sTrClass = "file1";
+	 $sLfList = "lfile1";
+       }
+     else
+       {
+	 $sTrClass = "file2";
+	 $sLfList = "lfile1";
+       }
 
-   print("<tr><td class=\"$sTrClass\" valign=\"top\">" . $sql->f("major_revision") . "." . $sql->f("minor_revision") . "</td>
+     print("<tr><td class=\"$sTrClass\" valign=\"top\">" . $sql->f("major_revision") . "." . $sql->f("minor_revision") . "</td>
                <td class=\"$sTrClass\" valign=\"top\">" . uid_to_name($sql->f("creatorid")) . "</td>");
-   if (!empty ($default->edit_text_files_inline))
-   {
-      $edit_inline =$default->edit_text_files_inline;
-      if ($ext != "" && preg_grep("/\b$ext\b/", $edit_inline))
-      {
-         print("<td class=\"$sTrClass\" valign=\"top\"><input type=\"radio\" name=\"diff_from\" value=\"" . $sql->f("id") ."\"></input></td>
+     if (!empty ($default->edit_text_files_inline))
+       {
+	 $edit_inline =$default->edit_text_files_inline;
+	 if ($ext != "" && preg_grep("/\b$ext\b/", $edit_inline))
+	   {
+	     print("<td class=\"$sTrClass\" valign=\"top\"><input type=\"radio\" name=\"diff_from\" value=\"" . $sql->f("id") ."\"></input></td>
                 <td class=\"$sTrClass\" valign=\"top\"><input type=\"radio\" name=\"diff_to\" value=\"" . $sql->f("id") ."\"></input></td>");
-      }
-   }
-   print("<td class=\"$sTrClass\" valign=\"top\" align=\"left\" width=\"70%\"><font size=\"2\" style=\"font-weight:bold\">");
-
-
-   if ($sql->f("parent") == $parent)
-   {
-       $is_backup_folder = false;
-   }
-   else
-   {
-       $is_backup_folder = true;
-   }
-   
-   printFileIcons($sql->f("id"), $sql->f("filename"), $sql->f("checked_out"), $sql->f("url"), $default->owl_version_control, $ext, $sql->f("parent"), $is_backup_folder);
-
-
-
-   print("&nbsp;&nbsp;[ " . $sql->f("filename") . " ]</font><br />" . fCleanDomTTContent($sql->f("description"), 0) . "</td>");
-   if ( $default->document_peer_review == 1)
-   {
-      switch ($sql->f("approved"))
-      {
-         case "0":
-            $sStatus = "<div class=\"cpending\">$owl_lang->peer_satus_pending</div>";
-            break;
-         case 1:
-            $sStatus = "<div class=\"capproved\">$owl_lang->peer_satus_approved</div>";
-            break;
-         default:
-            $sStatus = "<div class=\"cpending\">$owl_lang->peer_satus_rejected</div>";
-            break;
-      }
+	   }
+       }
+     print("<td class=\"$sTrClass\" valign=\"top\" align=\"left\" width=\"70%\"><font size=\"2\" style=\"font-weight:bold\">");
+     
+
+     if ($sql->f("parent") == $parent)
+       {
+	 $is_backup_folder = false;
+       }
+     else
+       {
+	 $is_backup_folder = true;
+       }
+     
+     printFileIcons($sql->f("id"), $sql->f("filename"), $sql->f("checked_out"), $sql->f("url"), $default->owl_version_control, $ext, $sql->f("parent"), $is_backup_folder);
+     
+     
+     
+     print("&nbsp;&nbsp;[ " . $sql->f("filename") . " ]</font><br />" . fCleanDomTTContent($sql->f("description"), 0) . "</td>");
+     if ( $default->document_peer_review == 1)
+       {
+	 switch ($sql->f("approved"))
+	   {
+	   case "0":
+	     $sStatus = "<div class=\"cpending\">$owl_lang->peer_satus_pending</div>";
+	     break;
+	   case 1:
+	     $sStatus = "<div class=\"capproved\">$owl_lang->peer_satus_approved</div>";
+	     break;
+	   default:
+	     $sStatus = "<div class=\"cpending\">$owl_lang->peer_satus_rejected</div>";
+	     break;
+	   }
          print("\t<td class=\"$sTrClass\" valign=\"top\" align=\"center\">$sStatus</td>");
-   }
+       }
 
-               print("<td class=\"$sTrClass\" valign=\"top\">" . date($owl_lang->localized_date_format, strtotime($sql->f("smodified")) + $default->time_offset) . "</td>
+     print("<td class=\"$sTrClass\" valign=\"top\">" . date($owl_lang->localized_date_format, strtotime($sql->f("smodified")) + $default->time_offset) . "</td>
                <td class=\"$sTrClass\" valign=\"top\">" . uid_to_name($sql->f("updatorid")) ."</td></tr>");
+   }
 }  
 if (!empty ($default->edit_text_files_inline))
 {
