adds access by circle to blog posts
This commit is contained in:
parent
9da7064791
commit
f25aa8ff97
32 changed files with 465 additions and 274 deletions
|
|
@ -1,3 +1,8 @@
|
|||
2015-07-02 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* UserCard.cs:
|
||||
* InputCircle.cs:
|
||||
|
||||
2015-06-10 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* InputCircle.cs: An input control specialized for circle
|
||||
|
|
|
|||
|
|
@ -26,8 +26,11 @@ using System.ComponentModel;
|
|||
using System.Web.UI.WebControls;
|
||||
using Yavsc.Model.Circles;
|
||||
using System.Web.Security;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace WebControls
|
||||
namespace Yavsc.WebControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Input circle.
|
||||
|
|
@ -63,13 +66,21 @@ namespace WebControls
|
|||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets or sets the value.
|
||||
/// Gets or sets the The CircleInfo collection.
|
||||
/// </summary>
|
||||
/// <value>The value.</value>
|
||||
[Bindable (true), DefaultValue(""), Localizable(true)]
|
||||
public string Value {
|
||||
[Bindable (true), DefaultValue(null), Localizable(true),
|
||||
Category("Behavior"),
|
||||
Description("The CircleInfo collection"),
|
||||
DesignerSerializationVisibility(
|
||||
DesignerSerializationVisibility.Content),
|
||||
PersistenceMode(PersistenceMode.InnerDefaultProperty)
|
||||
]
|
||||
public IEnumerable<SelectListItem> Value {
|
||||
get {
|
||||
return (string) ViewState["Value"];
|
||||
if (ViewState ["Value"] == null)
|
||||
ViewState ["Value"] = new List<SelectListItem> ();
|
||||
return (IEnumerable<SelectListItem>) ViewState["Value"];
|
||||
}
|
||||
set {
|
||||
ViewState ["Value"] = value;
|
||||
|
|
@ -134,10 +145,7 @@ namespace WebControls
|
|||
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");
|
||||
|
|
@ -146,13 +154,15 @@ namespace WebControls
|
|||
}
|
||||
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 ());
|
||||
foreach (Yavsc.Model.ListItem ci in CircleManager.DefaultProvider.List(u.UserName)) {
|
||||
foreach (SelectListItem sli in Value)
|
||||
if (sli.Value == ci.Value) {
|
||||
writer.AddAttribute ("selected", null);
|
||||
break;
|
||||
}
|
||||
writer.AddAttribute ("value", ci.Value );
|
||||
writer.RenderBeginTag ("option");
|
||||
writer.Write (ci.Title);
|
||||
writer.Write (ci.Text);
|
||||
writer.RenderEndTag ();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,11 @@ using System.Web.UI;
|
|||
using System.ComponentModel;
|
||||
using System.Web.Security;
|
||||
|
||||
namespace WebControls
|
||||
namespace Yavsc.WebControls
|
||||
{
|
||||
/// <summary>
|
||||
/// User card.
|
||||
/// </summary>
|
||||
[
|
||||
AspNetHostingPermission (SecurityAction.Demand,
|
||||
Level = AspNetHostingPermissionLevel.Minimal),
|
||||
|
|
@ -37,9 +40,6 @@ namespace WebControls
|
|||
DefaultProperty ("Name"),
|
||||
ToolboxData ("<{0}:UserCard runat=\"server\"> </{0}:UserCard>")
|
||||
]
|
||||
/// <summary>
|
||||
/// User card.
|
||||
/// </summary>
|
||||
public class UserCard: WebControl
|
||||
{
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue