| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#pragma once |
| 22 |
|
| 23 |
#include <string> |
| 24 |
|
| 25 |
#include "DataModel/ObjectIdentifier.h" |
| 26 |
#include "Server/Web/HtmlTag.h" |
| 27 |
#include "Server/Web/HtmlTagLabel.h" |
| 28 |
#include "Server/Web/HtmlTagSelect.h" |
| 29 |
|
| 30 |
namespace Server { namespace Web |
| 31 |
{ |
| 32 |
class HtmlTagSelectWithLabel : public HtmlTag |
| 33 |
{ |
| 34 |
public: |
| 35 |
HtmlTagSelectWithLabel() = delete; |
| 36 |
|
| 37 |
HtmlTagSelectWithLabel(const std::string& name, |
| 38 |
const Languages::TextSelector label, |
| 39 |
const std::map<std::string,DataModel::ObjectIdentifier>& options, |
| 40 |
const DataModel::ObjectIdentifier& defaultValue = DataModel::ObjectIdentifier()); |
| 41 |
|
| 42 |
template<typename T> |
| 43 |
HtmlTagSelectWithLabel(const std::string& name, |
| 44 |
const Languages::TextSelector label, |
| 45 |
const std::map<std::string,T>& options, |
| 46 |
const int defaultValue = 0) |
| 47 |
: HtmlTag("div") |
| 48 |
{ |
| 49 |
HtmlTag::AddClass("input_select_with_label"); |
| 50 |
AddChildTag(HtmlTagLabel(label, "s_" + name)); |
| 51 |
AddChildTag(HtmlTagSelect(name, options, defaultValue)); |
| 52 |
} |
| 53 |
|
| 54 |
template<typename T> |
| 55 |
HtmlTagSelectWithLabel(const std::string& name, |
| 56 |
const Languages::TextSelector label, |
| 57 |
const Languages::TextSelector hint, |
| 58 |
const std::map<std::string,T>& options, |
| 59 |
const int defaultValue = 0) |
| 60 |
: HtmlTag("div") |
| 61 |
{ |
| 62 |
HtmlTag::AddClass("input_select_with_label"); |
| 63 |
AddChildTag(HtmlTagLabel(label, hint, "s_" + name)); |
| 64 |
AddChildTag(HtmlTagSelect(name, options, defaultValue)); |
| 65 |
} |
| 66 |
|
| 67 |
template<typename T> |
| 68 |
HtmlTagSelectWithLabel(const std::string& name, |
| 69 |
const Languages::TextSelector label, |
| 70 |
const std::map<T,Languages::TextSelector>& options, |
| 71 |
const T defaultValue = 0) |
| 72 |
: HtmlTag("div") |
| 73 |
{ |
| 74 |
HtmlTag::AddClass("input_select_with_label"); |
| 75 |
AddChildTag(HtmlTagLabel(label, "s_" + name)); |
| 76 |
AddChildTag(HtmlTagSelect(name, options, defaultValue)); |
| 77 |
} |
| 78 |
|
| 79 |
template<typename T> |
| 80 |
HtmlTagSelectWithLabel(const std::string& name, |
| 81 |
const Languages::TextSelector label, |
| 82 |
const Languages::TextSelector hint, |
| 83 |
const std::map<T,Languages::TextSelector>& options, |
| 84 |
const T defaultValue = 0) |
| 85 |
: HtmlTag("div") |
| 86 |
{ |
| 87 |
HtmlTag::AddClass("input_select_with_label"); |
| 88 |
AddChildTag(HtmlTagLabel(label, hint, "s_" + name)); |
| 89 |
AddChildTag(HtmlTagSelect(name, options, defaultValue)); |
| 90 |
} |
| 91 |
|
| 92 |
template<typename T> |
| 93 |
HtmlTagSelectWithLabel(const std::string& name, |
| 94 |
const Languages::TextSelector label, |
| 95 |
const std::map<T,std::string>& options, |
| 96 |
const T defaultValue = 0) |
| 97 |
: HtmlTag("div") |
| 98 |
{ |
| 99 |
HtmlTag::AddClass("input_select_with_label"); |
| 100 |
AddChildTag(HtmlTagLabel(label, "s_" + name)); |
| 101 |
AddChildTag(HtmlTagSelect(name, options, defaultValue)); |
| 102 |
} |
| 103 |
|
| 104 |
template<typename T> |
| 105 |
HtmlTagSelectWithLabel(const std::string& name, |
| 106 |
const std::string& label, |
| 107 |
const std::map<T,std::string>& options, |
| 108 |
const T defaultValue = 0) |
| 109 |
: HtmlTag("div") |
| 110 |
{ |
| 111 |
HtmlTag::AddClass("input_select_with_label"); |
| 112 |
AddChildTag(HtmlTagLabel(label, "s_" + name)); |
| 113 |
AddChildTag(HtmlTagSelect(name, options, defaultValue)); |
| 114 |
} |
| 115 |
|
| 116 |
virtual ~HtmlTagSelectWithLabel() |
| 117 |
{ |
| 118 |
} |
| 119 |
|
| 120 |
virtual HtmlTag AddAttribute(const std::string& name, const std::string& value = "") override; |
| 121 |
|
| 122 |
virtual bool IsAttributeSet(const std::string& name) override; |
| 123 |
|
| 124 |
virtual HtmlTag AddClass(const std::string& _class) override; |
| 125 |
}; |
| 126 |
}} |
| 127 |
|