|
|
|
|
@ -14,12 +14,10 @@ |
|
|
|
|
OCA.Files.Search = { |
|
|
|
|
attach: function(search) { |
|
|
|
|
search.setFilter('files', function (query) { |
|
|
|
|
if (query) { |
|
|
|
|
if (OCA.Files) { |
|
|
|
|
OCA.Files.App.fileList.filter(query); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if (OCA.Files) { |
|
|
|
|
if (OCA.Files.Search.fileAppLoaded()) { |
|
|
|
|
if (query) { |
|
|
|
|
OCA.Files.App.fileList.setFilter(query); |
|
|
|
|
} else { |
|
|
|
|
OCA.Files.App.fileList.unfilter(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -34,6 +32,9 @@ |
|
|
|
|
search.setHandler(['file', 'audio', 'image'], OCA.Files.Search.handleFileClick); |
|
|
|
|
}, |
|
|
|
|
renderFolderResult: function($row, result) { |
|
|
|
|
if (OCA.Files.Search.inFileList($row, result)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
/*render folder icon, show path beneath filename, |
|
|
|
|
show size and last modified date on the right */ |
|
|
|
|
// backward compatibility:
|
|
|
|
|
@ -43,13 +44,17 @@ |
|
|
|
|
result.mime = result.mime_type; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var $pathDiv = $('<div class="path"></div>').text(result.path) |
|
|
|
|
var $pathDiv = $('<div class="path"></div>').text(result.path); |
|
|
|
|
$row.find('td.info div.name').after($pathDiv).text(result.name); |
|
|
|
|
|
|
|
|
|
$row.find('td.result a').attr('href', result.link); |
|
|
|
|
$row.find('td.icon').css('background-image', 'url(' + OC.imagePath('core', 'filetypes/folder') + ')'); |
|
|
|
|
return $row; |
|
|
|
|
}, |
|
|
|
|
renderFileResult: function($row, result) { |
|
|
|
|
if (OCA.Files.Search.inFileList($row, result)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
/*render preview icon, show path beneath filename, |
|
|
|
|
show size and last modified date on the right */ |
|
|
|
|
// backward compatibility:
|
|
|
|
|
@ -64,7 +69,7 @@ |
|
|
|
|
|
|
|
|
|
$row.find('td.result a').attr('href', result.link); |
|
|
|
|
|
|
|
|
|
if (OCA.Files) { |
|
|
|
|
if (OCA.Files.Search.fileAppLoaded()) { |
|
|
|
|
OCA.Files.App.fileList.lazyLoadPreview({ |
|
|
|
|
path: result.path, |
|
|
|
|
mime: result.mime, |
|
|
|
|
@ -84,20 +89,36 @@ |
|
|
|
|
OC.generateUrl('/apps/files/?dir={dir}&scrollto={scrollto}', {dir: dir, scrollto: result.name}) |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
return $row; |
|
|
|
|
}, |
|
|
|
|
renderAudioResult: function($row, result) { |
|
|
|
|
if (OCA.Files.Search.inFileList($row, result)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
/*render preview icon, show path beneath filename, |
|
|
|
|
show size and last modified date on the right |
|
|
|
|
show Artist and Album */ |
|
|
|
|
return $row; |
|
|
|
|
}, |
|
|
|
|
renderImageResult: function($row, result) { |
|
|
|
|
if (OCA.Files.Search.inFileList($row, result)) { |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
/*render preview icon, show path beneath filename, |
|
|
|
|
show size and last modified date on the right |
|
|
|
|
show width and height */ |
|
|
|
|
return $row; |
|
|
|
|
}, |
|
|
|
|
inFileList: function($row, result){ |
|
|
|
|
if (OCA.Files.Search.fileAppLoaded() && OCA.Files.App.fileList.inList(result.name)) { |
|
|
|
|
return true; |
|
|
|
|
} else { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleFolderClick: function($row, result, event) { |
|
|
|
|
// open folder
|
|
|
|
|
if (OCA.Files) { |
|
|
|
|
if (OCA.Files.Search.fileAppLoaded()) { |
|
|
|
|
OCA.Files.App.fileList.changeDirectory(result.path); |
|
|
|
|
return false; |
|
|
|
|
} else { |
|
|
|
|
@ -105,13 +126,16 @@ |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
handleFileClick: function($row, result, event) { |
|
|
|
|
if (OCA.Files) { |
|
|
|
|
if (OCA.Files.Search.fileAppLoaded()) { |
|
|
|
|
OCA.Files.App.fileList.changeDirectory(OC.dirname(result.path)); |
|
|
|
|
OCA.Files.App.fileList.scrollTo(result.name); |
|
|
|
|
return false; |
|
|
|
|
} else { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
fileAppLoaded: function() { |
|
|
|
|
return OCA.Files && OCA.Files.App; |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
})(); |
|
|
|
|
|