Skip to content

Commit

Permalink
Core side commit to display files shared by link
Browse files Browse the repository at this point in the history
  • Loading branch information
nadir committed Nov 13, 2015
1 parent 81b63a3 commit d3558dc
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions apps/files_sharing/templates/public.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,42 @@
<!-- Preview frame is filled via JS to support SVG images for modern browsers -->
<div id="imgframe"></div>
<?php endif; ?>
<?php $mime = $_['mimetype']; if($mime == 'application/x-root' || $mime == 'text/plain'): ?>
<div class="directDownload">
<a href="#" id="viewonline" mimetype="<?php p($_['mimetype']); ?>" class="button">
<img class="svg" alt="" src="<?php print_unescaped(OCP\image_path("core", "actions/play.svg")); ?>"/>
<?php p($l->t('View %s online', array($_['filename'])))?>
</a>
<script>
var dots = 0;

$('#viewonline').on('click', function() {
var mimetype = $('#viewonline').attr('mimetype');

$('#imgframe').empty();
$('#imgframe').text('Loading');
setInterval(loadingAnimation, 600);
$('div.directDownload').each( function(i) {
this.remove();
});

rootjsShowFileEditor('', $('#sharingToken').attr('value'), mimetype);

return false;
});

function loadingAnimation() {
if(dots < 3) {
$('#imgframe').append('.');
dots++;
} else {
dots = 0;
$('#imgframe').text('Loading');
}
}
</script>
</div>
<?php endif;?>
<div class="directDownload">
<a href="<?php p($_['downloadURL']); ?>" id="download" class="button">
<img class="svg" alt="" src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>"/>
Expand Down

0 comments on commit d3558dc

Please sign in to comment.