/[H9]/trunk/tntnet/dynamic/adm_customer_list.ecpp
ViewVC logotype

Annotation of /trunk/tntnet/dynamic/adm_customer_list.ecpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 171 - (hide annotations) (download)
Thu Dec 6 10:18:40 2007 UTC (16 years, 6 months ago) by torben
File size: 1233 byte(s)
Small layout fixes

1 torben 83 <%pre>
2     #include <tntdb/connect.h>
3     #include <tntdb/connection.h>
4     #include <tntdb/result.h>
5     #include <tntdb/row.h>
6     </%pre>
7    
8     <%config>
9     dburl;
10     </%config>
11    
12     <%session scope="global">
13     std::string userName;
14     </%session>
15    
16 torben 94 <{
17     if (userName.size() == 0)
18     {
19     reply.setHeader("Location", "index");
20     return HTTP_MOVED_TEMPORARILY;
21     }
22     }>
23    
24 torben 83 <&header title="Customer administration">
25     </&header>
26     <h2>Customers administration</h2>
27    
28     <a href="adm_customer_edit?id=-1">Create new customer</a><br>
29 torben 171 <br>
30 torben 83
31     <{
32 torben 94 tntdb::Connection conn = tntdb::connect(dburl);
33 torben 83
34     std::string query = "SELECT id, name FROM customer ORDER BY name ASC";
35    
36     tntdb::Result res = conn.select(query);
37    
38     std::ostream& out = reply.out();
39     if (res.size() > 0)
40     {
41 torben 104 out << "<table border='1' cellspacing='0'>";
42 torben 126 for (unsigned i=0; i<res.size(); ++i)
43 torben 83 {
44     int id = res[i].getInt(0);
45     std::string name = res[i].getString(1);
46 torben 171 out << "<tr><td>&nbsp;";
47 torben 83 out << "<a href='adm_customer_edit?id=" << id << "'>" << name << "</a>";
48 torben 171 out << "&nbsp;</td>\n<td>&nbsp;";
49 torben 104 out << "<a href='adm_installation_list?customerid=" << id << "&name=" << name << "'>manage installations</a>";
50 torben 171 out << "&nbsp;</td></tr>";
51 torben 83 }
52 torben 104 out << "</table>";
53 torben 83 }
54     else
55     {
56     out << "<i>No customers found!</i>";
57     }
58     }>
59    
60     <&footer>
61     </&footer>

  ViewVC Help
Powered by ViewVC 1.1.20