From 183851b06bd6c52f3cae5375f433da720d410447 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 11 Oct 2006 18:12:39 +0000 Subject: MediaWiki 1.7.1 wiederhergestellt --- includes/HTMLForm.php | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 includes/HTMLForm.php (limited to 'includes/HTMLForm.php') diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php new file mode 100644 index 00000000..c3d74b20 --- /dev/null +++ b/includes/HTMLForm.php @@ -0,0 +1,177 @@ +mRequest = $request; + } + + /** + * @private + * @param $name String: name of the fieldset. + * @param $content String: HTML content to put in. + * @return string HTML fieldset + */ + function fieldset( $name, $content ) { + return "
".wfMsg($this->mName.'-'.$name)."\n" . + $content . "\n
\n"; + } + + /** + * @private + * @param $varname String: name of the checkbox. + * @param $checked Boolean: set true to check the box (default False). + */ + function checkbox( $varname, $checked=false ) { + if ( $this->mRequest->wasPosted() && !is_null( $this->mRequest->getVal( $varname ) ) ) { + $checked = $this->mRequest->getCheck( $varname ); + } + return "
\n"; + } + + /** + * @private + * @param $varname String: name of the textbox. + * @param $value String: optional value (default empty) + * @param $size Integer: optional size of the textbox (default 20) + */ + function textbox( $varname, $value='', $size=20 ) { + if ( $this->mRequest->wasPosted() ) { + $value = $this->mRequest->getText( $varname, $value ); + } + $value = htmlspecialchars( $value ); + return "
\n"; + } + + /** + * @private + * @param $varname String: name of the radiobox. + * @param $fields Array: Various fields. + */ + function radiobox( $varname, $fields ) { + foreach ( $fields as $value => $checked ) { + $s .= "
\n"; + } + return $this->fieldset( $this->mName.'-'.$varname, $s ); + } + + /** + * @private + * @param $varname String: name of the textareabox. + * @param $value String: optional value (default empty) + * @param $size Integer: optional size of the textarea (default 20) + */ + function textareabox ( $varname, $value='', $size=20 ) { + if ( $this->mRequest->wasPosted() ) { + $value = $this->mRequest->getText( $varname, $value ); + } + $value = htmlspecialchars( $value ); + return '
\n"; + } + + /** + * @private + * @param $varname String: name of the arraybox. + * @param $size Integer: Optional size of the textarea (default 20) + */ + function arraybox( $varname , $size=20 ) { + $s = ''; + if ( $this->mRequest->wasPosted() ) { + $arr = $this->mRequest->getArray( $varname ); + if ( is_array( $arr ) ) { + foreach ( $_POST[$varname] as $index => $element ) { + $s .= htmlspecialchars( $element )."\n"; + } + } + } + return "