PTLib  Version 2.10.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
httpform.h
Go to the documentation of this file.
1 /*
2  * httpform.h
3  *
4  * Forms management using HTTP User Interface.
5  *
6  * Portable Windows Library
7  *
8  * Copyright (c) 1993-2002 Equivalence Pty. Ltd.
9  *
10  * The contents of this file are subject to the Mozilla Public License
11  * Version 1.0 (the "License"); you may not use this file except in
12  * compliance with the License. You may obtain a copy of the License at
13  * http://www.mozilla.org/MPL/
14  *
15  * Software distributed under the License is distributed on an "AS IS"
16  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17  * the License for the specific language governing rights and limitations
18  * under the License.
19  *
20  * The Original Code is Portable Windows Library.
21  *
22  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
23  *
24  * Contributor(s): ______________________________________.
25  *
26  * $Revision: 24177 $
27  * $Author: rjongbloed $
28  * $Date: 2010-04-05 06:52:04 -0500 (Mon, 05 Apr 2010) $
29  */
30 
31 #ifndef PTLIB_HTTPFORM_H
32 #define PTLIB_HTTPFORM_H
33 
34 #ifdef P_USE_PRAGMA
35 #pragma interface
36 #endif
37 
38 #if P_HTTPFORMS
39 
40 #include <ptclib/http.h>
41 #include <ptclib/html.h>
42 
43 
45 // PHTTPField
46 
50 class PHTTPField : public PObject
51 {
53  public:
54  PHTTPField(
55  const char * bname, // base name (identifier) for the field.
56  const char * title, // Title text for field (defaults to name).
57  const char * help // Help text for the field.
58  );
59  // Create a new field in a HTTP form.
60 
66  virtual Comparison Compare(
67  const PObject & obj
68  ) const;
69 
75  const PCaselessString & GetName() const { return fullName; }
76 
82  const PCaselessString & GetBaseName() const { return baseName; }
83 
86  virtual void SetName(
87  const PString & newName // New name for field
88  );
89 
95  virtual const PHTTPField * LocateName(
96  const PString & name // Full field name to locate
97  ) const;
98 
104  const PString & GetTitle() const { return title; }
105 
111  const PString & GetHelp() const { return help; }
112 
113  void SetHelp(
114  const PString & text // Help text.
115  ) { help = text; }
116  void SetHelp(
117  const PString & hotLinkURL, // URL for link to help page.
118  const PString & linkText // Help text in the link.
119  );
120  void SetHelp(
121  const PString & hotLinkURL, // URL for link to help page.
122  const PString & imageURL, // URL for image to be displayed in link.
123  const PString & imageText // Text in the link when image unavailable.
124  );
125  // Set the help text for the field.
126 
132  virtual PHTTPField * NewField() const = 0;
133 
134  virtual void ExpandFieldNames(PString & text, PINDEX start, PINDEX & finish) const;
135  // Splice expanded macro substitutions into text string
136 
139  virtual void GetHTMLTag(
140  PHTML & html // HTML to receive the fields HTML tag.
141  ) const = 0;
142 
145  virtual PString GetHTMLInput(
146  const PString & input // Source HTML text for input tag.
147  ) const;
148 
151  virtual PString GetHTMLSelect(
152  const PString & selection // Source HTML text for input tag.
153  ) const;
154 
157  virtual void GetHTMLHeading(
158  PHTML & html // HTML to receive the field info.
159  ) const;
160 
166  virtual PString GetValue(PBoolean dflt = false) const = 0;
167 
170  virtual void SetValue(
171  const PString & newValue // New value for the field.
172  ) = 0;
173 
177  virtual void LoadFromConfig(
178  PConfig & cfg // Configuration for value transfer.
179  );
180 
184  virtual void SaveToConfig(
185  PConfig & cfg // Configuration for value transfer.
186  ) const;
187 
193  virtual PBoolean Validated(
194  const PString & newVal, // Proposed new value for the field.
195  PStringStream & msg // Stream to take error HTML if value not valid.
196  ) const;
197 
198 
204  virtual void GetAllNames(PStringArray & names) const;
205 
208  virtual void SetAllValues(
209  const PStringToString & data // New value for the field.
210  );
211 
217  virtual PBoolean ValidateAll(
218  const PStringToString & data, // Proposed new value for the field.
219  PStringStream & msg // Stream to take error HTML if value not valid.
220  ) const;
221 
222 
223  PBoolean NotYetInHTML() const { return notInHTML; }
224  void SetInHTML() { notInHTML = false; }
225 
226  protected:
232 };
233 
234 
235 PARRAY(PHTTPFields, PHTTPField);
236 
238 {
240  public:
242  const char * name, // Name (identifier) for the field.
243  const char * title = NULL, // Title text for field (defaults to name).
244  const char * help = NULL, // Help text for the field.
245  bool includeHeaders = false // Make a sub-table and put headers on HTML fields.
246  );
247 
248  virtual void SetName(
249  const PString & name // New name for field
250  );
251 
252  virtual const PHTTPField * LocateName(
253  const PString & name // Full field name to locate
254  ) const;
255 
256  virtual PHTTPField * NewField() const;
257 
258  virtual void ExpandFieldNames(PString & text, PINDEX start, PINDEX & finish) const;
259 
260  virtual void GetHTMLTag(
261  PHTML & html // HTML to receive the field info.
262  ) const;
263 
264  virtual PString GetHTMLInput(
265  const PString & input // Source HTML text for input tag.
266  ) const;
267 
268  virtual void GetHTMLHeading(
269  PHTML & html // HTML to receive the field info.
270  ) const;
271 
272  virtual PString GetValue(PBoolean dflt = false) const;
273 
274  virtual void SetValue(
275  const PString & newValue // New value for the field.
276  );
277 
278  virtual void LoadFromConfig(
279  PConfig & cfg // Configuration for value transfer.
280  );
281  virtual void SaveToConfig(
282  PConfig & cfg // Configuration for value transfer.
283  ) const;
284 
285  virtual void GetAllNames(PStringArray & names) const;
286  virtual void SetAllValues(
287  const PStringToString & data // New value for the field.
288  );
289 
290  virtual PBoolean ValidateAll(
291  const PStringToString & data, // Proposed new value for the field.
292  PStringStream & msg // Stream to take error HTML if value not valid.
293  ) const;
294 
295 
303  virtual PINDEX GetSize() const;
304 
305  void Append(PHTTPField * fld);
306  PHTTPField & operator[](PINDEX idx) const { return fields[idx]; }
307  void RemoveAt(PINDEX idx) { fields.RemoveAt(idx); }
308  void RemoveAll() { fields.RemoveAll(); }
309 
310  protected:
311  PHTTPFields fields;
313 };
314 
315 
317 {
319  public:
320  PHTTPSubForm(
321  const PString & subFormName, // URL for the sub-form
322  const char * name, // Name (identifier) for the field.
323  const char * title = NULL, // Title text for field (defaults to name).
324  PINDEX primaryField = 0, // Pimary field whove value is in hot link
325  PINDEX secondaryField = P_MAX_INDEX // Seconary field next to hotlink
326  );
327 
328  PHTTPField * NewField() const;
329  void GetHTMLTag(PHTML & html) const;
330  void GetHTMLHeading(PHTML & html) const;
331 
332  protected:
334  PINDEX primary;
335  PINDEX secondary;
336 };
337 
338 
340 {
342  public:
345  PBoolean ordered,
346  PINDEX fixedSize = 0
347  );
348 
350 
351 
352  virtual PHTTPField * NewField() const;
353 
354  virtual void ExpandFieldNames(PString & text, PINDEX start, PINDEX & finish) const;
355 
356  virtual void GetHTMLTag(
357  PHTML & html // HTML to receive the field info.
358  ) const;
359 
360  virtual void LoadFromConfig(
361  PConfig & cfg // Configuration for value transfer.
362  );
363  virtual void SaveToConfig(
364  PConfig & cfg // Configuration for value transfer.
365  ) const;
366 
367 
368  virtual void SetAllValues(
369  const PStringToString & data // New value for the field.
370  );
371 
372  virtual PINDEX GetSize() const;
373  void SetSize(PINDEX newSize);
374 
376  PConfig & cfg
377  );
378 
379  void SetStrings(
380  PConfig & cfg,
381  const PStringArray & values
382  );
383 
384  protected:
385  void AddBlankField();
386  void AddArrayControlBox(PHTML & html, PINDEX fld) const;
387  void SetArrayFieldName(PINDEX idx) const;
388 
392 };
393 
394 
396 {
398  public:
400  const char * name,
401  PINDEX size,
402  const char * initVal = NULL,
403  const char * help = NULL
404  );
406  const char * name,
407  const char * title,
408  PINDEX size,
409  const char * initVal = NULL,
410  const char * help = NULL
411  );
412 
413  virtual PHTTPField * NewField() const;
414 
415  virtual void GetHTMLTag(
416  PHTML & html
417  ) const;
418 
419  virtual PString GetValue(PBoolean dflt = false) const;
420 
421  virtual void SetValue(
422  const PString & newVal
423  );
424 
425 
426  protected:
429  PINDEX size;
430 };
431 
432 
434 {
436  public:
438  const char * name,
439  PINDEX size,
440  const char * initVal = NULL,
441  const char * help = NULL
442  );
444  const char * name,
445  const char * title,
446  PINDEX size,
447  const char * initVal = NULL,
448  const char * help = NULL
449  );
450 
451  virtual PHTTPField * NewField() const;
452 
453  virtual void GetHTMLTag(
454  PHTML & html
455  ) const;
456 
457  virtual PString GetValue(PBoolean dflt = false) const;
458 
459  virtual void SetValue(
460  const PString & newVal
461  );
462 
463  static PString Decrypt(const PString & pword);
464 };
465 
466 
468 {
470  public:
472  const char * name,
473  const PTime & initVal = PTime(0),
475  );
476 
477  virtual PHTTPField * NewField() const;
478 
479  virtual void SetValue(
480  const PString & newValue
481  );
482 
483  virtual PBoolean Validated(
484  const PString & newValue,
485  PStringStream & msg
486  ) const;
487 
488  protected:
490 };
491 
492 
494 {
496  public:
498  const char * name,
499  int low, int high,
500  int initVal = 0,
501  const char * units = NULL,
502  const char * help = NULL
503  );
505  const char * name,
506  const char * title,
507  int low, int high,
508  int initVal = 0,
509  const char * units = NULL,
510  const char * help = NULL
511  );
512 
513  virtual PHTTPField * NewField() const;
514 
515  virtual void GetHTMLTag(
516  PHTML & html
517  ) const;
518 
519  virtual PString GetValue(PBoolean dflt = false) const;
520 
521  virtual void SetValue(
522  const PString & newVal
523  );
524 
525  virtual void LoadFromConfig(
526  PConfig & cfg
527  );
528  virtual void SaveToConfig(
529  PConfig & cfg
530  ) const;
531 
532  virtual PBoolean Validated(
533  const PString & newVal,
534  PStringStream & msg
535  ) const;
536 
537 
538  protected:
539  int low, high, value;
542 };
543 
544 
546 {
548  public:
550  const char * name,
551  PBoolean initVal = false,
552  const char * help = NULL
553  );
555  const char * name,
556  const char * title,
557  PBoolean initVal = false,
558  const char * help = NULL
559  );
560 
561  virtual PHTTPField * NewField() const;
562 
563  virtual void GetHTMLTag(
564  PHTML & html
565  ) const;
566 
567  virtual PString GetHTMLInput(
568  const PString & input
569  ) const;
570 
571  virtual PString GetValue(PBoolean dflt = false) const;
572 
573  virtual void SetValue(
574  const PString & newVal
575  );
576 
577  virtual void LoadFromConfig(
578  PConfig & cfg
579  );
580  virtual void SaveToConfig(
581  PConfig & cfg
582  ) const;
583 
584 
585  protected:
587 };
588 
589 
591 {
593  public:
595  const char * name,
596  const PStringArray & valueArray,
597  PINDEX initVal = 0,
598  const char * help = NULL
599  );
601  const char * name,
602  const PStringArray & valueArray,
603  const PStringArray & titleArray,
604  PINDEX initVal = 0,
605  const char * help = NULL
606  );
608  const char * name,
609  PINDEX count,
610  const char * const * valueStrings,
611  PINDEX initVal = 0,
612  const char * help = NULL
613  );
615  const char * name,
616  PINDEX count,
617  const char * const * valueStrings,
618  const char * const * titleStrings,
619  PINDEX initVal = 0,
620  const char * help = NULL
621  );
623  const char * name,
624  const char * groupTitle,
625  const PStringArray & valueArray,
626  PINDEX initVal = 0,
627  const char * help = NULL
628  );
630  const char * name,
631  const char * groupTitle,
632  const PStringArray & valueArray,
633  const PStringArray & titleArray,
634  PINDEX initVal = 0,
635  const char * help = NULL
636  );
638  const char * name,
639  const char * groupTitle,
640  PINDEX count,
641  const char * const * valueStrings,
642  PINDEX initVal = 0,
643  const char * help = NULL
644  );
646  const char * name,
647  const char * groupTitle,
648  PINDEX count,
649  const char * const * valueStrings,
650  const char * const * titleStrings,
651  PINDEX initVal = 0,
652  const char * help = NULL
653  );
654 
655  virtual PHTTPField * NewField() const;
656 
657  virtual void GetHTMLTag(
658  PHTML & html
659  ) const;
660 
661  virtual PString GetHTMLInput(
662  const PString & input
663  ) const;
664 
665  virtual PString GetValue(PBoolean dflt = false) const;
666 
667  virtual void SetValue(
668  const PString & newVal
669  );
670 
671 
672  protected:
677 };
678 
679 
681 {
683  public:
685  const char * name,
686  const PStringArray & valueArray,
687  PINDEX initVal = 0,
688  const char * help = NULL
689  );
691  const char * name,
692  PINDEX count,
693  const char * const * valueStrings,
694  PINDEX initVal = 0,
695  const char * help = NULL
696  );
698  const char * name,
699  const char * title,
700  const PStringArray & valueArray,
701  PINDEX initVal = 0,
702  const char * help = NULL
703  );
705  const char * name,
706  const char * title,
707  PINDEX count,
708  const char * const * valueStrings,
709  PINDEX initVal = 0,
710  const char * help = NULL
711  );
712 
713  virtual PHTTPField * NewField() const;
714 
715  virtual void GetHTMLTag(
716  PHTML & html
717  ) const;
718 
719  virtual PString GetValue(PBoolean dflt = false) const;
720 
721  virtual void SetValue(
722  const PString & newVal
723  );
724 
725 
727 
728 
729  protected:
731  PINDEX initialValue;
732 };
733 
734 
736 // PHTTPForm
737 
738 class PHTTPForm : public PHTTPString
739 {
741  public:
742  PHTTPForm(
743  const PURL & url
744  );
745  PHTTPForm(
746  const PURL & url,
747  const PHTTPAuthority & auth
748  );
749  PHTTPForm(
750  const PURL & url,
751  const PString & html
752  );
753  PHTTPForm(
754  const PURL & url,
755  const PString & html,
756  const PHTTPAuthority & auth
757  );
758 
759 
760  virtual void OnLoadedText(
761  PHTTPRequest & request,
762  PString & text
763  );
764  virtual PBoolean Post(
765  PHTTPRequest & request,
766  const PStringToString & data,
767  PHTML & replyMessage
768  );
769 
770 
771  PHTTPField * Add(
772  PHTTPField * fld
773  );
776 
781  };
782 
783  void BuildHTML(
784  const char * heading
785  );
786  void BuildHTML(
787  const PString & heading
788  );
789  void BuildHTML(
790  PHTML & html,
791  BuildOptions option = CompleteHTML
792  );
793 
794 
795  protected:
798 };
799 
800 
802 // PHTTPConfig
803 
804 class PHTTPConfig : public PHTTPForm
805 {
807  public:
808  PHTTPConfig(
809  const PURL & url,
810  const PString & section
811  );
812  PHTTPConfig(
813  const PURL & url,
814  const PString & section,
815  const PHTTPAuthority & auth
816  );
817  PHTTPConfig(
818  const PURL & url,
819  const PString & section,
820  const PString & html
821  );
822  PHTTPConfig(
823  const PURL & url,
824  const PString & section,
825  const PString & html,
826  const PHTTPAuthority & auth
827  );
828 
829  virtual void OnLoadedText(
830  PHTTPRequest & request,
831  PString & text
832  );
833  virtual PBoolean Post(
834  PHTTPRequest & request,
835  const PStringToString & data,
836  PHTML & replyMessage
837  );
838 
839 
842  void LoadFromConfig();
843 
849  const PString & GetConfigSection() const { return section; }
850 
852  const PString & sect
853  ) { section = sect; }
854  // Set the configuration file section.
855 
861  PHTTPField * sectionFld,
862  const char * prefix = NULL,
863  const char * suffix = NULL
864  );
865 
869  void AddNewKeyFields(
870  PHTTPField * keyFld,
871  PHTTPField * valFld
872  );
873 
874 
875  protected:
882 
883  private:
884  void Construct();
885 };
886 
887 
889 // PHTTPConfigSectionList
890 
892 {
894  public:
896  const PURL & url,
897  const PHTTPAuthority & auth,
898  const PString & sectionPrefix,
900  const PURL & editSection,
901  const PURL & newSection,
902  const PString & newSectionTitle,
903  PHTML & heading
904  );
905 
906  virtual void OnLoadedText(
907  PHTTPRequest & request,
908  PString & text
909  );
910  virtual PBoolean Post(
911  PHTTPRequest & request,
912  const PStringToString & data,
913  PHTML & replyMessage
914  );
915 
916  protected:
922 };
923 
924 
925 #endif // P_HTTPFORMS
926 
927 #endif // PTLIB_HTTPFORM_H
928 
929 
930 // End Of File ///////////////////////////////////////////////////////////////
virtual void GetAllNames(PStringArray &names) const
Retrieve all the names in the field and subfields.
Definition: httpform.h:493
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.
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:308
PHTTPField(const char *bname, const char *title, const char *help)
const PString & GetConfigSection() const
Get the configuration file section that the page will alter.
Definition: httpform.h:849
Definition: httpform.h:237
PHTTPSelectField(const char *name, const PStringArray &valueArray, PINDEX initVal=0, const char *help=NULL)
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.
PCaselessString fullName
Definition: httpform.h:228
int value
Definition: httpform.h:539
PString editSectionLink
Definition: httpform.h:921
virtual PString GetValue(PBoolean dflt=false) const
Get the string value of the field.
PINDEX secondary
Definition: httpform.h:335
PHTTPConfigSectionList(const PURL &url, const PHTTPAuthority &auth, const PString &sectionPrefix, 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 &sect)
Definition: httpform.h:851
PBoolean canAddElements
Definition: httpform.h:391
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:1049
PINDEX size
Definition: httpform.h:429
PHTTPBooleanField(const char *name, PBoolean initVal=false, const char *help=NULL)
virtual void ExpandFieldNames(PString &text, PINDEX start, PINDEX &finish) const
PStringArray titles
Definition: httpform.h:674
PARRAY(PHTTPFields, PHTTPField)
PHTTPFieldArray(PHTTPField *baseField, PBoolean ordered, PINDEX fixedSize=0)
PHTTPField * NewField() const
Create a new field of the same class as the current field.
This abstract class describes the authorisation mechanism for a Universal Resource Locator...
Definition: http.h:1002
This class defines an absolute time and date.
Definition: ptime.h:53
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:67
PINDEX primary
Definition: httpform.h:334
This class is a standard C++ stream class descendent for reading or writing streamed data to or from ...
Definition: pstring.h:1878
virtual void SaveToConfig(PConfig &cfg) const
Set the value of the sub-field into the PConfig.
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:2784
virtual PString GetHTMLSelect(const PString &selection) const
Convert the field input to HTML for inclusion into the HTTP page.
Comparison
Result of the comparison operation performed by the Compare() function.
Definition: object.h:1184
PString sectionPrefix
Definition: httpform.h:917
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
BuildOptions
Definition: httpform.h:777
This class is a variation of a string that ignores case.
Definition: pstring.h:1708
Definition: httpform.h:779
void GetHTMLHeading(PHTML &html) const
Convert the field to HTML for inclusion into the HTTP page.
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 Comparison Compare(const PObject &obj) const
Compare the fields using the field names.
Definition: httpform.h:433
Definition: httpform.h:467
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
PString initialValue
Definition: httpform.h:428
void BuildHTML(const char *heading)
Definition: httpform.h:780
This is an array collection class of PString objects.
Definition: pstring.h:2024
Definition: httpform.h:395
virtual void SaveToConfig(PConfig &cfg) const
Set the value of the sub-field into the PConfig.
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:1525
Definition: httpform.h:590
PBoolean orderedArray
Definition: httpform.h:390
void SetHelp(const PString &text)
Definition: httpform.h:113
virtual void LoadFromConfig(PConfig &cfg)
Get the value of the PConfig to the sub-field.
PString additionalValueName
Definition: httpform.h:918
virtual PString GetValue(PBoolean dflt=false) const =0
Get the string value of the field.
PHTTPField * sectionField
Definition: httpform.h:879
PTime::TimeFormat m_format
Definition: httpform.h:489
PBoolean notInHTML
Definition: httpform.h:231
PHTTPSubForm(const PString &subFormName, const char *name, const char *title=NULL, PINDEX primaryField=0, PINDEX secondaryField=P_MAX_INDEX)
virtual PHTTPField * NewField() const =0
Create a new field of the same class as the current field.
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:399
PHTTPField * keyField
Definition: httpform.h:880
virtual PString GetHTMLInput(const PString &input) 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.
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.
BOOL PBoolean
Definition: object.h:102
PString section
Definition: httpform.h:876
virtual void SetValue(const PString &newVal)
Set the value of the field.
PString subFormName
Definition: httpform.h:333
PString help
Definition: httpform.h:230
PString initialValue
Definition: httpform.h:676
PString value
Definition: httpform.h:730
virtual void SetAllValues(const PStringToString &data)
Set the value of the field in a list of fields.
int high
Definition: httpform.h:539
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
virtual void 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.
PBoolean initialValue
Definition: httpform.h:586
PINDEX initialValue
Definition: httpform.h:731
void SetStrings(PConfig &cfg, const PStringArray &values)
PStringArray GetStrings(PConfig &cfg)
Definition: httpform.h:545
virtual void SetValue(const PString &newVal)
Set the value of the field.
Definition: httpform.h:339
PCaselessString baseName
Definition: httpform.h:227
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
void Append(PHTTPField *fld)
virtual void SetValue(const PString &newVal)
Set the value of the field.
PString sectionSuffix
Definition: httpform.h:878
PStringArray values
Definition: httpform.h:726
PHTTPConfig(const PURL &url, const PString &section)
Date with numeric month and no time.
Definition: ptime.h:421
const PCaselessString & GetName() const
Get the identifier name of the field.
Definition: httpform.h:75
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.
Definition: httpform.h:316
PHTTPField * valField
Definition: httpform.h:881
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
virtual void GetHTMLHeading(PHTML &html) const
Convert the field to HTML for inclusion into the HTTP page.
PStringArray values
Definition: httpform.h:673
virtual PBoolean Validated(const PString &newVal, PStringStream &msg) const
Validate the new field value before SetValue() is called.
const PCaselessString & GetBaseName() const
Get the identifier name of the field.
Definition: httpform.h:82
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.
virtual void SetName(const PString &newName)
Set the name for the field.
PString newSectionLink
Definition: httpform.h:919
This is a set collection class of PString objects.
Definition: pstring.h:2391
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.
virtual void SetName(const PString &name)
Set the name for the field.
void RemoveAt(PINDEX idx)
Definition: httpform.h:307
virtual void SetValue(const PString &newValue)
Set the value of the field.
PString newSectionTitle
Definition: httpform.h:920
virtual void LoadFromConfig(PConfig &cfg)
Get the value of the PConfig to the sub-field.
virtual PBoolean ValidateAll(const PStringToString &data, PStringStream &msg) const
Validate the new field value in a list before SetValue() is called.
virtual PHTTPField * NewField() const
Create a new field of the same class as the current field.
PString value
Definition: httpform.h:427
virtual PString GetHTMLInput(const PString &input) const
Convert the field input to HTML for inclusion into the HTTP page.
Definition: httpform.h:891
Definition: httpform.h:778
void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
PString title
Definition: httpform.h:229
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:312
const PString & GetHelp() const
Get the title of the field.
Definition: httpform.h:111
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:223
This class describes a HyperText markup Language string as used by the World Wide Web and the PURL an...
Definition: html.h:49
PHTTPCompositeField(const char *name, const char *title=NULL, const char *help=NULL, bool includeHeaders=false)
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.
PBoolean value
Definition: httpform.h:586
PHTTPFields fields
Definition: httpform.h:311
int low
Definition: httpform.h:539
virtual void LoadFromConfig(PConfig &cfg)
Get the value of the PConfig to the sub-field.
virtual void SetValue(const PString &newValue)
Set the value of the field.
PHTTPForm(const PURL &url)
virtual PBoolean Validated(const PString &newValue, PStringStream &msg) const
Validate the new field value before SetValue() is called.
virtual void GetHTMLHeading(PHTML &html) const
Convert the field to HTML for inclusion into the HTTP page.
PHTTPField * Add(PHTTPField *fld)
This class is the abstract base class for fields in a PHTTPForm resource type.
Definition: httpform.h:50
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.
PStringSet fieldNames
Definition: httpform.h:797
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:104
Definition: httpform.h:680
void RemoveAllFields()
Definition: httpform.h:774
PHTTPStringField(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.
virtual PBoolean Post(PHTTPRequest &request, const PStringToString &data, PHTML &replyMessage)
Get a block of data (eg HTML) that the resource contains.
PString sectionPrefix
Definition: httpform.h:877
void SetSize(PINDEX newSize)
void AddBlankField()
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.
PHTTPField * baseField
Definition: httpform.h:389
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...
PString value
Definition: httpform.h:675
PHTTPIntegerField(const char *name, int low, int high, int initVal=0, const char *units=NULL, const char *help=NULL)
Definition: httpform.h:738
int initialValue
Definition: httpform.h:540
virtual void GetHTMLTag(PHTML &html) const
Convert the field to HTML form tag for inclusion into the HTTP page.
PString units
Definition: httpform.h:541
virtual void GetHTMLTag(PHTML &html) const =0
Convert the field to HTML form tag for inclusion into the HTTP page.
This object describes a HyperText Transport Protocol request.
Definition: http.h:968
Ultimate parent class for all objects in the class library.
Definition: object.h:1118
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:54
PHTTPField & operator[](PINDEX idx) const
Definition: httpform.h:306
virtual void LoadFromConfig(PConfig &cfg)
Get the value of the PConfig to the sub-field.
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.
void SetArrayFieldName(PINDEX idx) const
void SetInHTML()
Definition: httpform.h:224
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)
PHTTPCompositeField fields
Definition: httpform.h:796
virtual PString GetValue(PBoolean dflt=false) const
Get the string value of the field.
Definition: httpform.h:804