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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 126 - (hide annotations) (download)
Sun Dec 2 20:26:43 2007 UTC (16 years, 6 months ago) by torben
File size: 1349 byte(s)
Silenced compiler warnings

1 torben 101 <%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     <%args>
17     int customerid;
18     std::string name;
19     </%args>
20    
21     <{
22     if (userName.size() == 0)
23     {
24     reply.setHeader("Location", "index");
25     return HTTP_MOVED_TEMPORARILY;
26     }
27     }>
28    
29     <&header title="Installation administration">
30     </&header>
31     <h2>Installation administration for <$ name $></h2>
32    
33    
34 torben 104 <a href="adm_customer_list">&lt;&lt;Back to customer list</a><br>
35 torben 101 <a href="adm_installation_edit?id=-1&customerid=<$customerid$>&name=<$name$>">Create new installation</a><br>
36    
37    
38     <{
39     tntdb::Connection conn = tntdb::connect(dburl);
40    
41     std::stringstream query;
42     query << "SELECT id,description FROM installation WHERE customerid=" << customerid << " ORDER BY description ASC";
43    
44     tntdb::Result res = conn.select(query.str());
45    
46     std::ostream& out = reply.out();
47     if (res.size() > 0)
48     {
49     out << "<ol>";
50 torben 126 for (unsigned i=0; i<res.size(); ++i)
51 torben 101 {
52     int id = res[i].getInt(0);
53     std::string desc = res[i].getString(1);
54     out << "<li>";
55     out << "<a href='adm_installation_edit?id=" << id << "&customerid=" << customerid << "&name=" << name <<"'>" << desc << "</a>";
56     out << "</li>";
57     }
58     out << "</ol>";
59     }
60     else
61     {
62     out << "<i>No installations found!</i>";
63     }
64     }>
65    
66     <&footer>
67     </&footer>

  ViewVC Help
Powered by ViewVC 1.1.20