U4-4177 - U7 - Add Startnode Picker to Multiple Media Picker

Created by Jeavon Leopold 04 Feb 2014, 16:23:00 Updated by Brian Patton 15 Jul 2014, 20:41:10

Per Ploug: Editing the issue, to make it clear we are only including the picker, not the xpath, for more info, look at the discussion below.

It was one of the most useful features of DAMP and should be added! One further nice to have would be to have a placeholder for the XPath expression, it would be $currentNodeId. This would be really useful for when a content node has an associated media folder, then it would be possible to have one data type for all. e.g. //MyMediaFolder[@myContentPicker = $currentNodeId].
Probably a niche requirement but a pattern we have found frequently with content pages that have a associated gallery.

Comments

Per Ploug 17 Feb 2014, 10:00:56

Currently media doesnt support xpath, unless you hack it, like ucomponents did. The problem is that if you have a site with a reasonable sized media library, this will really slow down the site everytime you open a media picker.

This is what happens:

  1. You request a media node via xpath
  2. uQuery (ucomponents) collect all media nodes recursively in memory
  3. Puts together a xml document in memory
  4. queries the document.
  5. Discards it all.
  6. And it does this every time (no caching of the above)

Now imaging if you have 10,20 or 30.000 media items, that would but a huge strain on your DB every time you do this.

So, I will not add this to the core or enable it through the UI, but please feel free to extend the picker yourself and release as a package, all the API's are in place for this, but it exposes a very big performance burden to just have it included by default.

It is something that will come, when the new umbraco cache is included, if you need it today, I guess Damp for V7 would be an obvious project to build.


Jeroen Breuer 17 Feb 2014, 10:08:13

Support for xpath is hard and was also pretty slow for DAMP, but selecting a start node through a picker is probably not that hard. You don't need build an in memory xml document for that and since the media library usually isn't multilingual (an image can be the same for all languages) that will be used most anyway.


Per Ploug 17 Feb 2014, 10:11:14

Yeah, startnode pickers are fine for setting a root folder, the dialog already supports that so just the picker configuration that needs to change.


Jeavon Leopold 17 Feb 2014, 10:17:08

@Per.Ploug that will be a great improvement! I hope once the new cache layer is available that more complex non Xpath queries will be possible on media in the same way as content.


Lee Kelleher 19 Feb 2014, 16:07:42

We needed to set a start node for a media picker, so we created a custom property editor to handle it. Like Per says, it was literally adding in a media picker on the data-type's config.

If interested, I can send a pull-request for it, but wanted to check first - in case we'd be duplicating efforts.


Per Ploug 19 Feb 2014, 18:19:52

A pull request would be awesome lee :)


Matt Brailsford 20 Feb 2014, 17:54:57

Pull request here: https://github.com/umbraco/Umbraco-CMS/pull/300


Lee Kelleher 20 Feb 2014, 17:58:46

@Per - I've got a Courier DataResolver too (for the prevalue start nodeId) if you'd like that? I'll email it over.


Jeroen Breuer 26 Feb 2014, 08:24:26

Can this still make it into 7.1? The "Due in Version" on the right is not set yet.


Jeroen Breuer 10 Mar 2014, 15:24:12

I just tested the 7.1 Beta and this feature is still missing. I really hope this will be part of 7.1 because there is already a pull request for it.


Sebastiaan Janssen 19 Mar 2014, 14:24:19

Fixed in rev 375b3948e0e1b19452d40cc17e4da2dfab6fc1a4


Søren Reinke 17 Jun 2014, 11:20:44

The built in Image Cropper, should have a 'Start Node' feature as well :)


Brian Patton 15 Jul 2014, 20:41:10

Not sure if this is related, but i'm seeing an issue where if a user is restricted and has a start node set for their media library, that the v7 media picker doesn't work for the restricted user from the RTE or when using a media picker as a macro parameter. I've created an issue: http://issues.umbraco.org/issue/U4-5211


Priority: Normal

Type: Feature (request)

State: Fixed

Assignee: Per Ploug

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted: Pull request

Affected versions: 7.0.1, 7.0.2, 7.0.3, 7.0.4

Due in version: 7.1.0

Sprint:

Story Points:

Cycle: