]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed files_trashbin to also use hash URL part for IE8
authorVincent Petry <pvince81@owncloud.com>
Fri, 13 Sep 2013 19:00:15 +0000 (21:00 +0200)
committerVincent Petry <pvince81@owncloud.com>
Fri, 13 Sep 2013 19:00:15 +0000 (21:00 +0200)
apps/files_trashbin/index.php
apps/files_trashbin/templates/index.php

index c9468b60bd4a79d1feda14f0630155cddbe62c92..9f17448a757ecce21f03e57f3ea9fff70674de09 100644 (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();
index daae7753aebc1c481a973dff4ad8268e1ba7bba7..82ba0608834c95e6fcdc2632dd694235c90613b7 100644 (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">