Index: branches/REL1_16/extensions/Collection/Collection.i18n.php |
— | — | @@ -4526,6 +4526,8 @@ |
4527 | 4527 | 'coll-rendering_status' => '<strong>Állapot:</strong> $1', |
4528 | 4528 | 'coll-rendering_article' => '(lap: $1)', |
4529 | 4529 | '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', |
4530 | 4532 | 'coll-rendering_finished_title' => 'A renderelés befejeződött', |
4531 | 4533 | 'coll-rendering_finished_text' => '<strong>A dokumentum ekészült.</strong> |
4532 | 4534 | <strong>[$1 Fájl letöltése]</strong> a számítógépedre. |
— | — | @@ -4732,12 +4734,12 @@ |
4733 | 4735 | 'coll-error_reponse' => 'Responsa de error ab servitor', |
4734 | 4736 | 'coll-empty_collection' => 'Libro vacue', |
4735 | 4737 | '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', |
4737 | 4739 | '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]].', |
4739 | 4741 | 'coll-personal_collection_label' => 'Libro personal:', |
4740 | 4742 | 'coll-community_collection_label' => 'Libro communitari:', |
4741 | | - 'coll-save_collection' => 'Immagazinar libro', |
| 4743 | + 'coll-save_collection' => 'Salveguardar libro', |
4742 | 4744 | 'coll-save_category' => 'Tote le libros immagazinate es addite al categoria [[:Category:{{MediaWiki:Coll-bookscategory}}|{{MediaWiki:Coll-bookscategory}}]].', |
4743 | 4745 | 'coll-overwrite_title' => 'Le pagina existe ja. |
4744 | 4746 | Superscriber lo?', |
— | — | @@ -4810,8 +4812,8 @@ |
4811 | 4813 | 'coll-suggest_article_remove' => 'Le pagina <strong>$1</strong> ha essite removite de tu libro ($2).', |
4812 | 4814 | 'coll-suggest_undo_tooltip' => 'Disfacer iste action', |
4813 | 4815 | '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', |
4816 | 4818 | ); |
4817 | 4819 | |
4818 | 4820 | /** Indonesian (Bahasa Indonesia) |
— | — | @@ -5381,12 +5383,15 @@ |
5382 | 5384 | * @author გიორგიმელა |
5383 | 5385 | */ |
5384 | 5386 | $messages['ka'] = array( |
| 5387 | + 'coll-desc' => '[[Special:Book|წიგნის შექმნა]]', |
| 5388 | + 'coll-book_creator_help' => 'მეტი ინფორმაციისათვის იხილეთ [[{{MediaWiki:Coll-helppage}}|დახმარების გვერდი წიგნებზე]].', |
5385 | 5389 | 'coll-collection' => 'წიგნი', |
5386 | 5390 | 'coll-collections' => 'წიგნები', |
5387 | 5391 | 'coll-print_template_prefix' => 'დაბეჭვდა', |
5388 | 5392 | 'coll-print_template_pattern' => '$1/დაბეჭვდა', |
5389 | 5393 | 'coll-unknown_subpage_title' => 'უცნობი ქვეგვერდი', |
5390 | 5394 | 'coll-unknown_subpage_text' => '[[Special:Book|წიგნის]] ეს ქვეგვერდები არ არსებობს', |
| 5395 | + 'coll-couldnotaddarticle_title' => 'შეუძლებელია ვიკი-გვერდის დამატება', |
5391 | 5396 | 'coll-your_book' => 'თქვენი წიგნი', |
5392 | 5397 | 'coll-download_title' => 'ჩამოტვირთვა', |
5393 | 5398 | 'coll-download' => 'ჩამოტვირთვა', |
— | — | @@ -5473,6 +5478,7 @@ |
5474 | 5479 | 'coll-order_info_article' => '{{MediaWiki:Coll-helppage}}/ინფორმაცია PediaPress-ის შეკვვეთაზე', |
5475 | 5480 | 'coll-suggest_add_selected' => 'არჩეული გვერდების დამატება', |
5476 | 5481 | 'coll-suggest_your_book' => 'თქვენი წიგნი', |
| 5482 | + 'coll-suggest_show' => 'ჩვენება', |
5477 | 5483 | 'coll-suggest_undo' => 'გაუქმება', |
5478 | 5484 | 'right-collectionsaveasuserpage' => 'შეინახე წიგნი, როგორც მომხმარებლის გვერდი', |
5479 | 5485 | 'right-collectionsaveascommunitypage' => 'შეინახეთ წიგნი, როგორც საზოგადოების გვერდი', |
— | — | @@ -6329,7 +6335,7 @@ |
6330 | 6336 | 'coll-save_collection' => 'പുസ്തകം സേവ് ചെയ്യുക', |
6331 | 6337 | 'coll-save_category' => 'സേവ് ചെയ്ത പുസ്തകങ്ങളെല്ലാം [[:Category:{{MediaWiki:Coll-bookscategory}}|{{MediaWiki:Coll-bookscategory}}]] വർഗ്ഗത്തിലേയ്ക്ക് ചേർത്തിരിക്കുന്നു.', |
6332 | 6338 | 'coll-overwrite_title' => 'താള് നിലവിലുണ്ട്. അതിനെ ഓവര്റൈറ്റ് ചെയ്യട്ടെ?', |
6333 | | - 'coll-overwrite_text' => '[[:$1]] എന്ന പേരില് ഒരു താള് നിലവിലുണ്ട്. താങ്കളുടെ ശേഖരം ആ താളിനു ബദലാക്കണോ?', |
| 6339 | + 'coll-overwrite_text' => '[[:$1]] എന്ന പേരില് ഒരു താള് നിലവിലുണ്ട്. താങ്കളുടെ പുസ്തകം ആ താളിനു ബദലാക്കണോ?', |
6334 | 6340 | 'coll-yes' => 'ശരി', |
6335 | 6341 | 'coll-no' => 'ഇല്ല', |
6336 | 6342 | 'coll-load_overwrite_text' => 'താങ്കളുടെ പുസ്തകത്തില് ഇപ്പോള് തന്നെ കുറച്ചു താളുകള് ഉണ്ട്. |
— | — | @@ -7708,7 +7714,7 @@ |
7709 | 7715 | 'coll-exclusion_category_title' => 'Excluir ao imprimir', |
7710 | 7716 | 'coll-print_template_prefix' => 'Imprime', |
7711 | 7717 | 'coll-print_template_pattern' => '$1/Imprimir', |
7712 | | - 'coll-unknown_subpage_title' => 'Sub-página desconhecida', |
| 7718 | + 'coll-unknown_subpage_title' => 'Subpágina desconhecida', |
7713 | 7719 | 'coll-unknown_subpage_text' => 'Não existe esta sub-página do [[Special:Book|Livro]]', |
7714 | 7720 | 'coll-couldnotaddarticle_title' => 'Não foi possível adicionar a página wiki', |
7715 | 7721 | 'coll-couldnotaddarticle_msg' => 'A página wiki não pode ser adicionada.', |
Index: branches/REL1_16/extensions/Collection/Collection.php |
— | — | @@ -111,7 +111,6 @@ |
112 | 112 | 'version' => $wgCollectionVersion, |
113 | 113 | 'author' => array( 'PediaPress GmbH', 'Siebrand Mazeland' ), |
114 | 114 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Collection', |
115 | | - 'description' => 'Create books', |
116 | 115 | 'descriptionmsg' => 'coll-desc', |
117 | 116 | ); |
118 | 117 | |
— | — | @@ -280,6 +279,29 @@ |
281 | 280 | |
282 | 281 | $wgAjaxExportList[] = 'wfAjaxCollectionClear'; |
283 | 282 | |
| 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 | + |
284 | 306 | /** |
285 | 307 | * Backend of several following SAJAX function handlers... |
286 | 308 | * @param String $action provided by the specific handlers internally |
Index: branches/REL1_16/extensions/Collection/Collection.hooks.php |
— | — | @@ -240,6 +240,7 @@ |
241 | 241 | global $wgCollectionStyleVersion; |
242 | 242 | global $wgCollectionVersion; |
243 | 243 | global $wgJsMimeType; |
| 244 | + global $wgOut; |
244 | 245 | global $wgScriptPath; |
245 | 246 | global $wgTitle; |
246 | 247 | global $wgUser; |
— | — | @@ -259,8 +260,21 @@ |
260 | 261 | $oldid = 0; |
261 | 262 | } |
262 | 263 | } |
| 264 | + |
263 | 265 | $html = ''; |
264 | 266 | |
| 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 | + |
265 | 279 | $html .= Xml::element( 'script', |
266 | 280 | array( |
267 | 281 | 'type' => $wgJsMimeType, |
— | — | @@ -268,6 +282,21 @@ |
269 | 283 | ), |
270 | 284 | '', false |
271 | 285 | ); |
| 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 | + ); |
272 | 301 | |
273 | 302 | $addRemoveState = $mode; |
274 | 303 | |
Index: branches/REL1_16/extensions/Collection/Collection.session.php |
— | — | @@ -105,4 +105,31 @@ |
106 | 106 | } |
107 | 107 | return -1; |
108 | 108 | } |
| 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 | + } |
109 | 136 | } |
Index: branches/REL1_16/extensions/Collection/CollectionCore.i18n.php |
— | — | @@ -36,6 +36,8 @@ |
37 | 37 | 'coll-disable' => 'disable', |
38 | 38 | 'coll-book_creator_disable' => 'Disable book creator', |
39 | 39 | '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', |
40 | 42 | 'coll-add_category' => 'Add this category to your book', |
41 | 43 | 'coll-add_category_tooltip' => 'Add all wiki pages in this category to your book', |
42 | 44 | 'coll-add_this_page' => 'Add this page to your book', |
— | — | @@ -233,6 +235,8 @@ |
234 | 236 | 'coll-disable' => 'выключыць', |
235 | 237 | 'coll-book_creator_disable' => 'Выключыць майстра стварэньня кнігі', |
236 | 238 | 'coll-book_creator_disable_tooltip' => 'Спыніць выкарыстаньне майстра стварэньня кнігі', |
| 239 | + 'coll-add_linked_article' => 'Дадаць зьвязаную вікі-старонку ў Вашу кнігу', |
| 240 | + 'coll-remove_linked_article' => 'Выдаліць зьвязаную вікі-старонку з Вашай кнігі', |
237 | 241 | 'coll-add_category' => 'Дадаць гэтую катэгорыю ў Вашую кнігу', |
238 | 242 | 'coll-add_category_tooltip' => 'Дадаць усе старонкі з гэтай катэгорыі ў Вашую кнігу', |
239 | 243 | 'coll-add_this_page' => 'Дадаць гэтую старонку ў Вашую кнігу', |
— | — | @@ -1088,6 +1092,8 @@ |
1089 | 1093 | 'coll-disable' => 'deaktiviere', |
1090 | 1094 | 'coll-book_creator_disable' => 'Buechgenerator deaktiviere', |
1091 | 1095 | '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', |
1092 | 1098 | 'coll-add_category' => 'Die Kategorii zue Dyym Buech dezuefiege', |
1093 | 1099 | 'coll-add_category_tooltip' => 'Alli Wikisyte in däre Kategorii in Dyy Buech yyfiege', |
1094 | 1100 | 'coll-add_this_page' => 'Die Syte zue Dyym Buech zuefiege', |
— | — | @@ -1320,6 +1326,8 @@ |
1321 | 1327 | 'coll-disable' => 'disactivar', |
1322 | 1328 | 'coll-book_creator_disable' => 'Disactivar le creator de libros', |
1323 | 1329 | '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', |
1324 | 1332 | 'coll-add_category' => 'Adder iste categoria a tu libro', |
1325 | 1333 | 'coll-add_category_tooltip' => 'Adder tote le paginas wiki in iste categoria a tu libro', |
1326 | 1334 | 'coll-add_this_page' => 'Adder iste pagina a tu libro', |
— | — | @@ -1763,7 +1771,7 @@ |
1764 | 1772 | */ |
1765 | 1773 | $messages['ml'] = array( |
1766 | 1774 | 'coll-print_export' => 'അച്ചടിയ്ക്കുക/കയറ്റുമതി ചെയ്യുക', |
1767 | | - 'coll-create_a_book' => 'എന്റെ ശേഖരം', |
| 1775 | + 'coll-create_a_book' => 'പുസ്തകം സൃഷ്ടിക്കുക', |
1768 | 1776 | 'coll-create_a_book_tooltip' => 'ഒരു പുസ്തകം അല്ലെങ്കിൽ താളുകളുടെ ശേഖരം സൃഷ്ടിക്കുക', |
1769 | 1777 | 'coll-book_creator' => 'പുസ്തക സൃഷ്ടി ഉപകരണം', |
1770 | 1778 | 'coll-download_as' => '$1 ആയി ഡൗൺലോഡ് ചെയ്യുക', |
— | — | @@ -1771,6 +1779,8 @@ |
1772 | 1780 | 'coll-disable' => 'നിർജീവമാക്കുക', |
1773 | 1781 | 'coll-book_creator_disable' => 'പുസ്തക സൃഷ്ടി ഉപകരണം നിർജീവമാക്കുക', |
1774 | 1782 | 'coll-book_creator_disable_tooltip' => 'പുസ്തക സൃഷ്ടി ഉപകരണം ഉപയോഗിക്കുന്നതു നിർത്തുക', |
| 1783 | + 'coll-add_linked_article' => 'താങ്കളുടെ പുസ്തകത്തിൽ കണ്ണിയുള്ള വിക്കിതാൾ കൂട്ടിച്ചേർക്കുക', |
| 1784 | + 'coll-remove_linked_article' => 'താങ്കളുടെ പുസ്തകത്തിൽനിന്നും കണ്ണിചേർക്കപ്പെട്ട വിക്കിതാൾ നീക്കംചെയ്യുക', |
1775 | 1785 | 'coll-add_category' => 'താങ്കളുടെ പുസ്തകത്തിൽ ഈ വര്ഗ്ഗം ചേര്ക്കുക', |
1776 | 1786 | 'coll-add_category_tooltip' => 'ഈ വർഗ്ഗത്തിലുള്ള എല്ലാ വിക്കി താളുകളും താങ്കളുടെ പുസ്തകത്തിലേയ്ക്ക് കൂട്ടിച്ചേർക്കുക', |
1777 | 1787 | 'coll-add_this_page' => 'ഈ താൾ താങ്കളുടെ പുസ്തകത്തിലേയ്ക്ക് കൂട്ടിച്ചേർക്കുക', |
Index: branches/REL1_16/extensions/Collection/js/bookcreator.js |
— | — | @@ -21,23 +21,22 @@ |
22 | 22 | |
23 | 23 | (function() { |
24 | 24 | |
| 25 | +var $ = window.$; |
| 26 | +if (typeof $ == 'undefined') { |
| 27 | + $ = jQuery; |
| 28 | +} |
| 29 | + |
25 | 30 | function refreshBookCreatorBox(hint, oldid) { |
26 | 31 | sajax_request_type = 'GET'; |
27 | 32 | 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); |
35 | 34 | }); |
36 | 35 | } |
37 | 36 | |
38 | 37 | function collectionCall(func, args) { |
39 | 38 | var hint = args.shift(); |
40 | 39 | sajax_request_type = 'POST'; |
41 | | - sajax_do_call('wfAjaxCollection' + func, args, function(xhr) { |
| 40 | + sajax_do_call('wfAjaxCollection' + func, args, function() { |
42 | 41 | var oldid = null; |
43 | 42 | if (args.length == 3) { |
44 | 43 | oldid = args[2]; |
— | — | @@ -48,4 +47,134 @@ |
49 | 48 | |
50 | 49 | window.collectionCall = collectionCall; // public |
51 | 50 | |
| 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 | + |
52 | 181 | })(); |
Index: branches/REL1_16/extensions/Collection/js/collection.js |
— | — | @@ -145,7 +145,7 @@ |
146 | 146 | if (!jQuery('#saveButton').length) { |
147 | 147 | return; |
148 | 148 | } |
149 | | - if (jQuery('#emptyCollection').length) { |
| 149 | + if (jQuery('#collectionList .article').length == 0) { |
150 | 150 | jQuery('#saveButton').attr('disabled', 'disabled'); |
151 | 151 | return; |
152 | 152 | } |
— | — | @@ -181,7 +181,7 @@ |
182 | 182 | jQuery('#collectionListContainer').html(xhr.responseText); |
183 | 183 | jQuery('.makeVisible').css('display', 'inline'); |
184 | 184 | make_sortable(); |
185 | | - if (jQuery('#emptyCollection').length) { |
| 185 | + if (jQuery('#collectionList .article').length == 0) { |
186 | 186 | jQuery('#downloadButton').attr('disabled', 'disabled'); |
187 | 187 | jQuery('input.order').attr('disabled', 'disabled'); |
188 | 188 | } else { |
Index: branches/REL1_16/extensions/Collection/Collection.body.php |
— | — | @@ -185,7 +185,7 @@ |
186 | 186 | $collection = $this->loadCollection( $title, $wgRequest->getVal( 'append' ) ); |
187 | 187 | if ( $collection ) { |
188 | 188 | CollectionSession::startSession(); |
189 | | - $_SESSION['wsCollection'] = $collection; |
| 189 | + CollectionSession::setCollection( $collection ); |
190 | 190 | CollectionSession::enable(); |
191 | 191 | $wgOut->redirect( SkinTemplate::makeSpecialUrl( 'Book' ) ); |
192 | 192 | } |
— | — | @@ -240,7 +240,7 @@ |
241 | 241 | return; |
242 | 242 | case 'render': |
243 | 243 | return $this->renderCollection( |
244 | | - $_SESSION['wsCollection'], |
| 244 | + CollectionSession::getCollection(), |
245 | 245 | Title::newFromText( $wgContLang->specialPage( 'Book' ) ), |
246 | 246 | $wgRequest->getVal( 'writer', '' ) |
247 | 247 | ); |
— | — | @@ -273,7 +273,7 @@ |
274 | 274 | return; |
275 | 275 | case 'post_zip': |
276 | 276 | $partner = $wgRequest->getVal( 'partner', 'pediapress' ); |
277 | | - $this->postZIP( $_SESSION['wsCollection'], $partner ); |
| 277 | + $this->postZIP( CollectionSession::getCollection(), $partner ); |
278 | 278 | return; |
279 | 279 | case 'suggest': |
280 | 280 | $add = $wgRequest->getVal( 'add' ); |
— | — | @@ -515,7 +515,7 @@ |
516 | 516 | $wgOut->addScript( "<script type=\"$wgJsMimeType\" src=\"$jspath/collection.js?$wgCollectionStyleVersion\"></script>" ); |
517 | 517 | |
518 | 518 | $template = new CollectionPageTemplate(); |
519 | | - $template->set( 'collection', $_SESSION['wsCollection'] ); |
| 519 | + $template->set( 'collection', CollectionSession::getCollection() ); |
520 | 520 | $template->set( 'podpartners', $this->mPODPartners ); |
521 | 521 | $template->set( 'formats', $wgCollectionFormats); |
522 | 522 | $prefixes = self::getBookPagePrefixes(); |
— | — | @@ -525,11 +525,10 @@ |
526 | 526 | } |
527 | 527 | |
528 | 528 | static function setTitles( $title, $subtitle ) { |
529 | | - $collection = $_SESSION['wsCollection']; |
| 529 | + $collection = CollectionSession::getCollection(); |
530 | 530 | $collection['title'] = $title; |
531 | 531 | $collection['subtitle'] = $subtitle; |
532 | | - $_SESSION['wsCollection'] = $collection; |
533 | | - CollectionSession::touchSession(); |
| 532 | + CollectionSession::setCollection( $collection ); |
534 | 533 | } |
535 | 534 | |
536 | 535 | static function title_cmp($a, $b) { |
— | — | @@ -537,7 +536,7 @@ |
538 | 537 | } |
539 | 538 | |
540 | 539 | static function sortItems() { |
541 | | - $collection = $_SESSION['wsCollection']; |
| 540 | + $collection = CollectionSession::getCollection(); |
542 | 541 | $articles = array(); |
543 | 542 | $new_items = array(); |
544 | 543 | foreach ( $collection['items'] as $item ) { |
— | — | @@ -551,31 +550,28 @@ |
552 | 551 | } |
553 | 552 | usort( $articles, array( __CLASS__, 'title_cmp' ) ); |
554 | 553 | $collection['items'] = array_merge( $new_items, $articles ); |
555 | | - $_SESSION['wsCollection'] = $collection; |
556 | | - CollectionSession::touchSession(); |
| 554 | + CollectionSession::setCollection( $collection ); |
557 | 555 | } |
558 | 556 | |
559 | 557 | static function addChapter( $name ) { |
560 | | - $collection = $_SESSION['wsCollection']; |
| 558 | + $collection = CollectionSession::getCollection(); |
561 | 559 | array_unshift( $collection['items'], array( |
562 | 560 | 'type' => 'chapter', |
563 | 561 | 'title' => $name, |
564 | 562 | ) ); |
565 | | - $_SESSION['wsCollection'] = $collection; |
566 | | - CollectionSession::touchSession(); |
| 563 | + CollectionSession::setCollection( $collection ); |
567 | 564 | } |
568 | 565 | |
569 | 566 | static function renameChapter( $index, $name ) { |
570 | 567 | if (!is_int( $index ) ) { |
571 | 568 | return; |
572 | 569 | } |
573 | | - $collection = $_SESSION['wsCollection']; |
| 570 | + $collection = CollectionSession::getCollection(); |
574 | 571 | if ( $collection['items'][$index]['type'] != 'chapter' ) { |
575 | 572 | return; |
576 | 573 | } |
577 | 574 | $collection['items'][$index]['title'] = $name; |
578 | | - $_SESSION['wsCollection'] = $collection; |
579 | | - CollectionSession::touchSession(); |
| 575 | + CollectionSession::setCollection( $collection ); |
580 | 576 | } |
581 | 577 | |
582 | 578 | static function addArticleFromName( $namespace, $name, $oldid=0 ) { |
— | — | @@ -601,7 +597,7 @@ |
602 | 598 | if ( !CollectionSession::hasSession() ) { |
603 | 599 | CollectionSession::startSession(); |
604 | 600 | } |
605 | | - $collection = $_SESSION['wsCollection']; |
| 601 | + $collection = CollectionSession::getCollection(); |
606 | 602 | $revision = Revision::newFromTitle( $title, $oldid ); |
607 | 603 | $collection['items'][] = array( |
608 | 604 | 'type' => 'article', |
— | — | @@ -613,8 +609,7 @@ |
614 | 610 | 'url' => $title->getFullURL(), |
615 | 611 | 'currentVersion' => $currentVersion, |
616 | 612 | ); |
617 | | - $_SESSION['wsCollection'] = $collection; |
618 | | - CollectionSession::touchSession(); |
| 613 | + CollectionSession::setCollection( $collection ); |
619 | 614 | return true; |
620 | 615 | } |
621 | 616 | |
— | — | @@ -627,13 +622,12 @@ |
628 | 623 | if ( !CollectionSession::hasSession() ) { |
629 | 624 | return false; |
630 | 625 | } |
631 | | - $collection = $_SESSION['wsCollection']; |
| 626 | + $collection = CollectionSession::getCollection(); |
632 | 627 | $index = CollectionSession::findArticle( $title->getPrefixedText(), $oldid ); |
633 | 628 | if ( $index != -1 ) { |
634 | 629 | array_splice( $collection['items'], $index, 1 ); |
635 | 630 | } |
636 | | - $_SESSION['wsCollection'] = $collection; |
637 | | - CollectionSession::touchSession(); |
| 631 | + CollectionSession::setCollection( $collection ); |
638 | 632 | return true; |
639 | 633 | } |
640 | 634 | |
— | — | @@ -697,10 +691,9 @@ |
698 | 692 | if ( !CollectionSession::hasSession() ) { |
699 | 693 | return false; |
700 | 694 | } |
701 | | - $collection = $_SESSION['wsCollection']; |
| 695 | + $collection = CollectionSession::getCollection(); |
702 | 696 | array_splice( $collection['items'], $index, 1 ); |
703 | | - $_SESSION['wsCollection'] = $collection; |
704 | | - CollectionSession::touchSession(); |
| 697 | + CollectionSession::setCollection( $collection ); |
705 | 698 | return true; |
706 | 699 | } |
707 | 700 | |
— | — | @@ -708,12 +701,11 @@ |
709 | 702 | if ( !CollectionSession::hasSession() ) { |
710 | 703 | return false; |
711 | 704 | } |
712 | | - $collection = $_SESSION['wsCollection']; |
| 705 | + $collection = CollectionSession::getCollection(); |
713 | 706 | $saved = $collection['items'][$index + $delta]; |
714 | 707 | $collection['items'][$index + $delta] = $collection['items'][$index]; |
715 | 708 | $collection['items'][$index] = $saved; |
716 | | - $_SESSION['wsCollection'] = $collection; |
717 | | - CollectionSession::touchSession(); |
| 709 | + CollectionSession::setCollection( $collection ); |
718 | 710 | return true; |
719 | 711 | } |
720 | 712 | |
— | — | @@ -721,15 +713,14 @@ |
722 | 714 | if ( !CollectionSession::hasSession() ) { |
723 | 715 | return; |
724 | 716 | } |
725 | | - $collection = $_SESSION['wsCollection']; |
| 717 | + $collection = CollectionSession::getCollection(); |
726 | 718 | $old_items = $collection['items']; |
727 | 719 | $new_items = array(); |
728 | 720 | foreach ($items as $new_index => $old_index) { |
729 | 721 | $new_items[$new_index] = $old_items[$old_index]; |
730 | 722 | } |
731 | 723 | $collection['items'] = $new_items; |
732 | | - $_SESSION['wsCollection'] = $collection; |
733 | | - CollectionSession::touchSession(); |
| 724 | + CollectionSession::setCollection( $collection ); |
734 | 725 | } |
735 | 726 | |
736 | 727 | function parseCollectionLine( &$collection, $line, $append ) { |
— | — | @@ -808,8 +799,7 @@ |
809 | 800 | return; |
810 | 801 | } |
811 | 802 | |
812 | | - $article = new Article( $title ); |
813 | | - if ( !$article->exists() ) { |
| 803 | + if ( !$title->exists() ) { |
814 | 804 | $wgOut->showErrorPage( 'coll-notfound_title', 'coll-notfound_msg' ); |
815 | 805 | return false; |
816 | 806 | } |
— | — | @@ -821,7 +811,7 @@ |
822 | 812 | ); |
823 | 813 | $items = array(); |
824 | 814 | } else { |
825 | | - $collection = $_SESSION['wsCollection']; |
| 815 | + $collection = CollectionSession::getCollection(); |
826 | 816 | $items = $collection['items']; |
827 | 817 | } |
828 | 818 | |
— | — | @@ -843,7 +833,7 @@ |
844 | 834 | return false; |
845 | 835 | } |
846 | 836 | $articleText = "{{" . wfMsgForContent( 'coll-savedbook_template' ) . "}}\n\n"; |
847 | | - $collection = $_SESSION['wsCollection']; |
| 837 | + $collection = CollectionSession::getCollection(); |
848 | 838 | if( $collection['title'] ) { |
849 | 839 | $articleText .= '== ' . $collection['title'] . " ==\n"; |
850 | 840 | } |
Property changes on: branches/REL1_16/extensions/Collection |
___________________________________________________________________ |
Name: svn:mergeinfo |
851 | 841 | + /trunk/extensions/Collection:62820-63596 |