add class='preview-icon' to rows in file app that make use of previews
This commit is contained in:
parent
e01bc7de98
commit
1e4ec2ac27
|
@ -34,9 +34,17 @@ $totalsize = 0; ?>
|
||||||
<?php
|
<?php
|
||||||
$relativePath = substr($relativePath, strlen($_['sharingroot']));
|
$relativePath = substr($relativePath, strlen($_['sharingroot']));
|
||||||
?>
|
?>
|
||||||
style="background-image:url(<?php print_unescaped(OCP\publicPreview_icon($relativePath, $_['sharingtoken'])); ?>)"
|
<?php if(\OCP\Preview::isMimeSupported($file['mimetype'])): ?>
|
||||||
|
style="background-image:url(<?php print_unescaped(OCP\publicPreview_icon($relativePath, $_['sharingtoken'])); ?>)" class="preview-icon"
|
||||||
|
<?php else: ?>
|
||||||
|
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
|
||||||
|
<?php endif; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
style="background-image:url(<?php print_unescaped(OCP\preview_icon($relativePath)); ?>)"
|
<?php if(\OCP\Preview::isMimeSupported($file['mimetype'])): ?>
|
||||||
|
style="background-image:url(<?php print_unescaped(OCP\preview_icon($relativePath)); ?>)" class="preview-icon"
|
||||||
|
<?php else: ?>
|
||||||
|
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
|
||||||
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
>
|
>
|
||||||
|
|
|
@ -772,6 +772,22 @@ class Preview {
|
||||||
$preview->deleteAllPreviews();
|
$preview->deleteAllPreviews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function isMimeSupported($mimetype) {
|
||||||
|
//check if there are preview backends
|
||||||
|
if(empty(self::$providers)) {
|
||||||
|
self::initProviders();
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove last element because it has the mimetype *
|
||||||
|
$providers = array_slice(self::$providers, 0, -1);
|
||||||
|
foreach($providers as $supportedmimetype => $provider) {
|
||||||
|
if(preg_match($supportedmimetype, $mimetype)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private static function showErrorPreview() {
|
private static function showErrorPreview() {
|
||||||
$path = \OC::$SERVERROOT . '/core/img/actions/delete.png';
|
$path = \OC::$SERVERROOT . '/core/img/actions/delete.png';
|
||||||
$preview = new \OC_Image($path);
|
$preview = new \OC_Image($path);
|
||||||
|
|
|
@ -1,33 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* ownCloud
|
* Copyright (c) 2013 Frank Karlitschek frank@owncloud.org
|
||||||
*
|
* Copyright (c) 2013 Georg Ehrke georg@ownCloud.com
|
||||||
* @author Frank Karlitschek
|
* This file is licensed under the Affero General Public License version 3 or
|
||||||
* @copyright 2012 Frank Karlitschek frank@owncloud.org
|
* later.
|
||||||
*
|
* See the COPYING-README file.
|
||||||
* This library is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
|
||||||
* License as published by the Free Software Foundation; either
|
|
||||||
* version 3 of the License, or any later version.
|
|
||||||
*
|
|
||||||
* This library is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public
|
|
||||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Public interface of ownCloud for apps to use.
|
|
||||||
* Preview Class.
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// use OCP namespace for all classes that are considered public.
|
|
||||||
// This means that they should be used by apps instead of the internal ownCloud classes
|
|
||||||
namespace OCP;
|
namespace OCP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,4 +25,10 @@ class Preview {
|
||||||
return(\OC_Preview::show($file,$maxX,$maxY,$scaleup));
|
return(\OC_Preview::show($file,$maxX,$maxY,$scaleup));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function isMimeSupported($mimetype='*') {
|
||||||
|
return \OC\Preview::isMimeSupported($mimetype);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue