yalook
* totem-banner.png: * totem-banner.xs.jpg: * totem-banner.xxs.jpg: totem custo * Makefile: reloads config after each rsync call * NpgsqlBlogProvider.cs: - Fixes access on bills - Fixes usage of bill without photo * style.css: yastyle * AccountController.cs: - Fixes route usage with n ovalue for `id` - better code at getting the avatar url * BlogsController.cs: Fixes a Post request without user name in the route * YavscHelpers.cs: Implements a file list html rendering * App.master: * UserPost.aspx: * Profile.aspx: * AssemblyInfo.aspx: yahtmlstructure * Edit.aspx: Displays a list a attached files * UserPosts.aspx: yahtmlstrucure * Web.csproj: new images * instdbws.sql: returns to the flat list of properies (groups are not working) * LocalizedText.resx: * LocalizedText.fr.resx: * LocalizedText.Designer.cs: * LocalizedText.fr.Designer.cs: a new translation
This commit is contained in:
parent
c79921ea58
commit
30cebd7751
25 changed files with 349 additions and 165 deletions
|
|
@ -176,23 +176,92 @@ namespace Yavsc.Helpers
|
|||
if (a == null || a is DBNull) return "/avatars/" + helper.Encode(username)+".png";
|
||||
return helper.Encode ((string)a);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Javas the script.
|
||||
/// </summary>
|
||||
/// <returns>The script.</returns>
|
||||
/// <param name="html">Html.</param>
|
||||
/// <param name="obj">Object.</param>
|
||||
public static string JavaScript(this HtmlHelper html, object obj)
|
||||
{
|
||||
return JavaScript (obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Javas the script.
|
||||
/// </summary>
|
||||
/// <returns>The script.</returns>
|
||||
/// <param name="obj">Object.</param>
|
||||
public static string JavaScript(object obj)
|
||||
{
|
||||
JavaScriptSerializer serializer = new JavaScriptSerializer();
|
||||
return serializer.Serialize(obj);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notice the specified ViewData with message.
|
||||
/// </summary>
|
||||
/// <param name="ViewData">View data.</param>
|
||||
/// <param name="message">Message.</param>
|
||||
public static void Notice (ViewDataDictionary ViewData, string message) {
|
||||
if (ViewData ["Notifications"] == null)
|
||||
ViewData ["Notifications"] = new List<string> ();
|
||||
(ViewData ["Notifications"] as List<string>).Add (message.Replace("\'","\\\'"));
|
||||
}
|
||||
/// <summary>
|
||||
/// Files the list.
|
||||
/// </summary>
|
||||
/// <returns>The list.</returns>
|
||||
/// <param name="html">Html.</param>
|
||||
/// <param name="path">Path.</param>
|
||||
/// <param name="patterns">Patterns.</param>
|
||||
public static IHtmlString FileList(this HtmlHelper html, string path, string [] patterns = null) {
|
||||
StringWriter str = new StringWriter();
|
||||
HtmlTextWriter writter = new HtmlTextWriter (str);
|
||||
DirectoryInfo di = new DirectoryInfo (HttpContext.Current.Server.MapPath(path));
|
||||
if (!di.Exists)
|
||||
return new MvcHtmlString ("");
|
||||
var files = new List<FileInfo> ();
|
||||
if (patterns == null)
|
||||
patterns = new string[] { "*" };
|
||||
var url = new UrlHelper(html.ViewContext.RequestContext,
|
||||
html.RouteCollection);
|
||||
|
||||
foreach (string pattern in patterns)
|
||||
files.AddRange(
|
||||
di.EnumerateFiles (
|
||||
pattern,
|
||||
SearchOption.TopDirectoryOnly));
|
||||
writter.RenderBeginTag ("table");
|
||||
writter.RenderBeginTag ("tr");
|
||||
writter.RenderBeginTag ("td");
|
||||
writter.Write (html.Translate ("Name"));
|
||||
writter.RenderEndTag ();
|
||||
writter.RenderBeginTag ("td");
|
||||
writter.Write (html.Translate ("Created"));
|
||||
writter.RenderEndTag ();
|
||||
writter.RenderBeginTag ("td");
|
||||
writter.Write (html.Translate ("Modified"));
|
||||
writter.RenderEndTag ();
|
||||
writter.RenderEndTag ();
|
||||
foreach (FileInfo fi in files) {
|
||||
writter.RenderBeginTag ("tr");
|
||||
writter.RenderBeginTag ("td");
|
||||
writter.AddAttribute ("href", url.Content(path+"/"+fi.Name));
|
||||
writter.RenderBeginTag ("a");
|
||||
writter.Write (fi.Name);
|
||||
writter.RenderEndTag ();
|
||||
writter.RenderEndTag ();
|
||||
writter.RenderBeginTag ("td");
|
||||
writter.Write (fi.LastWriteTime.ToString ("U"));
|
||||
writter.RenderEndTag ();
|
||||
writter.RenderBeginTag ("td");
|
||||
writter.Write (fi.CreationTime.ToString("U"));
|
||||
writter.RenderEndTag ();
|
||||
writter.RenderEndTag ();
|
||||
}
|
||||
writter.RenderEndTag ();
|
||||
return new MvcHtmlString (str.ToString ());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue