-function ucDaysLink( $lim, $d )
-{
- global $wgUser, $wgLang, $wgRequest;
-
- $target = $wgRequest->getText( 'target' );
- $sk = $wgUser->getSkin();
- $s = $sk->makeKnownLink( $wgLang->specialPage( "Contributions" ),
- "{$d}", "target={$target}&days={$d}&limit={$lim}" );
- return $s;
+/**
+ * Generates a form used to restrict display of contributions
+ * to a specific namespace
+ *
+ * @return none
+ * @param string $target target user to show contributions for
+ * @param string $hideminor whether minor contributions are hidden
+ * @param string $namespace currently selected namespace, NULL for show all
+ * @param bool $invert inverts the namespace selection on true (default null)
+ */
+function namespaceForm ( $target, $hideminor, $namespace, $invert ) {
+ global $wgContLang, $wgScript;
+
+ $namespaceselect = '<select name="namespace">';
+ $namespaceselect .= '<option value="" '.(is_null($namespace) ? ' selected="selected"' : '').'>'.wfMsg( 'contributionsall' ).'</option>';
+ $arr = $wgContLang->getNamespaces();
+ foreach( array_keys( $arr ) as $i ) {
+ if( $i < 0 ) {
+ continue;
+ }
+ $namespacename = str_replace ( '_', ' ', $arr[$i] );
+ $n = ($i == 0) ? wfMsg ( 'articlenamespace' ) : $namespacename;
+ $sel = ($i === $namespace) ? ' selected="selected"' : '';
+ $namespaceselect .= "<option value='{$i}'{$sel}>{$n}</option>";
+ }
+ $namespaceselect .= '</select>';
+
+ $submitbutton = '<input type="submit" value="' . wfMsg( 'allpagessubmit' ) . '" />';
+ $invertbox = "<input type='checkbox' name='invert' value='1'" . ( $invert ? ' checked="checked"' : '' ) . ' />';
+
+ $out = "<div class='namespaceselector'><form method='get' action='{$wgScript}'>";
+ $out .= '<input type="hidden" name="title" value="'.$wgContLang->specialpage( 'Contributions' ).'" />';
+ $out .= '<input type="hidden" name="target" value="'.htmlspecialchars( $target ).'" />';
+ $out .= '<input type="hidden" name="hideminor" value="'.$hideminor.'" />';
+ $out .= wfMsg ( 'contributionsformtext', $namespaceselect, $submitbutton, $invertbox );
+ $out .= '</form></div>';
+ return $out;