summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorkondou <kondou@ts.unde.re>2013-07-26 12:20:11 +0200
committerkondou <kondou@ts.unde.re>2013-08-25 21:02:43 +0200
commit4a08f7d710ced1c564e05471e1f873ecfb9ca161 (patch)
tree3286d872ac9ad55d037e897a3da5e7425c6ca52b /settings
parentb8965c6107a908db705fde55e0606998ccbf02e4 (diff)
downloadnextcloud-server-4a08f7d710ced1c564e05471e1f873ecfb9ca161.tar.gz
nextcloud-server-4a08f7d710ced1c564e05471e1f873ecfb9ca161.zip
Add basic avatars and gravatar
Diffstat (limited to 'settings')
-rwxr-xr-xsettings/admin.php1
-rw-r--r--settings/ajax/setavatarmode.php12
-rw-r--r--settings/js/admin.js6
-rw-r--r--settings/personal.php1
-rw-r--r--settings/routes.php2
-rw-r--r--settings/templates/admin.php37
-rw-r--r--settings/templates/personal.php13
7 files changed, 72 insertions, 0 deletions
diff --git a/settings/admin.php b/settings/admin.php
index 869729a9e41..394d6b55d78 100755
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -30,6 +30,7 @@ $tmpl->assign('isWebDavWorking', OC_Util::isWebDAVWorking());
$tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded());
$tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax'));
$tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes'));
+$tmpl->assign('avatar', OC_Config::getValue("avatar", "local"));
// Check if connected using HTTPS
if (OC_Request::serverProtocol() === 'https') {
diff --git a/settings/ajax/setavatarmode.php b/settings/ajax/setavatarmode.php
new file mode 100644
index 00000000000..f6f19f50cc9
--- /dev/null
+++ b/settings/ajax/setavatarmode.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Copyright (c) 2013 Christopher Schäpers <christopher@schaepers.it>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+
+OC_Util::checkAdminUser();
+OCP\JSON::callCheck();
+
+OC_Config::setValue('avatar', $_POST['mode']);
diff --git a/settings/js/admin.js b/settings/js/admin.js
index f2d6f37a51a..6fa1c768ea3 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -14,6 +14,12 @@ $(document).ready(function(){
}
});
+ $('#avatar input').change(function(){
+ if ($(this).attr('checked')) {
+ $.post(OC.filePath('settings', 'ajax', 'setavatarmode.php'), {mode: $(this).val()});
+ }
+ });
+
$('#shareAPIEnabled').change(function() {
$('.shareAPI td:not(#enable)').toggle();
});
diff --git a/settings/personal.php b/settings/personal.php
index e69898f6f8f..4bec21d58c8 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -84,6 +84,7 @@ $tmpl->assign('passwordChangeSupported', OC_User::canUserChangePassword(OC_User:
$tmpl->assign('displayNameChangeSupported', OC_User::canUserChangeDisplayName(OC_User::getUser()));
$tmpl->assign('displayName', OC_User::getDisplayName());
$tmpl->assign('enableDecryptAll' , $enableDecryptAll);
+$tmpl->assign('avatar', OC_Config::getValue('avatar', 'local'));
$forms=OC_App::getForms('personal');
$tmpl->assign('forms', array());
diff --git a/settings/routes.php b/settings/routes.php
index 73ee70d1d5c..9a27c3e439b 100644
--- a/settings/routes.php
+++ b/settings/routes.php
@@ -70,3 +70,5 @@ $this->create('settings_ajax_setsecurity', '/settings/ajax/setsecurity.php')
->actionInclude('settings/ajax/setsecurity.php');
$this->create('isadmin', '/settings/js/isadmin.js')
->actionInclude('settings/js/isadmin.php');
+$this->create('settings_ajax_setavatarmode', '/settings/ajax/setavatarmode.php')
+ ->actionInclude('settings/ajax/setavatarmode.php');
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
index e54586b80df..a166aec7775 100644
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -116,6 +116,43 @@ if (!$_['internetconnectionworking']) {
</p>
</fieldset>
+<fieldset class="personalblock" id="avatar">
+ <legend><strong><?php p($l->t('Avatars')); ?></strong></legend>
+ <table class="nostyle">
+ <tr>
+ <td>
+ <input type="radio" name="avatarmode" value="gravatar"
+ id="avatar_gravatar" <?php if ($_['avatar'] === "gravatar") {
+ print_unescaped('checked="checked"');
+ } ?>>
+ <label for="avatar_gravatar">Gravatar</label><br>
+ <em><?php print_unescaped($l->t('Use <a href="http://gravatar.com/">gravatar</a> for avatars')); ?></em><br>
+ <em><?php p($l->t('This sends data to gravatar')); ?></em>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="radio" name="avatarmode" value="local"
+ id="avatar_local" <?php if ($_['avatar'] === "local") {
+ print_unescaped('checked="checked"');
+ } ?>>
+ <label for="avatar_local"><?php p($l->t('Local avatars')); ?></label><br>
+ <em><?php p($l->t('Use local avatars, which each user has to upload themselves')); ?></em>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="radio" name="avatarmode" value="none"
+ id="avatar_none" <?php if ($_['avatar'] === "none") {
+ print_unescaped('checked="checked"');
+ } ?>>
+ <label for="avatar_none"><?php p($l->t('No avatars')); ?></label><br>
+ <em><?php print_unescaped($l->t('Do not provide avatars')); ?></em>
+ </td>
+ </tr>
+ </table>
+</fieldset>
+
<fieldset class="personalblock" id="shareAPI">
<legend><strong><?php p($l->t('Sharing'));?></strong></legend>
<table class="shareAPI nostyle">
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index bad88142da9..55f626aa574 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -74,12 +74,25 @@ if($_['passwordChangeSupported']) {
<input type="text" name="email" id="email" value="<?php p($_['email']); ?>"
placeholder="<?php p($l->t('Your email address'));?>" /><span class="msg"></span><br />
<em><?php p($l->t('Fill in an email address to enable password recovery'));?></em>
+ <?php if($_['avatar'] === "gravatar") {
+ print_unescaped($l->t('<br><em>Your Email will be used for your gravatar<em>'));
+ } ?>
</fieldset>
</form>
<?php
}
?>
+<?php if ($_['avatar'] === "local"): ?>
+<form id="avatar">
+ <fieldset class="personalblock">
+ <legend><strong><?php p($l->t('Avatar')); ?></strong></legend>
+ <img src="<?php print_unescaped(\OC_Avatar::get(\OC_User::getUser())); ?>"><br>
+ <button><?php p($l->t('Upload a new avatar')); ?></button>
+ </fieldset>
+</form>
+<?php endif; ?>
+
<form>
<fieldset class="personalblock">
<legend><strong><?php p($l->t('Language'));?></strong></legend>