diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-02-07 20:08:25 +0400 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-02-07 20:08:25 +0400 |
commit | fb6290c87a9cfd43ca1332c6ef65ccbb29b073c6 (patch) | |
tree | 02fed9f6a282af3393b231d0cc3239ac6c0a18ea /apps/files_sharing | |
parent | 9c9b161f5116ba37d67620628965f9d42bb7120e (diff) | |
parent | 5edc4c95bc686a702b37e5a2b93e0557d50b86ec (diff) |
Merge pull request #7083 from owncloud/backport_6777_stable6
Backport 6777 stable6
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/css/mobile.css | 49 | ||||
-rw-r--r-- | apps/files_sharing/css/public.css | 67 | ||||
-rw-r--r-- | apps/files_sharing/js/public.js | 24 | ||||
-rw-r--r-- | apps/files_sharing/public.php | 5 | ||||
-rw-r--r-- | apps/files_sharing/templates/public.php | 83 |
5 files changed, 101 insertions, 127 deletions
diff --git a/apps/files_sharing/css/mobile.css b/apps/files_sharing/css/mobile.css new file mode 100644 index 00000000000..7d2116d190d --- /dev/null +++ b/apps/files_sharing/css/mobile.css @@ -0,0 +1,49 @@ +@media only screen and (max-width: 600px) { + +/* make header scroll up for single shares, more view of content on small screens */ +#header.share-file { + position: absolute !important; +} + +/* hide size and date columns */ +table th#headerSize, +table td.filesize, +table th#headerDate, +table td.date { + display: none; +} + +/* restrict length of displayed filename to prevent overflow */ +table td.filename .nametext { + max-width: 75% !important; +} + +/* on mobile, show single shared image at full width without margin */ +#imgframe { + width: 100%; + padding: 0; + margin-bottom: 35px; +} +/* some margin for the file type icon */ +#imgframe .publicpreview { + margin-top: 32px; +} + +/* always show actions on mobile */ +#fileList a.action { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)" !important; + filter: alpha(opacity=20) !important; + opacity: .2 !important; + display: inline !important; +} +/* some padding for better clickability */ +#fileList a.action img { + padding: 0 6px 0 12px; +} +/* hide text of the actions on mobile */ +#fileList a.action span { + display: none; +} + + +} diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css index afcee14e1b5..8d03868a972 100644 --- a/apps/files_sharing/css/public.css +++ b/apps/files_sharing/css/public.css @@ -14,39 +14,17 @@ body { padding:7px; } -#details { - color:#fff; - float: left; -} - -#public_upload, -#download { - font-weight:700; - margin: 0 0 0 .4em; - padding: 0 5px; - height: 32px; - float: left; - -} - -.header-right #details { - margin-right: 28px; -} - .header-right { padding: 0; height: 32px; } -#public_upload { - margin-left: 0.3em; -} - -#public_upload img, -#download img { - padding-left:.1em; - padding-right:.3em; - vertical-align:text-bottom; +#details { + color:#fff; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; + filter: alpha(opacity=50); + opacity: .5; + padding-right: 5px; } #controls { @@ -71,9 +49,8 @@ footer { p.info { color: #777; text-align: center; - width: 22em; margin: 0 auto; - padding: 20px; + padding: 20px 0; } p.info a { @@ -94,9 +71,13 @@ p.info a { max-width:100%; } -thead{ - background-color: white; - padding-left:0 !important; /* fixes multiselect bar offset on shared page */ +/* some margin for the file type icon */ +#imgframe .publicpreview { + margin-top: 10%; +} + +thead { + padding-left: 0 !important; /* fixes multiselect bar offset on shared page */ } #data-upload-form { @@ -110,25 +91,21 @@ thead{ margin: 0; } -#file_upload_start { - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - filter: alpha(opacity=0); - opacity: 0; - z-index: 20; - position: absolute !important; - top: 0; - left: 0; - width: 100% !important; -} - +.directDownload, .directLink { margin-bottom: 20px; } +.directDownload .button img { + vertical-align: text-bottom; +} .directLink label { font-weight: normal; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; + filter: alpha(opacity=50); + opacity: .5; } .directLink input { - margin-left: 10px; + margin-left: 5px; width: 300px; } .public_actions { diff --git a/apps/files_sharing/js/public.js b/apps/files_sharing/js/public.js index 4c0b0ad9d48..730649c6378 100644 --- a/apps/files_sharing/js/public.js +++ b/apps/files_sharing/js/public.js @@ -9,22 +9,13 @@ function fileDownloadPath(dir, file) { $(document).ready(function() { - $('#data-upload-form').tipsy({gravity:'ne', fade:true}); - if (typeof FileActions !== 'undefined') { var mimetype = $('#mimetype').val(); // Show file preview if previewer is available, images are already handled by the template if (mimetype.substr(0, mimetype.indexOf('/')) != 'image' && $('.publicpreview').length === 0) { // Trigger default action if not download TODO var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ); - if (typeof action === 'undefined') { - $('#noPreview').show(); - if (mimetype != 'httpd/unix-directory') { - // NOTE: Remove when a better file previewer solution exists - $('#content').remove(); - $('table').remove(); - } - } else { + if (typeof action !== 'undefined') { action($('#filename').val()); } } @@ -58,16 +49,9 @@ $(document).ready(function() { }; }); - // Add Uploadprogress Wrapper to controls bar - $('#controls').append($('#controls .actions div#uploadprogresswrapper')); - $('#uploadprogresswrapper').addClass('public_actions'); - - // Cancel upload trigger - $('#cancel_upload_button').click(function() { - OC.Upload.cancelUploads(); - procesSelection(); + $(document).on('click', '#directLink', function() { + $(this).focus(); + $(this).select(); }); - $('#directLink').focus(); - }); diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 2407903a928..23e147eecbe 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -136,6 +136,7 @@ if (isset($path)) { } else { OCP\Util::addScript('files', 'file-upload'); OCP\Util::addStyle('files_sharing', 'public'); + OCP\Util::addStyle('files_sharing', 'mobile'); OCP\Util::addScript('files_sharing', 'public'); OCP\Util::addScript('files', 'fileactions'); OCP\Util::addScript('files', 'jquery.iframe-transport'); @@ -158,7 +159,6 @@ if (isset($path)) { if ($linkItem['item_type'] !== 'folder') { $allowPublicUploadEnabled = false; } - $tmpl->assign('allowPublicUploadEnabled', $allowPublicUploadEnabled); $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); $tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize)); @@ -224,7 +224,8 @@ if (isset($path)) { $folder->assign('fileList', $list->fetchPage()); $folder->assign('breadcrumb', $breadcrumbNav->fetchPage()); $folder->assign('dir', $getPath); - $folder->assign('isCreatable', false); + $folder->assign('isCreatable', $allowPublicUploadEnabled); + $folder->assign('dirToken', $linkItem['token']); $folder->assign('permissions', OCP\PERMISSION_READ); $folder->assign('isPublic',true); $folder->assign('publicUploadEnabled', 'no'); diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index e1132142eff..3ddaf4446df 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -9,54 +9,14 @@ <input type="hidden" name="sharingToken" value="<?php p($_['sharingToken']) ?>" id="sharingToken"> <input type="hidden" name="filename" value="<?php p($_['filename']) ?>" id="filename"> <input type="hidden" name="mimetype" value="<?php p($_['mimetype']) ?>" id="mimetype"> -<header><div id="header" class="icon icon-noise"> +<header><div id="header" class="icon icon-noise <?php p((isset($_['folder']) ? 'share-folder' : 'share-file')) ?>"> <a href="<?php print_unescaped(link_to('', 'index.php')); ?>" title="" id="owncloud"><img class="svg" src="<?php print_unescaped(image_path('', 'logo-wide.svg')); ?>" alt="<?php p($theme->getName()); ?>" /></a> <div id="logo-claim" style="display:none;"><?php p($theme->getLogoClaim()); ?></div> <div class="header-right"> - <?php if (isset($_['folder'])): ?> - <span id="details"><?php p($l->t('%s shared the folder %s with you', - array($_['displayName'], $_['filename']))) ?></span> - <?php else: ?> - <span id="details"><?php p($l->t('%s shared the file %s with you', - array($_['displayName'], $_['filename']))) ?></span> - <?php endif; ?> - - - <?php if (!isset($_['folder']) || $_['allowZipDownload']): ?> - <a href="<?php p($_['downloadURL']); ?>" class="button" id="download"> - <img class="svg" alt="Download" src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>" /> - <span><?php p($l->t('Download'))?></span> - </a> - <?php endif; ?> - - <?php if ($_['allowPublicUploadEnabled']):?> - - - <input type="hidden" id="publicUploadRequestToken" name="requesttoken" value="<?php p($_['requesttoken']) ?>" /> - <input type="hidden" id="dirToken" name="dirToken" value="<?php p($_['dirToken']) ?>" /> - <input type="hidden" id="uploadMaxFilesize" name="uploadMaxFilesize" value="<?php p($_['uploadMaxFilesize']) ?>" /> - <input type="hidden" id="uploadMaxHumanFilesize" name="uploadMaxHumanFilesize" value="<?php p($_['uploadMaxHumanFilesize']) ?>" /> - <input type="hidden" id="directory_path" name="directory_path" value="<?php p($_['directory_path']) ?>" /> - <?php if($_['uploadMaxFilesize'] >= 0):?> - <input type="hidden" name="MAX_FILE_SIZE" id="max_upload" - value="<?php p($_['uploadMaxFilesize']) ?>"> - <?php endif;?> - - - <div id="data-upload-form" title="<?php p($l->t('Upload') . ' max. '.$_['uploadMaxHumanFilesize']) ?>"> - <input id="file_upload_start" type="file" name="files[]" data-url="<?php print_unescaped(OCP\Util::linkTo('files', 'ajax/upload.php')); ?>" multiple> - <a href="#" id="public_upload" class="button"> - <img class="svg" alt="Upload" src="<?php print_unescaped(OCP\image_path("core", "actions/upload.svg")); ?>" /> - <span><?php p($l->t('Upload'))?></span> - </a> - </div> - - </div> - <div> - <?php endif; ?> + <span id="details"><?php p($l->t('shared by %s', array($_['displayName']))) ?></span> </div> - </div></header> +</div></header> <div id="content"> <div id="preview"> <?php if (isset($_['folder'])): ?> @@ -72,25 +32,28 @@ <source src="<?php p($_['downloadURL']); ?>" type="<?php p($_['mimetype']); ?>" /> </video> </div> - <?php elseif (\OC\Preview::isMimeSupported($_['mimetype'])): ?> + <?php else: ?> <div id="imgframe"> - <img src="<?php p(OCP\Util::linkToRoute( 'core_ajax_public_preview', array('x' => 500, 'y' => 500, 'file' => urlencode($_['directory_path']), 't' => $_['dirToken']))); ?>" class="publicpreview"/> + <?php $size = \OC\Preview::isMimeSupported($_['mimetype']) ? 500 : 128 ?> + <img src="<?php p(OCP\Util::linkToRoute( 'core_ajax_public_preview', array('x' => $size, 'y' => $size, 'file' => urlencode($_['directory_path']), 't' => $_['dirToken']))); ?>" class="publicpreview"/> </div> - <?php else: ?> - <ul id="noPreview"> - <li class="error"> - <?php p($l->t('No preview available for').' '.$_['filename']); ?><br /> - <a href="<?php p($_['downloadURL']); ?>" id="download"><img class="svg" alt="Download" - src="<?php print_unescaped(OCP\image_path("core", "actions/download.svg")); ?>" - /><?php p($l->t('Download'))?></a> - </li> - </ul> <?php endif; ?> - <div class="directLink"><label for="directLink"><?php p($l->t('Direct link')) ?></label><input id="directLink" type="text" readonly value="<?php p($_['downloadURL']); ?>"></input></div> + <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")); ?>"/> + <?php p($l->t('Download %s', array($_['filename'])))?> + </a> + </div> + <div class="directLink"> + <label for="directLink"><?php p($l->t('Direct link')) ?></label> + <input id="directLink" type="text" readonly value="<?php p($_['downloadURL']); ?>"> + </div> <?php endif; ?> </div> - <footer> - <p class="info"> - <?php print_unescaped($theme->getLongFooter()); ?> - </p> - </footer> + +</div> +<footer> + <p class="info"> + <?php print_unescaped($theme->getLongFooter()); ?> + </p> +</footer> |