From 06d0a41915998918c2c162d609ee0eeded0a849d Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 2 Jun 2015 14:12:47 +0200 Subject: [PATCH 1/6] add social media button for diaspora, twitter, facebook and google+ --- .../css/3rdparty/gs-share/style.css | 49 +++++ apps/files_sharing/css/settings-personal.css | 3 + apps/files_sharing/img/gs-share.png | Bin 0 -> 863 bytes .../js/3rdparty/gs-share/gs-share.js | 206 ++++++++++++++++++ apps/files_sharing/js/settings-personal.js | 15 ++ apps/files_sharing/settings-personal.php | 7 + .../templates/settings-personal.php | 69 +++++- 7 files changed, 343 insertions(+), 6 deletions(-) create mode 100644 apps/files_sharing/css/3rdparty/gs-share/style.css create mode 100644 apps/files_sharing/css/settings-personal.css create mode 100644 apps/files_sharing/img/gs-share.png create mode 100644 apps/files_sharing/js/3rdparty/gs-share/gs-share.js create mode 100644 apps/files_sharing/js/settings-personal.js diff --git a/apps/files_sharing/css/3rdparty/gs-share/style.css b/apps/files_sharing/css/3rdparty/gs-share/style.css new file mode 100644 index 00000000000..c699ddb3db5 --- /dev/null +++ b/apps/files_sharing/css/3rdparty/gs-share/style.css @@ -0,0 +1,49 @@ +.js-gs-share, .gs-share [aria-hidden="true"], .gs-share-form[aria-hidden="true"] { + display: none; +} + +.js-gs-share-enabled .js-gs-share { + display: inline; + float: left; +} + +.gs-share .js-gs-share[href] { + display: inline; +} + +.gs-share [aria-hidden="false"], .gs-share-form[aria-hidden="false"] { + display: block; + margin-top: 40px; +} + +.gs-share { + position: relative; +} + +.gs-share-form { + background: #FFF; + border: 1px solid #000; + border-radius: 5px; + padding: 5px; + position: absolute; + z-index: 1; +} + +.gs-share [for="gs-account"], .gs-share [type="text"] { + display: block; + margin-bottom: 8px; +} + +.gs-share [type="submit"] { + display: block; + margin-top: 8px; +} + +.gs-share--icon { + border: none; + cursor: pointer; + min-height: 32px; + padding: 0; + padding-left: 33px; + background: transparent url('../../../img/gs-share.png') no-repeat left center; +} diff --git a/apps/files_sharing/css/settings-personal.css b/apps/files_sharing/css/settings-personal.css new file mode 100644 index 00000000000..de438844c7f --- /dev/null +++ b/apps/files_sharing/css/settings-personal.css @@ -0,0 +1,3 @@ +#fileSharingSettings img { + cursor: pointer; +} diff --git a/apps/files_sharing/img/gs-share.png b/apps/files_sharing/img/gs-share.png new file mode 100644 index 0000000000000000000000000000000000000000..25b0c4d06fee747919b945d3ded988ca368283a1 GIT binary patch literal 863 zcmV-l1EBngP)b=ETSS`}@IecH_Lju}4wZqo}V! zO#Alt&W)4Gf{E$O&-3Er`SJ4h>g%H>GWF-^@7UVGZFSLK=$F${t(@n5|Y{jlZy^~ngN)UXYTJ83#x!6VK2j{0=O=q=)ZFS00B=)L_t(2 zk#*BmbHY#%1>nVsTdBLt-3Eu^b$54ncX$2Wy$K0)BIjk#>=&O2fW_e?a&bB=0CuCS zu`$}grig^tz$(^5Lw{UxQ#l0%gbIfK@qMmC;zZ7N2 zrRxMTgCg})ZA;gwp@C76wo~=d>1|=-6={&FpUx!r)Fa}j3Lu8*`21pZTC5$2ckKN6 zjpI{Lti64R&+Pq@3_eKSm-M?4KT@f02Hzj0N@i}-AM))!vjSC?qqm9JYvLuES*Sou zl%s_lgCZJo05m2AG--g1TBpyZn3FucP7N|C;jWo4M*x*&tQN>)ZWW7#3fMrcytGIb po15sbRb3%#HLiMBZC&I4)gN^Zi>YM1$QS?s002ovPDHLkV1k>Crt$y) literal 0 HcmV?d00001 diff --git a/apps/files_sharing/js/3rdparty/gs-share/gs-share.js b/apps/files_sharing/js/3rdparty/gs-share/gs-share.js new file mode 100644 index 00000000000..fd4442708a4 --- /dev/null +++ b/apps/files_sharing/js/3rdparty/gs-share/gs-share.js @@ -0,0 +1,206 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// @license magnet:?xt=urn:btih:3877d6d54b3accd4bc32f8a48bf32ebc0901502a&dn=mpl-2.0.txt MPL 2.0 +document.addEventListener('DOMContentLoaded', function () { + 'use strict'; + /** + * 'Share' widget for GNU social + * http://code.chromic.org/project/view/2/ + * + * We make a few assumptions about the target instance: + * 1) The API root is in the default location + * 2) Fancy URLs are enabled + * 3) CORS is allowed + * 4) The Bookmark plugin is enabled + * + * If 1), 3) or 4) are wrong, we fall back to a regular + * notice (instead of a bookmark notice) + * + * If 2) is wrong the user will be directed to a 404 :( + */ + + // TODO: input sanitation [1], [2] + // TODO: server-side fallback if JS is disabled + + var createForm, + bindClicks, + frm, + shareAsNotice, + shareAsBookmark, + extractURLParams, + shareURL, + shareTitle, + closest, + i18n = window.i18n; + + /** + * Internationalization + */ + if (i18n === undefined) { + i18n = { + invalidId: 'The account id provided is invalid', + yourAcctId: 'Your account ID:', + idPlaceholder: 'user@example.org', + shareAsBookmark: 'Share as a bookmark' + }; + } + + shareAsNotice = function (title, url, domain) { + window.open('http://' + domain + '/notice/new?status_textarea=' + title + ' ' + url); // [1] + }; + + shareAsBookmark = function (title, url, domain) { + window.open('http://' + domain + '/main/bookmark/new?url=' + url + '&title=' + title); // [2] + }; + + /** + * Extract parameters from query string + * + * ex: + * ?foo=bar&baz=test + * will return: + * {foo: 'bar', baz: 'test'} + */ + extractURLParams = function (queryStr) { + var parts = queryStr.substr(1).split('&'), + i, len, keyVal, params = {}; + + for (i = 0, len = parts.length; i < len; i += 1) { + keyVal = parts[i].split('='); + params[keyVal[0]] = keyVal[1]; + } + + return params; + }; + + // Create the form that we'll re-use throughout the page + createForm = function () { + var err = document.createElement('div'); + err.setAttribute('class', 'gs-share-err'); + err.setAttribute('tabindex', '-1'); + err.setAttribute('aria-hidden', 'true'); + err.textContent = i18n.invalidId; + + frm = document.createElement('form'); + + frm.setAttribute('class', 'gs-share-form'); + frm.setAttribute('tabindex', '-1'); + frm.setAttribute('aria-hidden', 'true'); + + frm.innerHTML = '' + + '' + + ' ' + + ''; + frm.insertBefore(err, frm.firstChild); + + // Submit handler + frm.addEventListener('submit', function (e) { + e.preventDefault(); + + var accountParts = document.getElementById('gs-account').value.split('@'), + username, domain, xhr, bookmarkURL; + + if (accountParts.length === 2) { + err.setAttribute('aria-hidden', 'true'); + + username = accountParts[0]; + domain = accountParts[1]; + bookmarkURL = 'http://' + domain + '/api/bookmarks/' + username + '.json'; + + // Try bookmark + if (document.getElementById('gs-bookmark').checked) { + xhr = new XMLHttpRequest(); + + xhr.onreadystatechange = function () { + if (xhr.readyState === 4) { + if (xhr.status === 200) { // Success + shareAsBookmark(shareTitle, shareURL, domain); + } else { // Failure, fallback to regular notice + shareAsNotice(shareTitle, shareURL, domain); + } + } + }; + + xhr.open('GET', bookmarkURL, true); + xhr.send(); + } else { // Regular notice + shareAsNotice(shareTitle, shareURL, domain); + } + } else { // Invalid account id + err.setAttribute('aria-hidden', 'false'); + err.focus(); + } + }); + + // Keydown handler + frm.addEventListener('keydown', function (e) { + if (e.keyCode === 27) { // Escape key closes the dialog + frm.parentElement.getElementsByClassName('js-gs-share')[0].focus(); + frm.setAttribute('aria-hidden', 'true'); + } + }); + + document.body.appendChild(frm); + }; + + /** + * Something similar to jQuery.closest + * + * Given `elm`, return the closest parent with class `cls` + * or false if there is no matching ancestor. + */ + closest = function (elm, cls) { + while (elm !== document) { + if (elm.classList.contains(cls)) { + return elm; + } + + elm = elm.parentNode; + } + + return false; + }; + + bindClicks = function () { + document.addEventListener('click', function (e) { + var target = e.target, + urlParams, + lnk = closest(target, 'js-gs-share'); + + // Don't do anything on right/middle click or if ctrl or shift was pressed while left-clicking + if (!e.button && !e.ctrlKey && !e.shiftKey && lnk) { + e.preventDefault(); + + // Check for submission information in href first + if (lnk.search !== undefined) { + urlParams = extractURLParams(lnk.search); + shareURL = urlParams.url; + shareTitle = urlParams.title; + } else { // If it's not there, try data-* attributes. If not, use current document url and title + shareURL = lnk.getAttribute('data-url') || window.location.href; + shareTitle = lnk.getAttribute('data-title') || document.title; + } + + // Move form after the clicked link + lnk.parentNode.appendChild(frm); + + // Show form + frm.setAttribute('aria-hidden', 'false'); + + // Focus on form + frm.focus(); + } else if (!frm.contains(target)) { + frm.setAttribute('aria-hidden', 'true'); + } + }); + }; + + // Flag that js is enabled + document.body.classList.add('js-gs-share-enabled'); + + createForm(); + bindClicks(); +}); +// @license-end diff --git a/apps/files_sharing/js/settings-personal.js b/apps/files_sharing/js/settings-personal.js new file mode 100644 index 00000000000..800579d1eca --- /dev/null +++ b/apps/files_sharing/js/settings-personal.js @@ -0,0 +1,15 @@ +$(document).ready(function() { + + $('#fileSharingSettings img').click(function() { + var url = $(this).data('url'); + if (url) { + var width = 600; + var height = 400; + var left = (screen.width/2)-(width/2); + var top = (screen.height/2)-(height/2); + + window.open(url, 'name', 'width=' + width + ', height=' + height + ', top=' + top + ', left=' + left); + } + }); + +}); diff --git a/apps/files_sharing/settings-personal.php b/apps/files_sharing/settings-personal.php index 1aff784b488..d95c15001e3 100644 --- a/apps/files_sharing/settings-personal.php +++ b/apps/files_sharing/settings-personal.php @@ -22,11 +22,18 @@ \OC_Util::checkLoggedIn(); +$l = \OC::$server->getL10N('files_sharing'); + $uid = \OC::$server->getUserSession()->getUser()->getUID(); $server = \OC::$server->getURLGenerator()->getAbsoluteURL('/'); $cloudID = $uid . '@' . rtrim(\OCA\Files_Sharing\Helper::removeProtocolFromUrl($server), '/'); +$url = 'https://owncloud.org/federation'; $tmpl = new OCP\Template('files_sharing', 'settings-personal'); +$tmpl->assign('outgoingServer2serverShareEnabled', \OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled()); +$tmpl->assign('message_with_URL', $l->t('Share with me through my #ownCloud federation Id %s see %s', [$cloudID, $url])); +$tmpl->assign('message_without_URL', $l->t('Share with me through my #ownCloud federation Id %s', [$cloudID])); +$tmpl->assign('reference', $url); $tmpl->assign('cloudId', $cloudID); return $tmpl->fetchPage(); diff --git a/apps/files_sharing/templates/settings-personal.php b/apps/files_sharing/templates/settings-personal.php index 84d8e8a1b13..84efd1dd1db 100644 --- a/apps/files_sharing/templates/settings-personal.php +++ b/apps/files_sharing/templates/settings-personal.php @@ -1,12 +1,69 @@ -
-

t('Federated Cloud'));?>

-

- t('Your Federated Cloud ID: %s', [$_['cloudId']])); ?> -

+ +
+

t('Federated Cloud')); ?>

-
+

+ t('Your Federated Cloud ID: %s', [$_['cloudId']])); ?> +

+ +

+ +

t('Share your Federated Cloud Id:')); ?>

+ +

+ +

+ +
+ + + Share on Diaspora&url='/> +  | Share on Twitter'/> +  | Share on Facebook'/> +  | Share on Google+'/> + +

+ +
+ +

t('Add your Federated Cloud Id to your homepage:')); ?>

+ +

+ + + <?php p($_['/> + + +
+ t('HTML Code:')); ?> +
+ +

+ <a href="<?php p($_['reference']); ?>"> + <img src='TODO: Add Banner/Button' + alt='<?php p($_['message_with_URL']); ?>'/> + </a> + + +

+ +
+ From 4599da9608edba255bd4e5806e16424c11ca3de2 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 17 Jun 2015 12:34:49 +0200 Subject: [PATCH 2/6] federated cloud ID: add icons, fix HTML & layout, fix wording --- apps/files_sharing/css/settings-personal.css | 29 +++++++ apps/files_sharing/img/gs-share.png | Bin 863 -> 0 bytes apps/files_sharing/img/social-diaspora.svg | 52 ++++++++++++ apps/files_sharing/img/social-facebook.svg | 43 ++++++++++ apps/files_sharing/img/social-gnu.svg | 79 ++++++++++++++++++ apps/files_sharing/img/social-googleplus.svg | 45 ++++++++++ apps/files_sharing/img/social-owncloud.svg | 44 ++++++++++ apps/files_sharing/img/social-twitter.svg | 53 ++++++++++++ apps/files_sharing/settings-personal.php | 4 +- .../templates/settings-personal.php | 72 ++++++++-------- 10 files changed, 382 insertions(+), 39 deletions(-) delete mode 100644 apps/files_sharing/img/gs-share.png create mode 100644 apps/files_sharing/img/social-diaspora.svg create mode 100644 apps/files_sharing/img/social-facebook.svg create mode 100644 apps/files_sharing/img/social-gnu.svg create mode 100644 apps/files_sharing/img/social-googleplus.svg create mode 100644 apps/files_sharing/img/social-owncloud.svg create mode 100644 apps/files_sharing/img/social-twitter.svg diff --git a/apps/files_sharing/css/settings-personal.css b/apps/files_sharing/css/settings-personal.css index de438844c7f..c9af6c08c40 100644 --- a/apps/files_sharing/css/settings-personal.css +++ b/apps/files_sharing/css/settings-personal.css @@ -1,3 +1,32 @@ #fileSharingSettings img { cursor: pointer; } + +#fileSharingSettings xmp { + margin-top: 0; +} + +[class^="social-"], [class*=" social-"] { + background-repeat: no-repeat; + background-position: 2px; + min-width: 16px; + min-height: 16px; + padding-left: 29px; + background-size: 24px; +} + +.social-gnu { + background-image: url('../img/social-gnu.svg'); +} +.social-diaspora { + background-image: url('../img/social-diaspora.svg'); +} +.social-twitter { + background-image: url('../img/social-twitter.svg'); +} +.social-facebook { + background-image: url('../img/social-facebook.svg'); +} +.social-googleplus { + background-image: url('../img/social-googleplus.svg'); +} diff --git a/apps/files_sharing/img/gs-share.png b/apps/files_sharing/img/gs-share.png deleted file mode 100644 index 25b0c4d06fee747919b945d3ded988ca368283a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 863 zcmV-l1EBngP)b=ETSS`}@IecH_Lju}4wZqo}V! zO#Alt&W)4Gf{E$O&-3Er`SJ4h>g%H>GWF-^@7UVGZFSLK=$F${t(@n5|Y{jlZy^~ngN)UXYTJ83#x!6VK2j{0=O=q=)ZFS00B=)L_t(2 zk#*BmbHY#%1>nVsTdBLt-3Eu^b$54ncX$2Wy$K0)BIjk#>=&O2fW_e?a&bB=0CuCS zu`$}grig^tz$(^5Lw{UxQ#l0%gbIfK@qMmC;zZ7N2 zrRxMTgCg})ZA;gwp@C76wo~=d>1|=-6={&FpUx!r)Fa}j3Lu8*`21pZTC5$2ckKN6 zjpI{Lti64R&+Pq@3_eKSm-M?4KT@f02Hzj0N@i}-AM))!vjSC?qqm9JYvLuES*Sou zl%s_lgCZJo05m2AG--g1TBpyZn3FucP7N|C;jWo4M*x*&tQN>)ZWW7#3fMrcytGIb po15sbRb3%#HLiMBZC&I4)gN^Zi>YM1$QS?s002ovPDHLkV1k>Crt$y) diff --git a/apps/files_sharing/img/social-diaspora.svg b/apps/files_sharing/img/social-diaspora.svg new file mode 100644 index 00000000000..1d5131129a9 --- /dev/null +++ b/apps/files_sharing/img/social-diaspora.svg @@ -0,0 +1,52 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/apps/files_sharing/img/social-facebook.svg b/apps/files_sharing/img/social-facebook.svg new file mode 100644 index 00000000000..aad02bc3853 --- /dev/null +++ b/apps/files_sharing/img/social-facebook.svg @@ -0,0 +1,43 @@ + +image/svg+xml \ No newline at end of file diff --git a/apps/files_sharing/img/social-gnu.svg b/apps/files_sharing/img/social-gnu.svg new file mode 100644 index 00000000000..24556aaa024 --- /dev/null +++ b/apps/files_sharing/img/social-gnu.svg @@ -0,0 +1,79 @@ + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/apps/files_sharing/img/social-googleplus.svg b/apps/files_sharing/img/social-googleplus.svg new file mode 100644 index 00000000000..123273f2d38 --- /dev/null +++ b/apps/files_sharing/img/social-googleplus.svg @@ -0,0 +1,45 @@ + +image/svg+xml \ No newline at end of file diff --git a/apps/files_sharing/img/social-owncloud.svg b/apps/files_sharing/img/social-owncloud.svg new file mode 100644 index 00000000000..e2686839c3c --- /dev/null +++ b/apps/files_sharing/img/social-owncloud.svg @@ -0,0 +1,44 @@ + +image/svg+xml \ No newline at end of file diff --git a/apps/files_sharing/img/social-twitter.svg b/apps/files_sharing/img/social-twitter.svg new file mode 100644 index 00000000000..00ce390de6b --- /dev/null +++ b/apps/files_sharing/img/social-twitter.svg @@ -0,0 +1,53 @@ + + + + + + image/svg+xml + + + + + + + + + diff --git a/apps/files_sharing/settings-personal.php b/apps/files_sharing/settings-personal.php index d95c15001e3..f4d61b34f56 100644 --- a/apps/files_sharing/settings-personal.php +++ b/apps/files_sharing/settings-personal.php @@ -31,8 +31,8 @@ $url = 'https://owncloud.org/federation'; $tmpl = new OCP\Template('files_sharing', 'settings-personal'); $tmpl->assign('outgoingServer2serverShareEnabled', \OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled()); -$tmpl->assign('message_with_URL', $l->t('Share with me through my #ownCloud federation Id %s see %s', [$cloudID, $url])); -$tmpl->assign('message_without_URL', $l->t('Share with me through my #ownCloud federation Id %s', [$cloudID])); +$tmpl->assign('message_with_URL', $l->t('Share with me through my #ownCloud federation ID %s see %s', [$cloudID, $url])); +$tmpl->assign('message_without_URL', $l->t('Share with me through my #ownCloud federation ID %s', [$cloudID])); $tmpl->assign('reference', $url); $tmpl->assign('cloudId', $cloudID); diff --git a/apps/files_sharing/templates/settings-personal.php b/apps/files_sharing/templates/settings-personal.php index 84efd1dd1db..8703352e024 100644 --- a/apps/files_sharing/templates/settings-personal.php +++ b/apps/files_sharing/templates/settings-personal.php @@ -12,57 +12,55 @@ style('files_sharing', '3rdparty/gs-share/style');

t('Federated Cloud')); ?>

