Disabled ajax mode for public files view

Ajax loading is not supported yet for public files view.
This fix disabled the history API, ajax loading and ajax directory
switch in public mode until it is implemented properly.
remotes/origin/stable6
Vincent Petry 12 years ago
parent 09b084dfed
commit fab4102c51
  1. 44
      apps/files/js/filelist.js
  2. 4
      apps/files/js/files.js

@ -677,6 +677,7 @@ var FileList={
}; };
$(document).ready(function(){ $(document).ready(function(){
var isPublic = !!$('#isPublic').val();
// handle upload events // handle upload events
var file_upload_start = $('#file_upload_start'); var file_upload_start = $('#file_upload_start');
@ -924,29 +925,32 @@ $(document).ready(function(){
return (params && params.dir) || '/'; return (params && params.dir) || '/';
} }
// fallback to hashchange when no history support // disable ajax/history API for public app (TODO: until it gets ported)
if (!window.history.pushState){ if (!isPublic){
$(window).on('hashchange', function(){ // fallback to hashchange when no history support
FileList.changeDirectory(parseCurrentDirFromUrl(), false); if (!window.history.pushState){
}); $(window).on('hashchange', function(){
} FileList.changeDirectory(parseCurrentDirFromUrl(), false);
window.onpopstate = function(e){ });
var targetDir;
if (e.state && e.state.dir){
targetDir = e.state.dir;
}
else{
// read from URL
targetDir = parseCurrentDirFromUrl();
} }
if (targetDir){ window.onpopstate = function(e){
FileList.changeDirectory(targetDir, false); var targetDir;
if (e.state && e.state.dir){
targetDir = e.state.dir;
}
else{
// read from URL
targetDir = parseCurrentDirFromUrl();
}
if (targetDir){
FileList.changeDirectory(targetDir, false);
}
} }
}
if (parseInt($('#ajaxLoad').val(), 10) === 1){ if (parseInt($('#ajaxLoad').val(), 10) === 1){
// need to initially switch the dir to the one from the hash (IE8) // need to initially switch the dir to the one from the hash (IE8)
FileList.changeDirectory(parseCurrentDirFromUrl(), false, true); FileList.changeDirectory(parseCurrentDirFromUrl(), false, true);
}
} }
FileList.createFileSummary(); FileList.createFileSummary();

@ -705,7 +705,9 @@ function checkTrashStatus() {
function onClickBreadcrumb(e){ function onClickBreadcrumb(e){
var $el = $(e.target).closest('.crumb'), var $el = $(e.target).closest('.crumb'),
$targetDir = $el.data('dir'); $targetDir = $el.data('dir');
if ($targetDir !== undefined){ isPublic = !!$('#isPublic').val();
if ($targetDir !== undefined && !isPublic){
e.preventDefault(); e.preventDefault();
FileList.changeDirectory(decodeURIComponent($targetDir)); FileList.changeDirectory(decodeURIComponent($targetDir));
} }

Loading…
Cancel
Save