footer_generator.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "footer_generator.h"
00024
00025 #include <utils/misc/string_conversions.h>
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 WebviewFooterGenerator::WebviewFooterGenerator(WebviewServiceBrowseHandler *service_browser)
00039 {
00040 __service_browser = service_browser;
00041 }
00042
00043
00044 std::string
00045 WebviewFooterGenerator::html_footer()
00046 {
00047 std::string f = std::string("\n <div id=\"footer\">\n")
00048 + " <hr />\n";
00049 WebviewServiceBrowseHandler::ServiceList sl = __service_browser->service_list();
00050 if (! sl.empty()) {
00051 f += " <div class=\"instances\"><ul>";
00052 WebviewServiceBrowseHandler::ServiceList &sl = __service_browser->service_list();
00053 WebviewServiceBrowseHandler::ServiceList::iterator i;
00054 for (i = sl.begin(); i != sl.end(); ++i) {
00055 std::string short_host = i->second->host();
00056 std::string::size_type s = short_host.find(".");
00057 if (s != std::string::npos) short_host = short_host.substr(0, s);
00058
00059 f += std::string("<li><a href=\"http://") + i->second->host() + ":"
00060 + fawkes::StringConversions::to_string(i->second->port()) + "/\""
00061 + " title=\"" + i->first + "\">"
00062 + short_host + "</a></li>";
00063 }
00064 f += "</ul></div>\n";
00065 }
00066 f += " </div>";
00067 f += "\n </body>\n";
00068 f += "</html>\n";
00069
00070 return f;
00071 }