mirror of
https://github.com/friendica/friendica
synced 2025-04-19 09:50:11 +00:00
"Video" is replaced by a "Media" tab in contact and profile
This commit is contained in:
parent
1979b4775d
commit
c3554ac0f4
8 changed files with 286 additions and 484 deletions
|
@ -68,15 +68,14 @@ class BaseProfile extends BaseModule
|
|||
'id' => 'photo-tab',
|
||||
'accesskey' => 'h',
|
||||
],
|
||||
// @todo Currently deactivated since it doesn't really work
|
||||
// [
|
||||
// 'label' => DI::l10n()->t('Videos'),
|
||||
// 'url' => DI::baseUrl() . '/videos/' . $nickname,
|
||||
// 'sel' => $current == 'videos' ? 'active' : '',
|
||||
// 'title' => DI::l10n()->t('Videos'),
|
||||
// 'id' => 'video-tab',
|
||||
// 'accesskey' => 'v',
|
||||
// ],
|
||||
[
|
||||
'label' => DI::l10n()->t('Media'),
|
||||
'url' => $baseProfileUrl . '/media',
|
||||
'sel' => $current == 'media' ? 'active' : '',
|
||||
'title' => DI::l10n()->t('Media'),
|
||||
'id' => 'media-tab',
|
||||
'accesskey' => 'd',
|
||||
],
|
||||
];
|
||||
|
||||
// the calendar link for the full featured events calendar
|
||||
|
|
|
@ -52,6 +52,7 @@ class Contact extends BaseModule
|
|||
const TAB_PROFILE = 3;
|
||||
const TAB_CONTACTS = 4;
|
||||
const TAB_ADVANCED = 5;
|
||||
const TAB_MEDIA = 6;
|
||||
|
||||
private static function batchActions()
|
||||
{
|
||||
|
@ -372,11 +373,11 @@ class Contact extends BaseModule
|
|||
}
|
||||
|
||||
if ($cmd === 'posts') {
|
||||
return self::getPostsHTML($a, $contact_id);
|
||||
return self::getPostsHTML($contact_id, false);
|
||||
}
|
||||
|
||||
if ($cmd === 'media') {
|
||||
return self::getPostsHTML($a, $contact_id); // TODO
|
||||
return self::getPostsHTML($contact_id, true);
|
||||
}
|
||||
|
||||
if ($cmd === 'conversations') {
|
||||
|
@ -915,6 +916,14 @@ class Contact extends BaseModule
|
|||
'id' => 'posts-tab',
|
||||
'accesskey' => 'p',
|
||||
],
|
||||
[
|
||||
'label' => DI::l10n()->t('Media'),
|
||||
'url' => 'contact/' . $pcid . '/media',
|
||||
'sel' => (($active_tab == self::TAB_MEDIA) ? 'active' : ''),
|
||||
'title' => DI::l10n()->t('Posts containing media objects'),
|
||||
'id' => 'media-tab',
|
||||
'accesskey' => 'd',
|
||||
],
|
||||
[
|
||||
'label' => DI::l10n()->t('Profile'),
|
||||
'url' => 'contact/' . $cid,
|
||||
|
@ -983,7 +992,7 @@ class Contact extends BaseModule
|
|||
return $o;
|
||||
}
|
||||
|
||||
private static function getPostsHTML($a, $contact_id)
|
||||
private static function getPostsHTML(int $contact_id, bool $only_media)
|
||||
{
|
||||
$contact = DBA::selectFirst('contact', ['uid', 'url', 'id'], ['id' => $contact_id, 'deleted' => false]);
|
||||
|
||||
|
@ -999,9 +1008,9 @@ class Contact extends BaseModule
|
|||
DI::page()['aside'] = Widget\VCard::getHTML($profiledata);
|
||||
|
||||
if ($contact['uid'] == 0) {
|
||||
$o .= Model\Contact::getPostsFromId($contact['id']);
|
||||
$o .= Model\Contact::getPostsFromId($contact['id'], false, 0, 0, $only_media);
|
||||
} else {
|
||||
$o .= Model\Contact::getPostsFromUrl($contact['url']);
|
||||
$o .= Model\Contact::getPostsFromUrl($contact['url'], false, 0, 0, $only_media);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
53
src/Module/Profile/Media.php
Normal file
53
src/Module/Profile/Media.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2021, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Module\Profile;
|
||||
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\Profile as ProfileModel;
|
||||
use Friendica\Module\BaseProfile;
|
||||
use Friendica\Network\HTTPException;
|
||||
|
||||
class Media extends BaseProfile
|
||||
{
|
||||
public static function content(array $parameters = [])
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
$profile = ProfileModel::load($a, $parameters['nickname']);
|
||||
if (empty($profile)) {
|
||||
throw new HTTPException\NotFoundException(DI::l10n()->t('User not found.'));
|
||||
}
|
||||
|
||||
if (!$profile['net-publish']) {
|
||||
DI::page()['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
|
||||
}
|
||||
|
||||
$is_owner = local_user() == $profile['uid'];
|
||||
|
||||
$o = self::getTabsHTML($a, 'media', $is_owner, $profile['nickname'], $profile['hide-friends']);
|
||||
|
||||
$o .= Contact::getPostsFromUrl($profile['url'], false, 0, 0, true);
|
||||
|
||||
return $o;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue