// (C) 2017-2020 by folkert van heusden, released under AGPL v3.0 #include "view_html_grid.h" #include "http_server.h" #include "utils.h" view_html_grid::view_html_grid(configuration_t *const cfg, const std::string & id, const std::string & descr, const int width, const int height, const std::vector & sources, const int gwidth, const int gheight, const double switch_interval) : view(cfg, id, descr, width, height, nullptr, sources), grid_width(gwidth), grid_height(gheight), switch_interval(switch_interval) { } view_html_grid::~view_html_grid() { } std::string view_html_grid::get_html(const std::map & pars) const { std::string col_size, row_size; for(int i=0; i second.c_str())); if (nr >= sources.size()) nr = 0; } const size_t total_view_size = grid_width * grid_height; std::string refresh; if (switch_interval >= 1.0 && sources.size() > total_view_size) refresh = myformat("", int(switch_interval), id.c_str(), nr + total_view_size); std::string out = myformat("%s", refresh.c_str(), dim_css.c_str(), col_size.c_str(), row_size.c_str()); std::string dim_img; int each_w = -1, each_h = -1; if (width != -1) { each_w = width / grid_width; dim_img += myformat(" width=%d", each_w); } if (height != -1) { each_h = height / grid_height; dim_img += myformat(" height=%d", each_h); } out += myformat("
"); for(int y=0; y
", page_url.c_str(), img_url.c_str(), dim_img.c_str()); if (nr == sources.size()) goto done; } } done: out += ""; out += ""; return out; } void view_html_grid::operator()() { }