r63597 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63596‎ | r63597 | r63598 >
Date:12:03, 11 March 2010
Author:jojo
Status:deferred
Tags:
Comment:
backport merge from trunk up to rr63596
Modified paths:
  • /branches/REL1_16/extensions/Collection (modified) (history)
  • /branches/REL1_16/extensions/Collection/Collection.body.php (modified) (history)
  • /branches/REL1_16/extensions/Collection/Collection.hooks.php (modified) (history)
  • /branches/REL1_16/extensions/Collection/Collection.i18n.php (modified) (history)
  • /branches/REL1_16/extensions/Collection/Collection.php (modified) (history)
  • /branches/REL1_16/extensions/Collection/Collection.session.php (modified) (history)
  • /branches/REL1_16/extensions/Collection/CollectionCore.i18n.php (modified) (history)
  • /branches/REL1_16/extensions/Collection/js/bookcreator.js (modified) (history)
  • /branches/REL1_16/extensions/Collection/js/collection.js (modified) (history)

Diff [purge]

Index: branches/REL1_16/extensions/Collection/Collection.i18n.php
@@ -4526,6 +4526,8 @@
45274527 'coll-rendering_status' => '<strong>Állapot:</strong> $1',
45284528 'coll-rendering_article' => '(lap: $1)',
45294529 'coll-rendering_page' => '(oldal: $1)',
 4530+ 'coll-rendering_page_info_text_article' => '{{MediaWiki:Coll-helppage}}/Lap információinak renderelése',
 4531+ 'coll-rendering_collection_info_text_article' => '{{MediaWiki:Coll-helppage}}/Gyűjtemény információinak renderelése',
45304532 'coll-rendering_finished_title' => 'A renderelés befejeződött',
45314533 'coll-rendering_finished_text' => '<strong>A dokumentum ekészült.</strong>
45324534 <strong>[$1 Fájl letöltése]</strong> a számítógépedre.
@@ -4732,12 +4734,12 @@
47334735 'coll-error_reponse' => 'Responsa de error ab servitor',
47344736 'coll-empty_collection' => 'Libro vacue',
47354737 'coll-revision' => 'Version: $1',
4736 - 'coll-save_collection_title' => 'Immagazinar tu libro pro uso in commun',
 4738+ 'coll-save_collection_title' => 'Salveguardar e condivider tu libro',
47374739 'coll-save_collection_text' => 'Selige un location:',
4738 - 'coll-login_to_save' => 'Si tu vole immagazinar libros pro uso futur, per favor [[Special:UserLogin|aperi un session o crea un conto]].',
 4740+ 'coll-login_to_save' => 'Si tu vole salveguardar libros pro uso futur, per favor [[Special:UserLogin|aperi un session o crea un conto]].',
47394741 'coll-personal_collection_label' => 'Libro personal:',
47404742 'coll-community_collection_label' => 'Libro communitari:',
4741 - 'coll-save_collection' => 'Immagazinar libro',
 4743+ 'coll-save_collection' => 'Salveguardar libro',
47424744 'coll-save_category' => 'Tote le libros immagazinate es addite al categoria [[:Category:{{MediaWiki:Coll-bookscategory}}|{{MediaWiki:Coll-bookscategory}}]].',
47434745 'coll-overwrite_title' => 'Le pagina existe ja.
47444746 Superscriber lo?',
@@ -4810,8 +4812,8 @@
48114813 'coll-suggest_article_remove' => 'Le pagina <strong>$1</strong> ha essite removite de tu libro ($2).',
48124814 'coll-suggest_undo_tooltip' => 'Disfacer iste action',
48134815 'coll-suggest_undo' => 'disfacer',
4814 - 'right-collectionsaveasuserpage' => 'Immagazinar libros como pagina de usator',
4815 - 'right-collectionsaveascommunitypage' => 'Immagazinar libros como pagina de communitate',
 4816+ 'right-collectionsaveasuserpage' => 'Salveguardar libros como pagina de usator',
 4817+ 'right-collectionsaveascommunitypage' => 'Salveguardar libros como pagina de communitate',
48164818 );
48174819
48184820 /** Indonesian (Bahasa Indonesia)
@@ -5381,12 +5383,15 @@
53825384 * @author გიორგიმელა
53835385 */
53845386 $messages['ka'] = array(
 5387+ 'coll-desc' => '[[Special:Book|წიგნის შექმნა]]',
 5388+ 'coll-book_creator_help' => 'მეტი ინფორმაციისათვის იხილეთ [[{{MediaWiki:Coll-helppage}}|დახმარების გვერდი წიგნებზე]].',
53855389 'coll-collection' => 'წიგნი',
53865390 'coll-collections' => 'წიგნები',
53875391 'coll-print_template_prefix' => 'დაბეჭვდა',
53885392 'coll-print_template_pattern' => '$1/დაბეჭვდა',
53895393 'coll-unknown_subpage_title' => 'უცნობი ქვეგვერდი',
53905394 'coll-unknown_subpage_text' => '[[Special:Book|წიგნის]] ეს ქვეგვერდები არ არსებობს',
 5395+ 'coll-couldnotaddarticle_title' => 'შეუძლებელია ვიკი-გვერდის დამატება',
53915396 'coll-your_book' => 'თქვენი წიგნი',
53925397 'coll-download_title' => 'ჩამოტვირთვა',
53935398 'coll-download' => 'ჩამოტვირთვა',
@@ -5473,6 +5478,7 @@
54745479 'coll-order_info_article' => '{{MediaWiki:Coll-helppage}}/ინფორმაცია PediaPress-ის შეკვვეთაზე',
54755480 'coll-suggest_add_selected' => 'არჩეული გვერდების დამატება',
54765481 'coll-suggest_your_book' => 'თქვენი წიგნი',
 5482+ 'coll-suggest_show' => 'ჩვენება',
54775483 'coll-suggest_undo' => 'გაუქმება',
54785484 'right-collectionsaveasuserpage' => 'შეინახე წიგნი, როგორც მომხმარებლის გვერდი',
54795485 'right-collectionsaveascommunitypage' => 'შეინახეთ წიგნი, როგორც საზოგადოების გვერდი',
@@ -6329,7 +6335,7 @@
63306336 'coll-save_collection' => 'പുസ്തകം സേവ് ചെയ്യുക',
63316337 'coll-save_category' => 'സേവ് ചെയ്ത പുസ്തകങ്ങളെല്ലാം [[:Category:{{MediaWiki:Coll-bookscategory}}|{{MediaWiki:Coll-bookscategory}}]] വർഗ്ഗത്തിലേയ്ക്ക് ചേർത്തിരിക്കുന്നു.',
63326338 'coll-overwrite_title' => 'താള്‍ നിലവിലുണ്ട്. അതിനെ ഓവര്‍റൈറ്റ് ചെയ്യട്ടെ?',
6333 - 'coll-overwrite_text' => '[[:$1]] എന്ന പേരില്‍ ഒരു താള്‍ നിലവിലുണ്ട്. താങ്കളുടെ ശേഖരം ആ താളിനു ബദലാക്കണോ?',
 6339+ 'coll-overwrite_text' => '[[:$1]] എന്ന പേരില്‍ ഒരു താള്‍ നിലവിലുണ്ട്. താങ്കളുടെ പുസ്തകം ആ താളിനു ബദലാക്കണോ?',
63346340 'coll-yes' => 'ശരി',
63356341 'coll-no' => 'ഇല്ല',
63366342 'coll-load_overwrite_text' => 'താങ്കളുടെ പുസ്തകത്തില്‍ ഇപ്പോള്‍ തന്നെ കുറച്ചു താളുകള്‍ ഉണ്ട്.
@@ -7708,7 +7714,7 @@
77097715 'coll-exclusion_category_title' => 'Excluir ao imprimir',
77107716 'coll-print_template_prefix' => 'Imprime',
77117717 'coll-print_template_pattern' => '$1/Imprimir',
7712 - 'coll-unknown_subpage_title' => 'Sub-página desconhecida',
 7718+ 'coll-unknown_subpage_title' => 'Subpágina desconhecida',
77137719 'coll-unknown_subpage_text' => 'Não existe esta sub-página do [[Special:Book|Livro]]',
77147720 'coll-couldnotaddarticle_title' => 'Não foi possível adicionar a página wiki',
77157721 'coll-couldnotaddarticle_msg' => 'A página wiki não pode ser adicionada.',
Index: branches/REL1_16/extensions/Collection/Collection.php
@@ -111,7 +111,6 @@
112112 'version' => $wgCollectionVersion,
113113 'author' => array( 'PediaPress GmbH', 'Siebrand Mazeland' ),
114114 'url' => 'http://www.mediawiki.org/wiki/Extension:Collection',
115 - 'description' => 'Create books',
116115 'descriptionmsg' => 'coll-desc',
117116 );
118117
@@ -280,6 +279,29 @@
281280
282281 $wgAjaxExportList[] = 'wfAjaxCollectionClear';
283282
 283+function wfAjaxCollectionGetPopupData( $title ) {
 284+ global $wgScriptPath;
 285+
 286+ wfLoadExtensionMessages( 'CollectionCore' );
 287+ $json = new Services_JSON();
 288+ $result = array();
 289+ $imagePath = "$wgScriptPath/extensions/Collection/images";
 290+ if ( CollectionSession::findArticle( $title ) == -1 ) {
 291+ $result['action'] = 'add';
 292+ $result['text'] = wfMsg( 'coll-add_linked_article' );
 293+ $result['img'] = "$imagePath/silk-add.png";
 294+ } else {
 295+ $result['action'] = 'remove';
 296+ $result['text'] = wfMsg( 'coll-remove_linked_article' );
 297+ $result['img'] = "$imagePath/silk-remove.png";
 298+ }
 299+ $r = new AjaxResponse( $json->encode( $result ) );
 300+ $r->setContentType( 'application/json' );
 301+ return $r;
 302+}
 303+
 304+$wgAjaxExportList[] = 'wfAjaxCollectionGetPopupData';
 305+
