make index.php page aware; make default page start at 1
authorArun Persaud <arun@nubati.net>
Thu, 24 Nov 2011 19:03:27 +0000 (11:03 -0800)
committerArun Persaud <apersaud@lbl.gov>
Thu, 24 Nov 2011 19:03:27 +0000 (11:03 -0800)
this way page=0 can be used for an overview

getjson.php
index.php

index 24a913f2977084a472e1e83b1a2d7243e17ab88e..6026776775ea5a5278becd77e0289b806b0bfceb 100644 (file)
@@ -10,7 +10,7 @@ $N=$iniarray["pics_per_page"];
 /* end parse ini-file */
 
 if (isset($_REQUEST["P"]))
 /* end parse ini-file */
 
 if (isset($_REQUEST["P"]))
-  $OFFSET = "".($_REQUEST["P"]*$N).",";
+  $OFFSET = "".($_REQUEST["P"]*$N-$N).",";
 else
   $OFFSET = "";
 
 else
   $OFFSET = "";
 
index d3d569f3eba56612598a68bd029ee6b58ade19f7..44be53b253318db28df504c1a123749b642537f0 100644 (file)
--- a/index.php
+++ b/index.php
@@ -7,6 +7,13 @@ $admin=$iniarray["admin"];
 $title=$iniarray["title"];
 $N=$iniarray["pics_per_page"];
 /* end parse ini-file */
 $title=$iniarray["title"];
 $N=$iniarray["pics_per_page"];
 /* end parse ini-file */
+
+/* parse flags */
+if(isset($_REQUEST["page"]))
+  $page = intval($_REQUEST["page"]);
+else
+  $page = 1;
+
 ?>
 <html>
 <title><?php echo htmlspecialchars($title) ?></title>
 ?>
 <html>
 <title><?php echo htmlspecialchars($title) ?></title>
@@ -35,8 +42,8 @@ $N=$iniarray["pics_per_page"];
 
 var pics = d3.select(".pics").append("ul");
 
 
 var pics = d3.select(".pics").append("ul");
 
-var page=0;
-var N=<?php echo $N?>;
+var page=<?php echo $page ?>;
+var N=<?php echo $N ?>;
 var count=0;
 
 function myreload(a) {
 var count=0;
 
 function myreload(a) {
@@ -65,7 +72,7 @@ function myreload(a) {
 }
 
 function left() {
 }
 
 function left() {
-  if (page>=1) page=page-1;
+  if (page>=2) page=page-1;
   myreload(page);
 }
 
   myreload(page);
 }
 
@@ -76,7 +83,7 @@ function right() {
 
 function checkbutton() {
 
 
 function checkbutton() {
 
-  if (page==0)
+  if (page==1)
     { d3.select("button.prev").attr("disabled","disabled");}
   else
     { d3.select("button.prev").attr("disabled", null);};
     { d3.select("button.prev").attr("disabled","disabled");}
   else
     { d3.select("button.prev").attr("disabled", null);};