summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <hey@jancborchardt.net>2013-10-04 17:08:34 +0300
committerJan-Christoph Borchardt <hey@jancborchardt.net>2013-10-04 17:08:34 +0300
commit041837de2c85d79a05d29933d87e9077dd31530c (patch)
treeb8e2f469f7ff22996928dea4c147dc162ad07230 /core
parent3c13afee9837db9ba11f98ec8688f8a1163b81f1 (diff)
parent7337b341106b6ae093b8d56c4d885b497db6e5aa (diff)
downloadnextcloud-server-041837de2c85d79a05d29933d87e9077dd31530c.tar.gz
nextcloud-server-041837de2c85d79a05d29933d87e9077dd31530c.zip
merge master into input-simplify
Diffstat (limited to 'core')
-rw-r--r--core/ajax/share.php108
-rw-r--r--core/css/share.css2
-rw-r--r--core/css/styles.css62
-rw-r--r--core/img/breadcrumb-start.pngbin311 -> 0 bytes
-rw-r--r--core/img/breadcrumb-start.svg6
-rw-r--r--core/img/breadcrumb.pngbin320 -> 594 bytes
-rw-r--r--core/img/breadcrumb.svg16
-rw-r--r--core/js/avatar.js2
-rw-r--r--core/js/jquery.avatar.js20
-rw-r--r--core/js/share.js37
-rw-r--r--core/skeleton/welcome.txt5
-rw-r--r--core/templates/altmail.php6
-rw-r--r--core/templates/mail.php9
13 files changed, 235 insertions, 38 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 648f0a71bd4..1166ea3198a 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -23,6 +23,8 @@ OC_JSON::checkLoggedIn();
OCP\JSON::callCheck();
OC_App::loadApps();
+$defaults = new \OCP\Defaults();
+
if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSource'])) {
switch ($_POST['action']) {
case 'share':
@@ -33,7 +35,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
if ($shareType === OCP\Share::SHARE_TYPE_LINK && $shareWith == '') {
$shareWith = null;
}
-
+
$token = OCP\Share::shareItem(
$_POST['itemType'],
$_POST['itemSource'],
@@ -41,7 +43,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$shareWith,
$_POST['permissions']
);
-
+
if (is_string($token)) {
OC_JSON::success(array('data' => array('token' => $token)));
} else {
@@ -81,6 +83,104 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
($return) ? OC_JSON::success() : OC_JSON::error();
}
break;
+ case 'informRecipients':
+
+ $l = OC_L10N::get('core');
+
+ $shareType = (int) $_POST['shareType'];
+ $itemType = $_POST['itemType'];
+ $itemSource = $_POST['itemSource'];
+ $recipient = $_POST['recipient'];
+ $ownerDisplayName = \OCP\User::getDisplayName();
+ $from = \OCP\Util::getDefaultEmailAddress('sharing-noreply');
+
+ $noMail = array();
+ $recipientList = array();
+
+ if($shareType === \OCP\Share::SHARE_TYPE_USER) {
+ $recipientList[] = $recipient;
+ } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) {
+ $recipientList = \OC_Group::usersInGroup($recipient);
+ }
+
+ // don't send a mail to the user who shared the file
+ $recipientList = array_diff($recipientList, array(\OCP\User::getUser()));
+
+ // send mail to all recipients with an email address
+ foreach ($recipientList as $recipient) {
+ //get correct target folder name
+ $email = OC_Preferences::getValue($recipient, 'settings', 'email', '');
+
+ if ($email !== '') {
+ $displayName = \OCP\User::getDisplayName($recipient);
+ $items = \OCP\Share::getItemSharedWithUser($itemType, $itemSource, $recipient);
+ $filename = trim($items[0]['file_target'], '/');
+ $subject = (string)$l->t('%s shared »%s« with you', array($ownerDisplayName, $filename));
+ $expiration = null;
+ if (isset($items[0]['expiration'])) {
+ $date = new DateTime($items[0]['expiration']);
+ $expiration = $date->format('Y-m-d');
+ }
+
+ if ($itemType === 'folder') {
+ $foldername = "/Shared/" . $filename;
+ } else {
+ // if it is a file we can just link to the Shared folder,
+ // that's the place where the user will find the file
+ $foldername = "/Shared";
+ }
+
+ $link = \OCP\Util::linkToAbsolute('files', 'index.php', array("dir" => $foldername));
+
+ $content = new OC_Template("core", "mail", "");
+ $content->assign('link', $link);
+ $content->assign('user_displayname', $ownerDisplayName);
+ $content->assign('filename', $filename);
+ $content->assign('expiration', $expiration);
+ $text = $content->fetchPage();
+
+ $content = new OC_Template("core", "altmail", "");
+ $content->assign('link', $link);
+ $content->assign('user_displayname', $ownerDisplayName);
+ $content->assign('filename', $filename);
+ $content->assign('expiration', $expiration);
+ $alttext = $content->fetchPage();
+
+ $default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply');
+ $from = OCP\Config::getUserValue(\OCP\User::getUser(), 'settings', 'email', $default_from);
+
+ // send it out now
+ try {
+ OCP\Util::sendMail($email, $displayName, $subject, $text, $from, $ownerDisplayName, 1, $alttext);
+ } catch (Exception $exception) {
+ $noMail[] = \OCP\User::getDisplayName($recipient);
+ }
+ }
+ }
+
+ \OCP\Share::setSendMailStatus($itemType, $itemSource, $shareType, true);
+
+ if (empty($noMail)) {
+ OCP\JSON::success();
+ } else {
+ OCP\JSON::error(array(
+ 'data' => array(
+ 'message' => $l->t("Couldn't send mail to following users: %s ",
+ implode(', ', $noMail)
+ )
+ )
+ ));
+ }
+ break;
+ case 'informRecipientsDisabled':
+ $itemSource = $_POST['itemSource'];
+ $shareType = $_POST['shareType'];
+ $itemType = $_POST['itemType'];
+ $recipient = $_POST['recipient'];
+ \OCP\Share::setSendMailStatus($itemType, $itemSource, $shareType, false);
+ OCP\JSON::success();
+ break;
+
case 'email':
// read post variables
$user = OCP\USER::getUser();
@@ -213,10 +313,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
}
}
$count = 0;
-
+
// enable l10n support
$l = OC_L10N::get('core');
-
+
foreach ($groups as $group) {
if ($count < 15) {
if (!isset($_GET['itemShares'])
diff --git a/core/css/share.css b/core/css/share.css
index 10936e56520..2a21dc6edf6 100644
--- a/core/css/share.css
+++ b/core/css/share.css
@@ -11,7 +11,7 @@
margin-right:7em;
position:absolute;
right:0;
- width:19em;
+ width:25em;
z-index:500;
padding:1em;
}
diff --git a/core/css/styles.css b/core/css/styles.css
index d9c03f2c080..e0ac951a054 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -42,6 +42,10 @@ body { background:#fefefe; font:normal .8em/1.6em "Helvetica Neue",Helvetica,Ari
display: inline-block;
}
+#header .avatardiv img {
+ opacity: 1;
+}
+
/* INPUTS */
input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="email"], input[type="url"],
textarea, select,
@@ -158,22 +162,37 @@ input[type="submit"].enabled {
/* CONTENT ------------------------------------------------------------------ */
#controls {
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
position: fixed;
- height: 36px;
+ height: 44px;
width: 100%;
- padding: 0 75px 0 6px;
+ padding-right: 75px;
margin: 0;
background: #eee;
border-bottom: 1px solid #e7e7e7;
z-index: 50;
- -moz-box-sizing: border-box; box-sizing: border-box;
}
-#controls .button {
+#controls .button,
+#controls button,
+#controls input[type='submit'],
+#controls input[type='text'],
+#controls input[type='password'],
+#controls select {
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
display: inline-block;
+ height: 36px;
+ padding: 7px 10px
}
#content { position:relative; height:100%; width:100%; }
-#content .hascontrols { position: relative; top: 2.9em; }
+#content .hascontrols {
+ position: relative;
+ top: 45px;
+}
#content-wrapper {
position:absolute; height:100%; width:100%; padding-top:3.5em; padding-left:80px;
-moz-box-sizing:border-box; box-sizing:border-box;
@@ -744,15 +763,38 @@ span.ui-icon {float: left; margin: 3px 7px 30px 0;}
.arrow.left { left:-13px; bottom:1.2em; -webkit-transform:rotate(270deg); -moz-transform:rotate(270deg); -o-transform:rotate(270deg); -ms-transform:rotate(270deg); transform:rotate(270deg); }
.arrow.up { top:-8px; right:2em; }
.arrow.down { -webkit-transform:rotate(180deg); -moz-transform:rotate(180deg); -o-transform:rotate(180deg); -ms-transform:rotate(180deg); transform:rotate(180deg); }
-.help-includes {overflow: hidden; width: 100%; height: 100%; -moz-box-sizing: border-box; box-sizing: border-box; padding-top: 2.8em; }
+.help-includes {
+ overflow: hidden;
+ width: 100%;
+ height: 100%;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ padding-top: 44px;
+}
.help-iframe {width: 100%; height: 100%; margin: 0;padding: 0; border: 0; overflow: auto;}
/* ---- BREADCRUMB ---- */
-div.crumb { float:left; display:block; background:url('../img/breadcrumb.svg') no-repeat right 0; padding:.75em 1.5em 0 1em; height:2.9em; -moz-box-sizing:border-box; box-sizing:border-box; }
-div.crumb:first-child { padding:10px 20px 10px 5px; }
-div.crumb.last { font-weight:bold; background:none; padding-right:10px; }
-div.crumb a{ padding: 0.9em 0 0.7em 0; }
+div.crumb {
+ float: left;
+ display: block;
+ background: url('../img/breadcrumb.svg') no-repeat right center;
+ height: 44px;
+}
+div.crumb a {
+ position: relative;
+ top: 12px;
+ padding: 14px 24px 14px 17px;
+ color: #555;
+}
+div.crumb:first-child a {
+ position: relative;
+ top: 13px;
+}
+div.crumb.last {
+ font-weight: bold;
+ margin-right: 10px;
+}
/* some feedback for hover/tap on breadcrumbs */
div.crumb:hover,
diff --git a/core/img/breadcrumb-start.png b/core/img/breadcrumb-start.png
deleted file mode 100644
index b0df5f44037..00000000000
--- a/core/img/breadcrumb-start.png
+++ /dev/null
Binary files differ
diff --git a/core/img/breadcrumb-start.svg b/core/img/breadcrumb-start.svg
deleted file mode 100644
index 7f36231cdf8..00000000000
--- a/core/img/breadcrumb-start.svg
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="36" width="11" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
- <g transform="translate(0 -1016.4)">
- <path d="m0 0 11 18-11 18z" transform="translate(0 1016.4)" fill="#ddd"/>
- </g>
-</svg>
diff --git a/core/img/breadcrumb.png b/core/img/breadcrumb.png
index 84992be0d93..7e9593a36bf 100644
--- a/core/img/breadcrumb.png
+++ b/core/img/breadcrumb.png
Binary files differ
diff --git a/core/img/breadcrumb.svg b/core/img/breadcrumb.svg
index 05a216e50a9..f0b5c9218d5 100644
--- a/core/img/breadcrumb.svg
+++ b/core/img/breadcrumb.svg
@@ -1,6 +1,12 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="36" width="11" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
- <g transform="translate(0 -1016.4)">
- <path d="m0.5 0 10 18-10 18 10-18z" transform="translate(0 1016.4)" stroke="#ddd" stroke-linecap="round" stroke-miterlimit="31.2" stroke-width="0.9" fill="#ddd"/>
- </g>
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="44" width="14" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
+ <metadata>
+ <rdf:RDF>
+ <cc:Work rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
+ <dc:title/>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <path d="M0.54879,0.047777,12.744,22,0.54879,43.951,12.744,22z" stroke="#d7d7d7" stroke-linecap="round" stroke-miterlimit="31.20000076000000178" stroke-width="1.09758711000000009" fill="#F00"/>
</svg>
diff --git a/core/js/avatar.js b/core/js/avatar.js
index 57e6daa0930..c54c4068768 100644
--- a/core/js/avatar.js
+++ b/core/js/avatar.js
@@ -1,6 +1,6 @@
$(document).ready(function(){
if (OC.currentUser) {
- $('#header .avatardiv').avatar(OC.currentUser, 32);
+ $('#header .avatardiv').avatar(OC.currentUser, 32, undefined, true);
// Personal settings
$('#avatar .avatardiv').avatar(OC.currentUser, 128);
}
diff --git a/core/js/jquery.avatar.js b/core/js/jquery.avatar.js
index 88a4c25d1ee..00068101726 100644
--- a/core/js/jquery.avatar.js
+++ b/core/js/jquery.avatar.js
@@ -15,7 +15,7 @@
* You may use this on any <div></div>
* Here I'm using <div class="avatardiv"></div> as an example.
*
- * There are 4 ways to call this:
+ * There are 5 ways to call this:
*
* 1. $('.avatardiv').avatar('jdoe', 128);
* This will make the div to jdoe's fitting avatar, with a size of 128px.
@@ -34,10 +34,15 @@
* 4. $('.avatardiv').avatar('jdoe', 128, true);
* This will behave like the first example, except it will also append random
* hashes to the custom avatar images, to force image reloading in IE8.
+ *
+ * 5. $('.avatardiv').avatar('jdoe', 128, undefined, true);
+ * This will behave like the first example, but it will hide the avatardiv, if
+ * it will display the default placeholder. undefined is the ie8fix from
+ * example 4 and can be either true, or false/undefined, to be ignored.
*/
(function ($) {
- $.fn.avatar = function(user, size, ie8fix) {
+ $.fn.avatar = function(user, size, ie8fix, hidedefault) {
if (typeof(size) === 'undefined') {
if (this.height() > 0) {
size = this.height();
@@ -69,12 +74,17 @@
var url = OC.Router.generate('core_avatar_get', {user: user, size: size})+'?requesttoken='+oc_requesttoken;
$.get(url, function(result) {
if (typeof(result) === 'object') {
- if (result.data && result.data.displayname) {
- $div.placeholder(user, result.data.displayname);
+ if (!hidedefault) {
+ if (result.data && result.data.displayname) {
+ $div.placeholder(user, result.data.displayname);
+ } else {
+ $div.placeholder(user);
+ }
} else {
- $div.placeholder(user);
+ $div.hide();
}
} else {
+ $div.show();
if (ie8fix === true) {
$div.html('<img src="'+url+'#'+Math.floor(Math.random()*1000)+'">');
} else {
diff --git a/core/js/share.js b/core/js/share.js
index 82f5da0baea..8d14520cd74 100644
--- a/core/js/share.js
+++ b/core/js/share.js
@@ -114,6 +114,7 @@ OC.Share={
data = false;
}
}});
+
return data;
},
share:function(itemType, itemSource, shareType, shareWith, permissions, callback) {
@@ -217,9 +218,9 @@ OC.Share={
OC.Share.showLink(share.token, share.share_with, itemSource);
} else {
if (share.collection) {
- OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, share.collection);
+ OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, share.mail_send, share.collection);
} else {
- OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, false);
+ OC.Share.addShareWith(share.share_type, share.share_with, share.share_with_displayname, share.permissions, possiblePermissions, share.mail_send, false);
}
}
if (share.expiration != null) {
@@ -301,7 +302,7 @@ OC.Share={
}
});
},
- addShareWith:function(shareType, shareWith, shareWithDisplayName, permissions, possiblePermissions, collection) {
+ addShareWith:function(shareType, shareWith, shareWithDisplayName, permissions, possiblePermissions, mailSend, collection) {
if (!OC.Share.itemShares[shareType]) {
OC.Share.itemShares[shareType] = [];
}
@@ -343,6 +344,14 @@ OC.Share={
}else{
html += escapeHTML(shareWithDisplayName);
}
+ var mailNotificationEnabled = $('input:hidden[name=mailNotificationEnabled]').val();
+ if (mailNotificationEnabled === 'yes') {
+ var checked = '';
+ if (mailSend === '1') {
+ checked = 'checked';
+ }
+ html += '<input type="checkbox" name="mailNotification" class="mailNotification" ' + checked + ' />'+t('core', 'notify user by email')+'</label>';
+ }
if (possiblePermissions & OC.PERMISSION_CREATE || possiblePermissions & OC.PERMISSION_UPDATE || possiblePermissions & OC.PERMISSION_DELETE) {
if (editChecked == '') {
html += '<label style="display:none;">';
@@ -699,5 +708,27 @@ $(document).ready(function() {
}
});
+ $(document).on('click', '#dropdown input[name=mailNotification]', function() {
+ var li = $(this).parent();
+ var itemType = $('#dropdown').data('item-type');
+ var itemSource = $('#dropdown').data('item-source');
+ var action = '';
+ if (this.checked) {
+ action = 'informRecipients';
+ } else {
+ action = 'informRecipientsDisabled';
+ }
+
+ var shareType = $(li).data('share-type');
+ var shareWith = $(li).data('share-with');
+
+ $.post(OC.filePath('core', 'ajax', 'share.php'), {action: action, recipient: shareWith, shareType: shareType, itemSource: itemSource, itemType: itemType}, function(result) {
+ if (result.status !== 'success') {
+ OC.dialogs.alert(t('core', result.data.message), t('core', 'Warning'));
+ }
+ });
+
+});
+
});
diff --git a/core/skeleton/welcome.txt b/core/skeleton/welcome.txt
new file mode 100644
index 00000000000..c86eaf91bbe
--- /dev/null
+++ b/core/skeleton/welcome.txt
@@ -0,0 +1,5 @@
+Welcome to your ownCloud account!
+
+This is just an example file for developers and git users.
+The packaged and released versions will come with better examples.
+
diff --git a/core/templates/altmail.php b/core/templates/altmail.php
index 2551473c6f0..00b67bee456 100644
--- a/core/templates/altmail.php
+++ b/core/templates/altmail.php
@@ -1,5 +1,9 @@
<?php
-print_unescaped($l->t("Hey there,\n\njust letting you know that %s shared %s with you.\nView it: %s\n\nCheers!", array($_['user_displayname'], $_['filename'], $_['link'])));
+print_unescaped($l->t("Hey there,\n\njust letting you know that %s shared %s with you.\nView it: %s\n\n", array($_['user_displayname'], $_['filename'], $_['link'])));
+if ( isset($_['expiration']) ) {
+ print_unescaped($l->t("The share will expire on %s.\n\n", array($_['expiration'])));
+}
+p($l->t("Cheers!"));
?>
--
diff --git a/core/templates/mail.php b/core/templates/mail.php
index de72b136b13..40092f5491f 100644
--- a/core/templates/mail.php
+++ b/core/templates/mail.php
@@ -12,7 +12,11 @@
<td bgcolor="#f8f8f8" width="20px">&nbsp;</td>
<td bgcolor="#f8f8f8" style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">
<?php
-print_unescaped($l->t('Hey there,<br><br>just letting you know that %s shared »%s« with you.<br><a href="%s">View it!</a><br><br>Cheers!', array($_['user_displayname'], $_['filename'], $_['link'])));
+print_unescaped($l->t('Hey there,<br><br>just letting you know that %s shared »%s« with you.<br><a href="%s">View it!</a><br><br>', array($_['user_displayname'], $_['filename'], $_['link'])));
+if ( isset($_['expiration']) ) {
+ print_unescaped($l->t("The share will expire on %s.<br><br>", array($_['expiration'])));
+}
+p($l->t('Cheers!'));
?>
</td>
</tr>
@@ -22,7 +26,8 @@ print_unescaped($l->t('Hey there,<br><br>just letting you know that %s shared »
<td bgcolor="#f8f8f8" style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br>
<?php p($theme->getName()); ?> -
<?php p($theme->getSlogan()); ?>
-<br><a href="<?php print_unescaped($theme->getBaseUrl()); ?>"><?php print_unescaped($theme->getBaseUrl());?></a></td>
+<br><a href="<?php print_unescaped($theme->getBaseUrl()); ?>"><?php print_unescaped($theme->getBaseUrl());?></a>
+</td>
</tr>
<tr>
<td bgcolor="#f8f8f8" colspan="2">&nbsp;</td>