cvs: docweb /include lib_auth.inc.php lib_revcheck.inc.php /www revcheck.php

[email protected] ("Matt Li")
Newsgroups php.doc.web
Message-ID <cvsmazzanet1139138257@cvsserver>
mazzanet		Sun Feb  5 11:17:37 2006 UTC

  Modified files:              
    /docweb/include	lib_auth.inc.php lib_revcheck.inc.php 
    /docweb/www	revcheck.php 
  Log:
  Add ability to view outdated files for particular translators
  
http://cvs.php.net/viewcvs.cgi/docweb/include/lib_auth.inc.php?r1=1.12&r2=1.13&diff_format=u
Index: docweb/include/lib_auth.inc.php
diff -u docweb/include/lib_auth.inc.php:1.12 docweb/include/lib_auth.inc.php:1.13
--- docweb/include/lib_auth.inc.php:1.12	Mon Aug  1 09:42:48 2005
+++ docweb/include/lib_auth.inc.php	Sun Feb  5 11:17:37 2006
@@ -17,7 +17,7 @@
  * |          Nuno Lopes <[email protected]>                                |
  * +----------------------------------------------------------------------+
  *
- * $Id: lib_auth.inc.php,v 1.12 2005/08/01 09:42:48 vincent Exp $
+ * $Id: lib_auth.inc.php,v 1.13 2006/02/05 11:17:37 mazzanet Exp $
  */
 
 require_once 'cvs-auth.inc';
@@ -35,6 +35,7 @@
 	'philip',
 	'sean',
 	'vincent',
+	'mazzanet',
 );
 
 $user = $password = false;
http://cvs.php.net/viewcvs.cgi/docweb/include/lib_revcheck.inc.php?r1=1.10&r2=1.11&diff_format=u
Index: docweb/include/lib_revcheck.inc.php
diff -u docweb/include/lib_revcheck.inc.php:1.10 docweb/include/lib_revcheck.inc.php:1.11
--- docweb/include/lib_revcheck.inc.php:1.10	Thu Jul 28 11:11:50 2005
+++ docweb/include/lib_revcheck.inc.php	Sun Feb  5 11:17:37 2006
@@ -126,6 +126,60 @@
 
 }
 
+// return an array with the outdated files maintained by $user
+function get_outdated_translator_files($idx, $lang, $user)
+{
+    $sql = 'SELECT
+        a.status as status,
+        a.name as file,
+        a.maintainer as maintainer,
+        c.revision as en_rev,
+        c.size as en_size,
+        a.size as trans_size,
+        a.revision as trans_rev,
+        a.mdate as trans_date,
+        c.mdate as en_date,
+        b.name AS name,
+        a.dir as dir
+    FROM
+        files a,
+        dirs b
+    LEFT JOIN
+        files c
+    ON
+        c.name = a.name
+    AND
+        c.dir = a.dir
+    WHERE
+        b.id = a.dir
+    AND
+        a.lang="' . $lang . '"
+    AND
+        c.lang="en"
+    AND
+        a.maintainer = "' . $user . '"
+    AND
+        a.revision != c.revision order by b.name';
+    $result = sqlite_query($idx, $sql);
+    $tmp = array();
+    while ($r = sqlite_fetch_array($result, SQLITE_ASSOC)) {
+        $tmp[] = array(
+        'name' => $r['name'],
+        'en_date' => $r['en_date'],
+        'trans_date' => $r['trans_date'],
+        'en_rev' => $r['en_rev'],
+        'en_size' => $r['en_size'],
+        'trans_size' => $r['trans_size'],
+        'trans_rev' => $r['trans_rev'],
+        'status' => $r['status'],
+        'maintainer' => $r['maintainer'],
+        'file' => $r['file']);
+    }
+
+    return $tmp;
+
+}
+
 // Return an array with the revchecked documentation types
 function revcheck_available_types()
 {
http://cvs.php.net/viewcvs.cgi/docweb/www/revcheck.php?r1=1.18&r2=1.19&diff_format=u
Index: docweb/www/revcheck.php
diff -u docweb/www/revcheck.php:1.18 docweb/www/revcheck.php:1.19
--- docweb/www/revcheck.php:1.18	Thu Jul 28 11:11:48 2005
+++ docweb/www/revcheck.php	Sun Feb  5 11:17:37 2006
@@ -1,5 +1,5 @@
 <?php
-/* $Id: revcheck.php,v 1.18 2005/07/28 11:11:48 mazzanet Exp $ */
+/* $Id: revcheck.php,v 1.19 2006/02/05 11:17:37 mazzanet Exp $ */
 
 include '../include/init.inc.php';
 include '../include/lib_revcheck.inc.php';
@@ -378,6 +378,8 @@
         case 'files' :
         // we need a dir to browse
         $dirs = get_dirs($dbhandle, $LANG);
+        $users = get_translators($dbhandle, $LANG);
+
         if (empty($dirs)) {
             echo 'no files';
         } else {
@@ -392,10 +394,26 @@
                 echo '<option value="' . $id . '"' . $selected . '>' . $name . '</option>' . "\n";
             }
             echo '</select><input type="hidden" name="p" value="files" /><input type="submit" value="See outdated files" /></p></form>';
+            
+            echo '<p>Or choose a translator :</p>';
+            echo '<form method="get" action="' . BASE_URL . '/revcheck.php?p=files"><p><select name="user">';
+            foreach ($users as $id => $user) {
+                if (isset($_GET['user']) && $_GET['user'] == $id) {
+                    $selected = ' selected="selected"';
+                } else {
+                    $selected = '';
+                }
+                echo '<option value="' . $id . '"' . $selected . '>' . $id . '</option>' . "\n";
+            }
+            echo '</select><input type="hidden" name="p" value="files" /><input type="submit" value="See outdated files" /></p></form>';
         }
 
-        if (isset($_GET['dir'])) {
-            $outdated = get_outdated_files($dbhandle, $LANG, $_GET['dir']);
+        if (isset($_GET['dir']) || isset($_GET['user'])) {
+            if (isset($_GET['user'])) {
+                $outdated = get_outdated_translator_files($dbhandle, $LANG, $_GET['user']);
+            } else {
+                $outdated = get_outdated_files($dbhandle, $LANG, $_GET['dir']);
+            }
             if (empty($outdated)) {
                 echo 'No files info';
             } else {
@@ -425,8 +443,13 @@
 
 END_OF_MULTILINE;
                 $last_dir = false;
+                $prev_name = $outdated[0]['name'];
 
                 foreach ($outdated as $r) {
+                    if ($r['name'] != $prev_name) {
+                       echo '<tr class="blue"><th colspan="12">'.$r['name'].'</th></tr>';
+                       $prev_name = $r['name'];
+                    }
                     $r['en_date'] = intval((time() - $r['en_date']) / 86400);
                     $r['trans_date'] = intval((time() - $r['trans_date']) / 86400);
                     // Make decision on file category by revision, date and size
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.