Show notification that no preview is available if no previewer is found for a public link to a file

This commit is contained in:
Michael Gapczynski 2012-08-29 21:12:10 -04:00
parent 756b514fee
commit f2534e7428
3 changed files with 14 additions and 3 deletions

View File

@ -1,7 +1,8 @@
body { background:#ddd; }
#header { position:fixed; top:0; left:0; right:0; z-index:100; height:2.5em; line-height:2.5em; padding:.5em; background:#1d2d44; -moz-box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; -webkit-box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; }
#details { color:#fff; }
#download { margin-left:2em; font-weight:bold; color:#fff; }
#preview { min-height:30em; margin:50px auto; border-bottom:1px solid #f8f8f8; background:#eee; text-align:center; }
#header #download { margin-left:2em; font-weight:bold; color:#fff; }
#preview { min-height:30em; margin:50px auto; padding-top:2em; border-bottom:1px solid #f8f8f8; background:#eee; text-align:center; }
#noPreview { display:none; padding-top:5em; }
p.info { width:22em; text-align: center; margin:2em auto; color:#777; text-shadow:#fff 0 1px 0; }
p.info a { font-weight:bold; color:#777; }

View File

@ -11,7 +11,11 @@ $(document).ready(function() {
if (mimetype.substr(0, mimetype.indexOf('/')) != 'image') {
// Trigger default action if not download TODO
var action = FileActions.getDefault(mimetype, 'file', FileActions.PERMISSION_READ);
action($('#filename').val());
if (typeof action === 'undefined') {
$('#noPreview').show();
} else {
action($('#filename').val());
}
}
}

View File

@ -13,5 +13,11 @@
<?php if (substr($_['mimetype'], 0 , strpos($_['mimetype'], '/')) == 'image'): ?>
<img src="<?php echo $_['downloadURL']; ?>" />
<?php endif; ?>
<ul id="noPreview">
<li class="error">
<?php echo $l->t('No preview available for').' '.$_['filename']; ?><br />
<a href="<?php echo $_['downloadURL']; ?>" id="download"><img class="svg" alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>" /><?php echo $l->t('Download')?></a>
</li>
</ul>
</div>
<footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> &ndash; <?php echo $l->t('web services under your control'); ?></p></footer>