+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Document List File Naming Issue

Document List File Naming Issue

8 posts, 0 answered
  1. Tony
    Tony avatar
    57 posts
    Registered:
    04 Dec 2013
    08 Jan 2014
    Link to this post
    The Download List displays exactly what the file name is in your library document folder.
    I want the webpage link to say "View Manual" but I still want to keep the pdf file name to say...Charbroiler XYZ.
    I had to change the names of all the files to get the webpage to say View Manual and that is not right for file management in the back end.
    There must be a better way to handle this.
  2. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    02 Dec 2016
    13 Jan 2014
    Link to this post
    Hi Tony,

    You can change the link's title to display "View Manual" or any other text programmatically. Please note that this will not change the document's title. If you are using the "List" option to display your Download list of items you can create a .cs file inheriting the MasterListView class and use the following code sample:

    public class CustomMasterListView : MasterListView
        {
            public override void DataBindDocumentList()
            {
                if (base.Query != null || this.DataSource != null)
                {
                    if (this.TotalCount == 0)
                    {
                        this.ItemsContainer.Visible = false;
                        this.DocumentsRepeater.Visible = false;
                    }
                    else
                    {
                        this.DocumentsRepeater.ItemDataBound += new RepeaterItemEventHandler(DocumentsRepeater_ItemDataBound1);
                        if (this.DataSource == null)
                        {
                            this.DocumentsRepeater.DataSource = base.Query.ToList();
                        }
                        else
                        {
                            this.DocumentsRepeater.DataSource = this.DataSource;
                        }
                        this.DocumentsRepeater.DataBind();
     
                        if (this.ItemsContainer != null)
                        {
                            if (base.ThumbnailType == ThumbnailType.SmallIcons)
                                this.ItemsContainer.Attributes["class"] += " sfSmallIcns";
                            else if (base.ThumbnailType == ThumbnailType.BigIcons)
                                this.ItemsContainer.Attributes["class"] += " sfLargeIcns";
                        }
                    }
                }
            }
     
            void DocumentsRepeater_ItemDataBound1(object sender, RepeaterItemEventArgs e)
            {
                if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
                {
                    var dataItem = e.Item.DataItem;
                    var document = (Document)dataItem;
     
                    if (document != null)
                    {
                        var ext = document.Extension;
                        if (ext.Length > 0)
                            ext = ext.Remove(0, 1);
                        var documentLink = e.Item.FindControl("documentLink") as HyperLink;
                        if (documentLink != null)
                        {
                            documentLink.Text = "View Manual"; // you can put your required title here ...
                            documentLink.ToolTip = document.Description;
                            documentLink.NavigateUrl = document.MediaUrl;
                        }
     
                        var documentInfoLabel = e.Item.FindControl("infoLabel") as SitefinityLabel;
                        if (documentInfoLabel != null)
                        {
                            documentInfoLabel.Text = string.Format("{0}, {1}", ext.ToUpperInvariant(), base.ConfigureBytes(document.TotalSize));
                        }
     
                        var rowitem = e.Item.FindControl("docItem") as HtmlGenericControl;
                        if (rowitem != null)
                        {
                            rowitem.Attributes["class"] += " sf" + ext.ToLower();
                        }
                    }
                }
            }
        }

    Then please go to Administration -> Settings -> Advanced -> Libraries -> Controls -> FrontendDocuments -> Views -> MasterListView and find the ViewType property and set it to use your CustomMasterListView file when displaying the Download list items.

    Regards,
    Sabrie Nedzhip
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    14 Jan 2014
    Link to this post
    Dear Tony

    What happens if you got to Content - Documents & Files and then click on your document. Then change the title and the URL to your needs. 

    Could this help you to get close to what you want. You could even add an extra URL.

    Markus

  4. Tony
    Tony avatar
    57 posts
    Registered:
    04 Dec 2013
    16 Jan 2014 in reply to Markus
    Link to this post
    Markus,

    By George...I think that is the answer!!!
    So, let me ask you this question with this solution in mind.
    If I have a PDF named 123456789.pdf and I upload that to my Documents sub folders. I then click on that file name and edit the title properties to say something more useful like View Manual. Then I go down to the Advanced tab and change the URL to say Cold-Well-Steam-Tables and have the multiple URLs check box checked.
    Then when I Publish this PDF and go to the page and look at my Document List for that product, I see the View Manual text and it has a rollover link of Cold-Well-Steam-Tables.pdf and not 123456789.pdf.
    This should work, right?
    Thanks again for your help!!!
  5. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    17 Jan 2014 in reply to Tony
    Link to this post
    Dear Tony

    www.marktold.com/screencast/sf_tony.swf show you how it works.

    The URL shown in the downlaod widget will be the one you give in the document section. Most probably the original url of your document. I thought thats what you wanted. The additional URL let you access the file directly with another url. I guess thats mostly for linking in mails for example. 

    go to www.mydomain.com/manual instead of the other urls 1234569789 and so on. So I would say just give it a try.

    Sitefinity does a lot of stuff out of the box. And is simply the best CMS on the market :-)

    Markus
  6. Sabrie Nedzhip
    Sabrie Nedzhip avatar
    534 posts
    Registered:
    02 Dec 2016
    17 Jan 2014
    Link to this post
    Hello Markus,

    Thank you for sharing the solution with the community.

    Regards,
    Sabrie Nedzhip
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. Markus
    Markus avatar
    2763 posts
    Registered:
    25 Nov 2005
    17 Jan 2014 in reply to Sabrie Nedzhip
    Link to this post
    Dear Sabrie

    If you are so much on the receiving side as me, it feels good if I might help someone else for once :-)

    Hope this workaround suites Tony.

    Markus
  8. Tony
    Tony avatar
    57 posts
    Registered:
    04 Dec 2013
    20 Jan 2014 in reply to Markus
    Link to this post
    Yes Markus, that is the solution.
    Thank you for helping me out and the forum too.

    Markus, can you look at this forum question and see what you might think of:
    http://www.sitefinity.com/developer-network/forums/general-discussions-/download-list-questions

8 posts, 0 answered