--- trunk/tntnet/dynamic/critical.ecpp 2007/12/02 16:56:14 122 +++ trunk/tntnet/dynamic/critical.ecpp 2007/12/05 10:47:51 156 @@ -4,19 +4,6 @@ #include #include -//#include -#include - -/* -class CriticalInstallation -{ -public: - CriticalInstallation() {} - CriticalInstallation(int i, std::string m) : id(i), message(m) {} - int id; - std::string message; -};*/ - <%config> @@ -29,21 +16,13 @@ <{ - -//std::vector criticals; +reply.setHeader("Refresh", "120"); tntdb::Connection conn = tntdb::connect(dburl); -/* -tntdb::Result res = conn.select("SELECT id FROM installation WHERE commerror = true"); -for (int i=0; i 0) { - bool commerror = res[0].getBool(0); - int temperature = res[0].getInt(1); - bool flameDetector = res[0].getBool(2); - bool conveyorError = res[0].getBool(3); - bool powerFailure = res[0].getBool(4); + temperature = res[0].getInt(0); + flameDetector = res[0].getBool(1); + conveyorError = res[0].getBool(2); + powerFailure = res[0].getBool(3); + } - if (commerror || temperature > 90 || flameDetector == false || conveyorError || powerFailure) - { - out << "" << inst_res[i].getString(0) << " : " << inst_res[i].getString(1) << "
\n"; - out << "
    "; + if (commerror || temperature > 90 || flameDetector == false || conveyorError || powerFailure) + { + out << "" << inst_res[i].getString(0) << " : " << inst_res[i].getString(1) << "
    \n"; + out << "
      "; - if (temperature > 90) - out << "
    • High temperature
    • \n"; + if (temperature > 90) + out << "
    • High temperature
    • \n"; - if (commerror) - out << "
    • Communication error
    • \n"; + if (commerror) + out << "
    • Communication error
    • \n"; - if (flameDetector == false) - out << "
    • No flames
    • \n"; + if (flameDetector == false) + out << "
    • No flames
    • \n"; - if (conveyorError) - out << "
    • Conveyor error
    • \n"; + if (conveyorError) + out << "
    • Conveyor error
    • \n"; - if (powerFailure) - out << "
    • Power failure
    • \n"; + if (powerFailure) + out << "
    • Power failure
    • \n"; - out << "
    \n"; + out << "
\n"; - - } + hasCritical = true; } } +if (hasCritical == false) +{ + out << "No critical installations found\n"; +} + }> <&footer>