--- trunk/tntnet/dynamic/installationdetails.ecpp 2007/11/30 16:03:46 110 +++ trunk/tntnet/dynamic/installationdetails.ecpp 2007/11/30 16:05:11 111 @@ -3,6 +3,16 @@ #include #include #include + +#include +#include "common.h" + + +inline std::string convert_bool(bool input) +{ + return input ? "on" : "off"; +} + <%config> @@ -12,12 +22,111 @@ <&header title="Installation details"> +<%args> +int id; + +

Installation details

+ <{ tntdb::Connection conn; -conn = tntdb::connect(dburl); //letting exceptions flow up and to tntnet and let it display an error message +conn = tntdb::connect(dburl); + +std::stringstream query; +query << "SELECT c.name, c.address AS caddress, i.description, i.address AS iadress, i.furnacetype, i.updaterate "; +query << "FROM installation i INNER JOIN customer c ON c.id = i.customerid "; +query << "WHERE i.id = " << id; + +std::ostream& out = reply.out(); + +tntdb::Result res = conn.select(query.str()); + +if (res.size() >0 ) +{ +}> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Customer: <$ res[0].getString(0) $>
Customer address:  <$$ nl2br(res[0].getString(1)) $>
Installation: <$ res[0].getString(2) $>
Location: <$$ nl2br(res[0].getString(3)) $>
Furnace type: <$ res[0].getString(4) $>
Update rate: <$ res[0].getInt(5) $>
+ + +

+ + <{ + query.str(""); //reset stringstream + query << "SELECT messagenr, date_trunc('second', logtime) AS logtime, temperature, flamedetector, solidfuelempty, conveyorerror,powerfailure "; + query << "FROM logtable "; + query << "WHERE installationnr = " << id; + query << "ORDER BY messagenr DESC"; + res = conn.select(query.str()); + + + out << "\n"; + out << "\n"; + + for (int i=0; i"; + + out << "\n"; + out << "\n"; + out << "\n"; + out << "\n"; + out << "\n"; + out << "\n"; + out << "\n"; + + out << ""; + } + + + }> + + + +<{ +} +else +{ + reply.out() << "No installation with this ID"; +} }>
 Message#  Logtime  Temperature  Flamedetector  Solidfuel empty  Conveyor error  Power failure 
" << messagenr << "" << logtime << "90 ? critical : "" ) << ">" << temperature << "" << convert_bool(flamedetector) << "" << convert_bool(solidfuelempty) << "" << convert_bool(conveyorerror) << "" << convert_bool(powerfailure) << "