]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-13766, use bigger icons for file picker"
authordongsheng <dongsheng>
Wed, 14 Jan 2009 03:26:47 +0000 (03:26 +0000)
committerdongsheng <dongsheng>
Wed, 14 Jan 2009 03:26:47 +0000 (03:26 +0000)
36 files changed:
lib/filelib.php
pix/f/audio-32.png [new file with mode: 0644]
pix/f/avi-32.png [new file with mode: 0644]
pix/f/dmg-32.png [new file with mode: 0644]
pix/f/docm-32.png [new file with mode: 0644]
pix/f/docx-32.png [new file with mode: 0644]
pix/f/dotm-32.png [new file with mode: 0644]
pix/f/dotx-32.png [new file with mode: 0644]
pix/f/edit-32.png [new file with mode: 0644]
pix/f/excel-32.png [new file with mode: 0644]
pix/f/explore-32.png [new file with mode: 0644]
pix/f/folder-32.png [new file with mode: 0644]
pix/f/help-32.png [new file with mode: 0644]
pix/f/html-32.png [new file with mode: 0644]
pix/f/image-32.png [new file with mode: 0644]
pix/f/odp-32.png [new file with mode: 0644]
pix/f/odt-32.png [new file with mode: 0644]
pix/f/parent-32.png [new file with mode: 0644]
pix/f/powerpoint-32.png [new file with mode: 0644]
pix/f/pps-32.png [new file with mode: 0644]
pix/f/ppsx-32.png [new file with mode: 0644]
pix/f/pptx-32.png [new file with mode: 0644]
pix/f/text-32.png [new file with mode: 0644]
pix/f/unknown-32.png [new file with mode: 0644]
pix/f/video-32.png [new file with mode: 0644]
pix/f/web-32.png [new file with mode: 0644]
pix/f/word-32.png [new file with mode: 0644]
pix/f/xml-32.png [new file with mode: 0644]
pix/f/zip-32.png [new file with mode: 0644]
repository/alfresco/repository.class.php
repository/boxnet/repository.class.php
repository/lib.php
repository/s3/repository.class.php
repository/smb/repository.class.php
repository/webdav/repository.class.php
repository/wikimedia/repository.class.php

