diff --git a/CategoryTree.i18n.php b/CategoryTree.i18n.php
index 66cc524f..4707093a 100644
--- a/CategoryTree.i18n.php
+++ b/CategoryTree.i18n.php
@@ -33,6 +33,8 @@ $messages['categorytree-nothing-found']= 'nothing found';
$messages['categorytree-no-subcategories']= 'no subcategories';
$messages['categorytree-no-pages']= 'no pages or subcategories';
$messages['categorytree-not-found']= "Category $1 not found";
+$messages['categorytree-error'] = 'Problem loading data.';
+$messages['categorytree-retry'] = 'Please wait a moment and try again.';
$messages['categorytree-show-list'] = "Show as list";
$messages['categorytree-show-tree'] = "Show as tree";
diff --git a/CategoryTree.js b/CategoryTree.js
index 853f87c3..61cc9534 100644
--- a/CategoryTree.js
+++ b/CategoryTree.js
@@ -8,7 +8,11 @@
* @copyright © 2006 Daniel Kinzler
* @licence GNU General Public Licence 2.0 or later
*/
-
+
+// Default messages if new code loaded with old cached page
+var categoryTreeErrorMsg = "Problem loading data.";
+var categoryTreeRetryMsg = "Please wait a moment and try again.";
+
function categoryTreeNextDiv(e) {
var n= e.nextSibling;
while ( n && ( n.nodeType != 1 || n.nodeName != 'DIV') ) {
@@ -55,10 +59,19 @@
div.innerHTML= '' + categoryTreeLoadingMsg + '';
function f( request ) {
+ if (request.status != 200) {
+ div.innerHTML = '' + categoryTreeErrorMsg + ' ';
+ var retryLink = document.createElement('a');
+ retryLink.innerHTML = categoryTreeRetryMsg;
+ retryLink.onclick = function() {
+ categoryTreeLoadChildren(cat, mode, div);
+ }
+ div.appendChild(retryLink);
+ return;
+ }
+
result= request.responseText;
result= result.replace(/^\s+|\s+$/, '');
-
- if (request.status != 200) result= "
" + request.status + " " + request.statusText + ": " + result + "
";
if ( result == '' ) {
result= '';
diff --git a/CategoryTree.php b/CategoryTree.php
index 652c5714..a6ac584d 100644
--- a/CategoryTree.php
+++ b/CategoryTree.php
@@ -51,6 +51,7 @@ $wgCategoryTreeMaxDepth = array(CT_MODE_PAGES => 1, CT_MODE_ALL => 1, CT_MODE_CA
$wgCategoryTreeExtPath = '/extensions/CategoryTree';
$wgCategoryTreeDefaultMode = CT_MODE_CATEGORIES;
$wgCategoryTreeCategoryPageMode = CT_MODE_CATEGORIES;
+$wgCategoryTreeVersion = '1';
/**
* Register extension setup hook and credits
diff --git a/CategoryTreeFunctions.php b/CategoryTreeFunctions.php
index 7b61557c..1061f333 100644
--- a/CategoryTreeFunctions.php
+++ b/CategoryTreeFunctions.php
@@ -23,7 +23,7 @@ class CategoryTree {
* @param OutputPage $outputPage
*/
static function setHeaders( &$outputPage ) {
- global $wgJsMimeType, $wgScriptPath, $wgContLang, $wgCategoryTreeExtPath;
+ global $wgJsMimeType, $wgScriptPath, $wgContLang, $wgCategoryTreeExtPath, $wgCategoryTreeVersion;
efInjectCategoryTreeMessages();
# Register css file for CategoryTree
@@ -31,7 +31,7 @@ class CategoryTree {
array(
'rel' => 'stylesheet',
'type' => 'text/css',
- 'href' => $wgScriptPath . $wgCategoryTreeExtPath . '/CategoryTree.css'
+ 'href' => "$wgScriptPath$wgCategoryTreeExtPath/CategoryTree.css?$wgCategoryTreeVersion",
)
);
@@ -41,14 +41,14 @@ class CategoryTree {
array(
'rel' => 'stylesheet',
'type' => 'text/css',
- 'href' => $wgScriptPath . $wgCategoryTreeExtPath . '/CategoryTree.rtl.css'
+ 'href' => "$wgScriptPath$wgCategoryTreeExtPath/CategoryTree.rtl.css?$wgCategoryTreeVersion"
)
);
}
# Register main js file for CategoryTree
$outputPage->addScript(
- "\n"
);
@@ -62,6 +62,8 @@ class CategoryTree {
var categoryTreeNothingFoundMsg = \"".Xml::escapeJsString(self::msg('nothing-found'))."\";
var categoryTreeNoSubcategoriesMsg = \"".Xml::escapeJsString(self::msg('no-subcategories'))."\";
var categoryTreeNoPagesMsg = \"".Xml::escapeJsString(self::msg('no-pages'))."\";
+ var categoryTreeErrorMsg = \"".Xml::escapeJsString(self::msg('error'))."\";
+ var categoryTreeRetryMsg = \"".Xml::escapeJsString(self::msg('retry'))."\";
\n"
);
}