diff --git a/core/css/styles.css b/core/css/styles.css
index 367f3f7ca4..792ccb0832 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -40,6 +40,11 @@ body { background:#fefefe; font:normal .8em/1.6em "Helvetica Neue",Helvetica,Ari
.header-right { float:right; vertical-align:middle; padding:0.5em; }
.header-right > * { vertical-align:middle; }
+header .avatar {
+ float:right;
+ margin-top: 6px;
+ margin-right: 6px;
+}
/* INPUTS */
input[type="text"], input[type="password"], input[type="search"], input[type="number"], input[type="email"], input[type="url"],
diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php
index 038264bd06..0ab6a4dc08 100644
--- a/core/templates/layout.user.php
+++ b/core/templates/layout.user.php
@@ -45,9 +45,11 @@
getLogoClaim()); ?>
+
+
+
-
diff --git a/lib/templatelayout.php b/lib/templatelayout.php
index f24cd9cfd9..c26dff4176 100644
--- a/lib/templatelayout.php
+++ b/lib/templatelayout.php
@@ -20,7 +20,7 @@ class OC_TemplateLayout extends OC_Template {
// display avatars if they are enabled
if (OC_Config::getValue('avatar') === 'gravatar' || OC_Config::getValue('avatar', 'local') === 'local') {
- $this->assign('avatar', '');
+ $this->assign('avatar', '');
}
// Update notification
diff --git a/settings/ajax/newavatar.php b/settings/ajax/newavatar.php
index 4c8ff0c416..bede15e499 100644
--- a/settings/ajax/newavatar.php
+++ b/settings/ajax/newavatar.php
@@ -13,12 +13,19 @@ if(isset($_POST['path'])) {
\OC_Avatar::setLocalAvatar($user, $path);
OC_JSON::success();
} catch (Exception $e) {
- OC_JSON::error();
+ OC_JSON::error(array("msg" => $e->getMessage()));
}
}
-} elseif (isset($_POST['image'])) { // upload a new image
- \OC_Avatar::setLocalAvatar($user, $_POST['image']);
- OC_JSON::success();
+} elseif (!empty($_FILES)) { // upload a new image
+ $files = $_FILES['files'];
+ if ($files['error'][0] === 0) {
+ $data = file_get_contents($files['tmp_name'][0]);
+ \OC_Avatar::setLocalAvatar($user, $data);
+ unlink($files['tmp_name'][0]);
+ OC_JSON::success();
+ } else {
+ OC_JSON::error();
+ }
} else {
OC_JSON::error();
}
diff --git a/settings/css/settings.css b/settings/css/settings.css
index d5ffe44848..e6ced0e375 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -35,6 +35,9 @@ td.name, td.password { padding-left:.8em; }
td.password>img,td.displayName>img, td.remove>a, td.quota>img { visibility:hidden; }
td.password, td.quota, td.displayName { width:12em; cursor:pointer; }
td.password>span, td.quota>span, rd.displayName>span { margin-right: 1.2em; color: #C7C7C7; }
+td.avatar img {
+ margin-top: 6px;
+}
td.remove { width:1em; padding-right:1em; }
tr:hover>td.password>span, tr:hover>td.displayName>span { margin:0; cursor:pointer; }
diff --git a/settings/js/personal.js b/settings/js/personal.js
index fdaca07e98..71b4785bbf 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -144,6 +144,14 @@ $(document).ready(function(){
updateAvatar();
});
+ var uploadparms = {
+ done: function(e) {
+ updateAvatar();
+ }
+ };
+
+ $('#uploadavatar').fileupload(uploadparms);
+
$('#selectavatar').click(function(){
OC.dialogs.filepicker(t('settings', "Select an avatar"), selectAvatar, false, "image");
});
diff --git a/settings/personal.php b/settings/personal.php
index 4bec21d58c..233b1440eb 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -15,6 +15,9 @@ OC_Util::addScript( 'settings', 'personal' );
OC_Util::addStyle( 'settings', 'settings' );
OC_Util::addScript( '3rdparty', 'chosen/chosen.jquery.min' );
OC_Util::addStyle( '3rdparty', 'chosen' );
+if (OC_Config::getValue('avatar', 'local') === 'local') {
+ \OC_Util::addScript('files', 'jquery.fileupload');
+}
OC_App::setActiveNavigationEntry( 'personal' );
$storageInfo=OC_Helper::getStorageInfo();
diff --git a/settings/templates/admin.php b/settings/templates/admin.php
index e5b941f2b2..f7d6a576d9 100644
--- a/settings/templates/admin.php
+++ b/settings/templates/admin.php
@@ -121,10 +121,9 @@ if (!$_['internetconnectionworking']) {
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 01415a6f9a..e0e91cb7de 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -87,7 +87,7 @@ if($_['passwordChangeSupported']) {