Copied to clipboard

Flag this post as spam?

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


  • Gordon Saxby 1461 posts 1883 karma points
    Oct 27, 2016 @ 11:28
    Gordon Saxby
    0

    Custom workflow media picker

    I am creating a custom workflow for Forms v4.3.2

    I want to have a Media Picker but am not sure if that is possible and if so, how to define it.

    This is how to create a "Content" picker:

        [Umbraco.Forms.Core.Attributes.Setting("Email Template", description = "Email template to use", view = "Pickers.Content")]
        public string EmailTemplate { get; set; }
    

    But changing "Pickers.Content" to "Pickers.Media" does not work.

    The "Send xslt transformed email" workflow has a media picker for the XSLT file, but I can't see how that is done.

  • Comment author was deleted

    Oct 27, 2016 @ 12:00

    Try view = "File"

  • Gordon Saxby 1461 posts 1883 karma points
    Oct 27, 2016 @ 12:03
    Gordon Saxby
    0

    Haha!! Yes, that works! Why on earth is it "File" rather than "Media"?

  • Comment author was deleted

    Oct 27, 2016 @ 12:05

    THink since it stores a path to a file rather then a media id

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Oct 27, 2016 @ 12:04
    Warren Buckley
    0

    BAM exactly what Tim said Gordan the view for this needs to be File

    The default settings/editors we ship can be found at App_Plugins\UmbracoForms\Backoffice\Common\SettingTypes

    However it is possible to build your own custom Angular settings views and specify a path in the C# Workflow provider.

    Such as ~/App_Plugins/MyOwnCustomPath/AngularSettingView.html

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Oct 27, 2016 @ 12:06
    Warren Buckley
    0

    It's a File Uploader rather than a media picker.

    We could do with ideally a new one to be honest Gordan. As this file one is not a great workflow in my opinion. You upload an XSLT file to put in th media section and then afterwards you then have to pick it from the media section.

  • Gordon Saxby 1461 posts 1883 karma points
    Oct 27, 2016 @ 12:13
    Gordon Saxby
    0

    "File" is working OK for this particular case ... it's just that it isn't very well named (or easy to find out about).

    Could I create my own "File" picker which had a pre-defined (configurable?) start location within the media library?

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Oct 27, 2016 @ 12:17
    Warren Buckley
    0

    Yes you could, but you will need to create a custom Angular view and associated controller to call any Umbraco associated Angular API calls or if really needed call your own UmbracoAPIAuthorisedController to lookup the current logged in user's media start node.

    But for that example I think it's available as a global JS object in the main Umbraco.Sys when logged into the backoffice. Try experimenting in browser devtools console when logged in, to see useful bits in this object.

    Umbraco.Sys.ServerVariables.security.startMediaId contains the current logged in user Start Media Node ID

  • Comment author was deleted

    Oct 27, 2016 @ 12:09

    Could be good to add all the default ones to a Constants class so you could do

    UmbracoForms.Contants.FieldSettingTypes.File (instead of having to guess the correct name)

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Oct 27, 2016 @ 12:12
    Warren Buckley
    0

    Agree. Can you add it Tim to the issue tracker please :)

  • Comment author was deleted

    Oct 27, 2016 @ 12:15

    Done :)

  • Comment author was deleted

    Oct 27, 2016 @ 12:15
  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Oct 27, 2016 @ 12:23
    Warren Buckley
    0

    Thanks Tim ❤️

Please Sign in or register to post replies

Write your reply to:

Draft