<%@ Control Language="C#" Inherits="DNA.Mvc.DynamicUI.WidgetViewUserControl<IEnumerable<Article>>" %>
<%:Ajax.RenderAutoSettingForm(PropertyDescriptors, IDPrefix, IsDesignMode)%>
<% if (Model.Count() > 0)
{ %>
<table cellpadding="5px">
<%
foreach (var article in Model)
{
if ((article.IsPrivate) || (!article.IsPublished))
{
if (!HttpContext.Current.Request.IsAuthenticated)
continue;
if (!article.UserName.Equals(HttpContext.Current.User.Identity.Name, StringComparison.OrdinalIgnoreCase))
continue;
}
var content = article.GetGlobalizationContent();
%>
<tr>
<td valign="top" align="center">
<% if ((bool)UserData["ShowAuthorInfo"])
{
var profile = article.Author.GetProfile();
%>
<table style="width: 100%; margin-bottom: 10px;">
<tr>
<td valign="top" style="white-space: nowrap;">
<img src="<%:Url.Content("~/Content/Images/no-avatar.gif") %>" alt="" class="ui-corner-all"
style="width: 80px; height: 80px;" />
<div style="margin-top: 5px; text-align: center;">
<%:Html.UserLink(article.UserName) %>
</div>
<% if (!string.IsNullOrEmpty(profile["Location"].ToString()))
{ %>
<div>
<%:Html.Global("RES_LOCATION")%>:
<%:profile["Location"]%></div>
<%} %>
<% if (!string.IsNullOrEmpty(profile["Email"].ToString()))
{%>
<%:Html.ImageLink("Contact me via mail", "mailto:"+profile["Email"].ToString(), Url.Content("~/Content/Images/email.png"))%>
<%} %>
<% if (!string.IsNullOrEmpty(profile["WebSite"] as string))
{%>
<%:Html.ImageLink("Web site",profile["WebSite"].ToString(),Url.Content("~/Content/Images/icon_homelink.gif")) %>
<%} %>
</td>
</tr>
<tr>
<td>
<%: !string.IsNullOrEmpty(article.Author.GetProfile()["Signature"] as string) ? Html.Encode(article.Author.GetProfile()["Signature"].ToString()) : ""%>
</td>
</tr>
</table>
<%} %>
<% if ((article.AllowComments) || article.TotalComments > 0)
{ %>
<div style="width: 65px; margin-bottom: 5px;" class="ui-state-highlight ui-corner-all">
<div style="text-align: center; font-size: larger; font-weight: bold;">
<%:article.TotalComments%></div>
<div style="text-align: center; font-size: smaller;">
<%:Html.Global("publishing", "Comments") %></div>
</div>
<%} %>
<div style="width: 65px; margin-bottom: 5px;" class="ui-state-default ui-corner-all">
<div style="text-align: center; font-size: larger; font-weight: bold;">
<%:article.TotalRatings %></div>
<div style="text-align: center; font-size: smaller;">
<%:Html.Global("publishing", "Votes") %></div>
</div>
<div style="width: 65px;" class="ui-state-hover ui-corner-all">
<div style="text-align: center; font-size: larger; font-weight: bold;">
<%:article.Reads %></div>
<div style="text-align: center; font-size: smaller;">
<%:Html.Global("publishing", "Reads") %></div>
</div>
</td>
<td valign="top">
<h2 class="ui-title" style="margin-top: 0px;">
<a href="<%:article.GetPermaLinkUrl() %>">
<%:content.Title%></a>
<% if (article.Posted > DateTime.Now.AddDays(-3))
{%>
<img style="margin-left: 5px;" src="<%:Url.Content("~/Content/Images/new.gif") %>"
alt="[new]" />
<%} %>
</h2>
<div id="<%:IDPrefix+"_bodyArea" %>">
<% if (article.ContentFormat == 2)
{ %>
<%:Html.FormatWiKi(content.Body)%>
<%}
else
{ %>
<%: Html.FormatXhtml(content.Body)%>
<%} %>
<% Html.ForceImageAutoSize(IDPrefix + "_bodyArea", -1, 520); %>
</div>
<div style="overflow: hidden; display: block; margin: 5px 0px 5px 0px; padding-top: 5px;
border-top: 1px solid #cccccc;">
<%: Html.ImageLinkList()
.Options(opts =>
{
opts.CssClass = "ui-helper-reset";
opts.ItemCssStyleText = "float:left;margin-right:5px;";
opts.ImageCssStyleText = "float:left;margin-right:5px;";
opts.TitleCssStyleText = "float:left;padding-top:2px;";
})
.Items(list =>
{
var parent = article.GetParent();
var rootID =WebHost.EnablePersonalWeb ? WebSite.Open(article.UserName).DefaultCategory().ID : WebSite.Open().DefaultCategory().ID;
list.Add(Html.Global("publishing", "FiledUnder"));
list.Add(parent.ID == rootID ? Html.Global("publishing", "Uncategorized") : parent.Title, "", parent.GetPermalinkUrl().ToString());
if (!string.IsNullOrEmpty(article.Categories))
{
var cats = article.GetCategories();
foreach (var c in cats)
list.Add(c.ID == rootID ? Html.Global("publishing", "Uncategorized") : c.Title, "", parent.GetPermalinkUrl().ToString());
}
if (!((bool)UserData["ShowAuthorInfo"]))
list.Add(Html.Global("Publishing", "Author") + ":" + Html.UserLink(article.UserName), Url.Content("~/Content/Images/contact.gif"));
list.Add(Html.Global(article.Posted), Url.Content("~/Content/Images/calender.gif"));
if ((this.Context.Request.IsAuthenticated) && (this.Context.User.Identity.Name.Equals(article.UserName, StringComparison.OrdinalIgnoreCase)))
{
list.Add(Html.Global("RES_EDIT"), Url.Content("~/Content/Images/edit_page.png"), Url.Action("Edit", "Article", new { website = WebContext.Current.Web.Name, id = article.ID, Area = "Publishing" }));
}
if (article.AllowComments)
{
list.Add("", Url.Content("~/Content/Images/rss.png"));
list.Add("Rss", "", Url.Action("RssFeed", "Article", new { website = WebContext.Current.Web.Name, id = article.ID, Area = "Publishing" }));
list.Add("Atom", "", Url.Action("AtomFeed", "Article", new { website = WebContext.Current.Web.Name, id = article.ID, Area = "Publishing" }));
}
})
.Render()
%>
</div>
</td>
</tr>
<%} %>
</table>
<%}
else
{ %>
<div class="ui-state-highlight" style="padding: 10px;">
This is no article/blog found.
</div>
<%} %>
<%:Html.StartupScripts() %>