Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -962,6 +962,9 @@ |
963 | 963 | 'filedelete-nofile', |
964 | 964 | 'filedelete-nofile-old', |
965 | 965 | 'filedelete-iscurrent', |
| 966 | + 'filedelete-otherreason', |
| 967 | + 'filedelete-reason-otherlist', |
| 968 | + 'filedelete-reason-dropdown', |
966 | 969 | ), |
967 | 970 | 'mimesearch' => array( |
968 | 971 | 'mimesearch', |
Index: trunk/phase3/includes/FileDeleteForm.php |
— | — | @@ -63,23 +63,31 @@ |
64 | 64 | |
65 | 65 | // Perform the deletion if appropriate |
66 | 66 | if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $token, $this->oldimage ) ) { |
67 | | - $comment = $wgRequest->getText( 'wpReason' ); |
| 67 | + $this->DeleteReasonList = $wgRequest->getText( 'wpDeleteReasonList' ); |
| 68 | + $this->DeleteReason = $wgRequest->getText( 'wpReason' ); |
| 69 | + $reason = $this->DeleteReasonList; |
| 70 | + if ( $reason != 'other' && $this->DeleteReason != '') { |
| 71 | + // Entry from drop down menu + additional comment |
| 72 | + $reason .= ': ' . $this->DeleteReason; |
| 73 | + } elseif ( $reason == 'other' ) { |
| 74 | + $reason = $this->DeleteReason; |
| 75 | + } |
68 | 76 | if( $this->oldimage ) { |
69 | | - $status = $this->file->deleteOld( $this->oldimage, $comment ); |
| 77 | + $status = $this->file->deleteOld( $this->oldimage, $reason ); |
70 | 78 | if( $status->ok ) { |
71 | 79 | // Need to do a log item |
72 | 80 | $log = new LogPage( 'delete' ); |
73 | 81 | $logComment = wfMsg( 'deletedrevision', $this->oldimage ); |
74 | | - if( trim( $comment ) != '' ) |
75 | | - $logComment .= ": {$comment}"; |
| 82 | + if( trim( $reason ) != '' ) |
| 83 | + $logComment .= ": {$reason}"; |
76 | 84 | $log->addEntry( 'delete', $this->title, $logComment ); |
77 | 85 | } |
78 | 86 | } else { |
79 | | - $status = $this->file->delete( $comment ); |
| 87 | + $status = $this->file->delete( $reason ); |
80 | 88 | if( $status->ok ) { |
81 | 89 | // Need to delete the associated article |
82 | 90 | $article = new Article( $this->title ); |
83 | | - $article->doDeleteArticle( $comment ); |
| 91 | + $article->doDeleteArticle( $reason ); |
84 | 92 | } |
85 | 93 | } |
86 | 94 | if( !$status->isGood() ) |
— | — | @@ -103,15 +111,58 @@ |
104 | 112 | */ |
105 | 113 | private function showForm() { |
106 | 114 | global $wgOut, $wgUser, $wgRequest; |
| 115 | + |
| 116 | + $mDeletereasonother = Xml::label( wfMsg( 'filedelete-otherreason' ), 'wpReason' ); |
| 117 | + $mDeletereasonotherlist = wfMsgHtml( 'filedelete-reason-otherlist' ); |
| 118 | + $scDeleteReasonList = wfMsgForContent( 'filedelete-reason-dropdown' ); |
| 119 | + $mDeleteReasonList = ''; |
| 120 | + $delcom = Xml::label( wfMsg( 'filedelete-comment' ), 'wpDeleteReasonList' ); |
| 121 | + if ( $scDeleteReasonList != '' && $scDeleteReasonList != '-' ) { |
| 122 | + $deleteReasonList = "<option value=\"other\">$mDeletereasonotherlist</option>"; |
| 123 | + $optgroup = ""; |
| 124 | + foreach ( explode( "\n", $scDeleteReasonList ) as $option) { |
| 125 | + $value = trim( htmlspecialchars($option) ); |
| 126 | + if ( $value == '' ) { |
| 127 | + continue; |
| 128 | + } elseif ( substr( $value, 0, 1) == '*' && substr( $value, 1, 1) != '*' ) { |
| 129 | + // A new group is starting ... |
| 130 | + $value = trim( substr( $value, 1 ) ); |
| 131 | + $deleteReasonList .= "$optgroup<optgroup label=\"$value\">"; |
| 132 | + $optgroup = "</optgroup>"; |
| 133 | + } elseif ( substr( $value, 0, 2) == '**' ) { |
| 134 | + // groupmember |
| 135 | + $selected = ""; |
| 136 | + $value = trim( substr( $value, 2 ) ); |
| 137 | + if ( $mDeleteReasonList === $value) |
| 138 | + $selected = ' selected="selected"'; |
| 139 | + $deleteReasonList .= "<option value=\"$value\"$selected>$value</option>"; |
| 140 | + } else { |
| 141 | + // groupless delete reason |
| 142 | + $selected = ""; |
| 143 | + if ( $this->DeleteReasonList === $value) |
| 144 | + $selected = ' selected="selected"'; |
| 145 | + $deleteReasonList .= "$optgroup<option value=\"$value\"$selected>$value</option>"; |
| 146 | + $optgroup = ""; |
| 147 | + } |
| 148 | + } |
| 149 | + $deleteReasonList .= $optgroup; |
| 150 | + } |
107 | 151 | |
108 | 152 | $form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getAction() ) ); |
109 | 153 | $form .= Xml::hidden( 'wpEditToken', $wgUser->editToken( $this->oldimage ) ); |
110 | 154 | $form .= '<fieldset><legend>' . wfMsgHtml( 'filedelete-legend' ) . '</legend>'; |
| 155 | + $form .= '<table><tr>'; |
111 | 156 | $form .= $this->prepareMessage( 'filedelete-intro' ); |
112 | | - |
113 | | - $form .= '<p>' . Xml::inputLabel( wfMsg( 'filedelete-comment' ), 'wpReason', 'wpReason', |
114 | | - 60, $wgRequest->getText( 'wpReason' ) ) . '</p>'; |
| 157 | + $form .= "<td align=\"right\"> $delcom </td><td align=\"left\">"; |
| 158 | + $form .= "<select tabindex='2' id='wpDeleteReasonList' name=\"wpDeleteReasonList\"> |
| 159 | + $deleteReasonList |
| 160 | +</select>"; |
| 161 | + $form .= "</tr><tr><td align=\"right\"> $mDeletereasonother </td><td align=\"left\">"; |
| 162 | + $form .= "<input type='text' maxlength='255' size='60' name='wpReason' id='wpReason' "; |
| 163 | + $form .= "value=\"". htmlspecialchars( $wgRequest->getText( 'wpReason' ) ) ."\" tabindex=\"1\" />"; |
| 164 | + $form .= '</td></tr><tr><td colspan=2>'; |
115 | 165 | $form .= '<p>' . Xml::submitButton( wfMsg( 'filedelete-submit' ), array( 'name' => 'mw-filedelete-submit', 'id' => 'mw-filedelete-submit' ) ) . '</p>'; |
| 166 | + $form .= '</tr></table>'; |
116 | 167 | $form .= '</fieldset>'; |
117 | 168 | $form .= '</form>'; |
118 | 169 | |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1569,18 +1569,24 @@ |
1570 | 1570 | 'filerevert-badversion' => 'There is no previous local version of this file with the provided timestamp.', |
1571 | 1571 | |
1572 | 1572 | # File deletion |
1573 | | -'filedelete' => 'Delete $1', |
1574 | | -'filedelete-backlink' => '← $1', # only translate this message to other languages if you have to change it |
1575 | | -'filedelete-legend' => 'Delete file', |
1576 | | -'filedelete-intro' => "You are deleting '''[[Media:$1|$1]]'''.", |
1577 | | -'filedelete-intro-old' => '<span class="plainlinks">You are deleting the version of \'\'\'[[Media:$1|$1]]\'\'\' as of [$4 $3, $2].</span>', |
1578 | | -'filedelete-comment' => 'Comment:', |
1579 | | -'filedelete-submit' => 'Delete', |
1580 | | -'filedelete-success' => "'''$1''' has been deleted.", |
1581 | | -'filedelete-success-old' => '<span class="plainlinks">The version of \'\'\'[[Media:$1|$1]]\'\'\' as of $3, $2 has been deleted.</span>', |
1582 | | -'filedelete-nofile' => "'''$1''' does not exist on {{SITENAME}}.", |
1583 | | -'filedelete-nofile-old' => "There is no archived version of '''$1''' with the specified attributes.", |
1584 | | -'filedelete-iscurrent' => 'You are attempting to delete the most recent version of this file. Please revert to an older version first.', |
| 1573 | +'filedelete' => 'Delete $1', |
| 1574 | +'filedelete-backlink' => '← $1', # only translate this message to other languages if you have to change it |
| 1575 | +'filedelete-legend' => 'Delete file', |
| 1576 | +'filedelete-intro' => "You are deleting '''[[Media:$1|$1]]'''.", |
| 1577 | +'filedelete-intro-old' => '<span class="plainlinks">You are deleting the version of \'\'\'[[Media:$1|$1]]\'\'\' as of [$4 $3, $2].</span>', |
| 1578 | +'filedelete-comment' => 'Reason for deletion:', |
| 1579 | +'filedelete-submit' => 'Delete', |
| 1580 | +'filedelete-success' => "'''$1''' has been deleted.", |
| 1581 | +'filedelete-success-old' => '<span class="plainlinks">The version of \'\'\'[[Media:$1|$1]]\'\'\' as of $3, $2 has been deleted.</span>', |
| 1582 | +'filedelete-nofile' => "'''$1''' does not exist on {{SITENAME}}.", |
| 1583 | +'filedelete-nofile-old' => "There is no archived version of '''$1''' with the specified attributes.", |
| 1584 | +'filedelete-iscurrent' => 'You are attempting to delete the most recent version of this file. Please revert to an older version first.', |
| 1585 | +'filedelete-otherreason' => 'Other/additional reason:', |
| 1586 | +'filedelete-reason-otherlist' => 'Other reason', |
| 1587 | +'filedelete-reason-dropdown' => ' |
| 1588 | +*Common delete reasons |
| 1589 | +** Copyright violation |
| 1590 | +** Duplicated file', |
1585 | 1591 | |
1586 | 1592 | # MIME search |
1587 | 1593 | 'mimesearch' => 'MIME search', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -142,6 +142,7 @@ |
143 | 143 | when using mailers that set the envelope sender to the From header value. |
144 | 144 | * (bug 11897) Add alias [[Special:CreateAccount]] & [[Special:Userlogin/signup]] |
145 | 145 | for Special:Userlogin?type=signup |
| 146 | +* (bug 12214) Add a predefined list of delete reasons to the file deletion form |
146 | 147 | |
147 | 148 | === Bug fixes in 1.12 === |
148 | 149 | |