-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for display docs and videos (same behaviour as J4) in the view used by media field #19967
Conversation
|
||
$this->docs = &$docs; | ||
$this->videos = &$videos; | ||
$this->videos = &$videos; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes duplicate assignment, removed it
For image fields, PDFs should not be displayed/selectable. With the PR, the PDF is selectable, but won't display on the frontend to be clickable.
|
Yes non-images should not be selectable in the image fields Using the image fields (of images and links TAB) The selection for non-images for specific cases should be disallowed In my own views i am using ACL + a configuration id that corresponds to the configuration data in the DB to decide what is shown / not shown, and also do other customization on the view |
b6fcddb
to
963c05b
Compare
/** | ||
* Set the active video | ||
* | ||
* @param integer $index Image position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Video
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thanks
/** | ||
* Set the active document | ||
* | ||
* @param integer $index Image position |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thanks
* | ||
* @return void | ||
* | ||
* @since 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__DEPLOY_VERSION__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thanks
* | ||
* @return void | ||
* | ||
* @since 1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
__DEPLOY_VERSION__
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, thanks
@@ -47,8 +47,10 @@ | |||
); | |||
} | |||
?> | |||
<?php if (count($this->images) > 0 || count($this->folders) > 0) : ?> | |||
<?php if (count($this->docs) > 0 || count($this->videos) > 0 || count($this->images) > 0 || count($this->folders) > 0) : ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about moving count($this->docs) > 0 || count($this->videos) > 0
to the end since images are more likely to exist than docs and videos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, and i try to always remember for code that will be repeated
but in this case, it is only executed once per imagelist view opening,
thus the benefit would be only a couple of microseconds ... or less,
so i went for the order that the $this variables are defined in view.html.php,
or we could use the order the order that $this variables are used inside the IF:
folders, images, videos, docs
Also inside the IF the use of echo $this->loadTemplate('folder|image|video|doc');
inside loops
is really thousand times slower than this optimization, but even the above is hardly measurable because it is executed only a few dozens or hundrend times
963c05b
to
da879c3
Compare
Can you do this feature against the Joomla 4 branch? Don't want to introduce a new feature in J3 which doesn't exist in 4, better to do it the other way around. Thanks! |
Hi, improvement this is really useful! I was diverted here after raising a change request #20057 but I'm not sure if the functionality is the same. Would you mind comparing the text of that issue? In particular, can I just check if this change provides access to all types of media? I recently developed a website with media which included .gpx files (XML format files of GPS tracks), so would those be visible for example? Also, I suggested being able to filter on the types of media shown – eg by MIME type or file extension. Many thanks! |
this PR so far only adds the listing of doc / video files without any configuration so you mean |
you do not need wait for this PR to do it in any J3 installation you can do it today, just add 2 lines $docs = $this->get('documents');
$videos = $this->get('videos'); to your Joomla template override of **and then add 2 loops in it ** copy code for the 2 loops from here and correct the variable name of each loop if you need more help to do the above then please ask in Joomla forums or in PHP programming forums [EDIT] |
@ggppdk |
Escape filename like in #20616 |
Do you think this PR will merge soon ? |
@Max00 every PR need 2 successfully Test, before a Maintainer decide to merge or not. So if you wan't to help, please test. |
@ggppdk will be good, now you add this great feature, the |
yes, but still this PR does not solve (yet) the configuration issue You see there is the topic of how the MVC will decide that browsing docs and videos is allowed Always showing all files
Using (-only-) a parameter in url
and someone by just by adding a parameter to the URL will be able to browse docs and videos in the media folder, before someone would need to know the filename for accessing a file i suggest that the XTD button proposed in #20969
then you would add to the mediaelements URL then you would read configuration from the plugin |
@ggppdk we can test this PR, or you need still work in something more? I ask because of this:
So far, this PR only add the necessary layout for add that type of files, and if is all this PR will do, then we can test it, for see if we can have merged it. After that, we can use part of this code, in the |
Thanks anyone spending time on this PR |
@ggppdk Thank you so much for your code. I was able to use it completely as an override, without having to modify core-files. |
@Robdebert your Comment on #19954 is resolve by your above? |
@Robdebert would you mind sharing your override? Maybe as a gist? That would be great! |
@level420 and @ghost: Sorry for the late reply. I created a new issue, becuase i still think, that the media-fieldtype should use the same extensions as com_media allows, when editing the component-parameters. See #30548 Would be great, if you could support this new ticket, because the issue with the media-field is very old (i found a forum post from 2016 also).. and still Joomla-Core does not provide a modal-window fieldtype with the possibility to upload other files then images. |
Pull Request for Issues #10871 , #17475 , #19954
Summary of Changes
Added template files for documents and videos to the com_media view (imageslist) used by media field
Added template overrides to backend isis template
Added template overrides to frontend protostar template
Testing Instructions
(At Media Manager options)
Add
pdf,mp4,PDF,MP4
to Legal ExtensionsAdd
application/pdf,video/mp4
to Legal MIME typesOpen an article and go to TAB
image and links
, click to select an imageUpload a PDF file and an MP4 file, click on each of them so that they get selected and click "Insert"
Expected result
The files are uploaded and shown and insertable
Actual result
The files are uploaded but not shown / not insertable
Documentation Changes Required
YES