0
A
回答
0
这是适用通过重写一些Sitecore的XML控件,并使用下面的代码:
private void RenderRenderings(DeviceDefinition deviceDefinition, int selectedIndex, int index)
{
Assert.ArgumentNotNull(deviceDefinition, "deviceDefinition");
ArrayList renderings = deviceDefinition.Renderings;
if (renderings == null)
{
return;
}
foreach (RenderingDefinition renderingDefinition in renderings)
{
if (renderingDefinition.ItemID != null)
{
Item item = Client.ContentDatabase.GetItem(renderingDefinition.ItemID);
XmlControl xmlControl = Resource.GetWebControl("DeviceRendering") as XmlControl;
Assert.IsNotNull(xmlControl, typeof(XmlControl));
System.Web.UI.HtmlControls.HtmlGenericControl htmlGenericControl = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
htmlGenericControl.Style.Add("padding", "0");
htmlGenericControl.Style.Add("margin", "0");
htmlGenericControl.Style.Add("border", "0");
htmlGenericControl.Style.Add("position", "relative");
htmlGenericControl.Controls.Add(xmlControl);
string uniqueID = Control.GetUniqueID("R");
this.Renderings.Controls.Add(htmlGenericControl);
htmlGenericControl.ID = Control.GetUniqueID("C");
xmlControl["Click"] = "OnRenderingClick(\"" + index + "\")";
xmlControl["DblClick"] = "device:edit";
if (index == selectedIndex)
{
xmlControl["Background"] = "#D0EBF6";
}
this.Controls.Add(uniqueID);
//Get DataSource item path
var datasource = string.Empty;
Sitecore.Data.Database master = Sitecore.Configuration.Factory.GetDatabase("master");
if (!string.IsNullOrEmpty(renderingDefinition.Datasource))
{
var dsItem = master.GetItem(renderingDefinition.Datasource);
if (dsItem != null)
datasource = dsItem.Paths.Path;
}
if (item != null)
{
xmlControl["ID"] = uniqueID;
xmlControl["Icon"] = item.Appearance.Icon;
xmlControl["Header"] = item.DisplayName;
xmlControl["Placeholder"] = WebUtil.SafeEncode(renderingDefinition.Placeholder);
xmlControl["DataSource"] = datasource;
}
else
{
xmlControl["ID"] = uniqueID;
xmlControl["Icon"] = "Applications/24x24/forbidden.png";
xmlControl["Header"] = "Unknown rendering";
xmlControl["Placeholder"] = string.Empty;
xmlControl["DataSource"] = string.Empty;
}
if (renderingDefinition.Rules != null && !renderingDefinition.Rules.IsEmpty)
{
int num = renderingDefinition.Rules.Elements("rule").Count<XElement>();
if (num > 1)
{
System.Web.UI.HtmlControls.HtmlGenericControl htmlGenericControl2 = new System.Web.UI.HtmlControls.HtmlGenericControl("span");
if (num > 9)
{
htmlGenericControl2.Attributes["class"] = "scConditionContainer scLongConditionContainer";
}
else
{
htmlGenericControl2.Attributes["class"] = "scConditionContainer";
}
htmlGenericControl2.InnerText = num.ToString();
htmlGenericControl.Controls.Add(htmlGenericControl2);
}
}
RenderDeviceEditorRenderingPipeline.Run(renderingDefinition, xmlControl, htmlGenericControl);
index++;
}
}
}
下一步是更新下列文件: \网站\ Sitecore的\壳\覆盖\应用程序\布局\ DeviceEditor.xml \网站\ Sitecore的\壳\覆盖\应用程序\布局\ DeviceRendering.xml
您可以在以下博客文章的源代码:
http://baraamasri.blogspot.com/2017/03/custom-device-editor_21.html
此外,您还可以下载一个市场模块,这是否: https://marketplace.sitecore.net/Modules/C/Custom_Device_Editor.aspx
相关问题
- 1. Sitecore演示详细信息
- 2. 指定详细信息表格信息
- 3. Sitecore标准值介绍详细信息
- 4. Android主详细信息详细信息
- 5. Crystal Reports详细信息详细信息
- 6. 不完整的sitecore发布(演示详细信息丢失)
- 7. 搜索用户详细信息表格
- 8. 发送主人详细信息表格
- 9. 表空间详细信息
- 10. 如何修改详细查看我的强类型的详细信息
- 11. 对模板标准值的布局详细信息的支持
- 12. 修改编辑账户详细信息页面
- 13. 搜索和修改用户详细信息
- 14. 修改iPhone应用程序商店的详细信息
- 15. 投影栅格水位详细信息
- 16. Git pull后的详细信息更改
- 17. Mysql更改列详细信息
- 18. 用户详细信息表中的用户认证详细信息或单独?
- 19. 片段布局列表<-->详细
- 20. Android按钮详细信息
- 21. 显示行详细信息
- 22. OutofMemory异常详细信息
- 23. 主/详细信息页
- 24. ActiveReports多列详细信息
- 25. Beautifulsoup分析 - 详细信息
- 26. RDLC详细信息对
- 27. XCode项目详细信息?
- 28. MasterDetail ToolbarItem详细信息
- 29. Google Places API - 详细信息
- 30. XMLHttpRequest错误详细信息
没问题,就行了。 –
@Adriaan我更新了答案,希望这会更好。 –
@Mohammad您可以请您建议我需要修改哪些类和xml文件,以便在Device editor对话框之前打开的Layout Details对话框中实现相同的功能。这对我很有帮助 –