]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Able to scroll the list of users
authorJean-Marc Pigeon <jmp@safe.c>
Tue, 9 Sep 2025 01:15:23 +0000 (21:15 -0400)
committerJean-Marc Pigeon <jmp@safe.c>
Tue, 9 Sep 2025 01:15:23 +0000 (21:15 -0400)
www/lvlusr.php

index 2e8123f7aaa036e8a3a76c8cd4aa4096f4273280..76e6ff7763f1314ccf1745138e3c444d4e75bb6c 100644 (file)
@@ -17,18 +17,19 @@ $STR  = <<<EOT
 <TR>
 <TH align=left>
 <FORM action="lvlusr.php" method="post">
-<button name="scanner" value="gottop">
+<input type="hidden" name="offset" value="$offset"/>
+<input type="hidden" name="limit" value="$limit"/>
+<button name="scanner" value="gofirst">
 <FONT SIZE=+3>
 &larrb;
 </FONT>
 </Button>
-<button name="scanner" value="rewind">
+<button name="scanner" value="goprevious">
 <FONT SIZE=+3>
 &larr;
 </FONT>
 </Button>
-<FONT SIZE=+2>$offset/$numrec</FONT>
-<button name="scanner" value="forward">
+<button name="scanner" value="gonext">
 <FONT SIZE=+3>
 &rarr;
 </FONT>
@@ -38,11 +39,13 @@ $STR  = <<<EOT
 &rarrb;
 </FONT>
 </Button>
+<FONT SIZE=+2>$offset/$numrec</FONT>
 </FORM>
 </TH>
 <TD align=right>
 <FORM method="post">
-<select name="tbllim" onchange='if (this.value!=0) {this.form.submit();}'>
+<input type="hidden" name="offset" value="$offset"/>
+<select name="limit" style="font-size: 130%;" onchange='if (this.value!=0) {this.form.submit();}'>
 <option selected="selected">$limit</option>
 <option value=20>20</option>
 <option value=40>40</option>
@@ -65,15 +68,39 @@ global $isadmin;
 global $logname;
 
 $limit=20;
-$scanner=$_POST['scanner'];
-rou_alert(0,"JMPDBG scanner=$scanner");
-$agent_id=$_POST['tbllim'];
-if ( $agent_id!=NULL) 
-  $limit=intval($agent_id);
-$offset=2*$limit;
-$line="";
+$offset=0;
 $dbsql=sql_connect();
 $numrec=sql_getnumrec($dbsql,"emails");
+if (isset($_POST['limit']))
+  $limit=intval($_POST['limit']);
+if (isset($_POST['offset']))
+  $offset=intval($_POST['offset']);
+if (isset($_POST['scanner'])) {
+  $scanner=$_POST['scanner'];
+  switch ($scanner) {
+    case "golast"       :
+      $offset=$numrec-$limit;
+      break;
+    case "gonext"       :
+      $offset+=$limit;
+      if ($offset>($numrec-$limit))
+        $offset=$numrec-$limit;
+      break;
+    case "goprevious"   :
+      $offset-=$limit;
+      if ($offset<0)
+        $offset=0;
+      break;
+    case "gofirst"       :
+      $offset=0;
+      break;
+    default             :
+      break;
+    }
+  rou_alert(0,"JMPDBG scanner=$scanner");
+  }
+rou_alert(0,"JMPDBG scanner=$scanner offset=$offset");
+$line="";
 $emails=sql_getemaillist($dbsql,$limit,$offset);
 $count=$offset;
 foreach($emails as $email) {