I saw there is a new option in mapi_display: context (I guess you added this for mapi_derivatives.module). This isn't a very flexible:
- there is no possibility to get a list of all context types (derivatives uses page, teaser and full but there can be more).
- mapi_filename() just picks the first result, where multiple results can be provided by several transform hook implementations per context
- mapi-using-modules can't define their own contexts and which file (origional or transformed version) to use per context.
What we want:
- mapi_display() has to be able to handle every media type (for the sake of easy usage)
- mapi-using-modules don't have to know what transformations are available; mapi provides these
- mapi-using-modules should be able to define their own contexts and which file (origional or transformed version) to use.
What I definitly should do:
- remove context option from mapi_display, $op = default from hook_mapi_transformation and related settings from mapi_derivatives.module
- add context settings to media.module (and media_attach.module?)
Thoughts:
Solution 1:
- keep $op=default but without $context (although I would rename it to something like "final transformation")
- make it possible to list these final transformations
- use these for context settings (in media.module) as options per context (could be done for media_attach also)
Con: there still is no generalized way of choosing another presenter.
Solution 2 (more flexible?):
something with display profiles included in mapi.module?
Does this still make any sense, or am I over-acting?
| Comment | File | Size | Author |
|---|---|---|---|
| #17 | mapi.tar_.gz | 212.26 KB | rhys |
| #14 | mapi.tar_.gz | 97.47 KB | rhys |
| #5 | mapi_profile.tar_.gz | 5.02 KB | rhys |
| #4 | mapi.tar_.gz | 98.15 KB | rhys |
| #4 | media.tar_.gz | 36.01 KB | rhys |
Comments
Comment #1
rhys commentedGiven what you've said, I don't think so. I was working off the fact I didn't have the mapi_profiles done.
The functionality of the mapi modules was damaged by the context work-around, so I'll be removing almost all of that in preference for the profiles. I'll be adding the ability for mapi-using-modules to define their own contexts, so that these can be set within the profiles section.
There are functions:
* mapi_profile_list() - return a list of the currently defined profile names
* mapi_profile_settings($name, $ext) - returns both the presenter and the settings for the appropriate extension and name.
I may have to modify this to incorporate the question of definition of context, but generally, this seems the easiest way to then integrate the mapi_profile_settings() into the mapi_display, which would not need to know what the context actually is.
Comment #2
casey commentedHow's this progressing? CVS-ready? I'd like to test it on media_cck
Comment #3
rhys commentedI don't have a CVS ready one yet, I'm still testing, and I'll post what I have here in this issue soon so that you can use it, test it, etc.
Unfortunately I got caught on other work-related issues, so it's been delayed a couple of days.
Comment #4
rhys commentedI changed quite substantially how I wanted to do the profiles.
First, they are based entirely on contexts. It is possible for new contexts to be defined, and switched both on and off for presentation of media. This has been implemented in the media_attach module.
Through mapi_profiles, it allows custom definition of new contexts (although I've still got to work on a decent admin process for this), the menu system is still somewhat incorrect, but that'll be solved relatively soon.
mapi_context_list() will give you a list of all contexts defined by modules. There are a series of other mapi_context related functions, which including mapi_context_current(), mapi_context_reference() and mapi_context_switch().
If you've got questions, or statements please post them quickly, I'll be wanting to add this to CVS some time before the weekend since I'll be away for a week.
Comment #5
rhys commentedHere's a updated mapi_profiles. Please note the change in database structure for the definition of new contexts.
Comment #6
rhys commentedOh, I forgot to mention, I've got to add a height/width standard form settings for the settings sections of the presenter, and start getting some options for jw_player installed (like playlist derivative and start_image derivative, etc).
Comment #7
casey commentedStill investigating your changes, but I have my doubts about contexts.
There can be numerous contexts; not only for media.module, but also for example for:
- mediareference cck fields: it should be possible for every field to configure which presenter/derivative to use.
- media_attach: configurable per contenttype
- an custom avatar module using mapi
- header (configurable mediaitem per page/theme/etc) module
- media_gallery
Do they all need to define their own contexts (some even several; eg media_cck per field)? Or am I misunderstanding things?
Comment #8
casey commentedMy idea was that mapi-using-modules should define their own configuration forms where users choose which the profile to use; the mapi-using-module simply passes this profile to mapi_display.
With your implementation, on the other hand, mapi-using-modules don't have to define these forms.
When there are however a large number of context, the admin/mapi/contexts form could become hard to work with).
Another con is that profiles aren't reusable (they are bound to a context); but this is relatively simple to fix (e.g. inheritance like you've done with mapi_derivatives).
Comment #9
casey commentedSo question is whether defining contexts via mapi is usefull.
pro:
- no extra configuration forms per mapi-using-module needed
- sharing of contexts by mapi-using-modules (but this could also be done with profiles)
con:
- clarity: which contexts are available/ which are used by the several mapi-using-modules
- profiles arent reusable (yet)
- hard to figure out which context hook implementation is actually providing $filename
- performance
Sorry for coming up with more cons than pros (you've done a lot of work on this). But I think that defining contexts via mapi and this way of $filename selection is limiting flexibility.
The way I should do it:
hook_mapi_profile
default profile using original $filename and generic (or link) presenter
where a profile can override $filename
configurable profiles
possibility to override profiles defined by other modules (including default profiles), something like views.module is working
mapi_filter.module
media.module
media_attach.module (per contenttype)
...
such a module doesn't necessarily need a configuration form for profile selection
Users can still override these using mapi_profile.module
But of course it's your call. Maybe I've missed your reason to do it this way.
Comment #10
casey commentedIf you like I'll try to post a version like I described above next night (its 2:45am here now; I need sleep)
Comment #11
rhys commentedI'm trying to grasp what it is that my current system is doing differently to what you've posted (assuming that I change the name from context to profile).
It seems that what you mean by profiles are actually more simplified versions of contexts. i.e. instead of a context dealing with all the different extensions, a profile simply defines a presenter, and some settings that are the default for this process.
I understand the need to be able to pass the profile through the mapi_display, which gives more power than the way the current context definitions take place. Also, this would definitely change the way the mapi_derivatives form functions.
I'm assuming when you say define hook_mapi_profiles, that there is some kind of triggering process for listing available profiles, getting the details for the profile (which of course would be cached, for performance reasons), and probably a few other things I'm forgetting right now.
If this is not correct, could you please give me a clearer idea of the difference you see between contexts and profiles? What exactly do you mean by a profile?
Comment #12
casey commentedThey (contexts and profiles) are like you say almost the same; The name context was confusing to me. Big difference (with your implementation and my described idea) is however that you need to switch $context every time and that it is very hard to figure out which context hook implementation is actually providing $filename and $presenter. I think that just passing a profile to mapi_display is easier, more flexible and you know what is happening (you know which profile is used so its easy to figure out which $filename and $presenter is used).
How I saw your implementation
context is a string ('full', 'page', or whatever) which can be switched
context_profile (this is what I mean with a profile I guess)
What I mean by profiles is like what formatters are for cck (http://drupal.org/node/106716).
content_format($field, $item, $formatter);
we only have a filename
mapi_display($filename, $profile)
formatters can only handles certain fieldtypes. profiles have to be able to handle every mediatype (else presenters would be enough) and have to possibility to change $filename. A formatter creates HTML, a profile only provides settings (filename, presenter, settings) to mapi_display which calls the presenter to create HTML.
Comment #13
rhys commentedHaving read the link you sent, it would seem that it is fairly simple to generate the formatted HTML for the element, simply by having something like mapi_display($filename, array('profile' => 'fancy')).
I'm assuming that since profile has to apply to ALL extension that are defined, that we could get it to simply select the appropriate default if nothing has been selected for a particular extension (in other words, default is the profile of last resort).
Also, since layouting is an option (i.e. like captioned images), it would be useful to also have that as part of the definition of the profile. In this way not only can the presenter be chosen, but a layout to handle display of associated metadata can be done. (I'll be working on the user-definition of layouts fairly soon - there are already some defined, such as figured, captioned, generic, which also allow an do floats).
I'm in agreement on the problems with the context switching process, so I'll be eliminating that, and switch to the above mentioned profile selection.
The reason I wanted contexts with some kind of referencing, is so that teasers, or full page views, or so forth have enough information that they can generate specific information. Take the case of attached media. These are node specific, and it is important that when the media is displayed, that it's information is related to that of the node. It is possible to do this a different way, eliminate the contexts altogether, and settle on the profiling arrangement.
I think a combination of doing the profiling via the mapi_display as a selection rather than as an automatic thing, as well as the removal of contexts altogether can be accomplished, and with some slight modifications the potential requirements like media_attach can be solved by other means.
Comment #14
rhys commentedOk, so in the next week, I'll have the final beta mapi release, everything after that, are bug fixes for problems that occur within testing.
The contexts have been replaced, simply by profiles, with hopefully a slightly easier interface for usage.
This is not the finished version, but will give you a sense of the changes I've made.
I'm sorry if this breaks the version of media, but I'll be updating that to reflect changes to the mapi soon.
Comment #15
casey commentedCurrently I don't have the time to extensively review the changes, but after the 15th of may I do.
Comment #16
casey commentedBack in business. First of all, I think it is smart to get your changes into CVS (Maybe tag it as another version), so we can easily work both at it. What do you think?
Comment #17
rhys commentedI think the idea is a good one, however, I'm not that good with CVS. I've attached the mapi as it stands, I can't understand why it's suddenly grown in size.
If you could help me with the question of tagging, etc. Either with something to read (links are helpful), so that I can also manage the D6 version I'll be working on very soon, I'd be more than grateful.
Comment #18
rhys commentedSee CVS for d6, head.