- t('Your Federated Cloud ID: %s', [$_['cloudId']])); ?> + t('Your Federated Cloud ID:')); ?> +

-

- -

t('Share your Federated Cloud Id:')); ?>

+

- -

- + + + + -
- - - Share on Diaspora&url='/> -  | Share on Twitter'/> -  | Share on Facebook'/> -  | Share on Google+'/> -

-
- -

t('Add your Federated Cloud Id to your homepage:')); ?>

+

+ t('Add it to your website:')); ?> - - <?php p($_['/> + + + t('Share with me via ownCloud')); ?> +

-
+

t('HTML Code:')); ?> -
- -

- <a href="<?php p($_['reference']); ?>"> - <img src='TODO: Add Banner/Button' - alt='<?php p($_['message_with_URL']); ?>'/> - </a> - + <a target="_blank" href="<?php p($_['reference']); ?>"> + <img src="../img/social-owncloud.svg" /> + <?php p($l->t('Share with me via ownCloud')); ?> +</a>

From ac9733a8b8bb64a9cc5c5b792fb1119106d76fd0 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Wed, 17 Jun 2015 13:40:46 +0200 Subject: [PATCH 3/6] make the click actions work --- apps/files_sharing/js/settings-personal.js | 2 +- apps/files_sharing/templates/settings-personal.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/files_sharing/js/settings-personal.js b/apps/files_sharing/js/settings-personal.js index 800579d1eca..1c7aea0b9d6 100644 --- a/apps/files_sharing/js/settings-personal.js +++ b/apps/files_sharing/js/settings-personal.js @@ -1,6 +1,6 @@ $(document).ready(function() { - $('#fileSharingSettings img').click(function() { + $('#fileSharingSettings button.pop-up').click(function() { var url = $(this).data('url'); if (url) { var width = 600; diff --git a/apps/files_sharing/templates/settings-personal.php b/apps/files_sharing/templates/settings-personal.php index 8703352e024..c6bb1474c89 100644 --- a/apps/files_sharing/templates/settings-personal.php +++ b/apps/files_sharing/templates/settings-personal.php @@ -20,24 +20,26 @@ style('files_sharing', '3rdparty/gs-share/style');

t('Share it:')); ?> - - - - - From fa16c1f9b4c2ad3f3d0406747c52c06b861580ba Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Wed, 17 Jun 2015 13:52:18 +0200 Subject: [PATCH 4/6] fix path to owncloud logo --- apps/files_sharing/settings-personal.php | 2 ++ apps/files_sharing/templates/settings-personal.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/settings-personal.php b/apps/files_sharing/settings-personal.php index f4d61b34f56..9a9629c86bb 100644 --- a/apps/files_sharing/settings-personal.php +++ b/apps/files_sharing/settings-personal.php @@ -28,11 +28,13 @@ $uid = \OC::$server->getUserSession()->getUser()->getUID(); $server = \OC::$server->getURLGenerator()->getAbsoluteURL('/'); $cloudID = $uid . '@' . rtrim(\OCA\Files_Sharing\Helper::removeProtocolFromUrl($server), '/'); $url = 'https://owncloud.org/federation'; +$ownCloudLogoPath = \OC::$server->getURLGenerator()->imagePath('files_sharing', 'social-owncloud.svg'); $tmpl = new OCP\Template('files_sharing', 'settings-personal'); $tmpl->assign('outgoingServer2serverShareEnabled', \OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled()); $tmpl->assign('message_with_URL', $l->t('Share with me through my #ownCloud federation ID %s see %s', [$cloudID, $url])); $tmpl->assign('message_without_URL', $l->t('Share with me through my #ownCloud federation ID %s', [$cloudID])); +$tmpl->assign('owncloud_logo_path', $ownCloudLogoPath); $tmpl->assign('reference', $url); $tmpl->assign('cloudId', $cloudID); diff --git a/apps/files_sharing/templates/settings-personal.php b/apps/files_sharing/templates/settings-personal.php index c6bb1474c89..528e74f4cef 100644 --- a/apps/files_sharing/templates/settings-personal.php +++ b/apps/files_sharing/templates/settings-personal.php @@ -51,7 +51,7 @@ style('files_sharing', '3rdparty/gs-share/style'); t('Add it to your website:')); ?> - + t('Share with me via ownCloud')); ?>

@@ -59,7 +59,7 @@ style('files_sharing', '3rdparty/gs-share/style');

t('HTML Code:')); ?>

<a target="_blank" href="<?php p($_['reference']); ?>"> - <img src="../img/social-owncloud.svg" /> + <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['owncloud_logo_path'])); ?>" /> <?php p($l->t('Share with me via ownCloud')); ?> </a> From b43bfaf132b8457768785a5ef5165a1227273140 Mon Sep 17 00:00:00 2001 From: Jan-Christoph Borchardt Date: Wed, 17 Jun 2015 16:05:05 +0200 Subject: [PATCH 5/6] fix look of 'Share with me via ownCloud' button, fix wording --- apps/files_sharing/img/social-owncloud.svg | 44 ------------------- apps/files_sharing/settings-personal.php | 6 +-- .../templates/settings-personal.php | 12 +++-- 3 files changed, 11 insertions(+), 51 deletions(-) delete mode 100644 apps/files_sharing/img/social-owncloud.svg diff --git a/apps/files_sharing/img/social-owncloud.svg b/apps/files_sharing/img/social-owncloud.svg deleted file mode 100644 index e2686839c3c..00000000000 --- a/apps/files_sharing/img/social-owncloud.svg +++ /dev/null @@ -1,44 +0,0 @@ - -image/svg+xml \ No newline at end of file diff --git a/apps/files_sharing/settings-personal.php b/apps/files_sharing/settings-personal.php index 9a9629c86bb..704ee8103db 100644 --- a/apps/files_sharing/settings-personal.php +++ b/apps/files_sharing/settings-personal.php @@ -28,12 +28,12 @@ $uid = \OC::$server->getUserSession()->getUser()->getUID(); $server = \OC::$server->getURLGenerator()->getAbsoluteURL('/'); $cloudID = $uid . '@' . rtrim(\OCA\Files_Sharing\Helper::removeProtocolFromUrl($server), '/'); $url = 'https://owncloud.org/federation'; -$ownCloudLogoPath = \OC::$server->getURLGenerator()->imagePath('files_sharing', 'social-owncloud.svg'); +$ownCloudLogoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg'); $tmpl = new OCP\Template('files_sharing', 'settings-personal'); $tmpl->assign('outgoingServer2serverShareEnabled', \OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled()); -$tmpl->assign('message_with_URL', $l->t('Share with me through my #ownCloud federation ID %s see %s', [$cloudID, $url])); -$tmpl->assign('message_without_URL', $l->t('Share with me through my #ownCloud federation ID %s', [$cloudID])); +$tmpl->assign('message_with_URL', $l->t('Share with me through my #ownCloud Federated Cloud ID %s see %s', [$cloudID, $url])); +$tmpl->assign('message_without_URL', $l->t('Share with me through my #ownCloud Federated Cloud ID %s', [$cloudID])); $tmpl->assign('owncloud_logo_path', $ownCloudLogoPath); $tmpl->assign('reference', $url); $tmpl->assign('cloudId', $cloudID); diff --git a/apps/files_sharing/templates/settings-personal.php b/apps/files_sharing/templates/settings-personal.php index 528e74f4cef..bc10da5583b 100644 --- a/apps/files_sharing/templates/settings-personal.php +++ b/apps/files_sharing/templates/settings-personal.php @@ -50,16 +50,20 @@ style('files_sharing', '3rdparty/gs-share/style');

t('Add it to your website:')); ?> - - + + t('Share with me via ownCloud')); ?>

