* font-awesome.css: an awesome css

* hallo.js: Use a forked Hallo.js

* showdown.js:
* to-markdown.js:
* mdd_gripper.png:
* mdd_toolbar.png:
* mdd_modal_background.png: The client side Markdown is now
  implemented using Hallo.js

* FontAwesome.otf:
* fontawesome-webfont.eot:
* fontawesome-webfont.svg:
* fontawesome-webfont.ttf:
* fontawesome-webfont.woff:
* fontawesome-webfont.woff2: awesome

* MarkdownDeep.dll: a modified version to render video and audio tags

* NpgsqlBlogProvider.cs:
* CalendarController.cs:
* WorkFlowController.cs: refactoring: The `UserName` property from the
  `BlogEntry` class is renamed to `Author`

* InputUserName.cs: formatting

* BlogsController.cs: * refactoring: The `UserName` property from the
  `BlogEntry` class is renamed to `Author`
* Fixes pandoc process on file named with some spaces

* BlogsController.cs: UserName became Author on BlogEntry objects

* Global.asax.cs: route /fonts is now ignored.

* MarkdownHelper.cs: transform Markdown using a given base url

* App.master: jquery was not needed on all pages.

* Edit.aspx: using Hallo.js

* BlogEntry.cs:
* UserPost.aspx:
* UserPosts.aspx:
* BlogManager.cs:
* RemoveTitle.aspx:
* BlogEntryCollection.cs:
* UUBlogEntryCollection.cs:
* UUTBlogEntryCollection.cs: refactoring

* Web.config: ?

* Web.csproj: * use my local assembly for MarkdownDeep.dll
* fontawesome integration
* Hallo.js, to-markdown.js, showdowwn.js integration

* packages.config: Now use forked MarkdownDeep

* MarkdownDeepLib.min.js:
* MarkdownDeep License.txt:
* MarkdownDeep Quick Reference.txt: using my local revision

* mdd_ajax_loader.gif: The client side Markdown is now implemented
  using Hallo.js
This commit is contained in:
Paul Schneider 2015-09-23 18:48:38 +02:00
commit 77149697dd
42 changed files with 6854 additions and 634 deletions

View file

@ -1,64 +1,99 @@
<%@ Page Title="Bill_edition" Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntry>" MasterPageFile="~/Models/App.master" %>
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
<asp:Content ContentPlaceHolderID="head" ID="HeadContent1" runat="server">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
<script src="http://rangy.googlecode.com/svn/trunk/currentrelease/rangy-core.js"></script>
<link rel="stylesheet" href="<%=Url.Content("~/Scripts/mdd_styles.css")%>">
<script type="text/javascript" src="<%=Url.Content("~/Scripts/MarkdownDeepLib.min.js")%>">
</script>
<script type="text/javascript" src="<%=Url.Content("~/Scripts/MarkdownDeepLib.min.js")%>"></script>
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/jquery-ui.css")%>" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/font-awesome.css")%>" />
<script type="text/javascript" src="<%=Url.Content("~/Scripts/hallo.js")%>"></script>
<script type="text/javascript" src="<%=Url.Content("~/Scripts/to-markdown.js")%>"></script>
<script type="text/javascript" src="<%=Url.Content("~/Scripts/showdown.js")%>"></script>
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<% if (Model != null ) if (Model.Content != null ) { %>
<%= Html.ActionLink(Model.Title,"UserPost",new{user=Model.UserName,title=Model.Title,id=Model.Id}) %>
<% } %>
<%= Html.ValidationSummary("Edition du billet") %>
<h1><div id="vtitle" for="Title" class="post title editable"><%=Html.Markdown(Model.Title)%></div></h1>
<div id="vcontent" for="Content" class="post content editable">
<%=Html.Markdown(Model.Content,"/bfiles/"+Model.Id+"/")%>
</div>
<% using(Html.BeginForm("ValidateEdit","Blogs")) { %>
<%= Html.LabelFor(model => model.Title) %>:<br/>
<%= Html.TextBox( "Title" ) %>
<%= Html.ValidationMessage("Title", "*") %>
<br/>
<%= Html.LabelFor(model => model.Content) %>:<br/>
<div class="mdd_toolbar"></div>
<%= Html.TextArea( "Content" , new { @class="mdd_editor"}) %>
<div class="mdd_resizer"></div>
<div class="mdd_preview panel"></div>
<%= Html.ValidationMessage("Content", "*") %>
<br/>
<%= Html.CheckBox( "Visible" ) %>
<%= Html.LabelFor(model => model.Visible) %>
<%= Html.ValidationMessage("Visible", "*") %>
<br/>
<%= Html.LabelFor(model => model.AllowedCircles) %>
<%= Html.ListBox("AllowedCircles") %>
<%= Html.ValidationMessage("AllowedCircles", "*") %>
<%= Html.Hidden("Id") %>
<%= Html.Hidden("UserName") %>
<br/>
<input type="submit"/>
<%= Html.LabelFor(model => model.Title) %> <%= Html.ValidationMessage("Title") %> : <br>
<input name="Title" id="Title">
<br>
<%= Html.LabelFor(model => model.Content) %>
<%= Html.ValidationMessage("Content") %>: <br>
<textarea id="Content" name="Content"><%=Html.Markdown(Model.Content)%></textarea><br>
<%=Html.Hidden("Author")%>
<%=Html.Hidden("Id")%>
<input type="submit">
<% } %>
<script>
$(document).ready(function () {
$("textarea.mdd_editor").MarkdownDeep({
help_location: "/Scripts/mdd_help.htm",
disableTabHandling:false,
ExtraMode: true
});});
jQuery('#vtitle').hallo({
plugins: {
'halloformat': {},
'halloreundo': {}
},
toolbar: 'halloToolbarFixed'
});
jQuery('#vcontent').hallo({
plugins: {
'halloformat': {},
'halloheadings': {},
'hallolists': {},
'halloimage': {},
'halloreundo': {}
},
toolbar: 'halloToolbarFixed'
});
var markdownize = function(content) {
var html = content.split("\n").map($.trim).filter(function(line) {
return line != "";
}).join("\n");
return toMarkdown(html);
};
var converter = new Showdown.converter();
var htmlize = function(content) {
return converter.makeHtml(content);
};
// Method that converts the HTML contents to Markdown
var showSource = function(id,content) {
var markdown = markdownize(content);
if (jQuery('#'+id).get(0).value == markdown) {
return;
}
jQuery('#'+id).get(0).value = markdown;
};
var updateHtml = function(id,content) {
var jView = jQuery('div[for="'+id+'"]');
if (markdownize(jView.html()) == content) {
return;
}
var html = htmlize(content);
jView.html(html);
};
// Update Markdown every time content is modified
jQuery('.editable').bind('hallomodified', function(event, data) {
showSource(this.attributes["for"].value, data.content);
});
jQuery('#Content').bind('keyup', function() {
updateHtml(this.id, this.value);
});
jQuery('#Title').bind('keyup', function() {
updateHtml(this.id, this.value);
});
showSource("Title",jQuery('#vtitle').html());
showSource("Content",jQuery('#vcontent').html());
</script>
<% if (Model.Id!=0) { %>
<script>
function submitTo(method)
function submitFilesTo(method)
{
var data = new FormData($('#uploads').get()[0]);
Yavsc.message('Submitting via '+method);
@ -78,28 +113,26 @@ function submitTo(method)
function submitImport()
{
submitTo('Import');
submitFilesTo('Import');
}
function submitFile()
{
submitTo('PostFile');
submitFilesTo('PostFile');
}
</script>
<form id="uploads" method="post" enctype="multipart/form-data">
<input type="file" name="attached" id="postedfile" multiple>
<input type="button" value="attacher les ficher" onclick="submitFile()">
<input type="button" value="importer les documents" onclick="submitImport()">
</form>
<% } %>
</asp:Content>
<asp:Content ContentPlaceHolderID="MASContent" ID="MASContentContent" runat="server">
<div class="metablog">
(Id:<a href="/Blogs/UserPost/<%= Model.Id %>">
<i><%= Model.Id %></i></a>, <%= Model.Posted.ToString("yyyy/MM/dd") %> - <%= Model.Modified.ToString("yyyy/MM/dd") %> <%= Model.Visible? "":", Invisible!" %>) <%= Html.ActionLink("Supprimer","RemovePost", new { user=Model.UserName, title = Model.Title }, new { @class="actionlink" } ) %>
<i><%= Model.Id %></i></a>, <%= Model.Posted.ToString("yyyy/MM/dd") %> - <%= Model.Modified.ToString("yyyy/MM/dd") %> <%= Model.Visible? "":", Invisible!" %>) <%= Html.ActionLink("Supprimer","RemovePost", new { user=Model.Author, title = Model.Title }, new { @class="actionlink" } ) %>
</div>
</asp:Content>

View file

@ -8,7 +8,7 @@
<%= Html.LabelFor(model => model.Titles) %> :
<%= Html.TextBox( "Titles" ) %>
<%= Html.ValidationMessage("Titles", "*") %><br/>
<%= Html.Hidden("UserName") %>
<%= Html.Hidden("Author") %>
<label for="confirm">supprimer le billet</label>
<%= Html.CheckBox( "confirm" ) %>
<%= Html.ValidationMessage("AgreeToRemove", "*") %>

View file

@ -6,8 +6,8 @@
<h1 class="blogtitle"><% if (ViewData["Avatar"]!=null) { %>
<img src="<%=ViewData["Avatar"]%>" alt="" id="logo"/>
<% } %>
<%= Html.ActionLink(Model.Title,"UserPost", new{user=Model.UserName, title = Model.Title}, null) %>
<span> - <%= Html.ActionLink((string)ViewData ["BlogTitle"] ,"UserPosts",new{user=Model.UserName}, null) %>
<%= Html.ActionLink(Model.Title,"UserPost", new{user=Model.Author, title = Model.Title}, null) %>
<span> - <%= Html.ActionLink((string)ViewData ["BlogTitle"] ,"UserPosts",new{user=Model.Author}, null) %>
</span>
<span> -
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority%>"><%= YavscHelpers.SiteName %></a>
@ -18,10 +18,10 @@
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<% foreach (var be in Model) { %>
<div class="blogpost">
<%= Html.Markdown(be.Content) %>
<%= Html.Markdown(be.Content,"/bfiles/"+be.Id+"/") %>
</div>
<% if (Membership.GetUser()!=null) {
if (Membership.GetUser().UserName==be.UserName)
if (Membership.GetUser().UserName==be.Author)
{ %> <div class="metapost">
<%= Html.ActionLink("Editer","Edit", new { id = be.Id }, new { @class="actionlink" }) %>
<%= Html.ActionLink("Supprimer","RemovePost", new { id = be.Id }, new { @class="actionlink" } ) %>
@ -31,13 +31,13 @@
<% foreach (var c in (Comment[]) BlogManager.GetComments(be.Id)) { %>
<div class="comment" style="min-height:32px;"> <img style="clear:left;float:left;max-width:32px;max-height:32px;margin:.3em;" src="/Blogs/Avatar/<%=c.From%>" alt="<%=c.From%>"/>
<%= Html.Markdown(c.CommentText) %>
<% if ( username == Model.UserName || c.From == username ) { %>
<% if ( username == Model.Author || c.From == username ) { %>
<%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } , new { @class="actionlink" })%>
<% } %>
</div><% } %>
<div class="postcomment">
<% using (Html.BeginForm("Comment","Blogs")) { %>
<%=Html.Hidden("UserName")%>
<%=Html.Hidden("Author")%>
<%=Html.Hidden("Title")%>
<%=Html.TextArea("CommentText","")%>
<%=Html.Hidden("PostId",be.Id)%>

View file

@ -20,11 +20,11 @@
<% foreach (BlogEntry e in this.Model) { %>
<div <% if (!e.Visible) { %> style="background-color:#022;" <% } %>>
<h2 class="blogtitle" ><%= Html.ActionLink(e.Title,"UserPost", new { user=e.UserName, title=e.Title, id = e.Id }, new { @class = "usertitleref actionlink" , style="display:block;"}) %></h2>
<h2 class="blogtitle" ><%= Html.ActionLink(e.Title,"UserPost", new { user=e.Author, title=e.Title, id = e.Id }, new { @class = "usertitleref actionlink" , style="display:block;"}) %></h2>
<div class="metablog">(<%= e.Posted.ToString("yyyy/MM/dd") %>
- <%= e.Modified.ToString("yyyy/MM/dd") %> <%= e.Visible? "":", Invisible!" %>)
<% if (Membership.GetUser()!=null)
if (Membership.GetUser().UserName==e.UserName)
if (Membership.GetUser().UserName==e.Author)
{ %>
<%= Html.ActionLink("Editer","Edit", new { id = e.Id }, new { @class="actionlink" }) %>
<%= Html.ActionLink("Supprimer","RemovePost", new { id = e.Id }, new { @class="actionlink" } ) %>