Copied to clipboard

Flag this post as spam?

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


  • Daniel Bardi 927 posts 2562 karma points
    Aug 10, 2010 @ 12:06
    Daniel Bardi
    0

    Breaks Media Picker - 4.5.1 in IE

    This broke the media picker in IE.  It's reproducable.

    You get a javascript error because it places a script path in the MediaPicker.aspx dialog page.

    You should check the IsDialog property and not add the reference when true.

    Thanks!

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Aug 10, 2010 @ 12:09
    Matt Brailsford
    0

    Hey Daniel,

    You sure you got the right forum? Doc Type Extensions is breaking the Media Picker?

    Matt

  • Daniel Bardi 927 posts 2562 karma points
    Aug 10, 2010 @ 12:12
    Daniel Bardi
    0

    Yup... verified in 4.5.1.. you can test it.. works in all other browsers.. just breaks media picker in IE 8.

    I just tested it again to be sure I wasn't going nuts

    1. I verified that media picker was working
    2. Downloaded lastest package and installed
    3. Verified media picker was now broken (IE 8 only)
    4. Uninstalled and verified media picker was working again.

     

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Aug 10, 2010 @ 12:48
    Matt Brailsford
    0

    What the heck? How is that even possible? I'm only injecting buttons into an existing menu for the nodeTypes tree via an event handler.

    It does indeed insert the script path into the page, but why it would do that, I've no idea, it's also not honoring how JsSource actually works, so I'm thinking there is some other bug in Umbraco somewhere.

    I'll look into it for you though.

    Matt

     

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Aug 10, 2010 @ 16:10
    Matt Brailsford
    0

    Ok,

    I may have found the problem area, but still not sure why it's like this.

    So, the mediaPicker uses umbraco/dialogs/treePicker.aspx, which in turn uses the umbraco/controls/tree/TreeControl.ascx user control. Now in the user controls prerender it does the following:

    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
        if (!this.m_IsInit)
        {
            this.Initialize();
        }
        this.RenderTreeJS();
        this.RenderActionJS();
        if (this.Width != Unit.Empty)
        {
            this.TreeContainer.Style.Add(HtmlTextWriterStyle.Width, this.Width.ToString());
        }
        if (this.Height != Unit.Empty)
        {
            this.TreeContainer.Style.Add(HtmlTextWriterStyle.Height, this.Height.ToString());
        }
        if (this.BackColor != Color.Empty)
        {
            this.TreeContainer.Style.Add(HtmlTextWriterStyle.BackgroundColor, ColorTranslator.ToHtml(this.BackColor));
        }
        if (this.CssClass != "")
        {
            this.TreeContainer.Attributes.Add("class", this.CssClass);
        }
        else
        {
            this.TreeContainer.Attributes.Add("class", "treeContainer");
        }
        this.DataBind();
    }

    As the problem is being caused by the insertion of my actions JsSource attribute, the next best place to look at is the RenderActionJS, which is as follows:

    private void RenderActionJS()
    {
        foreach (IAction action in Action.GetAll())
        {
            try
            {
                if (!(string.IsNullOrEmpty(action.Alias) || string.IsNullOrEmpty(action.JsSource)))
                {
                    this.Page.ClientScript.RegisterClientScriptBlock(action.GetType(), action.Alias, action.JsSource, true);
                }
            }
            catch (Exception exception)
            {
                Log.Add(LogTypes.Error, -1, "Error initializing tree action: " + exception.ToString());
            }
        }
    }

    Now for me, there are 2 things wrong with this method.

    1) It's looping through ALL actions, regardless of whether it is relevant to the Media app

    2) It is registering JsSourrce (which in 4.5 should now be a path to a js file) as a script block, which means it is just writing the path out causing the error.

    As I say, I'm not sure why it's like this, but it certainly seems like it's an Umbraco bug, rather than an issue with Doc Type Extensions. I think it's more the fact that Doc Type Extensions is one of the first packages which adds a custom menu to be upgraded to work with 4.5 that it was noticed on this package.

    Anyway, I'm going to post a bug, and will report back afterwards.

    Matt

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Aug 10, 2010 @ 16:15
    Matt Brailsford
    0

    Ok, here is the umbraco issue if you'd like to vote it up

    http://umbraco.codeplex.com/workitem/28505

    Matt

  • Lee 1130 posts 3088 karma points
    Aug 19, 2010 @ 12:18
    Lee
    0

    This actually breaks it in Chrome & FF too... :(

    You can still use it though, just install move everything around then uninstall and everything works again :)

Please Sign in or register to post replies

Write your reply to:

Draft