Skip to content
Snippets Groups Projects
Commit bdf48a6d authored by Christopher Schäpers's avatar Christopher Schäpers
Browse files

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

parent 67c5be9f
Branches
No related tags found
No related merge requests found
......@@ -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);
......
<?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
}
}
......@@ -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();
}
......
......@@ -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('/');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment