2007-02-19 Ingmar Schlecht <ingmar@typo3.org>
+ * Fixed bug: AJAX navtree erroneously showed whole tree inside of the expanded branch on errors such as pages deleted in the meantime (thanks to Benjamin Mack)
* Fixed bug #4993: AJAX navtree does not expand in Konqueror (fixed by Benjamin Mack)
2007-02-16 Martin Kutschker <martin.t.kutschker@blackbox.net>
function printContent() {
// If we handle an AJAX call, send headers:
if ($this->ajax) {
+ header('X-JSON: ('.($this->pagetree->ajaxStatus?'true':'false').')');
header('Content-type: text/html; charset=utf-8');
// If it's the regular call to fully output the tree:
} else {
function printContent() {
// If we handle an AJAX call, send headers:
if ($this->ajax) {
+ header('X-JSON: ('.($this->foldertree->ajaxStatus?'true':'false').')');
header('Content-type: text/html; charset=utf-8');
// If it's the regular call to fully output the tree:
} else {
class filelistFolderTree extends t3lib_folderTree {
var $ext_IconMode;
+ var $ajaxStatus = false; // Indicates, whether the ajax call was successful, i.e. the requested page has been found
/**
* Calls init functions
}
// ajax request: collapse
- if($doCollapse && $expandedFolderUid == $uid) { return $itemHTML; }
+ if($doCollapse && $expandedFolderUid == $uid) {
+ $this->ajaxStatus = true;
+ return $itemHTML;
+ }
// ajax request: expand
if($doExpand && $expandedFolderUid == $uid) {
if($v['invertedDepth'] < $invertedDepthOfAjaxRequestedItem) {
$ajaxOutput .= $itemHTML;
} else {
+ $this->ajaxStatus = true;
return $ajaxOutput;
}
}
$out .= $itemHTML;
}
- if($ajaxOutput) { return $ajaxOutput; }
+ if($ajaxOutput) {
+ $this->ajaxStatus = true;
+ return $ajaxOutput;
+ }
// finally close the first ul
$out .= "</ul>\n";
var $ext_showPageId;
var $ext_IconMode;
+ var $ajaxStatus = false; // Indicates, whether the ajax call was successful, i.e. the requested page has been found
/**
* Calls init functions
}
// ajax request: collapse
- if($doCollapse && $collapsedPageUid == $uid) { return $itemHTML; }
+ if($doCollapse && $collapsedPageUid == $uid) {
+ $this->ajaxStatus = true;
+ return $itemHTML;
+ }
// ajax request: expand
if($doExpand && $expandedPageUid == $uid) {
if($v['invertedDepth'] < $invertedDepthOfAjaxRequestedItem) {
$ajaxOutput .= $itemHTML;
} else {
+ $this->ajaxStatus = true;
return $ajaxOutput;
}
}
$out .= $itemHTML;
}
- if($ajaxOutput) { return $ajaxOutput; }
+ if($ajaxOutput) {
+ $this->ajaxStatus = true;
+ return $ajaxOutput;
+ }
// finally close the first ul
$out .= '</ul>';
// Call this function, refresh_nav(), from another script in the backend if you want
// to refresh the navigation frame (eg. after having changed a page title or moved pages etc.)
// See t3lib_BEfunc::getSetUpdateSignal()
-function refresh_nav() { window.setTimeout('_refresh_nav();',0); }
-function _refresh_nav() {
- var r = new Date();
- // randNum is useful so pagetree does not get cached in browser cache when refreshing
- window.location.href = Tree.thisScript + '?randNum=' + r.getTime();
-}
+function refresh_nav() { window.setTimeout('Tree.refresh();',0); }
var Tree = {
new Ajax.Request(this.thisScript, {
method: 'get',
parameters: 'ajax=1&PM=' + params,
- onComplete: function(xhr) {
- // the parent node needs to be overwritten, not the object
+ onComplete: function(xhr, status) {
+ // if this is not a valid ajax response, the whole page gets refreshed
+ if (!status) return this.refresh();
+
+ // the parent node needs to be overwritten, not the object
$(obj.parentNode).replace(xhr.responseText);
this.registerDragDropHandlers();
this.reSelectActiveItem();
});
},
+ // does the complete page refresh (previously known as "_refresh_nav()")
+ refresh: function() {
+ var r = new Date();
+ // randNum is useful so pagetree does not get cached in browser cache when refreshing
+ window.location.href = this.thisScript + '?randNum=' + r.getTime();
+ },
+
// attaches the events to the elements needed for the drag and drop (for the titles and the icons)
registerDragDropHandlers: function() {
if (!this.activateDragDrop) return;