* InputCircle.cs: An input control specialized for circle selection
* UserCard.cs: Displays user informations on a little div * Estim.cs: * WebControls.csproj: * CircleInfo.cs: * CircleProvider.cs: * CircleApiController.cs: * BasketApiController.cs: * ITContentProvider.csproj: * CalendarApiController.cs: * WorkFlowApiController.cs: * NpgsqlCircleProvider.cs: * FrontOfficeApiController.cs: * InputUserName.cs: Fixes the ToolBoxData attribute * Web.csproj: * Circle.cs: refactoring * instdbws.sql: Foreign keys are cascading updates and deletions * Estim.tt: * Profile.cs: User's profile does not contain anymore the main e-mail address, it conflicts with registration informations, it is not part of the profile data
This commit is contained in:
parent
3d050e019e
commit
6680addcc8
24 changed files with 796 additions and 227 deletions
11
WebControls/ChangeLog
Normal file
11
WebControls/ChangeLog
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* InputCircle.cs: An input control specialized for circle
|
||||
selection
|
||||
|
||||
* UserCard.cs: Displays user informations on a little div
|
||||
|
||||
* InputUserName.cs: Fixes the ToolBoxData attribute
|
||||
|
||||
* WebControls.csproj:
|
||||
|
||||
163
WebControls/InputCircle.cs
Normal file
163
WebControls/InputCircle.cs
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
//
|
||||
// InputCircle.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;
|
||||
using System.Web;
|
||||
using System.Security.Permissions;
|
||||
using System.Web.UI;
|
||||
using System.ComponentModel;
|
||||
using System.Web.UI.WebControls;
|
||||
using Yavsc.Model.Circles;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace WebControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Input circle.
|
||||
/// </summary>
|
||||
[
|
||||
AspNetHostingPermission (SecurityAction.Demand,
|
||||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
AspNetHostingPermission (SecurityAction.InheritanceDemand,
|
||||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
ParseChildren (true),
|
||||
DefaultProperty ("Name"),
|
||||
ToolboxData ("<{0}:InputCircle runat=\"server\"> </{0}:InputCircle>")
|
||||
]
|
||||
public class InputCircle: WebControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WebControls.InputCircle"/> class.
|
||||
/// </summary>
|
||||
public InputCircle ()
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
[Bindable (true), DefaultValue(""), Localizable(true)]
|
||||
public string Name {
|
||||
get {
|
||||
return (string) ViewState["Name"];
|
||||
}
|
||||
set {
|
||||
ViewState ["Name"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
[Bindable (true), DefaultValue(""), Localizable(true)]
|
||||
public string Value {
|
||||
get {
|
||||
return (string) ViewState["Value"];
|
||||
}
|
||||
set {
|
||||
ViewState ["Value"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the on change.
|
||||
/// </summary>
|
||||
/// <value>The on change.</value>
|
||||
[Bindable (true), DefaultValue(""), Localizable(false)]
|
||||
public string OnChange {
|
||||
get {
|
||||
return (string) ViewState["OnChange"];
|
||||
}
|
||||
set {
|
||||
ViewState ["OnChange"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this <see cref="Yavsc.WebControls.InputUserName"/> is multiple.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if multiple; otherwise, <c>false</c>.</value>
|
||||
[Bindable (true), DefaultValue(false)]
|
||||
public bool Multiple {
|
||||
get {
|
||||
|
||||
return (bool) ViewState["Multiple"];
|
||||
}
|
||||
set {
|
||||
ViewState ["Multiple"] = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the empty value.
|
||||
/// </summary>
|
||||
/// <value>The empty value.</value>
|
||||
[Bindable (true), DefaultValue(null)]
|
||||
public string EmptyValue {
|
||||
get {
|
||||
return (string) ViewState["EmptyValue"];
|
||||
}
|
||||
set {
|
||||
ViewState ["EmptyValue"] = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renders the contents.
|
||||
/// </summary>
|
||||
/// <param name="writer">Writer.</param>
|
||||
protected override void RenderContents (HtmlTextWriter writer)
|
||||
{
|
||||
writer.AddAttribute ("id", ID);
|
||||
writer.AddAttribute ("name", Name);
|
||||
writer.AddAttribute ("class", CssClass);
|
||||
if (!string.IsNullOrWhiteSpace(OnChange))
|
||||
writer.AddAttribute ("onchange", OnChange);
|
||||
if (Multiple)
|
||||
writer.AddAttribute ("multiple","true");
|
||||
writer.RenderBeginTag ("select");
|
||||
string[] selected = null;
|
||||
if (!string.IsNullOrWhiteSpace (Value)) {
|
||||
selected = Value.Split (',');
|
||||
}
|
||||
if (EmptyValue!=null) {
|
||||
writer.AddAttribute ("value", "");
|
||||
writer.RenderBeginTag ("option");
|
||||
writer.Write (EmptyValue);
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
var u = Membership.GetUser ();
|
||||
if (u != null) {
|
||||
foreach (CircleInfo ci in CircleManager.DefaultProvider.List(u.UserName)) {
|
||||
if (selected != null)
|
||||
if (Array.Exists (selected, x => x == ci.Id.ToString ()))
|
||||
writer.AddAttribute ("selected", null);
|
||||
writer.AddAttribute ("value", ci.Id.ToString ());
|
||||
writer.RenderBeginTag ("option");
|
||||
writer.Write (ci.Title);
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
}
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ namespace Yavsc.WebControls
|
|||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
ParseChildren (true),
|
||||
DefaultProperty ("Name"),
|
||||
ToolboxData ("<{0}:ResultPages runat=\"server\"> </{0}:ResultPages>")
|
||||
ToolboxData ("<{0}:InputUserName runat=\"server\"> </{0}:InputUserName>")
|
||||
]
|
||||
public class InputUserName: WebControl
|
||||
{
|
||||
|
|
@ -70,9 +70,7 @@ namespace Yavsc.WebControls
|
|||
/// Gets or sets the value.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
[Bindable (true)]
|
||||
[DefaultValue("")]
|
||||
[Localizable(true)]
|
||||
[Bindable (true),DefaultValue(""),Localizable(true)]
|
||||
public string Value {
|
||||
get {
|
||||
return (string) ViewState["Value"];
|
||||
|
|
@ -82,9 +80,11 @@ namespace Yavsc.WebControls
|
|||
}
|
||||
}
|
||||
|
||||
[Bindable (true)]
|
||||
[DefaultValue("")]
|
||||
[Localizable(false)]
|
||||
/// <summary>
|
||||
/// Gets or sets the client side action on change.
|
||||
/// </summary>
|
||||
/// <value>The on change.</value>
|
||||
[Bindable (true),DefaultValue(""),Localizable(false)]
|
||||
public string OnChange {
|
||||
get {
|
||||
return (string) ViewState["OnChange"];
|
||||
|
|
@ -99,9 +99,7 @@ namespace Yavsc.WebControls
|
|||
/// Gets or sets the in role.
|
||||
/// </summary>
|
||||
/// <value>The in role.</value>
|
||||
[Bindable (true)]
|
||||
[DefaultValue("")]
|
||||
[Localizable(true)]
|
||||
[Bindable (true),DefaultValue(""),Localizable(true)]
|
||||
public string InRole {
|
||||
get {
|
||||
return (string) ViewState["InRole"];
|
||||
|
|
@ -115,8 +113,7 @@ namespace Yavsc.WebControls
|
|||
/// Gets or sets a value indicating whether this <see cref="Yavsc.WebControls.InputUserName"/> is multiple.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if multiple; otherwise, <c>false</c>.</value>
|
||||
[Bindable (true)]
|
||||
[DefaultValue(false)]
|
||||
[Bindable (true), DefaultValue(false)]
|
||||
public bool Multiple {
|
||||
get {
|
||||
|
||||
|
|
@ -128,9 +125,11 @@ namespace Yavsc.WebControls
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
[Bindable (true)]
|
||||
[DefaultValue(null)]
|
||||
/// <summary>
|
||||
/// Gets or sets the empty value.
|
||||
/// </summary>
|
||||
/// <value>The empty value.</value>
|
||||
[Bindable (true), DefaultValue(null)]
|
||||
public string EmptyValue {
|
||||
get {
|
||||
return (string) ViewState["EmptyValue"];
|
||||
|
|
|
|||
81
WebControls/UserCard.cs
Normal file
81
WebControls/UserCard.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
//
|
||||
// UserCard.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;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Web;
|
||||
using System.Security.Permissions;
|
||||
using System.Web.UI;
|
||||
using System.ComponentModel;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace WebControls
|
||||
{
|
||||
[
|
||||
AspNetHostingPermission (SecurityAction.Demand,
|
||||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
AspNetHostingPermission (SecurityAction.InheritanceDemand,
|
||||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
ParseChildren (true),
|
||||
DefaultProperty ("Name"),
|
||||
ToolboxData ("<{0}:UserCard runat=\"server\"> </{0}:UserCard>")
|
||||
]
|
||||
/// <summary>
|
||||
/// User card.
|
||||
/// </summary>
|
||||
public class UserCard: WebControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WebControls.UserCard"/> class.
|
||||
/// </summary>
|
||||
public UserCard ()
|
||||
{
|
||||
}
|
||||
|
||||
[Bindable (true), DefaultValue(""), Localizable(false)]
|
||||
string UserName { get; set; }
|
||||
|
||||
[Bindable (true), DefaultValue("(<a href=\"/Account/Profile\">You</a>)"), Localizable(true)]
|
||||
string yourTag { get; set; }
|
||||
/// <summary>
|
||||
/// Renders the contents.
|
||||
/// </summary>
|
||||
/// <param name="writer">Writer.</param>
|
||||
protected override void RenderContents (HtmlTextWriter writer)
|
||||
{
|
||||
if (UserName != null) {
|
||||
// icon, stats
|
||||
|
||||
writer.AddAttribute ("id", ID);
|
||||
writer.AddAttribute ("class", CssClass);
|
||||
writer.RenderBeginTag ("div");
|
||||
writer.Write (UserName+" ");
|
||||
var vuser = Membership.GetUser();
|
||||
if (vuser != null)
|
||||
if (vuser.UserName == UserName)
|
||||
writer.Write (yourTag);
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -39,11 +39,20 @@
|
|||
<Reference Include="System.Web.Mvc" />
|
||||
<Reference Include="System.Web.Http" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Configuration" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ResultPages.cs" />
|
||||
<Compile Include="InputUserName.cs" />
|
||||
<Compile Include="InputCircle.cs" />
|
||||
<Compile Include="UserCard.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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue