/// <summary>
        /// Renders the rendering.
        ///
        /// </summary>
        /// <param name="output">The output.</param><param name="rendering">The rendering.</param><param name="renderingDefinition">The rendering definition.</param><param name="index">The index.</param>
        private void RenderRendering(HtmlTextWriter output, Item rendering, RenderingDefinition renderingDefinition, int index)
        {
            Assert.ArgumentNotNull((object)output, "output");
            Assert.ArgumentNotNull((object)rendering, "rendering");
            Assert.ArgumentNotNull((object)renderingDefinition, "renderingDefinition");
            string str1 = rendering.DisplayName;

            if (rendering.ID == RenderingIDs.FieldRenderer)
            {
                string @string = StringUtil.GetString(new string[1]
                {
                    WebUtil.ParseQueryString(StringUtil.GetString(new string[1]
                    {
                        renderingDefinition.Parameters
                    }))["FieldName"]
                });
                if (!string.IsNullOrEmpty(@string))
                {
                    TemplateFieldItem templateFieldItem = (TemplateFieldItem)rendering.Database.GetItem(@string);
                    if (templateFieldItem != null)
                    {
                        str1 = "\"" + StringUtil.GetString(new string[2]
                        {
                            templateFieldItem.Title,
                            templateFieldItem.Name
                        }) + "\" " + Translate.Text("Field");
                    }
                    else
                    {
                        str1 = Translate.Text("[unknown field]");
                    }
                }
                else
                {
                    str1 = Translate.Text("[unknown field]");
                }
            }
            string str2            = string.Empty;
            string qualifiedKey    = this.GetQualifiedKey();
            Item   placeholderItem = Sitecore.Context.Page.GetPlaceholderItem(this, Sitecore.Context.Database);

            if (placeholderItem != null)
            {
                str2 = placeholderItem["Allowed Controls"];
            }
            string str3 = "javascript:return window.parent.scForm.postEvent(this,event,'pagedesigner:editplaceholder(placeholdername=" + (object)qualifiedKey + ",allowedrenderings=" + str2 + ",index=" + (string)(object)index + ")')";

            output.Write("<a href=\"#\" style=\"display:block;color:black;background:#e2ebf8;border:1px solid #97b3e1;font:8pt tahoma;padding:4px;margin:3px 0px 0px 0px;text-decoration:none\" onclick=\"" + str3 + "\" onmouseover=\"javascript:this.style.textDecoration='underline'\" onmouseout=\"javascript:this.style.textDecoration='none'\">");
            output.Write(ItemTileService.RenderTile(rendering, TileView.IconOnly, ImageDimension.id16x16));
            output.Write(' ');
            output.Write(str1);
            output.Write("</a>");
        }
Example #2
0
        private string RenderItems(List <Item> items)
        {
            Assert.ArgumentNotNull((object)items, "items");
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = true;

            foreach (Item obj in items)
            {
                string             click = StringUtil.EscapeJavascriptString(string.Format("Items_Click(\"{0}\",\"{1}\",\"{2}\")", (object)obj.ID, (object)obj.Language, (object)obj.Version));
                RenderItemTileArgs args  = new RenderItemTileArgs(obj, TileView.Thumbnails, ImageDimension.idDefault, click);
                if (flag)
                {
                    args.CssClass     = "scItemThumbnailSelected";
                    this.SelectedItem = obj.ID.ToString();
                    flag = false;
                }
                string str = ItemTileService.RenderTile(args);
                stringBuilder.Append(str);
            }
            return(stringBuilder.ToString());
        }
 /// <summary>
 /// Renders the sublayout.
 ///
 /// </summary>
 /// <param name="output">The output.</param><param name="rendering">The rendering.</param><param name="renderingDefinition">The rendering definition.</param><param name="index">The index.</param>
 private void RenderSublayout(HtmlTextWriter output, Item rendering, RenderingDefinition renderingDefinition, int index)
 {
     Assert.ArgumentNotNull((object)output, "output");
     Assert.ArgumentNotNull((object)rendering, "rendering");
     Assert.ArgumentNotNull((object)renderingDefinition, "renderingDefinition");
     foreach (Control control in this.Controls)
     {
         Sublayout sublayout = control as Sublayout;
         if (sublayout != null && string.Compare(sublayout.Path, rendering["Path"], StringComparison.InvariantCulture) == 0)
         {
             output.Write("<table width=\"100%\" style=\"table-layout:fixed;background:#e2ebf8;border:1px solid #97b3e1;margin:3px 0px 0px 0px\" cellpadding=\"2\" cellspacing=\"0\" border=\"0\">");
             output.Write("<tr><td>");
             string str1 = rendering.DisplayName;
             if (rendering.ID == RenderingIDs.FieldRenderer)
             {
                 string @string = StringUtil.GetString(new string[1]
                 {
                     WebUtil.ParseQueryString(renderingDefinition.Parameters)["FieldName"]
                 });
                 if (!string.IsNullOrEmpty(@string))
                 {
                     TemplateFieldItem templateFieldItem = (TemplateFieldItem)rendering.Database.GetItem(@string);
                     if (templateFieldItem != null)
                     {
                         str1 = "\"" + StringUtil.GetString(new string[2]
                         {
                             templateFieldItem.Title,
                             templateFieldItem.Name
                         }) + "\" " + Translate.Text("Field");
                     }
                     else
                     {
                         str1 = Translate.Text("[unknown field]");
                     }
                 }
                 else
                 {
                     str1 = Translate.Text("[unknown field]");
                 }
             }
             string str2            = string.Empty;
             string qualifiedKey    = this.GetQualifiedKey();
             Item   placeholderItem = Sitecore.Context.Page.GetPlaceholderItem(this, Sitecore.Context.Database);
             if (placeholderItem != null)
             {
                 str2 = placeholderItem["Allowed Controls"];
             }
             string str3 = "javascript:return window.parent.scForm.postEvent(this,event,'pagedesigner:editplaceholder(placeholdername=" + (object)qualifiedKey + ",allowedrenderings=" + str2 + ",index=" + (string)(object)index + ")')";
             output.Write("<a href=\"#\" style=\"display:block;color:black;font:8pt tahoma;padding:2px 2px 0px 2px;text-decoration:none\" onclick=\"" + str3 + "\" onmouseover=\"javascript:this.style.textDecoration='underline'\" onmouseout=\"javascript:this.style.textDecoration='none'\">");
             output.Write(ItemTileService.RenderTile(rendering, TileView.IconOnly, ImageDimension.id16x16));
             output.Write(' ');
             output.Write(str1);
             output.Write("</a>");
             output.Write("</td></tr>");
             output.Write("<tr><td>");
             ((Control)sublayout).RenderControl(output);
             output.Write("</td></tr></table>");
             break;
         }
     }
 }