Bug & layout fixes
* Index.aspx: * Title.aspx: * YavscModel.csproj: * BlogEntry.cs: * yavsc.scrollnotif.js: * AccountController.cs: * BlogEntryCollection.cs: refactoring * yavsc.tags.js: Implements a js call to the tag & untag methods * PostActions.ascx: a better html structure * BasePost.cs: refactoring: allows the "PostActions" user control to use a common base object as post reference * NpgsqlBlogProvider.cs: implements the tag methods on db * ResultPages.cs: A multi-pages result meta info when one page only * yavsc.circles.js: * AccountController.cs: code formatting * BlogsController.cs: Untag a post * style.css: yastyle, yet a better one. * BlogsController.cs: View the Title after edition * App.master: * UserPosts.aspx: a nicer html structure * yavsc.js: Fixes notice & dimiss js * Login.aspx: refactoring * Edit.aspx: better html * UserPost.aspx: A promess to be allowed to tag. * Web.csproj: Adds yavsc.tags.js and yavsc.scrollnotifs.js to the project decription. * BlogManager.cs: Makes the blog manager expose of the new `UnTag` method * BlogProvider.cs: introduces a method to `untag` * FindBlogEntryFlags.cs: Find post entry by tag * LocalizedText.resx: * LocalizedText.Designer.cs: new translations: - "Tag" - "Edit" * LocalizedText.fr.resx: * LocalizedText.fr.Designer.cs: nouvelles traductions: - "Tag" - "Edit" * Profile.cs: a nicer stack trace at buggy usage
This commit is contained in:
parent
c962998aaa
commit
d04a68db01
41 changed files with 894 additions and 270 deletions
|
|
@ -39,10 +39,11 @@ namespace Yavsc.ApiControllers
|
|||
/// Register the specified model.
|
||||
/// </summary>
|
||||
/// <param name="model">Model.</param>
|
||||
[Authorize()]
|
||||
[Authorize ()]
|
||||
[ValidateAjaxAttribute]
|
||||
public HttpResponseMessage Register ([FromBody] RegisterClientModel model)
|
||||
{
|
||||
|
||||
if (ModelState.IsValid) {
|
||||
if (model.IsApprouved)
|
||||
if (!Roles.IsUserInRole ("Admin"))
|
||||
|
|
@ -54,32 +55,32 @@ namespace Yavsc.ApiControllers
|
|||
}
|
||||
MembershipCreateStatus mcs;
|
||||
var user = Membership.CreateUser (
|
||||
model.UserName,
|
||||
model.Password,
|
||||
model.Email,
|
||||
model.Question,
|
||||
model.Answer,
|
||||
model.IsApprouved,
|
||||
out mcs);
|
||||
model.UserName,
|
||||
model.Password,
|
||||
model.Email,
|
||||
model.Question,
|
||||
model.Answer,
|
||||
model.IsApprouved,
|
||||
out mcs);
|
||||
switch (mcs) {
|
||||
case MembershipCreateStatus.DuplicateEmail:
|
||||
ModelState.AddModelError ("Email", "Cette adresse e-mail correspond " +
|
||||
"à un compte utilisateur existant");
|
||||
"à un compte utilisateur existant");
|
||||
break;
|
||||
case MembershipCreateStatus.DuplicateUserName:
|
||||
ModelState.AddModelError ("UserName", "Ce nom d'utilisateur est " +
|
||||
"déjà enregistré");
|
||||
"déjà enregistré");
|
||||
break;
|
||||
case MembershipCreateStatus.Success:
|
||||
if (!model.IsApprouved)
|
||||
Url.SendActivationMessage (user);
|
||||
ProfileBase prtu = ProfileBase.Create (model.UserName);
|
||||
prtu.SetPropertyValue("Name",model.Name);
|
||||
prtu.SetPropertyValue("Address",model.Address);
|
||||
prtu.SetPropertyValue("CityAndState",model.CityAndState);
|
||||
prtu.SetPropertyValue("Mobile",model.Mobile);
|
||||
prtu.SetPropertyValue("Phone",model.Phone);
|
||||
prtu.SetPropertyValue("ZipCode",model.ZipCode);
|
||||
prtu.SetPropertyValue ("Name", model.Name);
|
||||
prtu.SetPropertyValue ("Address", model.Address);
|
||||
prtu.SetPropertyValue ("CityAndState", model.CityAndState);
|
||||
prtu.SetPropertyValue ("Mobile", model.Mobile);
|
||||
prtu.SetPropertyValue ("Phone", model.Phone);
|
||||
prtu.SetPropertyValue ("ZipCode", model.ZipCode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -88,15 +89,12 @@ namespace Yavsc.ApiControllers
|
|||
return DefaultResponse ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resets the password.
|
||||
/// </summary>
|
||||
/// <param name="model">Model.</param>
|
||||
[ValidateAjax]
|
||||
public void ResetPassword(LostPasswordModel model)
|
||||
public void ResetPassword (LostPasswordModel model)
|
||||
{
|
||||
StringDictionary errors;
|
||||
MembershipUser user;
|
||||
|
|
@ -108,4 +106,3 @@ namespace Yavsc.ApiControllers
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,9 +40,19 @@ namespace Yavsc.ApiControllers
|
|||
/// </summary>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="tag">Tag.</param>
|
||||
public long Tag (long postid,string tag) {
|
||||
public void Tag (long postid,string tag) {
|
||||
BlogManager.GetForEditing (postid);
|
||||
return BlogManager.Tag (postid, tag);
|
||||
BlogManager.Tag (postid, tag);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Untag the specified postid and tag.
|
||||
/// </summary>
|
||||
/// <param name="postid">Postid.</param>
|
||||
/// <param name="tag">Tag.</param>
|
||||
public void Untag (long postid,string tag) {
|
||||
BlogManager.GetForEditing (postid);
|
||||
BlogManager.Untag (postid, tag);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -57,6 +67,7 @@ namespace Yavsc.ApiControllers
|
|||
throw new AuthorizationDenied (user);
|
||||
BlogManager.RemoveTitle (user, title);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the tag.
|
||||
/// </summary>
|
||||
|
|
@ -65,6 +76,7 @@ namespace Yavsc.ApiControllers
|
|||
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The allowed media types.
|
||||
/// </summary>
|
||||
|
|
@ -125,9 +137,9 @@ namespace Yavsc.ApiControllers
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Searchs the files accociated to the given post id,
|
||||
/// or related to the given terms.
|
||||
/// Searchs the file.
|
||||
/// </summary>
|
||||
/// <returns>The file.</returns>
|
||||
/// <param name="postid">Postid.</param>
|
||||
|
|
@ -165,7 +177,8 @@ namespace Yavsc.ApiControllers
|
|||
try
|
||||
{
|
||||
// Read the form data.
|
||||
IEnumerable<HttpContent> data = await Request.Content.ReadAsMultipartAsync(provider) ;
|
||||
//IEnumerable<HttpContent> data =
|
||||
await Request.Content.ReadAsMultipartAsync(provider) ;
|
||||
|
||||
var invalidChars = Path.GetInvalidFileNameChars();
|
||||
List<string> bodies = new List<string>();
|
||||
|
|
@ -182,10 +195,7 @@ namespace Yavsc.ApiControllers
|
|||
FileInfo fp = new FileInfo (Path.Combine(root,filename));
|
||||
if (fi.Exists) fi.Delete();
|
||||
fp.MoveTo(fi.FullName);
|
||||
// Get the mime type
|
||||
|
||||
|
||||
|
||||
// TODO Get the mime type
|
||||
using (Process p = new Process ()) {
|
||||
p.StartInfo.WorkingDirectory = root;
|
||||
p.StartInfo = new ProcessStartInfo ();
|
||||
|
|
|
|||
|
|
@ -8,13 +8,8 @@ body {
|
|||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
.iconsmall { max-height: 1.3em; max-width: 1.3em; }
|
||||
|
||||
input, textarea, checkbox {
|
||||
color: #FFFFA0;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
.photo { width: 100%; }
|
||||
.blogbanner { float: left; top:0; }
|
||||
|
|
@ -76,7 +71,7 @@ legend {
|
|||
footer p { display:inline-block; }
|
||||
|
||||
footer img { max-height: 2em; vertical-align: middle; }
|
||||
a.actionlink img, h1 img, .menuitem img { vertical-align: middle; }
|
||||
a img, h1 img, .menuitem img { max-height: 1em; vertical-align: middle; }
|
||||
|
||||
#gspacer {
|
||||
background-color: rgba(20,20,20,.8);
|
||||
|
|
@ -116,7 +111,7 @@ aside {
|
|||
margin:1em;
|
||||
padding:1em;
|
||||
background-color: rgba(0,0,32,0.8);
|
||||
color: #aaa;
|
||||
color: #eee;
|
||||
border-radius:10px;
|
||||
}
|
||||
.hiddenpost { background-color: rgba(16,16,16,0.5); }
|
||||
|
|
@ -167,14 +162,13 @@ content: ")";
|
|||
|
||||
|
||||
.usertitleref {
|
||||
color: #B0B080;
|
||||
border-radius: 5px;
|
||||
background-color:rgba(0,0,32,0.6);
|
||||
font-family: 'Arial', cursive;
|
||||
padding: 1em;
|
||||
}
|
||||
a:visited {
|
||||
color: #90B090;
|
||||
color: #E0E0E0;
|
||||
}
|
||||
label {
|
||||
font-size: medium;
|
||||
|
|
@ -186,7 +180,8 @@ label {
|
|||
border: dashed rgb(020,20,256) 2px;
|
||||
}
|
||||
#notifications {
|
||||
padding: .5em;
|
||||
margin: 2em;
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
.notification {
|
||||
|
|
@ -227,30 +222,33 @@ a {
|
|||
}
|
||||
|
||||
.actionlink, .menuitem, a {
|
||||
color: #B0B080;
|
||||
display:inline-block;
|
||||
color: white;
|
||||
border-radius:1em;
|
||||
border: solid black 1px;
|
||||
background-color: rgba(20,20,20,.8);
|
||||
cursor: pointer;
|
||||
font-family: 'Arial', cursive;
|
||||
padding: .2em;
|
||||
display: inline-block;
|
||||
padding: 1em;
|
||||
margin:1em;
|
||||
}
|
||||
|
||||
input, select {
|
||||
color: #B0B080;
|
||||
input, select, textarea {
|
||||
color: white;
|
||||
background-color:rgba(0,0,64,0.8);
|
||||
border: solid 1px rgb(128,128,128);
|
||||
border-radius:1em;
|
||||
background-color:rgba(0,0,32,0.8);
|
||||
font-family: 'Arial', cursive;
|
||||
font-family: 'Arial', cursive;
|
||||
}
|
||||
|
||||
|
||||
.actionlink:hover, fa:hover, .menuitem:hover, a:hover, input:hover {
|
||||
.actionlink:hover, fa:hover, .menuitem:hover, a:hover {
|
||||
background-color:rgba(30,0,124,0.9);
|
||||
border: solid green 1px;
|
||||
}
|
||||
|
||||
input:hover, textarea:hover {
|
||||
color: white;
|
||||
background-color:rgba(64,64,64,0.8);
|
||||
}
|
||||
.code {
|
||||
font-family: "monospace";
|
||||
background-color: rgba(0,0,256,0.1);
|
||||
|
|
@ -273,14 +271,6 @@ input, select {
|
|||
font-size: smaller;
|
||||
}
|
||||
|
||||
|
||||
.menuitem {
|
||||
border-radius:5px;
|
||||
margin:.5em;
|
||||
padding:.5em;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.onhover {
|
||||
display:none;
|
||||
position: absolute;
|
||||
|
|
@ -300,7 +290,7 @@ input, select {
|
|||
.c3 { font-size: x-small; font-style: italic; }
|
||||
@media print {
|
||||
body {background-color:white;color:black;}
|
||||
.control,.actionlink,nav { display:none;}
|
||||
.control, .actionlink, .menuitem, nav { display:none;}
|
||||
}
|
||||
|
||||
.bshpanel { display:block; }
|
||||
|
|
|
|||
|
|
@ -1,3 +1,38 @@
|
|||
2015-10-13 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* Index.aspx:
|
||||
* Title.aspx:
|
||||
* yavsc.scrollnotif.js:
|
||||
* AccountController.cs: refactoring
|
||||
|
||||
* yavsc.tags.js: Implements a js call
|
||||
to the tag & untag methods
|
||||
|
||||
* PostActions.ascx: a better html structure
|
||||
|
||||
* yavsc.circles.js:
|
||||
* AccountController.cs: code formatting
|
||||
|
||||
* BlogsController.cs: Untag a post
|
||||
|
||||
* style.css: yastyle, yet a better one.
|
||||
|
||||
* BlogsController.cs: View the Title after edition
|
||||
|
||||
* App.master:
|
||||
* UserPosts.aspx: a nicer html structure
|
||||
|
||||
* yavsc.js: Fixes notice & dimiss js
|
||||
|
||||
* Login.aspx: refactoring
|
||||
|
||||
* Edit.aspx: better html
|
||||
|
||||
* UserPost.aspx: A promess to be allowed to tag.
|
||||
|
||||
* Web.csproj: Adds yavsc.tags.js and yavsc.scrollnotifs.js to
|
||||
the project decription.
|
||||
|
||||
2015-10-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* Web.csproj:
|
||||
|
|
|
|||
|
|
@ -92,12 +92,15 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers the form.
|
||||
/// Gets the registration form.
|
||||
/// </summary>
|
||||
/// <returns>The form.</returns>
|
||||
public ActionResult RegisterForm()
|
||||
/// <returns>The register.</returns>
|
||||
/// <param name="model">Model.</param>
|
||||
/// <param name="returnUrl">Return URL.</param>
|
||||
public ActionResult GetRegister(RegisterViewModel model, string returnUrl)
|
||||
{
|
||||
return View ("Register");
|
||||
ViewData ["returnUrl"] = returnUrl;
|
||||
return View ("Register",model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -109,11 +112,6 @@ namespace Yavsc.Controllers
|
|||
public ActionResult Register (RegisterViewModel model, string returnUrl)
|
||||
{
|
||||
ViewData ["returnUrl"] = returnUrl;
|
||||
if (Request.RequestType == "GET") {
|
||||
foreach (string k in ModelState.Keys)
|
||||
ModelState [k].Errors.Clear ();
|
||||
return View (model);
|
||||
}
|
||||
|
||||
if (ModelState.IsValid) {
|
||||
if (model.ConfirmPassword != model.Password) {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace Yavsc.Controllers
|
|||
/// <summary>
|
||||
/// Title the specified title, pageIndex and pageSize.
|
||||
/// </summary>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="id">Title.</param>
|
||||
/// <param name="pageIndex">Page index.</param>
|
||||
/// <param name="pageSize">Page size.</param>
|
||||
///
|
||||
|
|
@ -289,7 +289,7 @@ namespace Yavsc.Controllers
|
|||
model.Id = BlogManager.Post (model.Author, model.Title, model.Content, model.Visible, model.AllowedCircles);
|
||||
if (model.Photo != null)
|
||||
BlogManager.UpdatePostPhoto (model.Id, model.Photo);
|
||||
return RedirectToAction ("UserPosts", new { user = model.Author, title = model.Title });
|
||||
return RedirectToAction ("Title", new { id = model.Title });
|
||||
}
|
||||
ViewData ["AllowedCircles"] =
|
||||
CircleManager.DefaultProvider.List (
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
<script type="text/javascript">
|
||||
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
|
||||
</script>
|
||||
<script src="/Scripts/yavsc.js"></script>
|
||||
<script src="<%=Url.Content("~/Scripts/yavsc.js")%>"></script>
|
||||
<script src="<%=Url.Content("~/Scripts/yavsc.scrollnotif.js")%>"></script>
|
||||
<asp:ContentPlaceHolder id="head" runat="server">
|
||||
</asp:ContentPlaceHolder>
|
||||
</head>
|
||||
|
|
@ -46,6 +47,7 @@ Yavsc.notice('<%=notice%>');
|
|||
</header>
|
||||
<nav data-type="background" data-speed="2">
|
||||
<% if (Membership.GetUser()==null) { %>
|
||||
|
||||
<a href="<%= Url.Content("~/Account/Login/?returnUrl=") + Url.Encode( Request.Url.PathAndQuery )%>" class="menuitem" >
|
||||
<i class="fa fa-sign-in">Connexion</i>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ function removeCircle() {
|
|||
else Yavsc.notice(false);
|
||||
}}});
|
||||
}
|
||||
|
||||
function modifyCircle() {
|
||||
Yavsc.notice(false);
|
||||
var id = $('#id').val();
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@ self.showHide = function () {
|
|||
$(this).html(this.oldhtml);
|
||||
}
|
||||
};
|
||||
self.dimiss = function () {
|
||||
|
||||
self.dimiss = function () {
|
||||
$(this).parent().remove();
|
||||
}
|
||||
self.notice = function (msg, msgok) {
|
||||
};
|
||||
|
||||
self.notice = function (msg, msgok) {
|
||||
if (!msgok) msgok='Ok';
|
||||
if (msg) {
|
||||
var note = $('<div class="notification">'+msg+'<br></div>');
|
||||
|
|
@ -40,12 +42,14 @@ self.showHide = function () {
|
|||
errspan.innerHTML=value.errors.join("<br/>");
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
self.onAjaxError = function (xhr, ajaxOptions, thrownError) {
|
||||
if (xhr.status!=400)
|
||||
Yavsc.notice(xhr.status+" : "+xhr.responseText);
|
||||
else Yavsc.notice(false);
|
||||
}
|
||||
};
|
||||
|
||||
return self;
|
||||
})();
|
||||
|
||||
|
|
|
|||
37
web/Scripts/yavsc.scrollnotif.js
Normal file
37
web/Scripts/yavsc.scrollnotif.js
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
//
|
||||
// parralax.js
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paul@pschneider.fr>
|
||||
//
|
||||
// Copyright (c) 2015 GNU GPL
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
$(document).ready(function(){
|
||||
var $window = $(window);
|
||||
$(window).scroll(function() {
|
||||
var $ns = $('#notifications');
|
||||
if ($ns.has('*').length>0) {
|
||||
if ($window.scrollTop()>375) {
|
||||
$ns.css('position','fixed');
|
||||
$ns.css('z-index',2);
|
||||
$ns.css('top',0);
|
||||
}
|
||||
else {
|
||||
$ns.css('position','static');
|
||||
$ns.css('z-index',1);
|
||||
}}
|
||||
});
|
||||
});
|
||||
32
web/Scripts/yavsc.tags.js
Normal file
32
web/Scripts/yavsc.tags.js
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
var Tags = (function(apiBaseUrl){
|
||||
var self = {};
|
||||
self.blogsApiUrl = (apiBaseUrl || '/api') + "/Blogs";
|
||||
|
||||
self.tag = function (postid,tagname,callback) {
|
||||
$.ajax({
|
||||
url: CirclesApiUrl+"/Tag",
|
||||
type: "POST",
|
||||
data: { postid: postid, tag: tagname },
|
||||
success: function () {
|
||||
if (callback) callback(postid,tagname);
|
||||
},
|
||||
statusCode: {
|
||||
400: Yavsc.onAjaxBadInput
|
||||
},
|
||||
error: Yavsc.onAjaxError});
|
||||
}
|
||||
self.untag = function (postid,tagname,callback) {
|
||||
$.ajax({
|
||||
url: CirclesApiUrl+"/Untag",
|
||||
type: "POST",
|
||||
data: { postid: postid, tag: tagname },
|
||||
success: function () {
|
||||
if (callback) callback(postid,tagname);
|
||||
},
|
||||
statusCode: {
|
||||
400: Yavsc.onAjaxBadInput
|
||||
},
|
||||
error: Yavsc.onAjaxError});
|
||||
}
|
||||
return self;
|
||||
})();
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
#if TEST
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using Npgsql;
|
||||
using System.Web.Configuration;
|
||||
|
||||
namespace Yavsc
|
||||
{
|
||||
[TestFixture ()]
|
||||
public class TestByteA: IDisposable
|
||||
{
|
||||
string cnxName = "yavsc";
|
||||
|
||||
string ConnectionString { get {
|
||||
return "Server=127.0.0.1;Port=5432;Database=YavscDev;User Id=yavscdev;Password=admin;Encoding=Unicode;" ;
|
||||
// Why? not this : return WebConfigurationManager.ConnectionStrings [cnxName].ConnectionString;
|
||||
|
||||
} }
|
||||
|
||||
[TestFixtureSetUp]
|
||||
public void Init()
|
||||
{
|
||||
// create the table
|
||||
Console.WriteLine ("cnx:"+ConnectionString);
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (ConnectionString))
|
||||
{
|
||||
cnx.Open ();
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "drop table _testbytea";
|
||||
try { cmd.ExecuteNonQuery (); }
|
||||
catch (NpgsqlException) {
|
||||
}
|
||||
cmd.CommandText = "create table _testbytea( t bytea )";
|
||||
cmd.ExecuteNonQuery ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test(Description="Test storing a byte array in a Postgresql table field")]
|
||||
public void TestStoreByteA ()
|
||||
{
|
||||
byte []a = new byte[3];
|
||||
a[0]=1;
|
||||
a[1]=2;
|
||||
a[2]=3;
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (ConnectionString)) {
|
||||
cnx.Open ();
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ())
|
||||
{
|
||||
cmd.CommandText = "insert into _testbytea (t) values (@tv)";
|
||||
cmd.Parameters.AddWithValue ("@tv", a);
|
||||
cmd.ExecuteNonQuery ();
|
||||
}
|
||||
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ())
|
||||
{
|
||||
cmd.CommandText = "select t from _testbytea";
|
||||
cmd.Parameters.AddWithValue ("@tv", a);
|
||||
|
||||
NpgsqlDataReader rdr = cmd.ExecuteReader ();
|
||||
if (!rdr.Read ())
|
||||
throw new Exception ("Read failed");
|
||||
int i = rdr.GetOrdinal ("t");
|
||||
byte []rded = (byte[]) rdr.GetValue (i);
|
||||
if (rded.Length!=a.Length)
|
||||
throw new Exception("Lengthes don't match");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region IDisposable implementation
|
||||
|
||||
[TestFixtureTearDown]
|
||||
public void Dispose ()
|
||||
{
|
||||
// drop the table
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (ConnectionString)) {
|
||||
cnx.Open ();
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "drop table _testbytea";
|
||||
cmd.ExecuteNonQuery ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -20,7 +20,7 @@
|
|||
<input type="submit"/>
|
||||
<% } %></div>
|
||||
<div class="panel">
|
||||
<%= Html.ActionLink("S'enregistrer","RegisterForm",new {returnUrl=ViewData["returnUrl"]}, new { @class="actionlink" }) %>
|
||||
<%= Html.ActionLink("S'enregistrer","GetRegister",new {returnUrl=ViewData["returnUrl"]}, new { @class="actionlink" }) %>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority + "/Google/Login"%>?returnUrl=<%=ViewData["returnUrl"]==null?Request.Url.PathAndQuery:(string)ViewData["returnUrl"]%>" class="actionlink">
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ var data = new FormData($('#frmajax').get()[0]);
|
|||
</script>
|
||||
<form id="frmajax">
|
||||
<fieldset>
|
||||
<legend>Fichiers attachés</legend>
|
||||
<legend>Attacher des fichiers</legend>
|
||||
<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()">
|
||||
|
|
@ -214,6 +214,11 @@ var data = new FormData($('#frmajax').get()[0]);
|
|||
<%= Html.ListBox("AllowedCircles") %>
|
||||
<%= Html.ValidationMessage("AllowedCircles", "*") %>
|
||||
</fieldset>
|
||||
<span id="viewsource">
|
||||
<i class="fa fa-code menuitem"><%=Html.Translate("View_source")%></i></span>
|
||||
<span id="hidesource" class="hidden">
|
||||
<i class="fa fa-code menuitem"><%=Html.Translate("Hide_source")%></i>
|
||||
</span>
|
||||
<fieldset id="source" class="hidden">
|
||||
<%=Html.Hidden("Author")%>
|
||||
<%=Html.Hidden("Id")%>
|
||||
|
|
@ -226,14 +231,10 @@ var data = new FormData($('#frmajax').get()[0]);
|
|||
<%=Html.TextArea("Content")%>
|
||||
<%=Html.ValidationMessage("Content")%>
|
||||
</fieldset>
|
||||
<i class="af af-check actionlink"><input type="submit" id="validate" value="Valider"></i>
|
||||
<input type="submit" id="validate" value="Valider" class="fa fa-check menuitem">
|
||||
<% } %>
|
||||
|
||||
<span id="viewsource" class="actionlink">
|
||||
<i class="fa fa-code">View Source</i></span>
|
||||
<span id="hidesource" class="actionlink hidden">
|
||||
<i class="fa fa-code">Hide Source</i>
|
||||
</span>
|
||||
|
||||
<aside>
|
||||
Id:<%= Html.ActionLink( Model.Id.ToString() , "UserPost", new { user= Model.Author, title=Model.Title, id = Model.Id }, new { @class = "usertitleref actionlink" }) %>
|
||||
, Posted: <%= Model.Posted.ToString("yyyy/MM/dd") %> - Modified: <%= Model.Modified.ToString("yyyy/MM/dd") %>
|
||||
|
|
|
|||
|
|
@ -8,16 +8,7 @@
|
|||
<% foreach (var p in g) { %>
|
||||
<div class="postpreview">
|
||||
<p><%= Html.Markdown(p.Intro,"/bfiles/"+p.Id+"/") %></p>
|
||||
<aside>
|
||||
(Posté le <%=p.Posted.ToString("D") %>)
|
||||
|
||||
<% if (Membership.GetUser()!=null)
|
||||
if ((Membership.GetUser().UserName==g.Key)
|
||||
|| (Roles.IsUserInRole ("Admin")))
|
||||
{ %>
|
||||
<%= Html.ActionLink("Editer","Edit", new { id = p.Id }, new { @class="actionlink" }) %>
|
||||
<%= Html.ActionLink("Supprimer","RemovePost", new { id = p.Id }, new { @class="actionlink" } ) %>
|
||||
<% } %> </aside>
|
||||
<%= Html.Partial("PostActions",p)%>
|
||||
</div> <% } %>
|
||||
<% } %>
|
||||
</div>
|
||||
|
|
|
|||
15
web/Views/Blogs/PostActions.ascx
Normal file
15
web/Views/Blogs/PostActions.ascx
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BasePost>" %>
|
||||
<aside>
|
||||
(<%= Model.Posted.ToString("yyyy/MM/dd") %>
|
||||
- <%= Model.Modified.ToString("yyyy/MM/dd") %> <%= Model.Visible? "":", Invisible!" %>)
|
||||
<% if (Membership.GetUser()!=null) {
|
||||
if (Membership.GetUser().UserName==Model.Author || Roles.IsUserInRole("Admin"))
|
||||
{ %>
|
||||
<i class="fa fa-tag"><%=Html.Translate("DoTag")%></i>
|
||||
<a href="<%= Url.RouteUrl("Default", new { action = "Edit", controller = "Blogs", id = Model.Id })%>" class="actionlink">
|
||||
<i class="fa fa-pencil"><%=Html.Translate("Edit")%></i>
|
||||
</a>
|
||||
<a href="<%= Url.RouteUrl("Default", new { action = "RemovePost", controller = "Blogs", id = Model.Id })%>" class="actionlink">
|
||||
<i class="fa fa-remove"><%=Html.Translate("Remove")%></i></a>
|
||||
<% }} %>
|
||||
</aside>
|
||||
|
|
@ -16,30 +16,19 @@
|
|||
<div class="post<% if (!e.Visible) { %> hiddenpost<% } %>" >
|
||||
<% if (e.Photo!=null) { %><img src="<%=e.Photo%>" alt="" class="photo"><% } %>
|
||||
<%= Html.Markdown(e.Content,"/bfiles/"+e.Id+"/") %>
|
||||
|
||||
<aside class="hidden">(<%= e.Posted.ToString("yyyy/MM/dd") %>
|
||||
- <%= e.Modified.ToString("yyyy/MM/dd") %> <%= e.Visible? "":", Invisible!" %>)
|
||||
<% if (Membership.GetUser()!=null)
|
||||
if (Membership.GetUser().UserName==e.Author || Roles.IsUserInRole("Admin") )
|
||||
{ %>
|
||||
<%= Html.ActionLink("Editer","Edit", new { id = e.Id }, new { @class="actionlink" }) %>
|
||||
<%= Html.ActionLink("Supprimer","RemovePost", new { id = e.Id }, new { @class="actionlink" } ) %>
|
||||
<% } %>
|
||||
</aside>
|
||||
<%= Html.Partial("PostActions",e)%>
|
||||
</div>
|
||||
<% } %>
|
||||
<aside>
|
||||
<form runat="server" id="form1" method="GET">
|
||||
<%
|
||||
if (((int) ViewData["RecordCount"]) > ((int) ViewData["PageSize"])) {
|
||||
rp1.ResultCount = (int) ViewData["RecordCount"];
|
||||
rp1.PageIndex = (int) ViewData["PageIndex"];
|
||||
rp1.PageSize = (int) ViewData["PageSize"];
|
||||
%>
|
||||
%><aside><form runat="server" id="form1">
|
||||
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server">
|
||||
<None><i>Pas de contenu</i></None>
|
||||
</yavsc:ResultPages>
|
||||
</form>
|
||||
</aside>
|
||||
|
||||
|
||||
<% } %>
|
||||
</asp:Content>
|
||||
|
|
|
|||
|
|
@ -35,14 +35,15 @@
|
|||
<% if (Model.Author == username || c.From == username ) { %>
|
||||
<%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } , new { @class="actionlink" })%>
|
||||
<% } %>
|
||||
|
||||
|
||||
</div><% } %>
|
||||
|
||||
|
||||
<% if (Membership.GetUser()!=null) {
|
||||
if (Membership.GetUser().UserName==be.Author)
|
||||
{ %> <div class="control">
|
||||
<%= Html.ActionLink("Editer","Edit", new { id = be.Id }, new { @class="actionlink" }) %>
|
||||
<%= Html.ActionLink("Supprimer","RemovePost", new { id = be.Id }, new { @class="actionlink" } ) %>
|
||||
<i class="fa fa-tag">Tagger</i>
|
||||
</div> <% } %>
|
||||
|
||||
<aside class="control">
|
||||
|
|
|
|||
|
|
@ -25,19 +25,10 @@
|
|||
<% bool truncated = false; %>
|
||||
<%= Html.MarkdownToHtmlIntro(out truncated, e.Content,"/bfiles/"+e.Id+"/") %>
|
||||
<% if (truncated) { %>
|
||||
<i><%= Html.ActionLink( "lire la suite" ,"UserPost", new { user=e.Author, title=e.Title, id = e.Id }, new { @class = "usertitleref" }) %></i>
|
||||
<a href="<%= Url.RouteUrl( "View", new { action="Title", title=e.Title}) %>">
|
||||
<i>Html.Translate("ReadMore")</i></a>
|
||||
<% } %>
|
||||
<aside>(<%= e.Posted.ToString("yyyy/MM/dd") %>
|
||||
- <%= e.Modified.ToString("yyyy/MM/dd") %> <%= e.Visible? "":", Invisible!" %>)
|
||||
<% if (Membership.GetUser()!=null)
|
||||
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" } ) %>
|
||||
<% } %>
|
||||
|
||||
|
||||
</aside>
|
||||
<%= Html.Partial("PostActions",e)%>
|
||||
</div>
|
||||
<% } %>
|
||||
<aside>
|
||||
|
|
|
|||
|
|
@ -141,6 +141,8 @@
|
|||
<Folder Include="bfiles\" />
|
||||
<Folder Include="fonts\" />
|
||||
<Folder Include="lib\" />
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Test\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
|
|
@ -150,7 +152,6 @@
|
|||
<Compile Include="Controllers\AccountController.cs" />
|
||||
<Compile Include="Controllers\BlogsController.cs" />
|
||||
<Compile Include="AssemblyInfo.cs" />
|
||||
<Compile Include="Test\TestByteA.cs" />
|
||||
<Compile Include="Controllers\FrontOfficeController.cs" />
|
||||
<Compile Include="Controllers\BackOfficeController.cs" />
|
||||
<Compile Include="Admin\Export.cs" />
|
||||
|
|
@ -429,6 +430,9 @@
|
|||
<Content Include="images\musician-923526_1.nbb.xs.jpg" />
|
||||
<Content Include="images\musician-923526_1.nbb.xxs.jpg" />
|
||||
<Content Include="Views\Blogs\Title.aspx" />
|
||||
<Content Include="Views\Blogs\PostActions.ascx" />
|
||||
<Content Include="Scripts\yavsc.tags.js" />
|
||||
<Content Include="Scripts\yavsc.scrollnotif.js" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
|
@ -493,7 +497,7 @@
|
|||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="instdbws.sql" />
|
||||
<EmbeddedResource Include="App_Data\instdbws.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WebReferences Include="Web References" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue