ASPX templates
Version 6.x > ASPX templates > Repeater/viewer for folders View modes: 
User avatar
Member
Member
Snarrak - 10/14/2011 6:11:11 AM
   
Repeater/viewer for folders
Hi,

Im working by ASPX-templates and need a repeater that displays the folders, that are made in the CMSDesk?

Like this:
User image

To display the images beneath this folders, is the next step when I click one of these folders.

Anyone who can help me with this?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/15/2011 9:05:20 AM
   
RE:Repeater/viewer for folders
Hi,

you can display folders the same way as other documents. The code may look like:


<%@ Register Src="~/CMSWebParts/Viewers/Documents/cmsrepeater.ascx" TagName="repeater" TagPrefix="uc1" %>

<uc1:repeater runat="server" ID="repeater" Path="/%" ClassNames="cms.folder"
TransformationName="cms.folder.default"
EnablePaging="True" PagingMode="querystring"
PagerPosition="bottom" PageSize="2" ResultsPosition="top" Visible="true" EnableViewState="false" />


The transformation with a code name cms.folder.default you can create in the Site Manager - Development - Document types - cms.folder - Transformations. For example:

<%#Eval ("NodeName")%> <br />
<%#Eval ("NodeAliasPath")%> <br />


Using these values you should be able to generate a link to appropriate folder.

As for the second step. You can insect for example another repeater web part to the template of folder document and it will list the content of selected document.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
Snarrak - 10/21/2011 5:20:31 AM
   
RE:Repeater/viewer for folders
Thanks. I have this working now.

I'm trying to add a link to the transformation. So you can click on the folder, that opens a new page with the files inside that folder.

Do you have any idea how I can make this dynamically?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/24/2011 8:40:52 AM
   
RE:Repeater/viewer for folders
Hi,

you can use GetDocumentUrl() method to generate link automatically. Here is an example:

<a href="<%# GetDocumentUrl() %>"> <%# Eval("NodeName") %></a>

Best regards,
Ivana Tomanickova

User avatar
Member
Member
Snarrak - 10/25/2011 7:03:58 AM
   
RE:Repeater/viewer for folders
This works perfectly, accept the link opens an aspx page. But this page is a folder, so it should open something with the items (images) inside this folder.

This could be something like:
- opening a lightbox
- show a div with the images in the selected folder as thumbnails.
- or just show the images in the content area.

From the folder I call a Javascript function, like this:
<image src="/60_ASPX_final/getmedia/2c7ec23b-9cc9-4e73-8657-8e18ea41abc2/folderTest.aspx" 
width="50" height="50" onclick="javascript:testfolder('<%#Eval ("NodeName")%>')"/>


I set the parameter dynamically, and this works, tested the parameter in an alert.
In the javascript function, I open a div with a CMSRepeater. This works fine and the images are shown. But I'm not sure if I can change the Path-property of the CMSRepeater with javascript....


User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/26/2011 7:35:12 AM
   
RE:Repeater/viewer for folders
Hi,

you can create a template with a media library (or a repeater) web part and assign it to the folder document in Properties - Templates tab. Then if user clicks on the folder document, he could see images.

Best regards,
Ivana Tomanickova

User avatar
Member
Member
Snarrak - 10/27/2011 9:22:12 AM
   
RE:Repeater/viewer for folders
Hi Ivana,

Now I have a media gallery webpart. I'm using it with the folder tree shown, so when I click on this folder, the images inside are shown. But i don't want a postback...
So I thought use the property UseUpdatePanel, and set this to true. But than it doesn't work anymore.
Any idea?

Webpart looks like this:

<wp:MediaGallery ID="_mediaGallery" runat="server"
CurrentPageTemplate="CMS.PagerTransformations.General-CurrentPage"
DisplayActiveContent="true"
DisplayFileCount="true"
DisplayFirstLastAutomatically="true"
DisplayPreviousNextAutomatically="true"
FileIDQueryStringKey="fileid"
FilterMethod="0"
FirstPageTemplate="CMS.PagerTransformations.General-FirstPage"
GroupSize="2"
HideFolderTree="false"
HidePagerForSinglePage="true"
LastPageTemplate="CMS.PagerTransformations.General-LastPage"
LayoutTemplate="CMS.PagerTransformations.General-PagerLayout"
MediaLibraryName="Ceco"
MediaLibraryPath="/Albums"
NextGroupTemplate="CMS.PagerTransformations.General-NextGroup"
NextPageTemplate="CMS.PagerTransformations.General-NextPage" PageSize="9"
PagesTemplate="CMS.PagerTransformations.General-Pages"
PathQueryStringKey="path"
PreviousGroupTemplate="CMS.PagerTransformations.General-PreviousGroup"
PreviousPageTemplate="CMS.PagerTransformations.General-PreviousPage" SelectedItemTransformation="Community.Transformations.MediaLibrarySelectedItem"
SeparatorTemplate="CMS.PagerTransformations.General-PageSeparator" SeparatorTransformation="Community.Transformations.MediaLibraryItemSeparator"
ShowSubfoldersContent="true" SortQueryStringKey="sort"
TransformationName="Community.Transformations.AM_MediaLibrary"
UseSecureLinks="true"
/>

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 11/7/2011 6:10:59 AM
   
