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