|
|
Rank: Devotee
Joined: 7/22/2006 Posts: 69 Location: Heraklion Crete
|
Inspired by the V3 sort-nodes solution, I created this multiple media picker with preview and drag n drop sorting. It renders the thumbnail of any image from media gallery. If not an image, will render a folder, or -file icon- if it is a file. SCREENSHOT  Download version 0.1 at http://www.joyhost.gr/media/11314-lefmediapicker.0.1.zipIf you find any bugs, please alert them to me.
|
|
Rank: Enthusiast
Joined: 8/30/2007 Posts: 11
|
Installed and it works just fine and looks very nice, I am wondering is it possible to add upload Multiple Media (img, pdf or word) feature in the same way?
Thanks. John
|
|
Rank: Devotee
Joined: 7/22/2006 Posts: 69 Location: Heraklion Crete
|
I forgot to mention for the web.config setting you must make. For the webservice to work remotely ( when you deploy) add the following in system.web : Code: <webServices> <protocols> <add name="HttpPost"/> </protocols> </webServices>
John wrote: Installed and it works just fine and looks very nice, I am wondering is it possible to add upload Multiple Media (img, pdf or word) feature in the same way?
Thanks. John
No, I'm not planning for upload functionality.
|
|
Rank: Devotee
Joined: 7/22/2006 Posts: 69 Location: Heraklion Crete
|
Version 0.2 created. It now returns xml nodes You get values like $images/descendant::node Download at: http://www.joyhost.gr/media/11322-lefmediapicker.0.2.zipPlease test it.
|
|
Rank: Devotee
Joined: 6/4/2007 Posts: 42
|
Lefteris,
would you be willing to share the source code?
I'd just use it to learn from..
new @ umbraco
|
|
 Rank: Fanatic
Joined: 11/24/2006 Posts: 322 Location: Stockholm, Sweden
|
Seems like a great add-on! Could you provide an example showing how it's used in the XSLT-code? I can't seem to get it to display the images on the page? Thanks in advance! /Thomas
Web Developer at Kärnhuset - http://www.karnhuset.net - Stockholm, Sweden
|
|
 Rank: Fanatic
Joined: 11/24/2006 Posts: 322 Location: Stockholm, Sweden
|
Never mind - I figured it out. :) An example that displays all images selected using a picker called 'myImages': Code: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE xsl:Stylesheet [ <!ENTITY nbsp " "> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" exclude-result-prefixes="msxml umbraco.library">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:for-each select="umbraco.library:GetMedia($currentPage/data[@alias='myImages']/descendant::node,'false')"> <img> <xsl:attribute name="src"> <xsl:value-of select="data[@alias = 'umbracoFile']"/> </xsl:attribute> </img> </xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Works like a charm! I'm going to use it to add banners to my pages. Thanks for a cool add-on!
Web Developer at Kärnhuset - http://www.karnhuset.net - Stockholm, Sweden
|
|
 Rank: Fanatic
Joined: 11/24/2006 Posts: 322 Location: Stockholm, Sweden
|
...you might want to add a check to see if there are any images first, like this: Code: <xsl:if test="($currentPage/data[@alias='myImages']/descendant::node) != ''">
<!-- the stuff you want to do -->
</xsl:if>
Web Developer at Kärnhuset - http://www.karnhuset.net - Stockholm, Sweden
|
|
 Rank: Fanatic
Joined: 11/24/2006 Posts: 322 Location: Stockholm, Sweden
|
Thomas Kahn wrote: Works like a charm! I'm going to use it to add banners to my pages.
Thanks for a cool add-on!
I take this back. There is something wrong with my XSLT-code. I'm using the following XSLT to check if there are any images (or in this case banners) uploaded using the multiple media picker. If there are uploaded banners, I want to get them (loop through them) and print them on the page: Code: <xsl:if test="($currentPage/data[@alias='selectedBanners']/descendant::node) != ''">
<xsl:for-each select="$currentPage/data[@alias='selectedBanners']/descendant::node">
This yields the ID's of the banners. Then I need to get to the actual data, and this is where I fail. I'm trying the following syntax for displaying an image/banner: Code: <img> <xsl:attribute name="src"> <xsl:value-of select="umbraco.library:GetMedia(data[@alias = 'umbracoFile'],'false')"/> </xsl:attribute>
<xsl:attribute name="alt">Banner</xsl:attribute> </img>
This generates and XSLT error. If I try this: Code: <img> <xsl:attribute name="src">
<xsl:value-of select="data[@alias = 'umbracoFile']"/> </xsl:attribute>
<xsl:attribute name="alt">Banner</xsl:attribute> </img>
...I get an empty image-tag. Please help me out with this one!
Web Developer at Kärnhuset - http://www.karnhuset.net - Stockholm, Sweden
|
|
Rank: Devotee
Joined: 7/22/2006 Posts: 69 Location: Heraklion Crete
|
Thomas, here is an example Code: <xsl:if test="($currentPage/data[@alias='selectedBanners']/descendant::node!='')"> <xsl:variable name="images" select="$currentPage/data[@alias='selectedBanners']"/> <xsl:for-each select="$images/descendant::node"> <xsl:value-of select="umbraco.library:GetMedia(.,0)/data[@alias='umbracoFile']"/> </xsl:for-each> </xsl:if>
|
|
 Rank: Fanatic
Joined: 11/24/2006 Posts: 322 Location: Stockholm, Sweden
|
Thanks! That did the trick! I guess it was the amount of 'layers' involed when accessing the actual data that confused me (get the page, find the control, find the objects in the control and access the paramters of the objects). I'm still having some trouble with the preview function of the control in the admin. When I open up an admin-page that contains the control, the images in the control are not visible. Only if I save the page or upload a new image to the control, the previews become visible. Empty preview area Preview area after save or upload Does anyone have a solution to this problem? I think it's important that the user can see which images are uploaded in the control. Of course there is the "Check Values"-button, but since it only displays ID-numbers and not the actual images, it's not very user-friendly.
Web Developer at Kärnhuset - http://www.karnhuset.net - Stockholm, Sweden
|
|
Rank: Devotee
Joined: 7/22/2006 Posts: 69 Location: Heraklion Crete
|
That is strange. Let me see if it is a bug.
|
|
 Rank: Fanatic
Joined: 11/24/2006 Posts: 322 Location: Stockholm, Sweden
|
That would be great! :thumbup: Let me know if there is anything else you need to know in order to look into the problem. I'm running Umbraco 3.0.2 on a Windows 2003 Server. /Thomas
Web Developer at Kärnhuset - http://www.karnhuset.net - Stockholm, Sweden
|
|
Rank: Devotee
Joined: 7/22/2006 Posts: 69 Location: Heraklion Crete
|
Version 0.3 is out. lefMediaGallery had problems when not inserted in the first Tab of a node. That was caused because the inactive tabs have display:none style property. Fixed by injecting javascript click handlers on inactive tabs, to render the Ext Grid. Download Version 0.3 at http://www.joyhost.gr/media/11325-lefmediapicker.0.3.zipPlease report any suggenstions or bugs.
|
|
 Rank: Fanatic
Joined: 11/24/2006 Posts: 322 Location: Stockholm, Sweden
|
Works for me! Thank you for sharing this very useful control! :) /Thomas
Web Developer at Kärnhuset - http://www.karnhuset.net - Stockholm, Sweden
|
|
 Rank: Enthusiast
