summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/ajax/rawlist.php19
-rw-r--r--core/js/oc-dialogs.js22
2 files changed, 22 insertions, 19 deletions
diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php
index 37fd12f71d0..2fd6f67d308 100644
--- a/apps/files/ajax/rawlist.php
+++ b/apps/files/ajax/rawlist.php
@@ -11,22 +11,23 @@ OCP\JSON::checkLoggedIn();
// Load the files
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
-$mimetype = isset($_GET['mimetype']) ? $_GET['mimetype'] : '';
-$mimetypeList = isset($_GET['mimetype_list']) ? json_decode($_GET['mimetype_list'], true) : '';
+$mimetypes = isset($_GET['mimetypes']) ? array_unique(json_decode($_GET['mimetypes'], true)) : '';
// make filelist
$files = array();
// If a type other than directory is requested first load them.
-if( ($mimetype || $mimetypeList) && strpos($mimetype, 'httpd/unix-directory') === false) {
+if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) {
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, 'httpd/unix-directory' ) as $i ) {
$i["date"] = OCP\Util::formatDate($i["mtime"] );
- $i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']);
+ $i['mimetype_icon'] = ($i['type'] == 'dir')
+ ? \mimetype_icon('dir')
+ : \mimetype_icon($i['mimetype']);
$files[] = $i;
}
}
-if (is_array($mimetypeList)) {
- foreach ($mimetypeList as $mimetype) {
+if (is_array($mimetypes) && count($mimetypes)) {
+ foreach ($mimetypes as $mimetype) {
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $i ) {
$i["date"] = OCP\Util::formatDate($i["mtime"]);
$i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']);
@@ -34,11 +35,11 @@ if (is_array($mimetypeList)) {
}
}
} else {
- foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $i ) {
- $i["date"] = OCP\Util::formatDate($i["mtime"] );
+ foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) {
+ $i["date"] = OCP\Util::formatDate($i["mtime"]);
$i['mimetype_icon'] = $i['type'] == 'dir' ? \mimetype_icon('dir'): \mimetype_icon($i['mimetype']);
$files[] = $i;
}
}
-OCP\JSON::success(array('data' => $files));
+OC_JSON::success(array('data' => $files));
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index f4c339702e1..ed4d7c678e1 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -244,17 +244,19 @@ var OCdialogs = {
return defer.promise();
},
_getFileList: function(dir, mimeType) {
- if (typeof(mimeType) === "object") {
- return $.getJSON(
- OC.filePath('files', 'ajax', 'rawlist.php'),
- {dir: dir, "mimetype_list": JSON.stringify(mimeType)}
- );
- } else {
- return $.getJSON(
- OC.filePath('files', 'ajax', 'rawlist.php'),
- {dir: dir, mimetype: mimeType}
- );
+ if (typeof(mimeType) === "string") {
+ var tmp = mimeType;
+ mimeType = new Array();
+ mimeType[0] = tmp;
}
+
+ return $.getJSON(
+ OC.filePath('files', 'ajax', 'rawlist.php'),
+ {
+ dir: dir,
+ mimetypes: JSON.stringify(mimeType)
+ }
+ );
},
_determineValue: function(element) {
if ( $(element).attr('type') === 'checkbox' ) {