Initial commit
[clearscm.git] / maps / php / list.php
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <?php
3 ////////////////////////////////////////////////////////////////////////////////
4 //
5 // File:        $RCSFile$
6 // Revision:    $Revision: 1.1 $
7 // Description: Process lists
8 // Author:      Andrew@DeFaria.com
9 // Created:     Fri Nov 29 14:17:21  2002
10 // Modified:    $Date: 2013/06/12 14:05:48 $
11 // Language:    PHP
12 //
13 // (c) Copyright 2000-2006, Andrew@DeFaria.com, all rights reserved.
14 //
15 ////////////////////////////////////////////////////////////////////////////////
16   include "site-functions.php";
17   include "MAPS.php";
18   MAPSHeader ();
19   $next = (isset ($_GET ["next"])) ? $_GET ["next"] : 0;
20 //  $prev;
21   $type = $_GET ["type"];
22   $message = $_GET ["message"];
23   $Type = ucfirst ($type);
24   $Userid = ucfirst ($userid);
25 ?>
26 <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
27 <head>
28   <title>MAPS: Manage <?php echo "$Type"?> List</title>
29   <script language="JavaScript1.2" src="/maps/JavaScript/ListActions.js"
30    type="text/javascript"></script>
31 <?php 
32 // Connect to MySQL
33 OpenDB ();
34
35 // Set User context
36 SetContext ($userid);
37
38 // Set $lines
39 $lines = GetUserLines ();
40
41 if (($next - $lines) > 0) {
42   $prev = $next - $lines;
43 } else {
44   $prev = $next == 0 ? -1 : 0;
45 } // if
46
47 $total = CountList ($type);
48 $last = $next + $lines < $total ? $next + $lines : $total;
49 $last_page = floor ($total / $lines);
50 $this_page = $next / $lines + 1;
51 ?>
52 </head>
53 <body>
54
55 <div class="heading">
56   <h2 class="header" align="center">
57   <font class="standout">MAPS</font> Manage <?php echo "$Userid's "; echo $Type?> List</h2>
58 </div>
59
60 <div class="content">
61   <?php NavigationBar ($userid)?>
62   <form method="post" action="/maps/bin/processaction.cgi" name="list">
63   <div align="center">
64   <?php 
65     if ($message != "") {
66       print "<center><font class=\"error\">$message</font></center>";
67     } // if
68     $current = $next + 1;
69     print "<input type=hidden name=type value=$type>";
70     print "<input type=hidden name=next value=$next>";
71     print "Page: <select name=page onChange=\"ChangePage(this.value,'$type','$lines');\"";
72     for ($i = 1; $i <= $last_page; $i++) {
73       if ($i == ($this_page - 1)) {
74         print "<option selected>$i</option>";
75       } else {
76         print "<option>$i</option>";
77       } // if
78     } // for
79     print "</select>";
80     print "&nbsp;of $last_page";
81   ?>
82   </div>
83   <div class="toolbar" align="center">
84     <?php
85     $prev_button = $prev >= 0 ? 
86       "<a href=list.php?type=$type&next=$prev><img src=/maps/images/previous.gif border=0 alt=Previous align=middle></a>" : "";
87     $next_button = ($next + $lines) < $total ? 
88       "<a href=list.php?type=$type&next=" . ($next + $lines) . "><img src=/maps/images/next.gif border=0 alt=Previous align=middle></a>" : "";
89     print $prev_button;
90     ?>
91     <input type="submit" name="action" value="Add New Entry"
92       onclick="return NoneChecked (document.list);">
93     <input type="submit" name="action" value="Delete Marked"
94       onclick="return CheckAtLeast1Checked (document.list) && AreYouSure ('Are you sure you want to delete these entries?');">
95     <input type="submit" name="action" value="Modify Marked"
96       onclick="return CheckAtLeast1Checked (document.list);">
97     <input type="submit" name="action" value="Reset Marks"
98       onclick="return ClearAll (document.list);">
99     <?php print $next_button?>
100   </div>
101   <table border="0" cellspacing="0" cellpadding="4" width="100%" align="center" name="list">
102     <tr>
103       <th class="tableleftend">Seq</th>
104       <th class="tableheader">Mark</th>
105       <th class="tableheader">Username</th>
106       <th class="tableheader">@</th>
107       <th class="tableheader">Domain</th>
108       <th class="tableheader">Hit Count</th>
109       <th class="tableheader">Last Hit</th>
110       <th class="tablerightend">Comments</th>
111     </tr>
112
113     <?php DisplayList ($type, $next, $lines)?>
114
115   </table>
116   <br>
117   <div align=center>
118     <a href="/maps/bin/exportlist.cgi?type=<?php echo $type?>">
119     <input type=submit name=export value="Export list"></a>
120     <a href="/maps/bin/importlist.cgi?type=<?php echo $type?>">
121     <input type=submit name=import value="Import List"></a>
122   </div>
123   </form>
124   <?php copyright (2001)?>
125
126 </body>
127 </html>