|
<%@ Control Language="C#" Inherits="DNA.Mvc.DynamicUI.WidgetViewUserControl" %>
<% if (IsDesignMode)
{ %>
<form action="#" class="ui-widget-settings ui-widget-content ui-corner-all">
<div style="overflow: hidden;">
<%:PropertyDescriptors["ImageUrl"].DisplayName %></div>
<div style="overflow: hidden; margin-top: 5px;">
<%:Ajax.TextBox(GenerateFieldID("ImageUrl"), UserData["ImageUrl"] != null ? UserData["ImageUrl"].ToString() : "http://")%>
<%:Ajax.FileButton(GenerateFieldID("ImageUrl"),
WebContext.Current.Web.GetWebRootUri(),
new ButtonOptions()
{
Text = Html.Global("RES_BROWSE"),
Icons = new ButtonOptions.ButtonIcons()
{
PrimaryIconCssClass = "ui-icon ui-icon-folder-open"
}
},
null)%>
</div>
<div style="overflow: hidden; margin-top: 5px;">
<%:PropertyDescriptors["LinkUrl"].DisplayName %></div>
<div style="overflow: hidden;">
<%:Ajax.TextBox(GenerateFieldID( "LinkUrl"), UserData["LinkUrl"] != null ? UserData["LinkUrl"].ToString() : "")%></div>
<div style="overflow: hidden; margin-top: 5px;">
<%:PropertyDescriptors["Alignment"].DisplayName%></div>
<div>
<% List<SelectableNode> alignmentNodes = new List<SelectableNode>();
alignmentNodes.Add(new SelectableNode(Html.Global("RES_ALIGN_CENTER"), "center"));
alignmentNodes.Add(new SelectableNode(Html.Global("RES_ALIGN_LEFT"), "left"));
alignmentNodes.Add(new SelectableNode(Html.Global("RES_ALIGN_RIGHT"), "right"));
%>
<%=Ajax.DropDown(GenerateFieldID("Alignment"), alignmentNodes, new DropDownOptions() { Width = 80, EmptyText = "", PrefixText = "", SelectedValue = UserData["Alignment"]!=null ? UserData["Alignment"].ToString():"center" })%>
</div>
<div style="overflow: hidden; margin-top: 5px;">
<%:PropertyDescriptors["Target"].DisplayName%></div>
<div>
<%
var targets = new List<SelectableNode>();
targets.AddRange(new SelectableNode[] {
new SelectableNode(Html.Global("RES_TARGET_BLANK"), "_blank"),
new SelectableNode(Html.Global("RES_TARGET_PARENT"), "_parent"),
new SelectableNode(Html.Global("RES_TARGET_SELF"), "_self"),
new SelectableNode(Html.Global("RES_TARGET_TOP"), "_top")
});
%>
<%=Ajax.DropDown(GenerateFieldID("Target"), targets, new DropDownOptions() { Width = 150, SelectedValue = UserData["Target"] == null ? "_self" : (!string.IsNullOrEmpty(UserData["Target"].ToString())) ? UserData["Target"].ToString() : "_self" })%>
</div>
<div style="overflow: hidden; margin-top: 5px;">
<%:PropertyDescriptors["ImageWidth"].DisplayName %></div>
<div style="overflow: hidden;">
<%:Ajax.Number(GenerateFieldID( "ImageWidth"), UserData["ImageWidth"] != null ? (int)UserData["ImageWidth"] : 0)%></div>
<div style="overflow: hidden; margin-top: 5px;">
<%:PropertyDescriptors["ImageHeight"].DisplayName %></div>
<div style="overflow: hidden;">
<%:Ajax.Number(GenerateFieldID( "ImageHeight"), UserData["ImageHeight"] != null ? (int)UserData["ImageHeight"] : 0)%></div>
</form>
<%} %>
<%
if (UserData["ImageUrl"] != null)
{
%><%
if ((((int)UserData["ImageHeight"]) > 0) && (WidgetInstance != null))
Html.RegisterStartupScript(" $(\".dna-ui-widget-body\",$(\"#" + WidgetInstance.ID.ToString() + "\")).css({height:\"" + UserData["ImageHeight"].ToString() + "px\"});");
%>
<%: MvcHtmlString.Create("<div class=\"ui-helper-reset\" style=\"padding:0px;margin:0px;text-align:" + (UserData["Alignment"] != null ? UserData["Alignment"].ToString() : "center") + "\">")%>
<%
if ((UserData["LinkUrl"] != null) && (!String.IsNullOrEmpty(UserData["LinkUrl"].ToString())))
{ %>
<a href="<%:UserData["LinkUrl"].ToString() %>" target="<%:UserData["Target"] == null ? "_self" : (!string.IsNullOrEmpty(UserData["Target"].ToString())) ? UserData["Target"].ToString() : "_self" %>">
<%} %>
<%:Html.Image(UserData["ImageUrl"].ToString(), (int)UserData["ImageWidth"], (int)UserData["ImageHeight"])%>
<% if ((UserData["LinkUrl"] != null) && (!String.IsNullOrEmpty(UserData["LinkUrl"].ToString())))
{ %>
</a>
<%} %>
</div>
<%}
else
{
if ((HttpContext.Current.Request.IsAuthenticated) && (HttpContext.Current.User.IsWebOwner()))
{
%>
<div class="ui-state-highlight ui-corner-all" style="padding: 15px; margin-top: 5px;">
Please add an image link first.
<% if ((HttpContext.Current.User.IsWebOwner()) && (string.IsNullOrEmpty(UserData["ImageUrl"] as string)) && !IsDesignMode)
{
%>
<div style="margin-top: 5px;">
Please <a href="javascript:void(0);" onclick="location=location+'?design=true&returnUrl='+location;">
<u>toggle</u></a> the page design mode and set image url to show it.
</div>
<%} %>
<% if ((HttpContext.Current.User.IsWebOwner()) && (string.IsNullOrEmpty(UserData["ImageUrl"] as string) && IsDesignMode))
{ %>
Open the ImageLink widget
<%:GenVerbLink("<u>setting</u>", WidgetVerbs.Settings)%>
an set the image url.
<%} %>
</div>
<% }
}%>
<%=Html.StartupScripts() %>
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
In 1999, I started programming using Delphi, VB, VJ.From 2002 I started with .NET using C#.Since 2005 when i had became an EIP product manager I was focus on EIP and CMS technique. In 2008 i established dotnetage.com and started to shared my ideas and projects online. I believe "No shared no grow"
www.dotnetage.com