RE:Repeater/viewer for folders
Hi,

I could not reproduce the issue. I tested behavior with the code:


<%@ Register Src="~/CMSWebParts/MediaLibrary/MediaGallery.ascx" TagName="MediaGallery" TagPrefix="uc1" %>

<uc1:MediaGallery
ID="cntMediaGallery" runat="server"
MediaLibraryName="CzechCities"
HideFolderTree="true"
TransformationName="Community.Transformations.MediaLibrary"
SelectedItemTransformation="Community.Transformations.MediaLibrarySelectedItem"
SeparatorTransformation="Community.Transformations.MediaLibraryItemSeparator"
HeaderTransformation="Community.Transformations.MediaLibraryHeader" FooterTransformation="Community.Transformations.MediaLibraryFooter"
FilterMethod="0"
FileIDQueryStringKey="fileid"
PathQueryStringKey="path"
SortQueryStringKey="sort"
EnableViewState="false"
UseUpdatePanel="true"/>



You said that you are using it with the folder tree shown, in this case there is a web part MediaGalleryFileList which can be used with a MediaGalleryFolderTree web part. Isn't it the web part you need?


<%@ Register Src="~/CMSWebParts/MediaLibrary/MediaGalleryFileList.ascx" TagName="MediaGalleryFileList"
TagPrefix="uc1" %>
<%@ Register Src="~/CMSWebParts/MediaLibrary/MediaGalleryFolderTree.ascx" TagName="MediaGalleryFolderTree"
TagPrefix="uc1" %>

<uc1:MediaGalleryFolderTree
ID="cntMediaGalleryTree" runat="server"
FilterName="cntMediaGalleryFilter"
FilterMethod="0"
FileIDQueryStringKey="fileid"
PathQueryStringKey="path"
MediaLibraryName="czechcities" />

<uc1:MediaGalleryFileList
ID="cntMediaGalleryList" runat="server"
DataSourceName="cntMediaFileDataSource"
MediaLibraryName="czechcities" TransformationName="Community.Transformations.MediaLibrary"
SelectedItemTransformationName="Community.Transformations.MediaLibrarySelectedItem"
SeparatorTransformationName="Community.Transformations.MediaLibraryItemSeparator"
HeaderTransformationName="Community.Transformations.MediaLibraryHeader" FooterTransformationName="Community.Transformations.MediaLibraryFooter"
FileIDQueryStringKey="fileid"
EnableViewState="false"
UseUpdatePanel="true" />


Best regards,
Ivana Tomanickova

User avatar
Member
Member
Snarrak - 11/14/2011 3:41:07 AM
   
RE:Repeater/viewer for folders
Hi Ivana,

I tried your code, but can't seem to get it working.
Two questions:
- How is the MediaGalleryFileList connected to the FolderTree? Because you use a DataSourceName, 'cntMediaFileDataSource', that I can't see.
- If I want to use the updatepanel, do I need (as normally in ASP.NET) an updatepanel and a contentTemplate where I can put my controls in?

Thanks in advance

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 11/21/2011 3:42:57 AM
   
RE:Repeater/viewer for folders
Hi,

here is the code of missing data source, but I realized that you need something else. Following example works with a media library, not with images under specific folder.


<%@ Register Src="~/CMSWebParts/MediaLibrary/MediaFileDataSource.ascx" TagName="MediaFileDataSource" TagPrefix="uc1" %>

<%@ Register Src="~/CMSWebParts/MediaLibrary/MediaGalleryFilter.ascx" TagName="MediaGalleryFilter"
TagPrefix="uc1" %>


<uc1:MediaFileDataSource
ID="cntMediaFileDataSource"
runat="server"
LibraryName="czechcities"
FilterName="cntMediaGalleryTree"
FileIDQueryStringKey="fileid"
EnableViewState="false" />

<uc1:MediaGalleryFilter
ID="cntMediaGalleryFilter"
runat="server"
FilterMethod="0"
FileIDQueryStringKey="fileid"
SortQueryStringKey="sort"
EnableViewState="false" />


Actually, you have a folder and images under this folder and you would like to display them in case user click on the folder.

In this case you can use following web part:


<%@ Register Src="~/CMSWebParts/Viewers/Effects/lightbox.ascx" TagName="lightbox" TagPrefix="uc1" %>

<uc1:lightbox runat="server" ID="LightboxImageGallery" ClassNames="CMS.File" TransformationName="CMS.File.lightbox"
SelectedItemTransformationName="CMS.File.imagegallery_detail800" EnablePaging="True"
PagingMode="querystring" PagerPosition="bottom" PageSize="12" LightBoxOverlayOpacity="0.7" EnableViewState="false" UseUpdatePanel = "true" />


This web part has a property UseUpdatePanel so you do not need to insert the standard one.

The whole example you can see if you install a default Corporate site ASPX. The example is in the section Images -> USA.

The template which is used you can find here:
~/CMSTemplates/CorporateSiteASPX/Images/LightBoxGallery.aspx


In the Images folder you can find two other ways how to display images inserted under some folder.

Best regards,
Ivana Tomanickova