Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Adriano Fabri 459 posts 1602 karma points
    Apr 27, 2012 @ 11:44
    Adriano Fabri
    0

    Problems with MultiNode Tree Picker used into media node

    Umbraco v4.7.1.1 - ASP.NET 4.0 - Windows Server 2008 R2 - IIS 7.5 - 

    Hi to all,
    I have a big problem with your MNTP (Multi Node Tree Picker) used into a media node.

    This is the scenario:
    @Content Section:
    I have a node with a MNTP to select a list of banners or sets (groups) of banners 
    @Media Section:
    I have a media folder with media all single banners nodes.
    In another media folder, I have the media banners "sets" nodes. These are nodes which have a MNTP property to select the banners.
    @Developer Section:
    I have a Razor Macro (ListBanners.cshtml) to show the list of banners (attach file).

    In the content node with banners MNTP I can select singles banner or a set of banners. If I select a set of banner I need to read the MNTP into the Media Node and retrieve the banners selected.
    This is the problem!!!
    In this media node I cannot retrieve in MNTP field, the list of banners I selected. I have only the content of the field as string.

    Can anyone help me to manage the MNTP in media node as a dynamicXML to resolve the issue?
    Thank you in advance

    Adriano

    Media Section:

    Content Section:

    Developer Section:

     

  • Adriano Fabri 459 posts 1602 karma points
    Apr 27, 2012 @ 11:48
    Adriano Fabri
    0

    The RAZOR Code:
    @{
      // ### ListBanners.cshtml ###
      
      int iCountMediaBanner 0;
      
      
      if (@Model.HasProperty("caBanners"&@Model.GetProperty("caBanners").Value != String.Empty)
      {
        <div class="dvBanners">
          <ul>
            @foreach (var item in Model.caBanners)
            {      
              var banNode @Model.MediaById(@item.InnerText);

              if (@banNode.NodeTypeAlias == "caMediaBanner")
              {
                 iCountMediaBanner++;
                 // Accertarsi che la configurazione del datatype UrlPicker sia in JSON altrimenti con Razor
                 // non sarà possibile tirar fuori dati 
                 var urlPicker uComponents.Core.DataTypes.UrlPicker.Dto.UrlPickerState.Deserialize(@banNode.caBannerUrl);
                 
                 <li>
                   <!--@urlPicker.Title      // Title
                   @urlPicker.Mode       // Tipologia di datoContent/URL/Media
                   @urlPicker.Url        // URL (Valorizzato con tipiURL/Media
                   @urlPicker.NodeId     // Id del nodo (Valorizzato con tipoContent)
                   @urlPicker.NewWindow  // _blank-->
               
                   @switch((string)@urlPicker.Mode.ToString())
                   {
                     case "Content":
                        <href="@Model.NodeById(int.Parse(@urlPicker.NodeId.ToString()))" title="@banNode.caBannerTitle">
                           <img src="@Model.MediaById(@banNode.Id).caBannerImage" alt="@banNode.caBannerTitle" width="90%" />
                         </a>
                         break;

                     case "URL":
                     case "Media":
                     default:
                         <href="@urlPicker.Url" title="@banNode.caBannerTitle">
                           <img src="@Model.MediaById(@banNode.Id).caBannerImage" alt="@banNode.caBannerTitle" width="90%" />
                         </a>
                         break;
                   }
                 </li>
              }
               
              if (@banNode.NodeTypeAlias == "caMediaBannerSet")
              {  
                 if (@banNode.HasProperty("caBannersSet"&@banNode.GetProperty("caBannersSet").Value != String.Empty)
                 {
                    foreach (var itemBanner in banNode.caBannersSet)
                    
                       var banNodeSet Library.MediaById(@item.InnerText);
                       
                       <li>@banNodeSet.Id</li>
                    }
                 }
              }
            }
          </ul>
        </div>
      }
    }

Please Sign in or register to post replies

Write your reply to:

Draft