index b2e9019d3cc69b59bf0bb4a53eef943c77017551..24e01d9a592576a5df4de7e33123bb15db4cb912 100644 (file)
@@ -668,13 +668,24 @@ function get_mimetypes_array() {
  * @return string Requested piece of information from array
  */
 function mimeinfo($element, $filename) {
+    global $CFG;
     $mimeinfo = get_mimetypes_array();
 
     if (eregi('\.([a-z0-9]+)$', $filename, $match)) {
         if (isset($mimeinfo[strtolower($match[1])][$element])) {
             return $mimeinfo[strtolower($match[1])][$element];
         } else {
-            return $mimeinfo['xxx'][$element];   // By default
+            if ($element == 'icon32' and isset($mimeinfo[strtolower($match[1])]['icon'])) {
+                $filename = substr($mimeinfo[strtolower($match[1])]['icon'], 0, -4);
+                $filename .= '-32.png';
+                if (file_exists($CFG->dirroot.'/pix/f/'.$filename)) {
+                    return $filename;
+                } else {
+                    return $CFG->pixpath.'/f/unknown-32.png';   // By default
+                }
+            } else {
+                return $mimeinfo['xxx'][$element];   // By default
+            }
         }
     } else {
         return $mimeinfo['xxx'][$element];   // By default
diff --git a/pix/f/audio-32.png b/pix/f/audio-32.png
new file mode 100644 (file)
index 0000000..c60b595
Binary files /dev/null and b/pix/f/audio-32.png differ
diff --git a/pix/f/avi-32.png b/pix/f/avi-32.png
new file mode 100644 (file)
index 0000000..5d6c8d1
Binary files /dev/null and b/pix/f/avi-32.png differ
diff --git a/pix/f/dmg-32.png b/pix/f/dmg-32.png
new file mode 100644 (file)
index 0000000..8a150b8
Binary files /dev/null and b/pix/f/dmg-32.png differ
diff --git a/pix/f/docm-32.png b/pix/f/docm-32.png
new file mode 100644 (file)
index 0000000..daf84b2
Binary files /dev/null and b/pix/f/docm-32.png differ
diff --git a/pix/f/docx-32.png b/pix/f/docx-32.png
new file mode 100644 (file)
index 0000000..daf84b2
Binary files /dev/null and b/pix/f/docx-32.png differ
diff --git a/pix/f/dotm-32.png b/pix/f/dotm-32.png
new file mode 100644 (file)
index 0000000..daf84b2
Binary files /dev/null and b/pix/f/dotm-32.png differ
diff --git a/pix/f/dotx-32.png b/pix/f/dotx-32.png
new file mode 100644 (file)
index 0000000..daf84b2
Binary files /dev/null and b/pix/f/dotx-32.png differ
diff --git a/pix/f/edit-32.png b/pix/f/edit-32.png
new file mode 100644 (file)
index 0000000..5594785
Binary files /dev/null and b/pix/f/edit-32.png differ
diff --git a/pix/f/excel-32.png b/pix/f/excel-32.png
new file mode 100644 (file)
index 0000000..c0ccb7a
Binary files /dev/null and b/pix/f/excel-32.png differ
diff --git a/pix/f/explore-32.png b/pix/f/explore-32.png
new file mode 100644 (file)
index 0000000..a29bd69
Binary files /dev/null and b/pix/f/explore-32.png differ
diff --git a/pix/f/folder-32.png b/pix/f/folder-32.png
new file mode 100644 (file)
index 0000000..472484f
Binary files /dev/null and b/pix/f/folder-32.png differ
diff --git a/pix/f/help-32.png b/pix/f/help-32.png
new file mode 100644 (file)
index 0000000..d60425f
Binary files /dev/null and b/pix/f/help-32.png differ
diff --git a/pix/f/html-32.png b/pix/f/html-32.png
new file mode 100644 (file)
index 0000000..a896697
Binary files /dev/null and b/pix/f/html-32.png differ
diff --git a/pix/f/image-32.png b/pix/f/image-32.png
new file mode 100644 (file)
index 0000000..6f118cd
Binary files /dev/null and b/pix/f/image-32.png differ
diff --git a/pix/f/odp-32.png b/pix/f/odp-32.png
new file mode 100644 (file)
index 0000000..047355c
Binary files /dev/null and b/pix/f/odp-32.png differ
diff --git a/pix/f/odt-32.png b/pix/f/odt-32.png
new file mode 100644 (file)
index 0000000..daf84b2
Binary files /dev/null and b/pix/f/odt-32.png differ
diff --git a/pix/f/parent-32.png b/pix/f/parent-32.png
new file mode 100644 (file)
index 0000000..afb307b
Binary files /dev/null and b/pix/f/parent-32.png differ
diff --git a/pix/f/powerpoint-32.png b/pix/f/powerpoint-32.png
new file mode 100644 (file)
index 0000000..047355c
Binary files /dev/null and b/pix/f/powerpoint-32.png differ
diff --git a/pix/f/pps-32.png b/pix/f/pps-32.png
new file mode 100644 (file)
index 0000000..047355c
Binary files /dev/null and b/pix/f/pps-32.png differ
diff --git a/pix/f/ppsx-32.png b/pix/f/ppsx-32.png
new file mode 100644 (file)
index 0000000..047355c
Binary files /dev/null and b/pix/f/ppsx-32.png differ
diff --git a/pix/f/pptx-32.png b/pix/f/pptx-32.png
new file mode 100644 (file)
index 0000000..047355c
Binary files /dev/null and b/pix/f/pptx-32.png differ
diff --git a/pix/f/text-32.png b/pix/f/text-32.png
new file mode 100644 (file)
index 0000000..928a679
Binary files /dev/null and b/pix/f/text-32.png differ
diff --git a/pix/f/unknown-32.png b/pix/f/unknown-32.png
new file mode 100644 (file)
index 0000000..5b7e649
Binary files /dev/null and b/pix/f/unknown-32.png differ
diff --git a/pix/f/video-32.png b/pix/f/video-32.png
new file mode 100644 (file)
index 0000000..5d6c8d1
Binary files /dev/null and b/pix/f/video-32.png differ
diff --git a/pix/f/web-32.png b/pix/f/web-32.png
new file mode 100644 (file)
index 0000000..a896697
Binary files /dev/null and b/pix/f/web-32.png differ
diff --git a/pix/f/word-32.png b/pix/f/word-32.png
new file mode 100644 (file)
index 0000000..daf84b2
Binary files /dev/null and b/pix/f/word-32.png differ
diff --git a/pix/f/xml-32.png b/pix/f/xml-32.png
new file mode 100644 (file)
index 0000000..a896697
Binary files /dev/null and b/pix/f/xml-32.png differ
diff --git a/pix/f/zip-32.png b/pix/f/zip-32.png
new file mode 100644 (file)
index 0000000..4b55b50
Binary files /dev/null and b/pix/f/zip-32.png differ
index cfe7bee2df4b244376d20a5771ad34fa7b9a0115..8df2f06b1e32abfb5464efd2cf8134bcd67ba437 100755 (executable)
@@ -117,7 +117,7 @@ class repository_alfresco extends repository {
                     'children'=>array());
             } elseif ($child->child->type == $file_filter) {
                 $ret['list'][] = array('title'=>$child->child->cm_name,
-                    'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo("icon", $child->child->cm_name),
+                    'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $child->child->cm_name),
                     'source'=>$child->child->id);
             }
         }
index e4ff381d0ed775486367b407bcd515ee486ba556..0c5c3b93ee1465c53ea4cdfca3956b93ca739df5 100755 (executable)
@@ -158,7 +158,7 @@ class repository_boxnet extends repository {
                             'date'=>$filedates[$n],
                             'source'=>'http://box.net/api/1.0/download/'
                                 .$this->options['auth_token'].'/'.$fileids[$n],
-                            'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon', $v));
+                            'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon32', $v));
                 }
             }
         }
