diff options
| author | deva <deva> | 2010-03-02 10:52:44 +0000 | 
|---|---|---|
| committer | deva <deva> | 2010-03-02 10:52:44 +0000 | 
| commit | 960fb99bfd02740c3652f020b76b8bd741481a4b (patch) | |
| tree | abe7b0c7de825b2f34d777512217889420268715 | |
| parent | 19f6738283f7d68f8ccb7bc58609582e628f62c4 (diff) | |
Set value from db/queries even though it doesn't have a value attribute (PART 2).
| -rw-r--r-- | server/src/widgetgenerator.cc | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/server/src/widgetgenerator.cc b/server/src/widgetgenerator.cc index 9647b9b..0240f69 100644 --- a/server/src/widgetgenerator.cc +++ b/server/src/widgetgenerator.cc @@ -40,7 +40,8 @@ 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,6 +75,10 @@ static std::string send_macro_widget(Macro ¯o,    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(); @@ -137,7 +142,8 @@ 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"] = +          xml_encode(values[widget.attributes["name"]].value);          timestamp = values[widget.attributes["name"]].timestamp;          prefilled = "pracro";        } @@ -180,7 +186,8 @@ 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["name"] != "") +      fields.push_back(widget.attributes["name"]);    }    std::vector< Widget >::iterator w = widget.widgets.begin(); @@ -190,7 +197,8 @@ 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); | 
