1

Closed

1.7 RC users should be warned that migrating mediapickerfield could break UI

description

Just look at the effect on a site using Nwazet.commerce...
May be the warning should ask them to wait validation from the authors of modules and themes they are using.
DB Backup should be a must have requirement
Closed Oct 29, 2013 at 9:30 PM by sebastienros

comments

jao28 wrote Jul 17, 2013 at 5:58 PM

I realize this is a horrible thing to do (so others can say so in the comments if they care to), but I have multiple clients and can't have their site's breaking when I do the initial crossover. I see warning's as being a great idea and would agree that having them is important. The best thing I have come up with is the "backwards supporting of old media picker field images while at the same time giving me time to fix View Overrides which are causing me issues". To this end, I have made the following (I believe temporary though it could stay permanently) code change:

File: Orchard.MediaLibrary.Fields.MediaLibraryPickerField
Add:
// Adding this in to support the transition FROM MediaPickerField.Url 
        #region Remove after all modules / view overrides are updated from MediaPickerField
        public string Url {
            get {
                string url = "";
                var mediaPart = MediaParts.FirstOrDefault();
                if (mediaPart != null) {
                    url = mediaPart.MediaUrl;
                }
                return url;
            }
        }
        public string AlternateText {
            get {
                string alternateText = "";
                var mediaPart = MediaParts.FirstOrDefault();
                if (mediaPart != null) {
                    alternateText = mediaPart.AlternateText;
                }
                return alternateText;
            }
        }
        public string Class {
            get {
                string classValue = "";
                // Nothing to map to
                return classValue;                
            }
        }
        public string Style {
            get {
                string style = "";
                // Nothing to map to
                return style;
            }
        }
        public string Alignment {
            get {
                string alignment = "";
                // Nothing to map to
                return alignment;
            }
        }
        public int Width {
            get {
                int width = 0;
                // Nothing to map to
                return width;
            }
        }
        public int Height {
            get {
                int height = 0;
                // Nothing to map to
                return height;
            }
        }
        #endregion
This works for me because my view overrides use "dynamic" retrieval of fields as such:
        var mediaPickerField = ((dynamic)feature.ContentItem).Features.TermIcon;
        featureImageUrl = mediaPickerField.Url;
This allows my view overrides to keep functioning as I have mapped the first image of the Media Library Picker Field over to the old "calls" from the Media Picker Field. Even though the rendering may not look exactly like I desire, it is far better than a crashed page.

CSADNT wrote Jul 17, 2013 at 6:30 PM

I have not gone further than pressing the migrate button and looking at the results... as the part has changed none of the custom templates is called I get the default template for medialibpicker, which is breaking everything.....

As we are used to say in France: "J'attends les chars et les americains', which means I will wait the move from Bertrand.

I suppose this could be the occasion for an heavy lifting on Nwazet.Commerce and may take some time.
Si I will not press the button.

But I suppose some other modules are using the MediapIckerField....

BertrandLeRoy wrote Jul 17, 2013 at 11:36 PM

FWIW, and not entirely related, but Christian asked, I have Nwazet.Commerce running on 1.7 on my dev machine.

jao28 wrote Jul 18, 2013 at 12:34 AM

Also off topic, I looked through my version of Nwazet.Commerce (yeah, yeah, I need to merge) and the Media Picker field shows up in three files:
  • BundleMigrations.cs
  • ShoppingCartController.cs
  • HistoryController.cs
  • CommerceMigrations
They don't seem to be breaking anything on my dev machine (yet). If you can spin off a separate thread on Nwazet.Commerce and share the link, would like to hear if anything is breaking (and what version of Nwazet.Commerce you are using, Bertrands - i.e. the core, or my version with PayPal integrated).

BertrandLeRoy wrote Jul 18, 2013 at 6:11 AM

Please file a bug against Nwazet.Commerce: https://bitbucket.org/bleroy/nwazet.commerce/issues/new