Move Browser & Upload to own namespace
This commit is contained in:
parent
051253a745
commit
50316bbb80
20 changed files with 77 additions and 121 deletions
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Module\Media;
|
namespace Friendica\Module\Media\Attachment;
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
|
@ -37,7 +37,7 @@ use Psr\Log\LoggerInterface;
|
||||||
/**
|
/**
|
||||||
* Browser for Attachments
|
* Browser for Attachments
|
||||||
*/
|
*/
|
||||||
class AttachmentBrowser extends BaseModule
|
class Browser extends BaseModule
|
||||||
{
|
{
|
||||||
/** @var IHandleUserSessions */
|
/** @var IHandleUserSessions */
|
||||||
protected $session;
|
protected $session;
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Module\Profile\Attachment;
|
namespace Friendica\Module\Media\Attachment;
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||||
|
@ -73,30 +73,13 @@ class Upload extends \Friendica\BaseModule
|
||||||
$this->response->setType(Response::TYPE_JSON, 'application/json');
|
$this->response->setType(Response::TYPE_JSON, 'application/json');
|
||||||
}
|
}
|
||||||
|
|
||||||
$nick = $this->parameters['nickname'];
|
$owner = User::getOwnerDataById($this->userSession->getLocalUserId());
|
||||||
$owner = User::getOwnerDataByNick($nick);
|
|
||||||
if (!$owner) {
|
if (!$owner) {
|
||||||
$this->logger->warning('owner is not a valid record:', ['owner' => $owner, 'nick' => $nick]);
|
$this->logger->warning('Owner not found.', ['uid' => $this->userSession->getLocalUserId()]);
|
||||||
return $this->return(401, $this->t('Invalid request.'));
|
return $this->return(401, $this->t('Invalid request.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
$can_post = false;
|
|
||||||
$contact_id = 0;
|
|
||||||
$page_owner_uid = $owner['uid'];
|
|
||||||
$community_page = $owner['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
|
|
||||||
|
|
||||||
if ($this->userSession->getLocalUserId() && $this->userSession->getLocalUserId() == $page_owner_uid) {
|
|
||||||
$can_post = true;
|
|
||||||
} elseif ($community_page && !empty($this->userSession->getRemoteContactID($page_owner_uid))) {
|
|
||||||
$contact_id = $this->userSession->getRemoteContactID($page_owner_uid);
|
|
||||||
$can_post = $this->database->exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$can_post) {
|
|
||||||
$this->logger->warning('User does not have required permissions', ['contact_id' => $contact_id, 'page_owner_uid' => $page_owner_uid]);
|
|
||||||
return $this->return(403, $this->t('Permission denied.'), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($_FILES['userfile'])) {
|
if (empty($_FILES['userfile'])) {
|
||||||
$this->logger->warning('No file uploaded (empty userfile)');
|
$this->logger->warning('No file uploaded (empty userfile)');
|
||||||
return $this->return(401, $this->t('Invalid request.'), true);
|
return $this->return(401, $this->t('Invalid request.'), true);
|
||||||
|
@ -126,7 +109,7 @@ class Upload extends \Friendica\BaseModule
|
||||||
return $this->return(401, $msg);
|
return $this->return(401, $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
$newid = Attach::storeFile($tempFileName, $page_owner_uid, $fileName, '<' . $owner['id'] . '>');
|
$newid = Attach::storeFile($tempFileName, $owner['uid'], $fileName, '<' . $owner['id'] . '>');
|
||||||
|
|
||||||
@unlink($tempFileName);
|
@unlink($tempFileName);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Module\Media;
|
namespace Friendica\Module\Media\Photo;
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
|
@ -38,7 +38,7 @@ use Psr\Log\LoggerInterface;
|
||||||
/**
|
/**
|
||||||
* Browser for Photos
|
* Browser for Photos
|
||||||
*/
|
*/
|
||||||
class PhotosBrowser extends BaseModule
|
class Browser extends BaseModule
|
||||||
{
|
{
|
||||||
/** @var IHandleUserSessions */
|
/** @var IHandleUserSessions */
|
||||||
protected $session;
|
protected $session;
|
||||||
|
@ -81,7 +81,7 @@ class PhotosBrowser extends BaseModule
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('media/filebrowser.tpl');
|
$tpl = Renderer::getMarkupTemplate('media/filebrowser.tpl');
|
||||||
$output = Renderer::replaceMacros($tpl, [
|
$output = Renderer::replaceMacros($tpl, [
|
||||||
'$type' => 'photos',
|
'$type' => 'photo',
|
||||||
'$path' => $path,
|
'$path' => $path,
|
||||||
'$folders' => $albums,
|
'$folders' => $albums,
|
||||||
'$files' => $photosArray,
|
'$files' => $photosArray,
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Module\Profile\Photos;
|
namespace Friendica\Module\Media\Photo;
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
use Friendica\Core\Config\Capability\IManageConfigValues;
|
||||||
|
@ -76,36 +76,11 @@ class Upload extends \Friendica\BaseModule
|
||||||
|
|
||||||
$album = trim($request['album'] ?? '');
|
$album = trim($request['album'] ?? '');
|
||||||
|
|
||||||
if (empty($_FILES['media'])) {
|
$owner = User::getOwnerDataById($this->userSession->getLocalUserId());
|
||||||
$user = $this->database->selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['nickname' => $this->parameters['nickname'], 'blocked' => false]);
|
|
||||||
} else {
|
|
||||||
$user = $this->database->selectFirst('owner-view', ['id', 'uid', 'nickname', 'page-flags'], ['uid' => BaseApi::getCurrentUserID() ?: null, 'blocked' => false]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$this->database->isResult($user)) {
|
if (!$owner) {
|
||||||
$this->logger->warning('User is not valid', ['nickname' => $this->parameters['nickname'], 'user' => $user]);
|
$this->logger->warning('Owner not found.', ['uid' => $this->userSession->getLocalUserId()]);
|
||||||
return $this->return(404, $this->t('User not found.'));
|
return $this->return(401, $this->t('Invalid request.'));
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Setup permissions structures
|
|
||||||
*/
|
|
||||||
$can_post = false;
|
|
||||||
$visitor = 0;
|
|
||||||
$contact_id = 0;
|
|
||||||
$page_owner_uid = $user['uid'];
|
|
||||||
|
|
||||||
if ($this->userSession->getLocalUserId() && $this->userSession->getLocalUserId() == $page_owner_uid) {
|
|
||||||
$can_post = true;
|
|
||||||
} elseif ($user['page-flags'] == User::PAGE_FLAGS_COMMUNITY && !$this->userSession->getRemoteContactID($page_owner_uid)) {
|
|
||||||
$contact_id = $this->userSession->getRemoteContactID($page_owner_uid);
|
|
||||||
$can_post = $this->database->exists('contact', ['blocked' => false, 'pending' => false, 'id' => $contact_id, 'uid' => $page_owner_uid]);
|
|
||||||
$visitor = $contact_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$can_post) {
|
|
||||||
$this->logger->warning('No permission to upload files', ['contact_id' => $contact_id, 'page_owner_uid' => $page_owner_uid]);
|
|
||||||
return $this->return(403, $this->t('Permission denied.'), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($_FILES['userfile']) && empty($_FILES['media'])) {
|
if (empty($_FILES['userfile']) && empty($_FILES['media'])) {
|
||||||
|
@ -223,9 +198,9 @@ class Upload extends \Friendica\BaseModule
|
||||||
$album = $this->t('Wall Photos');
|
$album = $this->t('Wall Photos');
|
||||||
}
|
}
|
||||||
|
|
||||||
$allow_cid = '<' . $user['id'] . '>';
|
$allow_cid = '<' . $owner['id'] . '>';
|
||||||
|
|
||||||
$result = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 0, Photo::DEFAULT, $allow_cid);
|
$result = Photo::store($image, $owner['uid'], 0, $resource_id, $filename, $album, 0, Photo::DEFAULT, $allow_cid);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
$this->logger->warning('Photo::store() failed', ['result' => $result]);
|
$this->logger->warning('Photo::store() failed', ['result' => $result]);
|
||||||
return $this->return(401, $this->t('Image upload failed.'));
|
return $this->return(401, $this->t('Image upload failed.'));
|
||||||
|
@ -233,7 +208,7 @@ class Upload extends \Friendica\BaseModule
|
||||||
|
|
||||||
if ($width > 640 || $height > 640) {
|
if ($width > 640 || $height > 640) {
|
||||||
$image->scaleDown(640);
|
$image->scaleDown(640);
|
||||||
$result = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 1, Photo::DEFAULT, $allow_cid);
|
$result = Photo::store($image, $owner['uid'], 0, $resource_id, $filename, $album, 1, Photo::DEFAULT, $allow_cid);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$smallest = 1;
|
$smallest = 1;
|
||||||
}
|
}
|
||||||
|
@ -241,14 +216,14 @@ class Upload extends \Friendica\BaseModule
|
||||||
|
|
||||||
if ($width > 320 || $height > 320) {
|
if ($width > 320 || $height > 320) {
|
||||||
$image->scaleDown(320);
|
$image->scaleDown(320);
|
||||||
$result = Photo::store($image, $page_owner_uid, $visitor, $resource_id, $filename, $album, 2, Photo::DEFAULT, $allow_cid);
|
$result = Photo::store($image, $owner['uid'], 0, $resource_id, $filename, $album, 2, Photo::DEFAULT, $allow_cid);
|
||||||
if ($result && ($smallest == 0)) {
|
if ($result && ($smallest == 0)) {
|
||||||
$smallest = 2;
|
$smallest = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->info('upload done');
|
$this->logger->info('upload done');
|
||||||
return $this->return(200, "\n\n" . '[url=' . $this->baseUrl . '/photos/' . $user['nickname'] . '/image/' . $resource_id . '][img]' . $this->baseUrl . "/photo/$resource_id-$smallest." . $image->getExt() . "[/img][/url]\n\n");
|
return $this->return(200, "\n\n" . '[url=' . $this->baseUrl . '/photos/' . $owner['nickname'] . '/image/' . $resource_id . '][img]' . $this->baseUrl . "/photo/$resource_id-$smallest." . $image->getExt() . "[/img][/url]\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace Friendica\Module\Profile\Photos;
|
namespace Friendica\Module\Profile;
|
||||||
|
|
||||||
use Friendica\App;
|
use Friendica\App;
|
||||||
use Friendica\Content\Pager;
|
use Friendica\Content\Pager;
|
||||||
|
@ -40,7 +40,7 @@ use Friendica\Util\Images;
|
||||||
use Friendica\Util\Profiler;
|
use Friendica\Util\Profiler;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
class Index extends \Friendica\Module\BaseProfile
|
class Photos extends \Friendica\Module\BaseProfile
|
||||||
{
|
{
|
||||||
/** @var IHandleUserSessions */
|
/** @var IHandleUserSessions */
|
||||||
private $session;
|
private $session;
|
|
@ -32,12 +32,10 @@ use Friendica\Module;
|
||||||
|
|
||||||
$profileRoutes = [
|
$profileRoutes = [
|
||||||
'' => [Module\Profile\Index::class, [R::GET]],
|
'' => [Module\Profile\Index::class, [R::GET]],
|
||||||
'/attachment/upload' => [Module\Profile\Attachment\Upload::class, [ R::POST]],
|
|
||||||
'/contacts/common' => [Module\Profile\Common::class, [R::GET]],
|
'/contacts/common' => [Module\Profile\Common::class, [R::GET]],
|
||||||
'/contacts[/{type}]' => [Module\Profile\Contacts::class, [R::GET]],
|
'/contacts[/{type}]' => [Module\Profile\Contacts::class, [R::GET]],
|
||||||
'/media' => [Module\Profile\Media::class, [R::GET]],
|
'/media' => [Module\Profile\Media::class, [R::GET]],
|
||||||
'/photos' => [Module\Profile\Photos\Index::class, [R::GET ]],
|
'/photos' => [Module\Profile\Photos::class, [R::GET ]],
|
||||||
'/photos/upload' => [Module\Profile\Photos\Upload::class, [ R::POST]],
|
|
||||||
'/profile' => [Module\Profile\Profile::class, [R::GET]],
|
'/profile' => [Module\Profile\Profile::class, [R::GET]],
|
||||||
'/remote_follow' => [Module\Profile\RemoteFollow::class, [R::GET, R::POST]],
|
'/remote_follow' => [Module\Profile\RemoteFollow::class, [R::GET, R::POST]],
|
||||||
'/schedule' => [Module\Profile\Schedule::class, [R::GET, R::POST]],
|
'/schedule' => [Module\Profile\Schedule::class, [R::GET, R::POST]],
|
||||||
|
@ -471,8 +469,10 @@ return [
|
||||||
'/friendica.webmanifest' => [Module\Manifest::class, [R::GET]],
|
'/friendica.webmanifest' => [Module\Manifest::class, [R::GET]],
|
||||||
|
|
||||||
'/media' => [
|
'/media' => [
|
||||||
'/attachment/browser' => [Module\Media\AttachmentBrowser::class, [R::GET]],
|
'/attachment/browser' => [Module\Media\Attachment\Browser::class, [R::GET]],
|
||||||
'/photos/browser[/{album}]' => [Module\Media\PhotosBrowser::class, [R::GET]],
|
'/attachment/upload' => [Module\Media\Attachment\Upload::class, [ R::POST]],
|
||||||
|
'/photo/browser[/{album}]' => [Module\Media\Photo\Browser::class, [R::GET]],
|
||||||
|
'/photo/upload' => [Module\Media\Photo\Upload::class, [ R::POST]],
|
||||||
],
|
],
|
||||||
|
|
||||||
'/moderation' => [
|
'/moderation' => [
|
||||||
|
@ -562,7 +562,7 @@ return [
|
||||||
|
|
||||||
// Kept for backwards-compatibility
|
// Kept for backwards-compatibility
|
||||||
// @TODO remove by version 2023.12
|
// @TODO remove by version 2023.12
|
||||||
'/photos/{nickname}' => [Module\Profile\Photos\Index::class, [R::GET]],
|
'/photos/{nickname}' => [Module\Profile\Photos::class, [R::GET]],
|
||||||
|
|
||||||
'/ping' => [Module\Notifications\Ping::class, [R::GET]],
|
'/ping' => [Module\Notifications\Ping::class, [R::GET]],
|
||||||
|
|
||||||
|
|
|
@ -345,9 +345,9 @@ img.acpopup-img {
|
||||||
.fbrowser .path a:before, .fbrowser .path .btn-link:before { content: "/"; padding-right: 5px;}
|
.fbrowser .path a:before, .fbrowser .path .btn-link:before { content: "/"; padding-right: 5px;}
|
||||||
.fbrowser .folders ul { list-style-type: none; padding-left: 10px;}
|
.fbrowser .folders ul { list-style-type: none; padding-left: 10px;}
|
||||||
.fbrowser .list { height: auto; overflow-y: hidden; margin: 10px 0px; }
|
.fbrowser .list { height: auto; overflow-y: hidden; margin: 10px 0px; }
|
||||||
.fbrowser.photos .photo-album-image-wrapper { float: left; }
|
.fbrowser.photo .photo-album-image-wrapper { float: left; }
|
||||||
.fbrowser.photos a img, .fbrowser.photos .btn-link img { height: 48px; }
|
.fbrowser.photo a img, .fbrowser.photo .btn-link img { height: 48px; }
|
||||||
.fbrowser.photos a p, .fbrowser.photos .btn-link p { display: none;}
|
.fbrowser.photo a p, .fbrowser.photo .btn-link p { display: none;}
|
||||||
.fbrowser.attachment .photo-album-image-wrapper { float:none; white-space: nowrap; }
|
.fbrowser.attachment .photo-album-image-wrapper { float:none; white-space: nowrap; }
|
||||||
.fbrowser.attachment img { display: inline; }
|
.fbrowser.attachment img { display: inline; }
|
||||||
.fbrowser.attachment p { display: inline; white-space: nowrap; }
|
.fbrowser.attachment p { display: inline; white-space: nowrap; }
|
||||||
|
|
|
@ -166,7 +166,7 @@ $(function() {
|
||||||
|
|
||||||
/* event from comment textarea button popups */
|
/* event from comment textarea button popups */
|
||||||
/* insert returned bbcode at cursor position or replace selected text */
|
/* insert returned bbcode at cursor position or replace selected text */
|
||||||
$('body').on('fbrowser.photos.comment', function(e, filename, bbcode, id) {
|
$('body').on('fbrowser.photo.comment', function(e, filename, bbcode, id) {
|
||||||
$.colorbox.close();
|
$.colorbox.close();
|
||||||
var textarea = document.getElementById("comment-edit-text-" +id);
|
var textarea = document.getElementById("comment-edit-text-" +id);
|
||||||
var start = textarea.selectionStart;
|
var start = textarea.selectionStart;
|
||||||
|
@ -1069,7 +1069,7 @@ var Dialog = {
|
||||||
* to the event handler
|
* to the event handler
|
||||||
*/
|
*/
|
||||||
doImageBrowser : function (name, id) {
|
doImageBrowser : function (name, id) {
|
||||||
var url = Dialog._get_url('photos', name, id);
|
var url = Dialog._get_url('photo', name, id);
|
||||||
return Dialog.show(url);
|
return Dialog.show(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ const FileBrowser = {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
let embed = '';
|
let embed = '';
|
||||||
if (FileBrowser.type === "photos") {
|
if (FileBrowser.type === "photo") {
|
||||||
embed = '[url=' + this.dataset.link + '][img=' + this.dataset.img + ']' + this.dataset.alt + '[/img][/url]';
|
embed = '[url=' + this.dataset.link + '][img=' + this.dataset.img + ']' + this.dataset.alt + '[/img][/url]';
|
||||||
}
|
}
|
||||||
if (FileBrowser.type === "attachment") {
|
if (FileBrowser.type === "attachment") {
|
||||||
|
@ -99,12 +99,11 @@ const FileBrowser = {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if ($('#upload-photos').length)
|
if ($('#upload-photo').length) {
|
||||||
{
|
|
||||||
new window.AjaxUpload(
|
new window.AjaxUpload(
|
||||||
'upload-photos',
|
'upload-photo',
|
||||||
{
|
{
|
||||||
action: 'profile/' + FileBrowser.nickname + '/photos/upload?response=json',
|
action: 'media/photo/upload?response=json',
|
||||||
name: 'userfile',
|
name: 'userfile',
|
||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
onSubmit: function (file, ext) {
|
onSubmit: function (file, ext) {
|
||||||
|
@ -125,12 +124,11 @@ const FileBrowser = {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($('#upload-attachment').length)
|
if ($('#upload-attachment').length) {
|
||||||
{
|
|
||||||
new window.AjaxUpload(
|
new window.AjaxUpload(
|
||||||
'upload-attachment',
|
'upload-attachment',
|
||||||
{
|
{
|
||||||
action: 'profile/' + FileBrowser.nickname + '/attachment/upload?response=json',
|
action: 'media/attachment/upload?response=json',
|
||||||
name: 'userfile',
|
name: 'userfile',
|
||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
onSubmit: function (file, ext) {
|
onSubmit: function (file, ext) {
|
||||||
|
|
|
@ -61,11 +61,11 @@ function enableOnUser(){
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/* callback */
|
/* callback */
|
||||||
$('body').on('fbrowser.photos.main', function(e, filename, embedcode, id) {
|
$('body').on('fbrowser.photo.main', function(e, filename, embedcode, id) {
|
||||||
$.colorbox.close();
|
$.colorbox.close();
|
||||||
addeditortext(embedcode);
|
addeditortext(embedcode);
|
||||||
});
|
});
|
||||||
$('body').on('fbrowser.photos.main', function(e, filename, embedcode, id) {
|
$('body').on('fbrowser.attachment.main', function(e, filename, embedcode, id) {
|
||||||
$.colorbox.close();
|
$.colorbox.close();
|
||||||
addeditortext(embedcode);
|
addeditortext(embedcode);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1563,10 +1563,10 @@ textarea.comment-edit-text:focus + .comment-edit-form .preview {
|
||||||
max-height: calc(100vh - 220px);
|
max-height: calc(100vh - 220px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.fbrowser.photos .photo-album-image-wrapper {
|
.fbrowser.photo .photo-album-image-wrapper {
|
||||||
box-shadow: 2px 2px 5px 0px rgba(0, 0, 0, 0.2);
|
box-shadow: 2px 2px 5px 0px rgba(0, 0, 0, 0.2);
|
||||||
}
|
}
|
||||||
.fbrowser.photos .photo-album-image-wrapper .caption {
|
.fbrowser.photo .photo-album-image-wrapper .caption {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
.fbrowser .profile-rotator-wrapper {
|
.fbrowser .profile-rotator-wrapper {
|
||||||
|
|
|
@ -82,7 +82,7 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Insert filebrowser images into the input field (field_fileinput.tpl).
|
// Insert filebrowser images into the input field (field_fileinput.tpl).
|
||||||
$("body").on("fbrowser.photos.input", function (e, filename, embedcode, id, img) {
|
$("body").on("fbrowser.photo.input", function (e, filename, embedcode, id, img) {
|
||||||
// Select the clicked button by it's attribute.
|
// Select the clicked button by it's attribute.
|
||||||
var elm = $("[image-input='select']");
|
var elm = $("[image-input='select']");
|
||||||
// Select the input field which belongs to this button.
|
// Select the input field which belongs to this button.
|
||||||
|
@ -137,7 +137,7 @@ Dialog._get_url = function (type, name, id) {
|
||||||
|
|
||||||
// Does load the filebrowser into the jot modal.
|
// Does load the filebrowser into the jot modal.
|
||||||
Dialog.showJot = function () {
|
Dialog.showJot = function () {
|
||||||
var type = "photos";
|
var type = "photo";
|
||||||
var name = "main";
|
var name = "main";
|
||||||
|
|
||||||
var url = Dialog._get_url(type, name);
|
var url = Dialog._get_url(type, name);
|
||||||
|
|
|
@ -109,7 +109,7 @@ var FileBrowser = {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
let embed = '';
|
let embed = '';
|
||||||
if (FileBrowser.type === 'photos') {
|
if (FileBrowser.type === 'photo') {
|
||||||
embed = '[url=' + this.dataset.link + '][img=' + this.dataset.img + ']' + this.dataset.alt + '[/img][/url]';
|
embed = '[url=' + this.dataset.link + '][img=' + this.dataset.img + ']' + this.dataset.alt + '[/img][/url]';
|
||||||
}
|
}
|
||||||
if (FileBrowser.type === 'attachment') {
|
if (FileBrowser.type === 'attachment') {
|
||||||
|
@ -155,12 +155,12 @@ var FileBrowser = {
|
||||||
|
|
||||||
// Initialize the AjaxUpload for the upload buttons
|
// Initialize the AjaxUpload for the upload buttons
|
||||||
uploadButtons: function () {
|
uploadButtons: function () {
|
||||||
if ($('#upload-photos').length) {
|
if ($('#upload-photo').length) {
|
||||||
//AjaxUpload for photos
|
//AjaxUpload for photos
|
||||||
new window.AjaxUpload(
|
new window.AjaxUpload(
|
||||||
'upload-photos',
|
'upload-photo',
|
||||||
{
|
{
|
||||||
action: 'profile/' + FileBrowser.nickname + '/photos/upload?response=json&album=' + encodeURIComponent(FileBrowser.folder),
|
action: 'media/photo/upload?response=json&album=' + encodeURIComponent(FileBrowser.folder),
|
||||||
name: 'userfile',
|
name: 'userfile',
|
||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
onSubmit: function (file, ext) {
|
onSubmit: function (file, ext) {
|
||||||
|
@ -187,7 +187,7 @@ var FileBrowser = {
|
||||||
new window.AjaxUpload(
|
new window.AjaxUpload(
|
||||||
'upload-attachment',
|
'upload-attachment',
|
||||||
{
|
{
|
||||||
action: 'profile/' + FileBrowser.nickname + '/attachment/upload?response=json',
|
action: 'media/attachment/upload?response=json',
|
||||||
name: 'userfile',
|
name: 'userfile',
|
||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
onSubmit: function (file, ext) {
|
onSubmit: function (file, ext) {
|
||||||
|
@ -236,7 +236,7 @@ var FileBrowser = {
|
||||||
|
|
||||||
// Initialize justified Gallery
|
// Initialize justified Gallery
|
||||||
initGallery: function () {
|
initGallery: function () {
|
||||||
$('.fbrowser.photos .fbrowser-content-container').justifiedGallery({
|
$('.fbrowser.photo .fbrowser-content-container').justifiedGallery({
|
||||||
rowHeight: 80,
|
rowHeight: 80,
|
||||||
margins: 4,
|
margins: 4,
|
||||||
border: 0,
|
border: 0,
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/* callback */
|
/* callback */
|
||||||
$('body').on('fbrowser.photos.main', function(e, filename, embedcode, id) {
|
$('body').on('fbrowser.photo.main', function(e, filename, embedcode, id) {
|
||||||
///@todo this part isn't ideal and need to be done in a better way
|
///@todo this part isn't ideal and need to be done in a better way
|
||||||
jotTextOpenUI(document.getElementById("profile-jot-text"));
|
jotTextOpenUI(document.getElementById("profile-jot-text"));
|
||||||
jotActive();
|
jotActive();
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
{{* Switch between image and file mode *}}
|
{{* Switch between image and file mode *}}
|
||||||
<div class="fbswitcher btn-group btn-group-xs pull-right" aria-label="Switch between photo and attachment mode">
|
<div class="fbswitcher btn-group btn-group-xs pull-right" aria-label="Switch between photo and attachment mode">
|
||||||
<button type="button" class="btn btn-default" data-mode="photos" aria-label="Photo Mode"><i class="fa fa-picture-o" aria-hidden="true"></i></button>
|
<button type="button" class="btn btn-default" data-mode="photo" aria-label="Photo Mode"><i class="fa fa-picture-o" aria-hidden="true"></i></button>
|
||||||
<button type="button" class="btn btn-default" data-mode="attachment" aria-label="Attachment Mode"><i class="fa fa-file-o" aria-hidden="true"></i></button>
|
<button type="button" class="btn btn-default" data-mode="attachment" aria-label="Attachment Mode"><i class="fa fa-file-o" aria-hidden="true"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
|
@ -2517,15 +2517,15 @@ footer {
|
||||||
.fbrowser .list {
|
.fbrowser .list {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
.fbrowser.photos .photo-album-image-wrapper {
|
.fbrowser.photo .photo-album-image-wrapper {
|
||||||
width: 48px;
|
width: 48px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
.fbrowser.photos a img {
|
.fbrowser.photo a img {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
.fbrowser.photos a p {
|
.fbrowser.photo a p {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.fbrowser.attachment .photo-album-image-wrapper {
|
.fbrowser.attachment .photo-album-image-wrapper {
|
||||||
|
|
|
@ -2516,15 +2516,15 @@ footer {
|
||||||
.fbrowser .list {
|
.fbrowser .list {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
.fbrowser.photos .photo-album-image-wrapper {
|
.fbrowser.photo .photo-album-image-wrapper {
|
||||||
width: 48px;
|
width: 48px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
.fbrowser.photos a img {
|
.fbrowser.photo a img {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
.fbrowser.photos a p {
|
.fbrowser.photo a p {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.fbrowser.attachment .photo-album-image-wrapper {
|
.fbrowser.attachment .photo-album-image-wrapper {
|
||||||
|
|
|
@ -2516,15 +2516,15 @@ footer {
|
||||||
.fbrowser .list {
|
.fbrowser .list {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
.fbrowser.photos .photo-album-image-wrapper {
|
.fbrowser.photo .photo-album-image-wrapper {
|
||||||
width: 48px;
|
width: 48px;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
.fbrowser.photos a img {
|
.fbrowser.photo a img {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: 48px;
|
height: 48px;
|
||||||
}
|
}
|
||||||
.fbrowser.photos a p {
|
.fbrowser.photo a p {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
.fbrowser.attachment .photo-album-image-wrapper {
|
.fbrowser.attachment .photo-album-image-wrapper {
|
||||||
|
|
|
@ -1673,9 +1673,9 @@ footer { height: 100px; display: table-row; }
|
||||||
}
|
}
|
||||||
.fbrowser .folders ul { list-style: url("icons/folder.png"); padding-left: 22px;}
|
.fbrowser .folders ul { list-style: url("icons/folder.png"); padding-left: 22px;}
|
||||||
.fbrowser .list { padding: 10px; }
|
.fbrowser .list { padding: 10px; }
|
||||||
.fbrowser.photos .photo-album-image-wrapper { width: 48px; height: 48px; }
|
.fbrowser.photo .photo-album-image-wrapper { width: 48px; height: 48px; }
|
||||||
.fbrowser.photos a img { width: auto; height: 48px; }
|
.fbrowser.photo a img { width: auto; height: 48px; }
|
||||||
.fbrowser.photos a p { display: none;}
|
.fbrowser.photo a p { display: none;}
|
||||||
.fbrowser.attachment .photo-album-image-wrapper { float:none; white-space: nowrap; width: 100%; height: auto; }
|
.fbrowser.attachment .photo-album-image-wrapper { float:none; white-space: nowrap; width: 100%; height: auto; }
|
||||||
.fbrowser.attachment img { display: inline; width: 16px; height: 16px}
|
.fbrowser.attachment img { display: inline; width: 16px; height: 16px}
|
||||||
.fbrowser.attachment p { display: inline; white-space: nowrap; }
|
.fbrowser.attachment p { display: inline; white-space: nowrap; }
|
||||||
|
|
|
@ -3261,7 +3261,7 @@ img.photo-album-photo {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* upload/select popup */
|
/* upload/select popup */
|
||||||
fbrowser.photos .photo-album-image-wrapper { margin-left: 10px; }
|
fbrowser.photo .photo-album-image-wrapper { margin-left: 10px; }
|
||||||
#message-preview { margin-top: 15px; }
|
#message-preview { margin-top: 15px; }
|
||||||
#message-preview span { width: 100%; }
|
#message-preview span { width: 100%; }
|
||||||
#message-preview .mail-count, #message-preview .mail-delete { display:none; }
|
#message-preview .mail-count, #message-preview .mail-delete { display:none; }
|
||||||
|
|
Loading…
Reference in a new issue