Merge branch 'master' of /opt/git/clearscm
[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   if (isset($_GET['message'])) {
23     $message = $_GET["message"];
24   } else {
25     $message = '';
26   } // if
27   $Type = ucfirst ($type);
28   $Userid = ucfirst ($userid);
29 ?>
30 <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
31 <head>
32   <title>MAPS: Manage <?php echo "$Type"?> List</title>
33   <script language="JavaScript1.2" src="/maps/JavaScript/ListActions.js"
34    type="text/javascript"></script>
35 <?php 
36 // Connect to MySQL
37 OpenDB ();
38
39 // Set User context
40 SetContext ($userid);
41
42 // Set $lines
43 $lines = GetUserLines ();
44
45 if (($next - $lines) > 0) {
46   $prev = $next - $lines;
47 } else {
48   $prev = $next == 0 ? -1 : 0;
49 } // if
50
51 $total = CountList ($type);
52 $last = $next + $lines < $total ? $next + $lines : $total;
53 $last_page = floor ($total / $lines);
54 $this_page = $next / $lines + 1;
55 ?>
56 </head>
57 <body>
58
59 <div class="heading">
60   <h2 class="header" align="center">
61   <font class="standout">MAPS</font> Manage <?php echo "$Userid's "; echo $Type?> List</h2>
62 </div>
63
64 <div class="content">
65   <?php NavigationBar ($userid)?>
66   <form method="post" action="/maps/bin/processaction.cgi" name="list">
67   <div align="center">
68   <?php 
69     if ($message != "") {
70       print "<center><font class=\"error\">$message</font></center>";
71     } // if
72     $current = $next + 1;
73     print "<input type=hidden name=type value=$type>";
74     print "<input type=hidden name=next value=$next>";
75     print "Page: <select name=page onChange=\"ChangePage(this.value,'$type','$lines');\"";
76     for ($i = 1; $i <= $last_page; $i++) {
77       if ($i == ($this_page - 1)) {
78         print "<option selected>$i</option>";
79       } else {
80         print "<option>$i</option>";
81       } // if
82     } // for
83     print "</select>";
84     print "&nbsp;of $last_page";
85   ?>
86   </div>
87   <div class="toolbar" align="center">
88     <?php
89     $prev_button = $prev >= 0 ? 
90       "<a href=list.php?type=$type&next=$prev><img src=/maps/images/previous.gif border=0 alt=Previous align=middle></a>" : "";
91     $next_button = ($next + $lines) < $total ? 
92       "<a href=list.php?type=$type&next=" . ($next + $lines) . "><img src=/maps/images/next.gif border=0 alt=Previous align=middle></a>" : "";
93     print $prev_button;
94     ?>
95     <input type="submit" name="action" value="Add New Entry"
96       onclick="return NoneChecked (document.list);">
97     <input type="submit" name="action" value="Delete Marked"
98       onclick="return CheckAtLeast1Checked (document.list) && AreYouSure ('Are you sure you want to delete these entries?');">
99     <input type="submit" name="action" value="Modify Marked"
100       onclick="return CheckAtLeast1Checked (document.list);">
101     <input type="submit" name="action" value="Reset Marks"
102       onclick="return ClearAll (document.list);">
103     <?php print $next_button?>
104   </div>
105   <table border="0" cellspacing="0" cellpadding="4" width="100%" align="center" name="list">
106     <tr>
107       <th class="tableleftend">Seq</th>
108       <th class="tableheader">Mark</th>
109       <th class="tableheader">Username</th>
110       <th class="tableheader">@</th>
111       <th class="tableheader">Domain</th>
112       <th class="tableheader">Hit Count</th>
113       <th class="tableheader">Last Hit</th>
114       <th class="tablerightend">Comments</th>
115     </tr>
116
117     <?php DisplayList ($type, $next, $lines)?>
118
119   </table>
120   <br>
121   <div align=center>
122     <a href="/maps/bin/exportlist.cgi?type=<?php echo $type?>">
123     <input type=submit name=export value="Export List"></a>
124     <a href="/maps/bin/importlist.cgi?type=<?php echo $type?>">
125     <input type=submit name=import value="Import List"></a>
126   </div>
127   </form>
128   <?php copyright (2001)?>
129
130 </body>
131 </html>