Index: trunk/extensions/CategoryTree/CategoryTree.php |
— | — | @@ -51,6 +51,7 @@ |
52 | 52 | $wgCategoryTreeExtPath = '/extensions/CategoryTree'; |
53 | 53 | $wgCategoryTreeDefaultMode = CT_MODE_CATEGORIES; |
54 | 54 | $wgCategoryTreeCategoryPageMode = CT_MODE_CATEGORIES; |
| 55 | +$wgCategoryTreeVersion = '1'; |
55 | 56 | |
56 | 57 | /** |
57 | 58 | * Register extension setup hook and credits |
Index: trunk/extensions/CategoryTree/CategoryTree.i18n.php |
— | — | @@ -33,6 +33,8 @@ |
34 | 34 | $messages['categorytree-no-subcategories']= 'no subcategories'; |
35 | 35 | $messages['categorytree-no-pages']= 'no pages or subcategories'; |
36 | 36 | $messages['categorytree-not-found']= "Category <i>$1</i> not found"; |
| 37 | +$messages['categorytree-error'] = 'Problem loading data.'; |
| 38 | +$messages['categorytree-retry'] = 'Please wait a moment and try again.'; |
37 | 39 | |
38 | 40 | $messages['categorytree-show-list'] = "Show as list"; |
39 | 41 | $messages['categorytree-show-tree'] = "Show as tree"; |
Index: trunk/extensions/CategoryTree/CategoryTree.js |
— | — | @@ -8,7 +8,11 @@ |
9 | 9 | * @copyright © 2006 Daniel Kinzler |
10 | 10 | * @licence GNU General Public Licence 2.0 or later |
11 | 11 | */ |
12 | | - |
| 12 | + |
| 13 | +// Default messages if new code loaded with old cached page |
| 14 | +var categoryTreeErrorMsg = "Problem loading data."; |
| 15 | +var categoryTreeRetryMsg = "Please wait a moment and try again."; |
| 16 | + |
13 | 17 | function categoryTreeNextDiv(e) { |
14 | 18 | var n= e.nextSibling; |
15 | 19 | while ( n && ( n.nodeType != 1 || n.nodeName != 'DIV') ) { |
— | — | @@ -55,10 +59,19 @@ |
56 | 60 | div.innerHTML= '<i class="CategoryTreeNotice">' + categoryTreeLoadingMsg + '</i>'; |
57 | 61 | |
58 | 62 | function f( request ) { |
| 63 | + if (request.status != 200) { |
| 64 | + div.innerHTML = '<i class="CategoryTreeNotice">' + categoryTreeErrorMsg + ' </i>'; |
| 65 | + var retryLink = document.createElement('a'); |
| 66 | + retryLink.innerHTML = categoryTreeRetryMsg; |
| 67 | + retryLink.onclick = function() { |
| 68 | + categoryTreeLoadChildren(cat, mode, div); |
| 69 | + } |
| 70 | + div.appendChild(retryLink); |
| 71 | + return; |
| 72 | + } |
| 73 | + |
59 | 74 | result= request.responseText; |
60 | 75 | result= result.replace(/^\s+|\s+$/, ''); |
61 | | - |
62 | | - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; |
63 | 76 | |
64 | 77 | if ( result == '' ) { |
65 | 78 | result= '<i class="CategoryTreeNotice">'; |
Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | * @param OutputPage $outputPage |
25 | 25 | */ |
26 | 26 | static function setHeaders( &$outputPage ) { |
27 | | - global $wgJsMimeType, $wgScriptPath, $wgContLang, $wgCategoryTreeExtPath; |
| 27 | + global $wgJsMimeType, $wgScriptPath, $wgContLang, $wgCategoryTreeExtPath, $wgCategoryTreeVersion; |
28 | 28 | efInjectCategoryTreeMessages(); |
29 | 29 | |
30 | 30 | # Register css file for CategoryTree |
— | — | @@ -31,7 +31,7 @@ |
32 | 32 | array( |
33 | 33 | 'rel' => 'stylesheet', |
34 | 34 | 'type' => 'text/css', |
35 | | - 'href' => $wgScriptPath . $wgCategoryTreeExtPath . '/CategoryTree.css' |
| 35 | + 'href' => "$wgScriptPath$wgCategoryTreeExtPath/CategoryTree.css?$wgCategoryTreeVersion", |
36 | 36 | ) |
37 | 37 | ); |
38 | 38 | |
— | — | @@ -41,14 +41,14 @@ |
42 | 42 | array( |
43 | 43 | 'rel' => 'stylesheet', |
44 | 44 | 'type' => 'text/css', |
45 | | - 'href' => $wgScriptPath . $wgCategoryTreeExtPath . '/CategoryTree.rtl.css' |
| 45 | + 'href' => "$wgScriptPath$wgCategoryTreeExtPath/CategoryTree.rtl.css?$wgCategoryTreeVersion" |
46 | 46 | ) |
47 | 47 | ); |
48 | 48 | } |
49 | 49 | |
50 | 50 | # Register main js file for CategoryTree |
51 | 51 | $outputPage->addScript( |
52 | | - "<script type=\"{$wgJsMimeType}\" src=\"{$wgScriptPath}{$wgCategoryTreeExtPath}/CategoryTree.js\">" . |
| 52 | + "<script type=\"{$wgJsMimeType}\" src=\"{$wgScriptPath}{$wgCategoryTreeExtPath}/CategoryTree.js?{$wgCategoryTreeVersion}\">" . |
53 | 53 | "</script>\n" |
54 | 54 | ); |
55 | 55 | |
— | — | @@ -62,6 +62,8 @@ |
63 | 63 | var categoryTreeNothingFoundMsg = \"".Xml::escapeJsString(self::msg('nothing-found'))."\"; |
64 | 64 | var categoryTreeNoSubcategoriesMsg = \"".Xml::escapeJsString(self::msg('no-subcategories'))."\"; |
65 | 65 | var categoryTreeNoPagesMsg = \"".Xml::escapeJsString(self::msg('no-pages'))."\"; |
| 66 | + var categoryTreeErrorMsg = \"".Xml::escapeJsString(self::msg('error'))."\"; |
| 67 | + var categoryTreeRetryMsg = \"".Xml::escapeJsString(self::msg('retry'))."\"; |
66 | 68 | </script>\n" |
67 | 69 | ); |
68 | 70 | } |