SpecialWantedcategories: Actually strike the category if it was emptied
[lhc/web/wiklou.git] / includes / specials / SpecialUpload.php
index 0700c49..27ba78e 100644 (file)
@@ -220,7 +220,7 @@ class SpecialUpload extends SpecialPage {
        protected function getUploadForm( $message = '', $sessionKey = '', $hideIgnoreWarning = false ) {
                # Initialize form
                $context = new DerivativeContext( $this->getContext() );
-               $context->setTitle( $this->getTitle() ); // Remove subpage
+               $context->setTitle( $this->getPageTitle() ); // Remove subpage
                $form = new UploadForm( array(
                        'watch' => $this->getWatchCheck(),
                        'forreupload' => $this->mForReUpload,
@@ -328,10 +328,10 @@ class SpecialUpload extends SpecialPage {
                # mDestWarningAck is set when some javascript has shown the warning
                # to the user. mForReUpload is set when the user clicks the "upload a
                # new version" link.
-               if ( !$warnings || ( count( $warnings ) == 1 &&
-                       isset( $warnings['exists'] ) &&
-                       ( $this->mDestWarningAck || $this->mForReUpload ) ) )
-               {
+               if ( !$warnings || ( count( $warnings ) == 1
+                       && isset( $warnings['exists'] )
+                       && ( $this->mDestWarningAck || $this->mForReUpload ) )
+               {
                        return false;
                }
 
@@ -348,9 +348,14 @@ class SpecialUpload extends SpecialPage {
                        } elseif ( $warning == 'duplicate' ) {
                                $msg = $this->getDupeWarning( $args );
                        } elseif ( $warning == 'duplicate-archive' ) {
-                               $msg = "\t<li>" . $this->msg( 'file-deleted-duplicate',
-                                               Title::makeTitle( NS_FILE, $args )->getPrefixedText() )->parse()
-                                       . "</li>\n";
+                               if ( $args === '' ) {
+                                       $msg = "\t<li>" . $this->msg( 'file-deleted-duplicate-notitle' )->parse()
+                                               . "</li>\n";
+                               } else {
+                                       $msg = "\t<li>" . $this->msg( 'file-deleted-duplicate',
+                                                       Title::makeTitle( NS_FILE, $args )->getPrefixedText() )->parse()
+                                               . "</li>\n";
+                               }
                        } else {
                                if ( $args === true ) {
                                        $args = array();
@@ -1107,10 +1112,8 @@ class UploadSourceField extends HTMLTextField {
         * @return string
         */
        function getLabelHtml( $cellAttributes = array() ) {
-               $id = $this->mParams['id'];
-               $label = Html::rawElement( 'label', array( 'for' => $id ), $this->mLabel );
-
                if ( !empty( $this->mParams['radio'] ) ) {
+                       $id = "wpSourceType{$this->mParams['upload-type']}";
                        $attribs = array(
                                'name' => 'wpSourceType',
                                'type' => 'radio',
@@ -1120,9 +1123,12 @@ class UploadSourceField extends HTMLTextField {
                        if ( !empty( $this->mParams['checked'] ) ) {
                                $attribs['checked'] = 'checked';
                        }
+                       $label = Html::rawElement( 'label', array( 'for' => $id ), $this->mLabel );
                        $label .= Html::element( 'input', $attribs );
+               } else {
+                       $id = $this->mParams['id'];
+                       $label = Html::rawElement( 'label', array( 'for' => $id ), $this->mLabel );
                }
-
                return Html::rawElement( 'td', array( 'class' => 'mw-label' ) + $cellAttributes, $label );
        }