Merge from booking branch
356
NpgsqlContentProvider/NpgsqlSkillProvider.cs
Normal file
|
|
@ -0,0 +1,356 @@
|
||||||
|
//
|
||||||
|
// NpgsqlSkillProvider.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 Yavsc.Model.Skill;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Npgsql;
|
||||||
|
using NpgsqlTypes;
|
||||||
|
|
||||||
|
namespace WorkFlowProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Npgsql skill provider.
|
||||||
|
/// </summary>
|
||||||
|
public class NpgsqlSkillProvider : SkillProvider
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="WorkFlowProvider.NpgsqlSkillProvider"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public NpgsqlSkillProvider ()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
string connectionString = null;
|
||||||
|
string applicationName = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initialize this object using the specified name and config.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">Name.</param>
|
||||||
|
/// <param name="config">Config.</param>
|
||||||
|
public override void Initialize (string name, NameValueCollection config)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace (config ["connectionStringName"]))
|
||||||
|
throw new ConfigurationErrorsException ("No name for Npgsql connection string found");
|
||||||
|
|
||||||
|
connectionString = ConfigurationManager.ConnectionStrings [config ["connectionStringName"]].ConnectionString;
|
||||||
|
applicationName = config ["applicationName"] ?? "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
#region implemented abstract members of SkillProvider
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user skills.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The user skills.</returns>
|
||||||
|
/// <param name="username">Username.</param>
|
||||||
|
public override PerformerProfile GetUserSkills (string username)
|
||||||
|
{
|
||||||
|
var skills = new List <UserSkill>();
|
||||||
|
var profile = new PerformerProfile (username);
|
||||||
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) {
|
||||||
|
cnx.Open ();
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText =
|
||||||
|
" select u._id, u.skillid, s.name, " +
|
||||||
|
" u.comment, u.rate from userskills u, " +
|
||||||
|
" skill s " +
|
||||||
|
" where u.skillid = s._id and " +
|
||||||
|
" u.username = :uname " +
|
||||||
|
" and applicationname = :app " +
|
||||||
|
" order by u.rate desc";
|
||||||
|
cmd.Parameters.AddWithValue ("uname", NpgsqlTypes.NpgsqlDbType.Varchar, username);
|
||||||
|
cmd.Parameters.AddWithValue ("app", NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
|
||||||
|
cmd.Prepare ();
|
||||||
|
using (var rdr = cmd.ExecuteReader ()) {
|
||||||
|
if (rdr.HasRows) while (rdr.Read ()) {
|
||||||
|
skills.Add (new UserSkill () {
|
||||||
|
Id = rdr.GetInt64 (0),
|
||||||
|
SkillId = rdr.GetInt64 (1),
|
||||||
|
SkillName = rdr.GetString (2),
|
||||||
|
Comment = rdr.GetString (3),
|
||||||
|
Rate = rdr.GetInt32(4)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
profile.Skills = skills.ToArray ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText =
|
||||||
|
"select uniqueid from profiles where username = :user and applicationname = :app";
|
||||||
|
cmd.Parameters.AddWithValue ("user", NpgsqlTypes.NpgsqlDbType.Varchar, username);
|
||||||
|
cmd.Parameters.AddWithValue ("app", NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
|
||||||
|
profile.Id = (long) cmd.ExecuteScalar ();
|
||||||
|
}
|
||||||
|
cnx.Close ();
|
||||||
|
}
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create the specified skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skill">skill.</param>
|
||||||
|
public override long Declare (Skill skill)
|
||||||
|
{
|
||||||
|
long res = 0;
|
||||||
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) {
|
||||||
|
cnx.Open ();
|
||||||
|
if (skill.Id == 0) {
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText = "insert into skill (name,rate) values (:name,:rate) returning _id";
|
||||||
|
cmd.Parameters.AddWithValue ("name", NpgsqlTypes.NpgsqlDbType.Varchar, skill.Name);
|
||||||
|
cmd.Parameters.AddWithValue ("rate",
|
||||||
|
NpgsqlTypes.NpgsqlDbType.Integer, skill.Rate);
|
||||||
|
res = (long)cmd.ExecuteScalar ();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText = "update skill set name = :name, rate = :rate where _id = :sid";
|
||||||
|
cmd.Parameters.AddWithValue ("name", NpgsqlTypes.NpgsqlDbType.Bigint, skill.Id);
|
||||||
|
cmd.Parameters.AddWithValue ("rate",
|
||||||
|
NpgsqlTypes.NpgsqlDbType.Integer, skill.Rate);
|
||||||
|
cmd.ExecuteNonQuery ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cnx.Close ();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Declares the userskill.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The userskill.</returns>
|
||||||
|
/// <param name="userskill">userskill.</param>
|
||||||
|
public override long Declare (UserSkillDeclaration userskill)
|
||||||
|
{
|
||||||
|
long res=0;
|
||||||
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) {
|
||||||
|
cnx.Open ();
|
||||||
|
if (userskill.Id == 0) {
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText = "insert into userskills" +
|
||||||
|
" (username, applicationname, skillid, rate, comment) " +
|
||||||
|
" values (:uname,:app,:sid,:rate,:cmnt) returning _id";
|
||||||
|
cmd.Parameters.AddWithValue ("uname",
|
||||||
|
NpgsqlTypes.NpgsqlDbType.Varchar, userskill.UserName);
|
||||||
|
cmd.Parameters.AddWithValue ("app",
|
||||||
|
NpgsqlTypes.NpgsqlDbType.Varchar, applicationName);
|
||||||
|
cmd.Parameters.AddWithValue ("sid",
|
||||||
|
NpgsqlTypes.NpgsqlDbType.Bigint, userskill.SkillId);
|
||||||
|
cmd.Parameters.AddWithValue ("rate",
|
||||||
|
NpgsqlTypes.NpgsqlDbType.Integer, userskill.Rate);
|
||||||
|
cmd.Parameters.AddWithValue ("cmnt",
|
||||||
|
NpgsqlTypes.NpgsqlDbType.Varchar, userskill.Comment);
|
||||||
|
userskill.Id = res = (long)cmd.ExecuteScalar ();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText = "update userskills" +
|
||||||
|
" set rate = :rate," +
|
||||||
|
" comment = :cmnt) " +
|
||||||
|
" where _id = :usid ";
|
||||||
|
cmd.Parameters.AddWithValue ("comment",
|
||||||
|
NpgsqlTypes.NpgsqlDbType.Varchar, userskill.Comment);
|
||||||
|
cmd.Parameters.AddWithValue ("rate",
|
||||||
|
NpgsqlTypes.NpgsqlDbType.Integer, userskill.Rate);
|
||||||
|
cmd.Parameters.AddWithValue ("usid",
|
||||||
|
NpgsqlTypes.NpgsqlDbType.Bigint, userskill.Id);
|
||||||
|
cmd.ExecuteNonQuery ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cnx.Close ();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rate the specified user's skill.
|
||||||
|
/// It creates the record describing the user's skill
|
||||||
|
/// if not existent.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userSkill">UserSkillRating.</param>
|
||||||
|
public override long Rate (UserSkillRating userSkill)
|
||||||
|
{
|
||||||
|
// TODO Use the Author value to choose
|
||||||
|
// between a self rating that goes into the `userskills` table
|
||||||
|
// and a client rating that goes into the
|
||||||
|
// `statisfaction` table.
|
||||||
|
long usid = 0;
|
||||||
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) {
|
||||||
|
cnx.Open ();
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
if (userSkill.Id == 0) {
|
||||||
|
cmd.CommandText = "insert into userskills " +
|
||||||
|
" ( skillid, rate, username, applicationname ) " +
|
||||||
|
" values ( :sid, :rate, :uname, :app ) " +
|
||||||
|
" returning _id ";
|
||||||
|
cmd.Parameters.AddWithValue ("sid", NpgsqlDbType.Bigint, userSkill.Id);
|
||||||
|
cmd.Parameters.AddWithValue ("rate", NpgsqlDbType.Integer, userSkill.Rate);
|
||||||
|
cmd.Parameters.AddWithValue ("uname", NpgsqlDbType.Varchar, userSkill.Performer);
|
||||||
|
cmd.Parameters.AddWithValue ("app", NpgsqlDbType.Varchar, applicationName);
|
||||||
|
usid = (long) cmd.ExecuteScalar ();
|
||||||
|
} else {
|
||||||
|
cmd.CommandText = "update userskills " +
|
||||||
|
" set rate = :rate " +
|
||||||
|
" where _id = :usid ";
|
||||||
|
cmd.Parameters.AddWithValue ("rate", NpgsqlDbType.Integer, userSkill.Rate);
|
||||||
|
cmd.Parameters.AddWithValue ("usid", NpgsqlDbType.Bigint, userSkill.Id);
|
||||||
|
cmd.ExecuteNonQuery ();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
cnx.Close ();
|
||||||
|
}
|
||||||
|
return usid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rate the specified skill.
|
||||||
|
/// The access to this method
|
||||||
|
/// should be restricted to an Admin,
|
||||||
|
/// or a rating engine
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skill">Skill.</param>
|
||||||
|
public override void Rate (SkillRating skill)
|
||||||
|
{
|
||||||
|
// TODO Use the Author value to choose
|
||||||
|
// between a global setting for the application
|
||||||
|
// and an user setting on his needs
|
||||||
|
|
||||||
|
// when the `Author` value is not null,
|
||||||
|
// it's concerning a rating on a need of the Author
|
||||||
|
// if not, it's a need of the site
|
||||||
|
|
||||||
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) {
|
||||||
|
cnx.Open ();
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText = "update skill set rate = :rate where _id = :sid";
|
||||||
|
cmd.Parameters.AddWithValue ("sid", NpgsqlTypes.NpgsqlDbType.Bigint, skill.Id);
|
||||||
|
cmd.Parameters.AddWithValue ("rate", NpgsqlTypes.NpgsqlDbType.Integer, skill.Rate);
|
||||||
|
cmd.ExecuteNonQuery ();
|
||||||
|
}
|
||||||
|
cnx.Close ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the skill identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The skill identifier.</returns>
|
||||||
|
/// <param name="pattern">Pattern.</param>
|
||||||
|
public override Skill[] FindSkill (string pattern)
|
||||||
|
{
|
||||||
|
List<Skill> skills = new List<Skill> ();
|
||||||
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) {
|
||||||
|
cnx.Open ();
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText = "select _id, name, rate from skill where name like :name order by rate desc";
|
||||||
|
cmd.Parameters.AddWithValue ("name", NpgsqlTypes.NpgsqlDbType.Varchar, pattern);
|
||||||
|
cmd.Prepare ();
|
||||||
|
using (var rdr = cmd.ExecuteReader ()) {
|
||||||
|
if (rdr.HasRows) while (rdr.Read ()) {
|
||||||
|
skills.Add (new Skill () {
|
||||||
|
Id = (long)rdr.GetInt64 (0),
|
||||||
|
Name = (string)rdr.GetString (1),
|
||||||
|
Rate = (int) rdr.GetInt32(2)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cnx.Close ();
|
||||||
|
}
|
||||||
|
return skills.ToArray ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the performer.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The performer.</returns>
|
||||||
|
/// <param name="skillIds">Skill identifiers.</param>
|
||||||
|
public override string[] FindPerformer (long[] skillIds)
|
||||||
|
{
|
||||||
|
var res = new List<string> ();
|
||||||
|
|
||||||
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) {
|
||||||
|
cnx.Open ();
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
|
||||||
|
cmd.CommandText = " select username from userskills " +
|
||||||
|
" where skillid = :sid " +
|
||||||
|
" order by rate desc ";
|
||||||
|
cmd.Parameters.AddWithValue ("sid", NpgsqlDbType.Bigint, 0);
|
||||||
|
cmd.Prepare ();
|
||||||
|
|
||||||
|
foreach ( long sid in skillIds )
|
||||||
|
{
|
||||||
|
cmd.Parameters ["sid"].Value = sid;
|
||||||
|
using (var rdr = cmd.ExecuteReader ()) {
|
||||||
|
string uname = rdr.GetString (0);
|
||||||
|
if (!res.Contains(uname))
|
||||||
|
res.Add (uname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cnx.Close ();
|
||||||
|
}
|
||||||
|
return res.ToArray ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skillId">Skill identifier.</param>
|
||||||
|
public override void DeleteSkill (long skillId)
|
||||||
|
{
|
||||||
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) {
|
||||||
|
cnx.Open ();
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText = " delete from skill " +
|
||||||
|
" where _id = :sid ";
|
||||||
|
cmd.Parameters.AddWithValue ("sid", NpgsqlTypes.NpgsqlDbType.Bigint,skillId);
|
||||||
|
cmd.ExecuteNonQuery ();
|
||||||
|
}
|
||||||
|
cnx.Close ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the user skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userSkillId">User skill identifier.</param>
|
||||||
|
public override void DeleteUserSkill(long userSkillId) {
|
||||||
|
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString)) {
|
||||||
|
cnx.Open ();
|
||||||
|
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
|
||||||
|
cmd.CommandText = " delete from userskills " +
|
||||||
|
" where _id = :usid ";
|
||||||
|
cmd.Parameters.AddWithValue ("usid", NpgsqlTypes.NpgsqlDbType.Bigint,userSkillId);
|
||||||
|
cmd.ExecuteNonQuery ();
|
||||||
|
}
|
||||||
|
cnx.Close ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
90
WebControls/RateControl.cs
Normal file
|
|
@ -0,0 +1,90 @@
|
||||||
|
//
|
||||||
|
// RateControl.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.Mvc;
|
||||||
|
using Yavsc.Model;
|
||||||
|
|
||||||
|
namespace Yavsc
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Rate control.
|
||||||
|
/// </summary>
|
||||||
|
public class RateControl<TModel> : ViewUserControl<TModel> where TModel : IRating
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the Yavsc.Blogs.RateControl class.
|
||||||
|
/// </summary>
|
||||||
|
public RateControl ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the rate, that is, an integer between 0 and 100
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The rate.</value>
|
||||||
|
public int Rate
|
||||||
|
{
|
||||||
|
get { return (int) ViewState["rate"]; }
|
||||||
|
set {
|
||||||
|
ViewState["rate"] = value;
|
||||||
|
int rate = value;
|
||||||
|
int rounded = (rate / 10);
|
||||||
|
HasHalf = rounded % 2 == 1;
|
||||||
|
NbFilled = (int)rounded / 2;
|
||||||
|
NbEmpty = (5 - NbFilled) - ((HasHalf)?1:0) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the nb filed.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The nb filed.</value>
|
||||||
|
public int NbFilled {
|
||||||
|
set { ViewState["nbfilled"] = value; }
|
||||||
|
get { return (int) ViewState["nbfilled"]; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the nb empty.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The nb empty.</value>
|
||||||
|
public int NbEmpty {
|
||||||
|
set { ViewState["nbempty"] = value; }
|
||||||
|
get { return (int) ViewState["nbempty"]; }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a value indicating whether this instance has half.
|
||||||
|
/// </summary>
|
||||||
|
/// <value><c>true</c> if this instance has half; otherwise, <c>false</c>.</value>
|
||||||
|
public bool HasHalf {
|
||||||
|
set { ViewState["hashalf"] = value; }
|
||||||
|
get { return (bool) ViewState["hashalf"]; }
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnInit (EventArgs e)
|
||||||
|
{
|
||||||
|
base.OnInit (e);
|
||||||
|
Rate = this.Model.Rate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
109
web/ApiControllers/SkillController.cs
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
//
|
||||||
|
// SkillController.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 Yavsc.Model.Skill;
|
||||||
|
using System.Web.Http;
|
||||||
|
using Yavsc.Model;
|
||||||
|
|
||||||
|
namespace Yavsc.ApiControllers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Skill controller.
|
||||||
|
/// </summary>
|
||||||
|
public class SkillController : YavscController
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Create or update the specified Skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="s">the Skill objet.</param>
|
||||||
|
[ValidateAjaxAttribute,Authorize(Roles="Profiler")]
|
||||||
|
public long DeclareSkill (Skill s) {
|
||||||
|
if (ModelState.IsValid) {
|
||||||
|
SkillManager.DeclareSkill (s);
|
||||||
|
}
|
||||||
|
return s.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Declares the user's skill,
|
||||||
|
/// This call should be in charge of
|
||||||
|
/// the user himself, it's an user
|
||||||
|
/// declaration, and as a result,
|
||||||
|
/// this only is a declarative caracterisation of
|
||||||
|
/// the user's skills.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The skill.</returns>
|
||||||
|
/// <param name="dec">Dec.</param>
|
||||||
|
[Authorize()]
|
||||||
|
public long DeclareUserSkill (UserSkillDeclaration dec) {
|
||||||
|
return SkillManager.DeclareUserSkill(dec);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rate the specified user's skill.
|
||||||
|
/// A way for an effective client to rate
|
||||||
|
/// the service or good he should have got.
|
||||||
|
/// This is the king's value
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rate">The user skill rating.</param>
|
||||||
|
[Authorize()]
|
||||||
|
public long RateUserSkill (UserSkillRating rate) {
|
||||||
|
return SkillManager.RateUserSkill(User.Identity.Name, rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rates the skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="rate">Skill rating.</param>
|
||||||
|
[Authorize()]
|
||||||
|
public void RateSkill (SkillRating rate) {
|
||||||
|
SkillManager.RateSkill(User.Identity.Name,rate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the skill identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The skill identifier.</returns>
|
||||||
|
/// <param name="pattern">Pattern.</param>
|
||||||
|
public Skill [] FindSkill (string pattern){
|
||||||
|
return SkillManager.FindSkill(pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the performer.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The performer.</returns>
|
||||||
|
/// <param name="skillIds">Skill identifiers.</param>
|
||||||
|
public string [] FindPerformer (long []skillIds){
|
||||||
|
return SkillManager.FindPerformer(skillIds);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skillId">Skill identifier.</param>
|
||||||
|
[Authorize(Roles="Moderator")]
|
||||||
|
public void DeleteSkill (long skillId)
|
||||||
|
{
|
||||||
|
SkillManager.DeleteSkill (skillId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
68
web/App_Data/Sql/Skills.sql
Normal file
|
|
@ -0,0 +1,68 @@
|
||||||
|
|
||||||
|
-- Table: skill
|
||||||
|
|
||||||
|
-- DROP TABLE skill;
|
||||||
|
|
||||||
|
CREATE TABLE skill
|
||||||
|
(
|
||||||
|
_id bigserial NOT NULL,
|
||||||
|
name character varying(2024) NOT NULL,
|
||||||
|
rate integer NOT NULL DEFAULT 50,
|
||||||
|
CONSTRAINT skill_pkey PRIMARY KEY (_id),
|
||||||
|
CONSTRAINT skill_name_key UNIQUE (name)
|
||||||
|
)
|
||||||
|
WITH (
|
||||||
|
OIDS=FALSE
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
-- Table: userskills
|
||||||
|
|
||||||
|
-- DROP TABLE userskills;
|
||||||
|
|
||||||
|
CREATE TABLE userskills
|
||||||
|
(
|
||||||
|
applicationname character varying(512) NOT NULL,
|
||||||
|
username character varying(512) NOT NULL,
|
||||||
|
comment character varying,
|
||||||
|
skillid bigint NOT NULL, -- Skill identifier
|
||||||
|
rate integer NOT NULL,
|
||||||
|
_id bigserial NOT NULL, -- The id ...
|
||||||
|
CONSTRAINT userskills_pkey PRIMARY KEY (applicationname, username, skillid),
|
||||||
|
CONSTRAINT userskills_applicationname_fkey FOREIGN KEY (applicationname, username)
|
||||||
|
REFERENCES users (applicationname, username) MATCH SIMPLE
|
||||||
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
CONSTRAINT userskills_skillid_fkey FOREIGN KEY (skillid)
|
||||||
|
REFERENCES skill (_id) MATCH SIMPLE
|
||||||
|
ON UPDATE CASCADE ON DELETE CASCADE,
|
||||||
|
CONSTRAINT userskills__id_key UNIQUE (_id)
|
||||||
|
)
|
||||||
|
WITH (
|
||||||
|
OIDS=FALSE
|
||||||
|
);
|
||||||
|
COMMENT ON COLUMN userskills.skillid IS 'Skill identifier';
|
||||||
|
COMMENT ON COLUMN userskills._id IS 'The id ...';
|
||||||
|
|
||||||
|
-- Table: satisfaction
|
||||||
|
|
||||||
|
-- DROP TABLE satisfaction;
|
||||||
|
|
||||||
|
CREATE TABLE satisfaction
|
||||||
|
(
|
||||||
|
_id bigserial NOT NULL,
|
||||||
|
userskillid bigint, -- the user's skill reference
|
||||||
|
rate integer, -- The satisfaction rating associated by a client to an user's skill
|
||||||
|
comnt character varying(8192), -- The satisfaction textual comment associated by a client to an user's skill, it could be formatted ala Markdown
|
||||||
|
CONSTRAINT satisfaction_pkey PRIMARY KEY (_id),
|
||||||
|
CONSTRAINT satisfaction_userskillid_fkey FOREIGN KEY (userskillid)
|
||||||
|
REFERENCES userskills (_id) MATCH SIMPLE
|
||||||
|
ON UPDATE CASCADE ON DELETE CASCADE
|
||||||
|
)
|
||||||
|
WITH (
|
||||||
|
OIDS=FALSE
|
||||||
|
);
|
||||||
|
COMMENT ON COLUMN satisfaction.userskillid IS 'the user''s skill reference';
|
||||||
|
COMMENT ON COLUMN satisfaction.rate IS 'The satisfaction rating associated by a client to an user''s skill';
|
||||||
|
COMMENT ON COLUMN satisfaction.comnt IS 'The satisfaction textual comment associated by a client to an user''s skill, it could be formatted ala Markdown';
|
||||||
|
|
||||||
|
|
||||||
465
web/App_Themes/clear/style.css
Normal file
|
|
@ -0,0 +1,465 @@
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: grey;
|
||||||
|
color: #303030;
|
||||||
|
font-family: 'Arial', cursive;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
.tagname { color: #D0FFD0; }
|
||||||
|
.tagname+.tagname:before { content: ', '; }
|
||||||
|
.tagname:hover { background-color: red; cursor:pointer; }
|
||||||
|
|
||||||
|
/* Start by setting display:none to make this hidden.
|
||||||
|
Then we position it in relation to the viewport window
|
||||||
|
with position:fixed. Width, height, top and left speak
|
||||||
|
for themselves. Background we set to 80% white with
|
||||||
|
our animation centered, and no-repeating */
|
||||||
|
.modal {
|
||||||
|
display: none;
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1000;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
background: rgba( 255, 255, 255, .8 )
|
||||||
|
url('/App_Themes/images/FhHRx.gif')
|
||||||
|
50% 50%
|
||||||
|
no-repeat;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
.dispmodal {
|
||||||
|
position: fixed;
|
||||||
|
z-index: 1000;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 100%;
|
||||||
|
overflow-y: auto;
|
||||||
|
overflow-x: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.loading {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
body.loading .modal {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.iconsmall { max-height: 1.3em; max-width: 1.3em; }
|
||||||
|
|
||||||
|
input, textarea, checkbox {
|
||||||
|
color: #FFA0A0;
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post .photo { max-width: 100%; }
|
||||||
|
|
||||||
|
.blogbanner { float: left; top:0; }
|
||||||
|
.subtitle { font-size:small; font-style: italic; }
|
||||||
|
header {
|
||||||
|
transition: margin 2s, padding 2s;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
display: block;
|
||||||
|
background: url("/App_Themes/images/live-concert-388160_1280.jpg") 50% 0 repeat fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
#logo {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
min-height: 12em;
|
||||||
|
background: url("/App_Themes/images/logo.s.png") 1em 1em no-repeat fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
h1, h2, h3 { background-color: rgba(256,256,256,.5); }
|
||||||
|
|
||||||
|
nav {
|
||||||
|
transition: margin 2s, padding 2s;
|
||||||
|
margin: 2em;
|
||||||
|
padding: 2em;
|
||||||
|
display: block;
|
||||||
|
border-radius:1em;
|
||||||
|
background: url("/App_Themes/images/live-concert-388160_1280.jpg") 50% 10em repeat fixed ;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
nav li { display: inline-block; }
|
||||||
|
main {
|
||||||
|
transition: margin 2s, padding 2s;
|
||||||
|
margin: 2em;
|
||||||
|
padding: 2em;
|
||||||
|
display: block;
|
||||||
|
border-radius:1em;
|
||||||
|
background: url("/App_Themes/images/musician-923526_1.nbbi.jpg") 50% 20em repeat fixed ;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
transition: margin 2s, padding 2s;
|
||||||
|
background: url("/App_Themes/images/live-concert-388160_1280.jpg") 50% 30em repeat fixed ;
|
||||||
|
margin: 0;
|
||||||
|
margin-top: 2em;
|
||||||
|
padding: 2em;
|
||||||
|
display: block;
|
||||||
|
clear: both;
|
||||||
|
font-size: smaller;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
border-radius:1em;
|
||||||
|
padding:1em;
|
||||||
|
}
|
||||||
|
legend {
|
||||||
|
border-radius:5px;
|
||||||
|
padding:.5em;
|
||||||
|
background-color: rgba(240,240,240,.5);
|
||||||
|
}
|
||||||
|
#copyr { text-align: center; display: block; background-color: rgba(250,250,250,.8); }
|
||||||
|
footer p { display:inline-block; }
|
||||||
|
|
||||||
|
footer img { max-height: 3em; vertical-align: middle; }
|
||||||
|
a img, h1 img, .menuitem img { vertical-align: middle; }
|
||||||
|
|
||||||
|
#gspacer {
|
||||||
|
background-color: rgba(209,209,209,.8);
|
||||||
|
border-radius:1em;
|
||||||
|
margin:1em; padding:1em; display: inline-block }
|
||||||
|
|
||||||
|
form {
|
||||||
|
background-color: rgba(150,150,256,0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldset {
|
||||||
|
background-color: rgba(216,216,256,0.8);
|
||||||
|
border-radius:5px; border: solid 1px #000060;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post video, .post img {
|
||||||
|
max-width:100%;
|
||||||
|
max-height:75%;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside {
|
||||||
|
display: inline-block;
|
||||||
|
float: right;
|
||||||
|
max-width: 40em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.postpreview {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: rgba(233,233,233,0.8);
|
||||||
|
border-radius:1em;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
img.postpreviewphoto, .postpreview video, .postpreview img {
|
||||||
|
padding: 1em;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post {
|
||||||
|
display:block;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: rgba(256,256,256,0.8);
|
||||||
|
border-radius:1em;
|
||||||
|
}
|
||||||
|
.hiddenpost { background-color: rgba(160,160,160,0.5); }
|
||||||
|
.fullwidth { width: 100%; }
|
||||||
|
|
||||||
|
textarea.fullwidth { min-height:10em; }
|
||||||
|
a { color: rgb(0,56,0); }
|
||||||
|
a:hover {
|
||||||
|
background-color: rgba(160,160,160,.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
footer a {
|
||||||
|
transition: margin 2s, padding 2s;
|
||||||
|
border-radius:1em;
|
||||||
|
margin:1em;
|
||||||
|
padding:1em;
|
||||||
|
text-decoration: none;
|
||||||
|
display:inline-block;
|
||||||
|
color: black;
|
||||||
|
font-weight: bold;
|
||||||
|
border: solid black 1px;
|
||||||
|
background-color: rgba(220,220,220,.8);
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: 'Arial', cursive;
|
||||||
|
}
|
||||||
|
.panel { max-width: 24em; display:inline-block; padding: 1em; }
|
||||||
|
.panel,.bshpanel, aside {
|
||||||
|
background-color: rgba(200,200,200,.8);
|
||||||
|
border-radius: 1em;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
.spanel {
|
||||||
|
max-width: 18em;
|
||||||
|
display: inline-block;
|
||||||
|
padding: .3em;
|
||||||
|
}
|
||||||
|
.xspanel {
|
||||||
|
max-width:13em;
|
||||||
|
display: inline-block;
|
||||||
|
padding:.2em;
|
||||||
|
}
|
||||||
|
.xxspanel {
|
||||||
|
max-width:7em;
|
||||||
|
display: inline-block;
|
||||||
|
padding:.1em;
|
||||||
|
}
|
||||||
|
.hint {
|
||||||
|
display: inline;
|
||||||
|
font-style: italic;
|
||||||
|
font-size: smaller;
|
||||||
|
}
|
||||||
|
.hint::before {
|
||||||
|
content: "(";
|
||||||
|
}
|
||||||
|
.hint::after {
|
||||||
|
content: ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.usertitleref {
|
||||||
|
border-radius: 1em;
|
||||||
|
background-color:rgba(256,256,212,0.6);
|
||||||
|
font-family: 'Arial', cursive;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
font-size: medium;
|
||||||
|
}
|
||||||
|
.editable {
|
||||||
|
margin: .5em;
|
||||||
|
min-height:1em;
|
||||||
|
border-radius: 1em;
|
||||||
|
border: dashed rgb(200,200,256) 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification {
|
||||||
|
font-size: large;
|
||||||
|
background-color: rgba(264,264,128,0.5);
|
||||||
|
border: solid green 1px;
|
||||||
|
padding: 1em;
|
||||||
|
border-radius:1em;
|
||||||
|
margin:1em;
|
||||||
|
padding:1em;
|
||||||
|
}
|
||||||
|
.dirty {
|
||||||
|
background-color: rgba(256,228,128,0.5);
|
||||||
|
}
|
||||||
|
.error, #error {
|
||||||
|
color: #f88;
|
||||||
|
font-size: large;
|
||||||
|
background-color: rgba(256,.5);
|
||||||
|
}
|
||||||
|
.validation-summary-errors{
|
||||||
|
color: #f88;
|
||||||
|
background-color: rgba(256,256,139,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden { display:none; }
|
||||||
|
|
||||||
|
ul.preview li:nth-child(-n+10) {
|
||||||
|
display:inline;
|
||||||
|
font-size:xx-small;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.preview li:nth-child(n) {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.validation-summary-errors{
|
||||||
|
color: #f88;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.menuitem {
|
||||||
|
display:inline-block;
|
||||||
|
color: black;
|
||||||
|
font-weight: bold;
|
||||||
|
border-radius:1em;
|
||||||
|
border: solid black 1px;
|
||||||
|
background-color: rgba(220,220,220,.8);
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: 'Arial', cursive;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.actionlink {
|
||||||
|
text-decoration: none;
|
||||||
|
display:inline-block;
|
||||||
|
color: black;
|
||||||
|
font-weight: bold;
|
||||||
|
border-radius:1em;
|
||||||
|
border: solid black 1px;
|
||||||
|
background-color: rgba(220,220,220,.8);
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: 'Arial', cursive;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, select, textarea {
|
||||||
|
color: black;
|
||||||
|
background-color:rgba(256,256,256,0.8);
|
||||||
|
border: solid 1px rgb(128,128,128);
|
||||||
|
border-radius:1em;
|
||||||
|
font-family: 'Arial', cursive;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:active {
|
||||||
|
background-color:rgba(184,180,132,0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
input:hover, textarea:hover {
|
||||||
|
color: white;
|
||||||
|
background-color:rgba(164,164,164,0.8);
|
||||||
|
}
|
||||||
|
.code {
|
||||||
|
font-family: "monospace";
|
||||||
|
background-color: rgba(230,230,230,0.5);
|
||||||
|
border-radius:25px;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
#avatar {
|
||||||
|
float: left;
|
||||||
|
margin:1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment {
|
||||||
|
border-radius:25px;
|
||||||
|
font-size: smaller;
|
||||||
|
}
|
||||||
|
|
||||||
|
.onhover {
|
||||||
|
display:none;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ohafter:hover + .onhover, .ohinside:hover > .onhover {
|
||||||
|
display:block;
|
||||||
|
z-index:2;
|
||||||
|
padding:5px; margin:5px;
|
||||||
|
background-color: rgba(240,240,250,.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-validation-error { border: solid 1px red; }
|
||||||
|
.field-validation-error { color: red; }
|
||||||
|
|
||||||
|
.c2 { font-size: small; font-style: italic; }
|
||||||
|
.c3 { font-size: x-small; font-style: italic; }
|
||||||
|
|
||||||
|
header h1, .actionlink, .menuitem {transition: padding 2s; padding:1em;}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
body {background-color:white;color:black;}
|
||||||
|
.control, .actionlink, .menuitem, nav { display:none;}
|
||||||
|
}
|
||||||
|
|
||||||
|
.bshpanel { display:block; }
|
||||||
|
.bsh { display: none; }
|
||||||
|
.c3 { display:initial; }
|
||||||
|
.c3-alt { display:none; }
|
||||||
|
|
||||||
|
@media all and (max-width: 640px) {
|
||||||
|
#logo {
|
||||||
|
min-height: 6em;
|
||||||
|
background: url("/App_Themes/images/logo.xs.png") 0 0 no-repeat fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
background: url("/App_Themes/images/live-concert-388160_1280.s.jpg") 50% 0 repeat fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
#avatar {
|
||||||
|
margin:.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
header h1, .actionlink, .menuitem { padding:.5em;}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
margin: 1em;
|
||||||
|
padding: 1em;
|
||||||
|
background: url("/App_Themes/images/live-concert-388160_1280.s.jpg") 50% 10% repeat fixed ;
|
||||||
|
}
|
||||||
|
main {
|
||||||
|
margin: 1em;
|
||||||
|
padding: 1em;
|
||||||
|
background: url("/App_Themes/images/musician-923526_1.nbbi.xs.jpg") 50% 20em repeat fixed ;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
background: url("/App_Themes/images/live-concert-388160_1280.s.jpg") 50% 90% repeat fixed ;
|
||||||
|
}
|
||||||
|
footer a {
|
||||||
|
border-radius:.5em;
|
||||||
|
margin:.5em;
|
||||||
|
padding:.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification {
|
||||||
|
padding: .5em;
|
||||||
|
border-radius:.5em;
|
||||||
|
margin:.5em;
|
||||||
|
padding:.5em;
|
||||||
|
}
|
||||||
|
.menuitem {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.post {
|
||||||
|
margin:.3em;
|
||||||
|
padding:.3em;
|
||||||
|
}
|
||||||
|
.usertitleref{
|
||||||
|
padding:.3em;
|
||||||
|
}
|
||||||
|
.bshpanel { cursor:zoom-in; }
|
||||||
|
|
||||||
|
.c2 { display:initial; }
|
||||||
|
.c2-alt { display:none; }
|
||||||
|
.c3 { display:none; }
|
||||||
|
.c3-alt { display:initial; }
|
||||||
|
#gspacer {
|
||||||
|
border-radius:.5em;
|
||||||
|
margin:.5em; padding:.5em; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media all and (max-width: 350px) {
|
||||||
|
#logo {
|
||||||
|
min-height: 3em;
|
||||||
|
background: url("/App_Themes/images/logo.xxs.png") 0 0 no-repeat fixed;
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
background: url("/App_Themes/images/live-concert-388160_1280.xxs.jpg") -1em -1em repeat fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
header h1, .actionlink, .menuitem { padding:.2em;}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
margin: .5em;
|
||||||
|
padding: .5em;
|
||||||
|
background: url("/App_Themes/images/live-concert-388160_1280.xxs.jpg") 50% 10% repeat fixed ;
|
||||||
|
}
|
||||||
|
main {
|
||||||
|
margin: .5em;
|
||||||
|
padding: .5em;
|
||||||
|
background: url("/App_Themes/images/musician-923526_1.nbbi.xxs.jpg") 50% 20em repeat fixed ;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
background: url("/App_Themes/images/live-concert-388160_1280.xxs.jpg") 50% 90% repeat fixed ;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
border-radius:.2em;
|
||||||
|
margin:.2em;
|
||||||
|
padding:.2em;
|
||||||
|
}
|
||||||
|
.c2 { display:none; }
|
||||||
|
.c2-alt { display:initial; }
|
||||||
|
#gspacer {
|
||||||
|
border-radius:.2em;
|
||||||
|
margin:.2em; padding:.2em; }
|
||||||
|
}
|
||||||
|
|
||||||
345
web/App_Themes/dark/style.css
Normal file
|
|
@ -0,0 +1,345 @@
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Arial', cursive;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
background-color: black;
|
||||||
|
color: #D0FFD0;
|
||||||
|
}
|
||||||
|
.tagname { color: #D0FFD0; }
|
||||||
|
.tagname+.tagname:before { content: ', '; }
|
||||||
|
.tagname:hover { cursor:pointer; background-color: red; }
|
||||||
|
|
||||||
|
|
||||||
|
.rate {
|
||||||
|
border-radius:1em;
|
||||||
|
border: solid rgb(128,128,0) 1px;
|
||||||
|
background-color: rgba(20,20,20,.8);
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
.rate:hover { border-color: green;
|
||||||
|
background-color:rgba(30,0,124,0.9); }
|
||||||
|
|
||||||
|
input, textarea, checkbox {
|
||||||
|
color: #FFFFA0;
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
header {
|
||||||
|
transition: margin 2s, padding 2s;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
padding-top: 2em;
|
||||||
|
padding-bottom:2em;
|
||||||
|
display: block;
|
||||||
|
background: url("/App_Themes/images/star-939235_1280.jpg") -3em -3em no-repeat fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
header h1, header a {
|
||||||
|
transition:padding 2s;
|
||||||
|
background-color: rgba(0,0,0,.5);
|
||||||
|
margin:0; padding:1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
transition: margin 2s, padding 2s;
|
||||||
|
margin: 2em;
|
||||||
|
padding: 2em;
|
||||||
|
display: block;
|
||||||
|
border-radius:1em;
|
||||||
|
background: url("/App_Themes/images/helix-nebula-1400x1400.s.jpg") 50% 10% repeat fixed ;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
transition: margin 2s, padding 2s;
|
||||||
|
margin: 2em;
|
||||||
|
padding: 2em;
|
||||||
|
display: block;
|
||||||
|
border-radius:1em;
|
||||||
|
background: url("/App_Themes/images/p8-av4.png") 50% 20em no-repeat fixed ;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
transition: margin 2s, padding 2s;
|
||||||
|
background: url("/App_Themes/images/helix-nebula-1400x1400.s.jpg") 50% 90% repeat fixed ;
|
||||||
|
margin: 0;
|
||||||
|
margin-top: 2em;
|
||||||
|
padding: 2em;
|
||||||
|
display: block;
|
||||||
|
clear: both;
|
||||||
|
font-size: smaller;
|
||||||
|
justify-content: space-around;
|
||||||
|
}
|
||||||
|
|
||||||
|
#copyr { text-align: center; display: block; background-color: rgba(20,20,20,.8); }
|
||||||
|
footer p { display:inline-block; }
|
||||||
|
|
||||||
|
footer img { max-height: 3em; vertical-align: middle; }
|
||||||
|
a img, h1 img, .menuitem img { vertical-align: middle; }
|
||||||
|
fieldset {
|
||||||
|
background-color: rgba(16,16,64,0.8);
|
||||||
|
border-radius:5px; border: solid 1px #000060;
|
||||||
|
}
|
||||||
|
|
||||||
|
legend {
|
||||||
|
background-color: rgba(0,0,32,.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
#gspacer {
|
||||||
|
background-color: rgba(20,20,20,.8);
|
||||||
|
border-radius:1em;
|
||||||
|
margin:1em; padding:1em; display: inline-block }
|
||||||
|
|
||||||
|
|
||||||
|
main video, main img {
|
||||||
|
max-width:100%;
|
||||||
|
max-height:75%;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
aside {
|
||||||
|
display: inline-block;
|
||||||
|
float: right;
|
||||||
|
max-width: 40em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.postpreview {
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 40em;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: rgba(0,0,32,0.8);
|
||||||
|
border-radius:1em;
|
||||||
|
}
|
||||||
|
.postpreview video, .postpreview img {
|
||||||
|
max-width: 100%;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
.post {
|
||||||
|
display:block;
|
||||||
|
padding: 1em;
|
||||||
|
background-color: rgba(0,0,32,0.8);
|
||||||
|
color: #eee;
|
||||||
|
border-radius:1em;
|
||||||
|
}
|
||||||
|
.hiddenpost { background-color: rgba(16,16,16,0.5); }
|
||||||
|
.fullwidth { width: 100%; }
|
||||||
|
|
||||||
|
textarea.fullwidth { min-height:10em; }
|
||||||
|
|
||||||
|
.thanks {
|
||||||
|
max-width: 10%;
|
||||||
|
text-align: center;
|
||||||
|
font-size:smaller;
|
||||||
|
display:inline;
|
||||||
|
bottom:0;
|
||||||
|
}
|
||||||
|
.panel {
|
||||||
|
display:inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.panel,.bshpanel, aside {
|
||||||
|
background-color: rgba(20,20,20,.8);
|
||||||
|
border-radius: 1em;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
.spanel {
|
||||||
|
max-width: 18em;
|
||||||
|
display: inline-block;
|
||||||
|
padding: .3em;
|
||||||
|
}
|
||||||
|
.xspanel {
|
||||||
|
max-width:13em;
|
||||||
|
display: inline-block;
|
||||||
|
padding:.2em;
|
||||||
|
}
|
||||||
|
.xxspanel {
|
||||||
|
max-width:7em;
|
||||||
|
display: inline-block;
|
||||||
|
padding:.1em;
|
||||||
|
}
|
||||||
|
.hint {
|
||||||
|
display: inline;
|
||||||
|
font-style: italic;
|
||||||
|
font-size: smaller;
|
||||||
|
}
|
||||||
|
.hint::before {
|
||||||
|
content: "(";
|
||||||
|
}
|
||||||
|
.hint::after {
|
||||||
|
content: ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.usertitleref {
|
||||||
|
border-radius: 1em;
|
||||||
|
background-color:rgba(0,0,32,0.6);
|
||||||
|
font-family: 'Arial', cursive;
|
||||||
|
padding: 1em;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
font-size: medium;
|
||||||
|
}
|
||||||
|
.editable {
|
||||||
|
margin: .5em;
|
||||||
|
min-height:1em;
|
||||||
|
border-radius: 1em;
|
||||||
|
border: dashed rgb(020,20,256) 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification {
|
||||||
|
font-size: large;
|
||||||
|
background-color: rgba(64,64,0,0.5);
|
||||||
|
border: solid green 1px;
|
||||||
|
padding: 1em;
|
||||||
|
border-radius:1em;
|
||||||
|
margin:1em;
|
||||||
|
padding:1em;
|
||||||
|
}
|
||||||
|
.dirty {
|
||||||
|
background-color: rgba(128,128,0,0.5);
|
||||||
|
}
|
||||||
|
.error, #error {
|
||||||
|
color: #f88;
|
||||||
|
font-size: large;
|
||||||
|
background-color: rgba(256,0,0,0.5);
|
||||||
|
}
|
||||||
|
.validation-summary-errors{
|
||||||
|
color: #f88;
|
||||||
|
background-color: rgba(256,0,0,0.5);
|
||||||
|
}
|
||||||
|
|
||||||
|
.hidden { display:none; }
|
||||||
|
|
||||||
|
ul.preview li:nth-child(-n+10) {
|
||||||
|
display:inline;
|
||||||
|
font-size:xx-small;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul.preview li:nth-child(n) {
|
||||||
|
display:none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.validation-summary-errors{
|
||||||
|
color: #f88;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.actionlink, .menuitem, a {
|
||||||
|
border-color: rgb(128,128,0);
|
||||||
|
background-color: rgba(20,20,20,.8);
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
|
|
||||||
|
input, select, textarea {
|
||||||
|
color: white;
|
||||||
|
background-color:rgba(0,0,64,0.8);
|
||||||
|
border-color: rgb(128,128,128);
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
background-color:rgba(30,0,124,0.9);
|
||||||
|
border-color: green ;
|
||||||
|
}
|
||||||
|
a:active {
|
||||||
|
background-color:rgba(124,0,32,0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
input:hover, textarea:hover {
|
||||||
|
color: white;
|
||||||
|
background-color:rgba(64,64,64,0.8);
|
||||||
|
}
|
||||||
|
.code {
|
||||||
|
background-color: rgba(0,0,256,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@media all and (max-width: 640px) {
|
||||||
|
header {
|
||||||
|
padding-top:1em;
|
||||||
|
padding-bottom:1em;
|
||||||
|
background: url("/App_Themes/images/star-939235_1280.s.jpg") 0 0 no-repeat fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
#avatar {
|
||||||
|
margin:.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
header h1, header a , .actionlink, .menuitem, a { padding:.5em;}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
margin: 1em;
|
||||||
|
padding: 1em;
|
||||||
|
background: url("/App_Themes/images/helix-nebula-1400x1400.s.jpg") 50% 10% repeat fixed ;
|
||||||
|
}
|
||||||
|
main {
|
||||||
|
margin: 1em;
|
||||||
|
padding: 1em;
|
||||||
|
background: url("/App_Themes/images/p8-av4.s.jpg") 50% 20em no-repeat fixed ;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
background: url("/App_Themes/images/helix-nebula-1400x1400.s.jpg") 50% 90% repeat fixed ;
|
||||||
|
}
|
||||||
|
footer a {
|
||||||
|
border-radius:.5em;
|
||||||
|
margin:.5em;
|
||||||
|
padding:.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification {
|
||||||
|
padding: .5em;
|
||||||
|
border-radius:.5em;
|
||||||
|
margin:.5em;
|
||||||
|
padding:.5em;
|
||||||
|
}
|
||||||
|
.menuitem {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.post {
|
||||||
|
margin:.3em;
|
||||||
|
padding:.3em;
|
||||||
|
}
|
||||||
|
.usertitleref{
|
||||||
|
padding:.3em;
|
||||||
|
}
|
||||||
|
.bshpanel { cursor:zoom-in; }
|
||||||
|
|
||||||
|
.c2 { display:initial; }
|
||||||
|
.c2-alt { display:none; }
|
||||||
|
.c3 { display:none; }
|
||||||
|
.c3-alt { display:initial; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media all and (max-width: 350px) {
|
||||||
|
header {
|
||||||
|
padding-top:.5em;
|
||||||
|
padding-bottom:.5em;
|
||||||
|
background: url("/App_Themes/images/star-939235_1280.xxs.jpg") 0 0 no-repeat fixed;
|
||||||
|
}
|
||||||
|
|
||||||
|
header h1, header a { padding:.2em;}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
margin: .5em;
|
||||||
|
padding: .5em;
|
||||||
|
background: url("/App_Themes/images/helix-nebula-1400x1400.xxs.jpg") 50% 10% repeat fixed ;
|
||||||
|
}
|
||||||
|
main {
|
||||||
|
margin: .5em;
|
||||||
|
padding: .5em;
|
||||||
|
background: url("/App_Themes/images/p8-av4.xxs.jpg") 50% 20em repeat fixed ;
|
||||||
|
}
|
||||||
|
footer {
|
||||||
|
background: url("/App_Themes/images/helix-nebula-1400x1400.xxs.jpg") 50% 10% repeat fixed ;
|
||||||
|
}
|
||||||
|
footer a {
|
||||||
|
border-radius:.2em;
|
||||||
|
margin:.2em;
|
||||||
|
padding:.2em;
|
||||||
|
}
|
||||||
|
.c2 { display:none; }
|
||||||
|
.c2-alt { display:initial; }
|
||||||
|
}
|
||||||
BIN
web/App_Themes/delete.gif
Normal file
|
After Width: | Height: | Size: 752 B |
BIN
web/App_Themes/images/facebook.png
Normal file
|
After Width: | Height: | Size: 4 KiB |
BIN
web/App_Themes/images/helix-nebula.l.jpg
Normal file
|
After Width: | Height: | Size: 164 KiB |
BIN
web/App_Themes/images/helix-nebula.s.jpg
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
web/App_Themes/images/helix-nebula.xs.jpg
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
web/App_Themes/images/logo-1.jpg
Normal file
|
After Width: | Height: | Size: 46 KiB |
BIN
web/App_Themes/images/logo-1.png
Normal file
|
After Width: | Height: | Size: 293 KiB |
BIN
web/App_Themes/images/logo.jpg
Normal file
|
After Width: | Height: | Size: 52 KiB |
BIN
web/App_Themes/images/logo.s.png
Normal file
|
After Width: | Height: | Size: 136 KiB |
BIN
web/App_Themes/images/logo.xs.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
web/App_Themes/images/logo.xxs.png
Normal file
|
After Width: | Height: | Size: 9.8 KiB |
BIN
web/App_Themes/images/p8-av4.xxs.png
Normal file
|
After Width: | Height: | Size: 132 KiB |
BIN
web/App_Themes/images/star-939235_1280.xs.jpg
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
web/App_Themes/images/twiter.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
58
web/AuthorizeAttribute.cs
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
//
|
||||||
|
// AuthorizeAttribute.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;
|
||||||
|
|
||||||
|
namespace Yavsc
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Authorize attribute.
|
||||||
|
/// </summary>
|
||||||
|
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
|
||||||
|
public class AuthorizeAttribute: System.Web.Mvc.AuthorizeAttribute
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Handles the unauthorized request.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="filterContext">Filter context.</param>
|
||||||
|
protected override void HandleUnauthorizedRequest(System.Web.Mvc.AuthorizationContext filterContext)
|
||||||
|
{
|
||||||
|
if (filterContext.HttpContext.Request.IsAuthenticated)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace (Users) && !string.IsNullOrEmpty (Roles))
|
||||||
|
{
|
||||||
|
// let the client know which role were allowed here
|
||||||
|
// filterContext.ActionDescriptor.ControllerDescriptor.
|
||||||
|
filterContext.Result = new System.Web.Mvc.RedirectResult ("~/Home/RestrictedArea");
|
||||||
|
filterContext.Controller.ViewData ["ActionName"] = filterContext.ActionDescriptor.ActionName;
|
||||||
|
filterContext.Controller.ViewData ["ControllerName"] = filterContext.ActionDescriptor.ControllerDescriptor.ControllerName;
|
||||||
|
filterContext.Controller.ViewData ["Roles"] = Roles;
|
||||||
|
filterContext.Controller.ViewData ["Users"] = Users;
|
||||||
|
}
|
||||||
|
else filterContext.Result = new System.Web.Mvc.HttpStatusCodeResult((int)System.Net.HttpStatusCode.Forbidden);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
base.HandleUnauthorizedRequest(filterContext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
98
web/Helpers/Google/GoogleHelpers.cs
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
//
|
||||||
|
// GoogleHelpers.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 Yavsc.Model.Google;
|
||||||
|
using System.Web.Profile;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace Yavsc.Helpers.Google
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Google helpers.
|
||||||
|
/// </summary>
|
||||||
|
public static class GoogleHelpers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the events.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The events.</returns>
|
||||||
|
/// <param name="profile">Profile.</param>
|
||||||
|
/// <param name="mindate">Mindate.</param>
|
||||||
|
/// <param name="maxdate">Maxdate.</param>
|
||||||
|
public static CalendarEventList GetEvents(this ProfileBase profile, DateTime mindate, DateTime maxdate)
|
||||||
|
{
|
||||||
|
string gcalid = (string) profile.GetPropertyValue ("gcalid");
|
||||||
|
if (string.IsNullOrWhiteSpace (gcalid))
|
||||||
|
throw new ArgumentException ("NULL gcalid");
|
||||||
|
CalendarApi c = new CalendarApi (clientApiKey);
|
||||||
|
string creds = OAuth2.GetFreshGoogleCredential (profile);
|
||||||
|
return c.GetCalendar (gcalid, mindate, maxdate, creds);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the calendars.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The calendars.</returns>
|
||||||
|
/// <param name="profile">Profile.</param>
|
||||||
|
public static CalendarList GetCalendars (this ProfileBase profile)
|
||||||
|
{
|
||||||
|
string cred = OAuth2.GetFreshGoogleCredential (profile);
|
||||||
|
CalendarApi c = new CalendarApi (clientApiKey);
|
||||||
|
return c.GetCalendars (cred);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string clientId = ConfigurationManager.AppSettings ["GOOGLE_CLIENT_ID"];
|
||||||
|
private static string clientSecret = ConfigurationManager.AppSettings ["GOOGLE_CLIENT_SECRET"];
|
||||||
|
private static string clientApiKey = ConfigurationManager.AppSettings ["GOOGLE_API_KEY"];
|
||||||
|
/// <summary>
|
||||||
|
/// Login the specified response, state and callBack.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="response">Response.</param>
|
||||||
|
/// <param name="state">State.</param>
|
||||||
|
/// <param name="callBack">Call back.</param>
|
||||||
|
public static void Login(this HttpResponseBase response, string state, string callBack)
|
||||||
|
{
|
||||||
|
OAuth2 oa = new OAuth2 (callBack, clientId,clientSecret);
|
||||||
|
oa.Login (response, state);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Cals the login.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="response">Response.</param>
|
||||||
|
/// <param name="state">State.</param>
|
||||||
|
/// <param name="callBack">Call back.</param>
|
||||||
|
public static void CalLogin(this HttpResponseBase response, string state, string callBack)
|
||||||
|
{
|
||||||
|
OAuth2 oa = new OAuth2 (callBack,clientId,clientSecret);
|
||||||
|
oa.GetCalendarScope (response, state);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Creates the O auth2.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The O auth2.</returns>
|
||||||
|
/// <param name="callBack">Call back.</param>
|
||||||
|
public static OAuth2 CreateOAuth2(string callBack)
|
||||||
|
{
|
||||||
|
return new OAuth2 (callBack,clientId,clientSecret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
189
web/Scripts/jquery.unobtrusive-ajax.js
vendored
Normal file
|
|
@ -0,0 +1,189 @@
|
||||||
|
/* NUGET: BEGIN LICENSE TEXT
|
||||||
|
*
|
||||||
|
* Microsoft grants you the right to use these script files for the sole
|
||||||
|
* purpose of either: (i) interacting through your browser with the Microsoft
|
||||||
|
* website or online service, subject to the applicable licensing or use
|
||||||
|
* terms; or (ii) using the files as included with a Microsoft product subject
|
||||||
|
* to that product's license terms. Microsoft reserves all other rights to the
|
||||||
|
* files not expressly granted by Microsoft, whether by implication, estoppel
|
||||||
|
* or otherwise. Insofar as a script file is dual licensed under GPL,
|
||||||
|
* Microsoft neither took the code under GPL nor distributes it thereunder but
|
||||||
|
* under the terms set out in this paragraph. All notices and licenses
|
||||||
|
* below are for informational purposes only.
|
||||||
|
*
|
||||||
|
* NUGET: END LICENSE TEXT */
|
||||||
|
/*!
|
||||||
|
** Unobtrusive Ajax support library for jQuery
|
||||||
|
** Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
|
||||||
|
/*global window: false, jQuery: false */
|
||||||
|
|
||||||
|
(function ($) {
|
||||||
|
var data_click = "unobtrusiveAjaxClick",
|
||||||
|
data_target = "unobtrusiveAjaxClickTarget",
|
||||||
|
data_validation = "unobtrusiveValidation";
|
||||||
|
|
||||||
|
function getFunction(code, argNames) {
|
||||||
|
var fn = window, parts = (code || "").split(".");
|
||||||
|
while (fn && parts.length) {
|
||||||
|
fn = fn[parts.shift()];
|
||||||
|
}
|
||||||
|
if (typeof (fn) === "function") {
|
||||||
|
return fn;
|
||||||
|
}
|
||||||
|
argNames.push(code);
|
||||||
|
return Function.constructor.apply(null, argNames);
|
||||||
|
}
|
||||||
|
|
||||||
|
function isMethodProxySafe(method) {
|
||||||
|
return method === "GET" || method === "POST";
|
||||||
|
}
|
||||||
|
|
||||||
|
function asyncOnBeforeSend(xhr, method) {
|
||||||
|
if (!isMethodProxySafe(method)) {
|
||||||
|
xhr.setRequestHeader("X-HTTP-Method-Override", method);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function asyncOnSuccess(element, data, contentType) {
|
||||||
|
var mode;
|
||||||
|
|
||||||
|
if (contentType.indexOf("application/x-javascript") !== -1) { // jQuery already executes JavaScript for us
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mode = (element.getAttribute("data-ajax-mode") || "").toUpperCase();
|
||||||
|
$(element.getAttribute("data-ajax-update")).each(function (i, update) {
|
||||||
|
var top;
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case "BEFORE":
|
||||||
|
top = update.firstChild;
|
||||||
|
$("<div />").html(data).contents().each(function () {
|
||||||
|
update.insertBefore(this, top);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "AFTER":
|
||||||
|
$("<div />").html(data).contents().each(function () {
|
||||||
|
update.appendChild(this);
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case "REPLACE-WITH":
|
||||||
|
$(update).replaceWith(data);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$(update).html(data);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function asyncRequest(element, options) {
|
||||||
|
var confirm, loading, method, duration;
|
||||||
|
|
||||||
|
confirm = element.getAttribute("data-ajax-confirm");
|
||||||
|
if (confirm && !window.confirm(confirm)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loading = $(element.getAttribute("data-ajax-loading"));
|
||||||
|
duration = parseInt(element.getAttribute("data-ajax-loading-duration"), 10) || 0;
|
||||||
|
|
||||||
|
$.extend(options, {
|
||||||
|
type: element.getAttribute("data-ajax-method") || undefined,
|
||||||
|
url: element.getAttribute("data-ajax-url") || undefined,
|
||||||
|
cache: !!element.getAttribute("data-ajax-cache"),
|
||||||
|
beforeSend: function (xhr) {
|
||||||
|
var result;
|
||||||
|
asyncOnBeforeSend(xhr, method);
|
||||||
|
result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(element, arguments);
|
||||||
|
if (result !== false) {
|
||||||
|
loading.show(duration);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
complete: function () {
|
||||||
|
loading.hide(duration);
|
||||||
|
getFunction(element.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(element, arguments);
|
||||||
|
},
|
||||||
|
success: function (data, status, xhr) {
|
||||||
|
asyncOnSuccess(element, data, xhr.getResponseHeader("Content-Type") || "text/html");
|
||||||
|
getFunction(element.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(element, arguments);
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"]).apply(element, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" });
|
||||||
|
|
||||||
|
method = options.type.toUpperCase();
|
||||||
|
if (!isMethodProxySafe(method)) {
|
||||||
|
options.type = "POST";
|
||||||
|
options.data.push({ name: "X-HTTP-Method-Override", value: method });
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
function validate(form) {
|
||||||
|
var validationInfo = $(form).data(data_validation);
|
||||||
|
return !validationInfo || !validationInfo.validate || validationInfo.validate();
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).on("click", "a[data-ajax=true]", function (evt) {
|
||||||
|
evt.preventDefault();
|
||||||
|
asyncRequest(this, {
|
||||||
|
url: this.href,
|
||||||
|
type: "GET",
|
||||||
|
data: []
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on("click", "form[data-ajax=true] input[type=image]", function (evt) {
|
||||||
|
var name = evt.target.name,
|
||||||
|
target = $(evt.target),
|
||||||
|
form = $(target.parents("form")[0]),
|
||||||
|
offset = target.offset();
|
||||||
|
|
||||||
|
form.data(data_click, [
|
||||||
|
{ name: name + ".x", value: Math.round(evt.pageX - offset.left) },
|
||||||
|
{ name: name + ".y", value: Math.round(evt.pageY - offset.top) }
|
||||||
|
]);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
form.removeData(data_click);
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on("click", "form[data-ajax=true] :submit", function (evt) {
|
||||||
|
var name = evt.currentTarget.name,
|
||||||
|
target = $(evt.target),
|
||||||
|
form = $(target.parents("form")[0]);
|
||||||
|
|
||||||
|
form.data(data_click, name ? [{ name: name, value: evt.currentTarget.value }] : []);
|
||||||
|
form.data(data_target, target);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
form.removeData(data_click);
|
||||||
|
form.removeData(data_target);
|
||||||
|
}, 0);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on("submit", "form[data-ajax=true]", function (evt) {
|
||||||
|
var clickInfo = $(this).data(data_click) || [],
|
||||||
|
clickTarget = $(this).data(data_target),
|
||||||
|
isCancel = clickTarget && clickTarget.hasClass("cancel");
|
||||||
|
evt.preventDefault();
|
||||||
|
if (!isCancel && !validate(this)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
asyncRequest(this, {
|
||||||
|
url: this.action,
|
||||||
|
type: this.method || "GET",
|
||||||
|
data: clickInfo.concat($(this).serializeArray())
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}(jQuery));
|
||||||
19
web/Scripts/jquery.unobtrusive-ajax.min.js
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
/* NUGET: BEGIN LICENSE TEXT
|
||||||
|
*
|
||||||
|
* Microsoft grants you the right to use these script files for the sole
|
||||||
|
* purpose of either: (i) interacting through your browser with the Microsoft
|
||||||
|
* website or online service, subject to the applicable licensing or use
|
||||||
|
* terms; or (ii) using the files as included with a Microsoft product subject
|
||||||
|
* to that product's license terms. Microsoft reserves all other rights to the
|
||||||
|
* files not expressly granted by Microsoft, whether by implication, estoppel
|
||||||
|
* or otherwise. Insofar as a script file is dual licensed under GPL,
|
||||||
|
* Microsoft neither took the code under GPL nor distributes it thereunder but
|
||||||
|
* under the terms set out in this paragraph. All notices and licenses
|
||||||
|
* below are for informational purposes only.
|
||||||
|
*
|
||||||
|
* NUGET: END LICENSE TEXT */
|
||||||
|
/*
|
||||||
|
** Unobtrusive Ajax support library for jQuery
|
||||||
|
** Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*/
|
||||||
|
(function(a){var b="unobtrusiveAjaxClick",d="unobtrusiveAjaxClickTarget",h="unobtrusiveValidation";function c(d,b){var a=window,c=(d||"").split(".");while(a&&c.length)a=a[c.shift()];if(typeof a==="function")return a;b.push(d);return Function.constructor.apply(null,b)}function e(a){return a==="GET"||a==="POST"}function g(b,a){!e(a)&&b.setRequestHeader("X-HTTP-Method-Override",a)}function i(c,b,e){var d;if(e.indexOf("application/x-javascript")!==-1)return;d=(c.getAttribute("data-ajax-mode")||"").toUpperCase();a(c.getAttribute("data-ajax-update")).each(function(f,c){var e;switch(d){case"BEFORE":e=c.firstChild;a("<div />").html(b).contents().each(function(){c.insertBefore(this,e)});break;case"AFTER":a("<div />").html(b).contents().each(function(){c.appendChild(this)});break;case"REPLACE-WITH":a(c).replaceWith(b);break;default:a(c).html(b)}})}function f(b,d){var j,k,f,h;j=b.getAttribute("data-ajax-confirm");if(j&&!window.confirm(j))return;k=a(b.getAttribute("data-ajax-loading"));h=parseInt(b.getAttribute("data-ajax-loading-duration"),10)||0;a.extend(d,{type:b.getAttribute("data-ajax-method")||undefined,url:b.getAttribute("data-ajax-url")||undefined,cache:!!b.getAttribute("data-ajax-cache"),beforeSend:function(d){var a;g(d,f);a=c(b.getAttribute("data-ajax-begin"),["xhr"]).apply(b,arguments);a!==false&&k.show(h);return a},complete:function(){k.hide(h);c(b.getAttribute("data-ajax-complete"),["xhr","status"]).apply(b,arguments)},success:function(a,e,d){i(b,a,d.getResponseHeader("Content-Type")||"text/html");c(b.getAttribute("data-ajax-success"),["data","status","xhr"]).apply(b,arguments)},error:function(){c(b.getAttribute("data-ajax-failure"),["xhr","status","error"]).apply(b,arguments)}});d.data.push({name:"X-Requested-With",value:"XMLHttpRequest"});f=d.type.toUpperCase();if(!e(f)){d.type="POST";d.data.push({name:"X-HTTP-Method-Override",value:f})}a.ajax(d)}function j(c){var b=a(c).data(h);return!b||!b.validate||b.validate()}a(document).on("click","a[data-ajax=true]",function(a){a.preventDefault();f(this,{url:this.href,type:"GET",data:[]})});a(document).on("click","form[data-ajax=true] input[type=image]",function(c){var g=c.target.name,e=a(c.target),f=a(e.parents("form")[0]),d=e.offset();f.data(b,[{name:g+".x",value:Math.round(c.pageX-d.left)},{name:g+".y",value:Math.round(c.pageY-d.top)}]);setTimeout(function(){f.removeData(b)},0)});a(document).on("click","form[data-ajax=true] :submit",function(e){var g=e.currentTarget.name,f=a(e.target),c=a(f.parents("form")[0]);c.data(b,g?[{name:g,value:e.currentTarget.value}]:[]);c.data(d,f);setTimeout(function(){c.removeData(b);c.removeData(d)},0)});a(document).on("submit","form[data-ajax=true]",function(h){var e=a(this).data(b)||[],c=a(this).data(d),g=c&&c.hasClass("cancel");h.preventDefault();if(!g&&!j(this))return;f(this,{url:this.action,type:this.method||"GET",data:e.concat(a(this).serializeArray())})})})(jQuery);
|
||||||
1288
web/Scripts/jquery.validate-vsdoc.js
vendored
Normal file
1398
web/Scripts/jquery.validate.js
vendored
Normal file
4
web/Scripts/jquery.validate.min.js
vendored
Normal file
429
web/Scripts/jquery.validate.unobtrusive.js
vendored
Normal file
|
|
@ -0,0 +1,429 @@
|
||||||
|
/* NUGET: BEGIN LICENSE TEXT
|
||||||
|
*
|
||||||
|
* Microsoft grants you the right to use these script files for the sole
|
||||||
|
* purpose of either: (i) interacting through your browser with the Microsoft
|
||||||
|
* website or online service, subject to the applicable licensing or use
|
||||||
|
* terms; or (ii) using the files as included with a Microsoft product subject
|
||||||
|
* to that product's license terms. Microsoft reserves all other rights to the
|
||||||
|
* files not expressly granted by Microsoft, whether by implication, estoppel
|
||||||
|
* or otherwise. Insofar as a script file is dual licensed under GPL,
|
||||||
|
* Microsoft neither took the code under GPL nor distributes it thereunder but
|
||||||
|
* under the terms set out in this paragraph. All notices and licenses
|
||||||
|
* below are for informational purposes only.
|
||||||
|
*
|
||||||
|
* NUGET: END LICENSE TEXT */
|
||||||
|
/*!
|
||||||
|
** Unobtrusive validation support library for jQuery and jQuery Validate
|
||||||
|
** Copyright (C) Microsoft Corporation. All rights reserved.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
|
||||||
|
/*global document: false, jQuery: false */
|
||||||
|
|
||||||
|
(function ($) {
|
||||||
|
var $jQval = $.validator,
|
||||||
|
adapters,
|
||||||
|
data_validation = "unobtrusiveValidation";
|
||||||
|
|
||||||
|
function setValidationValues(options, ruleName, value) {
|
||||||
|
options.rules[ruleName] = value;
|
||||||
|
if (options.message) {
|
||||||
|
options.messages[ruleName] = options.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function splitAndTrim(value) {
|
||||||
|
return value.replace(/^\s+|\s+$/g, "").split(/\s*,\s*/g);
|
||||||
|
}
|
||||||
|
|
||||||
|
function escapeAttributeValue(value) {
|
||||||
|
// As mentioned on http://api.jquery.com/category/selectors/
|
||||||
|
return value.replace(/([!"#$%&'()*+,./:;<=>?@\[\\\]^`{|}~])/g, "\\$1");
|
||||||
|
}
|
||||||
|
|
||||||
|
function getModelPrefix(fieldName) {
|
||||||
|
return fieldName.substr(0, fieldName.lastIndexOf(".") + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendModelPrefix(value, prefix) {
|
||||||
|
if (value.indexOf("*.") === 0) {
|
||||||
|
value = value.replace("*.", prefix);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onError(error, inputElement) { // 'this' is the form element
|
||||||
|
var container = $(this).find("[data-valmsg-for='" + escapeAttributeValue(inputElement[0].name) + "']"),
|
||||||
|
replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||||
|
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;
|
||||||
|
|
||||||
|
container.removeClass("field-validation-valid").addClass("field-validation-error");
|
||||||
|
error.data("unobtrusiveContainer", container);
|
||||||
|
|
||||||
|
if (replace) {
|
||||||
|
container.empty();
|
||||||
|
error.removeClass("input-validation-error").appendTo(container);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onErrors(event, validator) { // 'this' is the form element
|
||||||
|
var container = $(this).find("[data-valmsg-summary=true]"),
|
||||||
|
list = container.find("ul");
|
||||||
|
|
||||||
|
if (list && list.length && validator.errorList.length) {
|
||||||
|
list.empty();
|
||||||
|
container.addClass("validation-summary-errors").removeClass("validation-summary-valid");
|
||||||
|
|
||||||
|
$.each(validator.errorList, function () {
|
||||||
|
$("<li />").html(this.message).appendTo(list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSuccess(error) { // 'this' is the form element
|
||||||
|
var container = error.data("unobtrusiveContainer"),
|
||||||
|
replaceAttrValue = container.attr("data-valmsg-replace"),
|
||||||
|
replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;
|
||||||
|
|
||||||
|
if (container) {
|
||||||
|
container.addClass("field-validation-valid").removeClass("field-validation-error");
|
||||||
|
error.removeData("unobtrusiveContainer");
|
||||||
|
|
||||||
|
if (replace) {
|
||||||
|
container.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onReset(event) { // 'this' is the form element
|
||||||
|
var $form = $(this),
|
||||||
|
key = '__jquery_unobtrusive_validation_form_reset';
|
||||||
|
if ($form.data(key)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Set a flag that indicates we're currently resetting the form.
|
||||||
|
$form.data(key, true);
|
||||||
|
try {
|
||||||
|
$form.data("validator").resetForm();
|
||||||
|
} finally {
|
||||||
|
$form.removeData(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
$form.find(".validation-summary-errors")
|
||||||
|
.addClass("validation-summary-valid")
|
||||||
|
.removeClass("validation-summary-errors");
|
||||||
|
$form.find(".field-validation-error")
|
||||||
|
.addClass("field-validation-valid")
|
||||||
|
.removeClass("field-validation-error")
|
||||||
|
.removeData("unobtrusiveContainer")
|
||||||
|
.find(">*") // If we were using valmsg-replace, get the underlying error
|
||||||
|
.removeData("unobtrusiveContainer");
|
||||||
|
}
|
||||||
|
|
||||||
|
function validationInfo(form) {
|
||||||
|
var $form = $(form),
|
||||||
|
result = $form.data(data_validation),
|
||||||
|
onResetProxy = $.proxy(onReset, form),
|
||||||
|
defaultOptions = $jQval.unobtrusive.options || {},
|
||||||
|
execInContext = function (name, args) {
|
||||||
|
var func = defaultOptions[name];
|
||||||
|
func && $.isFunction(func) && func.apply(form, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
result = {
|
||||||
|
options: { // options structure passed to jQuery Validate's validate() method
|
||||||
|
errorClass: defaultOptions.errorClass || "input-validation-error",
|
||||||
|
errorElement: defaultOptions.errorElement || "span",
|
||||||
|
errorPlacement: function () {
|
||||||
|
onError.apply(form, arguments);
|
||||||
|
execInContext("errorPlacement", arguments);
|
||||||
|
},
|
||||||
|
invalidHandler: function () {
|
||||||
|
onErrors.apply(form, arguments);
|
||||||
|
execInContext("invalidHandler", arguments);
|
||||||
|
},
|
||||||
|
messages: {},
|
||||||
|
rules: {},
|
||||||
|
success: function () {
|
||||||
|
onSuccess.apply(form, arguments);
|
||||||
|
execInContext("success", arguments);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
attachValidation: function () {
|
||||||
|
$form
|
||||||
|
.off("reset." + data_validation, onResetProxy)
|
||||||
|
.on("reset." + data_validation, onResetProxy)
|
||||||
|
.validate(this.options);
|
||||||
|
},
|
||||||
|
validate: function () { // a validation function that is called by unobtrusive Ajax
|
||||||
|
$form.validate();
|
||||||
|
return $form.valid();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$form.data(data_validation, result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
$jQval.unobtrusive = {
|
||||||
|
adapters: [],
|
||||||
|
|
||||||
|
parseElement: function (element, skipAttach) {
|
||||||
|
/// <summary>
|
||||||
|
/// Parses a single HTML element for unobtrusive validation attributes.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="element" domElement="true">The HTML element to be parsed.</param>
|
||||||
|
/// <param name="skipAttach" type="Boolean">[Optional] true to skip attaching the
|
||||||
|
/// validation to the form. If parsing just this single element, you should specify true.
|
||||||
|
/// If parsing several elements, you should specify false, and manually attach the validation
|
||||||
|
/// to the form when you are finished. The default is false.</param>
|
||||||
|
var $element = $(element),
|
||||||
|
form = $element.parents("form")[0],
|
||||||
|
valInfo, rules, messages;
|
||||||
|
|
||||||
|
if (!form) { // Cannot do client-side validation without a form
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
valInfo = validationInfo(form);
|
||||||
|
valInfo.options.rules[element.name] = rules = {};
|
||||||
|
valInfo.options.messages[element.name] = messages = {};
|
||||||
|
|
||||||
|
$.each(this.adapters, function () {
|
||||||
|
var prefix = "data-val-" + this.name,
|
||||||
|
message = $element.attr(prefix),
|
||||||
|
paramValues = {};
|
||||||
|
|
||||||
|
if (message !== undefined) { // Compare against undefined, because an empty message is legal (and falsy)
|
||||||
|
prefix += "-";
|
||||||
|
|
||||||
|
$.each(this.params, function () {
|
||||||
|
paramValues[this] = $element.attr(prefix + this);
|
||||||
|
});
|
||||||
|
|
||||||
|
this.adapt({
|
||||||
|
element: element,
|
||||||
|
form: form,
|
||||||
|
message: message,
|
||||||
|
params: paramValues,
|
||||||
|
rules: rules,
|
||||||
|
messages: messages
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$.extend(rules, { "__dummy__": true });
|
||||||
|
|
||||||
|
if (!skipAttach) {
|
||||||
|
valInfo.attachValidation();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
parse: function (selector) {
|
||||||
|
/// <summary>
|
||||||
|
/// Parses all the HTML elements in the specified selector. It looks for input elements decorated
|
||||||
|
/// with the [data-val=true] attribute value and enables validation according to the data-val-*
|
||||||
|
/// attribute values.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="selector" type="String">Any valid jQuery selector.</param>
|
||||||
|
|
||||||
|
// $forms includes all forms in selector's DOM hierarchy (parent, children and self) that have at least one
|
||||||
|
// element with data-val=true
|
||||||
|
var $selector = $(selector),
|
||||||
|
$forms = $selector.parents()
|
||||||
|
.addBack()
|
||||||
|
.filter("form")
|
||||||
|
.add($selector.find("form"))
|
||||||
|
.has("[data-val=true]");
|
||||||
|
|
||||||
|
$selector.find("[data-val=true]").each(function () {
|
||||||
|
$jQval.unobtrusive.parseElement(this, true);
|
||||||
|
});
|
||||||
|
|
||||||
|
$forms.each(function () {
|
||||||
|
var info = validationInfo(this);
|
||||||
|
if (info) {
|
||||||
|
info.attachValidation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
adapters = $jQval.unobtrusive.adapters;
|
||||||
|
|
||||||
|
adapters.add = function (adapterName, params, fn) {
|
||||||
|
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.</summary>
|
||||||
|
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||||
|
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||||
|
/// <param name="params" type="Array" optional="true">[Optional] An array of parameter names (strings) that will
|
||||||
|
/// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and
|
||||||
|
/// mmmm is the parameter name).</param>
|
||||||
|
/// <param name="fn" type="Function">The function to call, which adapts the values from the HTML
|
||||||
|
/// attributes into jQuery Validate rules and/or messages.</param>
|
||||||
|
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||||
|
if (!fn) { // Called with no params, just a function
|
||||||
|
fn = params;
|
||||||
|
params = [];
|
||||||
|
}
|
||||||
|
this.push({ name: adapterName, params: params, adapt: fn });
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
adapters.addBool = function (adapterName, ruleName) {
|
||||||
|
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||||
|
/// the jQuery Validate validation rule has no parameter values.</summary>
|
||||||
|
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||||
|
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||||
|
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
|
||||||
|
/// of adapterName will be used instead.</param>
|
||||||
|
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||||
|
return this.add(adapterName, function (options) {
|
||||||
|
setValidationValues(options, ruleName || adapterName, true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {
|
||||||
|
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||||
|
/// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and
|
||||||
|
/// one for min-and-max). The HTML parameters are expected to be named -min and -max.</summary>
|
||||||
|
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||||
|
/// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>
|
||||||
|
/// <param name="minRuleName" type="String">The name of the jQuery Validate rule to be used when you only
|
||||||
|
/// have a minimum value.</param>
|
||||||
|
/// <param name="maxRuleName" type="String">The name of the jQuery Validate rule to be used when you only
|
||||||
|
/// have a maximum value.</param>
|
||||||
|
/// <param name="minMaxRuleName" type="String">The name of the jQuery Validate rule to be used when you
|
||||||
|
/// have both a minimum and maximum value.</param>
|
||||||
|
/// <param name="minAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
|
||||||
|
/// contains the minimum value. The default is "min".</param>
|
||||||
|
/// <param name="maxAttribute" type="String" optional="true">[Optional] The name of the HTML attribute that
|
||||||
|
/// contains the maximum value. The default is "max".</param>
|
||||||
|
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||||
|
return this.add(adapterName, [minAttribute || "min", maxAttribute || "max"], function (options) {
|
||||||
|
var min = options.params.min,
|
||||||
|
max = options.params.max;
|
||||||
|
|
||||||
|
if (min && max) {
|
||||||
|
setValidationValues(options, minMaxRuleName, [min, max]);
|
||||||
|
}
|
||||||
|
else if (min) {
|
||||||
|
setValidationValues(options, minRuleName, min);
|
||||||
|
}
|
||||||
|
else if (max) {
|
||||||
|
setValidationValues(options, maxRuleName, max);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
adapters.addSingleVal = function (adapterName, attribute, ruleName) {
|
||||||
|
/// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where
|
||||||
|
/// the jQuery Validate validation rule has a single value.</summary>
|
||||||
|
/// <param name="adapterName" type="String">The name of the adapter to be added. This matches the name used
|
||||||
|
/// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).</param>
|
||||||
|
/// <param name="attribute" type="String">[Optional] The name of the HTML attribute that contains the value.
|
||||||
|
/// The default is "val".</param>
|
||||||
|
/// <param name="ruleName" type="String" optional="true">[Optional] The name of the jQuery Validate rule. If not provided, the value
|
||||||
|
/// of adapterName will be used instead.</param>
|
||||||
|
/// <returns type="jQuery.validator.unobtrusive.adapters" />
|
||||||
|
return this.add(adapterName, [attribute || "val"], function (options) {
|
||||||
|
setValidationValues(options, ruleName || adapterName, options.params[attribute]);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
$jQval.addMethod("__dummy__", function (value, element, params) {
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
$jQval.addMethod("regex", function (value, element, params) {
|
||||||
|
var match;
|
||||||
|
if (this.optional(element)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
match = new RegExp(params).exec(value);
|
||||||
|
return (match && (match.index === 0) && (match[0].length === value.length));
|
||||||
|
});
|
||||||
|
|
||||||
|
$jQval.addMethod("nonalphamin", function (value, element, nonalphamin) {
|
||||||
|
var match;
|
||||||
|
if (nonalphamin) {
|
||||||
|
match = value.match(/\W/g);
|
||||||
|
match = match && match.length >= nonalphamin;
|
||||||
|
}
|
||||||
|
return match;
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($jQval.methods.extension) {
|
||||||
|
adapters.addSingleVal("accept", "mimtype");
|
||||||
|
adapters.addSingleVal("extension", "extension");
|
||||||
|
} else {
|
||||||
|
// for backward compatibility, when the 'extension' validation method does not exist, such as with versions
|
||||||
|
// of JQuery Validation plugin prior to 1.10, we should use the 'accept' method for
|
||||||
|
// validating the extension, and ignore mime-type validations as they are not supported.
|
||||||
|
adapters.addSingleVal("extension", "extension", "accept");
|
||||||
|
}
|
||||||
|
|
||||||
|
adapters.addSingleVal("regex", "pattern");
|
||||||
|
adapters.addBool("creditcard").addBool("date").addBool("digits").addBool("email").addBool("number").addBool("url");
|
||||||
|
adapters.addMinMax("length", "minlength", "maxlength", "rangelength").addMinMax("range", "min", "max", "range");
|
||||||
|
adapters.addMinMax("minlength", "minlength").addMinMax("maxlength", "minlength", "maxlength");
|
||||||
|
adapters.add("equalto", ["other"], function (options) {
|
||||||
|
var prefix = getModelPrefix(options.element.name),
|
||||||
|
other = options.params.other,
|
||||||
|
fullOtherName = appendModelPrefix(other, prefix),
|
||||||
|
element = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(fullOtherName) + "']")[0];
|
||||||
|
|
||||||
|
setValidationValues(options, "equalTo", element);
|
||||||
|
});
|
||||||
|
adapters.add("required", function (options) {
|
||||||
|
// jQuery Validate equates "required" with "mandatory" for checkbox elements
|
||||||
|
if (options.element.tagName.toUpperCase() !== "INPUT" || options.element.type.toUpperCase() !== "CHECKBOX") {
|
||||||
|
setValidationValues(options, "required", true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
adapters.add("remote", ["url", "type", "additionalfields"], function (options) {
|
||||||
|
var value = {
|
||||||
|
url: options.params.url,
|
||||||
|
type: options.params.type || "GET",
|
||||||
|
data: {}
|
||||||
|
},
|
||||||
|
prefix = getModelPrefix(options.element.name);
|
||||||
|
|
||||||
|
$.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {
|
||||||
|
var paramName = appendModelPrefix(fieldName, prefix);
|
||||||
|
value.data[paramName] = function () {
|
||||||
|
var field = $(options.form).find(":input").filter("[name='" + escapeAttributeValue(paramName) + "']");
|
||||||
|
// For checkboxes and radio buttons, only pick up values from checked fields.
|
||||||
|
if (field.is(":checkbox")) {
|
||||||
|
return field.filter(":checked").val() || field.filter(":hidden").val() || '';
|
||||||
|
}
|
||||||
|
else if (field.is(":radio")) {
|
||||||
|
return field.filter(":checked").val() || '';
|
||||||
|
}
|
||||||
|
return field.val();
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
setValidationValues(options, "remote", value);
|
||||||
|
});
|
||||||
|
adapters.add("password", ["min", "nonalphamin", "regex"], function (options) {
|
||||||
|
if (options.params.min) {
|
||||||
|
setValidationValues(options, "minlength", options.params.min);
|
||||||
|
}
|
||||||
|
if (options.params.nonalphamin) {
|
||||||
|
setValidationValues(options, "nonalphamin", options.params.nonalphamin);
|
||||||
|
}
|
||||||
|
if (options.params.regex) {
|
||||||
|
setValidationValues(options, "regex", options.params.regex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
$jQval.unobtrusive.parse(document);
|
||||||
|
});
|
||||||
|
}(jQuery));
|
||||||
19
web/Scripts/jquery.validate.unobtrusive.min.js
vendored
Normal file
57
web/Scripts/yavsc.rate.js
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
(function() {
|
||||||
|
(function(jQuery) {
|
||||||
|
return jQuery.widget('Yavsc.rate', {
|
||||||
|
options: {
|
||||||
|
target: null,
|
||||||
|
disabled: false
|
||||||
|
},
|
||||||
|
sendRate: function (rating,callback) {
|
||||||
|
Yavsc.ajax(this.options.target+'/Rate', rating, callback);
|
||||||
|
},
|
||||||
|
_create: function() {
|
||||||
|
var $ratectl = $(this.element);
|
||||||
|
var _this = this;
|
||||||
|
$ratectl.onChanged = function (newrate) {
|
||||||
|
// build the five stars
|
||||||
|
_this.updateRate($ratectl,newrate);
|
||||||
|
};
|
||||||
|
var id = $ratectl.data('id');
|
||||||
|
$ratectl.addClass('rate');
|
||||||
|
$ratectl.click(function (e) {
|
||||||
|
var oset = $ratectl.offset();
|
||||||
|
var x = ((e.pageX - oset.left) * 100 ) / $ratectl.width();
|
||||||
|
// here, x may be greater than 100, or lower than 0 here,
|
||||||
|
// depending on padding & mergin on the $ratectl node,
|
||||||
|
// when it's a span, and there is a line return within,
|
||||||
|
// the values on second star line are false.
|
||||||
|
// time to sanitize
|
||||||
|
x = Math.ceil(x);
|
||||||
|
if (x<0) x = 0;
|
||||||
|
if (x>100) x = 100;
|
||||||
|
var data = { Id: id, Rate: x };
|
||||||
|
_this.sendRate(data, function () {
|
||||||
|
$ratectl.onChanged(x); });
|
||||||
|
});
|
||||||
|
},
|
||||||
|
updateRate: function (ctl,rate) {
|
||||||
|
var rounded = Math.round(rate / 10);
|
||||||
|
var HasHalf = (rounded % 2 == 1);
|
||||||
|
var NbFilled = Math.floor(rounded / 2);
|
||||||
|
var NbEmpty = (5 - NbFilled) - ((HasHalf)?1:0) ;
|
||||||
|
ctl.empty();
|
||||||
|
var i=0;
|
||||||
|
for (i=0; i<NbFilled; i++)
|
||||||
|
ctl.append('<i class="fa fa-star"></i>');
|
||||||
|
if (HasHalf)
|
||||||
|
ctl.append('<i class="fa fa-star-half-o"></i>');
|
||||||
|
for (var j=0; j<NbEmpty; j++, i++ )
|
||||||
|
ctl.append('<i class="fa fa-star-o"></i>');
|
||||||
|
},
|
||||||
|
})})(jQuery);
|
||||||
|
}).call(this);
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
$('[data-type="rate-skill"]').rate({target: 'Skill/RateSkill'});
|
||||||
|
$('[data-type="rate-user-skill"]').rate({target: 'Skill/RateUserSkill'});
|
||||||
|
$('[data-type="rate-bill"]').rate({target: 'Blogs/Rate'});
|
||||||
|
});
|
||||||
20
web/Scripts/yavsc.skills.js
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
var Skills = (function(){
|
||||||
|
var self = {};
|
||||||
|
self.updateSkill = function () { } ;
|
||||||
|
|
||||||
|
self.createSkill = function (skillname,callback) {
|
||||||
|
var skill = { name: skillname } ;
|
||||||
|
console.log('creating the skill : '+skill.name+' ... ');
|
||||||
|
Yavsc.ajax('Skill/DeclareSkill',skill,callback);
|
||||||
|
};
|
||||||
|
self.deleteSkill = function (sid,callback) {
|
||||||
|
Yavsc.ajax('Skill/DeleteSkill',sid,callback);
|
||||||
|
};
|
||||||
|
self.declareUserSkill = function (usersdec,callback) {
|
||||||
|
console.log("creating the user's skill [ "+usersdec.skillid +', '+usersdec.comment+' ] ... ');
|
||||||
|
Yavsc.ajax('Skill/DeclareUserSkill',usersdec,callback);
|
||||||
|
};
|
||||||
|
|
||||||
|
return self;
|
||||||
|
})();
|
||||||
29
web/Views/Admin/AddUserToRole.ascx
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
|
||||||
|
<%= Html.ValidationSummary() %>
|
||||||
|
<% using(Html.BeginForm("AddUserToRole", "Admin"))
|
||||||
|
{ %>
|
||||||
|
<fieldset>
|
||||||
|
<div id="roleaddedresult"></div>
|
||||||
|
<% if (ViewData ["UserName"] != null) { %>
|
||||||
|
<%= Html.Hidden("RoleName",ViewData ["RoleName"]) %>
|
||||||
|
<% } else { %>
|
||||||
|
<div>
|
||||||
|
<label for="UserName" >Utilisateur : </label><input type="text" name="UserName" id="UserName">
|
||||||
|
<%= Html.ValidationMessage("UserName", "*") %>
|
||||||
|
</div>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<% if (ViewData ["RoleName"] != null) { %>
|
||||||
|
<%= Html.Hidden("RoleName",ViewData ["RoleName"]) %>
|
||||||
|
<% } else { %>
|
||||||
|
<div>
|
||||||
|
<label for="RoleName" >Nom du rôle : </label>
|
||||||
|
<input type="text" name="RoleName" id="RoleName">
|
||||||
|
<%= Html.ValidationMessage("RoleName", "*") %>
|
||||||
|
</div>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<%= Html.Hidden("ReturnUrl", Request.Url.PathAndQuery ) %>
|
||||||
|
<input type="submit">
|
||||||
|
</fieldset>
|
||||||
|
<% } %>
|
||||||
3
web/Views/Admin/UserCard.ascx
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
|
||||||
|
|
||||||
|
|
||||||
6
web/Views/Blogs/RateControl.ascx
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<%@ Control Language="C#" Inherits="Yavsc.RateControl<IRating>" %>
|
||||||
|
<div data-id="<%=Model.Id%>" data-type="rate-bill" ><% int i = 0; for (; i<NbFilled; i++) {
|
||||||
|
%><i class="fa fa-star" ></i><% }
|
||||||
|
%><% if (HasHalf) { %><i class="fa fa-star-half-o"></i><% i++; }
|
||||||
|
%><% for (int j=0; j<NbEmpty; j++, i++ ) { %><i class="fa fa-star-o"></i><% }
|
||||||
|
%></div>
|
||||||
6
web/Views/FrontOffice/RateControl.ascx
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
<%@ Control Language="C#" Inherits="Yavsc.RateControl<IRating>" %>
|
||||||
|
<div data-id="<%=Model.Id%>" data-type="rate-bill" ><% int i = 0; for (; i<NbFilled; i++) {
|
||||||
|
%><i class="fa fa-star" ></i><% }
|
||||||
|
%><% if (HasHalf) { %><i class="fa fa-star-half-o"></i><% i++; }
|
||||||
|
%><% for (int j=0; j<NbEmpty; j++, i++ ) { %><i class="fa fa-star-o"></i><% }
|
||||||
|
%></div>
|
||||||
7
web/Views/FrontOffice/RateSkillControl.ascx
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<%@ Control Language="C#" Inherits="Yavsc.RateControl<IRating>" %>
|
||||||
|
<% Rate = Model.Rate; %>
|
||||||
|
<div data-id="<%=Model.Id%>" data-type="rate-skill" ><% int i = 0; for (; i<NbFilled; i++) {
|
||||||
|
%><i class="fa fa-star" ></i><% }
|
||||||
|
%><% if (HasHalf) { %><i class="fa fa-star-half-o"></i><% i++; }
|
||||||
|
%><% for (int j=0; j<NbEmpty; j++, i++ ) { %><i class="fa fa-star-o"></i><% }
|
||||||
|
%></div>
|
||||||
7
web/Views/FrontOffice/RateUserSkillControl.ascx
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<%@ Control Language="C#" Inherits="Yavsc.RateControl<IRating>" %>
|
||||||
|
<% Rate = Model.Rate; %>
|
||||||
|
<div data-id="<%=Model.Id%>" data-type="rate-user-skill" ><% int i = 0; for (; i<NbFilled; i++) {
|
||||||
|
%><i class="fa fa-star" ></i><% }
|
||||||
|
%><% if (HasHalf) { %><i class="fa fa-star-half-o"></i><% i++; }
|
||||||
|
%><% for (int j=0; j<NbEmpty; j++, i++ ) { %><i class="fa fa-star-o"></i><% }
|
||||||
|
%></div>
|
||||||
38
web/Views/FrontOffice/Skills.aspx
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
<%@ Page Title="Skills" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Skill>>" %>
|
||||||
|
|
||||||
|
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
|
||||||
|
<script src="<%=Url.Content("~/Scripts/yavsc.skills.js")%>"></script>
|
||||||
|
</asp:Content>
|
||||||
|
|
||||||
|
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
|
||||||
|
|
||||||
|
|
||||||
|
<aside class="control">
|
||||||
|
<form method="post" action="DeclareSkill">
|
||||||
|
<fieldset>
|
||||||
|
<div id="Err_skillName" class="field-validation-error"></div>
|
||||||
|
<input type="text" name="SkillName" id="SkillName" >
|
||||||
|
<input type="button" value="Créer la compétence" id="btncreate" >
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#btncreate').click( function() {
|
||||||
|
Skills.createSkill(sname, function(sid) {
|
||||||
|
var sname = $('#SkillName').val();
|
||||||
|
console.log(' Skill created id : '+sid);
|
||||||
|
$('<li>'+sname+'</li>').data('sid',sid).addClass('skillname').appendTo('#skills');
|
||||||
|
$('#SkillName').val('');
|
||||||
|
}); } ); });
|
||||||
|
</script>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<ul id="skills">
|
||||||
|
<% foreach (var skill in Model) { %>
|
||||||
|
<li class="skillname" data-sid="<%= skill.Id %>">
|
||||||
|
<%= skill.Name %> <%=Html.Partial("RateSkillControl", skill) %>
|
||||||
|
</li>
|
||||||
|
<% } %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</asp:Content>
|
||||||
2
web/Views/FrontOffice/UserCard.ascx
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
|
||||||
|
|
||||||
51
web/Views/FrontOffice/UserSkills.aspx
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
<%@ Page Title="Skills" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<PerformerProfile>" %>
|
||||||
|
|
||||||
|
<asp:Content ID="headContent" ContentPlaceHolderID="head" runat="server">
|
||||||
|
<script src="<%=Url.Content("~/Scripts/yavsc.skills.js")%>"></script>
|
||||||
|
</asp:Content>
|
||||||
|
|
||||||
|
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
|
||||||
|
<aside class="control">
|
||||||
|
<form method="post" action="DeclareUserSkill">
|
||||||
|
<fieldset>
|
||||||
|
<legend>Declarer une compétence supplémentaire</legend>
|
||||||
|
<div id="Err_skillId" class="field-validation-error"></div>
|
||||||
|
<h2>
|
||||||
|
<select id="SkillId" >
|
||||||
|
<% foreach (var skill in (Skill[]) ViewData["SiteSkills"]) {
|
||||||
|
if (Model.HasSkill(skill.Id)) {%>
|
||||||
|
<option value="<%=skill.Id%>" disabled>
|
||||||
|
<%=skill.Name%></option>
|
||||||
|
<% } else { %>
|
||||||
|
<option value="<%=skill.Id%>"><%=skill.Name%></option>
|
||||||
|
<% } } %>
|
||||||
|
</select></h2>
|
||||||
|
<label for="Comment">Si vous le désirez, faites un commentaire sur cette compétence</label>
|
||||||
|
<textarea id="Comment"></textarea>
|
||||||
|
<input type="button" value="Ajouter la compétence à votre profile" id="btndeclare" >
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('#btndeclare').click( function() {
|
||||||
|
var sid = $('#SkillId').val();
|
||||||
|
var cmnt = $('#Comment').val();
|
||||||
|
var sname = $('#SkillId').text();
|
||||||
|
Skills.declareUserSkill({ username: <%=YavscAjaxHelper.QuoteJavascriptString(Model.UserName) %> ,
|
||||||
|
skillid: sid, rate: 50, comment: cmnt }, function(usid) {
|
||||||
|
console.log('User skill created, id : '+usid);
|
||||||
|
$('<li>'+sname+'</li>').data('sid',sid).data('id',usid).addClass('skillname').appendTo('#userskills');
|
||||||
|
$('#SkillId').val(0);
|
||||||
|
}); }); });
|
||||||
|
</script>
|
||||||
|
</aside>
|
||||||
|
|
||||||
|
<ul id="userskills">
|
||||||
|
<% foreach (var userskill in Model.Skills) { %>
|
||||||
|
<li class="skillname" data-sid="<%= userskill.Id %>">
|
||||||
|
<h2><%= userskill.SkillName %></h2><br> <div data-type="comment"><%= userskill.Comment %></div> <%=Html.Partial("RateUserSkillControl", userskill) %>
|
||||||
|
</li>
|
||||||
|
<% } %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</asp:Content>
|
||||||
37
web/Views/Home/Contact.template.aspx
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
<%@ Page Title="Contact" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %>
|
||||||
|
|
||||||
|
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||||
|
<div class="panel">
|
||||||
|
<p>
|
||||||
|
Directeur : <br>
|
||||||
|
Adresse postale : <br>
|
||||||
|
Tél. : +33 <br>
|
||||||
|
Tél. : +33 <br>
|
||||||
|
SIREN : <br>
|
||||||
|
SIRET : <br>
|
||||||
|
Activité Principalement Exercée (APE) : <br>
|
||||||
|
</p>
|
||||||
|
<% using (Html.BeginForm("Contact", "Home")) { %>
|
||||||
|
<fieldset>
|
||||||
|
<legend>Message</legend>
|
||||||
|
<p>
|
||||||
|
<%= Html.Label("email") %>:
|
||||||
|
<%= Html.ValidationMessage("email") %><br/>
|
||||||
|
<%= Html.TextBox("email") %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= Html.Label("reason") %>:
|
||||||
|
<%= Html.ValidationMessage("reason") %><br/>
|
||||||
|
<%= Html.TextBox("reason") %>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<%= Html.Label("body") %>:
|
||||||
|
<%= Html.ValidationMessage("body") %><br/>
|
||||||
|
<%= Html.TextArea("body") %>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
||||||
|
<input type="submit" value="<%=Html.Translate("Submit")%>">
|
||||||
|
|
||||||
|
<% } %>
|
||||||
|
</div>
|
||||||
|
</asp:Content>
|
||||||
7
web/Views/Home/RestrictedArea.aspx
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntryCollection>" MasterPageFile="~/Models/App.master"%>
|
||||||
|
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||||
|
Ce contenu est d'accès restreint : <<%= Html.Encode(ViewData["ControllerName"]) %>/<%= Html.Encode(ViewData["ActionName"]) %>>
|
||||||
|
|
||||||
|
Demandez à l'administrateur les autorisations suffisantes pour accèder à cet emplacement.
|
||||||
|
|
||||||
|
</asp:Content>
|
||||||
79
yavscModel/Calendar/BookingQuery.cs
Normal file
|
|
@ -0,0 +1,79 @@
|
||||||
|
//
|
||||||
|
// AskForADate.cs
|
||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Paul Schneider <paulschneider@free.fr>
|
||||||
|
//
|
||||||
|
// Copyright (c) 2014 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.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Calendar
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Ask for A date.
|
||||||
|
/// </summary>
|
||||||
|
public class BookingQuery
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the prefered date.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The prefered date.</value>
|
||||||
|
[DataType(DataType.Date)]
|
||||||
|
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd}", ApplyFormatInEditMode = true)]
|
||||||
|
[Display(ResourceType=typeof(LocalizedText),Name="StartDate")]
|
||||||
|
public DateTime StartDate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the minimum time.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The minimum time.</value>
|
||||||
|
[RegularExpression("\\d\\d:\\d\\d")]
|
||||||
|
[Display(ResourceType=typeof(LocalizedText),Name="StartHour")]
|
||||||
|
[Required(ErrorMessage= "S'il vous plait, saisissez une heure de début d'intervention")]
|
||||||
|
public string StartHour { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the max date.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The max date.</value>
|
||||||
|
[Display(Name="EndDate",ResourceType=typeof(LocalizedText))]
|
||||||
|
[DataType(DataType.Date)]
|
||||||
|
[DisplayFormat(DataFormatString = "{0:yyyy/MM/dd}", ApplyFormatInEditMode = true)]
|
||||||
|
public DateTime EndDate { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the minimal duration.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The duration.</value>
|
||||||
|
[RegularExpression("\\d\\d:\\d\\d")]
|
||||||
|
[Required(ErrorMessage= "S'il vous plait, saisissez une heure de fin d'intervention")]
|
||||||
|
[Display(Name="EndHour",ResourceType=typeof(LocalizedText))]
|
||||||
|
public string EndHour { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the role.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The role.</value>
|
||||||
|
[Required(ErrorMessage= "S'il vous plait, saisissez le ou les types d'intervention souhaité")]
|
||||||
|
[Display(Name="Role",ResourceType=typeof(LocalizedText))]
|
||||||
|
public string [] Roles { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
37
yavscModel/IAuthorized.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
//
|
||||||
|
// IAuthorized.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;
|
||||||
|
|
||||||
|
namespace Yavsc.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// I authorized.
|
||||||
|
/// </summary>
|
||||||
|
public interface IAuthorized {
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the author.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The author.</value>
|
||||||
|
string Author { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
30
yavscModel/IComment.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
//
|
||||||
|
// ICommented.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;
|
||||||
|
|
||||||
|
namespace Yavsc.Model
|
||||||
|
{
|
||||||
|
|
||||||
|
public interface IComment: IIdentified {
|
||||||
|
string Comment { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
30
yavscModel/IIdentified.cs
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
//
|
||||||
|
// IIdentified.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;
|
||||||
|
|
||||||
|
namespace Yavsc.Model
|
||||||
|
{
|
||||||
|
public interface IIdentified
|
||||||
|
{
|
||||||
|
long Id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
38
yavscModel/IRating.cs
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
//
|
||||||
|
// IIdentified.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;
|
||||||
|
|
||||||
|
namespace Yavsc.Model
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// I rating.
|
||||||
|
/// </summary>
|
||||||
|
public interface IRating: IIdentified
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the rate.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The rate.</value>
|
||||||
|
int Rate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
63
yavscModel/Manager.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
||||||
|
//
|
||||||
|
// Manager.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.Configuration;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Configuration.Provider;
|
||||||
|
|
||||||
|
namespace Yavsc.Model {
|
||||||
|
/// <summary>
|
||||||
|
/// Manager.
|
||||||
|
/// </summary>
|
||||||
|
public static class ManagerHelper {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the provider.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The provider.</value>
|
||||||
|
public static TProvider GetDefaultProvider<TProvider> (string configSetion) where TProvider: ProviderBase
|
||||||
|
{
|
||||||
|
DataProviderConfigurationSection config = ConfigurationManager.GetSection (configSetion) as DataProviderConfigurationSection;
|
||||||
|
if (config == null)
|
||||||
|
throw new ConfigurationErrorsException (
|
||||||
|
string.Format(
|
||||||
|
"The providers configuration bloc `{0}` was not found",
|
||||||
|
configSetion));
|
||||||
|
ProviderSettings celt =
|
||||||
|
config.Providers [config.DefaultProvider];
|
||||||
|
if (config == null)
|
||||||
|
throw new ConfigurationErrorsException (
|
||||||
|
string.Format (
|
||||||
|
"The default provider `{0}` was not found ",
|
||||||
|
config.DefaultProvider));
|
||||||
|
Type provtype = Type.GetType (celt.Type);
|
||||||
|
if (provtype == null)
|
||||||
|
throw new ProviderException (
|
||||||
|
string.Format (
|
||||||
|
"Provider type '{0}' was not found",celt.Type));
|
||||||
|
ConstructorInfo ci = provtype.GetConstructor (Type.EmptyTypes);
|
||||||
|
ProviderBase bp = ci.Invoke (Type.EmptyTypes) as ProviderBase;
|
||||||
|
bp.Initialize (celt.Name, celt.Parameters);
|
||||||
|
return bp as TProvider;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
39
yavscModel/RolesAndMembers/UserNameBase.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
//
|
||||||
|
// UserNameBase.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.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.RolesAndMembers
|
||||||
|
{
|
||||||
|
public class UserNameBase {
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the user.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name of the user.</value>
|
||||||
|
[Localizable(true), Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")
|
||||||
|
,Display(ResourceType=typeof(LocalizedText),Name="User_name"),RegularExpression("([a-z]|[A-Z]|[0-9] )+")]
|
||||||
|
public string UserName { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
43
yavscModel/RolesAndMembers/UserRole.cs
Normal file
|
|
@ -0,0 +1,43 @@
|
||||||
|
//
|
||||||
|
// UserRole.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.ComponentModel.DataAnnotations;
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.RolesAndMembers
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// User role.
|
||||||
|
/// </summary>
|
||||||
|
public class UserRole : UserNameBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the role.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The role.</value>
|
||||||
|
[Required]
|
||||||
|
[StringLength(255)]
|
||||||
|
[DisplayName("Nom du rôle")]
|
||||||
|
public string Role
|
||||||
|
{ get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
110
yavscModel/Skill/PerformerProfile.cs
Normal file
|
|
@ -0,0 +1,110 @@
|
||||||
|
//
|
||||||
|
// PerformerProfile.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 Yavsc.Model.RolesAndMembers;
|
||||||
|
using Yavsc.Model.Skill;
|
||||||
|
using System.Web.Security;
|
||||||
|
using System.Web.Profile;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Yavsc.Model;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Skill
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Performer profile.
|
||||||
|
/// </summary>
|
||||||
|
public class PerformerProfile: IRating, IIdentified
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Yavsc.Model.Skill.PerformerProfile"/> class.
|
||||||
|
/// </summary>
|
||||||
|
public PerformerProfile()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the user.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name of the user.</value>
|
||||||
|
[Localizable(true), Required(ErrorMessage = "S'il vous plait, entrez un nom d'utilisateur")
|
||||||
|
,Display(ResourceType=typeof(LocalizedText),Name="User_name"),RegularExpression("([a-z]|[A-Z]|[0-9] )+")]
|
||||||
|
public string UserName { get; set; }
|
||||||
|
public long Id { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the skills.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The skills.</value>
|
||||||
|
public virtual IEnumerable<UserSkill> Skills { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="Yavsc.FrontOffice.PerformerProfile"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="username">Username.</param>
|
||||||
|
public PerformerProfile(string username)
|
||||||
|
{
|
||||||
|
UserName = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The user.</returns>
|
||||||
|
public MembershipUser GetUser()
|
||||||
|
{
|
||||||
|
return Membership.GetUser (UserName);
|
||||||
|
}
|
||||||
|
private Profile yavscCLientProfile = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the yavsc C lient profile.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The yavsc C lient profile.</value>
|
||||||
|
public Profile YavscCLientProfile
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
if (yavscCLientProfile == null)
|
||||||
|
yavscCLientProfile = new Profile (
|
||||||
|
ProfileBase.Create (UserName));
|
||||||
|
return yavscCLientProfile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the rate.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The rate.</value>
|
||||||
|
public int Rate {
|
||||||
|
get ;
|
||||||
|
set ;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether this instance references the specified skillId.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><c>true</c> if this instance has skill the specified skillId; otherwise, <c>false</c>.</returns>
|
||||||
|
/// <param name="skillId">Skill identifier.</param>
|
||||||
|
public bool HasSkill(long skillId)
|
||||||
|
{
|
||||||
|
return Skills.Any (x => x.SkillId == skillId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
55
yavscModel/Skill/Skill.cs
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
//
|
||||||
|
// Skill.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.Configuration;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Configuration.Provider;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Skill
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Skill.
|
||||||
|
/// </summary>
|
||||||
|
public class Skill : IRating {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The identifier.</value>
|
||||||
|
public long Id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name.</value>
|
||||||
|
[Required(ErrorMessage = "Please, specify a skill name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the rate.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The rate.</value>
|
||||||
|
public int Rate { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
127
yavscModel/Skill/SkillManager.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
||||||
|
//
|
||||||
|
// SkillManager.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.Configuration;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Configuration.Provider;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Skill
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Skill manager.
|
||||||
|
/// </summary>
|
||||||
|
public static class SkillManager
|
||||||
|
{
|
||||||
|
private static SkillProvider provider = null;
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the provider.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The provider.</value>
|
||||||
|
private static SkillProvider Provider {
|
||||||
|
get {
|
||||||
|
if (provider == null)
|
||||||
|
provider = ManagerHelper.GetDefaultProvider<SkillProvider>
|
||||||
|
("system.web/skillProviders");
|
||||||
|
return provider;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create or modifies the specified skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skill">the skill.</param>
|
||||||
|
public static long DeclareSkill(Skill skill) {
|
||||||
|
Provider.Declare(skill);
|
||||||
|
return skill.Id;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Declares the skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The skill.</returns>
|
||||||
|
/// <param name="dec">Dec.</param>
|
||||||
|
public static long DeclareUserSkill(UserSkillDeclaration dec) {
|
||||||
|
return Provider.Declare(dec);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rates the user skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The user skill.</returns>
|
||||||
|
/// <param name="username">Username.</param>
|
||||||
|
/// <param name="userSkill">User skill.</param>
|
||||||
|
public static long RateUserSkill(string username, UserSkillRating userSkill) {
|
||||||
|
return Provider.Rate(userSkill);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Rates the skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="username">Username.</param>
|
||||||
|
/// <param name="skill">Skill.</param>
|
||||||
|
public static void RateSkill(string username, SkillRating skill) {
|
||||||
|
Provider.Rate(skill);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the skills.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The skill identifier.</returns>
|
||||||
|
/// <param name="pattern">Pattern.</param>
|
||||||
|
public static Skill [] FindSkill(string pattern){
|
||||||
|
return Provider.FindSkill(pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the performer.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The performer.</returns>
|
||||||
|
/// <param name="skillIds">Skill identifiers.</param>
|
||||||
|
public static string [] FindPerformer(long []skillIds){
|
||||||
|
return Provider.FindPerformer(skillIds);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skillId">Skill identifier.</param>
|
||||||
|
public static void DeleteSkill (long skillId)
|
||||||
|
{
|
||||||
|
Provider.DeleteSkill (skillId);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the user skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skillId">Skill identifier.</param>
|
||||||
|
public static void DeleteUserSkill (long skillId)
|
||||||
|
{
|
||||||
|
Provider.DeleteUserSkill (skillId);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user skills.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The user skills.</returns>
|
||||||
|
/// <param name="userName">User name.</param>
|
||||||
|
public static PerformerProfile GetUserSkills(string userName)
|
||||||
|
{
|
||||||
|
return Provider.GetUserSkills (userName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
89
yavscModel/Skill/SkillProvider.cs
Normal file
|
|
@ -0,0 +1,89 @@
|
||||||
|
//
|
||||||
|
// SkillProvider.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.Configuration.Provider;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Skill
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Skill provider.
|
||||||
|
/// </summary>
|
||||||
|
public abstract class SkillProvider: ProviderBase
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Declare the specified skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skill">Skill.</param>
|
||||||
|
public abstract long Declare(Skill skill) ;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Declare the specified user skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userskill">Userskill.</param>
|
||||||
|
public abstract long Declare(UserSkillDeclaration userskill) ;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rate the specified user skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userskill">Userskill.</param>
|
||||||
|
public abstract long Rate(UserSkillRating userskill) ;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rate the specified skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skill">Skill.</param>
|
||||||
|
public abstract void Rate(SkillRating skill) ;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the skill identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The skill identifier.</returns>
|
||||||
|
/// <param name="pattern">Pattern.</param>
|
||||||
|
public abstract Skill [] FindSkill(string pattern);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the user skills.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The user skills.</returns>
|
||||||
|
/// <param name="username">Username.</param>
|
||||||
|
public abstract PerformerProfile GetUserSkills(string username) ;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Finds the performer.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>The performer.</returns>
|
||||||
|
/// <param name="skillIds">Skill identifiers.</param>
|
||||||
|
public abstract string [] FindPerformer(long []skillIds);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="skillId">Skill identifier.</param>
|
||||||
|
public abstract void DeleteSkill(long skillId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Deletes the user skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userSkillId">User skill identifier.</param>
|
||||||
|
public abstract void DeleteUserSkill(long userSkillId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
49
yavscModel/Skill/SkillRating.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
//
|
||||||
|
// SkillRating.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;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Skill
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Skill rating.
|
||||||
|
/// </summary>
|
||||||
|
public class SkillRating : IRating, IAuthorized
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the skill identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The skill identifier.</value>
|
||||||
|
public long Id { get;set ; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the rate.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The rate.</value>
|
||||||
|
public int Rate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the author.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The author.</value>
|
||||||
|
public string Author { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
64
yavscModel/Skill/UserSkill.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
//
|
||||||
|
// SkillDeclaration.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;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Skill
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// User skill.
|
||||||
|
/// </summary>
|
||||||
|
public class UserSkill : IComment, IRating
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the identifier for this
|
||||||
|
/// user's skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The user's skill identifier.</value>
|
||||||
|
public long Id { get ; set ; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the skill identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The skill identifier.</value>
|
||||||
|
public long SkillId { get ; set ; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the skill.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name of the skill.</value>
|
||||||
|
public string SkillName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the rate.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The rate.</value>
|
||||||
|
public int Rate { get ; set ; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the comment.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The comment.</value>
|
||||||
|
public string Comment { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
40
yavscModel/Skill/UserSkillComment.cs
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
//
|
||||||
|
// UserSkillComment.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;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Skill
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// User skill comment.
|
||||||
|
/// </summary>
|
||||||
|
public class UserSkillComment: UserSkillReference, IComment
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the comment.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The comment.</value>
|
||||||
|
public string Comment { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
36
yavscModel/Skill/UserSkillDeclaration.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
//
|
||||||
|
// UserSkillDeclaration.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;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Skill
|
||||||
|
{
|
||||||
|
public class UserSkillDeclaration : UserSkill {
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the user.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name of the user.</value>
|
||||||
|
public string UserName { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
45
yavscModel/Skill/UserSkillRating.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
//
|
||||||
|
// SkillRating.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;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Skill
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Skill rating.
|
||||||
|
/// </summary>
|
||||||
|
public class UserSkillRating: UserSkillReference, IRating, IAuthorized
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the rate.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The rate.</value>
|
||||||
|
public int Rate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the author.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The author.</value>
|
||||||
|
public string Author { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
49
yavscModel/Skill/UserSkillReference.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
//
|
||||||
|
// UserSkillReference.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;
|
||||||
|
|
||||||
|
namespace Yavsc.Model.Skill
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// User skill reference.
|
||||||
|
/// </summary>
|
||||||
|
public class UserSkillReference {
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the user's skill identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The skill identifier.</value>
|
||||||
|
public long Id { get;set ; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the skill identifier.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The skill identifier.</value>
|
||||||
|
public long SkillId { get;set ; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the name of the performer.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The name of the user.</value>
|
||||||
|
public string Performer { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||