summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/templates/part.list.php16
-rw-r--r--apps/files_sharing/js/share.js21
-rw-r--r--apps/files_sharing/lib/cache.php3
-rw-r--r--apps/files_sharing/lib/share/file.php3
-rw-r--r--settings/admin/controller.php30
-rw-r--r--settings/js/admin.js12
-rw-r--r--settings/routes.php3
-rw-r--r--settings/templates/admin.php6
8 files changed, 78 insertions, 16 deletions
diff --git a/apps/files/templates/part.list.php b/apps/files/templates/part.list.php
index f4fb96a7a7c..8a7a1e370eb 100644
--- a/apps/files/templates/part.list.php
+++ b/apps/files/templates/part.list.php
@@ -17,7 +17,13 @@ $totalsize = 0; ?>
data-mime="<?php p($file['mimetype'])?>"
data-size="<?php p($file['size']);?>"
data-etag="<?php p($file['etag']);?>"
- data-permissions="<?php p($file['permissions']); ?>">
+ data-permissions="<?php p($file['permissions']); ?>"
+
+ <?php if(isset($file['displayname_owner'])): ?>
+ data-share-owner="<?php p($file['displayname_owner']) ?>"
+ <?php endif; ?>
+ >
+
<?php if(isset($file['isPreviewAvailable']) and $file['isPreviewAvailable']): ?>
<td class="filename svg preview-icon"
<?php else: ?>
@@ -34,17 +40,15 @@ $totalsize = 0; ?>
<span class="nametext">
<?php print_unescaped(htmlspecialchars($file['name']));?>
</span>
+ <span class="uploadtext" currentUploads="0">
+ </span>
+ </a>
<?php else: ?>
<a class="name" href="<?php p(rtrim($_['downloadURL'],'/').'/'.trim($directory,'/').'/'.$name); ?>">
<label class="filetext" title="" for="select-<?php p($file['fileid']); ?>"></label>
<span class="nametext"><?php print_unescaped(htmlspecialchars($file['basename']));?><span class='extension'><?php p($file['extension']);?></span></span>
</a>
<?php endif; ?>
- <?php if($file['type'] == 'dir'):?>
- <span class="uploadtext" currentUploads="0">
- </span>
- <?php endif;?>
- </a>
</td>
<td class="filesize"
style="color:rgb(<?php p($simple_size_color.','.$simple_size_color.','.$simple_size_color) ?>)">
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 36de452a55e..9f0ed12f935 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -5,6 +5,14 @@ $(document).ready(function() {
if (typeof OC.Share !== 'undefined' && typeof FileActions !== 'undefined' && !disableSharing) {
$('#fileList').on('fileActionsReady',function(){
+
+ var allShared = $('#fileList').find('[data-share-owner]').find('[data-Action="Share"]');
+ allShared.addClass('permanent');
+ allShared.find('span').text(function(){
+ $owner = $(this).closest('tr').attr('data-share-owner');
+ return ' ' + t('files_sharing', 'Shared by {owner}', {owner: $owner});
+ });
+
if (!sharesLoaded){
OC.Share.loadIcons('file');
// assume that we got all shares, so switching directories
@@ -17,16 +25,15 @@ $(document).ready(function() {
});
FileActions.register('all', 'Share', OC.PERMISSION_READ, OC.imagePath('core', 'actions/share'), function(filename) {
- if ($('#dir').val() == '/') {
- var item = $('#dir').val() + filename;
- } else {
- var item = $('#dir').val() + '/' + filename;
+ var dir = $('#dir').val();
+ var item = dir + '/' + filename;
+ if (dir == '/') {
+ item = dir + filename;
}
var tr = FileList.findFileEl(filename);
+ var itemType = 'file';
if ($(tr).data('type') == 'dir') {
- var itemType = 'folder';
- } else {
- var itemType = 'file';
+ itemType = 'folder';
}
var possiblePermissions = $(tr).data('permissions');
var appendTo = $(tr).find('td.filename');
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 4b0da0b002d..10f2182655f 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -137,9 +137,12 @@ class Shared_Cache extends Cache {
} else {
$cache = $this->getSourceCache($folder);
if ($cache) {
+ $parent = $this->storage->getFile($folder);
$sourceFolderContent = $cache->getFolderContents($this->files[$folder]);
foreach ($sourceFolderContent as $key => $c) {
$sourceFolderContent[$key]['usersPath'] = 'files/Shared/' . $folder . '/' . $c['name'];
+ $sourceFolderContent[$key]['uid_owner'] = $parent['uid_owner'];
+ $sourceFolderContent[$key]['displayname_owner'] = $parent['uid_owner'];
}
return $sourceFolderContent;
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php
index ec0f368386f..5e00050fe1e 100644
--- a/apps/files_sharing/lib/share/file.php
+++ b/apps/files_sharing/lib/share/file.php
@@ -94,6 +94,9 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
$file['mtime'] = $item['mtime'];
$file['encrypted'] = $item['encrypted'];
$file['etag'] = $item['etag'];
+ $file['uid_owner'] = $item['uid_owner'];
+ $file['displayname_owner'] = $item['displayname_owner'];
+
$storage = \OC\Files\Filesystem::getStorage('/');
$cache = $storage->getCache();
if ($item['encrypted'] or ($item['unencrypted_size'] > 0 and $cache->getMimetype($item['mimetype']) === 'httpd/unix-directory')) {
diff --git a/settings/admin/controller.php b/settings/admin/controller.php
index a075d774361..7019f9a4d2a 100644
--- a/settings/admin/controller.php
+++ b/settings/admin/controller.php
@@ -74,6 +74,36 @@ class Controller {
}
/**
+ * Send a mail to test the settings
+ */
+ public static function sendTestMail() {
+ \OC_Util::checkAdminUser();
+ \OCP\JSON::callCheck();
+
+ $l = \OC_L10N::get('settings');
+ $email = \OC_Preferences::getValue(\OC_User::getUser(), 'settings', 'email', '');
+ if (!empty($email)) {
+ $defaults = new \OC_Defaults();
+
+ try {
+ \OC_Mail::send($email, $_POST['user'],
+ $l->t('test email settings'),
+ $l->t('If you received this email, the settings seem to be correct.'),
+ \OCP\Util::getDefaultEmailAddress('no-reply'), $defaults->getName());
+ } catch (\Exception $e) {
+ $message = $l->t('A problem occurred while sending the e-mail. Please revisit your settings.');
+ \OC_JSON::error( array( "data" => array( "message" => $message)) );
+ exit;
+ }
+
+ \OC_JSON::success(array("data" => array( "message" => $l->t("Email sent") )));
+ } else {
+ $message = $l->t('You need to set your user email before being able to send test emails.');
+ \OC_JSON::error( array( "data" => array( "message" => $message)) );
+ }
+ }
+
+ /**
* Get the field name to use it in error messages
*
* @param $setting string
diff --git a/settings/js/admin.js b/settings/js/admin.js
index 5ea6a5af2df..684822f1834 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -62,10 +62,18 @@ $(document).ready(function(){
});
$('#mail_settings').change(function(){
- OC.msg.startSaving('#mail_settings .msg');
+ OC.msg.startSaving('#mail_settings_msg');
var post = $( "#mail_settings" ).serialize();
$.post(OC.Router.generate('settings_mail_settings'), post, function(data){
- OC.msg.finishedSaving('#mail_settings .msg', data);
+ OC.msg.finishedSaving('#mail_settings_msg', data);
+ });
+ });
+
+ $('#sendtestemail').click(function(){
+ OC.msg.startAction('#sendtestmail_msg', t('settings', 'Sending...'));
+ var post = $( "#sendtestemail" ).serialize();
+ $.post(OC.Router.generate('settings_admin_mail_test'), post, function(data){
+ OC.msg.finishedAction('#sendtestmail_msg', data);
});
});
});
diff --git a/settings/routes.php b/settings/routes.php
index 64f7122f0cf..a0d54dea1e7 100644
--- a/settings/routes.php
+++ b/settings/routes.php
@@ -73,5 +73,8 @@ $this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php')
$this->create('settings_mail_settings', '/settings/admin/mailsettings')
->post()
->action('OC\Settings\Admin\Controller', 'setMailSettings');
+$this->create('settings_admin_mail_test', '/settings/admin/mailtest')
+ ->post()
+ ->action('OC\Settings\Admin\Controller', 'sendTestMail');
$this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
->actionInclude('settings/ajax/setsecurity.php');
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
index 139a9dd076c..487da036e74 100644
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -272,7 +272,7 @@ if (!$_['internetconnectionworking']) {
</fieldset>
<fieldset id="mail_settings" class="personalblock">
- <h2><?php p($l->t('Email Server'));?> <span class="msg"></span></h2>
+ <h2><?php p($l->t('Email Server'));?> <span id="mail_settings_msg" class="msg"></span></h2>
<p><?php p($l->t('This is used for sending out notifications.')); ?></p>
@@ -347,6 +347,10 @@ if (!$_['internetconnectionworking']) {
placeholder="<?php p($l->t('SMTP Password'))?>" value='<?php p($_['mail_smtppassword']) ?>' />
</p>
+ <br />
+ <em><?php p($l->t( 'Test email settings' )); ?></em>
+ <input type="submit" name="sendtestemail" id="sendtestemail" value="<?php p($l->t( 'Send email' )); ?>"/>
+ <span id="sendtestmail_msg" class="msg"></span>
</fieldset>
<fieldset class="personalblock">