27 #ifndef PTLIB_HTTPFORM_H
28 #define PTLIB_HTTPFORM_H
272 const char * title = NULL,
273 const char * help = NULL,
274 bool includeHeaders =
false
339 virtual PINDEX
GetSize()
const;
359 const char * title = NULL,
360 PINDEX primaryField = 0,
415 virtual PINDEX
GetSize()
const;
447 const char * initVal = NULL,
448 const char * help = NULL,
456 const char * initVal = NULL,
457 const char * help = NULL,
491 const char * initVal = NULL,
492 const char * help = NULL
498 const char * initVal = NULL,
499 const char * help = NULL
553 const char * units = NULL,
554 const char * help = NULL
561 const char * units = NULL,
562 const char * help = NULL
611 const char * help = NULL
617 const char * help = NULL
664 const char * help = NULL
671 const char * help = NULL
676 const char *
const * valueStrings,
678 const char * help = NULL
683 const char *
const * valueStrings,
684 const char *
const * titleStrings,
686 const char * help = NULL
690 const char * groupTitle,
693 const char * help = NULL
697 const char * groupTitle,
701 const char * help = NULL
705 const char * groupTitle,
707 const char *
const * valueStrings,
709 const char * help = NULL
713 const char * groupTitle,
715 const char *
const * valueStrings,
716 const char *
const * titleStrings,
718 const char * help = NULL
754 const char * help = NULL,
755 bool enumeration =
false
760 const char *
const * valueStrings,
762 const char * help = NULL,
763 bool enumeration =
false
770 const char * help = NULL,
771 bool enumeration =
false
777 const char *
const * valueStrings,
779 const char * help = NULL,
780 bool enumeration =
false
796 void Construct(PINDEX initVal,
bool enumeration);
805 template <
typename Enumeration, Enumeration InitVal = (Enumeration)0>
813 Enumeration initVal = InitVal,
814 const char * help = NULL
819 const char *
const * valueStrings,
820 Enumeration initVal = InitVal,
821 const char * help = NULL
827 Enumeration initVal = InitVal,
828 const char * help = NULL
834 const char *
const * valueStrings,
835 Enumeration initVal = InitVal,
836 const char * help = NULL
837 ) :
PHTTPSelectField(name, title, count, valueStrings, initVal, help, true) { }
985 const char * prefix = NULL,
986 const char * suffix = NULL
1002 bool defaultValue =
false,
1003 const char * help = NULL
1012 int defaultValue = 0,
1013 const char * units = NULL,
1014 const char * help = NULL
1023 const char * defaultValue = NULL,
1024 const char * help = NULL,
1037 const char * help = NULL,
1048 const char * defaultValue = NULL,
1049 const char * help = NULL,
1050 bool enumeration =
false
1061 const char * help = NULL,
1062 bool enumeration =
false
1088 const PString & sectionPrefix,
1089 const PString & additionalValueName,
1090 const PURL & editSection,
1091 const PURL & newSection,
1092 const PString & newSectionTitle,
1103 PHTML & replyMessage
1115 #endif // P_HTTPFORMS
1117 #endif // PTLIB_HTTPFORM_H
PString m_sectionSuffix
Definition: httpform.h:1068
virtual void GetAllNames(PStringArray &names) const
Retrieve all the names in the field and subfields.
Definition: httpform.h:545
PHTTPEnumField(const char *name, const char *title, const PStringArray &valueArray, Enumeration initVal=InitVal, const char *help=NULL)
Definition: httpform.h:823
virtual PINDEX GetSize() const
Get the number of sub-fields in the composite field.
virtual void SaveToConfig(PConfig &cfg) const
Set the value of the sub-field into the PConfig.
PString m_units
Definition: httpform.h:600
virtual PBoolean Post(PHTTPRequest &request, const PStringToString &data, PHTML &replyMessage)
Get a block of data (eg HTML) that the resource contains.
void RemoveAll()
Definition: httpform.h:344
PHTTPField(const char *bname, const char *title, const char *help)
virtual void SaveToJSON(PJSON::Base &json) const
Set the value of the sub-field into the JSON.
virtual void LoadFromJSON(const PJSON::Base &json)
Get the value of the JSON to the sub-field.
const PString & GetConfigSection() const
Get the configuration file section that the page will alter.
Definition: httpform.h:972
Definition: httpform.h:266
void AddArrayControlBox(PHTML &html, PINDEX fld) const
PHTTPPasswordField(const char *name, PINDEX size, const char *initVal=NULL, const char *help=NULL)
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
PHTTPField * m_sectionField
Definition: httpform.h:1069
virtual PString GetValue(PBoolean dflt=false) const
Get the string value of the field.
bool m_enumeration
Definition: httpform.h:799
PHTTPConfigSectionList(const PURL &url, const PHTTPAuthority &auth, const PString §ionPrefix, const PString &additionalValueName, const PURL &editSection, const PURL &newSection, const PString &newSectionTitle, PHTML &heading)
void AddNewKeyFields(PHTTPField *keyFld, PHTTPField *valFld)
Add fields to the HTTP form for adding a new key to the config file section.
void SetConfigSection(const PString §)
Definition: httpform.h:974
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:2164
PHTTPBooleanField(const char *name, PBoolean initVal=false, const char *help=NULL)
virtual void ExpandFieldNames(PString &text, PINDEX start, PINDEX &finish) const
PHTTPFields m_fields
Definition: httpform.h:347
PHTTPFieldArray(PHTTPField *baseField, PBoolean ordered, PINDEX fixedSize=0)
PHTTPEnumField(const char *name, const PStringArray &valueArray, Enumeration initVal=InitVal, const char *help=NULL)
Definition: httpform.h:810
This abstract class describes the authorisation mechanism for a Universal Resource Locator...
Definition: http.h:1452
This class defines an absolute time and date.
Definition: ptime.h:49
PString m_sectionPrefix
Definition: httpform.h:1067
Definition: httpform.h:251
int m_low
Definition: httpform.h:598
PHTTPDateField(const char *name, const PTime &initVal=PTime(0), PTime::TimeFormat fmt=PTime::ShortDate)
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
virtual PBoolean Post(PHTTPRequest &request, const PStringToString &data, PHTML &replyMessage)
Get a block of data (eg HTML) that the resource contains.
A class representing a configuration for the application.
Definition: config.h:62
PString AddSelectField(const char *name, const PStringArray &valueArray, const char *defaultValue=NULL, const char *help=NULL, bool enumeration=false)
Add a string field.
This class is a standard C++ stream class descendent for reading or writing streamed data to or from ...
Definition: pstring.h:2188
PHTTPStringField(const char *name, PINDEX maxLength, const char *initVal=NULL, const char *help=NULL, int rows=0, int columns=0)
virtual void SaveToConfig(PConfig &cfg) const
Set the value of the sub-field into the PConfig.
PString m_editSectionLink
Definition: httpform.h:1111
virtual void ExpandFieldNames(PString &text, PINDEX start, PINDEX &finish) const
This is a dictionary collection class of PString objects, keyed by another string.
Definition: pstring.h:3151
PHTTPField * m_baseField
Definition: httpform.h:434
PStringArray m_values
Definition: httpform.h:739
virtual PString GetHTMLSelect(const PString &selection) const
Convert the field input to HTML for inclusion into the HTTP page.
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
PCaselessString m_baseName
Definition: httpform.h:240
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:2251
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
int AddIntegerField(const char *name, int low, int high, int defaultValue=0, const char *units=NULL, const char *help=NULL)
Add an integer field.
This class is a variation of a string that ignores case.
Definition: pstring.h:2012
PString m_section
Definition: httpform.h:1066
virtual Comparison Compare(const PObject &obj) const
Compare the fields using the field names.
Definition: httpform.h:484
PString m_help
Definition: httpform.h:243
Definition: httpform.h:519
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
virtual bool LoadFromConfig(PConfig &cfg)
Get the value of the PConfig to the sub-field.
This is an array collection class of PString objects.
Definition: pstring.h:2365
void Construct(PINDEX initVal, bool enumeration)
Definition: httpform.h:440
virtual void SaveToConfig(PConfig &cfg) const
Set the value of the sub-field into the PConfig.
PString m_additionalValueName
Definition: httpform.h:1108
virtual PINDEX GetSize() const
Get the number of sub-fields in the composite field.
This object describes a HyperText Transport Protocol resource which is a string kept in memory...
Definition: http.h:2009
Definition: httpform.h:656
virtual void SaveToJSON(PJSON::Base &json) const
Set the value of the sub-field into the JSON.
void SetHelp(const PString &text)
Definition: httpform.h:110
void SaveToJSON(PJSON &json)
Set the value of the pages fields into the JSON.
virtual PString GetValue(PBoolean dflt=false) const =0
Get the string value of the field.
PTime::TimeFormat m_format
Definition: httpform.h:541
int m_rows
Definition: httpform.h:479
virtual PHTTPField * NewField() const =0
Create a new field of the same class as the current field.
PString m_value
Definition: httpform.h:801
virtual void RemoveAll()
Remove all of the elements in the collection.
TimeFormat
Standard time formats for string representations of a time and date.
Definition: ptime.h:433
virtual PString GetHTMLInput(const PString &input) const
Convert the field input to HTML for inclusion into the HTTP page.
virtual void LoadFromJSON(const PJSON::Base &json)
Get the value of the JSON to the sub-field.
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
virtual PString GetValue(PBoolean dflt=false) const
Get the string value of the field.
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
int m_columns
Definition: httpform.h:480
virtual void LoadFromJSON(const PJSON::Base &json)
Get the value of the JSON to the sub-field.
virtual void SetValue(const PString &newVal)
Set the value of the field.
virtual bool LoadFromConfig(PConfig &cfg)
Get the value of the PConfig to the sub-field.
virtual void SetAllValues(const PStringToString &data)
Set the value of the field in a list of fields.
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
virtual void SetValue(const PString &newVal)
Set the value of the field.
bool AddBooleanField(const char *name, bool defaultValue=false, const char *help=NULL)
Add a boolean field.
int m_high
Definition: httpform.h:598
void LoadFromJSON(const PJSON &json)
Set the value of the JSON to the pages fields.
void SetStrings(PConfig &cfg, const PStringArray &values)
PString m_title
Definition: httpform.h:242
Definition: httpform.h:604
bool m_initialValue
Definition: httpform.h:652
virtual void SetValue(const PString &newVal)
Set the value of the field.
Definition: httpform.h:375
PString m_sectionPrefix
Definition: httpform.h:1107
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
void Append(PHTTPField *fld)
virtual bool LoadFromConfig(PConfig &cfg)
Get the value of the PConfig to the sub-field.
virtual void SetValue(const PString &newVal)
Set the value of the field.
PHTTPSelectField(const char *name, const PStringArray &valueArray, PINDEX initVal=0, const char *help=NULL, bool enumeration=false)
PString m_initialValue
Definition: httpform.h:742
PHTTPConfig(const PURL &url, const PString §ion)
Date with numeric month and no time.
Definition: ptime.h:444
const PCaselessString & GetName() const
Get the identifier name of the field.
Definition: httpform.h:72
virtual void SetValue(const PString &newValue)=0
Set the value of the field.
virtual PString GetValue(PBoolean dflt=false) const
Get the string value of the field.
bool PBoolean
Definition: object.h:174
PINDEX m_maxLength
Definition: httpform.h:478
PStringArray GetStrings(PConfig &cfg, const PStringArray &defaultValues)
PString m_newSectionLink
Definition: httpform.h:1109
#define PARRAY(cls, T)
Declare an array to a specific type of object.
Definition: array.h:985
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
#define P_MAX_INDEX
Definition: object.h:80
virtual void GetHTMLHeading(PHTML &html) const
Convert the field to HTML for inclusion into the HTTP page.
virtual PBoolean Validated(const PString &newVal, PStringStream &msg) const
Validate the new field value before SetValue() is called.
int m_value
Definition: httpform.h:598
const PCaselessString & GetBaseName() const
Get the identifier name of the field.
Definition: httpform.h:79
virtual void SaveToJSON(PJSON::Base &json) const
Set the value of the sub-field into the JSON.
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
The character string class.
Definition: pstring.h:108
virtual void SaveToConfig(PConfig &cfg) const
Set the value of the sub-field into the PConfig.
bool m_notInHTML
Definition: httpform.h:244
virtual void SetName(const PString &newName)
Set the name for the field.
PHTTPField * m_valField
Definition: httpform.h:1071
This is a set collection class of PString objects.
Definition: pstring.h:2821
virtual PBoolean ValidateAll(const PStringToString &data, PStringStream &msg) const
Validate the new field value in a list before SetValue() is called.
virtual PBoolean Validated(const PString &newVal, PStringStream &msg) const
Validate the new field value before SetValue() is called.
PStringArray AddSelectArrayField(const char *name, bool sorted, const PStringArray &defaultValues, const PStringArray &possibleValues, const char *help=NULL, bool enumeration=false)
Add a string array field.
virtual void SetName(const PString &name)
Set the name for the field.
virtual void SaveToJSON(PJSON::Base &json) const
Set the value of the sub-field into the JSON.
void RemoveAt(PINDEX idx)
Definition: httpform.h:343
virtual void SetValue(const PString &newValue)
Set the value of the field.
virtual PBoolean ValidateAll(const PStringToString &data, PStringStream &msg) const
Validate the new field value in a list before SetValue() is called.
PINDEX m_initialValue
Definition: httpform.h:800
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
virtual void SaveToConfig(PConfig &cfg) const
Set the value of the sub-field into the PConfig.
virtual PString GetHTMLInput(const PString &input) const
Convert the field input to HTML for inclusion into the HTTP page.
Definition: httpform.h:1081
PString m_newSectionTitle
Definition: httpform.h:1110
PHTTPField * AddSectionField(PHTTPField *sectionFld, const char *prefix=NULL, const char *suffix=NULL)
Add a field that will determine the name opf the secontion into which the other fields are to be adde...
static PString Decrypt(const PString &pword)
virtual void SetValue(const PString &newVal)
Set the value of the field.
bool m_includeHeaders
Definition: httpform.h:348
PHTTPEnumField(const char *name, const char *title, PINDEX count, const char *const *valueStrings, Enumeration initVal=InitVal, const char *help=NULL)
Definition: httpform.h:830
const PString & GetHelp() const
Get the title of the field.
Definition: httpform.h:108
PHTTPEnumField(const char *name, PINDEX count, const char *const *valueStrings, Enumeration initVal=InitVal, const char *help=NULL)
Definition: httpform.h:816
virtual PString GetHTMLInput(const PString &input) const
Convert the field input to HTML for inclusion into the HTTP page.
virtual const PHTTPField * LocateName(const PString &name) const
Locate the field naem, recusing down for composite fields.
virtual PString GetHTMLInput(const PString &input) const
Convert the field input to HTML for inclusion into the HTTP page.
virtual PString GetValue(PBoolean dflt=false) const
Get the string value of the field.
PBoolean NotYetInHTML() const
Definition: httpform.h:236
This class describes a HyperText markup Language string as used by the World Wide Web and the PURL an...
Definition: html.h:45
PHTTPCompositeField(const char *name, const char *title=NULL, const char *help=NULL, bool includeHeaders=false)
static PString Encrypt(const PString &clear)
virtual void SetValue(const PString &newVal)
Set the value of the field.
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
virtual void SetValue(const PString &newValue)
Set the value of the field.
virtual PBoolean Validated(const PString &newValue, PStringStream &msg) const
Validate the new field value before SetValue() is called.
PString m_value
Definition: httpform.h:476
virtual void GetHTMLHeading(PHTML &html) const
Convert the field to HTML for inclusion into the HTTP page.
This class is the abstract base class for fields in a PHTTPForm resource type.
Definition: httpform.h:47
virtual void OnLoadedText(PHTTPRequest &request, PString &text)
This is called after the text has been loaded and may be used to customise or otherwise mangle a load...
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
void LoadFromConfig()
Load all of the values for the resource from the configuration.
const PString & GetTitle() const
Get the title of the field.
Definition: httpform.h:101
PStringArray m_values
Definition: httpform.h:798
Definition: httpform.h:746
PString m_initialValue
Definition: httpform.h:477
virtual void LoadFromJSON(const PJSON::Base &json)
Get the value of the JSON to the sub-field.
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
PStringArray m_titles
Definition: httpform.h:740
virtual void SaveToJSON(PJSON::Base &json) const
Set the value of the sub-field into the JSON.
void SetSize(PINDEX newSize)
PString GetFieldNameForJSON() const
virtual PString GetValue(PBoolean dflt=false) const
Get the string value of the field.
PStringArray AddStringArrayField(const char *name, bool sorted, PINDEX maxLength, const PStringArray &defaultValues, const char *help=NULL, int rows=0, int columns=0)
Add a string array field.
virtual PString GetValue(PBoolean dflt=false) const
Get the string value of the field.
virtual void SetAllValues(const PStringToString &data)
Set the value of the field in a list of fields.
PString AddStringField(const char *name, PINDEX maxLength, const char *defaultValue=NULL, const char *help=NULL, int rows=0, int columns=0)
Add a string field.
virtual void OnLoadedText(PHTTPRequest &request, PString &text)
This is called after the text has been loaded and may be used to customise or otherwise mangle a load...
PHTTPField * m_keyField
Definition: httpform.h:1070
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
Definition: httpform.h:839
PHTTPIntegerField(const char *name, int low, int high, int initVal=0, const char *units=NULL, const char *help=NULL)
virtual void SetValue(const PString &newValue)
Set the value of the field.
virtual bool LoadFromConfig(PConfig &cfg)
Get the value of the PConfig to the sub-field.
virtual void LoadFromJSON(const PJSON::Base &json)
Get the value of the JSON to the sub-field.
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
virtual void GetHTMLTag(PHTML &html) const =0
Convert the field to HTML form tag for inclusion into the HTTP page.
PCaselessString m_fullName
Definition: httpform.h:241
This object describes a HyperText Transport Protocol request.
Definition: http.h:1417
Ultimate parent class for all objects in the class library.
Definition: object.h:2204
virtual void GetAllNames(PStringArray &names) const
Retrieve all the names in the field and subfields.
virtual void SetAllValues(const PStringToString &data)
Set the value of the field in a list of fields.
This class describes a Universal Resource Locator.
Definition: url.h:56
bool m_value
Definition: httpform.h:652
Definition: httpform.h:806
PHTTPField & operator[](PINDEX idx) const
Definition: httpform.h:342
virtual void SaveToConfig(PConfig &cfg) const
Set the value of the sub-field into the PConfig.
virtual PString GetValue(PBoolean dflt=false) const
Get the string value of the field.
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
PString m_value
Definition: httpform.h:741
void SetArrayFieldName(PINDEX idx) const
void SetInHTML()
Definition: httpform.h:237
bool m_orderedArray
Definition: httpform.h:435
virtual const PHTTPField * LocateName(const PString &name) const
Locate the field naem, recusing down for composite fields.
virtual void ExpandFieldNames(PString &text, PINDEX start, PINDEX &finish) const
PHTTPRadioField(const char *name, const PStringArray &valueArray, PINDEX initVal=0, const char *help=NULL)
virtual void SaveToJSON(PJSON::Base &json) const
Set the value of the sub-field into the JSON.
virtual bool LoadFromConfig(PConfig &cfg)
Get the value of the PConfig to the sub-field.
virtual PString GetValue(PBoolean dflt=false) const
Get the string value of the field.
Definition: httpform.h:915
int m_initialValue
Definition: httpform.h:599
bool m_canAddElements
Definition: httpform.h:436