aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------3rdparty0
-rw-r--r--apps/files_encryption/js/settings-admin.js22
-rw-r--r--apps/files_sharing/lib/api.php12
-rw-r--r--core/js/js.js28
-rw-r--r--lib/private/defaults.php7
-rw-r--r--lib/private/files/cache/cache.php10
-rw-r--r--lib/private/files/view.php5
-rw-r--r--lib/private/helper.php2
-rwxr-xr-xsettings/admin.php10
-rw-r--r--settings/admin/controller.php93
-rw-r--r--settings/css/settings.css12
-rw-r--r--settings/js/admin.js34
-rw-r--r--settings/js/apps.js26
-rw-r--r--settings/js/personal.js22
-rw-r--r--settings/routes.php3
-rw-r--r--settings/templates/admin.php99
16 files changed, 325 insertions, 60 deletions
diff --git a/3rdparty b/3rdparty
-Subproject bbc37618c74a5439f729cc3e8ed369f674cb541
+Subproject 177d3ff656bcf1153b4def12403c5f2d4fc53e7
diff --git a/apps/files_encryption/js/settings-admin.js b/apps/files_encryption/js/settings-admin.js
index c2140a6f1eb..785d02002fa 100644
--- a/apps/files_encryption/js/settings-admin.js
+++ b/apps/files_encryption/js/settings-admin.js
@@ -7,28 +7,6 @@
* See the COPYING-README file.
*/
-OC.msg={
- startSaving:function(selector){
- $(selector)
- .html( t('settings', 'Saving...') )
- .removeClass('success')
- .removeClass('error')
- .stop(true, true)
- .show();
- },
- finishedSaving:function(selector, data){
- if( data.status === "success" ){
- $(selector).html( data.data.message )
- .addClass('success')
- .stop(true, true)
- .delay(3000)
- .fadeOut(900);
- }else{
- $(selector).html( data.data.message ).addClass('error');
- }
- }
-};
-
$(document).ready(function(){
// Trigger ajax on recoveryAdmin status change
var enabledStatus = $('#adminEnableRecovery').val();
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index 19a2d22b068..0ba58aa896a 100644
--- a/apps/files_sharing/lib/api.php
+++ b/apps/files_sharing/lib/api.php
@@ -172,12 +172,12 @@ class Api {
// workaround because folders are named 'dir' in this context
$itemType = $file['type'] === 'file' ? 'file' : 'folder';
$share = \OCP\Share::getItemShared($itemType, $file['fileid']);
- $receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $file['fileid']);
- if ($receivedFrom) {
- $share['received_from'] = $receivedFrom['uid_owner'];
- $share['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
- }
- if ($share) {
+ if($share) {
+ $receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $file['fileid']);
+ if ($receivedFrom) {
+ $share['received_from'] = $receivedFrom['uid_owner'];
+ $share['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
+ }
$result = array_merge($result, $share);
}
}
diff --git a/core/js/js.js b/core/js/js.js
index ec890be4541..21ccee0f1d5 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -467,6 +467,34 @@ OC.search.lastResults={};
OC.addStyle.loaded=[];
OC.addScript.loaded=[];
+OC.msg={
+ startSaving:function(selector){
+ OC.msg.startAction(selector, t('core', 'Saving...'));
+ },
+ finishedSaving:function(selector, data){
+ OC.msg.finishedAction(selector, data);
+ },
+ startAction:function(selector, message){
+ $(selector)
+ .html( message )
+ .removeClass('success')
+ .removeClass('error')
+ .stop(true, true)
+ .show();
+ },
+ finishedAction:function(selector, data){
+ if( data.status === "success" ){
+ $(selector).html( data.data.message )
+ .addClass('success')
+ .stop(true, true)
+ .delay(3000)
+ .fadeOut(900);
+ }else{
+ $(selector).html( data.data.message ).addClass('error');
+ }
+ }
+};
+
OC.Notification={
queuedNotifications: [],
getDefaultNotificationFunction: null,
diff --git a/lib/private/defaults.php b/lib/private/defaults.php
index 0b97497baa1..59630cda5c0 100644
--- a/lib/private/defaults.php
+++ b/lib/private/defaults.php
@@ -174,4 +174,11 @@ class OC_Defaults {
return $footer;
}
+ public function buildDocLinkToKey($key) {
+ if ($this->themeExist('buildDocLinkToKey')) {
+ return $this->theme->buildDocLinkToKey($key);
+ }
+ return $this->getDocBaseUrl() . '/server/6.0/go.php?to=' . $key;
+ }
+
}
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 4cab4619149..9b18257088c 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -166,6 +166,16 @@ class Cache {
*/
public function getFolderContents($folder) {
$fileId = $this->getId($folder);
+ return $this->getFolderContentsById($fileId);
+ }
+
+ /**
+ * get the metadata of all files stored in $folder
+ *
+ * @param int $fileId the file id of the folder
+ * @return array
+ */
+ public function getFolderContentsById($fileId) {
if ($fileId > -1) {
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
`storage_mtime`, `encrypted`, `unencrypted_size`, `etag`
diff --git a/lib/private/files/view.php b/lib/private/files/view.php
index 6f235be8e34..2dbbf5b88c9 100644
--- a/lib/private/files/view.php
+++ b/lib/private/files/view.php
@@ -882,12 +882,13 @@ class View {
$watcher->checkUpdate($internalPath);
}
+ $folderId = $cache->getId($internalPath);
$files = array();
- $contents = $cache->getFolderContents($internalPath); //TODO: mimetype_filter
+ $contents = $cache->getFolderContents($internalPath, $folderId); //TODO: mimetype_filter
foreach ($contents as $content) {
$files[] = new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content);
}
- $permissions = $permissionsCache->getDirectoryPermissions($cache->getId($internalPath), $user);
+ $permissions = $permissionsCache->getDirectoryPermissions($folderId, $user);
$ids = array();
foreach ($files as $i => $file) {
diff --git a/lib/private/helper.php b/lib/private/helper.php
index 1aab2f296e1..d8c4650f666 100644
--- a/lib/private/helper.php
+++ b/lib/private/helper.php
@@ -64,7 +64,7 @@ class OC_Helper {
*/
public static function linkToDocs($key) {
$theme = new OC_Defaults();
- return $theme->getDocBaseUrl() . '/server/6.0/go.php?to=' . $key;
+ return $theme->buildDocLinkToKey($key);
}
/**
diff --git a/settings/admin.php b/settings/admin.php
index c0e4570658a..42477bfc1ca 100755
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -21,6 +21,16 @@ $entries=OC_Log_Owncloud::getEntries(3);
$entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3;
$tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 ));
+$tmpl->assign('mail_domain', OC_Config::getValue( "mail_domain", '' ));
+$tmpl->assign('mail_from_address', OC_Config::getValue( "mail_from_address", '' ));
+$tmpl->assign('mail_smtpmode', OC_Config::getValue( "mail_smtpmode", '' ));
+$tmpl->assign('mail_smtpsecure', OC_Config::getValue( "mail_smtpsecure", '' ));
+$tmpl->assign('mail_smtphost', OC_Config::getValue( "mail_smtphost", '' ));
+$tmpl->assign('mail_smtpport', OC_Config::getValue( "mail_smtpport", '' ));
+$tmpl->assign('mail_smtpauthtype', OC_Config::getValue( "mail_smtpauthtype", '' ));
+$tmpl->assign('mail_smtpauth', OC_Config::getValue( "mail_smtpauth", false ));
+$tmpl->assign('mail_smtpname', OC_Config::getValue( "mail_smtpname", '' ));
+$tmpl->assign('mail_smtppassword', OC_Config::getValue( "mail_smtppassword", '' ));
$tmpl->assign('entries', $entries);
$tmpl->assign('entriesremain', $entriesremain);
$tmpl->assign('htaccessworking', $htaccessworking);
diff --git a/settings/admin/controller.php b/settings/admin/controller.php
new file mode 100644
index 00000000000..a075d774361
--- /dev/null
+++ b/settings/admin/controller.php
@@ -0,0 +1,93 @@
+<?php
+/**
+* @author Joas Schilling
+* @copyright 2014 Joas Schilling nickvergessen@owncloud.com
+*
+* This library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
+* License as published by the Free Software Foundation; either
+* version 3 of the License, or any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
+*
+* You should have received a copy of the GNU Affero General Public
+* License along with this library. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace OC\Settings\Admin;
+
+class Controller {
+ /**
+ * Set mail settings
+ */
+ public static function setMailSettings() {
+ \OC_Util::checkAdminUser();
+ \OCP\JSON::callCheck();
+
+ $l = \OC_L10N::get('settings');
+
+ $smtp_settings = array(
+ 'mail_domain' => null,
+ 'mail_from_address' => null,
+ 'mail_smtpmode' => array('sendmail', 'smtp', 'qmail', 'php'),
+ 'mail_smtpsecure' => array('', 'ssl', 'tls'),
+ 'mail_smtphost' => null,
+ 'mail_smtpport' => null,
+ 'mail_smtpauthtype' => array('LOGIN', 'PLAIN', 'NTLM'),
+ 'mail_smtpauth' => true,
+ 'mail_smtpname' => null,
+ 'mail_smtppassword' => null,
+ );
+
+ foreach ($smtp_settings as $setting => $validate) {
+ if (!$validate) {
+ if (!isset($_POST[$setting]) || $_POST[$setting] === '') {
+ \OC_Config::deleteKey( $setting );
+ } else {
+ \OC_Config::setValue( $setting, $_POST[$setting] );
+ }
+ }
+ else if (is_bool($validate)) {
+ if (!empty($_POST[$setting])) {
+ \OC_Config::setValue( $setting, (bool) $_POST[$setting] );
+ } else {
+ \OC_Config::deleteKey( $setting );
+ }
+ }
+ else if (is_array($validate)) {
+ if (!isset($_POST[$setting]) || $_POST[$setting] === '') {
+ \OC_Config::deleteKey( $setting );
+ } else if (in_array($_POST[$setting], $validate)) {
+ \OC_Config::setValue( $setting, $_POST[$setting] );
+ } else {
+ $message = $l->t('Invalid value supplied for %s', array(self::getFieldname($setting, $l)));
+ \OC_JSON::error( array( "data" => array( "message" => $message)) );
+ exit;
+ }
+ }
+ }
+
+ \OC_JSON::success(array("data" => array( "message" => $l->t("Saved") )));
+ }
+
+ /**
+ * Get the field name to use it in error messages
+ *
+ * @param $setting string
+ * @param $l \OC_L10N
+ * @return string
+ */
+ public static function getFieldname($setting, $l) {
+ switch ($setting) {
+ case 'mail_smtpmode':
+ return $l->t( 'Send mode' );
+ case 'mail_smtpsecure':
+ return $l->t( 'Encryption' );
+ case 'mail_smtpauthtype':
+ return $l->t( 'Authentification method' );
+ }
+ }
+}
diff --git a/settings/css/settings.css b/settings/css/settings.css
index 60abbc10862..a47e7bf6563 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -155,6 +155,18 @@ span.connectionwarning {color:#933; font-weight:bold; }
input[type=radio] { width:1em; }
table.shareAPI td { padding-bottom: 0.8em; }
+#mail_settings p label:first-child {
+ display: inline-block;
+ width: 300px;
+ text-align: right;
+}
+#mail_settings p select:nth-child(2) {
+ width: 143px;
+}
+#mail_smtpport {
+ width: 40px;
+}
+
/* HELP */
.pressed {background-color:#DDD;}
diff --git a/settings/js/admin.js b/settings/js/admin.js
index e957bd68f1f..5ea6a5af2df 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -34,4 +34,38 @@ $(document).ready(function(){
$('#security').change(function(){
$.post(OC.filePath('settings','ajax','setsecurity.php'), { enforceHTTPS: $('#forcessl').val() },function(){} );
});
+
+ $('#mail_smtpauth').change(function() {
+ if (!this.checked) {
+ $('#mail_credentials').addClass('hidden');
+ } else {
+ $('#mail_credentials').removeClass('hidden');
+ }
+ });
+
+ $('#mail_smtpmode').change(function() {
+ if ($(this).val() !== 'smtp') {
+ $('#setting_smtpauth').addClass('hidden');
+ $('#setting_smtphost').addClass('hidden');
+ $('#mail_smtpsecure_label').addClass('hidden');
+ $('#mail_smtpsecure').addClass('hidden');
+ $('#mail_credentials').addClass('hidden');
+ } else {
+ $('#setting_smtpauth').removeClass('hidden');
+ $('#setting_smtphost').removeClass('hidden');
+ $('#mail_smtpsecure_label').removeClass('hidden');
+ $('#mail_smtpsecure').removeClass('hidden');
+ if ($('#mail_smtpauth').attr('checked')) {
+ $('#mail_credentials').removeClass('hidden');
+ }
+ }
+ });
+
+ $('#mail_settings').change(function(){
+ 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);
+ });
+ });
});
diff --git a/settings/js/apps.js b/settings/js/apps.js
index 7c71453e105..3dbc8a2f7c2 100644
--- a/settings/js/apps.js
+++ b/settings/js/apps.js
@@ -207,12 +207,24 @@ OC.Settings.Apps = OC.Settings.Apps || {
a.prepend(filename);
a.prepend(img);
li.append(a);
- // append the new app as last item in the list (.push is from sticky footer)
+
+ // append the new app as last item in the list
+ // (.push is from sticky footer)
$('#apps .wrapper .push').before(li);
- // scroll the app navigation down so the newly added app is seen
- $('#navigation').animate({ scrollTop: $('#navigation').height() }, 'slow');
- // draw attention to the newly added app entry by flashing it twice
- container.children('li[data-id="'+entry.id+'"]').animate({opacity:.3}).animate({opacity:1}).animate({opacity:.3}).animate({opacity:1});
+
+ // scroll the app navigation down
+ // so the newly added app is seen
+ $('#navigation').animate({
+ scrollTop: $('#navigation').height()
+ }, 'slow');
+
+ // draw attention to the newly added app entry
+ // by flashing it twice
+ container.children('li[data-id="' + entry.id + '"]')
+ .animate({opacity: 0.3})
+ .animate({opacity: 1})
+ .animate({opacity: 0.3})
+ .animate({opacity: 1});
if (!SVGSupport() && entry.icon.match(/\.svg$/i)) {
$(img).addClass('svg');
@@ -248,9 +260,9 @@ $(document).ready(function(){
var item = tgt.is('li') ? $(tgt) : $(tgt).parent();
var app = item.data('app');
OC.Settings.Apps.loadApp(app);
+ $('#leftcontent .selected').removeClass('selected');
+ item.addClass('selected');
}
- $('#leftcontent .selected').removeClass('selected');
- item.addClass('selected');
return false;
});
$('#rightcontent input.enable').click(function(){
diff --git a/settings/js/personal.js b/settings/js/personal.js
index 5944272067b..98bfe7132d4 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -315,25 +315,3 @@ OC.Encryption.msg={
}
}
};
-
-OC.msg={
- startSaving:function(selector){
- $(selector)
- .html( t('settings', 'Saving...') )
- .removeClass('success')
- .removeClass('error')
- .stop(true, true)
- .show();
- },
- finishedSaving:function(selector, data){
- if( data.status === "success" ){
- $(selector).html( data.data.message )
- .addClass('success')
- .stop(true, true)
- .delay(3000)
- .fadeOut(900);
- }else{
- $(selector).html( data.data.message ).addClass('error');
- }
- }
-};
diff --git a/settings/routes.php b/settings/routes.php
index 895a9f5ccea..64f7122f0cf 100644
--- a/settings/routes.php
+++ b/settings/routes.php
@@ -70,5 +70,8 @@ $this->create('settings_ajax_getlog', '/settings/ajax/getlog.php')
->actionInclude('settings/ajax/getlog.php');
$this->create('settings_ajax_setloglevel', '/settings/ajax/setloglevel.php')
->actionInclude('settings/ajax/setloglevel.php');
+$this->create('settings_mail_settings', '/settings/admin/mailsettings')
+ ->post()
+ ->action('OC\Settings\Admin\Controller', 'setMailSettings');
$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 0eabffb9316..139a9dd076c 100644
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -11,6 +11,27 @@ $levelLabels = array(
$l->t( 'Errors and fatal issues' ),
$l->t( 'Fatal issues only' ),
);
+
+$mail_smtpauthtype = array(
+ '' => $l->t('None'),
+ 'LOGIN' => $l->t('Login'),
+ 'PLAIN' => $l->t('Plain'),
+ 'NTLM' => $l->t('NT LAN Manager'),
+);
+
+$mail_smtpsecure = array(
+ '' => $l->t('None'),
+ 'ssl' => $l->t('SSL'),
+ 'tls' => $l->t('TLS'),
+);
+
+$mail_smtpmode = array(
+ 'sendmail',
+ 'smtp',
+ 'qmail',
+ 'php',
+);
+
?>
<?php
@@ -250,6 +271,84 @@ if (!$_['internetconnectionworking']) {
</table>
</fieldset>
+<fieldset id="mail_settings" class="personalblock">
+ <h2><?php p($l->t('Email Server'));?> <span class="msg"></span></h2>
+
+ <p><?php p($l->t('This is used for sending out notifications.')); ?></p>
+
+ <p>
+ <label for="mail_smtpmode"><?php p($l->t( 'Send mode' )); ?></label>
+ <select name='mail_smtpmode' id='mail_smtpmode'>
+ <?php foreach ($mail_smtpmode as $smtpmode):
+ $selected = '';
+ if ($smtpmode == $_['mail_smtpmode']):
+ $selected = 'selected="selected"';
+ endif; ?>
+ <option value='<?php p($smtpmode)?>' <?php p($selected) ?>><?php p($smtpmode) ?></option>
+ <?php endforeach;?>
+ </select>
+
+ <label id="mail_smtpsecure_label" for="mail_smtpsecure"
+ <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>>
+ <?php p($l->t( 'Encryption' )); ?>
+ </label>
+ <select name="mail_smtpsecure" id="mail_smtpsecure"
+ <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>>
+ <?php foreach ($mail_smtpsecure as $secure => $name):
+ $selected = '';
+ if ($secure == $_['mail_smtpsecure']):
+ $selected = 'selected="selected"';
+ endif; ?>
+ <option value='<?php p($secure)?>' <?php p($selected) ?>><?php p($name) ?></option>
+ <?php endforeach;?>
+ </select>
+ </p>
+
+ <p>
+ <label for="mail_from_address"><?php p($l->t( 'From address' )); ?></label>
+ <input type="text" name='mail_from_address' id="mail_from_address" placeholder="<?php p('mail')?>"
+ value='<?php p($_['mail_from_address']) ?>' />
+ @
+ <input type="text" name='mail_domain' id="mail_domain" placeholder="<?php p('example.com')?>"
+ value='<?php p($_['mail_domain']) ?>' />
+ </p>
+
+ <p id="setting_smtpauth" <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>>
+ <label for="mail_smtpauthtype"><?php p($l->t( 'Authentification method' )); ?></label>
+ <select name='mail_smtpauthtype' id='mail_smtpauthtype'>
+ <?php foreach ($mail_smtpauthtype as $authtype => $name):
+ $selected = '';
+ if ($authtype == $_['mail_smtpauthtype']):
+ $selected = 'selected="selected"';
+ endif; ?>
+ <option value='<?php p($authtype)?>' <?php p($selected) ?>><?php p($name) ?></option>
+ <?php endforeach;?>
+ </select>
+
+ <input type="checkbox" name="mail_smtpauth" id="mail_smtpauth" value="1"
+ <?php if ($_['mail_smtpauth']) print_unescaped('checked="checked"'); ?> />
+ <label for="mail_smtpauth"><?php p($l->t( 'Authentication required' )); ?></label>
+ </p>
+
+ <p id="setting_smtphost" <?php if ($_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>>
+ <label for="mail_smtphost"><?php p($l->t( 'Server address' )); ?></label>
+ <input type="text" name='mail_smtphost' id="mail_smtphost" placeholder="<?php p('smtp.example.com')?>"
+ value='<?php p($_['mail_smtphost']) ?>' />
+ :
+ <input type="text" name='mail_smtpport' id="mail_smtpport" placeholder="<?php p($l->t('Port'))?>"
+ value='<?php p($_['mail_smtpport']) ?>' />
+ </p>
+
+ <p id="mail_credentials" <?php if (!$_['mail_smtpauth'] || $_['mail_smtpmode'] != 'smtp') print_unescaped(' class="hidden"'); ?>>
+ <label for="mail_smtpname"><?php p($l->t( 'Credentials' )); ?></label>
+ <input type="text" name='mail_smtpname' id="mail_smtpname" placeholder="<?php p($l->t('SMTP Username'))?>"
+ value='<?php p($_['mail_smtpname']) ?>' />
+ <input type="password" name='mail_smtppassword' id="mail_smtppassword"
+ placeholder="<?php p($l->t('SMTP Password'))?>" value='<?php p($_['mail_smtppassword']) ?>' />
+ </p>
+
+</fieldset>
+
<fieldset class="personalblock">
<h2><?php p($l->t('Log'));?></h2>
<?php p($l->t('Log level'));?> <select name='loglevel' id='loglevel'>