Fixed files_trashbin to also use hash URL part for IE8

This commit is contained in:
Vincent Petry 2013-09-13 21:00:15 +02:00
parent 30a2f2f352
commit ec2f20f720
2 changed files with 27 additions and 2 deletions

View File

@ -18,7 +18,30 @@ OCP\Util::addscript('files', 'files');
$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : '';
$files = \OCA\files_trashbin\lib\Helper::getTrashFiles($dir);
$isIE8 = false;
preg_match('/MSIE (.*?);/', $_SERVER['HTTP_USER_AGENT'], $matches);
if (count($matches) > 0 && $matches[1] <= 8){
$isIE8 = true;
}
// if IE8 and "?dir=path" was specified, reformat the URL to use a hash like "#?dir=path"
if ($isIE8 && isset($_GET['dir'])){
if ($dir === ''){
$dir = '/';
}
header('Location: ' . OCP\Util::linkTo('files_trashbin', 'index.php') . '#?dir=' . \OCP\Util::encodePath($dir));
exit();
}
$ajaxLoad = false;
if (!$isIE8){
$files = \OCA\files_trashbin\lib\Helper::getTrashFiles($dir);
}
else{
$files = array();
$ajaxLoad = true;
}
// Redirect if directory does not exist
if ($files === null){
@ -53,5 +76,6 @@ $tmpl->assign('fileList', $list->fetchPage());
$tmpl->assign('files', $files);
$tmpl->assign('dir', $dir);
$tmpl->assign('disableSharing', true);
$tmpl->assign('ajaxLoad', true);
$tmpl->printPage();

View File

@ -5,10 +5,11 @@
</div>
<div id='notification'></div>
<?php if (isset($_['files']) && count($_['files']) === 0 && $_['dirlisting'] === false):?>
<?php if (isset($_['files']) && count($_['files']) === 0 && $_['dirlisting'] === false && !$_['ajaxLoad']):?>
<div id="emptycontent"><?php p($l->t('Nothing in here. Your trash bin is empty!'))?></div>
<?php endif; ?>
<input type="hidden" name="ajaxLoad" id="ajaxLoad" value="<?php p($_['ajaxLoad']); ?>" />
<input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>"></input>
<input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir">