Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Arun P K 11 posts 72 karma points
    Jul 14, 2016 @ 03:34
    Arun P K
    0

    Umbraco Multi Site - How to set MultiMediaPickers Start node dynamically

    Hi,

    I am working on multisite using Umbraco and now I am stuck with one thing related to MediaPicker - Images.

    Use Case: Lets say I currently have following multisites in my Umbraco instance.

    • Site-1
    • Site-2

    I am trying to eliminate following 2 scenarios

    1. The users of each site should not have access to other folders than their root Media folder.
    2. In the content region I have Nested Content Based structure which is using Media Pickers for Icons and Feature images etc... Lets say I am trying to access "Icon Media Picker" under "Site-1" then I should be able to see only the "Site-1" "Icon" folders images listed in the new dialog which generally opens for media picker and that has ability to upload image or select existing image. I also went through Hybrid Framework but wasn't able to achieve this scenario.

    Could you guys please help me out to figure out a solution or give me a walkthrough for this scenario.

    Thanks in Advance..

  • Ian 178 posts 752 karma points
    Jul 14, 2016 @ 19:18
    Ian
    100

    Hi this is part of the code for the mediapickercontroller

    if (!$scope.model.config.startNodeId) {
            userService.getCurrentUser().then(function (userData) {
                $scope.model.config.startNodeId = userData.startMediaId;
            });
        }
    

    the config.startNodeId gets passed through to the dialog where you choose the images. So can you not go into the users section of umbraco select the user and set their start node for the media library.

    Unless you explicitly set a start node when creating the datatype this node will be the initial entry point a user sees when wanting to add or upload media.

    Now this probably isn't perfect for you as i know you want to modularize your media assets and relate them to pickers.

    If you want to do everything and you really can't get the hybrid framework method to work and you are not using a dev version of umbraco which might allow you to use the method described by shannon here using the 'EditorModelEventManager.SendingContentModel' event

    Then you might have to create your own variant of the mediapicker property editor. I imagine that pretty much all the functionality could be wrapped by extending your editor from this class but using your own view path for a view which can use a slightly modified version of the core media picker controller replacing or extending the lines mentioned at the start of my post to call your own service for the startNodeId.

    If you have already invested time in the hybrid framework method it may still be worth looking at that again and post an example of which bit is failing and what the errors are.

    I'm guessing you saw the forum post

  • Arun P K 11 posts 72 karma points
    Jul 31, 2016 @ 02:27
    Arun P K
    0

    Thanks Ian, I will look into it once I get time. For the current project which I am working on is having tight deadline so will try this out once I get done with the project :).

    I will surely drop my feedback once I implement start node thing.

Please Sign in or register to post replies

Write your reply to:

Draft