Index: branches/wmf/1.17wmf1/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php |
— | — | @@ -19,9 +19,7 @@ |
20 | 20 | function execute( $sub ) { |
21 | 21 | global $wgOut, $wgRequest, $wgExtensionAssetsPath; |
22 | 22 | |
23 | | - if ( $wgRequest->wasPosted() ) { |
24 | | - $this->logType = $wgRequest->getText( 'log', 'campaignsettings' ); |
25 | | - } |
| 23 | + $this->logType = $wgRequest->getText( 'log', 'campaignsettings' ); |
26 | 24 | |
27 | 25 | // Begin output |
28 | 26 | $this->setHeaders(); |
— | — | @@ -49,12 +47,143 @@ |
50 | 48 | // Begin log selection fieldset |
51 | 49 | $htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
52 | 50 | |
53 | | - $htmlOut .= Xml::openElement( 'form', array( 'method' => 'post' ) ); |
| 51 | + $title = SpecialPage::getTitleFor( 'CentralNoticeLogs' ); |
| 52 | + $actionUrl = $title->getLocalURL(); |
| 53 | + $htmlOut .= Xml::openElement( 'form', array( 'method' => 'get', 'action' => $actionUrl ) ); |
54 | 54 | $htmlOut .= Xml::element( 'h2', null, wfMsg( 'centralnotice-view-logs' ) ); |
| 55 | + $htmlOut .= Xml::openElement( 'div', array( 'id' => 'cn-log-switcher' ) ); |
| 56 | + $title = SpecialPage::getTitleFor( 'CentralNoticeLogs' ); |
| 57 | + $fullUrl = $title->getFullUrl(); |
| 58 | + |
| 59 | + $htmlOut .= Xml::radio( |
| 60 | + 'log_type', |
| 61 | + 'campaign', |
| 62 | + ( $this->logType == 'campaignsettings' ? true : false ), |
| 63 | + array( 'onclick' => "switchLogs( '".$fullUrl."', 'campaignsettings' )" ) |
| 64 | + ); |
| 65 | + $htmlOut .= Xml::label( wfMsg( 'centralnotice-campaign-settings' ), 'campaign' ); |
| 66 | + |
| 67 | + $htmlOut .= Xml::radio( |
| 68 | + 'log_type', |
| 69 | + 'banner', |
| 70 | + ( $this->logType == 'bannersettings' ? true : false ), |
| 71 | + array( 'onclick' => "switchLogs( '".$fullUrl."', 'bannersettings' )" ) |
| 72 | + ); |
| 73 | + $htmlOut .= Xml::label( wfMsg( 'centralnotice-banner-settings' ), 'banner' ); |
| 74 | + |
| 75 | + $htmlOut .= Xml::closeElement( 'div' ); |
| 76 | + |
| 77 | + if ( $this->logType == 'campaignsettings' ) { |
| 78 | + |
| 79 | + $reset = $wgRequest->getVal( 'centralnoticelogreset' ); |
| 80 | + $campaign = $wgRequest->getVal( 'campaign' ); |
| 81 | + $user = $wgRequest->getVal( 'user' ); |
| 82 | + $startYear = $this->getDateValue( 'start_year' ); |
| 83 | + $startMonth = $this->getDateValue( 'start_month' ); |
| 84 | + $startDay = $this->getDateValue( 'start_day' ); |
| 85 | + $endYear = $this->getDateValue( 'end_year' ); |
| 86 | + $endMonth = $this->getDateValue( 'end_month' ); |
| 87 | + $endDay = $this->getDateValue( 'end_day' ); |
| 88 | + |
| 89 | + $htmlOut .= Xml::openElement( 'div', array( 'id' => 'cn-log-filters-container' ) ); |
| 90 | + |
| 91 | + if ( $campaign || $user || $startYear || $startMonth || $startDay || $endYear || $endMonth || $endDay ) { // filters on |
| 92 | + $htmlOut .= '<a href="javascript:toggleFilterDisplay()">'. |
| 93 | + '<img src="'.$wgExtensionAssetsPath.'/CentralNotice/collapsed.png" id="cn-collapsed-filter-arrow" style="display:none;position:relative;top:-2px;"/>'. |
| 94 | + '<img src="'.$wgExtensionAssetsPath.'/CentralNotice/uncollapsed.png" id="cn-uncollapsed-filter-arrow" style="display:inline-block;position:relative;top:-2px;"/>'. |
| 95 | + '</a>'; |
| 96 | + $htmlOut .= Xml::tags( 'span', array( 'style' => 'margin-left: 0.3em;' ), wfMsg( 'centralnotice-filters' ) ); |
| 97 | + $htmlOut .= Xml::openElement( 'div', array( 'id' => 'cn-log-filters' ) ); |
| 98 | + } else { // filters off |
| 99 | + $htmlOut .= '<a href="javascript:toggleFilterDisplay()">'. |
| 100 | + '<img src="'.$wgExtensionAssetsPath.'/CentralNotice/collapsed.png" id="cn-collapsed-filter-arrow" style="display:inline-block;position:relative;top:-2px;"/>'. |
| 101 | + '<img src="'.$wgExtensionAssetsPath.'/CentralNotice/uncollapsed.png" id="cn-uncollapsed-filter-arrow" style="display:none;position:relative;top:-2px;"/>'. |
| 102 | + '</a>'; |
| 103 | + $htmlOut .= Xml::tags( 'span', array( 'style' => 'margin-left: 0.3em;' ), 'Log filters' ); |
| 104 | + $htmlOut .= Xml::openElement( 'div', array( 'id' => 'cn-log-filters', 'style' => 'display:none;' ) ); |
| 105 | + } |
| 106 | + |
| 107 | + $htmlOut .= Xml::openElement( 'table' ); |
| 108 | + $htmlOut .= Xml::openElement( 'tr' ); |
| 109 | + |
| 110 | + $htmlOut .= Xml::openElement( 'td' ); |
| 111 | + $htmlOut .= Xml::label( wfMsg( 'centralnotice-start-date' ), 'month', array( 'class' => 'cn-log-filter-label' ) ); |
| 112 | + $htmlOut .= Xml::closeElement( 'td' ); |
| 113 | + $htmlOut .= Xml::openElement( 'td' ); |
| 114 | + if ( $reset ) { |
| 115 | + $htmlOut .= $this->dateSelector( 'start' ); |
| 116 | + } else { |
| 117 | + $htmlOut .= $this->dateSelector( 'start', $startYear, $startMonth, $startDay ); |
| 118 | + } |
| 119 | + $htmlOut .= Xml::closeElement( 'td' ); |
| 120 | + |
| 121 | + $htmlOut .= Xml::closeElement( 'tr' ); |
| 122 | + $htmlOut .= Xml::openElement( 'tr' ); |
| 123 | + |
| 124 | + $htmlOut .= Xml::openElement( 'td' ); |
| 125 | + $htmlOut .= Xml::label( wfMsg( 'centralnotice-end-date' ), 'month', array( 'class' => 'cn-log-filter-label' ) ); |
| 126 | + $htmlOut .= Xml::closeElement( 'td' ); |
| 127 | + $htmlOut .= Xml::openElement( 'td' ); |
| 128 | + if ( $reset ) { |
| 129 | + $htmlOut .= $this->dateSelector( 'end' ); |
| 130 | + } else { |
| 131 | + $htmlOut .= $this->dateSelector( 'end', $endYear, $endMonth, $endDay ); |
| 132 | + } |
| 133 | + $htmlOut .= Xml::closeElement( 'td' ); |
| 134 | + |
| 135 | + $htmlOut .= Xml::closeElement( 'tr' ); |
| 136 | + $htmlOut .= Xml::openElement( 'tr' ); |
| 137 | + |
| 138 | + $htmlOut .= Xml::openElement( 'td' ); |
| 139 | + $htmlOut .= Xml::label( wfMsg( 'centralnotice-notice' ), 'campaign', array( 'class' => 'cn-log-filter-label' ) ); |
| 140 | + $htmlOut .= Xml::closeElement( 'td' ); |
| 141 | + $htmlOut .= Xml::openElement( 'td' ); |
| 142 | + $htmlOut .= Xml::input( 'campaign', 25, ( $reset ? '' : $campaign ) ); |
| 143 | + $htmlOut .= Xml::closeElement( 'span' ); |
| 144 | + $htmlOut .= Xml::closeElement( 'td' ); |
| 145 | + |
| 146 | + $htmlOut .= Xml::closeElement( 'tr' ); |
| 147 | + $htmlOut .= Xml::openElement( 'tr' ); |
| 148 | + |
| 149 | + $htmlOut .= Xml::openElement( 'td' ); |
| 150 | + $htmlOut .= Xml::label( wfMsg( 'centralnotice-user' ), 'user', array( 'class' => 'cn-log-filter-label' ) ); |
| 151 | + $htmlOut .= Xml::closeElement( 'td' ); |
| 152 | + $htmlOut .= Xml::openElement( 'td' ); |
| 153 | + $htmlOut .= Xml::input( 'user', 25, ( $reset ? '' : $user ) ); |
| 154 | + $htmlOut .= Xml::closeElement( 'span' ); |
| 155 | + $htmlOut .= Xml::closeElement( 'td' ); |
| 156 | + |
| 157 | + $htmlOut .= Xml::closeElement( 'tr' ); |
| 158 | + $htmlOut .= Xml::openElement( 'tr' ); |
| 159 | + |
| 160 | + $htmlOut .= Xml::openElement( 'td', array( 'colspan' => 2 ) ); |
| 161 | + $htmlOut .= Xml::submitButton( wfMsg( 'centralnotice-apply-filters' ), |
| 162 | + array( |
| 163 | + 'id' => 'centralnoticesubmit', |
| 164 | + 'name' => 'centralnoticesubmit', |
| 165 | + 'class' => 'cn-filter-buttons', |
| 166 | + ) |
| 167 | + ); |
| 168 | + $link = $title->getLinkUrl(); |
| 169 | + $htmlOut .= Xml::submitButton( wfMsg( 'centralnotice-clear-filters' ), |
| 170 | + array( |
| 171 | + 'id' => 'centralnoticelogreset', |
| 172 | + 'name' => 'centralnoticelogreset', |
| 173 | + 'class' => 'cn-filter-buttons', |
| 174 | + 'onclick' => "window.location = '$link'; return false;", |
| 175 | + ) |
| 176 | + ); |
| 177 | + $htmlOut .= Xml::closeElement( 'td' ); |
| 178 | + |
| 179 | + $htmlOut .= Xml::closeElement( 'tr' ); |
| 180 | + $htmlOut .= Xml::closeElement( 'table' ); |
| 181 | + $htmlOut .= Xml::closeElement( 'div' ); |
| 182 | + $htmlOut .= Xml::closeElement( 'div' ); |
| 183 | + } |
| 184 | + |
55 | 185 | $htmlOut .= Xml::closeElement( 'form' ); |
56 | 186 | |
57 | 187 | // End log selection fieldset |
58 | | - // Uncomment when we have multiple logs |
59 | 188 | //$htmlOut .= Xml::closeElement( 'fieldset' ); |
60 | 189 | |
61 | 190 | $wgOut->addHTML( $htmlOut ); |
— | — | @@ -65,17 +194,42 @@ |
66 | 195 | $wgOut->addHTML( Xml::closeElement( 'div' ) ); |
67 | 196 | } |
68 | 197 | |
| 198 | + private function dateSelector( $prefix, $year = 0, $month = 0, $day = 0 ) { |
| 199 | + $dateRanges = CentralNotice::getDateRanges(); |
| 200 | + |
| 201 | + $fields = array( |
| 202 | + array( $prefix."_month", "centralnotice-month", $dateRanges['months'], $month ), |
| 203 | + array( $prefix."_day", "centralnotice-day", $dateRanges['days'], $day ), |
| 204 | + array( $prefix."_year", "centralnotice-year", $dateRanges['years'], $year ), |
| 205 | + ); |
| 206 | + |
| 207 | + $out = ''; |
| 208 | + foreach ( $fields as $data ) { |
| 209 | + list( $field, $label, $set, $current ) = $data; |
| 210 | + $out .= Xml::listDropDown( $field, |
| 211 | + CentralNotice::dropDownList( wfMsg( $label ), $set ), |
| 212 | + '', |
| 213 | + $current ); |
| 214 | + } |
| 215 | + return $out; |
| 216 | + } |
| 217 | + |
69 | 218 | /** |
70 | | - * Show a log. |
| 219 | + * Show a log of changes. |
| 220 | + * @param $logType string: which type of log to show |
71 | 221 | */ |
72 | 222 | function showLog( $logType ) { |
73 | 223 | global $wgOut; |
74 | 224 | |
75 | | - $pager = new CentralNoticeLogPager( $this ); |
| 225 | + if ( $logType == 'bannersettings' ) { |
| 226 | + $pager = new CentralNoticeBannerLogPager( $this ); |
| 227 | + } else { |
| 228 | + $pager = new CentralNoticeLogPager( $this ); |
| 229 | + } |
| 230 | + |
76 | 231 | $htmlOut = ''; |
77 | 232 | |
78 | 233 | // Begin log fieldset |
79 | | - // Uncomment when we have multiple logs |
80 | 234 | //$htmlOut .= Xml::openElement( 'fieldset', array( 'class' => 'prefsection' ) ); |
81 | 235 | |
82 | 236 | // Show paginated list of log entries |
— | — | @@ -92,309 +246,12 @@ |
93 | 247 | |
94 | 248 | $wgOut->addHTML( $htmlOut ); |
95 | 249 | } |
96 | | - |
97 | | -} |
98 | | - |
99 | | -class CentralNoticeLogPager extends ReverseChronologicalPager { |
100 | | - var $viewPage, $special; |
101 | | - |
102 | | - function __construct( $special ) { |
103 | | - $this->special = $special; |
104 | | - parent::__construct(); |
105 | | - |
106 | | - // Override paging defaults |
107 | | - list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset( 20, '' ); |
108 | | - $this->mLimitsShown = array( 20, 50, 100 ); |
109 | | - |
110 | | - $this->viewPage = SpecialPage::getTitleFor( 'CentralNotice' ); |
111 | | - } |
112 | 250 | |
113 | | - /** |
114 | | - * Sort the log list by timestamp |
115 | | - */ |
116 | | - function getIndexField() { |
117 | | - return 'notlog_timestamp'; |
| 251 | + private function getDateValue( $type ) { |
| 252 | + global $wgRequest; |
| 253 | + $value = $wgRequest->getVal( $type ); |
| 254 | + if ( $value === 'other' ) $value = null; |
| 255 | + return $value; |
118 | 256 | } |
119 | | - |
120 | | - /** |
121 | | - * Pull log entries from the database |
122 | | - */ |
123 | | - function getQueryInfo() { |
124 | | - return array( |
125 | | - 'tables' => array( 'cn_notice_log' ), |
126 | | - 'fields' => '*', |
127 | | - ); |
128 | | - } |
129 | | - |
130 | | - /** |
131 | | - * Generate the content of each table row (1 row = 1 log entry) |
132 | | - */ |
133 | | - function formatRow( $row ) { |
134 | | - global $wgLang, $wgExtensionAssetsPath; |
135 | | - |
136 | | - // Create a user object so we can pull the name, user page, etc. |
137 | | - $loggedUser = User::newFromId( $row->notlog_user_id ); |
138 | | - // Create the user page link |
139 | | - $userLink = $this->getSkin()->makeLinkObj( $loggedUser->getUserPage(), |
140 | | - $loggedUser->getName() ); |
141 | | - $userTalkLink = $this->getSkin()->makeLinkObj( $loggedUser->getTalkPage(), |
142 | | - wfMsg ( 'centralnotice-talk-link' ) ); |
143 | | - |
144 | | - // Create the campaign link |
145 | | - $campaignLink = $this->getSkin()->makeLinkObj( $this->viewPage, |
146 | | - htmlspecialchars( $row->notlog_not_name ), |
147 | | - 'method=listNoticeDetail¬ice=' . urlencode( $row->notlog_not_name ) ); |
148 | | - |
149 | | - // Begin log entry primary row |
150 | | - $htmlOut = Xml::openElement( 'tr' ); |
151 | | - |
152 | | - $htmlOut .= Xml::openElement( 'td', array( 'valign' => 'top' ) ); |
153 | | - if ( $row->notlog_action !== 'removed' ) { |
154 | | - $htmlOut .= '<a href="javascript:toggleDisplay(\''.$row->notlog_id.'\')">'. |
155 | | - '<img src="'.$wgExtensionAssetsPath.'/CentralNotice/collapsed.png" id="cn-collapsed-'.$row->notlog_id.'" style="display:block;vertical-align:baseline;"/>'. |
156 | | - '<img src="'.$wgExtensionAssetsPath.'/CentralNotice/uncollapsed.png" id="cn-uncollapsed-'.$row->notlog_id.'" style="display:none;vertical-align:baseline;"/>'. |
157 | | - '</a>'; |
158 | | - } |
159 | | - $htmlOut .= Xml::closeElement( 'td' ); |
160 | | - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top', 'class' => 'primary' ), |
161 | | - $wgLang->date( $row->notlog_timestamp ) . ' ' . $wgLang->time( $row->notlog_timestamp ) |
162 | | - ); |
163 | | - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top', 'class' => 'primary' ), |
164 | | - wfMsg ( 'centralnotice-user-links', $userLink, $userTalkLink ) |
165 | | - ); |
166 | | - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top', 'class' => 'primary' ), |
167 | | - $row->notlog_action |
168 | | - ); |
169 | | - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top', 'class' => 'primary' ), |
170 | | - $campaignLink |
171 | | - ); |
172 | | - $htmlOut .= Xml::tags( 'td', array(), |
173 | | - ' ' |
174 | | - ); |
175 | | - |
176 | | - // End log entry primary row |
177 | | - $htmlOut .= Xml::closeElement( 'tr' ); |
178 | | - |
179 | | - if ( $row->notlog_action !== 'removed' ) { |
180 | | - // Begin log entry secondary row |
181 | | - $htmlOut .= Xml::openElement( 'tr', array( 'id' => 'cn-log-details-'.$row->notlog_id, 'style' => 'display:none;' ) ); |
182 | | - |
183 | | - $htmlOut .= Xml::tags( 'td', array( 'valign' => 'top' ), |
184 | | - ' ' // force a table cell in older browsers |
185 | | - ); |
186 | | - $htmlOut .= Xml::openElement( 'td', array( 'valign' => 'top', 'colspan' => '5' ) ); |
187 | | - if ( $row->notlog_action == 'created' ) { |
188 | | - $htmlOut .= $this->showInitialSettings( $row ); |
189 | | - } else if ( $row->notlog_action == 'modified' ) { |
190 | | - $htmlOut .= $this->showChanges( $row ); |
191 | | - } |
192 | | - $htmlOut .= Xml::closeElement( 'td' ); |
193 | | - |
194 | | - // End log entry primary row |
195 | | - $htmlOut .= Xml::closeElement( 'tr' ); |
196 | | - } |
197 | | - |
198 | | - return $htmlOut; |
199 | | - } |
200 | | - |
201 | | - function showInitialSettings( $row ) { |
202 | | - global $wgLang; |
203 | | - $details = ''; |
204 | | - $details .= wfMsg ( |
205 | | - 'centralnotice-log-label', |
206 | | - wfMsg ( 'centralnotice-start-date' ), |
207 | | - $wgLang->date( $row->notlog_end_start ).' '.$wgLang->time( $row->notlog_end_start ) |
208 | | - )."<br/>"; |
209 | | - $details .= wfMsg ( |
210 | | - 'centralnotice-log-label', |
211 | | - wfMsg ( 'centralnotice-end-date' ), |
212 | | - $wgLang->date( $row->notlog_end_end ).' '.$wgLang->time( $row->notlog_end_end ) |
213 | | - )."<br/>"; |
214 | | - $details .= wfMsg ( |
215 | | - 'centralnotice-log-label', |
216 | | - wfMsg ( 'centralnotice-projects' ), |
217 | | - $row->notlog_end_projects |
218 | | - )."<br/>"; |
219 | | - $language_count = count( explode ( ', ', $row->notlog_end_languages ) ); |
220 | | - $languageList = ''; |
221 | | - if ( $language_count > 15 ) { |
222 | | - $languageList = wfMsg ( 'centralnotice-multiple-languages', $language_count ); |
223 | | - } elseif ( $language_count > 0 ) { |
224 | | - $languageList = $row->notlog_end_languages; |
225 | | - } |
226 | | - $details .= wfMsg ( |
227 | | - 'centralnotice-log-label', |
228 | | - wfMsg ( 'centralnotice-languages' ), |
229 | | - $languageList |
230 | | - )."<br/>"; |
231 | | - $details .= wfMsg ( |
232 | | - 'centralnotice-log-label', |
233 | | - wfMsg ( 'centralnotice-geo' ), |
234 | | - ($row->notlog_end_geo ? 'on' : 'off') |
235 | | - )."<br/>"; |
236 | | - if ( $row->notlog_end_geo ) { |
237 | | - $country_count = count( explode ( ', ', $row->notlog_end_countries ) ); |
238 | | - $countryList = ''; |
239 | | - if ( $country_count > 20 ) { |
240 | | - $countryList = wfMsg ( 'centralnotice-multiple-countries', $country_count ); |
241 | | - } elseif ( $country_count > 0 ) { |
242 | | - $countryList = $row->notlog_end_countries; |
243 | | - } |
244 | | - $details .= wfMsg ( |
245 | | - 'centralnotice-log-label', |
246 | | - wfMsg ( 'centralnotice-countries' ), |
247 | | - $countryList |
248 | | - )."<br/>"; |
249 | | - } |
250 | | - return $details; |
251 | | - } |
252 | | - |
253 | | - function showChanges( $row ) { |
254 | | - global $wgLang; |
255 | | - $details = ''; |
256 | | - if ( $row->notlog_begin_start !== $row->notlog_end_start ) { |
257 | | - $details .= wfMsg ( |
258 | | - 'centralnotice-log-label', |
259 | | - wfMsg ( 'centralnotice-start-date' ), |
260 | | - wfMsg ( |
261 | | - 'centralnotice-changed', |
262 | | - $wgLang->date( $row->notlog_begin_start ).' '.$wgLang->time( $row->notlog_begin_start ), |
263 | | - $wgLang->date( $row->notlog_end_start ).' '.$wgLang->time( $row->notlog_end_start ) |
264 | | - ) |
265 | | - )."<br/>"; |
266 | | - } |
267 | | - if ( $row->notlog_begin_end !== $row->notlog_end_end ) { |
268 | | - $details .= wfMsg ( |
269 | | - 'centralnotice-log-label', |
270 | | - wfMsg ( 'centralnotice-end-date' ), |
271 | | - wfMsg ( |
272 | | - 'centralnotice-changed', |
273 | | - $wgLang->date( $row->notlog_begin_end ).' '.$wgLang->time( $row->notlog_begin_end ), |
274 | | - $wgLang->date( $row->notlog_end_end ).' '.$wgLang->time( $row->notlog_end_end ) |
275 | | - ) |
276 | | - )."<br/>"; |
277 | | - } |
278 | | - $details .= $this->testBooleanChange( 'enabled', $row ); |
279 | | - $details .= $this->testBooleanChange( 'preferred', $row ); |
280 | | - $details .= $this->testBooleanChange( 'locked', $row ); |
281 | | - $details .= $this->testBooleanChange( 'geo', $row ); |
282 | | - $details .= $this->testSetChange( 'projects', $row ); |
283 | | - $details .= $this->testSetChange( 'languages', $row ); |
284 | | - $details .= $this->testSetChange( 'countries', $row ); |
285 | | - if ( $row->notlog_begin_banners !== $row->notlog_end_banners ) { |
286 | | - // Show changes to banner weights and assignment |
287 | | - $beginBannersObject = json_decode( $row->notlog_begin_banners ); |
288 | | - $endBannersObject = json_decode( $row->notlog_end_banners ); |
289 | | - $beginBanners = array(); |
290 | | - $endBanners = array(); |
291 | | - foreach( $beginBannersObject as $key => $weight ) { |
292 | | - $beginBanners[$key] = $key.' ('.$weight.')'; |
293 | | - } |
294 | | - foreach( $endBannersObject as $key => $weight ) { |
295 | | - $endBanners[$key] = $key.' ('.$weight.')'; |
296 | | - } |
297 | | - if ( $beginBanners ) { |
298 | | - $before = implode( ', ', $beginBanners ); |
299 | | - } else { |
300 | | - $before = wfMsg ( 'centralnotice-no-assignments' ); |
301 | | - } |
302 | | - if ( $endBanners ) { |
303 | | - $after = implode( ', ', $endBanners ); |
304 | | - } else { |
305 | | - $after = wfMsg ( 'centralnotice-no-assignments' ); |
306 | | - } |
307 | | - $details .= wfMsg ( |
308 | | - 'centralnotice-log-label', |
309 | | - wfMsg ( 'centralnotice-templates' ), |
310 | | - wfMsg ( 'centralnotice-changed', $before, $after) |
311 | | - )."<br/>"; |
312 | | - } |
313 | | - return $details; |
314 | | - } |
315 | | - |
316 | | - private function testBooleanChange( $param, $row ) { |
317 | | - $result = ''; |
318 | | - $beginField = 'notlog_begin_'.$param; |
319 | | - $endField = 'notlog_end_'.$param; |
320 | | - if ( $row->$beginField !== $row->$endField ) { |
321 | | - $result .= wfMsg ( |
322 | | - 'centralnotice-log-label', |
323 | | - wfMsg ( 'centralnotice-'.$param ), |
324 | | - wfMsg ( |
325 | | - 'centralnotice-changed', |
326 | | - ( $row->$beginField ? wfMsg ( 'centralnotice-on' ) : wfMsg ( 'centralnotice-off' ) ), |
327 | | - ( $row->$endField ? wfMsg ( 'centralnotice-on' ) : wfMsg ( 'centralnotice-off' ) ) |
328 | | - ) |
329 | | - )."<br/>"; |
330 | | - } |
331 | | - return $result; |
332 | | - } |
333 | | - |
334 | | - private function testSetChange( $param, $row ) { |
335 | | - $result = ''; |
336 | | - $beginField = 'notlog_begin_'.$param; |
337 | | - $endField = 'notlog_end_'.$param; |
338 | | - if ( $row->$beginField !== $row->$endField ) { |
339 | | - $beginSet = array(); |
340 | | - $endSet = array(); |
341 | | - if ( $row->$beginField ) { |
342 | | - $beginSet = explode( ', ', $row->$beginField ); |
343 | | - } |
344 | | - if ( $row->$endField ) { |
345 | | - $endSet = explode( ', ', $row->$endField ); |
346 | | - } |
347 | | - $added = array_diff( $endSet, $beginSet ); |
348 | | - $removed = array_diff( $beginSet, $endSet ); |
349 | | - $differences = ''; |
350 | | - if ( $added ) { |
351 | | - $differences .= wfMsg ( 'centralnotice-added', implode( ', ', $added ) ); |
352 | | - if ( $removed ) $differences .= '; '; |
353 | | - } |
354 | | - if ( $removed ) { |
355 | | - $differences .= wfMsg ( 'centralnotice-removed', implode( ', ', $removed ) ); |
356 | | - } |
357 | | - $result .= wfMsg ( |
358 | | - 'centralnotice-log-label', |
359 | | - wfMsg ( 'centralnotice-'.$param ), |
360 | | - $differences |
361 | | - )."<br/>"; |
362 | | - } |
363 | | - return $result; |
364 | | - } |
365 | | - |
366 | | - /** |
367 | | - * Specify table headers |
368 | | - */ |
369 | | - function getStartBody() { |
370 | | - $htmlOut = ''; |
371 | | - $htmlOut .= Xml::openElement( 'table', array( 'id' => 'cn-campaign-logs', 'cellpadding' => 3 ) ); |
372 | | - $htmlOut .= Xml::openElement( 'tr' ); |
373 | | - $htmlOut .= Xml::element( 'th', array( 'style' => 'width: 20px;' ) ); |
374 | | - $htmlOut .= Xml::element( 'th', array( 'align' => 'left', 'style' => 'width: 130px;' ), |
375 | | - wfMsg ( 'centralnotice-timestamp' ) |
376 | | - ); |
377 | | - $htmlOut .= Xml::element( 'th', array( 'align' => 'left', 'style' => 'width: 160px;' ), |
378 | | - wfMsg ( 'centralnotice-user' ) |
379 | | - ); |
380 | | - $htmlOut .= Xml::element( 'th', array( 'align' => 'left', 'style' => 'width: 100px;' ), |
381 | | - wfMsg ( 'centralnotice-action' ) |
382 | | - ); |
383 | | - $htmlOut .= Xml::element( 'th', array( 'align' => 'left', 'style' => 'width: 160px;' ), |
384 | | - wfMsg ( 'centralnotice-notice' ) |
385 | | - ); |
386 | | - $htmlOut .= Xml::tags( 'td', array(), |
387 | | - ' ' |
388 | | - ); |
389 | | - $htmlOut .= Xml::closeElement( 'tr' ); |
390 | | - return $htmlOut; |
391 | | - } |
392 | | - |
393 | | - /** |
394 | | - * Close table |
395 | | - */ |
396 | | - function getEndBody() { |
397 | | - $htmlOut = ''; |
398 | | - $htmlOut .= Xml::closeElement( 'table' ); |
399 | | - return $htmlOut; |
400 | | - } |
| 257 | + |
401 | 258 | } |
Property changes on: branches/wmf/1.17wmf1/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
402 | 259 | Merged /branches/wmf/1.16wmf4/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php:r67177,69199,76243,77266 |
403 | 260 | Merged /trunk/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php:r62820-67552,67557,67559-71720,71725-71731,71734-71739,71748-71753,71774-71997,72058-72131,72136-73830,73847,73850,73852,73855,73959,73963,73973,73980,73983,73991,73994-73995,74000-74321,74325-74406,75376-75470,75567,75643,75646,75674,75680,75726,75849,75889,75908,75973,76141,76145,76333,76347,76351,76356-76358,76361,76363,76462,76543,76763,77622-79761,79780,79783-80145,80147-80148,80150,80152-80602,81461-83563,83565-91117,91146,91368-95516 |
404 | 261 | Merged /trunk/phase3/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php:r63545-63546,63549,63643,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,77555,77558-77560,77563-77565,77573 |
405 | 262 | Merged /branches/wmf-deployment/extensions/CentralNotice/special/SpecialCentralNoticeLogs.php:r60970 |