diff options
author | deva <deva> | 2010-06-01 12:58:32 +0000 |
---|---|---|
committer | deva <deva> | 2010-06-01 12:58:32 +0000 |
commit | 74a28aa7125be6a603128ad600c98c4882f3b5c2 (patch) | |
tree | 1a9e4ab74f29d5ff10f2701e4e112f4525c0dcec /server/src/widgetgenerator.cc | |
parent | 9b9c1e2dd3e5807ff7714b378b03b9ba31f42df7 (diff) |
From new_protocol branch.
Diffstat (limited to 'server/src/widgetgenerator.cc')
-rw-r--r-- | server/src/widgetgenerator.cc | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/server/src/widgetgenerator.cc b/server/src/widgetgenerator.cc index 9fdacd2..425c71e 100644 --- a/server/src/widgetgenerator.cc +++ b/server/src/widgetgenerator.cc @@ -40,8 +40,7 @@ static std::string automap(std::string name) if(name[i] == '.') groupcheck += " and " + group; else groupcheck += name[i]; } - groupcheck += " and " + name + ".value and " + name + - ".timestamp and " + name + ".source"; + groupcheck += " and " + name + ".value and " + name + ".timestamp and " + name + ".source"; groupcheck += ")\n"; std::string automapstring = @@ -74,12 +73,9 @@ static std::string send_macro_widget(Macro ¯o, std::string prefilled; time_t timestamp = 0; time_t now = time(NULL); - /* - if(widget.attributes.find("value") != widget.attributes.end()) { - widget.attributes["value"] = ""; - } - */ + result = tabs + "<" + widget.attributes["tagname"]; + std::map< std::string, std::string >::iterator p = widget.attributes.begin(); PRACRO_DEBUG(prefill, "%s: %s\n", widget.attributes["tagname"].c_str(), @@ -113,9 +109,9 @@ static std::string send_macro_widget(Macro ¯o, if(luamap != "") { Value value = mapper.map(luamap); if(value.timestamp > now - Conf::pentominos_max_ttl) { - widget.attributes["value"] = xml_encode(value.value); + widget.attributes["value"] = value.value; timestamp = value.timestamp; - prefilled = xml_encode(value.source); + prefilled = value.source; } PRACRO_DEBUG(prefill, "map: (%s, %d)\n", @@ -141,8 +137,7 @@ static std::string send_macro_widget(Macro ¯o, if(values[widget.attributes["name"]].timestamp > timestamp) { if(values[widget.attributes["name"]].timestamp > now - Conf::db_max_ttl) { - widget.attributes["value"] = - xml_encode(values[widget.attributes["name"]].value); + widget.attributes["value"] = values[widget.attributes["name"]].value; timestamp = values[widget.attributes["name"]].timestamp; prefilled = "pracro"; } @@ -154,7 +149,6 @@ static std::string send_macro_widget(Macro ¯o, widget.attributes["value"].c_str(), (int)timestamp); - std::map< std::string, std::string >::iterator p = widget.attributes.begin(); while(p != widget.attributes.end()) { if(p->first != "tagname" && p->first != "map") { if( ! (p->first == "name" && p->second == "") ) @@ -184,12 +178,9 @@ static std::string send_macro_widget(Macro ¯o, static void get_fields(Widget &widget, Fieldnames &fields) { - // if(widget.attributes.find("value") != widget.attributes.end()) { - if(widget.attributes.find("name") != widget.attributes.end()) { - if(widget.attributes["name"] != "") - fields.push_back(widget.attributes["name"]); + if(widget.attributes.find("value") != widget.attributes.end()) { + if(widget.attributes["name"] != "") fields.push_back(widget.attributes["name"]); } - // } std::vector< Widget >::iterator w = widget.widgets.begin(); while(w != widget.widgets.end()) { @@ -198,8 +189,7 @@ static void get_fields(Widget &widget, Fieldnames &fields) } } -std::string widgetgenerator(std::string cpr, Macro ¯o, - LUAQueryMapper &mapper, Database &db) +std::string widgetgenerator(std::string cpr, Macro ¯o, LUAQueryMapper &mapper, Database &db) { Fieldnames fields; get_fields(macro.widgets, fields); |