]> source.dussan.org Git - nextcloud-server.git/commitdiff
adding calls to \OCA\files\lib\Helper::determineIcon($i) in files, trashbin and sharing
authorThomas Müller <thomas.mueller@tmit.eu>
Wed, 11 Sep 2013 22:40:35 +0000 (00:40 +0200)
committerThomas Müller <thomas.mueller@tmit.eu>
Wed, 11 Sep 2013 22:40:35 +0000 (00:40 +0200)
apps/files/ajax/list.php
apps/files/index.php
apps/files_sharing/public.php
apps/files_trashbin/index.php

index c50e96b2429075f09fb3e42de2516a8fa4d67cf6..14ed43cbb3aef98541a4867f90e01eda2c1f8028 100644 (file)
@@ -34,6 +34,7 @@ if($doBreadcrumb) {
 $files = array();
 foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) {
        $i["date"] = OCP\Util::formatDate($i["mtime"] );
+       $i['icon'] = \OCA\files\lib\Helper::determineIcon($i);
        $files[] = $i;
 }
 
index f1e120c872cf55f29668414962b3184a5b8536e6..4443bf5fde0e754788e1ac6a76679debfe284b42 100644 (file)
@@ -75,6 +75,7 @@ foreach ($content as $i) {
        }
        $i['directory'] = $dir;
        $i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']);
+       $i['icon'] = \OCA\files\lib\Helper::determineIcon($i);
        $files[] = $i;
 }
 
index ec6b4e815f80ba5fc9c42728bfa0cf81d5eaf02e..ae3e27cab3f816d8b19669f53071deb250a31d53 100644 (file)
@@ -19,6 +19,20 @@ function fileCmp($a, $b) {
        }
 }
 
+function determineIcon($file, $sharingRoot, $sharingToken) {
+       // for folders we simply reuse the files logic
+       if($file['type'] == 'dir') {
+               return \OCA\files\lib\Helper::determineIcon($file);
+       }
+
+       $relativePath = substr($file['path'], 6);
+       $relativePath = substr($relativePath, strlen($sharingRoot));
+       if($file['isPreviewAvailable']) {
+               return OCP\publicPreview_icon($relativePath, $sharingToken);
+       }
+       return OCP\mimetype_icon($file['mimetype']);
+}
+
 if (isset($_GET['t'])) {
        $token = $_GET['t'];
        $linkItem = OCP\Share::getShareByToken($token);
@@ -176,6 +190,7 @@ if (isset($path)) {
                                }
                                $i['directory'] = $getPath;
                                $i['permissions'] = OCP\PERMISSION_READ;
+                               $i['icon'] = determineIcon($i, $basePath, $token);
                                $files[] = $i;
                        }
                        usort($files, "fileCmp");
index 0baeab1de9734ad9e821ecfb6333e6573f534793..d7eb143f9af04ce0e564758aa35445c8b21484d1 100644 (file)
@@ -65,6 +65,7 @@ foreach ($result as $r) {
        }
        $i['permissions'] = OCP\PERMISSION_READ;
        $i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($r['mime']);
+       $i['icon'] = \OCA\files\lib\Helper::determineIcon($i);
        $files[] = $i;
 }