index 26112e615ab45f592febc1d22d78fa1475f69aae..d5db5033a9fa023690f91bd8b68551c533eba612 100644 (file)
@@ -754,7 +754,7 @@ abstract class repository {
                 return array('url'=>$ret->get_url(),
                     'id'=>$file->get_itemid(),
                     'file'=>$file->get_filename(),
-                    'icon'=>$CFG->pixpath.'/f/'.mimeinfo('icon', $path)
+                    'icon'=>$CFG->pixpath.'/f/'.mimeinfo('icon32', $path)
                 );
             } else {
                 return null;
@@ -964,7 +964,7 @@ abstract class repository {
                     'date' => $filedate,
                     //'source' => $child->get_url(),
                     'source' => base64_encode($source),
-                    'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo_from_type("icon", $filetype)
+                    'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $filename)
                 );
                 $filecount++;
             }
index e36686d384c67178e044005b9f1e2c19f74be241..1a17c8abce8f45dc2431e0eac7ba7924c7237bdd 100644 (file)
@@ -31,7 +31,7 @@ class repository_s3 extends repository {
                 $folder = array(
                     'title' => $bucket,
                     'children' => array(),
-                    'thumbnail'=>$CFG->pixpath.'/f/folder.gif',
+                    'thumbnail'=>$CFG->pixpath.'/f/folder-32.png',
                     'path'=>$bucket
                     );
                 $tree[] = $folder;
@@ -45,7 +45,7 @@ class repository_s3 extends repository {
                     'size'=>$file['size'],
                     'date'=>userdate($file['time']),
                     'source'=>$path.'/'.$file['name'],
-                    'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon', $file['name'])
+                    'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon32', $file['name'])
                     );
             }
         }
index 8cc3a438b709af1585c7a743aa7fe9c9c0d2fc95..343c36bef7f712625785d6f90db6833d7b47cb84 100755 (executable)
@@ -69,7 +69,7 @@ class repository_smb extends repository {
             } else {
                 $ret['list'][] = array(
                     'title'=>$file,
-                    'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo("icon", $file),
+                    'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $file),
                     'size'=>'',
                     'date'=>'',
                     'source'=>$path.$file);
index 2ad86383da8a74ddae3a60454ad9c77408b6cc0a..b99f1f8b0d7527ae8ecf6a26d5c6fc876b83c94e 100644 (file)
@@ -95,7 +95,7 @@ class repository_webdav extends repository {
                 $title = urldecode(substr($v['href'], strpos($v['href'], $path)+strlen($path)));
                 $ret['list'][] = array(
                     'title'=>$title,
-                    'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo("icon", $title),
+                    'thumbnail' => $CFG->pixpath .'/f/'. mimeinfo('icon32', $title),
                     'size'=>$v['getcontentlength'],
                     'date'=>$filedate,
                     'source'=>$v['href']
index 6d44424069583fe46ddb915bf4f6630f2092a155..f25938c222b13c54e270daebb6481ef20475e9ad 100644 (file)
@@ -14,8 +14,8 @@ class repository_wikimedia extends repository {
         $list['list'] = array();
         foreach ($result as $title=>$url) {
             $list['list'][] = array(
-                'title'=>$title,
-                'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon', 'xx.jpg'),
+                'title'=>substr($title, 5),
+                'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon32', 'xx.jpg'),
                 // plugin-dependent unique path to the file (id, url, path, etc.)
                 'source'=>$url,
                 // the accessible url of the file