More in this section

Forums / Developing with Sitefinity / Associating an image or document with a News item

Associating an image or document with a News item

11 posts, 0 answered
  1. Daniel
    Daniel avatar
    10 posts
    Registered:
    08 Apr 2008
    23 Jun 2008
    Link to this post
    Is it possible to associate a specific image or document in a Document Library with an item in a News list?  What we want to do is show the image/document in a custom newslist control that we are building.  When an admin creates the news item, they would pick the image/document that they want to show from the relevant Document Library.  We think that the existing Thumbnail feature in the News feature would not be appropriate for our needs.  The Documents the user will pick will likely be a Flash movie.

    Perhaps we would use metadata for this?  Or maybe we override the News feature to a more significant degree?
  2. Daniel
    Daniel avatar
    10 posts
    Registered:
    08 Apr 2008
    23 Jun 2008
    Link to this post
    Another option would be that instead of using the News list, we associate the necessary meta data directly with the Document Library.  In our case, the data we were considering using the newslist for was:  Publish Date, Expiration Date, Author.

    Would this be a better/easier solution?

    Cheers,
    Daniel
  3. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    23 Jun 2008
    Link to this post
    Hello Daniel,

    Please review the following KB article as we think it might help you achieve your goal:
    Adding thumbnails from Image and Documents to the News module

    Another possible approach is to use a server button that opens the LibraryImageManager or the LibraryDocumentManager when clicked. These dialogs will be similar to the ones used in Insert an image and Insert a document tools in the editor. See the attached examples.

    Let us know if you need any further assistance.

    All the best,
    Rebecca
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  4. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    23 Jun 2008
    Link to this post
    Hi Rebecca,

    Could you help to fix the ButtonSelector. This button allow only one selection, I need to add more that one element in my document.

    Could you explain if is possible to link one complete Image gallery inside the News in the same document ( NewsList). I need to attach the complete views to one news, not only one shot!.

    I need your help. Regards
  5. Rebecca
    Rebecca avatar
    536 posts
    Registered:
    24 Sep 2012
    24 Jun 2008
    Link to this post
    Hello Pierre,

    Unfortunately, you cannot achieve this functionality with the two dialogs. Image Gallery or Download LIst controls should be used instead.

    All the best,
    Rebecca
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    25 Jun 2008
    Link to this post
    Hi Rebecca,

    Could you explain more how to register and use the document selector found in the sample using MyLibrary.
    I used this 

    <%@ Register TagPrefix="myLib" Namespace="MyLibrary" Assembly="MyLibrary.DocumentSelector, App_Code" %> ??

    Using?

    <myLib:ButtonSelector?? ID="ButtonSelector1" runat="server" AssociatedControls="MyDocID" />

    ButtonSelector, DocumentSelector..?
    Please, no more post "DOCX" we need external tool to see

    Regards



  7. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    26 Jun 2008
    Link to this post
    Hello Pierre,

    Here is an example how to register the DocumentSelector control:

    <%@ Register TagPrefix="myLib" Namespace="MyLibrary" Assembly="App_Code" %> 
    ... 
       
    <myLib:DocumentSelector ID="DocumentSelector1" runat="server" /> 

    Also, I have attached the .cs file of the class.

    Hope this helps.

    Kind regards,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    26 Jun 2008
    Link to this post
    Hi,

    Thanks, but during use I have one big problem. When I add in my ControlPanelEdit/Insert Template for News "alone" as

    <mylib ID="DocumentSelector1" runat="server"/>
    works fine, but the ID="DocumentSelector1" is no linked to my metafields, no stored.

    After that I have linked like that to my custom-metafields like
    <myLib   ID="IDMyMetafieldShortText" runat="server"/>

    I'm work over 31Sp1 not new telerik.News

    And I have this Error

    Détails de l'exception: System.InvalidCastException: La zona de control Meta field debe ser implementada sobre el ITextControl.  
    translating : The zone of metafield control must be implemented over the ItextControl.   
     
     
    Erreur source: Telerik.News\...WebControls\Admin\ControlPanel.cs    
     
     
    Ligne 52 :                 }  
    Ligne 53 :             }  
    Ligne 54 :             base.CreateChildControls();  
    Ligne 55 :         }  
    Ligne 56 :   
       
     

    Could you help me to fix.

    Regards
  9. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    27 Jun 2008
    Link to this post
    Hi Pierre,

    The DocumentSelector control can be used only with Sitefinity v3.2 or later. This is because there is a reference in it to functionality which was implemented in v3.2. Also, this control is designed for the public part of the web sites, not for the administration.

    Hope the information is helpful for you.

    Sincerely yours,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  10. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    27 Jun 2008
    Link to this post

    Hi ,

    I'm cracy but I don't understand anything. If I use in my 3.2sp2Hf1616 to add one document in the ControlPanel Edit/InsertTemplate  to use with Module News, same in article KB to use in the NewsList. I Can't??

    How to add one document as Metafield to complete my NewsList?, I can't.?

    The Document selector as implemented as Text and need to be implemented as ItextControl to be able to use with Metafields.

    I don't understand your logic, The Button Selector for Thumbnails only works for 1 Thumbnail not for more images, and the Document selector works in Public Side now?, Where?, in the public aspx page, not in News Module Edit/Insert.

    Could you go inside in this problem. We searching to add in one NewsList or SingleNewsList one Document. The reference will be store as Metafield, like Authors and others like Thumbnail selector, It's not the moon.

    See.

     

     


     

  11. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    30 Jun 2008
    Link to this post
    Hi Pierre,

    I am confirming that the provided example is a public control for public use and you cannot use it in the administration. Let me explain the reason for this.
    Since all meta fields are automatically saved and set by Sitefinity, there must be some procedure how Sitefinity can do this automatically. The logic goes like this: Sitefinity looks for all controls that have id of a meta key and that can be cast to ITextControl interface. The importance of ITextControl interface is that it mandates the control to have a Text property, so Sitefinity always knows that the value of meta field will be stored in controls Text property, without actually worrying what kind of a control it is. So you can try to modify the provided control in order to use it in the administration:


    1. Implement ITextControl interface on the control.
    2.
    Implement mandated Text property. In the get accessor return the text of the TextBox control, in the set accessor set the text of the TextBox control to the value.

    Hope the information is helpful for you.

    Regards,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
11 posts, 0 answered