diff options
author | kondou <kondou@ts.unde.re> | 2013-08-26 16:46:55 +0200 |
---|---|---|
committer | kondou <kondou@ts.unde.re> | 2013-08-26 16:46:55 +0200 |
commit | 31736a1df36745467ad176ee1ffe442b87546012 (patch) | |
tree | 5d65ed5f890abc9c1e275dd382d037f3f52031d4 /settings | |
parent | 9a8908b643c69451118ab76ca36e5fa0e704bd0a (diff) | |
download | nextcloud-server-31736a1df36745467ad176ee1ffe442b87546012.tar.gz nextcloud-server-31736a1df36745467ad176ee1ffe442b87546012.zip |
Have a controller instead ofo avatar.php and fix some cropper-design
Diffstat (limited to 'settings')
-rw-r--r-- | settings/js/personal.js | 25 | ||||
-rw-r--r-- | settings/templates/personal.php | 4 | ||||
-rw-r--r-- | settings/templates/users.php | 2 |
3 files changed, 19 insertions, 12 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js index eaf90636d35..e97d0d64c92 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -45,7 +45,7 @@ function changeDisplayName(){ } function selectAvatar (path) { - $.post(OC.filePath('', '', 'avatar.php'), {path: path}, avatarResponseHandler); + $.post(OC.router_base_url+'/avatar/', {path: path}, avatarResponseHandler); } function updateAvatar () { @@ -54,22 +54,30 @@ function updateAvatar () { } function showAvatarCropper() { - OC.dialogs.message('', t('settings', 'Crop'), undefined, OCdialogs.OK_BUTTON, sendCropData); - var $dialog = $('#oc-dialog-'+(OC.dialogs.dialogs_counter-1)+'-content'); + var $dlg = $('<div id="cropperbox" title="'+t('settings', 'Crop')+'"></div>'); + $('body').append($dlg); + $('#cropperbox').ocdialog({ + width: '600px', + height: '600px', + buttons: [{ + text: t('settings', 'Crop'), + click: sendCropData, + defaultButton: true + }] + }); var cropper = new Image(); $(cropper).load(function() { $(this).attr('id', 'cropper'); - $('#oc-dialog-'+(OC.dialogs.dialogs_counter-1)+'-content').html(this); + $('#cropperbox').html(this); $(this).Jcrop({ onChange: saveCoords, onSelect: saveCoords, aspectRatio: 1 }); - }).attr('src', OC.filePath('', '', 'avatar.php')+"?user="+OC.currentUser+"&size=512&tmp="+$('#avatar').data('tmpname')); + }).attr('src', OC.router_base_url+'/avatar/tmp/512'); } function sendCropData() { - var tmp = $('#avatar').data('tmpname'); var cropperdata = $('#cropper').data(); var data = { x: cropperdata.x, @@ -77,7 +85,7 @@ function sendCropData() { w: cropperdata.w, h: cropperdata.h }; - $.post(OC.filePath('', '', 'avatar.php'), {tmp:tmp, crop: data}, avatarResponseHandler); + $.post(OC.router_base_url+'/avatar/', {crop: data}, avatarResponseHandler); } function saveCoords(c) { @@ -90,7 +98,6 @@ function avatarResponseHandler(data) { if (data.status === "success") { updateAvatar(); } else if (data.data.message === "notsquare") { - $('#avatar').data('tmpname', data.data.tmpname); showAvatarCropper(); } else { $warning.show(); @@ -206,7 +213,7 @@ $(document).ready(function(){ $('#removeavatar').click(function(){ $.ajax({ type: 'DELETE', - url: OC.filePath('', '', 'avatar.php'), + url: OC.router_base_url+'/avatar/', success: function(msg) { updateAvatar(); } diff --git a/settings/templates/personal.php b/settings/templates/personal.php index 5db28779b55..1ea005cf335 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -83,10 +83,10 @@ if($_['passwordChangeSupported']) { } ?> -<form id="avatar" method="post" action="<?php p(\OC_Helper::linkTo('', 'avatar.php')); ?>"> +<form id="avatar" method="post" action="<?php p(\OC_Helper::linkToRoute('core_avatar_post')); ?>"> <fieldset class="personalblock"> <legend><strong><?php p($l->t('Profile Image')); ?></strong></legend> - <img src="<?php print_unescaped(link_to('', 'avatar.php').'?user='.OC_User::getUser().'&size=128'); ?>"><br> + <img src="<?php print_unescaped(\OC_Helper::linkToRoute('core_avatar_get').'/'.OC_User::getUser().'/128'); ?>"><br> <em><?php p($l->t('Has to be square and either PNG or JPG')); ?></em><br> <div class="warning hidden"></div> <div class="inlineblock button" id="uploadavatarbutton"><?php p($l->t('Upload new')); ?></div> diff --git a/settings/templates/users.php b/settings/templates/users.php index d3f356a7ba8..32ca6e0b106 100644 --- a/settings/templates/users.php +++ b/settings/templates/users.php @@ -97,7 +97,7 @@ $_['subadmingroups'] = array_flip($items); <?php foreach($_["users"] as $user): ?> <tr data-uid="<?php p($user["name"]) ?>" data-displayName="<?php p($user["displayName"]) ?>"> - <td class="avatar"><img src="<?php print_unescaped(link_to('', 'avatar.php')); ?>?user=<?php p($user['name']); ?>&size=32"></td> + <td class="avatar"><img src="<?php print_unescaped(\OC_Helper::linkToRoute('core_avatar_get')); ?>/<?php p($user['name']); ?>/32"></td> <td class="name"><?php p($user["name"]); ?></td> <td class="displayName"><span><?php p($user["displayName"]); ?></span> <img class="svg action" src="<?php p(image_path('core', 'actions/rename.svg'))?>" |