Joined: 8/23/2007 Posts: 18
|
Hi, When I publish a page with the lefMediaPickerData using the main page publish button it works fine. However, if I right-click a parent node and choose 'publish' from the context menu I receive the following error message in the logs. Code: At /umbraco/dialogs/publish.aspx?id=1203 (Refered by: http://biggartbaillie/umbraco/dialogs/publish.aspx?id=1203): System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'. at lefMediaPicker.lefMediaPickerData.ToXMl(XmlDocument xd) at umbraco.cms.businesslogic.property.Property.ToXml(XmlDocument xd) at umbraco.cms.businesslogic.web.Document.XmlPopulate(XmlDocument xd, XmlNode& x, Boolean Deep) at umbraco.cms.businesslogic.web.Document.XmlGenerate(XmlDocument xd) at umbraco.cms.businesslogic.web.Document.Publish(User u) at umbraco.dialogs.publish.doPublishSubs(Document d) at umbraco.dialogs.publish.Page_Load(Object sender, EventArgs e) at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at umbraco.BasePages.BasePage.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Would it be possible to fix this error, or release the source code and I'll have a look at fixing it myself? Thanks, Chris
|
|
Rank: Devotee
Joined: 7/22/2006 Posts: 69 Location: Heraklion Crete
|
Bug fixed. Version 0.4 is available at http://www.joyhost.gr/media/11328-lefmediapicker.0.4.zipLet me know if you have oher issues. Lefteris
|
|
 Rank: Enthusiast
Joined: 8/23/2007 Posts: 18
|
Lefteris,
Works a treat!
Thanks for the quick response, I'm always impressed with the speed and activity in these forums!
Chris
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 649 Location: Preston, UK
|
Lefteris,
Probably dumb question, but does the datatype work with non images ie pdf / word etc in media directories?
Regards
Ismail
Level 2 certified. If it aint broke dont fix.
|
|
 Rank: Addict
Joined: 7/19/2006 Posts: 649 Location: Preston, UK
|
Duh,
Should have read the first line of first post.:blush: Many thanks for excellent datatype im going to get going with it! :thumbup:
Regards
Ismail
Level 2 certified. If it aint broke dont fix.
|
|
|
Guest |