t('HTML Code:')); ?> -

<a target="_blank" href="<?php p($_['reference']); ?>"> - <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['owncloud_logo_path'])); ?>" /> + <xmp><a target="_blank" href="<?php p($_['reference']); ?>" + style="padding:10px;background-color:#1d2d44;color:#fff;border-radius:3px;padding-left:4px;"> + <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['owncloud_logo_path'])); ?>" + style="width:50px;position:relative;top:8px;"> <?php p($l->t('Share with me via ownCloud')); ?> </a> From f9093466bf2230edde9a4e8156101dc9558968c5 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Thu, 18 Jun 2015 13:00:50 +0200 Subject: [PATCH 6/6] add id to url --- apps/files_sharing/settings-personal.php | 6 +++--- apps/files_sharing/templates/settings-personal.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/files_sharing/settings-personal.php b/apps/files_sharing/settings-personal.php index 704ee8103db..fdf641e1d2c 100644 --- a/apps/files_sharing/settings-personal.php +++ b/apps/files_sharing/settings-personal.php @@ -27,13 +27,13 @@ $l = \OC::$server->getL10N('files_sharing'); $uid = \OC::$server->getUserSession()->getUser()->getUID(); $server = \OC::$server->getURLGenerator()->getAbsoluteURL('/'); $cloudID = $uid . '@' . rtrim(\OCA\Files_Sharing\Helper::removeProtocolFromUrl($server), '/'); -$url = 'https://owncloud.org/federation'; +$url = 'https://owncloud.org/federation#' . $cloudID; $ownCloudLogoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg'); $tmpl = new OCP\Template('files_sharing', 'settings-personal'); $tmpl->assign('outgoingServer2serverShareEnabled', \OCA\Files_Sharing\Helper::isOutgoingServer2serverShareEnabled()); -$tmpl->assign('message_with_URL', $l->t('Share with me through my #ownCloud Federated Cloud ID %s see %s', [$cloudID, $url])); -$tmpl->assign('message_without_URL', $l->t('Share with me through my #ownCloud Federated Cloud ID %s', [$cloudID])); +$tmpl->assign('message_with_URL', $l->t('Share with me through my #ownCloud Federated Cloud ID, see %s', [$url])); +$tmpl->assign('message_without_URL', $l->t('Share with me through my #ownCloud Federated Cloud ID', [$cloudID])); $tmpl->assign('owncloud_logo_path', $ownCloudLogoPath); $tmpl->assign('reference', $url); $tmpl->assign('cloudId', $cloudID); diff --git a/apps/files_sharing/templates/settings-personal.php b/apps/files_sharing/templates/settings-personal.php index bc10da5583b..ee761ff5897 100644 --- a/apps/files_sharing/templates/settings-personal.php +++ b/apps/files_sharing/templates/settings-personal.php @@ -21,14 +21,14 @@ style('files_sharing', '3rdparty/gs-share/style');

t('Share it:')); ?>

-