Hi All, I just upgraded one of our larger intranets to 4.5.2 and have found that the MEdia Picker with Preview doesn't work? It allows me to click the "Choose..." link and popup the tree, but when I click a media node in the tree nothing happens (it doesn't select anything)? I tried changing the data type to the standard media picker but then that wipes out all of my data for the fields. Has anyone successfully worked around this issue?
I'm not 100% (having not done it myself), but isn't Type.registerNamespace part of the MS Ajax toolkit? which I'm pretty sure the latest Umbraco doesn't have a dependency on, so look to me like something may not have been updated correctly.
This is just my educated guess though, so could be wrong =)
Hey Matt, thanks for chiming in. The error is occurring in the DependencyHandler.axd line 205. I have the Ajax Toolkit in the bin still since contour needs that as far as I know. What about updating the data type manually? This issue would go away if I was able to change the data type associated with this property. I'm guessing I have to put on my SQL hat for that... :)
It's not a Contour issue really, this happens in the content section when editing a page with the Media Picker w/ Preview data type. This package is not listed as compatible with 4.5.2 which I should surely have checked before upgrading (DOH!). So, in light of the issue I think the best approach is to revert back to the standard out-of-the-box media picker. Unless, of course, there's an update for the package floating around out there.
If the advanced media picker saves the value as the same datatype as the regular media picker, you might be able to use the SQL statement out of my doc type extensions package for switching over data types:
UPDATE cmsPropertyData
SET propertytypeid = {2}
WHERE id in (
SELECT pd.id
FROM cmsPropertyData as pd
inner join umbracoNode as n on n.id = pd.contentNodeId
inner join cmsContent as c on c.nodeId = n.id
WHERE n.nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972' and
c.contentType = {0} and
pd.propertytypeid = {1}
)
Where {0} is your doc type id, {1} is the property id, and {2} is the target property type id
Wow, this one is gonna suck. Unfortunetly, I won't be able to do what you are suggeting Matt. The [SQL] data types are different between the two custom types (one text and one int). So, I have to switch the data type for the content type in question, then go through the DB and move the value from dataNtext to dataInt in the cmsPropertyData column for ALL of the nodes. I'll have to write a stored proc or somethign to do this as we're talking about hundreds of nodes.
UPDATE cmsPropertyData SET propertytypeid = {2}, dataInt = CAST(cmsPropertyData.dataNtext AS INT) WHERE id in ( SELECT pd.id FROM cmsPropertyData as pd inner join umbracoNode as n on n.id = pd.contentNodeId inner join cmsContent as c on c.nodeId = n.id WHERE n.nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972' and c.contentType = {0} and pd.propertytypeid = {1} )
Ok, so here it is. PROCEED WITH CAUTION AND BACKUP FIRST!
Update the data type for the property to media picker
'Copy' over the values from the dataNtext field to the dataInt field for the given propertyTypeId
update cmsPropertyData set dataInt=CAST(CONVERT(varchar(20),dataNtext) AS INT) where propertyTypeId={0}
NOTE: You have to convert the Ntext to varchar before you can cast it as an Int.
Clear the dataNtext value for the given propertyTypeId
update cmsPropertyData set dataNtext=null where propertyTypeId={0}
Now we have to update ALL the versions of the page to hold the correct value in the dataInt field. This is hacky at best so be careful when running your query as it may update versions that you didn't want to touch. This is the only way I found the current version to be updated. If you have a mechanism to find the current version and ONLY update that, that would be ideal.
WITH contentNodeIds
AS
(
SELECT DISTINCT(contentNodeId) as cNodeId,dataInt as cDataInt FROM cmsPropertyData WHERE propertyTypeId={0} and dataInt is not null
) UPDATE cmsPropertyData SET dataInt=cDataInt FROM contentNodeIds where contentNodeId=contentNodeIds.cNodeId
Just realized the version issue in one of my installations. Nik, did you do your upgrading directly in query editor in the Sql Server Management Studio?
And does your instruction imply that when you change the data type property from media picker with preview to old fashion media picker, then the value of then Ntext data type is somehow retained and can be copied over? Is this because the change is applied with a new version generated? I ask because I truely don't know :-)
It seems more secure to add a common media picker property and manually copy the media urls from old to new property, but of course that's a lot of work.
Any of you know if the preview picker will be adapted to v. 4.5.2?
Hi Siw, it's a little more complicated than just switching the data type. As you can see, the columns for the Ntext and integer are stored in two separate columns. This means that you will have to migrate the value for the given propertyId by following the steps in my post above. I made these changes using SQL Management Studio. Let me know if you have any particular questions about the scripts, and again, be careful when making these database changes manually.
Media Picker w/ Preview after upgrade
Hi All, I just upgraded one of our larger intranets to 4.5.2 and have found that the MEdia Picker with Preview doesn't work? It allows me to click the "Choose..." link and popup the tree, but when I click a media node in the tree nothing happens (it doesn't select anything)? I tried changing the data type to the standard media picker but then that wipes out all of my data for the fields. Has anyone successfully worked around this issue?
Thanks for your help!
-- Nik
To add onto this...here's the FireBug error I get when the right-hand pane is first loaded:
No error when trying to select the media.
I'm not 100% (having not done it myself), but isn't Type.registerNamespace part of the MS Ajax toolkit? which I'm pretty sure the latest Umbraco doesn't have a dependency on, so look to me like something may not have been updated correctly.
This is just my educated guess though, so could be wrong =)
Matt
Hey Matt, thanks for chiming in. The error is occurring in the DependencyHandler.axd line 205. I have the Ajax Toolkit in the bin still since contour needs that as far as I know. What about updating the data type manually? This issue would go away if I was able to change the data type associated with this property. I'm guessing I have to put on my SQL hat for that... :)
Cheers!
Hey Nik,
Is this a Contour thing? As, isn't the advanced media picker, just a checkbox in the prevalues for the regular media picker?
Matt
It's not a Contour issue really, this happens in the content section when editing a page with the Media Picker w/ Preview data type. This package is not listed as compatible with 4.5.2 which I should surely have checked before upgrading (DOH!). So, in light of the issue I think the best approach is to revert back to the standard out-of-the-box media picker. Unless, of course, there's an update for the package floating around out there.
-- Nik
Ahhhhh, I see.
If the advanced media picker saves the value as the same datatype as the regular media picker, you might be able to use the SQL statement out of my doc type extensions package for switching over data types:
UPDATE cmsPropertyData SET propertytypeid = {2} WHERE id in ( SELECT pd.id FROM cmsPropertyData as pd inner join umbracoNode as n on n.id = pd.contentNodeId inner join cmsContent as c on c.nodeId = n.id WHERE n.nodeObjectType = 'C66BA18E-EAF3-4CFF-8A22-41B16D66A972' and c.contentType = {0} and pd.propertytypeid = {1} )
Where {0} is your doc type id, {1} is the property id, and {2} is the target property type id
Don't forget to backup beforhand ;)
Matt
right-on Matt! I knew you'd have something up your sleeve :) I'll give that a try.
-- Nik
Wow, this one is gonna suck. Unfortunetly, I won't be able to do what you are suggeting Matt. The [SQL] data types are different between the two custom types (one text and one int). So, I have to switch the data type for the content type in question, then go through the DB and move the value from dataNtext to dataInt in the cmsPropertyData column for ALL of the nodes. I'll have to write a stored proc or somethign to do this as we're talking about hundreds of nodes.
Oy!
-- Nik
Hey Nik.
Are you needing to convert from text to int, or int to text? I'm pretty sure it could all be 1 statement.
Matt
Hey Matt, from text to int. And I think you're right, one update should do it with the correct sub-selects....
Will this work?:
Matt
Ok, so here it is. PROCEED WITH CAUTION AND BACKUP FIRST!
Hehe, nice work =)
Glad you got it working.
Matt
Just realized the version issue in one of my installations. Nik, did you do your upgrading directly in query editor in the Sql Server Management Studio?
And does your instruction imply that when you change the data type property from media picker with preview to old fashion media picker, then the value of then Ntext data type is somehow retained and can be copied over? Is this because the change is applied with a new version generated? I ask because I truely don't know :-)
It seems more secure to add a common media picker property and manually copy the media urls from old to new property, but of course that's a lot of work.
Any of you know if the preview picker will be adapted to v. 4.5.2?
Hi Siw, it's a little more complicated than just switching the data type. As you can see, the columns for the Ntext and integer are stored in two separate columns. This means that you will have to migrate the value for the given propertyId by following the steps in my post above. I made these changes using SQL Management Studio. Let me know if you have any particular questions about the scripts, and again, be careful when making these database changes manually.
Cheers,
Nik
is working on a reply...