r40958 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40957‎ | r40958 | r40959 >
Date:13:39, 17 September 2008
Author:jojo
Status:old
Tags:
Comment:
removed "Start collection" feature, which is not needed anymore thanks to correct (non-)caching
Modified paths:
  • /trunk/extensions/Collection/Collection.body.php (modified) (history)
  • /trunk/extensions/Collection/Collection.i18n.php (modified) (history)
  • /trunk/extensions/Collection/Collection.php (modified) (history)
  • /trunk/extensions/Collection/README.txt (modified) (history)

Diff [purge]

Index: trunk/extensions/Collection/Collection.i18n.php
@@ -125,15 +125,6 @@
126126 'coll-invalid_podpartner_msg' => 'The supplied POD partner is invalid.
127127 Please contact your MediaWiki administrator.',
128128 'coll-license' => 'License',
129 - 'coll-start_title' => "Start collection",
130 - 'coll-start_text' => "From now on, you can collect pages, generate and download a document in one of several formats from page collections or from single pages, order books from a print-on-demand partner, and save page collections for later use, or to share them.
131 -
132 -See the [[{{MediaWiki:Coll-helppage}}|help page about collections]] for more information.
133 -",
134 - 'coll-start_add_box_title' => "Start collection right now",
135 - 'coll-start_add_link' => "Click to start your collection.",
136 - 'coll-start_add_page_text' => "Click to add the page <em>$1</em> to your collection",
137 - 'coll-start_add_page_category' => "Click to add the pages in category <em>$1</em> to your collection",
138129 'coll-return_to' => "Return to [[:$1]]",
139130 );
140131
Index: trunk/extensions/Collection/Collection.php
@@ -37,9 +37,6 @@
3838
3939 # Configuration:
4040
41 -/** Title of Start Collection page */
42 -$wgCollectionStartPage = 'Start collection';
43 -
4441 /** URL of mw-serve render server */
4542 $wgCollectionMWServeURL = 'http://tools.pediapress.com/mw-serve/';
4643
Index: trunk/extensions/Collection/README.txt
@@ -98,15 +98,6 @@
9999
100100 See mwlib_ for possible other writers.
101101
102 - *$wgCollectionStartPage (string)*
103 - Title of a page that is displayed when a user clicks on "Start collection",
104 - i.e. is using the Collection extension "for the first time" (actually it's
105 - not necessarily the first time, because it can be turned off again on the
106 - Special:Collection page). If the page does not exist, a (short) fallback
107 - page is displayed which essentially links to the Help:Collections page.
108 -
109 - Default is 'Start collection'.
110 -
111102 *$wgCommunityCollectionNamespace (integer)*
112103 Namespace for "community collections", i.e. the namespace where non-personal
113104 article collection pages are saved.
Index: trunk/extensions/Collection/Collection.body.php
@@ -55,15 +55,7 @@
5656
5757 wfLoadExtensionMessages( 'Collection' );
5858
59 - if ( $par == 'start_collection/' ) {
60 - $art_url = $wgRequest->getVal( 'arttitle', '' );
61 - $oldid = $wgRequest->getInt( 'oldid', 0 );
62 - $art_title = Title::newFromURL( $art_url );
63 - $cat_url = $wgRequest->getVal( 'cattitle', '' );
64 - $cat_title = Title::makeTitleSafe( NS_CATEGORY, $cat_url );
65 - $this->startCollection( $art_title, $olid, $cat_title );
66 - return;
67 - } else if ( $par == 'add_article/' ) {
 59+ if ( $par == 'add_article/' ) {
6860 if ( self::countArticles() >= $wgCollectionMaxArticles ) {
6961 $this->limitExceeded();
7062 return;
@@ -171,12 +163,6 @@
172164 $this->outputSaveOverwrite( $title );
173165 }
174166 return;
175 - } else if ( $par == 'disable_collection/' ) {
176 - if ( self::hasSession() ) {
177 - unset( $_SESSION['wsCollection'] );
178 - }
179 - $mp = Title::newFromText( wfMsgNoDB( "mainpage" ) );
180 - $wgOut->redirect( $mp->getFullURL() );
181167 } else if ( $par == 'render/' ) {
182168 $title = $wgRequest->getVal( 'downloadTitle', '' );
183169 if ( $title ) {
@@ -219,7 +205,6 @@
220206 $this->outputBookSection();
221207 $this->outputDownloadSection();
222208 $this->outputSaveSection();
223 - $this->outputDisableSection();
224209 $this->outputIntro();
225210 $this->outputArticleList();
226211 }
@@ -284,68 +269,6 @@
285270 return -1;
286271 }
287272
288 - function startCollection( $title, $oldid, $cat_title ) {
289 - global $wgOut;
290 - global $wgCollectionStartPage;
291 -
292 - if ( !self::hasSession() ) {
293 - self::startSession();
294 - }
295 -
296 - $wgOut->setPageTitle( wfMsg( 'coll-collection' ) );
297 -
298 - if ( !is_null( $title ) or !is_null( $cat_title ) ) {
299 - if ( !is_null( $title ) ) {
300 - $params = 'arttitle=' . $title->getPrefixedURL();
301 - if ( $oldid ) {
302 - $params .= '&oldid=' . $oldid;
303 - }
304 - $addLinkURL = htmlspecialchars( wfAppendQuery( SkinTemplate::makeSpecialUrlSubpage(
305 - 'Collection',
306 - 'add_article/'
307 - ), $params ) );
308 - $addLinkLabel = wfMsg( "coll-start_add_page_text", $title->getPrefixedText() );
309 - } else {
310 - $params = 'cattitle=' . $cat_title->getPartialURL();
311 - $addLinkURL = htmlspecialchars( wfAppendQuery( SkinTemplate::makeSpecialUrlSubpage(
312 - 'Collection',
313 - 'add_category/'
314 - ), $params ) );
315 - $addLinkLabel = wfMsg( "coll-start_add_category_text", $link );
316 - }
317 - //$addLinkLabel = wfMsg( "coll-start_add_link", $title->getPrefixedText() );
318 - $wgOut->addHTML( <<<EOS
319 -<table align="center" margin-bottom: 10px;" class="toccolours" width="50%">
320 - <tr>
321 - <td align="center">
322 - <a href="$addLinkURL" rel="nofollow"><strong>$addLinkLabel</strong></a><br/>
323 - </td>
324 - </tr>
325 -</table>
326 -EOS
327 - );
328 - }
329 -
330 - $fallback = true;
331 - $startPageTitle = Title::newFromText( $wgCollectionStartPage );
332 - if ( !is_null( $startPageTitle ) ) {
333 - $startPage = new Article( $startPageTitle );
334 - if ( $startPage->exists() ) {
335 - $wgOut->addWikiText( "{{:$wgCollectionStartPage}}" );
336 - $fallback = false;
337 - }
338 - }
339 - if ( $fallback ) {
340 - $wgOut->addWikiText( wfMsg( 'coll-start_text' ) );
341 - }
342 -
343 - if ( $title ) {
344 - $wgOut->addWikiText( wfMsg( 'coll-return_to', $title->getPrefixedText() ) );
345 - } else if ( $cat_title ) {
346 - $wgOut->addWikiText( wfMsg( 'coll-return_to', $cat_title->getPrefixedText() ) );
347 - }
348 - }
349 -
350273 function addArticle( $title, $oldid=0 ) {
351274 $article = new Article( $title, $oldid );
352275 $latest = $article->getLatest();
@@ -1018,14 +941,6 @@
1019942 $this->outputBox( $html );
1020943 }
1021944
1022 - private function outputDisableSection() {
1023 - $html = '<p>' . wfMsg(
1024 - 'coll-disable_collection_text',
1025 - htmlspecialchars( SkinTemplate::makeSpecialUrlSubpage( 'Collection', 'disable_collection/' ) )
1026 - ) . '</p>';
1027 - $this->outputBox( $html );
1028 - }
1029 -
1030945 private function outputSaveOverwrite( $title ) {
1031946 global $wgOut;
1032947
@@ -1268,35 +1183,8 @@
12691184 'load_collection/'
12701185 ), $params ) );
12711186 $out .= "<li><a href=\"$href\" rel=\"nofollow\">$loadCollection</a></li>";
1272 - } else if ( !self::hasSession() ) {
1273 - $startURL = SkinTemplate::makeSpecialUrlSubpage(
1274 - 'Collection',
1275 - 'start_collection/'
1276 - );
1277 - if ( $wgRequest->getRequestURL() == $startURL ) {
1278 - return;
1279 - }
1280 - $params = null;
1281 - if ( !is_null($wgArticle) && $wgArticle->exists() ) {
1282 - if ( $wgTitle->getNamespace() == NS_MAIN ) { // TODO: only NS_MAIN?
1283 - $params = "arttitle=" . $wgTitle->getPrefixedUrl()
1284 - . "&oldid=" . $wgArticle->getOldID();
1285 - } else if ( $wgTitle->getNamespace() == NS_CATEGORY ) {
1286 - $params = "cattitle=" . $wgTitle->getPartialURL();
1287 - }
1288 - }
1289 - $startURL = SkinTemplate::makeSpecialUrlSubpage(
1290 - 'Collection',
1291 - 'start_collection/'
1292 - );
1293 - if ( $params ) {
1294 - $startURL = wfAppendQuery( $startURL, $params );
1295 - }
1296 - $startURL = htmlspecialchars( $startURL );
1297 - $startLabel = 'Start collection';
1298 - $out .= "<li><a href=\"$startURL\">$startLabel</a></li>";
12991187 } else {
1300 -
 1188+
13011189 // disable caching
13021190 $wgOut->setSquidMaxage( 0 );
13031191 $wgOut->enableClientCache( false );