284306 /**
285307 * Backend of several following SAJAX function handlers...
286308 * @param String $action provided by the specific handlers internally
Index: branches/REL1_16/extensions/Collection/Collection.hooks.php
@@ -240,6 +240,7 @@
241241 global $wgCollectionStyleVersion;
242242 global $wgCollectionVersion;
243243 global $wgJsMimeType;
 244+ global $wgOut;
244245 global $wgScriptPath;
245246 global $wgTitle;
246247 global $wgUser;
@@ -259,8 +260,21 @@
260261 $oldid = 0;
261262 }
262263 }
 264+
263265 $html = '';
264266
 267+ if ( method_exists( $wgOut, 'includeJQuery' ) ) {
 268+ $wgOut->includeJQuery();
 269+ } else {
 270+ $html .= Xml::element( 'script',
 271+ array(
 272+ 'type' => $wgJsMimeType,
 273+ 'src' => "$jsPath/jquery.js?$wgCollectionStyleVersion",
 274+ ),
 275+ '', false
 276+ );
 277+ }
 278+
265279 $html .= Xml::element( 'script',
266280 array(
267281 'type' => $wgJsMimeType,
@@ -268,6 +282,21 @@
269283 ),
270284 '', false
271285 );
 286+ $html .= Xml::element( 'style',
 287+ array( 'type' => 'text/css' ),
 288+ <<<EOS
 289+#collectionpopup {
 290+ position: absolute;
 291+ padding: 4px;
 292+ border: 1px solid #000;
 293+ background-color: #fea;
 294+ z-index: 9999;
 295+ display: inline;
 296+ font-size: 10pt;
 297+}
 298+EOS
 299+ , false
 300+ );
272301
273302 $addRemoveState = $mode;
274303
Index: branches/REL1_16/extensions/Collection/Collection.session.php
@@ -105,4 +105,31 @@
106106 }
107107 return -1;
108108 }
 109+
 110+ static function purge() {
 111+ $coll = $_SESSION['wsCollection'];
 112+ $newitems = array();
 113+ foreach ( $coll['items'] as $index => $item ) {
 114+ if ( $item['type'] == 'article' ) {
 115+ $t = Title::newFromText( $item['title'] );
 116+ if ( $t->exists() ) {
 117+ $newitems[] = $item;
 118+ }
 119+ } else {
 120+ $newitems[] = $item;
 121+ }
 122+ }
 123+ $coll['items'] = $newitems;
 124+ $_SESSION['wsCollection'] = $coll;
 125+ }
 126+
 127+ static function getCollection() {
 128+ self::purge();
 129+ return $_SESSION['wsCollection'];
 130+ }
 131+
 132+ static function setCollection($collection) {
 133+ $_SESSION['wsCollection'] = $collection;
 134+ self::touchSession();
 135+ }
109136 }
Index: branches/REL1_16/extensions/Collection/CollectionCore.i18n.php
@@ -36,6 +36,8 @@
3737 'coll-disable' => 'disable',
3838 'coll-book_creator_disable' => 'Disable book creator',
3939 'coll-book_creator_disable_tooltip' => 'Stop using the book creator',
 40+ 'coll-add_linked_article' => 'Add linked wiki page to your book',
 41+ 'coll-remove_linked_article' => 'Remove linked wiki page from your book',
4042 'coll-add_category' => 'Add this category to your book',
4143 'coll-add_category_tooltip' => 'Add all wiki pages in this category to your book',
4244 'coll-add_this_page' => 'Add this page to your book',
@@ -233,6 +235,8 @@
234236 'coll-disable' => 'выключыць',
235237 'coll-book_creator_disable' => 'Выключыць майстра стварэньня кнігі',
236238 'coll-book_creator_disable_tooltip' => 'Спыніць выкарыстаньне майстра стварэньня кнігі',
 239+ 'coll-add_linked_article' => 'Дадаць зьвязаную вікі-старонку ў Вашу кнігу',
 240+ 'coll-remove_linked_article' => 'Выдаліць зьвязаную вікі-старонку з Вашай кнігі',
237241 'coll-add_category' => 'Дадаць гэтую катэгорыю ў Вашую кнігу',
238242 'coll-add_category_tooltip' => 'Дадаць усе старонкі з гэтай катэгорыі ў Вашую кнігу',
239243 'coll-add_this_page' => 'Дадаць гэтую старонку ў Вашую кнігу',
@@ -1088,6 +1092,8 @@
10891093 'coll-disable' => 'deaktiviere',
10901094 'coll-book_creator_disable' => 'Buechgenerator deaktiviere',
10911095 'coll-book_creator_disable_tooltip' => 'Buechgenerator nit bruche',
 1096+ 'coll-add_linked_article' => 'Fieg e vergleichti Wikisyte in Dyy Buech yy',
 1097+ 'coll-remove_linked_article' => 'Nimm e vergleichti Wikisyte us Dyym Buech uuse',
10921098 'coll-add_category' => 'Die Kategorii zue Dyym Buech dezuefiege',
10931099 'coll-add_category_tooltip' => 'Alli Wikisyte in däre Kategorii in Dyy Buech yyfiege',
10941100 'coll-add_this_page' => 'Die Syte zue Dyym Buech zuefiege',
@@ -1320,6 +1326,8 @@
13211327 'coll-disable' => 'disactivar',
13221328 'coll-book_creator_disable' => 'Disactivar le creator de libros',
13231329 'coll-book_creator_disable_tooltip' => 'Cessar de usar le creator de libros',
 1330+ 'coll-add_linked_article' => 'Adder le pagina $1 a tu libro',
 1331+ 'coll-remove_linked_article' => 'Remover le pagina $1 de tu libro',
13241332 'coll-add_category' => 'Adder iste categoria a tu libro',
13251333 'coll-add_category_tooltip' => 'Adder tote le paginas wiki in iste categoria a tu libro',
13261334 'coll-add_this_page' => 'Adder iste pagina a tu libro',
@@ -1763,7 +1771,7 @@
17641772 */
17651773 $messages['ml'] = array(
17661774 'coll-print_export' => 'അച്ചടിയ്ക്കുക/കയറ്റുമതി ചെയ്യുക',
1767 - 'coll-create_a_book' => 'എന്റെ ശേഖരം',
 1775+ 'coll-create_a_book' => 'പുസ്തകം സൃഷ്ടിക്കുക',
17681776 'coll-create_a_book_tooltip' => 'ഒരു പുസ്തകം അല്ലെങ്കിൽ താളുകളുടെ ശേഖരം സൃഷ്ടിക്കുക',
17691777 'coll-book_creator' => 'പുസ്തക സൃഷ്ടി ഉപകരണം',
17701778 'coll-download_as' => '$1 ആയി ഡൗൺലോഡ് ചെയ്യുക',
@@ -1771,6 +1779,8 @@
17721780 'coll-disable' => 'നിർജീവമാക്കുക',
17731781 'coll-book_creator_disable' => 'പുസ്തക സൃഷ്ടി ഉപകരണം നിർജീവമാക്കുക',
17741782 'coll-book_creator_disable_tooltip' => 'പുസ്തക സൃഷ്ടി ഉപകരണം ഉപയോഗിക്കുന്നതു നിർത്തുക',
 1783+ 'coll-add_linked_article' => 'താങ്കളുടെ പുസ്തകത്തിൽ കണ്ണിയുള്ള വിക്കിതാൾ കൂട്ടിച്ചേർക്കുക',
 1784+ 'coll-remove_linked_article' => 'താങ്കളുടെ പുസ്തകത്തിൽനിന്നും കണ്ണിചേർക്കപ്പെട്ട വിക്കിതാൾ നീക്കംചെയ്യുക',
17751785 'coll-add_category' => 'താങ്കളുടെ പുസ്തകത്തിൽ ഈ വര്‍ഗ്ഗം ചേര്‍ക്കുക',
17761786 'coll-add_category_tooltip' => 'ഈ വർഗ്ഗത്തിലുള്ള എല്ലാ വിക്കി താളുകളും താങ്കളുടെ പുസ്തകത്തിലേയ്ക്ക് കൂട്ടിച്ചേർക്കുക',
17771787 'coll-add_this_page' => 'ഈ താൾ താങ്കളുടെ പുസ്തകത്തിലേയ്ക്ക് കൂട്ടിച്ചേർക്കുക',
Index: branches/REL1_16/extensions/Collection/js/bookcreator.js
@@ -21,23 +21,22 @@
2222
2323 (function() {
2424
 25+var $ = window.$;
 26+if (typeof $ == 'undefined') {
 27+ $ = jQuery;
 28+}
 29+
2530 function refreshBookCreatorBox(hint, oldid) {
2631 sajax_request_type = 'GET';
2732 sajax_do_call('wfAjaxCollectionGetBookCreatorBoxContent', [hint, oldid], function(xhr) {
28 - document.getElementById('coll-book_creator_box').innerHTML = xhr.responseText;
29 - if (hint && typeof wgCollectionAddRemoveState != 'undefined') {
30 - wgCollectionAddRemoveState = hint;
31 - }
32 - if (typeof refreshCollectionArticleList == 'function') {
33 - refreshCollectionArticleList();
34 - }
 33+ $('#coll-book_creator_box').html(xhr.responseText);
3534 });
3635 }
3736
3837 function collectionCall(func, args) {
3938 var hint = args.shift();
4039 sajax_request_type = 'POST';
41 - sajax_do_call('wfAjaxCollection' + func, args, function(xhr) {
 40+ sajax_do_call('wfAjaxCollection' + func, args, function() {
4241 var oldid = null;
4342 if (args.length == 3) {
4443 oldid = args[2];
@@ -48,4 +47,134 @@
4948
5049 window.collectionCall = collectionCall; // public
5150
 51+
 52+var mouse_pos = {};
 53+var popup_div = null;
 54+var addremove_link = null;
 55+var visible = false;
 56+var show_soon_timeout = null;
 57+var get_data_xhr = null;
 58+var script_url = wgServer + ((wgScript == null) ? (wgScriptPath + "/index.php") : wgScript);
 59+var current_link = null;
 60+var title = null;
 61+
 62+function createDiv() {
 63+ addremove_link = $('<a href="javascript:void(0)" />');
 64+ popup_div = $('<div id="collectionpopup" />');
 65+ popup_div.append(addremove_link)
 66+ $('body').append(popup_div);
 67+ popup_div.hide();
 68+}
 69+
 70+function addremove_article(action, title) {
 71+ $.post(script_url, {
 72+ 'action': 'ajax',
 73+ 'rs': 'wfAjaxCollection' + action.charAt(0).toUpperCase() + action.slice(1) + 'Article',
 74+ 'rsargs[]': [0, title, '']
 75+ }, function() {
 76+ hide();
 77+ refreshBookCreatorBox(null, null);
 78+ });
 79+}
 80+
 81+function show(link) {
 82+ if (visible) {
 83+ return;
 84+ }
 85+ current_link = link;
 86+ title = link.attr('title');
 87+ link.attr('title', ''); // disable default browser tooltip
 88+ show_soon_timeout = setTimeout(function() {
 89+ get_data_xhr = $.post(script_url, {
 90+ 'action': 'ajax',
 91+ 'rs': 'wfAjaxCollectionGetPopupData',
 92+ 'rsargs[]': [title]
 93+ }, function(result) {
 94+ visible = true;
 95+ var img = $('<img />').attr({src: result.img, alt: ''});
 96+ addremove_link
 97+ .text('\u00a0' + result.text)
 98+ .prepend(img)
 99+ .unbind('click')
 100+ .click(function(e) { addremove_article(result.action, title); });
 101+ popup_div
 102+ .css({left: mouse_pos.x + 2 + 'px',
 103+ top: mouse_pos.y + 2 + 'px'})
 104+ .show();
 105+ }, 'json');
 106+ }, 300);
 107+}
 108+
 109+function cancel() {
 110+ if (current_link && title) {
 111+ current_link.attr('title', title);
 112+ }
 113+ if (show_soon_timeout) {
 114+ clearTimeout(show_soon_timeout);
 115+ show_soon_timeout = null;
 116+ }
 117+ if (get_data_xhr) {
 118+ get_data_xhr.abort();
 119+ get_data_xhr = null;
 120+ }
 121+}
 122+
 123+function hide() {
 124+ cancel();
 125+ if (!visible) {
 126+ return;
 127+ }
 128+ visible = false;
 129+ popup_div.hide();
 130+}
 131+
 132+function is_inside(x, y, left, top, width, height) {
 133+ var fuzz = 5;
 134+ return x + fuzz >= left && x - fuzz <= left + width
 135+ && y + fuzz >= top && y - fuzz <= top + height;
 136+}
 137+
 138+function check_popup_hide() {
 139+ if (!visible) {
 140+ return;
 141+ }
 142+ var pos = popup_div.offset();
 143+ if (!is_inside(mouse_pos.x, mouse_pos.y,
 144+ pos.left, pos.top, popup_div.width(), popup_div.height())) {
 145+ hide();
 146+ }
 147+}
 148+
 149+$(function() {
 150+ $(document).mousemove(function(e) {
 151+ mouse_pos.x = e.pageX;
 152+ mouse_pos.y = e.pageY;
 153+ });
 154+ setInterval(check_popup_hide, 300);
 155+ createDiv();
 156+ var prefix = wgArticlePath.replace(/\$1/, '');
 157+ $('#bodyContent '
 158+ + 'a[href^=' + prefix + ']' // URL starts with prefix of wgArticlePath
 159+ + ':not(a[href~=index.php])' // URL doesn't contain index.php (simplification!)
 160+ + '[title!=]' // title attribute is not empty
 161+ + '[rel!=nofollow]'
 162+ + ':not(.external)'
 163+ + ':not(.sortheader)'
 164+ + ':not([accesskey])'
 165+ + ':not(.nopopup)'
 166+ ).each(function(i, link) {
 167+ if (this.onmousedown) {
 168+ return;
 169+ }
 170+ var $this = $(this);
 171+ if ($this.attr('title').indexOf(':') != -1) { // title doesn't contain ":" (simplification!)
 172+ return;
 173+ }
 174+ if ($this.parents('.nopopups').length) {
 175+ return;
 176+ }
 177+ $this.hover(function() { show($this); }, cancel);
 178+ });
 179+});
 180+
52181 })();
Index: branches/REL1_16/extensions/Collection/js/collection.js
@@ -145,7 +145,7 @@
146146 if (!jQuery('#saveButton').length) {
147147 return;
148148 }
149 - if (jQuery('#emptyCollection').length) {
 149+ if (jQuery('#collectionList .article').length == 0) {
150150 jQuery('#saveButton').attr('disabled', 'disabled');
151151 return;
152152 }
@@ -181,7 +181,7 @@
182182 jQuery('#collectionListContainer').html(xhr.responseText);
183183 jQuery('.makeVisible').css('display', 'inline');
184184 make_sortable();
185 - if (jQuery('#emptyCollection').length) {
 185+ if (jQuery('#collectionList .article').length == 0) {
186186 jQuery('#downloadButton').attr('disabled', 'disabled');
187187 jQuery('input.order').attr('disabled', 'disabled');
188188 } else {
Index: branches/REL1_16/extensions/Collection/Collection.body.php
@@ -185,7 +185,7 @@
186186 $collection = $this->loadCollection( $title, $wgRequest->getVal( 'append' ) );
187187 if ( $collection ) {
188188 CollectionSession::startSession();
189 - $_SESSION['wsCollection'] = $collection;
 189+ CollectionSession::setCollection( $collection );
190190 CollectionSession::enable();
191191 $wgOut->redirect( SkinTemplate::makeSpecialUrl( 'Book' ) );
192192 }
@@ -240,7 +240,7 @@
241241 return;
242242 case 'render':
243243 return $this->renderCollection(
244 - $_SESSION['wsCollection'],
 244+ CollectionSession::getCollection(),
245245 Title::newFromText( $wgContLang->specialPage( 'Book' ) ),
246246 $wgRequest->getVal( 'writer', '' )
247247 );
@@ -273,7 +273,7 @@
274274 return;
275275 case 'post_zip':
276276 $partner = $wgRequest->getVal( 'partner', 'pediapress' );
277 - $this->postZIP( $_SESSION['wsCollection'], $partner );
 277+ $this->postZIP( CollectionSession::getCollection(), $partner );
278278 return;
279279 case 'suggest':
280280 $add = $wgRequest->getVal( 'add' );
@@ -515,7 +515,7 @@
516516 $wgOut->addScript( "<script type=\"$wgJsMimeType\" src=\"$jspath/collection.js?$wgCollectionStyleVersion\"></script>" );
517517
518518 $template = new CollectionPageTemplate();
519 - $template->set( 'collection', $_SESSION['wsCollection'] );
 519+ $template->set( 'collection', CollectionSession::getCollection() );
520520 $template->set( 'podpartners', $this->mPODPartners );
521521 $template->set( 'formats', $wgCollectionFormats);
522522 $prefixes = self::getBookPagePrefixes();
@@ -525,11 +525,10 @@
526526 }
527527
528528 static function setTitles( $title, $subtitle ) {
529 - $collection = $_SESSION['wsCollection'];
 529+ $collection = CollectionSession::getCollection();
530530 $collection['title'] = $title;
531531 $collection['subtitle'] = $subtitle;
532 - $_SESSION['wsCollection'] = $collection;
533 - CollectionSession::touchSession();
 532+ CollectionSession::setCollection( $collection );
534533 }
535534
536535 static function title_cmp($a, $b) {
@@ -537,7 +536,7 @@
538537 }
539538
540539 static function sortItems() {
541 - $collection = $_SESSION['wsCollection'];
 540+ $collection = CollectionSession::getCollection();
542541 $articles = array();
543542 $new_items = array();
544543 foreach ( $collection['items'] as $item ) {
@@ -551,31 +550,28 @@
552551 }
553552 usort( $articles, array( __CLASS__, 'title_cmp' ) );
554553 $collection['items'] = array_merge( $new_items, $articles );
555 - $_SESSION['wsCollection'] = $collection;
556 - CollectionSession::touchSession();
 554+ CollectionSession::setCollection( $collection );
557555 }
558556
559557 static function addChapter( $name ) {
560 - $collection = $_SESSION['wsCollection'];
 558+ $collection = CollectionSession::getCollection();
561559 array_unshift( $collection['items'], array(
562560 'type' => 'chapter',
563561 'title' => $name,
564562 ) );
565 - $_SESSION['wsCollection'] = $collection;
566 - CollectionSession::touchSession();
 563+ CollectionSession::setCollection( $collection );
567564 }
568565
569566 static function renameChapter( $index, $name ) {
570567 if (!is_int( $index ) ) {
571568 return;
572569 }
573 - $collection = $_SESSION['wsCollection'];
 570+ $collection = CollectionSession::getCollection();
574571 if ( $collection['items'][$index]['type'] != 'chapter' ) {
575572 return;
576573 }
577574 $collection['items'][$index]['title'] = $name;
578 - $_SESSION['wsCollection'] = $collection;
579 - CollectionSession::touchSession();
 575+ CollectionSession::setCollection( $collection );
580576 }
581577
582578 static function addArticleFromName( $namespace, $name, $oldid=0 ) {
@@ -601,7 +597,7 @@
602598 if ( !CollectionSession::hasSession() ) {
603599 CollectionSession::startSession();
604600 }
605 - $collection = $_SESSION['wsCollection'];
 601+ $collection = CollectionSession::getCollection();
606602 $revision = Revision::newFromTitle( $title, $oldid );
607603 $collection['items'][] = array(
608604 'type' => 'article',
@@ -613,8 +609,7 @@
614610 'url' => $title->getFullURL(),
615611 'currentVersion' => $currentVersion,
616612 );
617 - $_SESSION['wsCollection'] = $collection;
618 - CollectionSession::touchSession();
 613+ CollectionSession::setCollection( $collection );
619614 return true;
620615 }
621616
@@ -627,13 +622,12 @@
628623 if ( !CollectionSession::hasSession() ) {
629624 return false;
630625 }
631 - $collection = $_SESSION['wsCollection'];
 626+ $collection = CollectionSession::getCollection();
632627 $index = CollectionSession::findArticle( $title->getPrefixedText(), $oldid );
633628 if ( $index != -1 ) {
634629 array_splice( $collection['items'], $index, 1 );
635630 }
636 - $_SESSION['wsCollection'] = $collection;
637 - CollectionSession::touchSession();
 631+ CollectionSession::setCollection( $collection );
638632 return true;
639633 }
640634
@@ -697,10 +691,9 @@
698692 if ( !CollectionSession::hasSession() ) {
699693 return false;
700694 }
701 - $collection = $_SESSION['wsCollection'];
 695+ $collection = CollectionSession::getCollection();
702696 array_splice( $collection['items'], $index, 1 );
703 - $_SESSION['wsCollection'] = $collection;
704 - CollectionSession::touchSession();
 697+ CollectionSession::setCollection( $collection );
705698 return true;
706699 }
707700
@@ -708,12 +701,11 @@
709702 if ( !CollectionSession::hasSession() ) {
710703 return false;
711704 }
712 - $collection = $_SESSION['wsCollection'];
 705+ $collection = CollectionSession::getCollection();
713706 $saved = $collection['items'][$index + $delta];
714707 $collection['items'][$index + $delta] = $collection['items'][$index];
715708 $collection['items'][$index] = $saved;
716 - $_SESSION['wsCollection'] = $collection;
717 - CollectionSession::touchSession();
 709+ CollectionSession::setCollection( $collection );
718710 return true;
719711 }
720712
@@ -721,15 +713,14 @@
722714 if ( !CollectionSession::hasSession() ) {
723715 return;
724716 }
725 - $collection = $_SESSION['wsCollection'];
 717+ $collection = CollectionSession::getCollection();
726718 $old_items = $collection['items'];
727719 $new_items = array();
728720 foreach ($items as $new_index => $old_index) {
729721 $new_items[$new_index] = $old_items[$old_index];
730722 }
731723 $collection['items'] = $new_items;
732 - $_SESSION['wsCollection'] = $collection;
733 - CollectionSession::touchSession();
 724+ CollectionSession::setCollection( $collection );
734725 }
735726
736727 function parseCollectionLine( &$collection, $line, $append ) {
@@ -808,8 +799,7 @@
809800 return;
810801 }
811802
812 - $article = new Article( $title );
813 - if ( !$article->exists() ) {
 803+ if ( !$title->exists() ) {
814804 $wgOut->showErrorPage( 'coll-notfound_title', 'coll-notfound_msg' );
815805 return false;
816806 }
@@ -821,7 +811,7 @@
822812 );
823813 $items = array();
824814 } else {
825 - $collection = $_SESSION['wsCollection'];
 815+ $collection = CollectionSession::getCollection();
826816 $items = $collection['items'];
827817 }
828818
@@ -843,7 +833,7 @@
844834 return false;
845835 }
846836 $articleText = "{{" . wfMsgForContent( 'coll-savedbook_template' ) . "}}\n\n";
847 - $collection = $_SESSION['wsCollection'];
 837+ $collection = CollectionSession::getCollection();
848838 if( $collection['title'] ) {
849839 $articleText .= '== ' . $collection['title'] . " ==\n";
850840 }
Property changes on: branches/REL1_16/extensions/Collection
___________________________________________________________________
Name: svn:mergeinfo
851841 + /trunk/extensions/Collection:62820-63596

Status & tagging log