From 414079a69fc7901511bdec1593c21e2e5a52ccdb Mon Sep 17 00:00:00 2001 From: Jens Frank Date: Thu, 30 Sep 2004 21:33:34 +0000 Subject: [PATCH] Admin interface to site parameters, UI part. No way to save settings, yet. Might be a starting point for Hashar's efforts --- includes/SpecialSitesettings.php | 222 +++++++++++++++++++++++++++++++ languages/Language.php | 34 +++++ 2 files changed, 256 insertions(+) create mode 100644 includes/SpecialSitesettings.php diff --git a/includes/SpecialSitesettings.php b/includes/SpecialSitesettings.php new file mode 100644 index 0000000000..ecc97a9706 --- /dev/null +++ b/includes/SpecialSitesettings.php @@ -0,0 +1,222 @@ +execute(); +} + +class SiteSettingsForm { + var $mPosted, $mRequest, $mReset, $mSaveprefs; + + function SiteSettingsForm ( &$request ) { + $this->mPosted = $request->wasPosted(); + $this->mRequest = $request; + } + + function execute() { + if ( wfReadOnly() ) { + $wgOut->readOnlyPage(); + return; + } + if ( $this->mReset ) { + $this->resetPrefs(); + $this->mainPrefsForm( wfMsg( "prefsreset" ) ); + } else if ( $this->mSaveprefs ) { + $this->savePreferences(); + } else { + $this->resetPrefs(); + $this->mainPrefsForm( "" ); + } + } + + /* private */ function resetPrefs() { + return; + } + + /* private */ function fieldset( $name, $content ) { + return "
".wfMsg($name)."\n" . + $content . "\n
\n"; + } + + /* private */ function checkbox( $varname, $checked=false ) { + $checked = isset( $GLOBALS[$varname] ) && $GLOBALS[$varname] ; + return "
\n"; + } + + /* private */ function textbox( $varname, $value='', $size=20 ) { + $value = isset( $GLOBALS[$varname] ) ? $GLOBALS[$varname] : ''; + return "
\n"; + } + /* private */ function radiobox( $varname, $fields ) { + foreach ( $fields as $value => $checked ) { + $s .= "
\n"; + } + return $this->fieldset( 'sitesettings-'.$varname, $s ); + } + + /* private */ function arraybox( $varname , $size=20 ) { + $s = ''; + if ( isset( $GLOBALS[$varname] ) && is_array( $GLOBALS[$varname] ) ) { + foreach ( $GLOBALS[$varname] as $index=>$element ) { + $s .= $element."\n"; + } + } + return "