* Web.config:
* Web.csproj: * instdbws.sql: * packages.config: * TestByteA.cs: * App.master: * MyClass.cs: * LocalizedText.resx: * Index.aspx: * LocalizedText.fr.resx: * packages.config: * Details.aspx: * packages.config: * packages.config: * packages.config: * EventPub.aspx: * LocalizedText.Designer.cs: * FileSystemController.cs: * FrontOfficeController.cs: * NpgsqlContentProvider.cs: * ITContentProvider.csproj: * FileSystemManager.cs: * Circle.cs: * YaEvent.cs: * NpgsqlBlogProvider.csproj: * NpgsqlMRPProviders.csproj: * EventPub.cs: * NpgsqlContentProvider.csproj: * EventType.cs: * UserPrefs.cs: * CalendarController.cs: * EstablishmentType.cs: * ITCPNpgsqlProvider.cs: * NpgsqlBlogProvider.cs: * NpgsqlRoleProvider.cs: * NpgsqlProfileProvider.cs: * NpgsqlMembershipProvider.cs: Npgsql Command.Parameters.Add is obsolete * Commande.cs: FileSystem ctor needs a format parameter in order to use path by membership * google-services.json: intented to be used to build android application able to receive push notification via GCM
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
//
|
||||
// NightFlashController.cs
|
||||
// CalendarController.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
@ -22,6 +22,12 @@ using System;
|
||||
using System.Web.Http;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Yavsc.ApiControllers.Calendar.Model;
|
||||
using Yavsc.Helpers;
|
||||
using System.ComponentModel;
|
||||
using Yavsc.Model;
|
||||
using System.Web.Security;
|
||||
using System.Web.Profile;
|
||||
using System.Web.Http.ModelBinding;
|
||||
|
||||
namespace Yavsc.ApiControllers.Calendar
|
||||
{
|
||||
@ -30,6 +36,44 @@ namespace Yavsc.ApiControllers.Calendar
|
||||
/// </summary>
|
||||
public class CalendarController: ApiController
|
||||
{
|
||||
YaEvent[] getTestList()
|
||||
{
|
||||
return new YaEvent[] {
|
||||
new YaEvent () {
|
||||
Description = "Test Descr",
|
||||
Title = "Night club special bubble party",
|
||||
Location = new Position () {
|
||||
Longitude = 0,
|
||||
Latitude = 0
|
||||
}
|
||||
},
|
||||
new YaEvent () {
|
||||
Title = "Test2",
|
||||
ImgLocator = "http://bla/im.png",
|
||||
Location = new Position () {
|
||||
Longitude = 0,
|
||||
Latitude = 0
|
||||
}
|
||||
},
|
||||
new YaEvent () {
|
||||
Description = "Test Descr",
|
||||
Title = "Night club special bubble party",
|
||||
Location = new Position () {
|
||||
Longitude = 0,
|
||||
Latitude = 0
|
||||
}
|
||||
},
|
||||
new YaEvent () {
|
||||
Title = "Test2",
|
||||
ImgLocator = "http://bla/im.png",
|
||||
Location = new Position () {
|
||||
Longitude = 0,
|
||||
Latitude = 0
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List events according the specified search arguments.
|
||||
/// </summary>
|
||||
@ -38,40 +82,7 @@ namespace Yavsc.ApiControllers.Calendar
|
||||
[HttpGet]
|
||||
public YaEvent[] List ([FromUri] PositionAndKeyphrase args)
|
||||
{
|
||||
return new YaEvent[] {
|
||||
new YaEvent () {
|
||||
Description = "Test Descr",
|
||||
Title = "Night club special bubble party",
|
||||
Location = new Position() {
|
||||
Longitude = 0,
|
||||
Latitude = 0
|
||||
}
|
||||
},
|
||||
new YaEvent () {
|
||||
Title = "Test2",
|
||||
ImgLocator = "http://bla/im.png",
|
||||
Location = new Position() {
|
||||
Longitude = 0,
|
||||
Latitude = 0
|
||||
}
|
||||
},
|
||||
new YaEvent () {
|
||||
Description = "Test Descr",
|
||||
Title = "Night club special bubble party",
|
||||
Location = new Position() {
|
||||
Longitude = 0,
|
||||
Latitude = 0
|
||||
}
|
||||
},
|
||||
new YaEvent () {
|
||||
Title = "Test2",
|
||||
ImgLocator = "http://bla/im.png",
|
||||
Location = new Position() {
|
||||
Longitude = 0,
|
||||
Latitude = 0
|
||||
}
|
||||
}
|
||||
};
|
||||
return getTestList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -119,12 +130,260 @@ namespace Yavsc.ApiControllers.Calendar
|
||||
/// <param name="ev">Ev.</param>
|
||||
public int PostEvent ([FromBody] ProvidedEvent ev)
|
||||
{
|
||||
return -1;
|
||||
throw new NotImplementedException();
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Notification.
|
||||
/// </summary>
|
||||
public class Notification {
|
||||
/// <summary>
|
||||
/// The title.
|
||||
/// </summary>
|
||||
public string title;
|
||||
/// <summary>
|
||||
/// The body.
|
||||
/// </summary>
|
||||
public string body;
|
||||
/// <summary>
|
||||
/// The icon.
|
||||
/// </summary>
|
||||
public string icon;
|
||||
/// <summary>
|
||||
/// The sound.
|
||||
/// </summary>
|
||||
public string sound;
|
||||
/// <summary>
|
||||
/// The tag.
|
||||
/// </summary>
|
||||
public string tag;
|
||||
/// <summary>
|
||||
/// The color.
|
||||
/// </summary>
|
||||
public string color;
|
||||
/// <summary>
|
||||
/// The click action.
|
||||
/// </summary>
|
||||
public string click_action;
|
||||
|
||||
}
|
||||
|
||||
// https://gcm-http.googleapis.com/gcm/send
|
||||
/// <summary>
|
||||
/// Message with payload.
|
||||
/// </summary>
|
||||
public class MessageWithPayload<T> {
|
||||
/// <summary>
|
||||
/// To.
|
||||
/// </summary>
|
||||
public string to;
|
||||
/// <summary>
|
||||
/// The registration identifiers.
|
||||
/// </summary>
|
||||
public string [] registration_ids;
|
||||
/// <summary>
|
||||
/// The data.
|
||||
/// </summary>
|
||||
public T[] data ;
|
||||
/// <summary>
|
||||
/// The notification.
|
||||
/// </summary>
|
||||
public Notification notification;
|
||||
/// <summary>
|
||||
/// The collapse key.
|
||||
/// </summary>
|
||||
public string collapse_key; // in order to collapse ...
|
||||
/// <summary>
|
||||
/// The priority.
|
||||
/// </summary>
|
||||
public int priority; // between 0 and 10, 10 is the lowest!
|
||||
/// <summary>
|
||||
/// The content available.
|
||||
/// </summary>
|
||||
public bool content_available;
|
||||
/// <summary>
|
||||
/// The delay while idle.
|
||||
/// </summary>
|
||||
public bool delay_while_idle;
|
||||
/// <summary>
|
||||
/// The time to live.
|
||||
/// </summary>
|
||||
public int time_to_live; // seconds
|
||||
/// <summary>
|
||||
/// The name of the restricted package.
|
||||
/// </summary>
|
||||
public string restricted_package_name;
|
||||
/// <summary>
|
||||
/// The dry run.
|
||||
/// </summary>
|
||||
public bool dry_run;
|
||||
/// <summary>
|
||||
/// Validate the specified modelState.
|
||||
/// </summary>
|
||||
/// <param name="modelState">Model state.</param>
|
||||
public void Validate(ModelStateDictionary modelState) {
|
||||
if (to==null && registration_ids == null) {
|
||||
modelState.AddModelError ("to", "One of \"to\" or \"registration_ids\" parameters must be specified");
|
||||
modelState.AddModelError ("registration_ids", "*");
|
||||
}
|
||||
if (notification == null && data == null) {
|
||||
modelState.AddModelError ("notification", "At least one of \"notification\" or \"data\" parameters must be specified");
|
||||
modelState.AddModelError ("data", "*");
|
||||
}
|
||||
if (notification != null) {
|
||||
if (notification.icon == null)
|
||||
modelState.AddModelError ("notification.icon", "please, specify an icon resoure name");
|
||||
if (notification.title == null)
|
||||
modelState.AddModelError ("notification.title", "please, specify a title");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Message with payload response.
|
||||
/// </summary>
|
||||
public class MessageWithPayloadResponse {
|
||||
/// <summary>
|
||||
/// The multicast identifier.
|
||||
/// </summary>
|
||||
public int multicast_id;
|
||||
/// <summary>
|
||||
/// The success count.
|
||||
/// </summary>
|
||||
public int success;
|
||||
/// <summary>
|
||||
/// The failure count.
|
||||
/// </summary>
|
||||
public int failure;
|
||||
/// <summary>
|
||||
/// The canonical identifiers... ?!?
|
||||
/// </summary>
|
||||
public int canonical_ids;
|
||||
/// <summary>
|
||||
/// Detailled result.
|
||||
/// </summary>
|
||||
public class Result {
|
||||
/// <summary>
|
||||
/// The message identifier.
|
||||
/// </summary>
|
||||
public string message_id;
|
||||
/// <summary>
|
||||
/// The registration identifier.
|
||||
/// </summary>
|
||||
public string registration_id;
|
||||
/// <summary>
|
||||
/// The error.
|
||||
/// </summary>
|
||||
public string error;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The results.
|
||||
/// </summary>
|
||||
public Result [] results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GCM register model.
|
||||
/// </summary>
|
||||
public class GCMRegisterModel {
|
||||
/// <summary>
|
||||
/// Gets or sets the name of the user.
|
||||
/// </summary>
|
||||
/// <value>The name of the user.</value>
|
||||
[Localizable(true)]
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="UserName")]
|
||||
[Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password.
|
||||
/// </summary>
|
||||
/// <value>The password.</value>
|
||||
[DisplayName("Mot de passe")]
|
||||
[Required(ErrorMessage = "S'il vous plait, entez un mot de passe")]
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the email.
|
||||
/// </summary>
|
||||
/// <value>The email.</value>
|
||||
[DisplayName("Adresse e-mail")]
|
||||
[Required(ErrorMessage = "S'il vous plait, entrez un e-mail valide")]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the registration identifier against Google Clood Messaging and their info on this application.
|
||||
/// </summary>
|
||||
/// <value>The registration identifier.</value>
|
||||
public string RegistrationId { get; set; }
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers with push notifications enabled.
|
||||
/// </summary>
|
||||
/// <param name="model">Model.</param>
|
||||
[ValidateAjax]
|
||||
public void RegisterWithPushNotifications(GCMRegisterModel model)
|
||||
{
|
||||
if (ModelState.IsValid) {
|
||||
MembershipCreateStatus mcs;
|
||||
var user = Membership.CreateUser (
|
||||
model.UserName,
|
||||
model.Password,
|
||||
model.Email,
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
out mcs);
|
||||
switch (mcs) {
|
||||
case MembershipCreateStatus.DuplicateEmail:
|
||||
ModelState.AddModelError ("Email", "Cette adresse e-mail correspond " +
|
||||
"à un compte utilisateur existant");
|
||||
break;
|
||||
case MembershipCreateStatus.DuplicateUserName:
|
||||
ModelState.AddModelError ("UserName", "Ce nom d'utilisateur est " +
|
||||
"déjà enregistré");
|
||||
break;
|
||||
case MembershipCreateStatus.Success:
|
||||
YavscHelpers.SendActivationEmail (user);
|
||||
// TODO set registration id
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the registration identifier.
|
||||
/// </summary>
|
||||
/// <param name="registrationId">Registration identifier.</param>
|
||||
[Authorize]
|
||||
void NotifyEvent(EventPub evpub) {
|
||||
throw new NotImplementedException();
|
||||
public void SetRegistrationId(string registrationId)
|
||||
{
|
||||
// TODO set registration id
|
||||
setRegistrationId (Membership.GetUser ().UserName, registrationId);
|
||||
}
|
||||
|
||||
private void setRegistrationId(string username, string regid) {
|
||||
ProfileBase pr = ProfileBase.Create(username);
|
||||
pr.SetPropertyValue ("gregid", regid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies the event.
|
||||
/// </summary>
|
||||
/// <param name="evpub">Evpub.</param>
|
||||
public MessageWithPayloadResponse NotifyEvent(EventPub evpub) {
|
||||
SimpleJsonPostMethod<MessageWithPayload<YaEvent>,MessageWithPayloadResponse> r =
|
||||
new SimpleJsonPostMethod<MessageWithPayload<YaEvent>,MessageWithPayloadResponse>(
|
||||
"https://gcm-http.googleapis.com/gcm/send");
|
||||
using (r) {
|
||||
var msg = new MessageWithPayload<YaEvent> () { data = new YaEvent[] { (YaEvent)evpub } };
|
||||
msg.to = string.Join (" ", Circle.Union (evpub.Circles));
|
||||
|
||||
return r.Invoke (msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// NightFlashController.cs
|
||||
// Circle.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
@ -21,13 +21,42 @@
|
||||
using System;
|
||||
using System.Web.Http;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Yavsc.ApiControllers.Calendar.Model
|
||||
{
|
||||
class Circle
|
||||
/// <summary>
|
||||
/// Circle.
|
||||
/// </summary>
|
||||
public class Circle
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the title.
|
||||
/// </summary>
|
||||
/// <value>The title.</value>
|
||||
public string Title { get; set; }
|
||||
string [] Users { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the users.
|
||||
/// </summary>
|
||||
/// <value>The users.</value>
|
||||
public string [] Users { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Union the specified that.
|
||||
/// </summary>
|
||||
/// <param name="that">That.</param>
|
||||
public static string [] Union (Circle []those)
|
||||
{
|
||||
List<string> content = new List<string>();
|
||||
foreach (Circle c in those) {
|
||||
foreach (string user_name in c.Users) {
|
||||
if (!content.Contains (user_name))
|
||||
content.Add (user_name);
|
||||
}
|
||||
}
|
||||
return content.ToArray ();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,62 +0,0 @@
|
||||
//
|
||||
// NFEvent.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2015 Paul Schneider
|
||||
//
|
||||
// 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.Http;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.ApiControllers.Calendar.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Establishment type.
|
||||
/// </summary>
|
||||
public enum EstablishmentType
|
||||
{
|
||||
/// <summary>
|
||||
/// The discotheque.
|
||||
/// </summary>
|
||||
Discotheque,
|
||||
/// <summary>
|
||||
/// The piano bar.
|
||||
/// </summary>
|
||||
PianoBar,
|
||||
/// <summary>
|
||||
/// The bar.
|
||||
/// </summary>
|
||||
Bar,
|
||||
/// <summary>
|
||||
/// The place publique.
|
||||
/// </summary>
|
||||
PlacePublique,
|
||||
/// <summary>
|
||||
/// The maison privee.
|
||||
/// </summary>
|
||||
MaisonPrivee,
|
||||
/// <summary>
|
||||
/// The domaine publique.
|
||||
/// </summary>
|
||||
DomainePublique,
|
||||
/// <summary>
|
||||
/// The domaine prive.
|
||||
/// </summary>
|
||||
DomainePrive
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// NightFlashController.cs
|
||||
// EventPub.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
@ -22,12 +22,21 @@ using System;
|
||||
using System.Web.Http;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Yavsc.ApiControllers.Calendar.Model;
|
||||
using Yavsc.Model;
|
||||
|
||||
namespace Yavsc.ApiControllers.Calendar.Model
|
||||
{
|
||||
class EventPub: YaEvent
|
||||
/// <summary>
|
||||
/// Event pub.
|
||||
/// </summary>
|
||||
public class EventPub: YaEvent
|
||||
{
|
||||
Circle[] Circles { get; set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the circles.
|
||||
/// </summary>
|
||||
/// <value>The circles.</value>
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="Circles")]
|
||||
public Circle[] Circles { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
//
|
||||
// EventType.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
//
|
||||
// Copyright (c) 2015 Paul Schneider
|
||||
//
|
||||
// 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.Http;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Yavsc.ApiControllers.Calendar.Model
|
||||
{
|
||||
/// <summary>
|
||||
/// Event type.
|
||||
/// </summary>
|
||||
public enum EventType
|
||||
{
|
||||
/// <summary>
|
||||
/// The concert gratuit.
|
||||
/// </summary>
|
||||
ConcertGratuit,
|
||||
/// <summary>
|
||||
/// The concert prive.
|
||||
/// </summary>
|
||||
ConcertPrive,
|
||||
/// <summary>
|
||||
/// The distraciton.
|
||||
/// </summary>
|
||||
Distraciton,
|
||||
/// <summary>
|
||||
/// The rencontre.
|
||||
/// </summary>
|
||||
Rencontre,
|
||||
/// <summary>
|
||||
/// The assemblee.
|
||||
/// </summary>
|
||||
Assemblee,
|
||||
/// <summary>
|
||||
/// The reunion.
|
||||
/// </summary>
|
||||
Reunion,
|
||||
/// <summary>
|
||||
/// The bureau.
|
||||
/// </summary>
|
||||
Bureau,
|
||||
/// <summary>
|
||||
/// The manifestation.
|
||||
/// </summary>
|
||||
Manifestation,
|
||||
/// <summary>
|
||||
/// The zone de danger.
|
||||
/// </summary>
|
||||
ZoneDeDanger
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
//
|
||||
// NightFlashController.cs
|
||||
// UserPrefs.cs
|
||||
//
|
||||
// Author:
|
||||
// Paul Schneider <paulschneider@free.fr>
|
||||
@ -28,7 +28,7 @@ namespace Yavsc.ApiControllers.Calendar.Model
|
||||
class UserPrefs
|
||||
{
|
||||
Circle [] Circles { get; set ; }
|
||||
Dictionary<string,double> MusicTypeRatings { get; set; }
|
||||
Dictionary<string,double> EventTypeRatings { get; set; }
|
||||
Dictionary<string,double> LocationTypeRatings { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
using System;
|
||||
using System.Web.Http;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Yavsc.Model;
|
||||
|
||||
namespace Yavsc.ApiControllers.Calendar.Model
|
||||
{
|
||||
@ -31,71 +32,65 @@ namespace Yavsc.ApiControllers.Calendar.Model
|
||||
/// </summary>
|
||||
public class YaEvent
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Yavsc.ApiControllers.Calendar.Model.YaEvent"/> class.
|
||||
/// </summary>
|
||||
public YaEvent()
|
||||
{
|
||||
this.EstabType = EstablishmentType.DomainePublique;
|
||||
this.NFEvType = EventType.Distraciton;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the NF ev.
|
||||
/// </summary>
|
||||
/// <value>The type of the NF ev.</value>
|
||||
[Required]
|
||||
public EventType NFEvType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the type of the estab.
|
||||
/// </summary>
|
||||
/// <value>The type of the estab.</value>
|
||||
[Required(ErrorMessage="Please, choose an establisment type.")]
|
||||
public EstablishmentType EstabType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The title.
|
||||
/// </summary>
|
||||
[Required(ErrorMessage="Please, choose a .")]
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="Title")]
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// The description.
|
||||
/// </summary>
|
||||
[Required(ErrorMessage="Please, choose a Description.")] public string Description { get; set; }
|
||||
[Required(ErrorMessage="Please, choose a Description.")]
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="Description")]
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
/// The location.
|
||||
/// </summary>
|
||||
[Required(ErrorMessage="Please, choose a Location.")] public Position Location { get; set; }
|
||||
[Required(ErrorMessage="Please, choose a Location.")]
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="Location")]
|
||||
public Position Location { get; set; }
|
||||
/// <summary>
|
||||
/// The start date.
|
||||
/// </summary>
|
||||
[Required(ErrorMessage="Please, choose a Start Date.")] public DateTime StartDate { get; set; }
|
||||
[Required(ErrorMessage="Please, choose a Start Date.")]
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="StartDate")]
|
||||
public DateTime StartDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the end date.
|
||||
/// </summary>
|
||||
/// <value>The end date.</value>
|
||||
[Required(ErrorMessage="Please, choose an End Date.")] public DateTime EndDate { get; set; }
|
||||
[Required(ErrorMessage="Please, choose an End Date.")]
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="EndDate")]
|
||||
public DateTime EndDate { get; set; }
|
||||
/// <summary>
|
||||
/// The name of the NF provider.
|
||||
/// </summary>
|
||||
[Required(ErrorMessage="Please, choose a Nigth Flash Provider Name.")] public string NFProviderName { get; set; }
|
||||
[Required(ErrorMessage="Please, choose a Provider Name.")]
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="ProviderName")]
|
||||
public string ProviderName { get; set; }
|
||||
/// <summary>
|
||||
/// The NF provider identifier.
|
||||
/// </summary>
|
||||
[Required(ErrorMessage="Please, choose a Night Flash Provider Identifier.")] public string NFProviderId { get; set; }
|
||||
[Required(ErrorMessage="Please, choose a Provider Identifier.")]
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="ProviderId")]
|
||||
public string ProviderId { get; set; }
|
||||
/// <summary>
|
||||
/// The promotion code.
|
||||
/// </summary>
|
||||
public string PromotionCode { get; set; }
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="Comment")]
|
||||
public string Comment { get; set; }
|
||||
/// <summary>
|
||||
/// The event web page.
|
||||
/// </summary>
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="EventWebPage")]
|
||||
public string EventWebPage { get; set; }
|
||||
/// <summary>
|
||||
/// The image locator.
|
||||
/// </summary>-
|
||||
/// </summary>
|
||||
[Display(ResourceType=typeof(LocalizedText),Name="ImgLocator")]
|
||||
public string ImgLocator { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -13,29 +13,18 @@ namespace Yavsc.Controllers
|
||||
/// <summary>
|
||||
/// File system controller.
|
||||
/// </summary>
|
||||
|
||||
public class FileSystemController : Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the users base directory.
|
||||
/// </summary>
|
||||
/// <value>The users dir.</value>
|
||||
public string RootDir {
|
||||
get {
|
||||
return mgr.Prefix;
|
||||
}
|
||||
}
|
||||
|
||||
FileSystemManager mgr = null ;
|
||||
|
||||
/// <summary>
|
||||
/// Initialize the specified requestContext.
|
||||
/// </summary>
|
||||
/// <param name="requestContext">Request context.</param>
|
||||
[Authorize]
|
||||
protected override void Initialize (System.Web.Routing.RequestContext requestContext)
|
||||
{
|
||||
base.Initialize (requestContext);
|
||||
mgr = new FileSystemManager (
|
||||
string.Format("~/users/{0}",Membership.GetUser().UserName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -44,7 +33,10 @@ namespace Yavsc.Controllers
|
||||
[Authorize]
|
||||
public ActionResult Index (string id)
|
||||
{
|
||||
return View (mgr.GetFiles (id));
|
||||
FileSystemManager fsmgr = new FileSystemManager ();
|
||||
var files = fsmgr.GetFiles (id);
|
||||
files.Owner = Membership.GetUser ().UserName;
|
||||
return View (files);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -53,6 +45,7 @@ namespace Yavsc.Controllers
|
||||
/// <param name="id">Identifier.</param>
|
||||
public ActionResult Details (string id)
|
||||
{
|
||||
|
||||
foreach (char x in Path.GetInvalidPathChars()) {
|
||||
if (id.Contains (x)) {
|
||||
ViewData ["Message"] =
|
||||
@ -62,10 +55,19 @@ namespace Yavsc.Controllers
|
||||
return RedirectToAction ("Index");
|
||||
}
|
||||
}
|
||||
FileInfo fi = mgr.FileInfo (id);
|
||||
|
||||
ViewData ["Content"] = Url.Content (fi.FullName);
|
||||
FileSystemManager fsmgr = new FileSystemManager ();
|
||||
FileInfo fi = fsmgr.FileInfo (id);
|
||||
|
||||
ViewData ["id"] = id;
|
||||
// TODO : ensure that we use the default port for
|
||||
// the used sheme
|
||||
ViewData ["url"] =
|
||||
string.Format(
|
||||
"{0}://{1}/users/{2}/{3}",
|
||||
Request.Url.Scheme,
|
||||
Request.Url.Authority,
|
||||
Membership.GetUser ().UserName ,
|
||||
id );
|
||||
return View (fi);
|
||||
}
|
||||
|
||||
@ -77,16 +79,10 @@ namespace Yavsc.Controllers
|
||||
[Authorize]
|
||||
public ActionResult Create (string id)
|
||||
{
|
||||
mgr.Put ( id, Request.Files);
|
||||
return View ("Index",mgr.GetFiles(id));
|
||||
FileSystemManager fsmgr = new FileSystemManager ();
|
||||
return View ("Index",fsmgr.GetFiles(id));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the user's base dir.
|
||||
/// </summary>
|
||||
/// <value>The base dir.</value>
|
||||
public string UserBaseDir { get { return Path.Combine (RootDir, Membership.GetUser ().UserName); } }
|
||||
|
||||
/// <summary>
|
||||
/// Edit the specified id.
|
||||
/// </summary>
|
||||
|
@ -12,6 +12,7 @@ using System.Web.Security;
|
||||
using System.Threading;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
using Yavsc.Model.FileSystem;
|
||||
using Yavsc.ApiControllers.Calendar.Model;
|
||||
|
||||
namespace Yavsc.Controllers
|
||||
{
|
||||
@ -43,7 +44,10 @@ namespace Yavsc.Controllers
|
||||
{
|
||||
return View ();
|
||||
}
|
||||
|
||||
public ActionResult EventPub (EventPub model)
|
||||
{
|
||||
return View (model);
|
||||
}
|
||||
/// <summary>
|
||||
/// Estimates this instance.
|
||||
/// </summary>
|
||||
|
@ -60,6 +60,11 @@ ViewState["orgtitle"] = T.GetString(Page.Title);
|
||||
</aside>
|
||||
<div style="float:right; height:5em; z-index:-1;"></div>
|
||||
<footer>
|
||||
<!-- Placez cette balise dans l'en-tête ou juste avant la balise de fermeture du corps de texte. -->
|
||||
<script src="https://apis.google.com/js/platform.js" async defer>
|
||||
{lang: 'fr'}
|
||||
</script>
|
||||
<div class="g-plusone" data-annotation="inline" data-width="230"></div>
|
||||
<%= Html.ActionLink("Contact","Contact","Home",null, new { @class="footerlink" }) %> <br/>
|
||||
<% foreach ( string link in Yavsc.ThanksHelper.Links()) { %>
|
||||
<%= link %>
|
||||
|
@ -47,14 +47,14 @@ namespace Yavsc
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ())
|
||||
{
|
||||
cmd.CommandText = "insert into testbytea (t) values (@tv)";
|
||||
cmd.Parameters.Add ("@tv", a);
|
||||
cmd.Parameters.AddWithValue ("@tv", a);
|
||||
cmd.ExecuteNonQuery ();
|
||||
}
|
||||
|
||||
using (NpgsqlCommand cmd = cnx.CreateCommand ())
|
||||
{
|
||||
cmd.CommandText = "select t from testbytea";
|
||||
cmd.Parameters.Add ("@tv", a);
|
||||
cmd.Parameters.AddWithValue ("@tv", a);
|
||||
|
||||
NpgsqlDataReader rdr = cmd.ExecuteReader ();
|
||||
if (!rdr.Read ())
|
||||
|
@ -7,5 +7,5 @@ Dérnière modification :
|
||||
<%= Model.LastWriteTime %><br/>
|
||||
Dernier accès :
|
||||
<%= Model.LastAccessTime %><br/>
|
||||
Lien permanent : <a href="/<%= ViewData["Content"] %>">/<%= ViewData["Content"] %></a>
|
||||
Lien permanent : <a href="<%= ViewData["url"] %>"><%= ViewData["url"] %></a>
|
||||
</asp:Content>
|
||||
|
@ -1,8 +1,9 @@
|
||||
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<Yavsc.FileInfoCollection>" %>
|
||||
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<Yavsc.Model.FileSystem.FileInfoCollection>" %>
|
||||
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
|
||||
<h1> Index of <%= Model.Owner %>'s files (<%= Html.Encode(Model.Count) %>) </h1>
|
||||
<h1> Index of <%= Model.Owner %>'s files (<%= Html.Encode(Model.Count) %>)
|
||||
</h1>
|
||||
<ul>
|
||||
<% foreach (System.IO.FileInfo fi in Model) { %>
|
||||
<% foreach (System.IO.FileInfo fi in Model) { %>
|
||||
<li> <%= Html.ActionLink(fi.Name,"Details",new {id = fi.Name}) %> </li>
|
||||
<% } %>
|
||||
</ul>
|
||||
|
23
web/Views/FrontOffice/EventPub.aspx
Normal file
23
web/Views/FrontOffice/EventPub.aspx
Normal file
@ -0,0 +1,23 @@
|
||||
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<Yavsc.ApiControllers.Calendar.Model.EventPub>" %>
|
||||
|
||||
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
|
||||
|
||||
<% using (Html.BeginForm()) { %>
|
||||
|
||||
<%= Html.LabelFor(model => model.Title) %>: <%=Model.Title%><br/>
|
||||
<%= Html.LabelFor(model => model.Description) %>: <%=Model.Description%> <br/>
|
||||
<%= Html.LabelFor(model => model.Location) %>: <%=Model.Location%> <br/>
|
||||
<%= Html.LabelFor(model => model.StartDate) %>: <%=Model.StartDate%> <br/>
|
||||
<%= Html.LabelFor(model => model.EndDate) %>: <%=Model.EndDate%> <br/>
|
||||
<%= Html.LabelFor(model => model.Circles) %>: <%=Model.Circles%> <br/>
|
||||
<%= Html.LabelFor(model => model.ImgLocator) %>: <%=Model.ImgLocator%> <br/>
|
||||
<%= Html.LabelFor(model => model.EventWebPage) %>: <%=Model.EventWebPage%> <br/>
|
||||
<%= Html.LabelFor(model => model.ProviderName) %>: <%=Model.ProviderName%> <br/>
|
||||
<%= Html.LabelFor(model => model.Comment) %>: <%=Model.Comment%> <br/>
|
||||
|
||||
<% } %>
|
||||
|
||||
|
||||
|
||||
|
||||
</asp:Content>
|
@ -45,17 +45,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
||||
-->
|
||||
<compilation defaultLanguage="C#" debug="false">
|
||||
<assemblies>
|
||||
<add assembly="Npgsql, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />
|
||||
<add assembly="System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add assembly="System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add assembly="System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
@ -149,6 +139,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
||||
<add name="avatar" />
|
||||
<add name="gcalapi" />
|
||||
<add name="gcalid" />
|
||||
<add name="gregid" />
|
||||
</properties>
|
||||
</profile>
|
||||
<blog defaultProvider="NpgsqlBlogProvider">
|
||||
@ -261,7 +252,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx
|
||||
</root>
|
||||
</log4net>
|
||||
<connectionStrings>
|
||||
<add name="yavsc" connectionString="Server=127.0.0.1;Port=5432;Database=yavsc;User Id=yavsc;Password=admin;Encoding=Unicode;" providerName="Npgsql" />
|
||||
<add name="yavsc" connectionString="Server=127.0.0.1;Port=5432;Database=YavscDev;User Id=yavscdev;Password=admin;Encoding=Unicode;" providerName="Npgsql" />
|
||||
</connectionStrings>
|
||||
<appSettings>
|
||||
<add key="WorkflowContentProviderClass" value="yavsc.NpgsqlContentProvider" />
|
||||
|
@ -54,7 +54,6 @@
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="Npgsql" />
|
||||
<Reference Include="CodeKicker.BBCode">
|
||||
<HintPath>lib\CodeKicker.BBCode.dll</HintPath>
|
||||
</Reference>
|
||||
@ -85,6 +84,12 @@
|
||||
<Reference Include="System.Net.Http.Formatting" />
|
||||
<Reference Include="System.Net.Http.WebRequest" />
|
||||
<Reference Include="System.Web.WebPages.Razor" />
|
||||
<Reference Include="Mono.Security">
|
||||
<HintPath>..\packages\Npgsql.2.2.5\lib\net45\Mono.Security.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Npgsql">
|
||||
<HintPath>..\packages\Npgsql.2.2.5\lib\net45\Npgsql.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
@ -187,8 +192,6 @@
|
||||
<Compile Include="ApiControllers\Calendar\Model\Schedule.cs" />
|
||||
<Compile Include="ApiControllers\Calendar\Model\ProviderPublicInfo.cs" />
|
||||
<Compile Include="ApiControllers\Calendar\Model\WeekDay.cs" />
|
||||
<Compile Include="ApiControllers\Calendar\Model\EstablishmentType.cs" />
|
||||
<Compile Include="ApiControllers\Calendar\Model\EventType.cs" />
|
||||
<Compile Include="ApiControllers\Calendar\CalendarController.cs" />
|
||||
<Compile Include="ApiControllers\Calendar\Model\YaEvent.cs" />
|
||||
<Compile Include="ApiControllers\Calendar\Model\Circle.cs" />
|
||||
@ -682,6 +685,7 @@
|
||||
<Content Include="Views\FrontOffice\Estimate.aspx" />
|
||||
<Content Include="Theme\dark\croix.png" />
|
||||
<Content Include="Views\Admin\RemoveRole..aspx" />
|
||||
<Content Include="Views\FrontOffice\EventPub.aspx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
@ -122,6 +122,7 @@ CREATE TABLE profiledata
|
||||
gtokenexpir timestamp with time zone, -- Google access token expiration date
|
||||
avatar character varying(512), -- url for an avatar
|
||||
gcalapi boolean NOT NULL DEFAULT false, -- true when user authorized to use its Google calendar
|
||||
gregid character varying(1024), -- Google Cloud Message registration identifier
|
||||
CONSTRAINT fkprofiles2 FOREIGN KEY (uniqueid)
|
||||
REFERENCES profiles (uniqueid) MATCH SIMPLE
|
||||
ON UPDATE CASCADE ON DELETE CASCADE
|
||||
@ -142,6 +143,7 @@ COMMENT ON COLUMN profiledata.gtokentype IS 'Google access token type';
|
||||
COMMENT ON COLUMN profiledata.grefreshtoken IS 'Google refresh token';
|
||||
COMMENT ON COLUMN profiledata.gtokenexpir IS 'Google access token expiration date';
|
||||
COMMENT ON COLUMN profiledata.avatar IS 'url for an avatar';
|
||||
COMMENT ON COLUMN profiledata.gregid IS 'Google Cloud Message registration identifier';
|
||||
|
||||
-- Index: fki_fkprofiles2
|
||||
|
||||
|
@ -5,5 +5,6 @@
|
||||
<package id="jquery-globalize" version="0.1.3" targetFramework="net45" />
|
||||
<package id="log4net" version="2.0.3" targetFramework="net40" />
|
||||
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net451" />
|
||||
<package id="Npgsql" version="2.2.5" targetFramework="net451" />
|
||||
<package id="PayPalCoreSDK" version="1.6.0" targetFramework="net451" />
|
||||
</packages>
|
Reference in New Issue
Block a user