Use OC.Router.generate, TODO use cache, prepare for defaultavatars

This commit is contained in:
kondou 2013-08-28 21:20:28 +02:00
parent 67c5be9f19
commit bdf48a6daa
4 changed files with 7 additions and 18 deletions

View File

@ -91,7 +91,7 @@ class OC_Core_Avatar_Controller {
// TODO deliver actual size here as well, so Jcrop can do its magic and we have the actual coordinates here again
// TODO or don't have a size parameter and only resize client sided (looks promising)
//
// TODO make a cronjob that cleans up the tmpavatar after it's older than 2 hours, should be run every hour
// TODO move the tmpavatar to the cache instead, so it's cleaned up after some time
$user = OC_User::getUser();
$view = new \OC\Files\View('/'.$user);

View File

@ -1,13 +0,0 @@
<?php
class CleanUpAvatarJob extends \OC\BackgroundJob\TimedJob {
public function __construct () {
$this->setInterval(7200); // 2 hours
}
public function run ($argument) {
// TODO $view
// TODO remove ALL the tmpavatars
}
}

View File

@ -45,7 +45,7 @@ function changeDisplayName(){
}
function selectAvatar (path) {
$.post(OC.router_base_url+'/avatar/', {path: path}, avatarResponseHandler);
$.post(OC.Router.generate('core_avatar_post'), {path: path}, avatarResponseHandler);
}
function updateAvatar () {
@ -74,7 +74,7 @@ function showAvatarCropper() {
onSelect: saveCoords,
aspectRatio: 1
});
}).attr('src', OC.router_base_url+'/avatartmp/512');
}).attr('src', OC.Router.generate('core_avatar_get_tmp', {size: 512}));
}
function sendCropData() {
@ -86,7 +86,7 @@ function sendCropData() {
w: cropperdata.w,
h: cropperdata.h
};
$.post(OC.router_base_url+'/avatar/cropped', {crop: data}, avatarResponseHandler);
$.post(OC.Router.generate('core_avatar_post_cropped'), {crop: data}, avatarResponseHandler);
}
function saveCoords(c) {
@ -214,7 +214,7 @@ $(document).ready(function(){
$('#removeavatar').click(function(){
$.ajax({
type: 'DELETE',
url: OC.router_base_url+'/avatar/',
url: OC.Router.generate('core_avatar_delete'),
success: function(msg) {
updateAvatar();
}

View File

@ -18,6 +18,8 @@ OC_Util::addStyle( '3rdparty', 'chosen' );
\OC_Util::addScript('files', 'jquery.fileupload');
\OC_Util::addScript('3rdparty/Jcrop', 'jquery.Jcrop.min');
\OC_Util::addStyle('3rdparty/Jcrop', 'jquery.Jcrop.min');
//OC_Util::addScript('3rdparty', 'md5/md5.min');
//OC_Util::addScript('core', 'placeholder');
OC_App::setActiveNavigationEntry( 'personal' );
$storageInfo=OC_Helper::getStorageInfo('/');