* 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>
|
2015-08-14 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
* README.md: blanked: not clear enough
|
* 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>
|
2015-08-04 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
|
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
|
||||||
|
@ -179,8 +179,7 @@ namespace WorkFlowProvider
|
|||||||
cmd.Prepare ();
|
cmd.Prepare ();
|
||||||
if (users!=null)
|
if (users!=null)
|
||||||
foreach (string user in users) {
|
foreach (string user in users) {
|
||||||
object pkid = Membership.GetUser (user).ProviderUserKey;
|
cmd.Parameters[1].Value = user;
|
||||||
cmd.Parameters[1].Value = pkid.ToString();
|
|
||||||
cmd.ExecuteNonQuery ();
|
cmd.ExecuteNonQuery ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,7 +189,7 @@ namespace WorkFlowProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete the specified owner and title.
|
/// Delete the specified title.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Identifier.</param>
|
/// <param name="id">Identifier.</param>
|
||||||
public override void Delete (long id)
|
public override void Delete (long id)
|
||||||
@ -209,32 +208,51 @@ namespace WorkFlowProvider
|
|||||||
/// List user's circles.
|
/// List user's circles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="user">User.</param>
|
/// <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> ();
|
List<Circle> cc = new List<Circle> ();
|
||||||
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
|
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
|
||||||
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
cmd.CommandText = "select _id, title from circle where owner = :wnr";
|
cmd.CommandText = "select _id, title from circle where owner = :wnr";
|
||||||
cmd.Parameters.AddWithValue("wnr",user);
|
cmd.Parameters.AddWithValue ("wnr", user);
|
||||||
cnx.Open ();
|
cnx.Open ();
|
||||||
cmd.Prepare ();
|
cmd.Prepare ();
|
||||||
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
|
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
|
||||||
if (rdr.HasRows) {
|
if (rdr.HasRows) {
|
||||||
|
|
||||||
while (rdr.Read ()) {
|
while (rdr.Read ()) {
|
||||||
string title = null;
|
string title = null;
|
||||||
int ottl = rdr.GetOrdinal ("title");
|
int ottl = rdr.GetOrdinal ("title");
|
||||||
if (!rdr.IsDBNull (ottl))
|
if (!rdr.IsDBNull (ottl))
|
||||||
title = rdr.GetString (ottl);
|
title = rdr.GetString (ottl);
|
||||||
long id = (long) rdr.GetInt64 (
|
long id = (long)rdr.GetInt64 (
|
||||||
rdr.GetOrdinal ("_id"));
|
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 ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rdr.Close ();
|
|
||||||
}
|
}
|
||||||
cnx.Close ();
|
cnx.Close ();
|
||||||
|
|
||||||
}
|
}
|
||||||
return cc;
|
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>
|
2015-07-15 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
* WebControls.csproj: Moves to Mono framework
|
* WebControls.csproj: Moves to Mono framework
|
||||||
|
@ -154,15 +154,24 @@ namespace Yavsc.WebControls
|
|||||||
}
|
}
|
||||||
var u = Membership.GetUser ();
|
var u = Membership.GetUser ();
|
||||||
if (u != null) {
|
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)
|
foreach (SelectListItem sli in Value)
|
||||||
if (sli.Value == ci.Value) {
|
if (sli.Value == ci.Id.ToString()) {
|
||||||
writer.AddAttribute ("selected", null);
|
writer.AddAttribute ("selected", null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
writer.AddAttribute ("value", ci.Value );
|
writer.AddAttribute ("value", ci.Id.ToString() );
|
||||||
writer.RenderBeginTag ("option");
|
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 ();
|
writer.RenderEndTag ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,8 @@ Project("{9344BDBB-3E7F-41FC-A0DD-8665D75EE146}") = "pkg", "pkg\pkg.mdproj", "{C
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestAPI", "TestAPI\TestAPI.csproj", "{42B77C89-BF6D-4DB1-8763-6197F4030A95}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestAPI", "TestAPI\TestAPI.csproj", "{42B77C89-BF6D-4DB1-8763-6197F4030A95}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Presta", "Presta\Presta.csproj", "{6A312228-9641-478D-916F-4681CC65A35D}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{68F5B80A-616E-4C3C-91A0-828AA40000BD}.Release|Any CPU.Build.0 = 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.ActiveCfg = Debug|Any CPU
|
||||||
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Debug|Any CPU.Build.0 = 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
|
{77044C92-D2F1-45BD-80DD-AA25B311B027}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
@ -60,7 +60,8 @@ namespace Yavsc.ApiControllers
|
|||||||
/// Create the specified circle.
|
/// Create the specified circle.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="model">Model.</param>
|
/// <param name="model">Model.</param>
|
||||||
[Authorize]
|
[Authorize,
|
||||||
|
AcceptVerbs ("POST")]
|
||||||
public long Create(NewCircle model)
|
public long Create(NewCircle model)
|
||||||
{
|
{
|
||||||
string user = Membership.GetUser ().UserName;
|
string user = Membership.GetUser ().UserName;
|
||||||
@ -72,7 +73,8 @@ namespace Yavsc.ApiControllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Circle Identifier.</param>
|
/// <param name="id">Circle Identifier.</param>
|
||||||
/// <param name="username">username.</param>
|
/// <param name="username">username.</param>
|
||||||
[Authorize]
|
[Authorize,
|
||||||
|
AcceptVerbs ("POST")]
|
||||||
public void Add(long id, string username)
|
public void Add(long id, string username)
|
||||||
{
|
{
|
||||||
checkIsOwner (CircleManager.DefaultProvider.Get (id));
|
checkIsOwner (CircleManager.DefaultProvider.Get (id));
|
||||||
@ -84,7 +86,9 @@ namespace Yavsc.ApiControllers
|
|||||||
/// Delete the circle specified by id.
|
/// Delete the circle specified by id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Identifier.</param>
|
/// <param name="id">Identifier.</param>
|
||||||
[Authorize] public void Delete(long id)
|
[Authorize,
|
||||||
|
AcceptVerbs ("GET")]
|
||||||
|
public void Delete(long id)
|
||||||
{
|
{
|
||||||
checkIsOwner (CircleManager.DefaultProvider.Get(id));
|
checkIsOwner (CircleManager.DefaultProvider.Get(id));
|
||||||
CircleManager.DefaultProvider.Delete (id);
|
CircleManager.DefaultProvider.Delete (id);
|
||||||
@ -101,7 +105,8 @@ namespace Yavsc.ApiControllers
|
|||||||
/// Get the circle specified id.
|
/// Get the circle specified id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Identifier.</param>
|
/// <param name="id">Identifier.</param>
|
||||||
[Authorize]
|
[Authorize,
|
||||||
|
AcceptVerbs ("GET")]
|
||||||
public Circle Get(long id)
|
public Circle Get(long id)
|
||||||
{
|
{
|
||||||
var c = CircleManager.DefaultProvider.Get (id);
|
var c = CircleManager.DefaultProvider.Get (id);
|
||||||
@ -112,8 +117,9 @@ namespace Yavsc.ApiControllers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// List the circles
|
/// List the circles
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Authorize]
|
[Authorize,
|
||||||
public IEnumerable<ListItem> List()
|
AcceptVerbs ("GET")]
|
||||||
|
public IEnumerable<Circle> List()
|
||||||
{
|
{
|
||||||
string user = Membership.GetUser ().UserName;
|
string user = Membership.GetUser ().UserName;
|
||||||
return CircleManager.DefaultProvider.List (user);
|
return CircleManager.DefaultProvider.List (user);
|
||||||
|
@ -12,7 +12,7 @@ body {
|
|||||||
textarea {
|
textarea {
|
||||||
width:25em;
|
width:25em;
|
||||||
height:5em;
|
height:5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, textarea, checkbox {
|
input, textarea, checkbox {
|
||||||
color: #FFFFA0;
|
color: #FFFFA0;
|
||||||
@ -86,7 +86,7 @@ footer {
|
|||||||
font-size:75%;
|
font-size:75%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#login img { max-height:5em; max-width:5em; }
|
#login img { max-height:5em; max-width:5em; }
|
||||||
|
|
||||||
header {
|
header {
|
||||||
background-color:rgba(16,16,0,0.8);
|
background-color:rgba(16,16,0,0.8);
|
||||||
@ -155,6 +155,7 @@ label {
|
|||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.hidden { display:none; }
|
||||||
|
|
||||||
ul.preview li:nth-child(-n+10) {
|
ul.preview li:nth-child(-n+10) {
|
||||||
display:inline;
|
display:inline;
|
||||||
@ -180,6 +181,7 @@ usertitleref {
|
|||||||
font-family: 'Arial', cursive;
|
font-family: 'Arial', cursive;
|
||||||
font-size: 140%;
|
font-size: 140%;
|
||||||
display:block;
|
display:block;
|
||||||
|
padding: .2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
input, select {
|
input, select {
|
||||||
@ -230,34 +232,35 @@ a.actionlink img { top:4px; }
|
|||||||
.field-validation-error { color: red; }
|
.field-validation-error { color: red; }
|
||||||
.c2 { font-size: small; font-style: italic; }
|
.c2 { font-size: small; font-style: italic; }
|
||||||
.c3 { font-size: x-small; font-style: italic; }
|
.c3 { font-size: x-small; font-style: italic; }
|
||||||
|
|
||||||
@media print {
|
@media print {
|
||||||
body {background-color:white;color:black;}
|
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) {
|
@media all and (min-width: 641px) {
|
||||||
.bshpanel { display:block; }
|
.bshpanel { display:block; }
|
||||||
.bsh { display: none; }
|
.bsh { display: none; }
|
||||||
.c3 { display:initial; }
|
.c3 { display:initial; }
|
||||||
.c3-alt { display:none; }
|
.c3-alt { display:none; }
|
||||||
}
|
}
|
||||||
@media all and (max-width: 640px) {
|
|
||||||
|
|
||||||
.bshpanel { cursor:zoom-in; }
|
|
||||||
|
|
||||||
|
@media all and (max-width: 640px) {
|
||||||
|
.bshpanel { cursor:zoom-in; }
|
||||||
footer {
|
footer {
|
||||||
font-size: x-small;
|
font-size: x-small;
|
||||||
}
|
}
|
||||||
|
|
||||||
.c2 { display:initial; }
|
.c2 { display:initial; }
|
||||||
.c2-alt { display:none; }
|
.c2-alt { display:none; }
|
||||||
.c3 { display:none; }
|
.c3 { display:none; }
|
||||||
.c3-alt { display:initial; }
|
.c3-alt { display:initial; }
|
||||||
}
|
|
||||||
|
|
||||||
@media all and (max-width: 350px) {
|
|
||||||
.c2 { display:none; }
|
|
||||||
.c2-alt { display:initial; }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@media all and (max-width: 350px) {
|
||||||
|
.c2 { display:none; }
|
||||||
|
.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>
|
2015-08-14 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
* FileSystemController.cs: Fixes the route to user's Files by
|
* FileSystemController.cs: Fixes the route to user's Files by
|
||||||
|
@ -13,6 +13,7 @@ using Yavsc.Helpers;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Yavsc.Model.Circles;
|
using Yavsc.Model.Circles;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
@ -309,12 +310,10 @@ namespace Yavsc.Controllers
|
|||||||
public ActionResult Circles ()
|
public ActionResult Circles ()
|
||||||
{
|
{
|
||||||
string user = Membership.GetUser ().UserName;
|
string user = Membership.GetUser ().UserName;
|
||||||
ViewData["Circles"] = CircleManager.DefaultProvider.List (user).Select (x => new SelectListItem {
|
ViewData["Circles"] = CircleManager.DefaultProvider.List (user);
|
||||||
Value = x.Value,
|
|
||||||
Text = x.Text
|
|
||||||
});;
|
|
||||||
return View ();
|
return View ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logout the specified returnUrl.
|
/// Logout the specified returnUrl.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -18,6 +18,7 @@ using Yavsc.Model.RolesAndMembers;
|
|||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Yavsc.Model.Circles;
|
using Yavsc.Model.Circles;
|
||||||
|
using Yavsc.Helpers;
|
||||||
|
|
||||||
namespace Yavsc.Controllers
|
namespace Yavsc.Controllers
|
||||||
{
|
{
|
||||||
@ -131,11 +132,6 @@ namespace Yavsc.Controllers
|
|||||||
ViewData ["Avatar"] = bupr.avatar;
|
ViewData ["Avatar"] = bupr.avatar;
|
||||||
ViewData ["RecordCount"] = tr;
|
ViewData ["RecordCount"] = tr;
|
||||||
UUBlogEntryCollection uuc = new UUBlogEntryCollection (user, c);
|
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);
|
return View ("UserPosts", uuc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,8 +255,8 @@ namespace Yavsc.Controllers
|
|||||||
title = "";
|
title = "";
|
||||||
ViewData ["UserName"] = un;
|
ViewData ["UserName"] = un;
|
||||||
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem {
|
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem {
|
||||||
Value = x.Value,
|
Value = x.Id.ToString(),
|
||||||
Text = x.Text
|
Text = YavscHelpers.FormatCircle(x).ToHtmlString()
|
||||||
});
|
});
|
||||||
|
|
||||||
return View ("Edit", new BlogEntry { Title = title });
|
return View ("Edit", new BlogEntry { Title = title });
|
||||||
@ -306,9 +302,9 @@ namespace Yavsc.Controllers
|
|||||||
e.AllowedCircles = new long[0];
|
e.AllowedCircles = new long[0];
|
||||||
|
|
||||||
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem {
|
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem {
|
||||||
Value = x.Value,
|
Value = x.Id.ToString(),
|
||||||
Text = x.Text,
|
Text = YavscHelpers.FormatCircle(x).ToHtmlString(),
|
||||||
Selected = e.AllowedCircles.Contains (long.Parse (x.Value))
|
Selected = e.AllowedCircles.Contains (x.Id)
|
||||||
});
|
});
|
||||||
return View (e);
|
return View (e);
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,32 @@ namespace Yavsc.Helpers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class YavscHelpers
|
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;
|
private static string siteName = null;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the site.
|
/// Gets the name of the site.
|
||||||
|
@ -13,12 +13,11 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody id="tbcb">
|
<tbody id="tbcb">
|
||||||
<% int lc=0;
|
<% int lc=0;
|
||||||
foreach (SelectListItem ci in (IEnumerable<SelectListItem>) ViewData["Circles"]) { lc++; %>
|
foreach (var ci in (IEnumerable<Circle>) ViewData["Circles"]) { lc++; %>
|
||||||
<tr class="<%= (lc%2==0)?"even ":"odd " %>row" id="c_<%=ci.Value%>">
|
<tr class="<%= (lc%2==0)?"even ":"odd " %>row" id="c_<%=ci.Id%>">
|
||||||
<td><%=ci.Text%></td>
|
<td><%=Html.FormatCircle(ci)%></td>
|
||||||
<td>
|
<td>
|
||||||
<input type="button" value="<%=Html.Translate("Remove")%>" class="actionlink rowbtnrm"/>
|
<input type="button" value="<%=Html.Translate("Remove")%>" class="btnremovecircle actionlink" cid="<%=ci.Id%>"/>
|
||||||
<input type="button" value="<%=Html.Translate("Members")%>" class="actionlink rowbtnvw"/>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
@ -33,13 +32,13 @@ $("#tbc").stupidtable();
|
|||||||
<asp:Content ID="MASContentContent" ContentPlaceHolderID="MASContent" runat="server">
|
<asp:Content ID="MASContentContent" ContentPlaceHolderID="MASContent" runat="server">
|
||||||
|
|
||||||
<div id="dfnuser" class="hidden panel">
|
<div id="dfnuser" class="hidden panel">
|
||||||
<%= Html.Partial("~/Views/Account/Register.ascx",new RegisterClientModel(),new ViewDataDictionary(ViewData)
|
<%= Html.Partial("~/Views/Account/Register.ascx",new RegisterClientModel(),new ViewDataDictionary(ViewData)
|
||||||
|
{
|
||||||
|
TemplateInfo = new System.Web.Mvc.TemplateInfo
|
||||||
{
|
{
|
||||||
TemplateInfo = new System.Web.Mvc.TemplateInfo
|
HtmlFieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix==""?"ur":ViewData.TemplateInfo.HtmlFieldPrefix+"_ur"
|
||||||
{
|
}
|
||||||
HtmlFieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix==""?"ur":ViewData.TemplateInfo.HtmlFieldPrefix+"_ur"
|
}) %>
|
||||||
}
|
|
||||||
}) %>
|
|
||||||
</div>
|
</div>
|
||||||
<form>
|
<form>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@ -87,9 +86,38 @@ $("#tbc").stupidtable();
|
|||||||
$("#Err_ur_IsApprouved").text("");
|
$("#Err_ur_IsApprouved").text("");
|
||||||
}
|
}
|
||||||
function clearCircleValidation() {}
|
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()
|
function addCircle()
|
||||||
{
|
{
|
||||||
|
message(false);
|
||||||
var circle = { title: $("#title").val(), users: $("#users").val() } ;
|
var circle = { title: $("#title").val(), users: $("#users").val() } ;
|
||||||
$("#title").text('');
|
$("#title").text('');
|
||||||
$("#users").val('');
|
$("#users").val('');
|
||||||
@ -98,7 +126,8 @@ $("#tbc").stupidtable();
|
|||||||
type: "POST",
|
type: "POST",
|
||||||
data: circle,
|
data: circle,
|
||||||
success: function (data) {
|
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: {
|
statusCode: {
|
||||||
400: function(data) {
|
400: function(data) {
|
||||||
@ -121,6 +150,7 @@ $("#tbc").stupidtable();
|
|||||||
|
|
||||||
function addUser()
|
function addUser()
|
||||||
{
|
{
|
||||||
|
message(false);
|
||||||
var user={
|
var user={
|
||||||
UserName: $("#ur_UserName").val(),
|
UserName: $("#ur_UserName").val(),
|
||||||
Name: $("#ur_Name").val(),
|
Name: $("#ur_Name").val(),
|
||||||
@ -174,6 +204,7 @@ $("#tbc").stupidtable();
|
|||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$("#btnnewuser").click(addUser);
|
$("#btnnewuser").click(addUser);
|
||||||
$("#btnnewcircle").click(addCircle);
|
$("#btnnewcircle").click(addCircle);
|
||||||
|
$(".btnremovecircle").click(removeCircle);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</asp:Content>
|
</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
|
CREATE TABLE circle_members
|
||||||
(
|
(
|
||||||
circle_id bigint NOT NULL,
|
circle_id bigserial NOT NULL,
|
||||||
member character varying 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_pkey PRIMARY KEY (circle_id, member),
|
||||||
CONSTRAINT circle_members_member_fkey FOREIGN KEY (member)
|
CONSTRAINT fk_circle_members_users FOREIGN KEY (member, applicationname)
|
||||||
REFERENCES users (pkid) MATCH SIMPLE
|
REFERENCES users (username, applicationname) MATCH SIMPLE
|
||||||
ON UPDATE CASCADE ON DELETE CASCADE
|
ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
)
|
)
|
||||||
WITH (
|
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.
|
/// Gets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEntryCollection"/> concerns A unique title.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if concerns A unique title; otherwise, <c>false</c>.</value>
|
/// <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 {
|
public bool ConcernsAUniqueTitle {
|
||||||
get {
|
get {
|
||||||
if (this.Count <= 1)
|
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.
|
/// Gets a value indicating whether this <see cref="Yavsc.Model.Blogs.BlogEntryCollection"/> concerns A unique title.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value><c>true</c> if concerns A unique title; otherwise, <c>false</c>.</value>
|
/// <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 {
|
public bool ConcernsAUniqueUser {
|
||||||
get {
|
get {
|
||||||
if (this.Count <= 1)
|
if (this.Count <= 1)
|
||||||
|
@ -33,12 +33,7 @@ namespace Yavsc.Model.Blogs
|
|||||||
/// <param name="username">Username.</param>
|
/// <param name="username">Username.</param>
|
||||||
/// <param name="title">Title.</param>
|
/// <param name="title">Title.</param>
|
||||||
/// <param name="items">Items.</param>
|
/// <param name="items">Items.</param>
|
||||||
public UUTBlogEntryCollection(string username, string title,
|
public UUTBlogEntryCollection(string username, string title) : base(username) {
|
||||||
IEnumerable<BlogEntry> items = null) : base(username,items) {
|
|
||||||
if (Count>0) {
|
|
||||||
if (!(ConcernsAUniqueTitle && ConcernsAUniqueTitle))
|
|
||||||
throw new InvalidOperationException ();
|
|
||||||
}
|
|
||||||
_title = title;
|
_title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,6 +53,8 @@ namespace Yavsc.Model.Blogs
|
|||||||
return string.Format ("[UUTBlogEntryCollection: " +
|
return string.Format ("[UUTBlogEntryCollection: " +
|
||||||
"Title={0} User={1} Count={2}]", Title, UserName, Count);
|
"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>
|
2015-08-14 Paul Schneider <paul@pschneider.fr>
|
||||||
|
|
||||||
* FileSystemManager.cs: * Fixes the dir separator usage
|
* FileSystemManager.cs: * Fixes the dir separator usage
|
||||||
|
@ -72,7 +72,7 @@ namespace Yavsc.Model.Circles
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// List this instance.
|
/// List this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract IEnumerable<ListItem> List(string user);
|
public abstract IEnumerable<Circle> List(string user);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Covers the specified username.
|
/// Covers the specified username.
|
||||||
|
Reference in New Issue
Block a user