* Presta.csproj: A first class
* AssemblyInfo.cs: initial commit * NpgsqlCircleProvider.cs: circle members are now stored in bd upon their user's name * InputCircle.cs: fixes the new CircleManager interface usage * Yavsc.sln: Adds the `Presta` project * CircleController.cs: * Authorize some Http methods * Lists circles as circles * style.css: Fixes the missing "hidden" css class * AccountController.cs: using the new Circle provider interface * BlogsController.cs: * using the new Circle provider interface * do not test blog entry collections in order to group them by a unique user name or title, it's too bad, instead, keep user's request id as guide to model and view. * YavscHelpers.cs: Adds a Circle Html formatter * Circles.aspx: List of circles is now given as a list of `Circle` objects * instdbws.sql: fixes the db in order to store user names in circle member's records. * BlogEntryCollection.cs: ConcernsAUniqueTitle and ConcernsAUniqueUser are now Obsoletes * UUTBlogEntryCollection.cs: Drops a useless ctor * CircleProvider.cs: The `CircleManager` now delivers the user's circle as a `Circle` object collection.
This commit is contained in:
@ -1,3 +1,7 @@
|
||||
2015-08-20 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* Yavsc.sln: Adds the `Presta` project
|
||||
|
||||
2015-08-14 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* README.md: blanked: not clear enough
|
||||
|
@ -1,3 +1,8 @@
|
||||
2015-08-20 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* NpgsqlCircleProvider.cs: circle members are now stored in bd
|
||||
upon their user's name
|
||||
|
||||
2015-08-04 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
|
||||
|
@ -179,8 +179,7 @@ namespace WorkFlowProvider
|
||||
cmd.Prepare ();
|
||||
if (users!=null)
|
||||
foreach (string user in users) {
|
||||
object pkid = Membership.GetUser (user).ProviderUserKey;
|
||||
cmd.Parameters[1].Value = pkid.ToString();
|
||||
cmd.Parameters[1].Value = user;
|
||||
cmd.ExecuteNonQuery ();
|
||||
}
|
||||
}
|
||||
@ -190,7 +189,7 @@ namespace WorkFlowProvider
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete the specified owner and title.
|
||||
/// Delete the specified title.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
public override void Delete (long id)
|
||||
@ -209,10 +208,10 @@ namespace WorkFlowProvider
|
||||
/// List user's circles.
|
||||
/// </summary>
|
||||
/// <param name="user">User.</param>
|
||||
public override IEnumerable<ListItem> List (string user)
|
||||
public override IEnumerable<Circle> List (string user)
|
||||
{
|
||||
List<ListItem> cc = new List<ListItem> ();
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
|
||||
List<Circle> cc = new List<Circle> ();
|
||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "select _id, title from circle where owner = :wnr";
|
||||
cmd.Parameters.AddWithValue ("wnr", user);
|
||||
@ -228,13 +227,32 @@ namespace WorkFlowProvider
|
||||
title = rdr.GetString (ottl);
|
||||
long id = (long)rdr.GetInt64 (
|
||||
rdr.GetOrdinal ("_id"));
|
||||
cc.Add (new ListItem { Value = id.ToString(), Text = title} );
|
||||
cc.Add (new Circle { Id = id, Title = title });
|
||||
}
|
||||
}
|
||||
rdr.Close ();
|
||||
}
|
||||
}
|
||||
// select members
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||
cmd.CommandText = "select member from circle_members where circle_id = :cid";
|
||||
cmd.Parameters.Add("cid",NpgsqlDbType.Bigint);
|
||||
cmd.Prepare ();
|
||||
foreach (Circle c in cc) {
|
||||
cmd.Parameters ["cid"].Value = c.Id;
|
||||
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
|
||||
if (rdr.HasRows) {
|
||||
var res = new List<string> ();
|
||||
while (rdr.Read ()) {
|
||||
res.Add (rdr.GetString (0));
|
||||
}
|
||||
c.Members = res.ToArray ();
|
||||
}
|
||||
rdr.Close ();
|
||||
}
|
||||
}
|
||||
}
|
||||
cnx.Close ();
|
||||
|
||||
}
|
||||
return cc;
|
||||
}
|
||||
|
6
Presta/ChangeLog
Normal file
6
Presta/ChangeLog
Normal file
@ -0,0 +1,6 @@
|
||||
2015-08-20 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* Presta.csproj: A first class
|
||||
|
||||
* AssemblyInfo.cs: initial commit
|
||||
|
45
Presta/Presta.csproj
Normal file
45
Presta/Presta.csproj
Normal file
@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{6A312228-9641-478D-916F-4681CC65A35D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Presta</RootNamespace>
|
||||
<AssemblyName>Presta</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\yavscModel\YavscModel.csproj">
|
||||
<Project>{68F5B80A-616E-4C3C-91A0-828AA40000BD}</Project>
|
||||
<Name>YavscModel</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
47
Presta/Properties/AssemblyInfo.cs
Normal file
47
Presta/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,47 @@
|
||||
//
|
||||
// AssemblyInfo.cs
|
||||
//
|
||||
// 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/>.
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle ("Presta")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("GNU GPL")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion ("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
@ -1,3 +1,7 @@
|
||||
2015-08-20 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* InputCircle.cs: fixes the new CircleManager interface usage
|
||||
|
||||
2015-07-15 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* WebControls.csproj: Moves to Mono framework
|
||||
|
@ -154,15 +154,24 @@ namespace Yavsc.WebControls
|
||||
}
|
||||
var u = Membership.GetUser ();
|
||||
if (u != null) {
|
||||
foreach (Yavsc.Model.ListItem ci in CircleManager.DefaultProvider.List(u.UserName)) {
|
||||
foreach (var ci in CircleManager.DefaultProvider.List(u.UserName)) {
|
||||
foreach (SelectListItem sli in Value)
|
||||
if (sli.Value == ci.Value) {
|
||||
if (sli.Value == ci.Id.ToString()) {
|
||||
writer.AddAttribute ("selected", null);
|
||||
break;
|
||||
}
|
||||
writer.AddAttribute ("value", ci.Value );
|
||||
writer.AddAttribute ("value", ci.Id.ToString() );
|
||||
writer.RenderBeginTag ("option");
|
||||
writer.Write (ci.Text);
|
||||
writer.Write (ci.Title);
|
||||
if (ci.Members.Length > 0) {
|
||||
writer.RenderBeginTag ("br");
|
||||
writer.RenderEndTag ();
|
||||
writer.RenderBeginTag ("i");
|
||||
writer.Write (ci.Members [0]);
|
||||
for (int i=1; i<ci.Members.Length; i++)
|
||||
writer.Write (", "+ci.Members [i]);
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "pkg", "pkg\pkg.mdproj", "{C
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestAPI", "TestAPI\TestAPI.csproj", "{42B77C89-BF6D-4DB1-8763-6197F4030A95}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Presta", "Presta\Presta.csproj", "{6A312228-9641-478D-916F-4681CC65A35D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -53,6 +55,10 @@ Global
|
||||
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6A312228-9641-478D-916F-4681CC65A35D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6A312228-9641-478D-916F-4681CC65A35D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6A312228-9641-478D-916F-4681CC65A35D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6A312228-9641-478D-916F-4681CC65A35D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
@ -60,7 +60,8 @@ namespace Yavsc.ApiControllers
|
||||
/// Create the specified circle.
|
||||
/// </summary>
|
||||
/// <param name="model">Model.</param>
|
||||
[Authorize]
|
||||
[Authorize,
|
||||
AcceptVerbs ("POST")]
|
||||
public long Create(NewCircle model)
|
||||
{
|
||||
string user = Membership.GetUser ().UserName;
|
||||
@ -72,7 +73,8 @@ namespace Yavsc.ApiControllers
|
||||
/// </summary>
|
||||
/// <param name="id">Circle Identifier.</param>
|
||||
/// <param name="username">username.</param>
|
||||
[Authorize]
|
||||
[Authorize,
|
||||
AcceptVerbs ("POST")]
|
||||
public void Add(long id, string username)
|
||||
{
|
||||
checkIsOwner (CircleManager.DefaultProvider.Get (id));
|
||||
@ -84,7 +86,9 @@ namespace Yavsc.ApiControllers
|
||||
/// Delete the circle specified by id.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
[Authorize] public void Delete(long id)
|
||||
[Authorize,
|
||||
AcceptVerbs ("GET")]
|
||||
public void Delete(long id)
|
||||
{
|
||||
checkIsOwner (CircleManager.DefaultProvider.Get(id));
|
||||
CircleManager.DefaultProvider.Delete (id);
|
||||
@ -101,7 +105,8 @@ namespace Yavsc.ApiControllers
|
||||
/// Get the circle specified id.
|
||||
/// </summary>
|
||||
/// <param name="id">Identifier.</param>
|
||||
[Authorize]
|
||||
[Authorize,
|
||||
AcceptVerbs ("GET")]
|
||||
public Circle Get(long id)
|
||||
{
|
||||
var c = CircleManager.DefaultProvider.Get (id);
|
||||
@ -112,8 +117,9 @@ namespace Yavsc.ApiControllers
|
||||
/// <summary>
|
||||
/// List the circles
|
||||
/// </summary>
|
||||
[Authorize]
|
||||
public IEnumerable<ListItem> List()
|
||||
[Authorize,
|
||||
AcceptVerbs ("GET")]
|
||||
public IEnumerable<Circle> List()
|
||||
{
|
||||
string user = Membership.GetUser ().UserName;
|
||||
return CircleManager.DefaultProvider.List (user);
|
||||
|
@ -155,6 +155,7 @@ label {
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.hidden { display:none; }
|
||||
|
||||
ul.preview li:nth-child(-n+10) {
|
||||
display:inline;
|
||||
@ -180,6 +181,7 @@ usertitleref {
|
||||
font-family: 'Arial', cursive;
|
||||
font-size: 140%;
|
||||
display:block;
|
||||
padding: .2em;
|
||||
}
|
||||
|
||||
input, select {
|
||||
@ -230,24 +232,25 @@ a.actionlink img { top:4px; }
|
||||
.field-validation-error { color: red; }
|
||||
.c2 { font-size: small; font-style: italic; }
|
||||
.c3 { font-size: x-small; font-style: italic; }
|
||||
|
||||
@media print {
|
||||
body {background-color:white;color:black;}
|
||||
header,footer,.postcomment,.actionlink,.metablog,#login{ display:none;}
|
||||
header,footer,.postcomment,.actionlink,.metablog,#login
|
||||
{ display:none;}
|
||||
}
|
||||
|
||||
@media all and (min-width: 641px) {
|
||||
.bshpanel { display:block; }
|
||||
.bsh { display: none; }
|
||||
.c3 { display:initial; }
|
||||
.c3-alt { display:none; }
|
||||
}
|
||||
|
||||
@media all and (max-width: 640px) {
|
||||
|
||||
.bshpanel { cursor:zoom-in; }
|
||||
|
||||
footer {
|
||||
font-size: x-small;
|
||||
}
|
||||
|
||||
.c2 { display:initial; }
|
||||
.c2-alt { display:none; }
|
||||
.c3 { display:none; }
|
||||
@ -259,5 +262,5 @@ a.actionlink img { top:4px; }
|
||||
.c2-alt { display:initial; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,28 @@
|
||||
2015-08-20 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* CircleController.cs: * Authorize some Http methods
|
||||
* Lists circles as circles
|
||||
|
||||
|
||||
* style.css: Fixes the missing "hidden" css class
|
||||
|
||||
* AccountController.cs: using the new Circle provider
|
||||
interface
|
||||
|
||||
* BlogsController.cs: * using the new Circle provider
|
||||
interface
|
||||
* do not test blog entry collections in order to group them by
|
||||
a unique user name or title, it's too bad,
|
||||
instead, keep user's request id as guide to model and view.
|
||||
|
||||
* YavscHelpers.cs: Adds a Circle Html formatter
|
||||
|
||||
* Circles.aspx: List of circles is now given as a list of
|
||||
`Circle` objects
|
||||
|
||||
* instdbws.sql: fixes the db in order to store user names in
|
||||
circle member's records.
|
||||
|
||||
2015-08-14 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* FileSystemController.cs: Fixes the route to user's Files by
|
||||
|
@ -13,6 +13,7 @@ using Yavsc.Helpers;
|
||||
using System.Web.Mvc;
|
||||
using Yavsc.Model.Circles;
|
||||
using System.Collections.Specialized;
|
||||
using System.Text;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -309,12 +310,10 @@ namespace Yavsc.Controllers
|
||||
public ActionResult Circles ()
|
||||
{
|
||||
string user = Membership.GetUser ().UserName;
|
||||
ViewData["Circles"] = CircleManager.DefaultProvider.List (user).Select (x => new SelectListItem {
|
||||
Value = x.Value,
|
||||
Text = x.Text
|
||||
});;
|
||||
ViewData["Circles"] = CircleManager.DefaultProvider.List (user);
|
||||
return View ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logout the specified returnUrl.
|
||||
/// </summary>
|
||||
|
@ -18,6 +18,7 @@ using Yavsc.Model.RolesAndMembers;
|
||||
using System.Net;
|
||||
using System.Web.Mvc;
|
||||
using Yavsc.Model.Circles;
|
||||
using Yavsc.Helpers;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -131,11 +132,6 @@ namespace Yavsc.Controllers
|
||||
ViewData ["Avatar"] = bupr.avatar;
|
||||
ViewData ["RecordCount"] = tr;
|
||||
UUBlogEntryCollection uuc = new UUBlogEntryCollection (user, c);
|
||||
if (uuc.ConcernsAUniqueTitle) {
|
||||
var uutc = new UUTBlogEntryCollection (uuc.UserName,
|
||||
uuc [0].Title, uuc);
|
||||
return View ("UserPost", uutc );
|
||||
}
|
||||
return View ("UserPosts", uuc);
|
||||
}
|
||||
|
||||
@ -259,8 +255,8 @@ namespace Yavsc.Controllers
|
||||
title = "";
|
||||
ViewData ["UserName"] = un;
|
||||
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem {
|
||||
Value = x.Value,
|
||||
Text = x.Text
|
||||
Value = x.Id.ToString(),
|
||||
Text = YavscHelpers.FormatCircle(x).ToHtmlString()
|
||||
});
|
||||
|
||||
return View ("Edit", new BlogEntry { Title = title });
|
||||
@ -306,9 +302,9 @@ namespace Yavsc.Controllers
|
||||
e.AllowedCircles = new long[0];
|
||||
|
||||
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem {
|
||||
Value = x.Value,
|
||||
Text = x.Text,
|
||||
Selected = e.AllowedCircles.Contains (long.Parse (x.Value))
|
||||
Value = x.Id.ToString(),
|
||||
Text = YavscHelpers.FormatCircle(x).ToHtmlString(),
|
||||
Selected = e.AllowedCircles.Contains (x.Id)
|
||||
});
|
||||
return View (e);
|
||||
}
|
||||
|
@ -21,6 +21,32 @@ namespace Yavsc.Helpers
|
||||
/// </summary>
|
||||
public static class YavscHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Formats the circle.
|
||||
/// </summary>
|
||||
/// <returns>The circle.</returns>
|
||||
/// <param name="c">C.</param>
|
||||
public static HtmlString FormatCircle (Circle c)
|
||||
{
|
||||
if (c.Members!=null)
|
||||
if (c.Members.Length > 0) {
|
||||
TagBuilder i = new TagBuilder ("i");
|
||||
i.SetInnerText (String.Join (", ", c.Members));
|
||||
return new HtmlString (c.Title+"<br/>\n"+i.ToString());
|
||||
}
|
||||
return new HtmlString (c.Title);
|
||||
}
|
||||
/// <summary>
|
||||
/// Formats the circle.
|
||||
/// </summary>
|
||||
/// <returns>The circle as Html string.</returns>
|
||||
/// <param name="helper">Helper.</param>
|
||||
/// <param name="c">C.</param>
|
||||
public static HtmlString FormatCircle(this HtmlHelper helper, Circle c)
|
||||
{
|
||||
return FormatCircle (c);
|
||||
}
|
||||
|
||||
private static string siteName = null;
|
||||
/// <summary>
|
||||
/// Gets the name of the site.
|
||||
|
@ -13,12 +13,11 @@
|
||||
</thead>
|
||||
<tbody id="tbcb">
|
||||
<% int lc=0;
|
||||
foreach (SelectListItem ci in (IEnumerable<SelectListItem>) ViewData["Circles"]) { lc++; %>
|
||||
<tr class="<%= (lc%2==0)?"even ":"odd " %>row" id="c_<%=ci.Value%>">
|
||||
<td><%=ci.Text%></td>
|
||||
foreach (var ci in (IEnumerable<Circle>) ViewData["Circles"]) { lc++; %>
|
||||
<tr class="<%= (lc%2==0)?"even ":"odd " %>row" id="c_<%=ci.Id%>">
|
||||
<td><%=Html.FormatCircle(ci)%></td>
|
||||
<td>
|
||||
<input type="button" value="<%=Html.Translate("Remove")%>" class="actionlink rowbtnrm"/>
|
||||
<input type="button" value="<%=Html.Translate("Members")%>" class="actionlink rowbtnvw"/>
|
||||
<input type="button" value="<%=Html.Translate("Remove")%>" class="btnremovecircle actionlink" cid="<%=ci.Id%>"/>
|
||||
</td>
|
||||
</tr>
|
||||
<% } %>
|
||||
@ -87,9 +86,38 @@ $("#tbc").stupidtable();
|
||||
$("#Err_ur_IsApprouved").text("");
|
||||
}
|
||||
function clearCircleValidation() {}
|
||||
function removeCircle() {
|
||||
message(false);
|
||||
var id = $(this).attr('cid');
|
||||
$.ajax({
|
||||
url: "<%=Url.Content("~/api/Circle/Delete/")%>"+id,
|
||||
type: "GET",
|
||||
success: function (data) {
|
||||
// Drops the detroyed circle row
|
||||
$("c_"+id).remove();
|
||||
},
|
||||
statusCode: {
|
||||
400: function(data) {
|
||||
$.each(data.responseJSON, function (key, value) {
|
||||
var errspanid = "Err_cr_" + value.key.replace("model.","");
|
||||
var errspan = document.getElementById(errspanid);
|
||||
if (errspan==null)
|
||||
alert('enoent '+errspanid);
|
||||
else
|
||||
errspan.innerHTML=value.errors.join("<br/>");
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function (xhr, ajaxOptions, thrownError) {
|
||||
if (xhr.status!=400)
|
||||
message(xhr.status+" : "+xhr.responseText);
|
||||
else message(false);
|
||||
}});
|
||||
}
|
||||
|
||||
function addCircle()
|
||||
{
|
||||
message(false);
|
||||
var circle = { title: $("#title").val(), users: $("#users").val() } ;
|
||||
$("#title").text('');
|
||||
$("#users").val('');
|
||||
@ -98,7 +126,8 @@ $("#tbc").stupidtable();
|
||||
type: "POST",
|
||||
data: circle,
|
||||
success: function (data) {
|
||||
$("#users option:last").after($('<option>'+user.UserName+'</option>'));
|
||||
// Adds a node rendering the new circle
|
||||
$("#tbcb").append("<tr><td>"+circle.title+" <br><i>"+circle.users+"</i></td></tr>");
|
||||
},
|
||||
statusCode: {
|
||||
400: function(data) {
|
||||
@ -121,6 +150,7 @@ $("#tbc").stupidtable();
|
||||
|
||||
function addUser()
|
||||
{
|
||||
message(false);
|
||||
var user={
|
||||
UserName: $("#ur_UserName").val(),
|
||||
Name: $("#ur_Name").val(),
|
||||
@ -174,6 +204,7 @@ $("#tbc").stupidtable();
|
||||
$(document).ready(function () {
|
||||
$("#btnnewuser").click(addUser);
|
||||
$("#btnnewcircle").click(addCircle);
|
||||
$(".btnremovecircle").click(removeCircle);
|
||||
});
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
@ -680,11 +680,12 @@ COMMENT ON COLUMN circle.public IS 'true when this circle is a public circle, fr
|
||||
|
||||
CREATE TABLE circle_members
|
||||
(
|
||||
circle_id bigint NOT NULL,
|
||||
member character varying NOT NULL,
|
||||
circle_id bigserial NOT NULL,
|
||||
member character varying (255) NOT NULL,
|
||||
applicationname character varying (255) NOT NULL,
|
||||
CONSTRAINT circle_members_pkey PRIMARY KEY (circle_id, member),
|
||||
CONSTRAINT circle_members_member_fkey FOREIGN KEY (member)
|
||||
REFERENCES users (pkid) MATCH SIMPLE
|
||||
CONSTRAINT fk_circle_members_users FOREIGN KEY (member, applicationname)
|
||||
REFERENCES users (username, applicationname) MATCH SIMPLE
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
)
|
||||
WITH (
|
||||
|
@ -148,6 +148,7 @@ namespace Yavsc.Model.Blogs
|
||||
/// Gets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEntryCollection"/> concerns A unique title.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if concerns A unique title; otherwise, <c>false</c>.</value>
|
||||
[Obsolete("And what if no title? Do you really need this test?")]
|
||||
public bool ConcernsAUniqueTitle {
|
||||
get {
|
||||
if (this.Count <= 1)
|
||||
@ -160,6 +161,7 @@ namespace Yavsc.Model.Blogs
|
||||
/// Gets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEntryCollection"/> concerns A unique title.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if concerns A unique title; otherwise, <c>false</c>.</value>
|
||||
[Obsolete("And what if no title? Do you really need this test?")]
|
||||
public bool ConcernsAUniqueUser {
|
||||
get {
|
||||
if (this.Count <= 1)
|
||||
|
@ -33,12 +33,7 @@ namespace Yavsc.Model.Blogs
|
||||
/// <param name="username">Username.</param>
|
||||
/// <param name="title">Title.</param>
|
||||
/// <param name="items">Items.</param>
|
||||
public UUTBlogEntryCollection(string username, string title,
|
||||
IEnumerable<BlogEntry> items = null) : base(username,items) {
|
||||
if (Count>0) {
|
||||
if (!(ConcernsAUniqueTitle && ConcernsAUniqueTitle))
|
||||
throw new InvalidOperationException ();
|
||||
}
|
||||
public UUTBlogEntryCollection(string username, string title) : base(username) {
|
||||
_title = title;
|
||||
}
|
||||
|
||||
@ -58,6 +53,8 @@ namespace Yavsc.Model.Blogs
|
||||
return string.Format ("[UUTBlogEntryCollection: " +
|
||||
"Title={0} User={1} Count={2}]", Title, UserName, Count);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,3 +1,13 @@
|
||||
2015-08-20 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* BlogEntryCollection.cs: ConcernsAUniqueTitle and
|
||||
ConcernsAUniqueUser are now Obsoletes
|
||||
|
||||
* UUTBlogEntryCollection.cs: Drops a useless ctor
|
||||
|
||||
* CircleProvider.cs: The `CircleManager` now delivers the
|
||||
user's circle as a `Circle` object collection.
|
||||
|
||||
2015-08-14 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* FileSystemManager.cs: * Fixes the dir separator usage
|
||||
|
@ -72,7 +72,7 @@ namespace Yavsc.Model.Circles
|
||||
/// <summary>
|
||||
/// List this instance.
|
||||
/// </summary>
|
||||
public abstract IEnumerable<ListItem> List(string user);
|
||||
public abstract IEnumerable<Circle> List(string user);
|
||||
|
||||
/// <summary>
|
||||
/// Covers the specified username.
|
||||
|
Reference in New Issue
Block a user