Author: mike
Date: 2008-11-07 16:29:10 -0800 (Fri, 07 Nov 2008)
New Revision: 512
Log:
Add "items per page" setting to user prefeences.
Modified:
trunk/phplib/auth.php
trunk/phplib/base-str.php
trunk/phplib/db-user.php
trunk/phplib/globals.php
Modified: trunk/phplib/auth.php
===================================================================
--- trunk/phplib/auth.php 2008-10-20 22:46:06 UTC (rev 511)
+++ trunk/phplib/auth.php 2008-11-08 00:29:10 UTC (rev 512)
@@ -1,6 +1,6 @@
<?
//
-// "$Id: auth.php,v 1.3 2005/01/28 20:58:00 easysw Exp $"
+// "$Id$"
//
// Authentication functions for PHP pages...
//
@@ -60,15 +60,18 @@
// Store the current user in the global variable LOGIN_USER...
//
-$LOGIN_ID = 0;
-$LOGIN_LEVEL = 0;
-$LOGIN_USER = "";
-$LOGIN_EMAIL = "";
+$LOGIN_ID = 0;
+$LOGIN_LEVEL = 0;
+$LOGIN_USER = "";
+$LOGIN_EMAIL = "";
$LOGIN_PROJECTS = 0;
+$PAGE_MAX = 20;
auth_current();
+
+
//
// 'auth_current()' - Return the currently logged in user...
//
@@ -77,7 +80,7 @@
auth_current()
{
global $_COOKIE, $_SERVER, $LOGIN_EMAIL, $LOGIN_LEVEL, $LOGIN_USER,
- $LOGIN_PROJECTS, $PROJECT_MODULE, $LOGIN_ID;
+ $LOGIN_PROJECTS, $PROJECT_MODULE, $LOGIN_ID, $PAGE_MAX;
// See if the SID cookie is set; if not, the user is not logged in...
@@ -113,6 +116,7 @@
$LOGIN_LEVEL = $row["level"];
$LOGIN_EMAIL = $row["email"];
$LOGIN_PROJECTS = $row["projects"];
+ $PAGE_MAX = $row["items_per_page"];
$_COOKIE["${PROJECT_MODULE}FROM"] = $row["email"];
// Return the current user...
@@ -133,7 +137,7 @@
$password) // I - Password
{
global $_COOKIE, $_SERVER, $LOGIN_EMAIL, $LOGIN_LEVEL, $LOGIN_USER,
- $LOGIN_PROJECTS, $PROJECT_MODULE, $LOGIN_ID;
+ $LOGIN_PROJECTS, $PROJECT_MODULE, $LOGIN_ID, $PAGE_MAX;
// Reset the user...
@@ -157,6 +161,7 @@
$LOGIN_LEVEL = $row["level"];
$LOGIN_EMAIL = $row["email"];
$LOGIN_PROJECTS = $row["projects"];
+ $PAGE_MAX = $row["items_per_page"];
$_COOKIE["${PROJECT_MODULE}FROM"] = $row["email"];
// Compute the session ID...
@@ -273,6 +278,6 @@
//
-// End of "$Id: auth.php,v 1.3 2005/01/28 20:58:00 easysw Exp $".
+// End of "$Id$".
//
?>
Modified: trunk/phplib/base-str.php
===================================================================
--- trunk/phplib/base-str.php 2008-10-20 22:46:06 UTC (rev 511)
+++ trunk/phplib/base-str.php 2008-11-08 00:29:10 UTC (rev 512)
@@ -585,9 +585,6 @@
if ($index < 0)
$index = 0;
break;
- case 'M' : // Set max STRs per page
- $PAGE_MAX = (int)$option;
- break;
case 'P' : // Set priority filter
$priority = (int)$option;
break;
@@ -628,16 +625,11 @@
$scope = (int)$_POST["FSCOPE"];
if (array_key_exists("FEMAIL", $_POST))
$femail = (int)$_POST["FEMAIL"];
- if (array_key_exists("FPAGEMAX", $_POST))
- {
- $PAGE_MAX = (int)$_POST["FPAGEMAX"];
- setcookie("PAGE_MAX", $PAGE_MAX, time() + 365 * 86400);
- }
if (array_key_exists("SEARCH", $_POST))
$search = $_POST["SEARCH"];
}
- $options = "+P$priority+S$status+C$scope+I$index+E$femail+M$PAGE_MAX+Q" .
+ $options = "+P$priority+S$status+C$scope+I$index+E$femail+Q" .
urlencode($search);
// B = Batch update selected STRs
@@ -748,13 +740,13 @@
$f_me = array_search($id, $f_matches);
if ($f_me>0) {
$f_prev_id = $f_matches[$f_me-1];
- html_link("Prev",
"$PHP_SELF?L$f_prev_id+P$priority+S$status+C$scope+E$femail+"
- ."M$PAGE_MAX+Q" . urlencode($search));
+ html_link("Prev", "$PHP_SELF?L$f_prev_id+P$priority+S$status+"
+ ."C$scope+E$femail+Q" . urlencode($search));
}
if ($f_me<$f_count-1) {
$f_next_id = $f_matches[$f_me+1];
- html_link("Next",
"$PHP_SELF?L$f_next_id+P$priority+S$status+C$scope+E$femail+"
- ."M$PAGE_MAX+Q" . urlencode($search));
+ html_link("Next", "$PHP_SELF?L$f_next_id+P$priority+S$status+"
+ ."C$scope+E$femail+Q" . urlencode($search));
}
html_end_links();
@@ -765,8 +757,8 @@
}
else
{
- $bookmark = "$PHP_URL?L+P$priority+S$status+C$scope+E$femail+"
- ."M$PAGE_MAX+Q" . urlencode($search);
+ $bookmark = "$PHP_URL?L+P$priority+S$status+C$scope+E$femail+Q"
+ . urlencode($search);
html_header("Bugs & Features", $path, "", $links);
html_start_links(1);
@@ -838,17 +830,6 @@
print("</select>\n");
}
- $values = array(10, 20, 50, 100, 1000);
- print("STRs/Page: <select name='FPAGEMAX'>");
- for ($i = 0; $i < sizeof($values); $i ++)
- {
- if ($values[$i] == $PAGE_MAX)
- print("<option value='$values[$i]'
selected>$values[$i]</option>");
- else
- print("<option value='$values[$i]'>$values[$i]</option>");
- }
- print("</select>\n");
-
print("<br><i>Search supports 'and', 'or', 'not', and parenthesis. "
."<a href='${path}search-help.php'>More info...</a></i>"
."</p></form>\n");
Modified: trunk/phplib/db-user.php
===================================================================
--- trunk/phplib/db-user.php 2008-10-20 22:46:06 UTC (rev 511)
+++ trunk/phplib/db-user.php 2008-11-08 00:29:10 UTC (rev 512)
@@ -35,6 +35,7 @@
var $hash, $hash_valid;
var $level, $level_valid;
var $projects, $projects_valid;
+ var $items_per_page;
var $create_date;
var $create_user;
var $modify_date;
@@ -71,6 +72,7 @@
$this->hash = "";
$this->level = AUTH_USER;
$this->projects = 0;
+ $this->items_per_page = 20;
$this->create_date = 0;
$this->create_user = "";
$this->modify_date = 0;
@@ -114,7 +116,7 @@
if ($LOGIN_LEVEL < AUTH_ADMIN)
{
print("<input type='hidden' name='is_published' "
- ."value='$this->is_published'/>");
+ ."value='$this->is_published'>");
}
else
{
@@ -131,9 +133,9 @@
$hclass = "invalid";
print("<tr><th class='$hclass' align='right' valign='top'
nowrap>Username:</th><td>");
if ($LOGIN_LEVEL < AUTH_ADMIN)
- print("<input type='hidden' name='name' value='$html'/>$html");
+ print("<input type='hidden' name='name' value='$html'>$html");
else
- print("<input type='text' name='name' value='$html' size='72'/>");
+ print("<input type='text' name='name' value='$html' size='72'>");
print("</td></tr>\n");
// email
@@ -144,7 +146,7 @@
$hclass = "invalid";
print("<tr><th class='$hclass' align='right' valign='top'
nowrap>Email:</th><td>");
print("<input type='text' name='email' "
- ."value='$html' size='72'/>");
+ ."value='$html' size='72'>");
print("</td></tr>\n");
// password
@@ -153,10 +155,10 @@
else
$hclass = "invalid";
print("<tr><th class='$hclass' align='right' valign='top'
nowrap>Password:</th><td>");
- print("<input type='password' name='password' size='20'/> (leave blank for
no change)");
+ print("<input type='password' name='password' size='20'> (leave blank for
no change)");
print("</td></tr>\n");
print("<tr><th class='$hclass' align='right' valign='top' nowrap>Password
Again:</th><td>");
- print("<input type='password' name='password2' size='20'/>");
+ print("<input type='password' name='password2' size='20'>");
print("</td></tr>\n");
// level
@@ -167,7 +169,7 @@
print("<tr><th class='$hclass' align='right' valign='top' nowrap>Access
Level:</th><td>");
if ($LOGIN_LEVEL < AUTH_ADMIN)
- print("<input type='hidden' name='level' value='$this->level'/>"
+ print("<input type='hidden' name='level' value='$this->level'>"
. $AUTH_LEVELS[$this->level]);
else
{
@@ -206,17 +208,28 @@
print("<input type='checkbox' name='$form' ");
if ($this->projects & $AUTH_MASKS[$link_id])
print("checked");
- print("/>$name<br />");
+ print(">$name<br >");
}
else if ($this->projects & $AUTH_MASKS[$link_id])
- print("$name<br />");
+ print("$name<br >");
}
print("</td></tr>\n");
}
+ // items_per_page
+ $choices = array(10, 20, 50, 100, 1000);
+ print("<tr><th class='valid' align='right'>Items per Page:</th>"
+ ."<td><select name='items_per_page'>");
+ foreach ($choices as $choice)
+ if ($choice == $this->items_per_page)
+ print("<option value='$choice' selected>$choice</option>");
+ else
+ print("<option value='$choice'>$choice</option>");
+ print("</select></td></tr>\n");
+
// Submit
print("<tr><td></td><td>"
- ."<input type='submit' value='$action'/>"
+ ."<input type='submit' value='$action'>"
."</td></tr>\n"
."</table></p>\n"
."</form>\n");
@@ -244,6 +257,7 @@
$this->hash = $row["hash"];
$this->level = $row["level"];
$this->projects = $row["projects"];
+ $this->items_per_page = $row["items_per_page"];
$this->create_date = $row["create_date"];
$this->create_user = $row["create_user"];
$this->modify_date = $row["modify_date"];
@@ -283,10 +297,10 @@
else if (array_key_exists("email", $_POST))
$this->email = $_POST["email"];
- if (array_key_exists("level", $_GET))
- $this->level = $_GET["level"];
- else if (array_key_exists("level", $_POST))
- $this->level = $_POST["level"];
+ if (array_key_exists("items_per_page", $_GET))
+ $this->items_per_page = (int)$_GET["items_per_page"];
+ else if (array_key_exists("items_per_page", $_POST))
+ $this->items_per_page = (int)$_POST["items_per_page"];
if (array_key_exists("password", $_GET))
$password = $_GET["password"];
@@ -309,6 +323,11 @@
if ($LOGIN_LEVEL == AUTH_ADMIN)
{
+ if (array_key_exists("level", $_GET))
+ $this->level = $_GET["level"];
+ else if (array_key_exists("level", $_POST))
+ $this->level = $_POST["level"];
+
$this->projects = 0;
reset($AUTH_PROJECTS);
@@ -366,6 +385,7 @@
.", hash = '" . db_escape($this->hash) . "'"
.", level = $this->level"
.", projects = $this->projects"
+ .", items_per_page = $this->items_per_page"
.", modify_date = $this->modify_date"
.", modify_user = '" . db_escape($this->modify_user) . "'"
." WHERE id = $this->id") === FALSE)
@@ -451,6 +471,7 @@
.", '" . db_escape($this->hash) . "'"
.", $this->level"
.", $this->projects"
+ .", $this->items_per_page"
.", $this->create_date"
.", '" . db_escape($this->create_user) . "'"
.", $this->modify_date"
@@ -658,10 +679,15 @@
reset($AUTH_PROJECTS);
while (list($link_id, $name) = each($AUTH_PROJECTS))
if ($this->projects & $AUTH_MASKS[$link_id])
- print("$name<br />");
+ print("$name<br >");
print("</td></tr>\n");
}
+ // items_per_page
+ print("<tr><th align='right' valign='top' nowrap>Items per
Page:</th><td>");
+ print($this->items_per_page);
+ print("</td></tr>\n");
+
// create_date
$html = date("H:i M d, Y", $this->create_date);
print("<tr><th align='right' valign='top' nowrap>User Since:</th><td>");
Modified: trunk/phplib/globals.php
===================================================================
--- trunk/phplib/globals.php 2008-10-20 22:46:06 UTC (rev 511)
+++ trunk/phplib/globals.php 2008-11-08 00:29:10 UTC (rev 512)
@@ -13,17 +13,6 @@
global $_COOKIE, $_FILES, $_GET, $_POST, $_SERVER;
-// Max items per page
-if (array_key_exists("PAGE_MAX", $_COOKIE))
-{
- $PAGE_MAX = (int)$_COOKIE["PAGE_MAX"];
-
- if ($PAGE_MAX < 10)
- $PAGE_MAX = 10;
-}
-else
- $PAGE_MAX = 10;
-
$PROJECT_BUGS = "[EMAIL PROTECTED]"; // Bug reporting address
$PROJECT_EMAIL = "[EMAIL PROTECTED]";
// Default notification address
_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit