Merge /home/paul/workspace/totem

This commit is contained in:
Paul Schneider
2015-10-19 18:50:04 +02:00
146 changed files with 4830 additions and 3576 deletions

3
.gitignore vendored
View File

@ -6,10 +6,11 @@ plugins/*/obj
packages
web/avatars
web/users
build
dist
bower_components
node_modules
svg
.nuget
.gitignore
web/bfiles

View File

@ -1,32 +1,4 @@
2015-10-04 Paul Schneider <paul@pschneider.fr>
2015-10-09 Paul Schneider <paul@pschneider.fr>
* Makefile: adds a new line to the end of file
2015-10-04 Paul Schneider <paul@pschneider.fr>
* Makefile: my deploy config
2015-08-20 Paul Schneider <paul@pschneider.fr>
* Yavsc.sln: Adds the `Presta` project
2015-08-14 Paul Schneider <paul@pschneider.fr>
* README.md: blanked: not clear enough
2015-07-17 Paul Schneider <paul@pschneider.fr>
* Yavsc.sln:
2015-06-09 Paul Schneider <paul@pschneider.fr>
* Yavsc.sln: creates a packaging project
2015-06-07 Paul Schneider <paul@pschneider.fr>
* Makefile: cleans the StyleCop cache
2015-06-06 Paul Schneider <paul@pschneider.fr>
* Yavsc.sln: modifies the Version control integration
* Makefile: reloads config after each rsync call

View File

@ -1,18 +0,0 @@
2015-10-04 Paul Schneider <paul@pschneider.fr>
* packages.config:
* ITContentProvider.csproj: Npgsql package update
2015-07-15 Paul Schneider <paul@pschneider.fr>
* ITContentProvider.csproj: Moves to Mono framework
2015-06-10 Paul Schneider <paul@pschneider.fr>
* ITContentProvider.csproj:
2015-06-09 Paul Schneider <paul@pschneider.fr>
* ITContentProvider.csproj: Helps to fix packaging, and cleans
dependencies

View File

@ -3,25 +3,17 @@ VERSION=1.1
CONFIG=Debug
LDYDESTDIR=dist/web/$(CONFIG)
COPYUNCHANGED="false"
HOST_rsync_yavsc=lua.pschneider.fr
DESTDIR_rsync_yavsc=/srv/www/yavsc
HOST_rsync_lua=lua.pschneider.fr
DESTDIR_rsync_lua=/srv/www/lua
HOST_rsync_pre=lua.pschneider.fr
DESTDIR_rsync_pre=/srv/www/yavscpre
HOST_rsync_prod=lua.pschneider.fr
DESTDIR_rsync_prod=/srv/www/yavsc
RSYNCCMD=rsync -ravu --chown=www-data:www-data
HOST_rsync_dev=totemdev.localdomain
DESTDIR_rsync_dev=/srv/www/totemdev
HOST_rsync_pre=totempre.localdomain
DESTDIR_rsync_pre=/srv/www/totempre
HOST_rsync_prod=totemprod.pschneider.fr
DESTDIR_rsync_prod=/srv/www/totemprod
DOCASSBS=NpgsqlBlogProvider.dll WorkFlowProvider.dll Yavsc.WebControls.dll ITContentProvider.dll NpgsqlMRPProviders.dll Yavsc.dll SalesCatalog.dll YavscModel.dll
RSYNCCMD=rsync -ravu --chown=www-data:www-data
all: deploy
ddir:
mkdir -p $(LDYDESTDIR)
@ -30,17 +22,17 @@ deploy: ddir build
xbuild /p:Configuration=$(CONFIG) /p:SkipCopyUnchangedFiles=$(COPYUNCHANGED) /p:DeployDir=../$(LDYDESTDIR) /t:Deploy web/Web.csproj
mv $(LDYDESTDIR)/Web.config $(LDYDESTDIR)/Web.config.new
rsync_% : HOST = $(HOST_$@)
rsync_% : DESTDIR = $(DESTDIR_$@)
rsync_% : deploy
echo "!Deploying to $(HOST)!"
$(RSYNCCMD) dist/web/$(CONFIG)/ root@$(HOST):$(DESTDIR)
ssh root@$(HOST) "service apache2 reload"
build:
xbuild /p:Configuration=$(CONFIG) /t:Build Yavsc.sln
xbuild /p:Configuration=$(CONFIG) /t:Build Totem.sln
clean:
xbuild /t:Clean
@ -64,12 +56,9 @@ htmldoc: xmldoc
docdeploy-prod: htmldoc
rsync -ravu web/htmldoc root@$(PRODHOSTDIR)
rsync_lua:
rsync_yavsc:
rsync_dev:
rsync_pre:
rsync_prod:

View File

@ -1,40 +1,27 @@
2015-10-07 Paul Schneider <paul@pschneider.fr>
2015-10-19 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.cs: Fixes usage of Npgsql upgrade to
latest version
* NpgsqlTagInfo.cs: Fixes the photo retreival
2015-10-04 Paul Schneider <paul@pschneider.fr>
2015-10-17 Paul Schneider <paul@pschneider.fr>
* packages.config:
* NpgsqlBlogProvider.csproj: Npgsql package update
* NpgsqlTagInfo.cs:
* NpgsqlBlogProvider.cs:
2015-09-27 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.cs: Fixes the sql command preparation
2015-09-23 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.cs: refactoring: The `UserName` property
from the `BlogEntry` class is renamed to `Author`
2015-08-04 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.cs: * Remove post by id
* Manage collections of entries on a couple (user,title), not
a single post
2015-07-15 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.csproj: Moves to Mono framework
2015-07-02 Paul Schneider <paul@pschneider.fr>
2015-10-17 Paul Schneider <paul@pschneider.fr>
* NpgsqlTagInfo.cs:
* NpgsqlBlogProvider.cs:
* NpgsqlBlogProvider.csproj:
2015-06-09 Paul Schneider <paul@pschneider.fr>
2015-10-17 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.csproj: Helps to fix packaging, and
cleans dependencies
* NpgsqlBlogProvider.cs:
2015-10-13 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.cs: implements the tag methods on db
2015-10-10 Paul Schneider <paul@pschneider.fr>
* NpgsqlBlogProvider.cs:

View File

@ -7,6 +7,7 @@ using Yavsc.Model.Blogs;
using Yavsc.Model.Circles;
using System.Web.Mvc;
using NpgsqlTypes;
using System.Linq;
namespace Npgsql.Web.Blog
{
@ -15,40 +16,70 @@ namespace Npgsql.Web.Blog
/// </summary>
public class NpgsqlBlogProvider : BlogProvider
{
string applicationName;
string connectionString;
#region implemented abstract members of BlogProvider
/// <summary>
/// Tag the specified postid and tag.
/// Gets the tag info.
/// </summary>
/// <returns>The tag info.</returns>
/// <param name="tagname">Tagname.</param>
public override TagInfo GetTagInfo (string tagname)
{
return new NpgsqlTagInfo (connectionString, tagname);
}
/// <summary>
/// Tag the specified post by identifier
/// using the given tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tag">Tag.</param>
public override long Tag (long postid, string tag)
/// <param name="tagname">Tag name.</param>
public override long Tag (long postid, string tagname)
{
long tid = GetOrCreateTagId (tagname);
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into bltag (blid,tag) values (@postid,@tag) returning _id";
cmd.Parameters.AddWithValue("@tag",tag);
cmd.Parameters.AddWithValue("@postid",postid);
cmd.CommandText = "INSERT INTO tagged (tagid,postid) VALUES (:tid,:pid)";
cmd.Parameters.AddWithValue ("tid", tid);
cmd.Parameters.AddWithValue ("pid", postid);
cnx.Open ();
return (long) cmd.ExecuteScalar ();
cmd.ExecuteNonQuery ();
return tid;
}
}
/// <summary>
/// Removes the tag.
/// Uns the tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tagid">Tagid.</param>
public override void RemoveTag (long tagid)
/// <param name="name">Name.</param>
override public void Untag (long postid, string name)
{
Untag (postid, GetTagId (name));
}
/// <summary>
/// Uns the tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="tagid">Tagid.</param>
/// <param name="tid">Tid.</param>
override public void Untag (long postid, long tid)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from bltag where _id = @tagid";
cmd.Parameters.AddWithValue("@tagid",tagid);
cmd.CommandText = "DELETE FROM tagged WHERE postid = :pid AND tagid = :tid";
cmd.Parameters.AddWithValue ("pid", postid);
cmd.Parameters.AddWithValue ("tid", tid);
cnx.Open ();
cmd.ExecuteNonQuery ();
cmd.ExecuteNonQuery ();
}
}
/// <summary>
/// Gets the comments.
/// </summary>
@ -59,32 +90,33 @@ namespace Npgsql.Web.Blog
{
List<Comment> cmts = new List<Comment> ();
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id, username, bcontent, modified, posted, visible from comment " +
"where applicationname = @appname and postid = @id" +
((getHidden) ? " and visible = true ":" ") +
"order by posted asc" ;
cmd.Parameters.AddWithValue ("@appname", applicationName);
cmd.Parameters.AddWithValue ("@id", postid);
"where applicationname = :appname and postid = :id" +
((getHidden) ? " and visible = true " : " ") +
"order by posted asc";
cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("id", postid);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
Comment c = new Comment();
Comment c = new Comment ();
c.CommentText = rdr.GetString (rdr.GetOrdinal ("bcontent"));
c.From = rdr.GetString (rdr.GetOrdinal ("username"));
c.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
c.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
c.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
c.PostId = postid;
c.Id = rdr.GetInt64(rdr.GetOrdinal("_id"));
c.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
cmts.Add (c);
}
}
}
return cmts.ToArray();
return cmts.ToArray ();
}
/// <summary>
/// Updates the post.
/// </summary>
@ -94,29 +126,30 @@ namespace Npgsql.Web.Blog
/// <param name="visible">If set to <c>true</c> visible.</param>
/// <param name="cids">Circle identifiers</param>
public override void UpdatePost (long postid, string title, string content,
bool visible, long [] cids)
bool visible, long[] cids)
{
using (NpgsqlConnection cnx = new NpgsqlConnection(connectionString)) {
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
DateTime now = DateTime.Now;
cmd.CommandText =
"update blog set modified=@now," +
" title = @title," +
" bcontent=@content, " +
" visible = @visible " +
"where _id = @id";
cmd.Parameters.AddWithValue ("@now", now);
cmd.Parameters.AddWithValue ("@title", title);
cmd.Parameters.AddWithValue ("@content", content);
cmd.Parameters.AddWithValue ("@visible", visible);
cmd.Parameters.AddWithValue ("@id", postid);
"update blog set modified=:now," +
" title = :title," +
" bcontent=:content, " +
" visible = :visible " +
"where _id = :id";
cmd.Parameters.AddWithValue ("now", now);
cmd.Parameters.AddWithValue ("title", title);
cmd.Parameters.AddWithValue ("content", content);
cmd.Parameters.AddWithValue ("visible", visible);
cmd.Parameters.AddWithValue ("id", postid);
cnx.Open ();
cmd.ExecuteNonQuery ();
}
cnx.Close();
cnx.Close ();
}
UpdatePostCircles (postid, cids);
}
/// <summary>
/// Removes the post.
/// </summary>
@ -125,12 +158,13 @@ namespace Npgsql.Web.Blog
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from blog where _id = @id";
cmd.CommandText = "delete from blog where _id = :id";
cmd.Parameters.AddWithValue ("id", postid);
cnx.Open ();
cmd.ExecuteNonQuery();
cmd.ExecuteNonQuery ();
}
}
/// <summary>
/// Comment the specified from, postid and content.
/// </summary>
@ -140,29 +174,30 @@ namespace Npgsql.Web.Blog
public override long Comment (string from, long postid, string content)
{
if (from == null)
throw new ArgumentNullException("from");
throw new ArgumentNullException ("from");
if (content == null)
throw new ArgumentNullException("content");
throw new ArgumentNullException ("content");
bool visible = AutoValidatesComments;
using (NpgsqlConnection cnx=
new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
using (NpgsqlConnection cnx =
new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into comment (postid,bcontent," +
"modified,posted,visible,username,applicationname)" +
"values (@postid,@bcontent,@modified,@posted," +
"@visible,@username,@appname) returning _id";
cmd.Parameters.AddWithValue ("@postid", postid);
cmd.Parameters.AddWithValue ("@bcontent", content);
"modified,posted,visible,username,applicationname)" +
"values (:postid,:bcontent,:modified,:posted," +
":visible,:username,:appname) returning _id";
cmd.Parameters.AddWithValue ("postid", postid);
cmd.Parameters.AddWithValue ("bcontent", content);
DateTime now = DateTime.Now;
cmd.Parameters.AddWithValue ("@modified", now);
cmd.Parameters.AddWithValue ("@posted", now);
cmd.Parameters.AddWithValue ("@visible", visible);
cmd.Parameters.AddWithValue ("@username", from);
cmd.Parameters.AddWithValue ("@appname", applicationName);
cmd.Parameters.AddWithValue ("modified", now);
cmd.Parameters.AddWithValue ("posted", now);
cmd.Parameters.AddWithValue ("visible", visible);
cmd.Parameters.AddWithValue ("username", from);
cmd.Parameters.AddWithValue ("appname", applicationName);
cnx.Open ();
return (long) cmd.ExecuteScalar();
return (long)cmd.ExecuteScalar ();
}
}
/// <summary>
/// Validates the comment.
/// </summary>
@ -171,6 +206,7 @@ namespace Npgsql.Web.Blog
{
throw new NotImplementedException ();
}
/// <summary>
/// Updates the comment.
/// </summary>
@ -184,6 +220,7 @@ namespace Npgsql.Web.Blog
}
private bool autoValidateComment = true;
/// <summary>
/// Gets or sets a value indicating whether this <see cref="Npgsql.Web.Blog.NpgsqlBlogProvider"/> auto validate comment.
/// </summary>
@ -193,7 +230,7 @@ namespace Npgsql.Web.Blog
return autoValidateComment;
}
set {
autoValidateComment=value;
autoValidateComment = value;
}
}
@ -209,6 +246,7 @@ namespace Npgsql.Web.Blog
}
#endregion
/// <summary>
/// Initialize the specified name and config.
/// </summary>
@ -222,10 +260,12 @@ namespace Npgsql.Web.Blog
config.Remove ("connectionStringName");
applicationName = config ["applicationName"];
config.Remove ("applicationName");
defaultPageSize = int.Parse ( config ["pageLen"] ?? "10") ;
defaultPageSize = int.Parse (config ["pageLen"] ?? "10");
base.Initialize (name, config);
}
#region implemented abstract members of BlogProvider
/// <summary>
/// Gets the post.
/// </summary>
@ -234,14 +274,14 @@ namespace Npgsql.Web.Blog
public override BlogEntry GetPost (long postid)
{
BlogEntry be = null;
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "select username, title, bcontent, modified, posted, visible from blog " +
"where applicationname = @appname and _id = @id";
cmd.Parameters.AddWithValue ("@appname", applicationName);
cmd.Parameters.AddWithValue ("@id", postid);
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select username, title, bcontent, modified, posted, visible, photo from blog " +
"where applicationname = :appname and _id = :id";
cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("id", postid);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
if (rdr.Read ()) {
be = new BlogEntry ();
be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
@ -250,13 +290,19 @@ namespace Npgsql.Web.Blog
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
int oph = rdr.GetOrdinal ("photo");
if (!rdr.IsDBNull (oph))
be.Photo = rdr.GetString (oph);
be.Id = postid;
}
}
}
if (be!=null) SetCirclesOn (be);
if (be != null)
Populate (be);
return be;
}
/// <summary>
/// Removes the comment.
/// </summary>
@ -267,13 +313,14 @@ namespace Npgsql.Web.Blog
long postid = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from comment where _id = @id returning postid";
cmd.CommandText = "delete from comment where _id = :id returning postid";
cmd.Parameters.AddWithValue ("id", cmtid);
cnx.Open ();
postid = (long) cmd.ExecuteScalar ();
postid = (long)cmd.ExecuteScalar ();
}
return postid;
}
/// <summary>
/// Gets the post.
/// </summary>
@ -282,13 +329,13 @@ namespace Npgsql.Web.Blog
/// <param name="title">Title.</param>
public override UUTBlogEntryCollection GetPost (string username, string title)
{
UUTBlogEntryCollection bec = new UUTBlogEntryCollection (username,title);
UUTBlogEntryCollection bec = new UUTBlogEntryCollection (username, title);
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select _id,bcontent,modified,posted,visible from blog " +
cmd.CommandText = "select _id,bcontent,modified,posted,visible,photo from blog " +
"where applicationname = :appname and username = :username and title = :title";
cmd.Parameters.AddWithValue ("appname", NpgsqlDbType.Varchar, applicationName);
cmd.Parameters.AddWithValue ("username", NpgsqlDbType.Varchar ,username);
cmd.Parameters.AddWithValue ("username", NpgsqlDbType.Varchar, username);
cmd.Parameters.AddWithValue ("title", NpgsqlDbType.Varchar, title);
cnx.Open ();
cmd.Prepare ();
@ -302,6 +349,11 @@ namespace Npgsql.Web.Blog
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
{
int oph = rdr.GetOrdinal ("photo");
if (!rdr.IsDBNull (oph))
be.Photo = rdr.GetString (oph);
}
bec.Add (be);
}
rdr.Close ();
@ -325,20 +377,20 @@ namespace Npgsql.Web.Blog
be.Tags = tags.ToArray ();
}
}
SetCirclesOn (bec);
if (bec != null)
Populate (bec);
}
}
return bec;
}
private void SetCirclesOn(BlogEntry be)
private void SetCirclesOn (BlogEntry be)
{
List<long> circles = new List<long> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmdcircles = cnx.CreateCommand ()) {
cmdcircles.CommandText = "select a.circle_id from blog_access a " +
"where a.post_id = :pid";
"where a.post_id = :pid";
cmdcircles.Parameters.AddWithValue ("pid", be.Id);
cnx.Open ();
using (NpgsqlDataReader rdr = cmdcircles.ExecuteReader ()) {
@ -350,12 +402,122 @@ namespace Npgsql.Web.Blog
be.AllowedCircles = circles.ToArray ();
}
private void SetCirclesOn(BlogEntryCollection bec)
{
foreach (BlogEntry be in bec) {
SetCirclesOn (be);
/// <summary>
/// Removes the tag.
/// </summary>
/// <param name="tagid">Tagid.</param>
public override void DropTag (long tagid)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "DELETE from public.tag where _id = :tid";
cmd.Parameters.AddWithValue ("tagid", tagid);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close ();
}
}
private static string SelectTagsSql = "SELECT tag.name, tag._id FROM public.tag WHERE name like :name";
private IEnumerable<string> GetSuggestion (string pattern)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = SelectTagsSql;
throw new NotImplementedException ();
}
}
private static string InsertTagSql = "INSERT INTO tag (name) VALUES (:name) returning _id";
private void InsertTag (long postid, long tagid)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = InsertTagSql;
throw new NotImplementedException ();
}
}
private long GetTagId (string tagname)
{
long id = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "SELECT tag._id FROM public.tag WHERE name = :name";
cmd.Parameters.AddWithValue ("name", tagname);
cnx.Open ();
id = (long)cmd.ExecuteScalar ();
}
return id;
}
private long GetOrCreateTagId (string tagname)
{
long id = 0;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
try {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "SELECT tag._id FROM public.tag WHERE name = :name";
cmd.Parameters.AddWithValue ("name", tagname);
cnx.Open ();
id = (long)cmd.ExecuteScalar ();
}
} catch (NullReferenceException) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "INSERT INTO public.tag(name) VALUES (:name) RETURNING _id";
cmd.Parameters.AddWithValue ("name", tagname);
cnx.Open ();
id = (long)cmd.ExecuteScalar ();
}
}
}
return id;
}
private static string SelectPostTagsSql = "SELECT tag.name FROM public.tag, public.tagged\n" +
"WHERE tag._id = tagged.tagid AND tagged.postid = :pid \n";
private void SetTagsOn (BlogEntryCollection bec)
{
foreach (BlogEntry be in bec) {
SetTagsOn (be);
}
}
private void SetTagsOn (BlogEntry be)
{
List<string> tags = new List<string> ();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmdtags = cnx.CreateCommand ()) {
cmdtags.CommandText = SelectPostTagsSql;
cmdtags.Parameters.AddWithValue ("pid", be.Id);
cnx.Open ();
using (NpgsqlDataReader rdr = cmdtags.ExecuteReader ()) {
while (rdr.Read ()) {
tags.Add (rdr.GetString (0));
}
}
}
be.Tags = tags.ToArray ();
}
// Assert(bec!=null);
private void Populate (BlogEntryCollection bec)
{
foreach (BlogEntry be in bec)
Populate (be);
}
private void Populate (BlogEntry be)
{
SetTagsOn (be);
SetCirclesOn (be);
}
/// <summary>
/// Post the specified username, title, content and visible.
/// </summary>
@ -364,15 +526,15 @@ namespace Npgsql.Web.Blog
/// <param name="content">Content.</param>
/// <param name="visible">If set to <c>true</c> visible.</param>
/// <param name="circles">.</param>
public override long Post (string username, string title, string content, bool visible, long [] circles)
public override long Post (string username, string title, string content, bool visible, long[] circles)
{
long pid = 0;
if (username == null)
throw new ArgumentNullException("username");
throw new ArgumentNullException ("username");
if (title == null)
throw new ArgumentNullException("title");
throw new ArgumentNullException ("title");
if (content == null)
throw new ArgumentNullException("content");
throw new ArgumentNullException ("content");
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into blog (title,bcontent,modified,posted,visible,username,applicationname)" +
@ -394,7 +556,26 @@ namespace Npgsql.Web.Blog
return pid;
}
private void UpdatePostCircles( long pid, long[] circles)
/// <summary>
/// Updates the post photo.
/// </summary>
/// <param name="pid">Pid.</param>
/// <param name="photo">Photo.</param>
public override void UpdatePostPhoto (long pid, string photo)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "update blog set photo = :photo where _id = :pid";
cmd.Parameters.AddWithValue ("pid", pid);
cmd.Parameters.AddWithValue ("photo", photo);
cmd.ExecuteNonQuery ();
}
cnx.Close ();
}
}
private void UpdatePostCircles (long pid, long[] circles)
{
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) {
cnx.Open ();
@ -403,21 +584,22 @@ namespace Npgsql.Web.Blog
cmd.Parameters.AddWithValue ("pid", pid);
cmd.ExecuteNonQuery ();
}
if (circles!=null)
if (circles.Length>0)
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into blog_access (post_id,circle_id) values (:pid,:cid)";
cmd.Parameters.AddWithValue ("pid", NpgsqlTypes.NpgsqlDbType.Bigint, pid);
cmd.Parameters.Add ("cid", NpgsqlTypes.NpgsqlDbType.Bigint);
cmd.Prepare ();
foreach (long ci in circles) {
cmd.Parameters ["cid"].Value = ci;
cmd.ExecuteNonQuery ();
if (circles != null)
if (circles.Length > 0)
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "insert into blog_access (post_id,circle_id) values (:pid,:cid)";
cmd.Parameters.AddWithValue ("pid", NpgsqlTypes.NpgsqlDbType.Bigint, pid);
cmd.Parameters.Add ("cid", NpgsqlTypes.NpgsqlDbType.Bigint);
cmd.Prepare ();
foreach (long ci in circles) {
cmd.Parameters ["cid"].Value = ci;
cmd.ExecuteNonQuery ();
}
}
}
cnx.Close ();
}
}
/// <summary>
/// Finds the post.
/// </summary>
@ -432,43 +614,55 @@ namespace Npgsql.Web.Blog
{
BlogEntryCollection c = new BlogEntryCollection ();
totalRecords = 0;
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
if (readersName != null) {
cmd.CommandText = "select _id, title,bcontent,modified," +
"posted,username,visible " +
"from blog b left outer join " +
"(select count(*)>0 acc, a.post_id pid " +
"from blog_access a," +
" circle_members m, users u where m.circle_id = a.circle_id " +
" and m.member = u.pkid and u.username = :uname " +
" and u.applicationname = :appname " +
" group by a.post_id) ma on (ma.pid = b._id) " +
"where ( ma.acc IS NULL or ma.acc = TRUE or b.username = :uname) ";
cmd.CommandText = "select _id, title,bcontent, modified," +
"posted,username,visible,photo " +
"from blog b left outer join " +
"(select count(*)>0 acc, a.post_id pid " +
"from blog_access a," +
" circle_members m, users u where m.circle_id = a.circle_id " +
" and m.member = u.username and u.username = :uname " +
" and u.applicationname = :appname " +
" group by a.post_id) ma on (ma.pid = b._id) " +
"where ( ((ma.acc IS NULL or ma.acc = TRUE) and b.Visible IS TRUE ) or b.username = :uname) ";
cmd.Parameters.AddWithValue ("uname", readersName);
} else {
cmd.CommandText = "select _id, title,bcontent,modified," +
"posted,username,visible " +
"from blog b left outer join " +
"(select count(*)>0 acc, a.post_id pid " +
"from blog_access a" +
" group by a.post_id) ma on (ma.pid = b._id)" +
" where " +
" ma.acc IS NULL and " +
" applicationname = :appname";
"posted,username,visible,photo " +
"from blog b left outer join " +
"(select count(*)>0 acc, a.post_id pid " +
"from blog_access a" +
" group by a.post_id) ma on (ma.pid = b._id)" +
" where " +
" ma.acc IS NULL and " +
" b.Visible IS TRUE and " +
" applicationname = :appname";
}
cmd.Parameters.AddWithValue ("@appname", applicationName);
if ((searchflags & FindBlogEntryFlags.MatchContent) > 0) {
cmd.CommandText += " and bcontent like :bcontent";
cmd.Parameters.AddWithValue (":bcontent", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchTitle) > 0) {
cmd.CommandText += " and title like :title";
cmd.Parameters.AddWithValue (":title", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchUserName) > 0) {
cmd.CommandText += " and username like :username";
cmd.Parameters.AddWithValue (":username", pattern);
cmd.Parameters.AddWithValue ("appname", applicationName);
if (pattern != null) {
if ((searchflags & FindBlogEntryFlags.MatchTag) > 0) {
cmd.CommandText +=
"AND EXISTS (SELECT tag._id FROM public.tag, public.tagged WHERE " +
"public.tag._id = public.tagged.tagid " +
"AND public.tagged.postid = a.post_id " +
"public.tag.name like :tagname) ";
cmd.Parameters.AddWithValue ("tagname", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchContent) > 0) {
cmd.CommandText += " and bcontent like :bcontent";
cmd.Parameters.AddWithValue ("bcontent", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchTitle) > 0) {
cmd.CommandText += " and title like :title";
cmd.Parameters.AddWithValue ("title", pattern);
}
if ((searchflags & FindBlogEntryFlags.MatchUserName) > 0) {
cmd.CommandText += " and username like :username";
cmd.Parameters.AddWithValue ("username", pattern);
}
}
if ((searchflags & FindBlogEntryFlags.MatchInvisible) == 0) {
cmd.CommandText += " and visible = true";
@ -476,11 +670,11 @@ namespace Npgsql.Web.Blog
cmd.CommandText += " order by posted desc";
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
// pageIndex became one based
int firstrec = pageIndex * pageSize;
int lastrec = firstrec + pageSize - 1;
while (rdr.Read()) {
while (rdr.Read ()) {
if (totalRecords >= firstrec && totalRecords <= lastrec) {
BlogEntry be = new BlogEntry ();
be.Title = rdr.GetString (rdr.GetOrdinal ("title"));
@ -489,7 +683,12 @@ namespace Npgsql.Web.Blog
be.Author = rdr.GetString (rdr.GetOrdinal ("username"));
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible"));
{
int oph = rdr.GetOrdinal ("photo");
if (!rdr.IsDBNull (oph))
be.Photo = rdr.GetString (oph);
}
c.Add (be);
}
totalRecords++;
@ -497,11 +696,12 @@ namespace Npgsql.Web.Blog
rdr.Close ();
}
}
foreach (BlogEntry be in c)
SetCirclesOn (be);
if (c != null)
Populate (c);
return c;
}
/// <summary>
/// Removes the post.
/// </summary>
@ -509,20 +709,21 @@ namespace Npgsql.Web.Blog
/// <param name="title">Title.</param>
public override void RemoveTitle (string username, string title)
{
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
cmd.CommandText = "delete from blog where username = @username and applicationname = @appname and title=@title";
cmd.Parameters.AddWithValue ("@username",username);
cmd.Parameters.AddWithValue ("@appname", applicationName);
cmd.Parameters.AddWithValue ("@title",title);
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "delete from blog where username = :username and applicationname = :appname and title=:title";
cmd.Parameters.AddWithValue ("username", username);
cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("title", title);
cnx.Open ();
cmd.ExecuteNonQuery ();
cnx.Close();
cnx.Close ();
}
}
int defaultPageSize = 10;
/// <summary>
/// Lasts the posts.
/// </summary>
@ -530,30 +731,23 @@ namespace Npgsql.Web.Blog
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
/// <param name="totalRecords">Total records.</param>
public override BlogEntryCollection LastPosts(int pageIndex, int pageSize, out int totalRecords)
public override BlogEntryCollection LastPosts (int pageIndex, int pageSize, out int totalRecords)
{
BlogEntryCollection c = new BlogEntryCollection ();
using (NpgsqlConnection cnx=new NpgsqlConnection(connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand()) {
/*cmd.CommandText = "select blog.* from blog, " +
"(select max(posted) lpost, username " +
"from blog where applicationname = @appname " +
"group by username) as lblog " +
"where blog.posted = lblog.lpost and blog.username = lblog.username " ;
*/
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "select * " +
"from blog where applicationname = :appname and visible = true " +
" order by posted desc limit :len" ;
"from blog where applicationname = :appname and visible = true " +
" order by modified desc limit :len";
cmd.Parameters.AddWithValue ("appname", applicationName);
cmd.Parameters.AddWithValue ("len", defaultPageSize*10);
cmd.Parameters.AddWithValue ("len", defaultPageSize * 10);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader()) {
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
totalRecords = 0;
int firstrec = pageIndex * pageSize;
int lastrec = firstrec + pageSize - 1;
while (rdr.Read()) {
while (rdr.Read ()) {
if (totalRecords >= firstrec && totalRecords <= lastrec) {
BlogEntry be = new BlogEntry ();
be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id"));
@ -563,16 +757,22 @@ namespace Npgsql.Web.Blog
be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted"));
be.Modified = rdr.GetDateTime (rdr.GetOrdinal ("modified"));
be.Visible = true; // because of sql code used
{
int oph = rdr.GetOrdinal ("photo");
if (!rdr.IsDBNull (oph))
be.Photo = rdr.GetString (oph);
}
c.Add (be);
}
totalRecords++;
}
}
}
foreach (BlogEntry be in c)
SetCirclesOn (be);
if (c != null)
Populate (c);
return c;
}
#endregion
}
}

View File

@ -34,6 +34,7 @@
<ItemGroup>
<Compile Include="NpgsqlBlogProvider.cs" />
<Compile Include="AssemblyInfo.cs" />
<Compile Include="NpgsqlTagInfo.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Sql\" />

View File

@ -0,0 +1,103 @@
//
// NpgsqlTagInfo.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.Blogs;
using System.Collections.Generic;
namespace Npgsql.Web.Blog
{
/// <summary>
/// Npgsql tag info.
/// </summary>
public class NpgsqlTagInfo: TagInfo
{
/// <summary>
/// Initializes a new instance of the <see cref="Npgsql.Web.Blog.NpgsqlTagInfo"/> class.
/// </summary>
/// <param name="connectionString">Connection string.</param>
/// <param name="tagname">Tagname.</param>
public NpgsqlTagInfo (string connectionString, string tagname): base(tagname)
{
titles = new List<BasePostInfo>();
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText =
"SELECT \n" +
" blog.username, \n" +
" blog.posted, \n" +
" blog.modified, \n" +
" blog.title, \n" +
" blog.bcontent, \n" +
" blog.visible, \n" +
" blog._id, \n" +
" blog.photo, \n" +
" tag.name\n" +
"FROM \n" +
" public.blog, \n" +
" public.tagged, \n" +
" public.tag\n" +
"WHERE \n" +
" tagged.postid = blog._id AND \n" +
" tag._id = tagged.tagid AND \n" +
" public.tag.name = :name";
cmd.Parameters.AddWithValue ("name", tagname);
cnx.Open ();
using (NpgsqlDataReader rdr = cmd.ExecuteReader ()) {
while (rdr.Read ()) {
bool truncated;
int oph = rdr.GetOrdinal ("photo");
string photo = null;
if (!rdr.IsDBNull (oph))
photo = rdr.GetString (oph);
var pi = new BasePostInfo {
Title = rdr.GetString(3),
Author = rdr.GetString (0),
Id = rdr.GetInt64 (6),
Intro = MarkdownHelper.MarkdownIntro (
rdr.GetString (4),
out truncated),
Visible = rdr.GetBoolean(5),
Photo = photo,
Modified = rdr.GetDateTime(2),
Posted = rdr.GetDateTime(1)
};
titles.Add (pi);
}
}
}
}
List<BasePostInfo> titles;
#region implemented abstract members of TagInfo
/// <summary>
/// Gets the titles.
/// </summary>
/// <value>The titles.</value>
public override System.Collections.Generic.IEnumerable<BasePostInfo> Titles {
get {
return titles;
}
}
#endregion
}
}

View File

@ -1,62 +0,0 @@
2015-10-04 Paul Schneider <paul@pschneider.fr>
* packages.config:
* NpgsqlContentProvider.csproj: Npgsql package update
2015-09-27 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: Fixes the sql command preparation
2015-09-10 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs:
2015-09-10 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: * refactoring
* updates the circle
2015-08-20 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: circle members are now stored in bd
upon their user's name
2015-08-04 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: Fixes the "Match" method.
* NpgsqlContentProvider.cs: refactoring
2015-07-15 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: Makes Circles private, or not
* NpgsqlContentProvider.cs: Impacts htmldoc
* NpgsqlContentProvider.csproj: Moves to Mono framework
2015-07-02 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs:
2015-06-18 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: Fixes the Circle creation
* NpgsqlContentProvider.cs: code formatting
2015-06-10 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs:
2015-06-10 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: implements a Circle provider
* NpgsqlContentProvider.csproj: new circle provider
2015-06-09 Paul Schneider <paul@pschneider.fr>
* NpgsqlContentProvider.csproj: Helps to fix packaging, and
cleans dependencies

View File

@ -1,49 +0,0 @@
2015-10-04 Paul Schneider <paul@pschneider.fr>
* packages.config:
* NpgsqlMRPProviders.csproj: Npgsql package update
2015-10-04 Paul Schneider <paul@pschneider.fr>
* NpgsqlMembershipProvider.cs: Fixes a Bug introduced by
Npgsql driver upgrade
2015-08-04 Paul Schneider <paul@pschneider.fr>
* NpgsqlMRPProviders.csproj: new NpgsqlUserName provider
* NpgsqlRoleProvider.cs: simpler init method
* NpgsqlUserNameProvider.cs: impements a UserNameProvider
2015-08-01 Paul Schneider <paul@pschneider.fr>
* NpgsqlMembershipProvider.cs: Fixes the membership update.
2015-07-15 Paul Schneider <paul@pschneider.fr>
* NpgsqlMRPProviders.csproj: Moves to Mono framework
* NpgsqlMembershipProvider.cs: Makes possible to change the
UserName
* NpgsqlRoleProvider.cs: Drops this SQL code, which is
actually maintained in Web/instdbws.sql
2015-06-18 Paul Schneider <paul@pschneider.fr>
* NpgsqlMembershipProvider.cs: should fix a bug at resetting
the password
2015-06-10 Paul Schneider <paul@pschneider.fr>
* NpgsqlMembershipProvider.cs: Fixes the Google registration
since usage of NuGet for Npgsql
2015-06-09 Paul Schneider <paul@pschneider.fr>
* NpgsqlCircleProvider.cs: Refactoring: Npgsql prefix
* NpgsqlMRPProviders.csproj: Helps to fix packaging, and
cleans dependencies

View File

@ -202,7 +202,7 @@ namespace Npgsql.Web
return c;
using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString))
using (NpgsqlCommand cmd = cnx.CreateCommand ()) {
cmd.CommandText = "SELECT * from profiledata,profiles where " +
cmd.CommandText = "SELECT * from profiledata, profiles where " +
"profiledata.uniqueid = profiles.uniqueid " +
"and profiles.username = @username " +
"and profiles.applicationname = @appname";

52
TestAPI/AllTests.cs Normal file
View File

@ -0,0 +1,52 @@
//
// AllTests.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 NUnit.Framework;
using System;
using Yavsc.Model.Blogs;
using Yavsc.Controllers;
using System.Web.Mvc;
using System.Web.Security;
using System.Web.Configuration;
using System.Configuration;
using System.IO;
using System.Web.Http;
using Mono.WebServer;
using System.Net;
using System.Collections;
namespace Yavsc
{
public class AllTests
{
[Suite]
public static IEnumerable Suite
{
get
{
ArrayList suite = new ArrayList ();
suite.Add(new BlogUnitTestCase());
return suite;
}
}
}
}

View File

@ -1,76 +0,0 @@
//
// BlogUnitTest.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 NUnit.Framework;
using System;
using Yavsc.Model.Blogs;
using Yavsc.Controllers;
using System.Web.Mvc;
using System.Web.Security;
namespace TestAPI
{
[TestFixture ()]
public class BlogUnitTest
{
public string UserName { get; set; }
public string Email { get; set; }
public string Password { get; set; }
AccountController accountController;
[TestFixtureSetUp]
public void Init()
{
accountController = new AccountController ();
}
[Test ()]
public void Register ()
{
ViewResult actionResult = accountController.Register (
new Yavsc.Model.RolesAndMembers.RegisterViewModel () {
UserName = UserName, Email = Email,
Password = "tpwd", ConfirmPassword = Password,
IsApprouved = true
},
"/testreturnurl") as ViewResult;
Assert.AreEqual (actionResult.ViewName, "RegistrationPending");
MembershipUser u = Membership.GetUser (UserName, false);
Assert.NotNull (u);
Assert.False (u.IsApproved);
// TODO : check mail for test,
// get the validation key from its body,
// and use the accountController.Validate(username,key)
u.IsApproved = true;
Membership.UpdateUser (u);
Assert.True (u.IsApproved);
}
[TestFixtureTearDown()]
public void Unregister()
{
ViewResult actionResult =
accountController.Unregister (UserName, true) as ViewResult;
Assert.AreEqual (actionResult.ViewName, "Index");
}
}
}

View File

@ -0,0 +1,52 @@
//
// TagTestCases.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 NUnit.Framework;
using System;
using Yavsc.Model.Blogs;
namespace Yavsc
{
[TestFixture ()]
public class BlogUnitTestCase: ServerTestCase
{
[TestFixtureSetUp]
void NeedAPost()
{
Register ();
}
[Test ()]
public void TestCase ()
{
long pid = BlogManager.Post (UserName, "BlogUnitTestCase", "content", true, null);
BlogManager.Tag (pid, "test");
}
[TestFixtureTearDown()]
void Cleanup()
{
Unregister ();
}
}
}

View File

@ -1,20 +1,11 @@
2015-10-07 Paul Schneider <paul@pschneider.fr>
* BlogUnitTest.cs: Should test the user registration
* TestAPI.csproj: switch to .Net framework 4.5.1
2015-10-04 Paul Schneider <paul@pschneider.fr>
2015-10-17 Paul Schneider <paul@pschneider.fr>
* AllTests.cs:
* HelloWorld.cs:
* DebugServer.cs:
* TestAPI.csproj:
* packages.config: Npgsql package update
2015-07-17 Paul Schneider <paul@pschneider.fr>
* TestAPI.csproj:
* AssemblyInfo.cs:
* TestAutomate.cs: Tests an Automate
* packages.config: using Machine.Specifications
* TestAutomate.cs:
* ServerTestCase.cs:
* BlogUnitTestCase.cs:
* test-domain-TestAPI.config:

51
TestAPI/DebugServer.cs Normal file
View File

@ -0,0 +1,51 @@
//
// DebugServer.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 NUnit.Framework;
using System.Net;
using Mono.WebServer.XSP;
namespace Mono.WebServer.Test
{
public class DebugServer : IDisposable
{
#region IDisposable implementation
public void Dispose ()
{
// would have a sense when managing the Xsp server instance:
// server.Stop();
}
#endregion
string physicalPath = @"/home/paul/workspace/totem/web/";
public int Run ()
{
return Server.Main (new [] { "--applications", "/:"+physicalPath, "--port", "8080", "--nonstop" });
}
}
}

73
TestAPI/HelloWorld.cs Normal file
View File

@ -0,0 +1,73 @@
//
// HelloWorld.cs
//
//
// HelloWorld.cs
//
// Author:
// Leonardo Taglialegne <leonardo.taglialegne@gmail.com>
//
// Copyright (c) 2013 Leonardo Taglialegne.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using NUnit.Framework;
using System.Net;
using Mono.WebServer.XSP;
namespace Mono.WebServer.Test
{
[TestFixture]
public class HelloWorld
{
[Test]
public void TestCase ()
{
using (var server = new DebugServer()) {
Assert.AreEqual (0, server.Run ());
var wc = new WebClient ();
try {
string downloaded = wc.DownloadString ("http://localhost:8080/");
//Assert.AreEqual (Environment.CurrentDirectory, downloaded);
// ResponseHeaders {
// Date: Thu, 15 Oct 2015 16:12:00 GMT
// Server: Mono.WebServer.XSP/3.8.0.0 Linux
// X-AspNetMvc-Version: 3.0
// X-AspNet-Version: 4.0.30319
// Content-Length: 2180
// Cache-Control: private
// Content-Type: text/html
// Set-Cookie: ASP.NET_SessionId=ED208D636A4312B9745E396D; path=/
// Keep-Alive: timeout=15, max=100
// Connection: Keep-Alive } System.Net.WebHeaderCollection
Assert.Greater(wc.ResponseHeaders["Set-Cookie"].Length, 10);
} catch (WebException e) {
Assert.Fail (e.Message);
}
}
}
}
}

151
TestAPI/ServerTestCase.cs Normal file
View File

@ -0,0 +1,151 @@
//
// BlogUnitTest.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 NUnit.Framework;
using System;
using Yavsc.Model.Blogs;
using Yavsc.Controllers;
using System.Web.Mvc;
using System.Web.Security;
using System.Web.Configuration;
using System.Configuration;
using System.IO;
using System.Web.Http;
using Mono.WebServer;
using System.Net;
using System.Web.Hosting;
using Mono.Web.Util;
using Mono.WebServer.Options;
namespace Yavsc
{
[TestFixture ()]
public class ServerTestCase
{
public string UserName { get; set; }
public string Email { get; set; }
public string Password { get; set; }
AccountController accountController;
public AccountController AccountController {
get {
return accountController;
}
}
ApplicationServer WebAppServer;
string defaultMembershipProvider = null;
[Test]
public virtual void Start()
{
// get the web config
string physicalPath = @"/home/paul/workspace/totem/web/";
string physicalPathToConfig = physicalPath + "/Web.config";
ExeConfigurationFileMap exemap = new ExeConfigurationFileMap ();
exemap.ExeConfigFilename = physicalPathToConfig ;
Configuration config = System.Configuration.ConfigurationManager.OpenMappedExeConfiguration (exemap, ConfigurationUserLevel.None);
string basedir = AppDomain.CurrentDomain.BaseDirectory;
string curdir = Directory.GetCurrentDirectory ();
string dummyVirtualPath = "/";
int Port=8080;
XSPWebSource websource=new XSPWebSource(IPAddress.Any,Port);
WebAppServer=new ApplicationServer(websource,physicalPath);
var broker = new XSPRequestBroker ();
var host = new XSPApplicationHost ();
host.RequestBroker = broker;
host.Server = WebAppServer;
broker.InitializeLifetimeService ();
host.InitializeLifetimeService ();
// ApplicationHost h = new XSPApplicationHost();
//"[[hostname:]port:]VPath:realpath"
string cmdLine=Port+":/:"+physicalPath;
WebAppServer.AddApplicationsFromCommandLine (cmdLine);
WebAppServer.Broker = broker;
WebAppServer.AppHost = host;
// WebAppServer.AddApplicationsFromConfigFile (physicalPath+"/Web.config");
// WebConfigurationFileMap map = new WebConfigurationFileMap ();
// map.VirtualDirectories.Add (dummyVirtualPath, new VirtualDirectoryMapping (physicalPath, true));
// TODO why not? Configuration configuration = WebConfigurationManager.OpenMappedWebConfiguration (map, dummyVirtualPath);
// string da = (string)config.AppSettings.Settings ["DefaultAvatar"].Value;
// MembershipSection s = config.GetSection ("system.web/membership") as MembershipSection;
// defaultMembershipProvider = s.DefaultProvider;
// ??? WebConfigurationManager.ConfigPath
Configuration cfg = WebConfigurationManager.OpenWebConfiguration (dummyVirtualPath);
// WebConfigurationManager.AppSettings.Clear ();
// WebConfigurationManager.ConnectionStrings.Clear ();
// var mbrssect = WebConfigurationManager.GetWebApplicationSection ("system.web/membership") as MembershipSection;
//
// mbrssect.Providers.Clear ();
var syswebcfg = WebConfigurationManager.GetWebApplicationSection ("system.web") as ConfigurationSection;
WebAppServer.Start (true,2000);
// System.Threading.Thread.Sleep(30000);
}
[Test ()]
public virtual void Register ()
{
accountController = new AccountController ();
ViewResult actionResult = accountController.Register (
new Yavsc.Model.RolesAndMembers.RegisterViewModel () {
UserName = UserName, Email = Email,
Password = "tpwd", ConfirmPassword = Password,
IsApprouved = true
},
"/testreturnurl") as ViewResult;
Assert.AreSame ("",actionResult.ViewName);
MembershipUser u = Membership.GetUser (UserName, false);
Assert.NotNull (u);
Assert.False (u.IsApproved);
// TODO : check mail for test,
// get the validation key from its body,
// and use the accountController.Validate(username,key)
u.IsApproved = true;
Membership.UpdateUser (u);
Assert.True (u.IsApproved);
}
[Test()]
public virtual void Stop() {
WebAppServer.Stop();
}
public virtual void Unregister()
{
ViewResult actionResult =
accountController.Unregister (UserName, true) as ViewResult;
Assert.AreEqual (actionResult.ViewName, "Index");
}
}
}

View File

@ -58,11 +58,37 @@
<Reference Include="System.Web.Mvc" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Web.Http" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Security" />
<Reference Include="System.Net" />
<Reference Include="Mono.WebServer2">
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\Mono.WebServer2.dll</HintPath>
</Reference>
<Reference Include="xsp4">
<HintPath>..\..\..\..\..\usr\lib\mono\4.5\xsp4.exe</HintPath>
</Reference>
<Reference Include="nunit.util, Version=2.6.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<Package>nunit</Package>
</Reference>
<Reference Include="nunit.mocks, Version=2.6.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<Package>nunit</Package>
</Reference>
<Reference Include="nunit-console-runner, Version=2.6.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<Package>nunit</Package>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestAutomate.cs" />
<Compile Include="BlogUnitTest.cs" />
<Compile Include="BlogUnitTestCase.cs" />
<Compile Include="TestByteA.cs" />
<Compile Include="AllTests.cs" />
<Compile Include="HelloWorld.cs" />
<Compile Include="ServerTestCase.cs" />
<Compile Include="DebugServer.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@ -74,8 +100,28 @@
<Project>{77044C92-D2F1-45BD-80DD-AA25B311B027}</Project>
<Name>Web</Name>
</ProjectReference>
<ProjectReference Include="..\NpgsqlBlogProvider\NpgsqlBlogProvider.csproj">
<Project>{C6E9E91B-97D3-48D9-8AA7-05356929E162}</Project>
<Name>NpgsqlBlogProvider</Name>
</ProjectReference>
<ProjectReference Include="..\NpgsqlContentProvider\NpgsqlContentProvider.csproj">
<Project>{821FF72D-9F4B-4A2C-B95C-7B965291F119}</Project>
<Name>NpgsqlContentProvider</Name>
</ProjectReference>
<ProjectReference Include="..\NpgsqlMRPProviders\NpgsqlMRPProviders.csproj">
<Project>{BBA7175D-7F92-4278-96FC-84C495A2B5A6}</Project>
<Name>NpgsqlMRPProviders</Name>
</ProjectReference>
<ProjectReference Include="..\SalesCatalog\SalesCatalog.csproj">
<Project>{90BF2234-7252-4CD5-B2A4-17501B19279B}</Project>
<Name>SalesCatalog</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="test-domain-TestAPI.config">
<Gettext-ScanForTranslations>False</Gettext-ScanForTranslations>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
</Project>

View File

@ -55,7 +55,9 @@ namespace TestAPI
[Test]
public void DoTheTest()
{
// Establish
context.Invoke ();
// Because
of.Invoke ();
should_be_in_state_0.Invoke ();
should_not_be_in_state_1.Invoke ();

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
</sectionGroup>
</sectionGroup>
</sectionGroup>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<sectionGroup name="system.web">
<section name="membership" type="System.Web.Configuration.MembershipSection, System.Web" />
<section name="blog" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="thanks" type="Yavsc.ThanksConfigurationSection, Yavsc" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="catalog" type="Yavsc.Model.FrontOffice.Configuration.CatalogProvidersConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="workflow" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" allowLocation="true" requirePermission="false" allowDefinition="Everywhere" />
<section name="circleProviders" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" />
<section name="userNameManager" type="Yavsc.Model.DataProviderConfigurationSection, YavscModel" />
</sectionGroup>
<section name="paypal" type="PayPal.SDKConfigHandler, PayPal" />
</configSections>
<system.data>
<DbProviderFactories>
<add name="Npgsql Data Provider" invariant="Npgsql" support="FF" description=".Net Framework Data Provider for Postgresql Server" type="Npgsql.NpgsqlFactory, Npgsql" />
</DbProviderFactories>
</system.data>
<system.web>
<authentication mode="Forms" >
<forms loginUrl="login.aspx"
name=".ASPXFORMSAUTH" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
<membership defaultProvider="NpgsqlMembershipProvider" userIsOnlineTimeWindow="1">
<providers>
<clear />
<add name="NpgsqlMembershipProvider" type="Npgsql.Web.NpgsqlMembershipProvider, NpgsqlMRPProviders"
connectionStringName="yavsc" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="false"
requiresUniqueEmail="true" passwordFormat="Clear" maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10" applicationName="/" autogenerateschema="false" />
</providers>
</membership>
<roleManager enabled="true" defaultProvider="NpgsqlRoleProvider">
<providers>
<clear />
<add name="NpgsqlRoleProvider" connectionStringName="yavsc" applicationName="/" type="Npgsql.Web.NpgsqlRoleProvider, NpgsqlMRPProviders" autogenerateschema="false" />
</providers>
</roleManager>
<userNameManager defaultProvider="NpsqlUserNameProvider">
<providers>
<add name="NpsqlUserNameProvider" connectionStringName="yavsc" applicationName="/" type="Npgsql.Web.RolesAndMembers.NpgsqlUserNameProvider, NpgsqlMRPProviders" autogenerateschema="false">
</add>
</providers>
</userNameManager>
<workflow defaultProvider="ITProvider">
<providers>
<clear />
<add name="ITProvider" type="Yavsc.ITCPNpgsqlProvider, ITContentProvider" applicationName="/" connectionStringName="yavsc" />
</providers>
</workflow>
<profile defaultProvider="NpgsqlProfileProvider">
<providers>
<clear />
<add name="NpgsqlProfileProvider" type="Npgsql.Web.NpgsqlProfileProvider, NpgsqlMRPProviders" connectionStringName="yavsc" applicationName="/" description="ProfileProvider for yavsc" />
</providers>
<properties>
<add name="Name" />
<add name="Phone" />
<add name="Mobile" />
<add name="Avatar" />
<add name="BlogVisible" type="System.Boolean" />
<add name="BlogTitle" />
<add name="WebSite" />
<add name="Address" />
<add name="CityAndState" />
<add name="ZipCode" />
<add name="Country" />
<add name="BankCode" />
<add name="IBAN" />
<add name="BIC" />
<add name="WicketCode" />
<add name="AccountNumber" />
<add name="BankedKey" />
<add name="gtoken" />
<add name="grefreshtoken" />
<add name="gtokentype" />
<add name="gtokenexpir" />
<add name="gcalapi" />
<add name="gcalid" />
<add name="gregid" />
</properties>
</profile>
<blog defaultProvider="NpgsqlBlogProvider">
<providers>
<add name="NpgsqlBlogProvider" connectionStringName="yavsc" applicationName="/" type="Npgsql.Web.Blog.NpgsqlBlogProvider, NpgsqlBlogProvider" />
</providers>
</blog>
</system.web>
<connectionStrings>
<add name="yavsc" connectionString="Server=127.0.0.1;Port=5432;Database=totem;User Id=totemweb;Password=cZeoft2k5_d4;" providerName="Npgsql" />
</connectionStrings>
<appSettings>
<add key="MonoServerDefaultIndexFiles" value="index.html,Index.aspx" />
<add key="WorkflowContentProviderClass" value="yavsc.NpgsqlContentProvider" />
<add key="SmtpServer" value="smtp.free.fr" />
<add key="AdminEMail" value="paulschneider@free.fr" />
<add key="OwnerEMail" value="" />
<add key="Name" value="TOTEM PRODUCTION" />
<add key="DefaultController" value="Home" />
<add key="DefaultAvatar" value="/images/noavatar.png;image/png" />
<add key="RegistrationMessage" value="/RegistrationMail.txt" />
<!-- <add key="ClientValidationEnabled" value="true" /> -->
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="PayPalLogger" value="PayPal.Log.Log4netLogger" />
</appSettings>
</configuration>

View File

@ -1,3 +1,8 @@
2015-10-13 Paul Schneider <paul@pschneider.fr>
* ResultPages.cs: A multi-pages result meta info when one page
only
2015-10-04 Paul Schneider <paul@pschneider.fr>
* ResultPages.cs: .

View File

@ -91,6 +91,21 @@ namespace Yavsc.WebControls
}
}
/// <summary>
/// Gets or sets the Single page message.
/// </summary>
/// <value>The none.</value>
[Bindable (true)]
[DefaultValue("1")]
public string SinglePage {
get {
return (string) ViewState["SinglePage"];
}
set {
ViewState["SinglePage"] = value;
}
}
/// <summary>
/// Gets or sets the none.
/// </summary>
@ -105,7 +120,20 @@ namespace Yavsc.WebControls
ViewState["None"] = value;
}
}
/// <summary>
/// Gets or sets the none.
/// </summary>
/// <value>The none.</value>
[Bindable (true)]
[DefaultValue("Pages: ")]
public string PagesLabel {
get {
return (string) ViewState["PagesLabel"];
}
set {
ViewState["PagesLabel"] = value;
}
}
/// <summary>
/// Gets or sets the current page.
/// </summary>
@ -132,6 +160,7 @@ namespace Yavsc.WebControls
writer.WriteEncodedText (Text);
int pageCount = ((ResultCount-1) / PageSize) + 1;
if ( pageCount > 1 ) {
writer.Write (PagesLabel);
for (int pi = (PageIndex < 5) ? 0 : PageIndex - 5; pi < pageCount && pi < PageIndex + 5; pi++) {
if (PageIndex == pi)
writer.RenderBeginTag ("b");
@ -144,6 +173,9 @@ namespace Yavsc.WebControls
writer.RenderEndTag ();
writer.Write ("&nbsp;");
}
}
else {
writer.Write (SinglePage);
}
}
if (ResultCount == 0) {

BIN
totem-banner.xxs.xcf Normal file

Binary file not shown.

BIN
totem.xcf Normal file

Binary file not shown.

View File

@ -39,10 +39,11 @@ namespace Yavsc.ApiControllers
/// Register the specified model.
/// </summary>
/// <param name="model">Model.</param>
[Authorize()]
[Authorize ()]
[ValidateAjaxAttribute]
public HttpResponseMessage Register ([FromBody] RegisterClientModel model)
{
if (ModelState.IsValid) {
if (model.IsApprouved)
if (!Roles.IsUserInRole ("Admin"))
@ -54,32 +55,32 @@ namespace Yavsc.ApiControllers
}
MembershipCreateStatus mcs;
var user = Membership.CreateUser (
model.UserName,
model.Password,
model.Email,
model.Question,
model.Answer,
model.IsApprouved,
out mcs);
model.UserName,
model.Password,
model.Email,
model.Question,
model.Answer,
model.IsApprouved,
out mcs);
switch (mcs) {
case MembershipCreateStatus.DuplicateEmail:
ModelState.AddModelError ("Email", "Cette adresse e-mail correspond " +
"à un compte utilisateur existant");
"à un compte utilisateur existant");
break;
case MembershipCreateStatus.DuplicateUserName:
ModelState.AddModelError ("UserName", "Ce nom d'utilisateur est " +
"déjà enregistré");
"déjà enregistré");
break;
case MembershipCreateStatus.Success:
if (!model.IsApprouved)
Url.SendActivationMessage (user);
ProfileBase prtu = ProfileBase.Create (model.UserName);
prtu.SetPropertyValue("Name",model.Name);
prtu.SetPropertyValue("Address",model.Address);
prtu.SetPropertyValue("CityAndState",model.CityAndState);
prtu.SetPropertyValue("Mobile",model.Mobile);
prtu.SetPropertyValue("Phone",model.Phone);
prtu.SetPropertyValue("ZipCode",model.ZipCode);
prtu.SetPropertyValue ("Name", model.Name);
prtu.SetPropertyValue ("Address", model.Address);
prtu.SetPropertyValue ("CityAndState", model.CityAndState);
prtu.SetPropertyValue ("Mobile", model.Mobile);
prtu.SetPropertyValue ("Phone", model.Phone);
prtu.SetPropertyValue ("ZipCode", model.ZipCode);
break;
default:
break;
@ -88,15 +89,12 @@ namespace Yavsc.ApiControllers
return DefaultResponse ();
}
/// <summary>
/// Resets the password.
/// </summary>
/// <param name="model">Model.</param>
[ValidateAjax]
public void ResetPassword(LostPasswordModel model)
public void ResetPassword (LostPasswordModel model)
{
StringDictionary errors;
MembershipUser user;
@ -108,4 +106,3 @@ namespace Yavsc.ApiControllers
}
}
}

View File

@ -21,28 +21,38 @@ namespace Yavsc.ApiControllers
/// </summary>
public class BlogsController : YavscApiController
{
private const string adminRoleName = "Admin";
/// <summary>
/// Initialize the specified controllerContext.
/// Tag the specified model.
/// </summary>
/// <param name="controllerContext">Controller context.</param>
protected override void Initialize (System.Web.Http.Controllers.HttpControllerContext controllerContext)
{
base.Initialize (controllerContext);
if (!Roles.RoleExists (adminRoleName)) {
Roles.CreateRole (adminRoleName);
/// <param name="model">Model.</param>
[Authorize,
AcceptVerbs ("POST")]
public void Tag (PostTag model) {
if (ModelState.IsValid) {
BlogManager.GetForEditing (model.PostId);
BlogManager.Tag (model.PostId, model.Tag);
}
}
static string [] officalTags = new string[] { "Artistes", "Accueil", "Actualités", "Mentions légales", "Admin", "Web" } ;
/// <summary>
/// Tags the specified pattern.
/// </summary>
/// <param name="pattern">Pattern.</param>
[ValidateAjaxAttribute]
public IEnumerable<string> Tags(string pattern)
{
return officalTags;
}
/// <summary>
/// Tag the specified postid and tag.
/// Untag the specified postid and tag.
/// </summary>
/// <param name="postid">Postid.</param>
/// <param name="id">Postid.</param>
/// <param name="tag">Tag.</param>
public long Tag (long postid,string tag) {
BlogManager.GetForEditing (postid);
return BlogManager.Tag (postid, tag);
[Authorize, ValidateAjaxAttribute, HttpPost]
public void Untag (long id, [FromBody] string tag) {
BlogManager.GetForEditing (id);
BlogManager.Untag (id, tag);
}
/// <summary>
@ -50,21 +60,24 @@ namespace Yavsc.ApiControllers
/// </summary>
/// <param name="user">User.</param>
/// <param name="title">Title.</param>
[Authorize]
public void RemoveTitle(string user, string title) {
[Authorize, ValidateAjaxAttribute, HttpPost]
public void RemoveTitle(string user, string title) {
if (Membership.GetUser ().UserName != user)
if (!Roles.IsUserInRole("Admin"))
throw new AuthorizationDenied (user);
BlogManager.RemoveTitle (user, title);
}
/// <summary>
/// Removes the tag.
/// </summary>
/// <param name="tagid">Tagid.</param>
public void RemoveTag(long tagid) {
[Authorize, ValidateAjaxAttribute, HttpPost]
public void RemoveTag([FromBody] long tagid) {
throw new NotImplementedException ();
}
/// <summary>
/// The allowed media types.
/// </summary>
@ -84,7 +97,7 @@ namespace Yavsc.ApiControllers
/// Posts the file.
/// </summary>
/// <returns>The file.</returns>
[Authorize,HttpPost]
[Authorize, HttpPost]
public async Task<HttpResponseMessage> PostFile(long id) {
if (!(Request.Content.Headers.ContentType.MediaType=="multipart/form-data"))
throw new HttpRequestException ("not a multipart/form-data request");
@ -125,20 +138,40 @@ namespace Yavsc.ApiControllers
}
}
[Authorize,HttpGet]
public async Task<HttpResponseMessage> SearchFile(long postid, string terms) {
/// <summary>
/// Searchs the file.
/// </summary>
/// <returns>The file.</returns>
/// <param name="id">Postid.</param>
/// <param name="terms">Terms.</param>
[HttpGet]
public async Task<HttpResponseMessage> SearchFile(long id, string terms) {
throw new NotImplementedException ();
}
/// <summary>
/// Sets the photo.
/// </summary>
/// <param name="id">Identifier.</param>
/// <param name="photo">Photo.</param>
[Authorize, HttpPost, ValidateAjaxAttribute]
public void SetPhoto(long id, [FromBody] string photo)
{
BlogManager.Provider.UpdatePostPhoto (id, photo);
}
/// <summary>
/// Import the specified id.
/// </summary>
/// <param name="id">Identifier.</param>
[Authorize, HttpPost, ValidateAjaxAttribute]
public async Task<HttpResponseMessage> Import(long id) {
if (!(Request.Content.Headers.ContentType.MediaType=="multipart/form-data"))
throw new HttpRequestException ("not a multipart/form-data request");
BlogEntry be = BlogManager.GetPost (id);
if (be.Author != Membership.GetUser ().UserName)
throw new AuthorizationDenied ("b"+id);
throw new AuthorizationDenied ("post: "+id);
string root = HttpContext.Current.Server.MapPath("~/bfiles/"+id);
DirectoryInfo di = new DirectoryInfo (root);
if (!di.Exists) di.Create ();
@ -146,26 +179,13 @@ namespace Yavsc.ApiControllers
try
{
// Read the form data.
IEnumerable<HttpContent> data = await Request.Content.ReadAsMultipartAsync(provider) ;
//IEnumerable<HttpContent> data =
await Request.Content.ReadAsMultipartAsync(provider) ;
var invalidChars = Path.GetInvalidFileNameChars();
List<string> parts = new List<string>();
List<string> text = new List<string>();
// filter files on their mime type
foreach ( var httpAudioContent in data
) {
string [] mimetype = httpAudioContent.Headers.ContentType.MediaType.Split('/');
switch (mimetype[0]) {
case "application": break;
case "text": break;
case "image": break;
case "audio": break;
case "video": break;
}
}
foreach (string fkey in text)
List<string> bodies = new List<string>();
foreach (string fkey in provider.BodyPartFileNames.Keys)
{
string filename = provider.BodyPartFileNames[fkey];
@ -177,10 +197,7 @@ namespace Yavsc.ApiControllers
FileInfo fp = new FileInfo (Path.Combine(root,filename));
if (fi.Exists) fi.Delete();
fp.MoveTo(fi.FullName);
// Get the mime type
// TODO Get the mime type
using (Process p = new Process ()) {
p.StartInfo.WorkingDirectory = root;
p.StartInfo = new ProcessStartInfo ();
@ -203,14 +220,14 @@ namespace Yavsc.ApiControllers
);
}
}
parts.Add(fo.OpenText().ReadToEnd());
bodies.Add(fo.OpenText().ReadToEnd());
fi.Delete();
fo.Delete();
}
return Request.CreateResponse(HttpStatusCode.OK,string.Join("---\n",parts),new SimpleFormatter("text/plain"));
return Request.CreateResponse(HttpStatusCode.OK,string.Join("---\n",bodies),new SimpleFormatter("text/plain"));
}
catch (System.Exception e)

View File

@ -97,31 +97,31 @@ WITH (
CREATE TABLE profiledata
(
uniqueid integer,
"address.zipcode" character varying(10),
"address.cityandstate" character varying(255),
uniqueid integer,
zipcode character varying(10),
cityandstate character varying(255),
blogtitle character varying(255), -- Blog Title
"address.address" character varying(2048), -- Postal address
"address.country" character varying(100),
address character varying(2048), -- Postal address
country character varying(100),
website character varying(256),
blogvisible boolean,
name character varying(1024),
phone character varying(15),
mobile character varying(15),
"bank.accountnumber" character varying(15), -- Numero de compte
"bank.key" integer, -- clé RIB
"bank.code" character varying(5), -- Code banque
"bank.wicketcode" character varying(5),
"bank.iban" character varying(33),
"bank.bic" character varying(15),
"google.token" character varying(512), -- Google authentification token
"google.refreshtoken" character varying(512), -- Google refresh token
"google.tokentype" character varying(256), -- Google access token type
"google.calid" character varying(255), -- Google calendar identifier
"google.tokenexpir" timestamp with time zone, -- Google access token expiration date
accountnumber character varying(15), -- Numero de compte
bankedkey integer, -- clé RIB
bankcode character varying(5), -- Code banque
wicketcode character varying(5),
iban character varying(33),
bic character varying(15),
gtoken character varying(512), -- Google authentification token
grefreshtoken character varying(512), -- Google refresh token
gtokentype character varying(256), -- Google access token type
gcalid character varying(255), -- Google calendar identifier
gtokenexpir timestamp with time zone, -- Google access token expiration date
avatar character varying(512), -- url for an avatar
"google.calapi" boolean NOT NULL DEFAULT false,
"google.regid" character varying(1024), -- Google Cloud Message registration identifier
gcalapi boolean NOT NULL DEFAULT false,
gregid character varying(1024), -- Google Cloud Message registration identifier
CONSTRAINT fkprofiles2 FOREIGN KEY (uniqueid)
REFERENCES profiles (uniqueid) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
@ -129,12 +129,9 @@ CREATE TABLE profiledata
WITH (
OIDS=FALSE
);
ALTER TABLE profiledata
OWNER TO yavscdev;
COMMENT ON COLUMN profiledata."address.address" IS 'Postal address';
COMMENT ON COLUMN profiledata.blogtitle IS 'Blog Title';
COMMENT ON COLUMN profiledata.avatar IS 'url for an avatar';
COMMENT ON COLUMN profiledata.hasavatar IS 'True when user has specified an image for avatar';
COMMENT ON COLUMN profiledata."bank.accountnumber" IS 'Numero de compte';
COMMENT ON COLUMN profiledata."bank.key" IS 'clé RIB';
COMMENT ON COLUMN profiledata."bank.code" IS 'Code banque';
@ -174,6 +171,7 @@ CREATE TABLE blog
bcontent text NOT NULL,
visible boolean NOT NULL,
_id bigserial NOT NULL,
photo character varying(512),
CONSTRAINT blog_pkey PRIMARY KEY (_id),
CONSTRAINT bloguser FOREIGN KEY (applicationname, username)
REFERENCES users (applicationname, username) MATCH SIMPLE
@ -183,23 +181,22 @@ WITH (
OIDS=FALSE
);
-- Table: blfiles
COMMENT ON COLUMN blog.photo IS 'a photo url, supposed to be the main photo
related to this post';
CREATE TABLE blfiles
(
_id bigserial NOT NULL, -- Identifier
name character varying(2048), -- File Name, relative to the user home directory, must not begin with a slash.
blid bigint, -- Blog entry identifier (foreign key)
CONSTRAINT blfiles_pkey PRIMARY KEY (_id),
CONSTRAINT blfiles_blid_fkey FOREIGN KEY (blid)
REFERENCES blog (_id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
alt_text character varying(512),
CONSTRAINT bltags_pkey PRIMARY KEY (_id)
)
WITH (
OIDS=FALSE
);
COMMENT ON COLUMN blfiles._id IS 'Identifier';
COMMENT ON COLUMN blfiles.name IS 'File Name, relative to the user home directory, must not begin with a slash.';
COMMENT ON COLUMN blfiles.blid IS 'Blog entry identifier (foreign key)';
-- Table: commandes
@ -259,7 +256,7 @@ CREATE TABLE comment
CONSTRAINT comment_pkey PRIMARY KEY (_id),
CONSTRAINT fkey_blog FOREIGN KEY (postid)
REFERENCES blog (_id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE ,
ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT fkey_users FOREIGN KEY (username, applicationname)
REFERENCES users (username, applicationname) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
@ -670,8 +667,7 @@ CREATE TABLE circle
WITH (
OIDS=FALSE
);
ALTER TABLE circle
OWNER TO yavscdev;
COMMENT ON COLUMN circle._id IS 'Circle identifier';
COMMENT ON COLUMN circle.owner IS 'creator of this circle';
COMMENT ON COLUMN circle.applicationname IS 'Application name';
@ -735,3 +731,23 @@ WITH (
OIDS=FALSE
);
-- Table: postheader
-- DROP TABLE postheader;
CREATE TABLE postheader
(
postid bigserial NOT NULL, -- Blog post identifier, to which will be associated this head image
url character varying(512), -- Url for this header image,...
CONSTRAINT postheader_pkey PRIMARY KEY (postid),
CONSTRAINT postheader_postid_fkey FOREIGN KEY (postid)
REFERENCES blog (_id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE
)
WITH (
OIDS=FALSE
);
COMMENT ON COLUMN postheader.postid IS 'Blog post identifier, to which will be associated this head image';
COMMENT ON COLUMN postheader.url IS 'Url for this header image, if relative, it will be on the path "~/bfiles/<postid>"';

34
web/App_Themes/desert.css Normal file
View File

@ -0,0 +1,34 @@
/* desert scheme ported from vim to google prettify */
pre.prettyprint { display: block; background-color: #333 }
pre .nocode { background-color: none; color: #000 }
pre .str { color: #ffa0a0 } /* string - pink */
pre .kwd { color: #f0e68c; font-weight: bold }
pre .com { color: #87ceeb } /* comment - skyblue */
pre .typ { color: #98fb98 } /* type - lightgreen */
pre .lit { color: #cd5c5c } /* literal - darkred */
pre .pun { color: #fff } /* punctuation */
pre .pln { color: #fff } /* plaintext */
pre .tag { color: #f0e68c; font-weight: bold } /* html/xml tag - lightyellow */
pre .atn { color: #bdb76b; font-weight: bold } /* attribute name - khaki */
pre .atv { color: #ffa0a0 } /* attribute value - pink */
pre .dec { color: #98fb98 } /* decimal - lightgreen */
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE } /* IE indents via margin-left */
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,li.L3,li.L5,li.L7,li.L9 { }
@media print {
pre.prettyprint { background-color: none }
pre .str, code .str { color: #060 }
pre .kwd, code .kwd { color: #006; font-weight: bold }
pre .com, code .com { color: #600; font-style: italic }
pre .typ, code .typ { color: #404; font-weight: bold }
pre .lit, code .lit { color: #044 }
pre .pun, code .pun { color: #440 }
pre .pln, code .pln { color: #000 }
pre .tag, code .tag { color: #006; font-weight: bold }
pre .atn, code .atn { color: #404 }
pre .atv, code .atv { color: #060 }
}

64
web/App_Themes/doxy.css Normal file
View File

@ -0,0 +1,64 @@
/* Doxy pretty-printing styles. Used with prettify.js. */
pre .str, code .str { color: #fec243; } /* string - eggyolk gold */
pre .kwd, code .kwd { color: #8470FF; } /* keyword - light slate blue */
pre .com, code .com { color: #32cd32; font-style: italic; } /* comment - green */
pre .typ, code .typ { color: #6ecbcc; } /* type - turq green */
pre .lit, code .lit { color: #d06; } /* literal - cherry red */
pre .pun, code .pun { color: #8B8970; } /* punctuation - lemon chiffon4 */
pre .pln, code .pln { color: #f0f0f0; } /* plaintext - white */
pre .tag, code .tag { color: #9c9cff; } /* html/xml tag (bluey) */
pre .htm, code .htm { color: #dda0dd; } /* html tag light purply*/
pre .xsl, code .xsl { color: #d0a0d0; } /* xslt tag light purply*/
pre .atn, code .atn { color: #46eeee; font-weight: normal;} /* html/xml attribute name - lt turquoise */
pre .atv, code .atv { color: #EEB4B4; } /* html/xml attribute value - rosy brown2 */
pre .dec, code .dec { color: #3387CC; } /* decimal - blue */
a {
text-decoration: none;
}
pre.prettyprint, code.prettyprint {
font-family:'Droid Sans Mono','CPMono_v07 Bold','Droid Sans';
font-weight: bold;
font-size: 9pt;
background-color: #0f0f0f;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
-o-border-radius: 8px;
-ms-border-radius: 8px;
-khtml-border-radius: 8px;
border-radius: 8px;
} /* background is black (well, just a tad less dark ) */
pre.prettyprint {
width: 95%;
margin: 1em auto;
padding: 1em;
white-space: pre-wrap;
}
pre.prettyprint a, code.prettyprint a {
text-decoration:none;
}
/* Specify class=linenums on a pre to get line numbering; line numbers themselves are the same color as punctuation */
ol.linenums { margin-top: 0; margin-bottom: 0; color: #8B8970; } /* IE indents via margin-left */
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,li.L3,li.L5,li.L7,li.L9 { }
/* print is mostly unchanged from default at present */
@media print {
pre.prettyprint, code.prettyprint { background-color: #fff; }
pre .str, code .str { color: #088; }
pre .kwd, code .kwd { color: #006; font-weight: bold; }
pre .com, code .com { color: #oc3; font-style: italic; }
pre .typ, code .typ { color: #404; font-weight: bold; }
pre .lit, code .lit { color: #044; }
pre .pun, code .pun { color: #440; }
pre .pln, code .pln { color: #000; }
pre .tag, code .tag { color: #b66ff7; font-weight: bold; }
pre .htm, code .htm { color: #606; font-weight: bold; }
pre .xsl, code .xsl { color: #606; font-weight: bold; }
pre .atn, code .atn { color: #c71585; font-weight: normal; }
pre .atv, code .atv { color: #088; font-weight: normal; }
}

View File

@ -0,0 +1 @@
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}

View File

@ -0,0 +1,118 @@
/*
* Derived from einaros's Sons of Obsidian theme at
* http://studiostyl.es/schemes/son-of-obsidian by
* Alex Ford of CodeTunnel:
* http://CodeTunnel.com/blog/post/71/google-code-prettify-obsidian-theme
*/
.str
{
color: #EC7600;
}
.kwd
{
color: #93C763;
}
.com
{
color: #66747B;
}
.typ
{
color: #678CB1;
}
.lit
{
color: #FACD22;
}
.pun
{
color: #F1F2F3;
}
.pln
{
color: #F1F2F3;
}
.tag
{
color: #8AC763;
}
.atn
{
color: #E0E2E4;
}
.atv
{
color: #EC7600;
}
.dec
{
color: purple;
}
pre.prettyprint
{
border: 0px solid #888;
}
ol.linenums
{
margin-top: 0;
margin-bottom: 0;
}
.prettyprint {
background: #000;
}
li.L0, li.L1, li.L2, li.L3, li.L4, li.L5, li.L6, li.L7, li.L8, li.L9
{
color: #555;
list-style-type: decimal;
}
li.L1, li.L3, li.L5, li.L7, li.L9 {
background: #111;
}
@media print
{
.str
{
color: #060;
}
.kwd
{
color: #006;
font-weight: bold;
}
.com
{
color: #600;
font-style: italic;
}
.typ
{
color: #404;
font-weight: bold;
}
.lit
{
color: #044;
}
.pun
{
color: #440;
}
.pln
{
color: #000;
}
.tag
{
color: #006;
font-weight: bold;
}
.atn
{
color: #404;
}
.atv
{
color: #060;
}
}

View File

@ -4,78 +4,112 @@ body {
background-color: black;
color: #D0FFD0;
font-family: 'Arial', cursive;
padding:2em;
margin:2em;
padding: 0;
margin: 0;
}
/* 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('http://i.stack.imgur.com/FhHRx.gif')
50% 50%
no-repeat;
}
/* When the body has the loading class, we turn
the scrollbar off with overflow:hidden */
body.loading {
overflow: hidden;
}
/* Anytime the body has the loading class, our
modal element will be visible */
body.loading .modal {
display: block;
}
.iconsmall { max-height: 1.3em; max-width: 1.3em; }
input, textarea, checkbox {
color: #FFFFA0;
background: black;
}
.photo { width: 100%; }
.blogbanner { float: left; top:0; }
.subtitle { font-size:small; font-style: italic; }
header {
padding: 0;
margin: 0;
padding-top: 201px;
padding-bottom:2em;
display: block;
border-radius:1em;
margin: 1em;
padding: 3em;
min-height: 8em;
background: url("/images/star-939235_1280.jpg") 0 0 no-repeat fixed;
background: url("/images/totem-banner.xs.jpg") 0 0 no-repeat fixed;
}
header h1, header a {
background-color: rgba(0,0,0,.5);
margin:0; padding:1em;
}
nav {
border-radius:1em;
margin: 1em;
padding: 1em;
margin: 2em;
padding: 2em;
display: block;
background: url("/images/helix-nebula-1400x1400.s.jpg") 50% 10% repeat fixed ;
min-height: 10em;
border-radius:1em;
background: url("/images/live-concert-388160_1280.jpg") 50% 10em repeat fixed ;
justify-content: space-around;
}
main {
border-radius:1em;
margin: 1em;
padding: 1em;
margin: 2em;
padding: 2em;
display: block;
background: url("/images/p8-av4.png") 50% 20em no-repeat fixed ;
min-height: 10em;
border-radius:1em;
background: url("/images/musician-923526_1.nbb.jpg") 50% 20em repeat fixed ;
}
footer {
border-radius:1em;
margin: 1em;
padding: 1em;
background: url("/images/drummer-652345_1280.s.jpg") 50% 30em repeat fixed ;
margin: 0;
margin-top: 2em;
padding: 2em;
display: block;
background: url("/images/helix-nebula-1400x1400.s.jpg") 50% 90% repeat fixed ;
min-height: 10em;
clear: both;
font-size: smaller;
justify-content: center;
justify-content: space-around;
}
footer a {
background-color: rgba(0,0,40,.8);
border-radius:5px;
margin:.5em;
border-radius:1em;
padding:1em;
}
legend {
border-radius:5px;
padding:.5em;
background-color: rgba(0,0,32,.5);
}
#copyr { text-align: center; display: block; background-color: rgba(20,20,20,.8); }
footer p { display:inline-block; }
footer img { max-height: 2em; vertical-align: middle; }
a.actionlink img, h1 img, .menuitem img { vertical-align: middle; }
footer img { max-height: 3em; vertical-align: middle; }
a img, h1 img, .menuitem img { vertical-align: middle; }
#gspacer {
background-color: rgba(0,0,40,.8);
border-radius:5px;
margin:.5em; padding:1em; display: inline-block }
background-color: rgba(20,20,20,.8);
border-radius:1em;
margin:1em; padding:1em; display: inline-block }
fieldset {
background-color: rgba(32,16,16,0.8);
background-color: rgba(16,16,64,0.8);
border-radius:5px; border: solid 1px #000060;
}
video, img {
main video, main img {
max-width:100%;
max-height:75%;
padding: .5em;
padding: 1em;
}
aside {
@ -87,10 +121,9 @@ aside {
.postpreview {
display: inline-block;
max-width: 40em;
padding: .5em;
margin: .5em;
background-color: rgba(32,32,32,0.8);
border-radius:10px;
padding: 1em;
background-color: rgba(0,0,32,0.8);
border-radius:1em;
}
.postpreview video, .postpreview img {
max-width:100%;
@ -98,11 +131,10 @@ aside {
}
.post {
display:block;
margin:1em;
padding:1em;
background-color: rgba(32,32,32,0.8);
color: #aaa;
border-radius:10px;
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%; }
@ -118,12 +150,25 @@ textarea.fullwidth { min-height:10em; }
}
.panel,.bshpanel, aside {
background-color: rgba(32,32,16,0.8);
border-radius:5px;
margin:.5em;
padding: .5em;
background-color: rgba(20,20,20,.8);
border-radius: 1em;
padding: 1em;
}
.spanel {
max-width: 24em;
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;
@ -137,32 +182,32 @@ content: ")";
}
a {
text-decoration: none;
color: #B0B080;
background-color:rgba(20,20,20,0.5);
text-decoration: none;
}
.usertitleref {
color: #B0B080;
border-radius: 5px;
border-radius: 1em;
background-color:rgba(0,0,32,0.6);
font-family: 'Arial', cursive;
padding: 1em;
}
a:hover {
text-decoration: underline;
}
a:visited {
color: #90B090;
color: #E0E0E0;
}
label {
font-size: medium;
}
.editable {
margin 1em;
min-height:1em;
border-radius: 1em;
border: dashed rgb(020,20,256) 2px;
}
#notifications {
padding: 1em;
}
.message, #message {
.notification {
font-size: large;
background-color: rgba(64,64,0,0.5);
border: solid green 1px;
}
.dirty {
background-color: rgba(128,128,0,0.5);
@ -177,7 +222,6 @@ label {
background-color: rgba(256,0,0,0.5);
}
.hidden { display:none; }
ul.preview li:nth-child(-n+10) {
@ -193,54 +237,53 @@ ul.preview li:nth-child(n) {
color: #f88;
}
.actionlink {
color: #B0B080;
border-radius: 5px;
background-color:rgba(0,0,32,0.5);
a {
text-decoration: none;
}
.actionlink, .menuitem, a {
display:inline-block;
color: white;
border-radius:1em;
border: solid black 1px;
background-color: rgba(20,20,20,.8);
cursor: pointer;
font-family: 'Arial', cursive;
padding: .2em;
padding: 1em;
}
input, select {
color: #B0B080;
input, select, textarea {
color: white;
background-color:rgba(0,0,64,0.8);
border: solid 1px rgb(128,128,128);
border-radius:5px;
background-color:rgba(0,0,32,0.8);
font-family: 'Arial', cursive;
border-radius:1em;
font-family: 'Arial', cursive;
}
.actionlink:hover {
.actionlink:hover, fa:hover, .menuitem:hover, a:hover {
background-color:rgba(30,0,124,0.9);
text-decoration: underline;
border: solid green 1px;
}
input:hover, textarea:hover {
color: white;
background-color:rgba(64,64,64,0.8);
}
.code {
font-family: "monospace";
background-color: rgba(0,0,256,0.1);
border-radius:25px;
white-space: pre-wrap;
}
.avatar {
max-width: 64px;
max-height: 64px;
}
#avatar {
float: left;
margin:1em;
}
.comment {
border-radius:25px;
font-size: smaller;
}
.menuitem {
border-radius:5px;
margin:.5em;
padding:.5em;
display: inline-block;
}
.onhover {
display:none;
position: absolute;
@ -258,11 +301,9 @@ input, select {
.c2 { font-size: small; font-style: italic; }
.c3 { font-size: x-small; font-style: italic; }
@media print {
body {background-color:white;color:black;}
header,footer,.postcomment,.actionlink,nav
{ display:none;}
.control, .actionlink, .menuitem, nav { display:none;}
}
.bshpanel { display:block; }
@ -271,36 +312,37 @@ input, select {
.c3-alt { display:none; }
@media all and (max-width: 640px) {
body { padding: 1em; margin: 1em;}
header {min-height: 5em;}
}
header {
padding-bottom:1em;
}
#avatar {
margin:.5em;
}
header h1, header a , .actionlink, .menuitem, a { padding:.5em;}
@media all and (max-width: 460px) {
body { padding: .5em; margin:.5;}
header {
margin: .5em;
padding: .5em;
min-height: 3em;
background: url("/images/star-939235_1280.xxs.jpg") 0 0 no-repeat fixed;
}
nav {
margin: .5em;
padding: .5em;
min-height: 3em;
background: url("/images/helix-nebula-1400x1400.xxs.jpg") 50% 10% repeat fixed ;
margin: 1em;
padding: 1em;
background: url("/images/live-concert-388160_1280.s.jpg") 50% 10% repeat fixed ;
}
main {
margin: .5em;
padding: .5em;
min-height: 7em;
background: url("/images/p8-av4.xxs.jpg") 50% 20em no-repeat fixed ;
margin: 1em;
padding: 1em;
background: url("/images/musician-923526_1.nbb.xs.jpg") 50% 20em repeat fixed ;
}
footer {
margin: .5em;
padding: .5em;
min-height: 3em;
background: url("/images/helix-nebula-1400x1400.xxs.jpg") 50% 90% repeat fixed ;
background: url("/images/drummer-652345_1280.s.jpg") 50% 90% repeat fixed ;
}
footer a {
border-radius:.5em;
margin:.5em;
padding:.5em;
}
#notifications {
padding: .5em;
}
.menuitem {
display: block;
}
@ -312,7 +354,6 @@ body { padding: .5em; margin:.5;}
padding:.3em;
}
.bshpanel { cursor:zoom-in; }
footer { clear:both; }
.c2 { display:initial; }
.c2-alt { display:none; }
@ -321,7 +362,31 @@ body { padding: .5em; margin:.5;}
}
@media all and (max-width: 350px) {
body { padding: 0em; margin:0; }
header {
padding-top: 101px;
padding-bottom:1em;
background: url("/images/totem-banner.xxs.jpg") 0 0 no-repeat fixed;
}
header h1, header a { padding:.2em;}
nav {
margin: .5em;
padding: .5em;
background: url("/images/live-concert-388160_1280.xxs.jpg") 50% 10% repeat fixed ;
}
main {
margin: .5em;
padding: .5em;
background: url("/images/musician-923526_1.nbb.xxs.jpg") 50% 20em repeat fixed ;
}
footer {
background: url("/images/drummer-652345_1280.xxs.jpg") 50% 90% repeat fixed ;
}
footer a {
border-radius:.2em;
margin:.2em;
padding:.2em;
}
.c2 { display:none; }
.c2-alt { display:initial; }
}

View File

@ -0,0 +1,51 @@
/* Pretty printing styles. Used with prettify.js. */
/* Vim sunburst theme by David Leibovic */
pre .str, code .str { color: #65B042; } /* string - green */
pre .kwd, code .kwd { color: #E28964; } /* keyword - dark pink */
pre .com, code .com { color: #AEAEAE; font-style: italic; } /* comment - gray */
pre .typ, code .typ { color: #89bdff; } /* type - light blue */
pre .lit, code .lit { color: #3387CC; } /* literal - blue */
pre .pun, code .pun { color: #fff; } /* punctuation - white */
pre .pln, code .pln { color: #fff; } /* plaintext - white */
pre .tag, code .tag { color: #89bdff; } /* html/xml tag - light blue */
pre .atn, code .atn { color: #bdb76b; } /* html/xml attribute name - khaki */
pre .atv, code .atv { color: #65B042; } /* html/xml attribute value - green */
pre .dec, code .dec { color: #3387CC; } /* decimal - blue */
pre.prettyprint, code.prettyprint {
background-color: #000;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
-o-border-radius: 8px;
-ms-border-radius: 8px;
-khtml-border-radius: 8px;
border-radius: 8px;
}
pre.prettyprint {
width: 95%;
margin: 1em auto;
padding: 1em;
white-space: pre-wrap;
}
/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE; } /* IE indents via margin-left */
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,li.L3,li.L5,li.L7,li.L9 { }
@media print {
pre .str, code .str { color: #060; }
pre .kwd, code .kwd { color: #006; font-weight: bold; }
pre .com, code .com { color: #600; font-style: italic; }
pre .typ, code .typ { color: #404; font-weight: bold; }
pre .lit, code .lit { color: #044; }
pre .pun, code .pun { color: #440; }
pre .pln, code .pln { color: #000; }
pre .tag, code .tag { color: #006; font-weight: bold; }
pre .atn, code .atn { color: #404; }
pre .atv, code .atv { color: #060; }
}

File diff suppressed because it is too large Load Diff

View File

@ -24,12 +24,6 @@ namespace Yavsc.Controllers
/// </summary>
public class AccountController : Controller
{
string avatarDir = "~/avatars";
string defaultAvatar;
string defaultAvatarMimetype;
/// <summary>
/// Avatar the specified user.
/// </summary>
@ -50,17 +44,7 @@ namespace Yavsc.Controllers
}
}
}
/// <summary>
/// Gets or sets the avatar dir.
/// This value is past to <c>Server.MapPath</c>,
/// it should start with <c>~/</c>, and we assume it
/// to be relative to the application path.
/// </summary>
/// <value>The avatar dir.</value>
public string AvatarDir {
get { return avatarDir; }
set { avatarDir = value; }
}
/// <summary>
/// Index this instance.
@ -94,17 +78,7 @@ namespace Yavsc.Controllers
ViewData ["returnUrl"] = returnUrl;
return View (model);
}
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Controllers.BlogsController"/> class.
/// </summary>
private void GetAvatarConfig ()
{
string[] defaultAvatarSpec = ConfigurationManager.AppSettings.Get ("DefaultAvatar").Split (';');
if (defaultAvatarSpec.Length != 2)
throw new ConfigurationErrorsException ("the DefaultAvatar spec should be found as <fileName>;<mime-type> ");
defaultAvatar = defaultAvatarSpec [0];
defaultAvatarMimetype = defaultAvatarSpec [1];
}
/// <summary>
/// Login the specified returnUrl.
@ -117,9 +91,16 @@ namespace Yavsc.Controllers
return View ();
}
public ActionResult RegisterForm()
/// <summary>
/// Gets the registration form.
/// </summary>
/// <returns>The register.</returns>
/// <param name="model">Model.</param>
/// <param name="returnUrl">Return URL.</param>
public ActionResult GetRegister(RegisterViewModel model, string returnUrl)
{
return View ("Register");
ViewData ["returnUrl"] = returnUrl;
return View ("Register",model);
}
/// <summary>
@ -131,11 +112,6 @@ namespace Yavsc.Controllers
public ActionResult Register (RegisterViewModel model, string returnUrl)
{
ViewData ["returnUrl"] = returnUrl;
if (Request.RequestType == "GET") {
foreach (string k in ModelState.Keys)
ModelState [k].Errors.Clear ();
return View (model);
}
if (ModelState.IsValid) {
if (model.ConfirmPassword != model.Password) {
@ -307,13 +283,13 @@ namespace Yavsc.Controllers
// if said valid, move as avatar file
// else invalidate the model
if (AvatarFile.ContentType == "image/png") {
string avdir = Server.MapPath (AvatarDir);
string avdir = Server.MapPath (YavscHelpers.AvatarDir);
var di = new DirectoryInfo (avdir);
if (!di.Exists)
di.Create ();
string avpath = Path.Combine (avdir, id + ".png");
AvatarFile.SaveAs (avpath);
model.avatar = Url.Content( AvatarDir + "/" + id + ".png");
model.avatar = Url.Content( YavscHelpers.AvatarDir + "/" + id + ".png");
} else
ModelState.AddModelError ("Avatar",
string.Format ("Image type {0} is not supported (suported formats : {1})",
@ -356,7 +332,7 @@ namespace Yavsc.Controllers
UserManager.ChangeName (id, model.Name);
FormsAuthentication.SetAuthCookie (model.Name, model.RememberMe);
}
ViewData ["Message"] = "Profile enregistré"+((editsMyName)?", nom public inclu.":"");
YavscHelpers.Notify(ViewData, "Profile enregistré"+((editsMyName)?", nom public inclu.":""));
}
return View (model);
}
@ -412,20 +388,20 @@ namespace Yavsc.Controllers
{
MembershipUser u = Membership.GetUser (id, false);
if (u == null) {
ViewData ["Error"] =
string.Format ("Cet utilisateur n'existe pas ({0})", id);
YavscHelpers.Notify( ViewData,
string.Format ("Cet utilisateur n'existe pas ({0})", id));
} else if (u.ProviderUserKey.ToString () == key) {
if (u.IsApproved) {
ViewData ["Message"] =
string.Format ("Votre compte ({0}) est déjà validé.", id);
YavscHelpers.Notify( ViewData,
string.Format ("Votre compte ({0}) est déjà validé.", id));
} else {
u.IsApproved = true;
Membership.UpdateUser (u);
ViewData ["Message"] =
string.Format ("La création de votre compte ({0}) est validée.", id);
YavscHelpers.Notify( ViewData,
string.Format ("La création de votre compte ({0}) est validée.", id));
}
} else
ViewData ["Error"] = "La clé utilisée pour valider ce compte est incorrecte";
YavscHelpers.Notify( ViewData, "La clé utilisée pour valider ce compte est incorrecte" );
return View ();
}

View File

@ -10,6 +10,7 @@ using Yavsc.Model.Admin;
using Yavsc.Admin;
using System.IO;
using Yavsc.Model;
using Yavsc.Helpers;
namespace Yavsc.Controllers
{
@ -164,8 +165,7 @@ namespace Yavsc.Controllers
ViewData ["usertoremove"] = username;
if (submitbutton == "Supprimer") {
Membership.DeleteUser (username);
ViewData["Message"]=
string.Format("utilisateur \"{0}\" supprimé",username);
YavscHelpers.Notify(ViewData, string.Format("utilisateur \"{0}\" supprimé",username));
ViewData ["usertoremove"] = null;
}
return View ();
@ -240,7 +240,7 @@ namespace Yavsc.Controllers
public ActionResult DoAddRole (string rolename)
{
Roles.CreateRole(rolename);
ViewData["Message"] = LocalizedText.role_created+ " : "+rolename;
YavscHelpers.Notify(ViewData, LocalizedText.role_created+ " : "+rolename);
return View ();
}
@ -278,7 +278,7 @@ namespace Yavsc.Controllers
ViewData ["useritems"] = users;
if (ModelState.IsValid) {
Roles.AddUserToRole (model.UserName, adminRoleName);
ViewData ["Message"] = model.UserName + " "+LocalizedText.was_added_to_the_role+" '" + adminRoleName + "'";
YavscHelpers.Notify(ViewData, model.UserName + " "+LocalizedText.was_added_to_the_role+" '" + adminRoleName + "'");
} else {
if (admins.Length > 0) {
if (! admins.Contains (Membership.GetUser ().UserName)) {
@ -290,9 +290,9 @@ namespace Yavsc.Controllers
// No admin, gives the Admin Role to the current user
Roles.AddUserToRole (currentUser, adminRoleName);
admins = new string[] { currentUser };
ViewData ["Message"] += string.Format (
YavscHelpers.Notify(ViewData, string.Format (
LocalizedText.was_added_to_the_empty_role,
currentUser, adminRoleName);
currentUser, adminRoleName));
}
}
return View (model);

View File

@ -29,47 +29,26 @@ namespace Yavsc.Controllers
{
private string sitename =
WebConfigurationManager.AppSettings ["Name"];
string avatarDir = "~/avatars";
/// <summary>
/// Gets or sets the avatar dir.
/// Index the specified title, pageIndex and pageSize.
/// </summary>
/// <value>The avatar dir.</value>
public string AvatarDir {
get { return avatarDir; }
set { avatarDir = value; }
}
/// <summary>
/// Index the specified user, title, pageIndex and pageSize.
/// </summary>
/// <param name="user">User.</param>
/// <param name="title">Title.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
public ActionResult Index (string user = null, string title = null, int pageIndex = 0, int pageSize = 10)
public ActionResult Index (string title, int pageIndex = 0, int pageSize = 10)
{
if (string.IsNullOrEmpty (user)) {
return BlogList (pageIndex, pageSize);
} else {
MembershipUser u = null;
if (Membership.FindUsersByName (user) != null)
u = Membership.GetUser (user, false);
if (u == null) {
ModelState.AddModelError ("Author",
string.Format ("Utilisateur inconu : {0}", user));
return BlogList ();
} else {
if (string.IsNullOrEmpty (title))
return UserPosts (user, pageIndex, pageSize);
return UserPost (user, title, pageIndex, pageSize);
}
}
if (title != null)
return Title (title, pageIndex, pageSize);
return BlogList (pageIndex, pageSize);
}
public ActionResult ChooseMedia(long id)
/// <summary>
/// Chooses the media.
/// </summary>
/// <returns>The media.</returns>
/// <param name="id">Identifier.</param>
public ActionResult ChooseMedia(long postid)
{
return View ();
}
@ -87,7 +66,33 @@ namespace Yavsc.Controllers
ViewData ["ResultCount"] = totalRecords;
ViewData ["PageSize"] = pageSize;
ViewData ["PageIndex"] = pageIndex;
return View ("Index", new BlogEntryCollection(bs) );
var bec = new BlogEntryCollection (bs);
return View ("Index", bec );
}
/// <summary>
/// Title the specified title, pageIndex and pageSize.
/// </summary>
/// <param name="id">Title.</param>
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
///
[HttpGet]
public ActionResult Title (string title, int pageIndex = 0, int pageSize = 10)
{
int recordCount;
MembershipUser u = Membership.GetUser ();
string username = u == null ? null : u.UserName;
FindBlogEntryFlags sf = FindBlogEntryFlags.MatchTitle;
BlogEntryCollection c =
BlogManager.FindPost (username, title, sf, pageIndex, pageSize, out recordCount);
var utc = new UTBlogEntryCollection (title);
utc.AddRange (c);
ViewData ["RecordCount"] = recordCount;
ViewData ["PageIndex"] = pageIndex;
ViewData ["PageSize"] = pageSize;
return View ("Title", utc);
}
/// <summary>
@ -98,9 +103,10 @@ namespace Yavsc.Controllers
/// <param name="pageIndex">Page index.</param>
/// <param name="pageSize">Page size.</param>
[HttpGet]
public ActionResult UserPosts (string user, int pageIndex = 0, int pageSize = 10)
public ActionResult UserPosts (string user, string title=null, int pageIndex = 0, int pageSize = 10)
{
int tr;
if (title != null) return UserPost (user, title, pageIndex, pageSize);
int recordcount=0;
MembershipUser u = Membership.GetUser ();
FindBlogEntryFlags sf = FindBlogEntryFlags.MatchUserName;
ViewData ["SiteName"] = sitename;
@ -113,17 +119,23 @@ namespace Yavsc.Controllers
if (u.UserName == user || Roles.IsUserInRole ("Admin"))
sf |= FindBlogEntryFlags.MatchInvisible;
readersName = u.UserName;
if (user == null)
user = u.UserName;
}
// find entries
BlogEntryCollection c =
BlogManager.FindPost (readersName, user, sf, pageIndex, pageSize, out tr);
BlogManager.FindPost (readersName, user, sf, pageIndex, pageSize, out recordcount);
// Get author's meta data
Profile bupr = new Profile (ProfileBase.Create (user));
ViewData ["BlogUserProfile"] = bupr;
var pr = ProfileBase.Create (user);
if (pr != null) {
Profile bupr = new Profile (pr);
ViewData ["BlogUserProfile"] = bupr;
// Inform of listing meta data
ViewData ["BlogTitle"] = bupr.BlogTitle;
ViewData ["Avatar"] = bupr.avatar;
ViewData ["RecordCount"] = tr;
}
ViewData ["RecordCount"] = recordcount;
UUBlogEntryCollection uuc = new UUBlogEntryCollection (user, c);
return View ("UserPosts", uuc);
}
@ -141,14 +153,14 @@ namespace Yavsc.Controllers
}
/// <summary>
/// Returns the post.
/// Gets the post.
/// </summary>
/// <returns>The post.</returns>
/// <param name="id">Identifier.</param>
public ActionResult GetPost (long id)
/// <param name="postid">Postid.</param>
public ActionResult GetPost (long postid)
{
ViewData ["id"] = id;
BlogEntry e = BlogManager.GetForReading (id);
ViewData ["id"] = postid;
BlogEntry e = BlogManager.GetForReading (postid);
UUTBlogEntryCollection c = new UUTBlogEntryCollection (e.Author,e.Title);
c.Add (e);
ViewData ["user"] = c.Author;
@ -180,7 +192,12 @@ namespace Yavsc.Controllers
if (pr == null)
// the owner's profile must exist
// in order to publish its bills
return View ("NotAuthorized");
// This should'nt occur, as long as
// a profile must exist for each one of
// existing user record in data base
// and each post is deleted with user deletion
// a post => an author => a profile
throw new Exception("Unexpected error retreiving author's profile");
ViewData ["BlogUserProfile"] = pr;
ViewData ["Avatar"] = pr.avatar;
ViewData ["BlogTitle"] = pr.BlogTitle;
@ -237,28 +254,24 @@ namespace Yavsc.Controllers
}
/// <summary>
/// Post the specified user and title.
/// Post the specified title.
/// </summary>
/// <param name="user">User.</param>
/// <param name="title">Title.</param>
[Authorize]
public ActionResult Post (string user, string title)
public ActionResult Post (string title)
{
ViewData ["BlogUser"] = user;
ViewData ["PostTitle"] = title;
ViewData ["SiteName"] = sitename;
string un = Membership.GetUser ().UserName;
if (String.IsNullOrEmpty (user))
user = un;
if (String.IsNullOrEmpty (title))
title = "";
ViewData ["SiteName"] = sitename;
ViewData ["Author"] = un;
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (Membership.GetUser ().UserName).Select (x => new SelectListItem {
ViewData ["AllowedCircles"] = CircleManager.DefaultProvider.List (un)
.Select (x => new SelectListItem {
Value = x.Id.ToString(),
Text = x.Title
});
return View ("Edit", new BlogEntry { Title = title });
return View ("Edit", new BlogEntry { Title = title, Author = un });
}
/// <summary>
@ -280,8 +293,17 @@ namespace Yavsc.Controllers
}
else
model.Id = BlogManager.Post (model.Author, model.Title, model.Content, model.Visible, model.AllowedCircles);
return RedirectToAction ("UserPosts", new { user = model.Author, title = model.Title });
if (model.Photo != null)
BlogManager.UpdatePostPhoto (model.Id, model.Photo);
return RedirectToAction ("Title", new { title = model.Title });
}
ViewData ["AllowedCircles"] =
CircleManager.DefaultProvider.List (
Membership.GetUser ().UserName).Select (x => new SelectListItem {
Value = x.Id.ToString(),
Text = x.Title,
Selected = model.AllowedCircles.Contains (x.Id)
});
return View ("Edit", model);
}
@ -290,15 +312,15 @@ namespace Yavsc.Controllers
/// </summary>
/// <param name="id">Identifier.</param>
[Authorize]
public ActionResult Edit (long id)
public ActionResult Edit (long postid)
{
BlogEntry e = BlogManager.GetForEditing (id);
BlogEntry e = BlogManager.GetForEditing (postid);
string user = Membership.GetUser ().UserName;
Profile pr = new Profile (ProfileBase.Create(e.Author));
ViewData ["BlogTitle"] = pr.BlogTitle;
ViewData ["LOGIN"] = user;
ViewData ["Id"] = id;
ViewData ["Id"] = postid;
// Populates the circles combo items
if (e.AllowedCircles == null)
@ -335,8 +357,8 @@ namespace Yavsc.Controllers
/// using returnUrl as the URL to return to,
/// and confirm as a proof you really know what you do.
/// </summary>
/// <param name="id">Title.</param>
/// <param name="user">User.</param>
/// <param name="title">Title.</param>
/// <param name="returnUrl">Return URL.</param>
/// <param name="confirm">If set to <c>true</c> confirm.</param>
[Authorize]
@ -368,19 +390,19 @@ namespace Yavsc.Controllers
/// <param name="returnUrl">Return URL.</param>
/// <param name="confirm">If set to <c>true</c> confirm.</param>
[Authorize]
public ActionResult RemovePost (long id, string returnUrl, bool confirm = false)
public ActionResult RemovePost (long postid, string returnUrl, bool confirm = false)
{
// ensures the access control
BlogEntry e = BlogManager.GetForEditing (id);
BlogEntry e = BlogManager.GetForEditing (postid);
if (e == null)
return new HttpNotFoundResult ("post id "+id.ToString());
ViewData ["id"] = id;
return new HttpNotFoundResult ("post id "+postid.ToString());
ViewData ["id"] = postid;
ViewData ["returnUrl"] = string.IsNullOrWhiteSpace(returnUrl)?
Request.UrlReferrer.AbsoluteUri.ToString(): returnUrl;
// TODO: cleaner way to disallow deletion
if (!confirm)
return View ("RemovePost",e);
BlogManager.RemovePost (id);
BlogManager.RemovePost (postid);
if (string.IsNullOrWhiteSpace(returnUrl))
return RedirectToAction ("Index");
return Redirect (returnUrl);

View File

@ -14,6 +14,7 @@ using Yavsc.Model.FrontOffice;
using Yavsc.Model.FileSystem;
using Yavsc.Model.Calendar;
using System.Configuration;
using Yavsc.Helpers;
namespace Yavsc.Controllers
{
@ -206,7 +207,7 @@ namespace Yavsc.Controllers
ViewData ["ProdRef"] = pref;
Catalog cat = CatalogManager.GetCatalog ();
if (cat == null) {
ViewData ["Message"] = "Catalog introuvable";
YavscHelpers.Notify(ViewData, "Catalog introuvable");
ViewData ["RefType"] = "Catalog";
return View ("ReferenceNotFound");
}
@ -249,10 +250,10 @@ namespace Yavsc.Controllers
// Add specified product command to the basket,
// saves it in db
new Command(collection,HttpContext.Request.Files);
ViewData ["Message"] = LocalizedText.Item_added_to_basket;
YavscHelpers.Notify(ViewData, LocalizedText.Item_added_to_basket);
return View (collection);
} catch (Exception e) {
ViewData ["Message"] = "Exception:" + e.Message;
YavscHelpers.Notify(ViewData,"Exception:" + e.Message);
return View (collection);
}
}

View File

@ -17,6 +17,7 @@ using Yavsc.Model.Google;
using Yavsc.Model.RolesAndMembers;
using Yavsc.Helpers.Google;
using Yavsc.Model.Calendar;
using Yavsc.Helpers;
namespace Yavsc.Controllers
{
@ -25,6 +26,11 @@ namespace Yavsc.Controllers
/// </summary>
public class GoogleController : Controller
{
public ActionResult Index()
{
return View ();
}
private string SetSessionSate ()
{
string state = "security_token";
@ -100,7 +106,7 @@ namespace Yavsc.Controllers
AuthToken gat = oa.GetToken (Request, (string)Session ["state"], out msg);
if (gat == null) {
ViewData ["Message"] = msg;
YavscHelpers.Notify(ViewData, msg);
return View ("Auth");
}
SaveToken (gat);
@ -118,7 +124,7 @@ namespace Yavsc.Controllers
/// </summary>
/// <param name="gat">Gat.</param>
private void SaveToken (AuthToken gat)
{
{
HttpContext.Profile.SetPropertyValue ("gtoken", gat.access_token);
if (gat.refresh_token != null)
HttpContext.Profile.SetPropertyValue ("grefreshtoken", gat.refresh_token);
@ -137,7 +143,7 @@ namespace Yavsc.Controllers
OAuth2 oa = new OAuth2 (AuthGRU);
AuthToken gat = oa.GetToken (Request, (string)Session ["state"], out msg);
if (gat == null) {
ViewData ["Message"] = msg;
YavscHelpers.Notify(ViewData, msg);
return View ();
}
string returnUrl = (string)Session ["returnUrl"];

View File

@ -13,6 +13,7 @@ using Npgsql.Web.Blog;
using Yavsc.Helpers;
using Yavsc;
using System.Web.Mvc;
using Yavsc.Model.Blogs;
namespace Yavsc.Controllers
{
@ -84,16 +85,22 @@ namespace Yavsc.Controllers
/// </summary>
public ActionResult Index ()
{
/*
* A very bad idea (a redirect permanent as home page):
*
* string startPage = WebConfigurationManager.AppSettings ["StartPage"];
if (startPage != null)
Redirect (startPage);
*/
ViewData ["Message"] = LocalizedText.Welcome;
foreach (string tagname in new string[] {"Artistes","Accueil","Actualités","Mentions légales"})
{
TagInfo ti = BlogManager.GetTagInfo (tagname);
// TODO specialyze BlogEntry creating a PhotoEntry
ViewData [tagname] = ti;
}
return View ();
}
/// <summary>
/// Credits this instance.
/// </summary>
public ActionResult Credits ()
{
return View ();
}
/// <summary>
/// Contact the specified email, reason and body.
/// </summary>
@ -123,8 +130,7 @@ namespace Yavsc.Controllers
using (System.Net.Mail.SmtpClient sc = new SmtpClient())
{
sc.Send (msg);
ViewData ["Message"] = LocalizedText.Message_sent;
YavscHelpers.Notify(ViewData, LocalizedText.Message_sent);
return View (new { email=email, reason="", body="" });
}
}

View File

@ -47,28 +47,40 @@ namespace Yavsc
routes.IgnoreRoute ("favicon.png"); // favorite icon
routes.IgnoreRoute ("robots.txt"); // for search engine robots
routes.MapRoute (
"Blogs",
"Blogs/{action}/{user}/{title}",
new { controller = "Blogs", action = "Index", user=UrlParameter.Optional, title = UrlParameter.Optional }
);
"Titles",
"title/{title}",
new { controller = "Blogs", action = "Index",
title=UrlParameter.Optional }
);
routes.MapRoute (
"BlogByTitleRO",
"Blog/{user}/{title}",
new { controller = "Blogs", action = "Index", user=UrlParameter.Optional, title = UrlParameter.Optional }
"Blogs",
"blog/{user}",
new { controller = "Blogs",
action = "UserPosts",
user="Paul Schneider" }
);
routes.MapRoute (
"BlogByTitle",
"by/{user}/{title}/{id}",
new { controller = "Blogs",
action = "UserPosts",
user="Paul Schneider",
title=UrlParameter.Optional,
id=UrlParameter.Optional }
);
routes.MapRoute (
"BlogById",
"B/{action}/{id}",
new { controller = "Blogs", action = "UserPost", id = UrlParameter.Optional }
"b/{action}/{postid}",
new { controller = "Blogs", action = "Index",
postid=UrlParameter.Optional }
);
routes.MapRoute (
"Default",
"{controller}/{action}/{id}",
new { controller = defaultController,
action = "Index",
user=UrlParameter.Optional,
id = UrlParameter.Optional }
new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
/// <summary>

View File

@ -12,14 +12,19 @@ using Yavsc.Model.Circles;
using System.Web.UI;
using System.Linq.Expressions;
using System.Web.Profile;
using System.Web.Script.Serialization;
using System.Web.Mvc;
using System.Text.RegularExpressions;
namespace Yavsc.Helpers
{
/// <summary>
/// Yavsc helpers.
/// </summary>
public static class YavscHelpers
{
private static string siteName = null;
/// <summary>
@ -53,7 +58,9 @@ namespace Yavsc.Helpers
/// <param name="user">User.</param>
public static void SendActivationMessage(this System.Web.Http.Routing.UrlHelper helper, MembershipUser user)
{
SendActivationMessage (helper.Route("~/Account/Validate/",new { id=user.UserName, key=user.ProviderUserKey.ToString() } )
SendActivationMessage (helper.Route("Default", new { controller="Account",
action = "Validate",
key=user.ProviderUserKey.ToString() } )
, WebConfigurationManager.AppSettings ["RegistrationMessage"],
user);
}
@ -156,7 +163,7 @@ namespace Yavsc.Helpers
ProfileBase pr = ProfileBase.Create (username);
object avpath = null;
if (pr != null) avpath = pr.GetPropertyValue("Avatar");
if (avpath == null) return "/bfiles/"+username+".png";
if (avpath == null) return DefaultAvatar==null?"/bfiles/"+username+".png":DefaultAvatar;
string avatarLocation = avpath as string;
if (avatarLocation.StartsWith ("~/")) {
avatarLocation = helper.RequestContext.HttpContext.Server.MapPath(avatarLocation);
@ -164,6 +171,175 @@ namespace Yavsc.Helpers
return avatarLocation;
}
private static string avatarDir = "~/avatars";
private static string defaultAvatar = null;
private static string defaultAvatarMimetype = null;
public static string DefaultAvatar {
get {
if (defaultAvatar == null)
GetAvatarConfig ();
return defaultAvatar;
}
}
public static string AvatarDir {
get {
return avatarDir;
}
}
/// <summary>
/// Initializes a new instance of the <see cref="Yavsc.Controllers.BlogsController"/> class.
/// </summary>
private static void GetAvatarConfig ()
{
string[] defaultAvatarSpec = ConfigurationManager.AppSettings.Get ("DefaultAvatar").Split (';');
if (defaultAvatarSpec.Length != 2)
throw new ConfigurationErrorsException ("the DefaultAvatar spec should be found as <fileName>;<mime-type> ");
defaultAvatar = defaultAvatarSpec [0];
defaultAvatarMimetype = defaultAvatarSpec [1];
}
/// <summary>
/// Javas the script.
/// </summary>
/// <returns>The script.</returns>
/// <param name="html">Html.</param>
/// <param name="obj">Object.</param>
public static string JavaScript(this System.Web.Mvc.HtmlHelper html, object obj)
{
return JavaScript (obj);
}
/// <summary>
/// Javas the script.
/// </summary>
/// <returns>The script.</returns>
/// <param name="obj">Object.</param>
public static string JavaScript(object obj)
{
JavaScriptSerializer serializer = new JavaScriptSerializer();
return serializer.Serialize(obj);
}
/// <summary>
/// Notifies
/// </summary>
/// <param name="ViewData">View data.</param>
/// <param name="message">Message.</param>
public static void Notify (this HtmlHelper helper, string message) {
Notify (helper.ViewData, message);
}
/// <summary>
/// Notify the specified viewData and message.
/// </summary>
/// <param name="viewData">View data.</param>
/// <param name="message">Message.</param>
public static void Notify(ViewDataDictionary viewData, string message) {
if (viewData ["Notifications"] == null)
viewData ["Notifications"] = new List<string> ();
(viewData ["Notifications"] as List<string>).Add (message.Replace("\'","\\\'"));
}
/// <summary>
/// Files the list.
/// </summary>
/// <returns>The list.</returns>
/// <param name="html">Html.</param>
/// <param name="path">Path.</param>
/// <param name="patterns">Patterns.</param>
public static IHtmlString FileList(this System.Web.Mvc.HtmlHelper html, string path, string [] patterns = null) {
StringWriter str = new StringWriter();
HtmlTextWriter writter = new HtmlTextWriter (str);
DirectoryInfo di = new DirectoryInfo (HttpContext.Current.Server.MapPath(path));
if (!di.Exists)
return new System.Web.Mvc.MvcHtmlString ("");
var files = new List<FileInfo> ();
if (patterns == null)
patterns = new string[] { "*" };
var url = new System.Web.Mvc.UrlHelper(html.ViewContext.RequestContext,
html.RouteCollection);
foreach (string pattern in patterns)
files.AddRange(
di.EnumerateFiles (
pattern,
SearchOption.TopDirectoryOnly));
writter.RenderBeginTag ("table");
writter.RenderBeginTag ("tr");
writter.RenderBeginTag ("td");
writter.Write (html.Translate ("Name"));
writter.RenderEndTag ();
writter.RenderBeginTag ("td");
writter.Write (html.Translate ("Created"));
writter.RenderEndTag ();
writter.RenderBeginTag ("td");
writter.Write (html.Translate ("Modified"));
writter.RenderEndTag ();
writter.RenderEndTag ();
foreach (FileInfo fi in files) {
writter.RenderBeginTag ("tr");
writter.RenderBeginTag ("td");
writter.AddAttribute ("href", url.Content(path+"/"+fi.Name));
writter.RenderBeginTag ("a");
writter.Write (fi.Name);
writter.RenderEndTag ();
writter.RenderEndTag ();
writter.RenderBeginTag ("td");
writter.Write (fi.LastWriteTime.ToString ("U"));
writter.RenderEndTag ();
writter.RenderBeginTag ("td");
writter.Write (fi.CreationTime.ToString("U"));
writter.RenderEndTag ();
writter.RenderEndTag ();
}
writter.RenderEndTag ();
return new System.Web.Mvc.MvcHtmlString (str.ToString ());
}
/// <summary>
/// Renders the page links.
/// </summary>
/// <returns>The page links.</returns>
/// <param name="helper">Helper.</param>
/// <param name="ResultCount">Result count.</param>
/// <param name="PageSize">Page size.</param>
/// <param name="PageIndex">Page index.</param>
public static IHtmlString RenderPageLinks (
this HtmlHelper helper,
int PageIndex, int PageSize, int ResultCount,
string args="?PageIndex={0}",
string pagesLabel="Pages: ", string singlePage="",
string none="néant"
)
{
StringWriter strwr = new StringWriter ();
HtmlTextWriter writer = new HtmlTextWriter(strwr);
if (ResultCount > 0 && ResultCount > PageSize ) {
int pageCount = ((ResultCount-1) / PageSize) + 1;
if ( pageCount > 1 ) {
writer.WriteEncodedText (pagesLabel);
for (int pi = (PageIndex < 5) ? 0 : PageIndex - 5; pi < pageCount && pi < PageIndex + 5; pi++) {
if (PageIndex == pi)
writer.RenderBeginTag ("b");
else {
writer.AddAttribute (HtmlTextWriterAttribute.Href,
string.Format (args, pi));
writer.RenderBeginTag ("a");
}
writer.Write (pi + 1);
writer.RenderEndTag ();
writer.Write ("&nbsp;");
}
}
else {
writer.Write (singlePage);
}
}
if (ResultCount == 0) {
writer.Write (none);
}
return new MvcHtmlString(strwr.ToString());
}
}
}

View File

@ -1,32 +0,0 @@
using System;
using SalesCatalog;
using System.Web.Routing;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Web.Http;
using System.Net.Http;
using System.Web;
using System.Linq;
using System.IO;
using System.Net;
using Yavsc;
using System.Web.Security;
using Yavsc.Model.WorkFlow;
using System.Reflection;
using System.Collections.Generic;
using Yavsc.Model.RolesAndMembers;
using Yavsc.Controllers;
using Yavsc.Formatters;
using System.Text;
using System.Web.Profile;
namespace Yavsc.ApiControllers
{
interface IValueProvider<T>
{
T GetValue();
}
}

View File

@ -1,4 +1,4 @@
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" CodeBehind="App.master.cs" %>
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<asp:ContentPlaceHolder id="init" runat="server">
@ -12,132 +12,89 @@
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/style.css")%>" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/font-awesome.css")%>" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/jquery-ui.css")%>" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/prettify.css")%>" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/doxy.css")%>" />
<link rel="icon" type="image/png" href="/favicon.png?v=3" />
<script src="<%=Url.Content("~/Scripts/jquery-2.1.4.min.js")%>"></script>
<script src="<%=Url.Content("~/Scripts/jquery-ui-1.11.4.js")%>"></script>
<script src="<%=Url.Content("~/Scripts/parralax.js")%>"></script>
<script src="<%=Url.Content("~/Scripts/Prettify/run_prettify.js")%>"></script>
<script type="text/javascript">
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
$(document).ready(function(){
var $window = $(window);
$('[data-type="background"]').each(function(){
var $bgobj = $(this); // assigning the object
// get the initial background position, assumes a "X% Yem" ?
var orgpos = $bgobj.css('backgroundPosition');
var bgpos = orgpos.split(" ");
var bgposx = bgpos[0];
var bgposy = bgpos[1];
if (/%$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-1);
$bgobj.attr('orgbgpxu','% ');
}
else if (/em$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-2);
$bgobj.attr('orgbgpxu','em ');
}
else if (/px$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-2);
$bgobj.attr('orgbgpxu','px ');
}
else { $bgobj.attr('orgbgpxu','px '); }
if (/%$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-1);
$bgobj.attr('orgbgpyu','% ');
}
else if (/em$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-2);
$bgobj.attr('orgbgpyu','em ');
}
else if (/px$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-2);
$bgobj.attr('orgbgpyu','px ');
}
else { $bgobj.attr('orgbgpyu','px '); }
$bgobj.attr('orgbgpx',parseInt(bgposx));
$bgobj.attr('orgbgpy',parseInt(bgposy));
$(window).scroll(function() {
var speed = $bgobj.data('speed');
var xPos = $bgobj.attr('orgbgpx') - Math.round($window.scrollLeft() / speed);
var yPos = $bgobj.attr('orgbgpy') - Math.round($window.scrollTop() / speed);
// Put together our final background position
var coords = '' + xPos + $bgobj.attr('orgbgpxu') + yPos + $bgobj.attr('orgbgpyu');
// Move the background
$bgobj.css({ backgroundPosition: coords });
// console.log($bgobj.get()[0].localName+' backgroundPosition: '+coords);
});
});
});
</script>
<script src="/Scripts/yavsc.js"></script>
<script src="<%=Url.Content("~/Scripts/yavsc.js")%>">
</script>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<link href='http://fonts.googleapis.com/css?family=Dancing+Script:400,700' rel='stylesheet' type='text/css'/>
</head>
<body>
<header data-type="background" data-speed="8" >
<asp:ContentPlaceHolder ID="overHeaderOne" runat="server">
<h1><a href="<%= Url.Content("~/") %>"> <%=ViewState["orgtitle"]%> </a></h1>
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="header" runat="server"></asp:ContentPlaceHolder>
<div id="error"><%= (ViewData["Error"]!=null)? Html.Encode(ViewData["Error"]) : "" %></div>
<div id="message"><%= Html.Encode(ViewData["Message"]) %></div>
<h1><a href="<%= Url.Content("~/") %>">
<%=ViewState["orgtitle"]%></a>
- <a href="<%= Url.RouteUrl("Default", new {controller="Home" }) %>"><%= YavscHelpers.SiteName %></a>
</h1>
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="header" runat="server"></asp:ContentPlaceHolder>
<div id="notifications"></div>
<%if (ViewData ["Notifications"]!=null) { %>
<script>
$(document).ready(function(){
<% foreach (string note in (IEnumerable<string>) ViewData ["Notifications"] ) { %>
Yavsc.notice('<%=note%>');
<% } %>
});
</script>
<% } %>
</header>
<nav data-type="background" data-speed="2">
<% if (Membership.GetUser()==null) { %>
<a href="<%= Url.RouteUrl("Default", new { controller = "Account", action="Login", returnUrl=Request.Url.PathAndQuery } ) %>" class="menuitem">
<i class="fa fa-sign-in"></i> Connexion
<div class="hint">Pour pouvoir commenter, publier, facturer, partager en cercles privés ...</div>
<a href="<%= Url.RouteUrl("Default", new { controller = "Account", action = "Login", returnUrl=Request.Url.PathAndQuery}) %>" class="menuitem" accesskey = "C">
<i class="fa fa-sign-in">Connexion</i>
</a>
<% } else { %>
<a href="/Blog/<%= HttpContext.Current.User.Identity.Name%>" accesskey = "B" class="menuitem">
<a href="<%=Url.RouteUrl("Blogs", new { user = HttpContext.Current.User.Identity.Name } )%>" accesskey = "B" class="menuitem" >
<img src="<%=Url.AvatarUrl(HttpContext.Current.User.Identity.Name)%>" alt="vos billets" class="iconsmall" />
<div class="hint">Vos billets</div>
<span class="hint">Vos billets</span>
</a>
<a href="<%= Url.RouteUrl("Default", new { controller = "Account", action = "Profile", id = HttpContext.Current.User.Identity.Name} ) %>" accesskey="P" class="menuitem">
<i class="fa fa-user"><%= HttpContext.Current.User.Identity.Name %>
<span class="hint"> &Eacute;dition de votre profile </span></i>
</a>
<a href="<%= Url.Content("~/Account/Profile/" + HttpContext.Current.User.Identity.Name) %>" accesskey="L" class="menuitem">
<i class="fa fa-user"></i> <%= HttpContext.Current.User.Identity.Name %>
<div class="hint"> &Eacute;dition de votre profile </div></a>
<a href="/Blogs/Post" accesskey="P" class="menuitem">
<i class="fa fa-pencil"></i>
<u>P</u>oster
<div class="hint">&Eacute;dition d'un nouveau billet </div></a>
<i class="fa fa-pencil"><u>P</u>oster
<span class="hint">&Eacute;dition d'un nouveau billet </span></i>
</a>
<a href="<%= Url.Content( "~/Account/Logout/?returnUrl=")+Url.Encode(Request.Url.PathAndQuery)%>" accesskey = "P" class="menuitem">
<i class="fa fa-sign-out"></i>Deconnexion</a>
<a href="<%= Url.RouteUrl("Default", new { controller = "Account", action = "Logout", returnUrl=Request.Url.PathAndQuery}) %>" accesskey = "C" class="menuitem">
<i class="fa fa-sign-out"><%=Html.Translate("Logout")%></i></a>
<% } %>
</nav>
<main data-type="background" data-speed="10">
<div>
<main data-type="background" data-speed="10" data-emheight="10" data-posx="0" data-posy="22" >
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</div>
</main>
<asp:ContentPlaceHolder ID="MASContent" runat="server">
</asp:ContentPlaceHolder>
<footer data-type="background" data-speed="2">
<div >
<%= Html.ActionLink("Formulaire de contact","Contact","Home",null, new { @class="thanks" }) %>
<% foreach ( Link link in Html.Thanks()) { %>
<a class="thanks" href="<%=link.Url%>"><% if (link.Image !=null) {
%><img src="<%= link.Image %>" alt="<%= link.Text %>"/></a>
<% } else { %>
<a class="thanks" href="<%=link.Url%>"><%= link.Text %></a>
<% }} %>
<footer data-type="background" data-speed="2" >
<div id="copyr">
© 2015 Totem Production. Tous droits réservés.
</div>
<div >
<p class="control">
<%= Html.ActionLink("Formulaire de contact","Contact","Home") %>
</p>
<p>
<a href="https://fr-fr.facebook.com/Brahms.Totem.officiel" ><img src="/images/facebook.png" alt="facebook"/></a>
<a href="http://twitter.com/TotemOfficiel"><img src="/images/twiter.png" alt="twiter"/></a>
</p>
<script src="https://apis.google.com/js/platform.js" defer>
{lang: 'fr'}
</script>
<div id="gspacer"><div class="g-plusone" data-annotation="inline" data-width="170"></div></div>
</footer>
<div id="gspacer" class="control"><div class="g-plusone" data-annotation="inline" data-width="170"></div>
</div>
</div>
</footer><div class="modal"></div>
</body>
</html>

View File

@ -2,64 +2,80 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<asp:ContentPlaceHolder id="init" runat="server">
</asp:ContentPlaceHolder><%
ViewState["orgtitle"] = T.GetString(Page.Title);
</asp:ContentPlaceHolder>
<% ViewState["orgtitle"] = Html.Translate(Page.Title);
Page.Title = ViewState["orgtitle"] + " - " + YavscHelpers.SiteName;
%><head runat="server">
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/App_Themes/style.css" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/style.css")%>" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/font-awesome.css")%>" />
<link rel="stylesheet" href="<%=Url.Content("~/App_Themes/jquery-ui.css")%>" />
<link rel="icon" type="image/png" href="/favicon.png?v=3" />
<script type="text/javascript" src="<%=Url.Content("~/Scripts/jquery-2.1.4.min.js")%>"></script>
<script src="<%=Url.Content("~/Scripts/jquery-2.1.4.min.js")%>"></script>
<script src="<%=Url.Content("~/Scripts/jquery-ui-1.11.4.js")%>"></script>
<script src="<%=Url.Content("~/Scripts/parralax.js")%>"></script>
<script type="text/javascript">
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
</script>
<script src="<%=Url.Content("~/Scripts/yavsc.js")%>">
</script>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<link href='http://fonts.googleapis.com/css?family=Dancing+Script:400,700' rel='stylesheet' type='text/css'/>
</head>
<body>
<header>
<header data-type="background" data-speed="8" >
<asp:ContentPlaceHolder ID="overHeaderOne" runat="server">
<h1><a href="<%= Html.Encode(Request.Url.AbsoluteUri.ToString()) %>"> <%=ViewState["orgtitle"]%> </a> -
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority%>"><%= YavscHelpers.SiteName %></a>
</h1>
</asp:ContentPlaceHolder><asp:ContentPlaceHolder ID="header" runat="server"></asp:ContentPlaceHolder><%
if (ViewData["Error"]!=null) {
%><div class="error"><%= Html.Encode(ViewData["Error"]) %>
</div><% }
if (ViewData["Message"]!=null) {
%><div class="message"><%= Html.Encode(ViewData["Message"]) %></div><% }
%>
<h1><a href="<%= Url.Content("~/") %>">
<%=ViewState["orgtitle"]%></a>
- <a href="<%= Url.Content("~/") %>"><%= YavscHelpers.SiteName %></a>
</h1>
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="header" runat="server"></asp:ContentPlaceHolder>
<div id="notifications"></div>
<%if (ViewData ["Notifications"]!=null) { %>
<script>
$(document).ready(function(){
<% foreach (string note in (IEnumerable<string>) ViewData ["Notifications"] ) { %>
Yavsc.notice('<%=note%>');
<% } %>
});
</script>
<% } %>
</header>
<main>
<nav data-type="background" data-speed="2">
<a href="<%= Url.RouteUrl("Default", new { controller = "Account", action = "Logout", returnUrl=Request.Url.PathAndQuery}) %>" accesskey = "C" class="menuitem">
<i class="fa fa-sign-out">Deconnexion</i></a>
</nav>
<main data-type="background" data-speed="10" data-emheight="10" data-posx="0" data-posy="22" >
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</main>
<asp:ContentPlaceHolder ID="MASContent" runat="server">
</asp:ContentPlaceHolder>
<footer>
<script src="https://apis.google.com/js/platform.js" async defer>
<footer data-type="background" data-speed="2" >
<div id="copyr">
© 2012 Totem Production. Tous droits réservés.
</div>
<div >
<p class="control">
<%= Html.ActionLink("Formulaire de contact","Contact","Home") %>
</p>
<p>
<a href="https://fr-fr.facebook.com/Brahms.Totem.officiel" ><img src="/images/facebook.png" alt="facebook"/></a>
<a href="http://twitter.com/TotemOfficiel"><img src="/images/twiter.png" alt="twiter"/></a>
</p>
<script src="https://apis.google.com/js/platform.js" defer>
{lang: 'fr'}
</script>
<%= Html.ActionLink("Contact","Contact","Home",null, new { @class="thanks" }) %>
<% foreach ( Link link in Html.Thanks()) { %>
<a class="thanks" href="<%=link.Url%>"><% if (link.Image !=null) {
%><img src="<%= link.Image %>" alt="<%= link.Text %>"/></a><%
} else { %><a class="thanks" href="<%=link.Url%>"><%= link.Text %></a><% }} %>
<div class="g-plusone" data-annotation="inline" data-width="230"></div>
</footer>
<script type="text/javascript">
var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
</script> <script>
$( ".bshd" ).on("click",function(e) {
if (e.target == "[object HTMLElement]") {
var panel = $(this).children(".bshpanel");
if (panel.hasClass("hidden")) panel.css("cursor","zoom-out");
else panel.css("cursor","zoom-in");
panel.toggleClass("hidden");
$(this).children(".bsh").toggleClass("hidden");
} });
</script>
<div id="gspacer" class="control"><div class="g-plusone" data-annotation="inline" data-width="170"></div>
</div>
</div>
</footer><div class="modal"></div>
</body>
</html>

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["com",/^#[^\n\r]*/,null,"#"],["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"']],[["kwd",/^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/,
null],["typ",/^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[ES]?BANK=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[!-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["apollo","agc","aea"]);

View File

@ -0,0 +1,3 @@
var a=null;
PR.registerLangHandler(PR.createSimpleLexer([["str",/^"(?:[^\n\r"\\]|\\.)*(?:"|$)/,a,'"'],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["com",/^REM[^\n\r]*/,a],["kwd",/^\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\b/,a],["pln",/^[a-z][^\W_]?(?:\$|%)?/i,a],["lit",/^(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?/i,a,"0123456789"],["pun",
/^.[^\s\w"$%.]*/,a]]),["basic","cbm"]);

View File

@ -0,0 +1,18 @@
/*
Copyright (C) 2011 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var a=null;
PR.registerLangHandler(PR.createSimpleLexer([["opn",/^[([{]+/,a,"([{"],["clo",/^[)\]}]+/,a,")]}"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:def|if|do|let|quote|var|fn|loop|recur|throw|try|monitor-enter|monitor-exit|defmacro|defn|defn-|macroexpand|macroexpand-1|for|doseq|dosync|dotimes|and|or|when|not|assert|doto|proxy|defstruct|first|rest|cons|defprotocol|deftype|defrecord|reify|defmulti|defmethod|meta|with-meta|ns|in-ns|create-ns|import|intern|refer|alias|namespace|resolve|ref|deref|refset|new|set!|memfn|to-array|into-array|aset|gen-class|reduce|map|filter|find|nil?|empty?|hash-map|hash-set|vec|vector|seq|flatten|reverse|assoc|dissoc|list|list?|disj|get|union|difference|intersection|extend|extend-type|extend-protocol|prn)\b/,a],
["typ",/^:[\dA-Za-z-]+/]]),["clj"]);

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n\u000c"]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]+)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],
["com",/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}\b/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]);

View File

@ -0,0 +1,3 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"]],[["com",/^#!.*/],["kwd",/^\b(?:import|library|part of|part|as|show|hide)\b/i],["com",/^\/\/.*/],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["kwd",/^\b(?:class|interface)\b/i],["kwd",/^\b(?:assert|break|case|catch|continue|default|do|else|finally|for|if|in|is|new|return|super|switch|this|throw|try|while)\b/i],["kwd",/^\b(?:abstract|const|extends|factory|final|get|implements|native|operator|set|static|typedef|var)\b/i],
["typ",/^\b(?:bool|double|dynamic|int|num|object|string|void)\b/i],["kwd",/^\b(?:false|null|true)\b/i],["str",/^r?'''[\S\s]*?[^\\]'''/],["str",/^r?"""[\S\s]*?[^\\]"""/],["str",/^r?'('|[^\n\f\r]*?[^\\]')/],["str",/^r?"("|[^\n\f\r]*?[^\\]")/],["pln",/^[$_a-z]\w*/i],["pun",/^[!%&*+/:<-?^|~-]/],["lit",/^\b0x[\da-f]+/i],["lit",/^\b\d+(?:\.\d*)?(?:e[+-]?\d+)?/i],["lit",/^\b\.\d+(?:e[+-]?\d+)?/i],["pun",/^[(),.;[\]{}]/]]),
["dart"]);

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["lit",/^[a-z]\w*/],["lit",/^'(?:[^\n\f\r'\\]|\\[^&])+'?/,null,"'"],["lit",/^\?[^\t\n ({]+/,null,"?"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^%[^\n]*/],["kwd",/^(?:module|attributes|do|let|in|letrec|apply|call|primop|case|of|end|when|fun|try|catch|receive|after|char|integer|float,atom,string,var)\b/],
["kwd",/^-[_a-z]+/],["typ",/^[A-Z_]\w*/],["pun",/^[,.;]/]]),["erlang","erl"]);

View File

@ -0,0 +1 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["pln",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])+(?:'|$)|`[^`]*(?:`|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\/\*[\S\s]*?\*\/)/],["pln",/^(?:[^"'/`]|\/(?![*/]))+/]]),["go"]);

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t-\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^\n\f\r'\\]|\\[^&])'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:--+[^\n\f\r]*|{-(?:[^-]|-+[^}-])*-})/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^\d'A-Za-z]|$)/,
null],["pln",/^(?:[A-Z][\w']*\.)*[A-Za-z][\w']*/],["pun",/^[^\d\t-\r "'A-Za-z]+/]]),["hs"]);

View File

@ -0,0 +1,3 @@
var a=null;
PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(+/,a,"("],["clo",/^\)+/,a,")"],["com",/^;[^\n\r]*/,a,";"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|con[ds]|def(?:ine|un)|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a],
["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["cl","el","lisp","lsp","scm","ss","rkt"]);

View File

@ -0,0 +1 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^!?"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["com",/^;[^\n\r]*/,null,";"]],[["pln",/^[!%@](?:[$\-.A-Z_a-z][\w$\-.]*|\d+)/],["kwd",/^[^\W\d]\w*/,null],["lit",/^\d+\.\d+/],["lit",/^(?:\d+|0[Xx][\dA-Fa-f]+)/],["pun",/^[(-*,:<->[\]{}]|\.\.\.$/]]),["llvm","ll"]);

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\S\s]*?(?:]\1]|$)|[^\n\r]*)/],["str",/^\[(=*)\[[\S\s]*?(?:]\1]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],
["pln",/^[_a-z]\w*/i],["pun",/^[^\w\t\n\r \xa0][^\w\t\n\r "'+=\xa0-]*/]]),["lua"]);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^#(?:if[\t\n\r \xa0]+(?:[$_a-z][\w']*|``[^\t\n\r`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:"(?:[^"\\]|\\[\S\s])*(?:"|$)|'(?:[^'\\]|\\[\S\s])(?:'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\n\r]*|\(\*[\S\s]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/],
["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],["pln",/^(?:[_a-z][\w']*[!#?]?|``[^\t\n\r`]*(?:``|$))/i],["pun",/^[^\w\t\n\r "'\xa0]+/]]),["fs","ml"]);

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"]|\\.)*"/,null,'"']],[["com",/^;[^\n\r]*/,null,";"],["dec",/^\$(?:d|device|ec|ecode|es|estack|et|etrap|h|horolog|i|io|j|job|k|key|p|principal|q|quit|st|stack|s|storage|sy|system|t|test|tl|tlevel|tr|trestart|x|y|z[a-z]*|a|ascii|c|char|d|data|e|extract|f|find|fn|fnumber|g|get|j|justify|l|length|na|name|o|order|p|piece|ql|qlength|qs|qsubscript|q|query|r|random|re|reverse|s|select|st|stack|t|text|tr|translate|nan)\b/i,
null],["kwd",/^(?:[^$]b|break|c|close|d|do|e|else|f|for|g|goto|h|halt|h|hang|i|if|j|job|k|kill|l|lock|m|merge|n|new|o|open|q|quit|r|read|s|set|tc|tcommit|tre|trestart|tro|trollback|ts|tstart|u|use|v|view|w|write|x|xecute)\b/i,null],["lit",/^[+-]?(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?/i],["pln",/^[a-z][^\W_]*/i],["pun",/^[^\w\t\n\r"$%;^\xa0]|_/]]),["mumps"]);

View File

@ -0,0 +1,4 @@
var a=null;
PR.registerLangHandler(PR.createSimpleLexer([["str",/^(?:'(?:[^\n\r'\\]|\\.)*'|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,a,'"'],["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,a,"#"],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["str",/^@"(?:[^"]|"")*(?:"|$)/,a],["str",/^<#[^#>]*(?:#>|$)/,a],["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,a],["com",/^\/\/[^\n\r]*/,a],["com",/^\/\*[\S\s]*?(?:\*\/|$)/,
a],["kwd",/^(?:abstract|and|as|base|catch|class|def|delegate|enum|event|extern|false|finally|fun|implements|interface|internal|is|macro|match|matches|module|mutable|namespace|new|null|out|override|params|partial|private|protected|public|ref|sealed|static|struct|syntax|this|throw|true|try|type|typeof|using|variant|virtual|volatile|when|where|with|assert|assert2|async|break|checked|continue|do|else|ensures|for|foreach|if|late|lock|new|nolate|otherwise|regexp|repeat|requires|return|surroundwith|unchecked|unless|using|while|yield)\b/,
a],["typ",/^(?:array|bool|byte|char|decimal|double|float|int|list|long|object|sbyte|short|string|ulong|uint|ufloat|ulong|ushort|void)\b/,a],["lit",/^@[$_a-z][\w$@]*/i,a],["typ",/^@[A-Z]+[a-z][\w$@]*/,a],["pln",/^'?[$_a-z][\w$@]*/i,a],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,a,"0123456789"],["pun",/^.[^\s\w"-$'./@`]*/,a]]),["n","nemerle"]);

View File

@ -0,0 +1,3 @@
var a=null;
PR.registerLangHandler(PR.createSimpleLexer([["str",/^'(?:[^\n\r'\\]|\\.)*(?:'|$)/,a,"'"],["pln",/^\s+/,a," \r\n\t\u00a0"]],[["com",/^\(\*[\S\s]*?(?:\*\)|$)|^{[\S\s]*?(?:}|$)/,a],["kwd",/^(?:absolute|and|array|asm|assembler|begin|case|const|constructor|destructor|div|do|downto|else|end|external|for|forward|function|goto|if|implementation|in|inline|interface|interrupt|label|mod|not|object|of|or|packed|procedure|program|record|repeat|set|shl|shr|then|to|type|unit|until|uses|var|virtual|while|with|xor)\b/i,a],
["lit",/^(?:true|false|self|nil)/i,a],["pln",/^[a-z][^\W_]*/i,a],["lit",/^(?:\$[\da-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)/i,a,"0123456789"],["pun",/^.[^\s\w$'./@]*/,a]]),["pascal"]);

View File

@ -0,0 +1 @@
PR.registerLangHandler(PR.sourceDecorator({keywords:"bytes,default,double,enum,extend,extensions,false,group,import,max,message,option,optional,package,repeated,required,returns,rpc,service,syntax,to,true",types:/^(bool|(double|s?fixed|[su]?int)(32|64)|float|string)\b/,cStyleComments:!0}),["proto"]);

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,null,'"'],["str",/^'(?:[^'\\]|\\[\S\s])*(?:'|$)/,null,"'"]],[["com",/^#.*/],["kwd",/^(?:if|else|for|while|repeat|in|next|break|return|switch|function)(?![\w.])/],["lit",/^0[Xx][\dA-Fa-f]+([Pp]\d+)?[Li]?/],["lit",/^[+-]?(\d+(\.\d+)?|\.\d+)([Ee][+-]?\d+)?[Li]?/],["lit",/^(?:NULL|NA(?:_(?:integer|real|complex|character)_)?|Inf|TRUE|FALSE|NaN|\.\.(?:\.|\d+))(?![\w.])/],
["pun",/^(?:<<?-|->>?|-|==|<=|>=|<|>|&&?|!=|\|\|?|[!*+/^]|%.*?%|[$=@~]|:{1,3}|[(),;?[\]{}])/],["pln",/^(?:[A-Za-z]+[\w.]*|\.[^\W\d][\w.]*)(?![\w.])/],["str",/^`.+`/]]),["r","s","R","S","Splus"]);

View File

@ -0,0 +1 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\n\r]*/,null,"%"]],[["lit",/^\\(?:cr|l?dots|R|tab)\b/],["kwd",/^\\[@-Za-z]+/],["kwd",/^#(?:ifn?def|endif)/],["pln",/^\\[{}]/],["pun",/^[()[\]{}]+/]]),["Rd","rd"]);

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^"(?:""(?:""?(?!")|[^"\\]|\\.)*"{0,3}|(?:[^\n\r"\\]|\\.)*"?)/,null,'"'],["lit",/^`(?:[^\n\r\\`]|\\.)*`?/,null,"`"],["pun",/^[!#%&(--:-@[-^{-~]+/,null,"!#%&()*+,-:;<=>?@[\\]^{|}~"]],[["str",/^'(?:[^\n\r'\\]|\\(?:'|[^\n\r']+))'/],["lit",/^'[$A-Z_a-z][\w$]*(?![\w$'])/],["kwd",/^(?:abstract|case|catch|class|def|do|else|extends|final|finally|for|forSome|if|implicit|import|lazy|match|new|object|override|package|private|protected|requires|return|sealed|super|throw|trait|try|type|val|var|while|with|yield)\b/],
["lit",/^(?:true|false|null|this)\b/],["lit",/^(?:0(?:[0-7]+|x[\da-f]+)l?|(?:0|[1-9]\d*)(?:(?:\.\d+)?(?:e[+-]?\d+)?f?|l?)|\\.\d+(?:e[+-]?\d+)?f?)/i],["typ",/^[$_]*[A-Z][\d$A-Z_]*[a-z][\w$]*/],["pln",/^[$A-Z_a-z][\w$]*/],["com",/^\/(?:\/.*|\*(?:\/|\**[^*/])*(?:\*+\/?)?)/],["pun",/^(?:\.+|\/)/]]),["scala"]);

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\n\r]*|\/\*[\S\s]*?(?:\*\/|$))/],["kwd",/^(?:add|all|alter|and|any|apply|as|asc|authorization|backup|begin|between|break|browse|bulk|by|cascade|case|check|checkpoint|close|clustered|coalesce|collate|column|commit|compute|connect|constraint|contains|containstable|continue|convert|create|cross|current|current_date|current_time|current_timestamp|current_user|cursor|database|dbcc|deallocate|declare|default|delete|deny|desc|disk|distinct|distributed|double|drop|dummy|dump|else|end|errlvl|escape|except|exec|execute|exists|exit|fetch|file|fillfactor|following|for|foreign|freetext|freetexttable|from|full|function|goto|grant|group|having|holdlock|identity|identitycol|identity_insert|if|in|index|inner|insert|intersect|into|is|join|key|kill|left|like|lineno|load|match|matched|merge|natural|national|nocheck|nonclustered|nocycle|not|null|nullif|of|off|offsets|on|open|opendatasource|openquery|openrowset|openxml|option|or|order|outer|over|partition|percent|pivot|plan|preceding|precision|primary|print|proc|procedure|public|raiserror|read|readtext|reconfigure|references|replication|restore|restrict|return|revoke|right|rollback|rowcount|rowguidcol|rows?|rule|save|schema|select|session_user|set|setuser|shutdown|some|start|statistics|system_user|table|textsize|then|to|top|tran|transaction|trigger|truncate|tsequal|unbounded|union|unique|unpivot|update|updatetext|use|user|using|values|varying|view|waitfor|when|where|while|with|within|writetext|xml)(?=[^\w-]|$)/i,
null],["lit",/^[+-]?(?:0x[\da-f]+|(?:\.\d+|\d+(?:\.\d*)?)(?:e[+-]?\d+)?)/i],["pln",/^[_a-z][\w-]*/i],["pun",/^[^\w\t\n\r "'\xa0][^\w\t\n\r "'+\xa0-]*/]]),["sql"]);

View File

@ -0,0 +1,3 @@
var a=null;
PR.registerLangHandler(PR.createSimpleLexer([["opn",/^{+/,a,"{"],["clo",/^}+/,a,"}"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^[\t\n\r \xa0]+/,a,"\t\n\r \u00a0"],["str",/^"(?:[^"\\]|\\[\S\s])*(?:"|$)/,a,'"']],[["kwd",/^(?:after|append|apply|array|break|case|catch|continue|error|eval|exec|exit|expr|for|foreach|if|incr|info|proc|return|set|switch|trace|uplevel|upvar|while)\b/,a],["lit",/^[+-]?(?:[#0]x[\da-f]+|\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[de][+-]?\d+)?)/i],["lit",
/^'(?:-*(?:\w|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?)?/],["pln",/^-*(?:[_a-z]|\\[!-~])(?:[\w-]*|\\[!-~])[!=?]?/i],["pun",/^[^\w\t\n\r "'-);\\\xa0]+/]]),["tcl"]);

View File

@ -0,0 +1 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"],["com",/^%[^\n\r]*/,null,"%"]],[["kwd",/^\\[@-Za-z]+/],["kwd",/^\\./],["typ",/^[$&]/],["lit",/[+-]?(?:\.\d+|\d+(?:\.\d*)?)(cm|em|ex|in|pc|pt|bp|mm)/i],["pun",/^[()=[\]{}]+/]]),["latex","tex"]);

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0\u2028\u2029]+/,null,"\t\n\r \u00a0\u2028\u2029"],["str",/^(?:["\u201c\u201d](?:[^"\u201c\u201d]|["\u201c\u201d]{2})(?:["\u201c\u201d]c|$)|["\u201c\u201d](?:[^"\u201c\u201d]|["\u201c\u201d]{2})*(?:["\u201c\u201d]|$))/i,null,'"\u201c\u201d'],["com",/^['\u2018\u2019](?:_(?:\r\n?|[^\r]?)|[^\n\r_\u2028\u2029])*/,null,"'\u2018\u2019"]],[["kwd",/^(?:addhandler|addressof|alias|and|andalso|ansi|as|assembly|auto|boolean|byref|byte|byval|call|case|catch|cbool|cbyte|cchar|cdate|cdbl|cdec|char|cint|class|clng|cobj|const|cshort|csng|cstr|ctype|date|decimal|declare|default|delegate|dim|directcast|do|double|each|else|elseif|end|endif|enum|erase|error|event|exit|finally|for|friend|function|get|gettype|gosub|goto|handles|if|implements|imports|in|inherits|integer|interface|is|let|lib|like|long|loop|me|mod|module|mustinherit|mustoverride|mybase|myclass|namespace|new|next|not|notinheritable|notoverridable|object|on|option|optional|or|orelse|overloads|overridable|overrides|paramarray|preserve|private|property|protected|public|raiseevent|readonly|redim|removehandler|resume|return|select|set|shadows|shared|short|single|static|step|stop|string|structure|sub|synclock|then|throw|to|try|typeof|unicode|until|variant|wend|when|while|with|withevents|writeonly|xor|endif|gosub|let|variant|wend)\b/i,
null],["com",/^rem\b.*/i],["lit",/^(?:true\b|false\b|nothing\b|\d+(?:e[+-]?\d+[dfr]?|[dfilrs])?|(?:&h[\da-f]+|&o[0-7]+)[ils]?|\d*\.\d+(?:e[+-]?\d+)?[dfr]?|#\s+(?:\d+[/-]\d+[/-]\d+(?:\s+\d+:\d+(?::\d+)?(\s*(?:am|pm))?)?|\d+:\d+(?::\d+)?(\s*(?:am|pm))?)\s+#)/i],["pln",/^(?:(?:[a-z]|_\w)\w*(?:\[[!#%&@]+])?|\[(?:[a-z]|_\w)\w*])/i],["pun",/^[^\w\t\n\r "'[\]\xa0\u2018\u2019\u201c\u201d\u2028\u2029]+/],["pun",/^(?:\[|])/]]),["vb","vbs"]);

View File

@ -0,0 +1,3 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xa0]+/,null,"\t\n\r \u00a0"]],[["str",/^(?:[box]?"(?:[^"]|"")*"|'.')/i],["com",/^--[^\n\r]*/],["kwd",/^(?:abs|access|after|alias|all|and|architecture|array|assert|attribute|begin|block|body|buffer|bus|case|component|configuration|constant|disconnect|downto|else|elsif|end|entity|exit|file|for|function|generate|generic|group|guarded|if|impure|in|inertial|inout|is|label|library|linkage|literal|loop|map|mod|nand|new|next|nor|not|null|of|on|open|or|others|out|package|port|postponed|procedure|process|pure|range|record|register|reject|rem|report|return|rol|ror|select|severity|shared|signal|sla|sll|sra|srl|subtype|then|to|transport|type|unaffected|units|until|use|variable|wait|when|while|with|xnor|xor)(?=[^\w-]|$)/i,
null],["typ",/^(?:bit|bit_vector|character|boolean|integer|real|time|string|severity_level|positive|natural|signed|unsigned|line|text|std_u?logic(?:_vector)?)(?=[^\w-]|$)/i,null],["typ",/^'(?:active|ascending|base|delayed|driving|driving_value|event|high|image|instance_name|last_active|last_event|last_value|left|leftof|length|low|path_name|pos|pred|quiet|range|reverse_range|right|rightof|simple_name|stable|succ|transaction|val|value)(?=[^\w-]|$)/i,null],["lit",/^\d+(?:_\d+)*(?:#[\w.\\]+#(?:[+-]?\d+(?:_\d+)*)?|(?:\.\d+(?:_\d+)*)?(?:e[+-]?\d+(?:_\d+)*)?)/i],
["pln",/^(?:[a-z]\w*|\\[^\\]*\\)/i],["pun",/^[^\w\t\n\r "'\xa0][^\w\t\n\r "'\xa0-]*/]]),["vhdl","vhd"]);

View File

@ -0,0 +1,2 @@
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\d\t a-gi-z\xa0]+/,null,"\t \u00a0abcdefgijklmnopqrstuvwxyz0123456789"],["pun",/^[*=[\]^~]+/,null,"=*~^[]"]],[["lang-wiki.meta",/(?:^^|\r\n?|\n)(#[a-z]+)\b/],["lit",/^[A-Z][a-z][\da-z]+[A-Z][a-z][^\W_]+\b/],["lang-",/^{{{([\S\s]+?)}}}/],["lang-",/^`([^\n\r`]+)`/],["str",/^https?:\/\/[^\s#/?]*(?:\/[^\s#?]*)?(?:\?[^\s#]*)?(?:#\S*)?/i],["pln",/^(?:\r\n|[\S\s])[^\n\r#*=A-[^`h{~]*/]]),["wiki"]);
PR.registerLangHandler(PR.createSimpleLexer([["kwd",/^#[a-z]+/i,null,"#"]],[]),["wiki.meta"]);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
var a=null;
PR.registerLangHandler(PR.createSimpleLexer([["pun",/^[:>?|]+/,a,":|>?"],["dec",/^%(?:YAML|TAG)[^\n\r#]+/,a,"%"],["typ",/^&\S+/,a,"&"],["typ",/^!\S*/,a,"!"],["str",/^"(?:[^"\\]|\\.)*(?:"|$)/,a,'"'],["str",/^'(?:[^']|'')*(?:'|$)/,a,"'"],["com",/^#[^\n\r]*/,a,"#"],["pln",/^\s+/,a," \t\r\n"]],[["dec",/^(?:---|\.\.\.)(?:[\n\r]|$)/],["pun",/^-/],["kwd",/^\w+:[\n\r ]/],["pln",/^\w+/]]),["yaml","yml"]);

View File

@ -0,0 +1,30 @@
!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=
b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a<f;++a){var h=b[a];if(/\\[bdsw]/i.test(h))c.push(h);else{var h=d(h),l;a+2<f&&"-"===b[a+1]?(l=d(b[a+2]),a+=2):l=h;e.push([h,l]);l<65||h>122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;a<e.length;++a)h=e[a],h[0]<=f[1]+1?f[1]=Math.max(f[1],h[1]):b.push(f=h);for(a=0;a<b.length;++a)h=b[a],c.push(g(h[0])),
h[1]>h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f<c;++f){var l=a[f];l==="("?++h:"\\"===l.charAt(0)&&(l=+l.substring(1))&&(l<=h?d[l]=-1:a[f]=g(l))}for(f=1;f<d.length;++f)-1===d[f]&&(d[f]=++x);for(h=f=0;f<c;++f)l=a[f],l==="("?(++h,d[h]||(a[f]="(?:")):"\\"===l.charAt(0)&&(l=+l.substring(1))&&l<=h&&
(a[f]="\\"+d[l]);for(f=0;f<c;++f)"^"===a[f]&&"^"!==a[f+1]&&(a[f]="");if(e.ignoreCase&&m)for(f=0;f<c;++f)l=a[f],e=l.charAt(0),l.length>=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k<c;++k){var i=a[k];if(i.ignoreCase)j=!0;else if(/[a-z]/i.test(i.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){m=!0;j=!1;break}}for(var r={b:8,t:9,n:10,v:11,
f:12,r:13},n=[],k=0,c=a.length;k<c;++k){i=a[k];if(i.global||i.multiline)throw Error(""+i);n.push("(?:"+s(i)+")")}return RegExp(n.join("|"),j?"gi":"g")}function T(a,d){function g(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)g(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)s[j]="\n",m[j<<1]=x++,m[j++<<1|1]=a}}else if(c==3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),s[j]=c,m[j<<1]=x,x+=c.length,m[j++<<1|1]=
a)}var b=/(?:^|\s)nocode(?:\s|$)/,s=[],x=0,m=[],j=0;g(a);return{a:s.join("").replace(/\n$/,""),d:m}}function H(a,d,g,b){d&&(a={a:d,e:a},g(a),b.push.apply(b,a.g))}function U(a){for(var d=void 0,g=a.firstChild;g;g=g.nextSibling)var b=g.nodeType,d=b===1?d?a:g:b===3?V.test(g.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function g(a){for(var j=a.e,k=[j,"pln"],c=0,i=a.a.match(s)||[],r={},n=0,e=i.length;n<e;++n){var z=i[n],w=r[z],t=void 0,f;if(typeof w==="string")f=!1;else{var h=b[z.charAt(0)];
if(h)t=z.match(h[1]),w=h[0];else{for(f=0;f<x;++f)if(h=d[f],t=z.match(h[1])){w=h[0];break}t||(w="pln")}if((f=w.length>=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c<i;++c){var r=
g[c],n=r[3];if(n)for(var e=n.length;--e>=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",
/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+
s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,
q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d=
c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i<c.length;++i)b(c[i]);d===(d|0)&&c[0].setAttribute("value",d);var r=j.createElement("ol");
r.className="linenums";for(var d=Math.max(0,d-1|0)||0,i=0,n=c.length;i<n;++i)k=c[i],k.className="L"+(i+d)%10,k.firstChild||k.appendChild(j.createTextNode("\u00a0")),r.appendChild(k);a.appendChild(r)}function p(a,d){for(var g=d.length;--g>=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return F[a]}function K(a){var d=a.h;try{var g=T(a.c,a.i),b=g.a;
a.a=b;a.d=g.d;a.e=0;I(d,b)(a);var s=/\bMSIE\s(\d+)/.exec(navigator.userAgent),s=s&&+s[1]<=8,d=/\n/g,x=a.a,m=x.length,g=0,j=a.d,k=j.length,b=0,c=a.g,i=c.length,r=0;c[i]=m;var n,e;for(e=n=0;e<i;)c[e]!==c[e+2]?(c[n++]=c[e++],c[n++]=c[e++]):e+=2;i=n;for(e=n=0;e<i;){for(var p=c[e],w=c[e+1],t=e+2;t+2<=i&&c[t+1]===w;)t+=2;c[n++]=p;c[n++]=w;e=t}c.length=n;var f=a.c,h;if(f)h=f.style.display,f.style.display="none";try{for(;b<k;){var l=j[b+2]||m,B=c[r+2]||m,t=Math.min(l,B),A=j[b+1],G;if(A.nodeType!==1&&(G=x.substring(g,
t))){s&&(G=G.replace(d,"\r"));A.nodeValue=G;var L=A.ownerDocument,o=L.createElement("span");o.className=c[r+1];var v=A.parentNode;v.replaceChild(o,A);o.appendChild(A);g<l&&(j[b+1]=A=L.createTextNode(x.substring(t,l)),v.insertBefore(A,o.nextSibling))}g=t;g>=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);p(C([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);p(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);p(v({keywords:M,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);p(v({keywords:"null,true,false"}),["json"]);p(v({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:R}),
["cs"]);p(v({keywords:N,cStyleComments:!0}),["java"]);p(v({keywords:y,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);p(v({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);p(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);p(v({keywords:Q,
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);p(v({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);p(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);p(v({keywords:W,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1});
return b.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function g(){for(var b=D.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;i<p.length&&c.now()<b;i++){for(var d=p[i],j=h,k=d;k=k.previousSibling;){var m=k.nodeType,o=(m===7||m===8)&&k.nodeValue;if(o?!/^\??prettify\b/.test(o):m!==3||/\S/.test(k.nodeValue))break;if(o){j={};o.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){j[b]=c});break}}k=d.className;if((j!==h||e.test(k))&&!v.test(k)){m=!1;for(o=d.parentNode;o;o=o.parentNode)if(f.test(o.tagName)&&
o.className&&e.test(o.className)){m=!0;break}if(!m){d.className+=" prettyprinted";m=j.lang;if(!m){var m=k.match(n),y;if(!m&&(y=U(d))&&t.test(y.tagName))m=y.className.match(n);m&&(m=m[1])}if(w.test(d.tagName))o=1;else var o=d.currentStyle,u=s.defaultView,o=(o=o?o.whiteSpace:u&&u.getComputedStyle?u.getComputedStyle(d,q).getPropertyValue("white-space"):0)&&"pre"===o.substring(0,3);u=j.linenums;if(!(u=u==="true"||+u))u=(u=k.match(/\blinenums\b(?::(\d+))?/))?u[1]&&u[1].length?+u[1]:!0:!1;u&&J(d,u,o);r=
{h:m,c:d,j:u,i:o};K(r)}}}i<p.length?setTimeout(g,250):"function"===typeof a&&a()}for(var b=d||document.body,s=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],p=[],m=0;m<b.length;++m)for(var j=0,k=b[m].length;j<k;++j)p.push(b[m][j]);var b=q,c=Date;c.now||(c={now:function(){return+new Date}});var i=0,r,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,e=/\bprettyprint\b/,v=/\bprettyprinted\b/,w=/pre|xmp/i,t=/^code$/i,f=/^(?:pre|code|xmp)$/i,
h={};g()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Y})})();}()

View File

@ -0,0 +1,34 @@
!function(){var r=null;
(function(){function X(e){function j(){try{J.doScroll("left")}catch(e){P(j,50);return}w("poll")}function w(j){if(!(j.type=="readystatechange"&&x.readyState!="complete")&&((j.type=="load"?n:x)[z](i+j.type,w,!1),!m&&(m=!0)))e.call(n,j.type||j)}var Y=x.addEventListener,m=!1,C=!0,t=Y?"addEventListener":"attachEvent",z=Y?"removeEventListener":"detachEvent",i=Y?"":"on";if(x.readyState=="complete")e.call(n,"lazy");else{if(x.createEventObject&&J.doScroll){try{C=!n.frameElement}catch(A){}C&&j()}x[t](i+"DOMContentLoaded",
w,!1);x[t](i+"readystatechange",w,!1);n[t](i+"load",w,!1)}}function Q(){S&&X(function(){var e=K.length;$(e?function(){for(var j=0;j<e;++j)(function(e){P(function(){n.exports[K[e]].apply(n,arguments)},0)})(j)}:void 0)})}for(var n=window,P=n.setTimeout,x=document,J=x.documentElement,L=x.head||x.getElementsByTagName("head")[0]||J,z="",A=x.scripts,m=A.length;--m>=0;){var M=A[m],T=M.src.match(/^[^#?]*\/run_prettify\.js(\?[^#]*)?(?:#.*)?$/);if(T){z=T[1]||"";M.parentNode.removeChild(M);break}}var S=!0,D=
[],N=[],K=[];z.replace(/[&?]([^&=]+)=([^&]+)/g,function(e,j,w){w=decodeURIComponent(w);j=decodeURIComponent(j);j=="autorun"?S=!/^[0fn]/i.test(w):j=="lang"?D.push(w):j=="skin"?N.push(w):j=="callback"&&K.push(w)});m=0;for(z=D.length;m<z;++m)(function(){var e=x.createElement("script");e.onload=e.onerror=e.onreadystatechange=function(){if(e&&(!e.readyState||/loaded|complete/.test(e.readyState)))e.onerror=e.onload=e.onreadystatechange=r,--R,R||P(Q,0),e.parentNode&&e.parentNode.removeChild(e),e=r};e.type=
"text/javascript";e.src="https://google-code-prettify.googlecode.com/svn/loader/lang-"+encodeURIComponent(D[m])+".js";L.insertBefore(e,L.firstChild)})(D[m]);for(var R=D.length,A=[],m=0,z=N.length;m<z;++m)A.push("https://google-code-prettify.googlecode.com/svn/loader/skins/"+encodeURIComponent(N[m])+".css");A.push("https://google-code-prettify.googlecode.com/svn/loader/prettify.css");(function(e){function j(m){if(m!==w){var n=x.createElement("link");n.rel="stylesheet";n.type="text/css";if(m+1<w)n.error=
n.onerror=function(){j(m+1)};n.href=e[m];L.appendChild(n)}}var w=e.length;j(0)})(A);var $=function(){window.PR_SHOULD_USE_CONTINUATION=!0;var e;(function(){function j(a){function d(f){var b=f.charCodeAt(0);if(b!==92)return b;var a=f.charAt(1);return(b=i[a])?b:"0"<=a&&a<="7"?parseInt(f.substring(1),8):a==="u"||a==="x"?parseInt(f.substring(2),16):f.charCodeAt(1)}function h(f){if(f<32)return(f<16?"\\x0":"\\x")+f.toString(16);f=String.fromCharCode(f);return f==="\\"||f==="-"||f==="]"||f==="^"?"\\"+f:
f}function b(f){var b=f.substring(1,f.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),f=[],a=b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,g=b.length;a<g;++a){var k=b[a];if(/\\[bdsw]/i.test(k))c.push(k);else{var k=d(k),o;a+2<g&&"-"===b[a+1]?(o=d(b[a+2]),a+=2):o=k;f.push([k,o]);o<65||k>122||(o<65||k>90||f.push([Math.max(65,k)|32,Math.min(o,90)|32]),o<97||k>122||f.push([Math.max(97,k)&-33,Math.min(o,122)&-33]))}}f.sort(function(f,a){return f[0]-
a[0]||a[1]-f[1]});b=[];g=[];for(a=0;a<f.length;++a)k=f[a],k[0]<=g[1]+1?g[1]=Math.max(g[1],k[1]):b.push(g=k);for(a=0;a<b.length;++a)k=b[a],c.push(h(k[0])),k[1]>k[0]&&(k[1]+1>k[0]&&c.push("-"),c.push(h(k[1])));c.push("]");return c.join("")}function e(f){for(var a=f.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],g=0,k=0;g<c;++g){var o=a[g];o==="("?++k:"\\"===o.charAt(0)&&(o=+o.substring(1))&&(o<=k?d[o]=-1:a[g]=h(o))}for(g=
1;g<d.length;++g)-1===d[g]&&(d[g]=++j);for(k=g=0;g<c;++g)o=a[g],o==="("?(++k,d[k]||(a[g]="(?:")):"\\"===o.charAt(0)&&(o=+o.substring(1))&&o<=k&&(a[g]="\\"+d[o]);for(g=0;g<c;++g)"^"===a[g]&&"^"!==a[g+1]&&(a[g]="");if(f.ignoreCase&&F)for(g=0;g<c;++g)o=a[g],f=o.charAt(0),o.length>=2&&f==="["?a[g]=b(o):f!=="\\"&&(a[g]=o.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var j=0,F=!1,l=!1,I=0,c=a.length;I<c;++I){var p=a[I];if(p.ignoreCase)l=
!0;else if(/[a-z]/i.test(p.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){F=!0;l=!1;break}}for(var i={b:8,t:9,n:10,v:11,f:12,r:13},q=[],I=0,c=a.length;I<c;++I){p=a[I];if(p.global||p.multiline)throw Error(""+p);q.push("(?:"+e(p)+")")}return RegExp(q.join("|"),l?"gi":"g")}function m(a,d){function h(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)h(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)e[l]="\n",F[l<<1]=j++,F[l++<<1|1]=a}}else if(c==
3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),e[l]=c,F[l<<1]=j,j+=c.length,F[l++<<1|1]=a)}var b=/(?:^|\s)nocode(?:\s|$)/,e=[],j=0,F=[],l=0;h(a);return{a:e.join("").replace(/\n$/,""),d:F}}function n(a,d,h,b){d&&(a={a:d,e:a},h(a),b.push.apply(b,a.g))}function x(a){for(var d=void 0,h=a.firstChild;h;h=h.nextSibling)var b=h.nodeType,d=b===1?d?a:h:b===3?S.test(h.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function h(a){for(var l=a.e,j=[l,"pln"],c=
0,p=a.a.match(e)||[],m={},q=0,f=p.length;q<f;++q){var B=p[q],y=m[B],u=void 0,g;if(typeof y==="string")g=!1;else{var k=b[B.charAt(0)];if(k)u=B.match(k[1]),y=k[0];else{for(g=0;g<i;++g)if(k=d[g],u=B.match(k[1])){y=k[0];break}u||(y="pln")}if((g=y.length>=5&&"lang-"===y.substring(0,5))&&!(u&&typeof u[1]==="string"))g=!1,y="src";g||(m[B]=y)}k=c;c+=B.length;if(g){g=u[1];var o=B.indexOf(g),H=o+g.length;u[2]&&(H=B.length-u[2].length,o=H-g.length);y=y.substring(5);n(l+k,B.substring(0,o),h,j);n(l+k+o,g,A(y,
g),j);n(l+k+H,B.substring(H),h,j)}else j.push(l+k,y)}a.g=j}var b={},e;(function(){for(var h=a.concat(d),l=[],i={},c=0,p=h.length;c<p;++c){var m=h[c],q=m[3];if(q)for(var f=q.length;--f>=0;)b[q.charAt(f)]=m;m=m[1];q=""+m;i.hasOwnProperty(q)||(l.push(m),i[q]=r)}l.push(/[\S\s]/);e=j(l)})();var i=d.length;return h}function t(a){var d=[],h=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,
r,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,r,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,r,"\"'"]);a.verbatimStrings&&h.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,r]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,r,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,
r,"#"]),h.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,r])):d.push(["com",/^#[^\n\r]*/,r,"#"]));a.cStyleComments&&(h.push(["com",/^\/\/[^\n\r]*/,r]),h.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,r]));if(b=a.regexLiterals){var e=(b=b>1?"":"\n\r")?".":"[\\S\\s]";h.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+
("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+e+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+e+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&h.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&h.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),r]);d.push(["pln",/^\s+/,r," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");h.push(["lit",/^@[$_a-z][\w$@]*/i,r],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,r],["pln",/^[$_a-z][\w$@]*/i,r],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,
r,"0123456789"],["pln",/^\\[\S\s]?/,r],["pun",RegExp(b),r]);return C(d,h)}function z(a,d,h){function b(a){var c=a.nodeType;if(c==1&&!j.test(a.className))if("br"===a.nodeName)e(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&h){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(l.createTextNode(d),a.nextSibling),e(a),c||a.parentNode.removeChild(a)}}
function e(a){function b(a,c){var d=c?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),h=a.nextSibling;f.appendChild(d);for(var e=h;e;e=h)h=e.nextSibling,f.appendChild(e)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var j=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,l=a.ownerDocument,i=l.createElement("li");a.firstChild;)i.appendChild(a.firstChild);for(var c=[i],p=0;p<c.length;++p)b(c[p]);d===(d|0)&&c[0].setAttribute("value",
d);var n=l.createElement("ol");n.className="linenums";for(var d=Math.max(0,d-1|0)||0,p=0,q=c.length;p<q;++p)i=c[p],i.className="L"+(p+d)%10,i.firstChild||i.appendChild(l.createTextNode("\u00a0")),n.appendChild(i);a.appendChild(n)}function i(a,d){for(var h=d.length;--h>=0;){var b=d[h];U.hasOwnProperty(b)?V.console&&console.warn("cannot override language handler %s",b):U[b]=a}}function A(a,d){if(!a||!U.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return U[a]}function D(a){var d=
a.h;try{var h=m(a.c,a.i),b=h.a;a.a=b;a.d=h.d;a.e=0;A(d,b)(a);var e=/\bMSIE\s(\d+)/.exec(navigator.userAgent),e=e&&+e[1]<=8,d=/\n/g,i=a.a,j=i.length,h=0,l=a.d,n=l.length,b=0,c=a.g,p=c.length,t=0;c[p]=j;var q,f;for(f=q=0;f<p;)c[f]!==c[f+2]?(c[q++]=c[f++],c[q++]=c[f++]):f+=2;p=q;for(f=q=0;f<p;){for(var x=c[f],y=c[f+1],u=f+2;u+2<=p&&c[u+1]===y;)u+=2;c[q++]=x;c[q++]=y;f=u}c.length=q;var g=a.c,k;if(g)k=g.style.display,g.style.display="none";try{for(;b<n;){var o=l[b+2]||j,H=c[t+2]||j,u=Math.min(o,H),E=l[b+
1],W;if(E.nodeType!==1&&(W=i.substring(h,u))){e&&(W=W.replace(d,"\r"));E.nodeValue=W;var Z=E.ownerDocument,s=Z.createElement("span");s.className=c[t+1];var z=E.parentNode;z.replaceChild(s,E);s.appendChild(E);h<o&&(l[b+1]=E=Z.createTextNode(i.substring(u,o)),z.insertBefore(E,s.nextSibling))}h=u;h>=o&&(b+=2);h>=H&&(t+=2)}}finally{if(g)g.style.display=k}}catch(v){V.console&&console.log(v&&v.stack||v)}}var V=window,G=["break,continue,do,else,for,if,return,while"],O=[[G,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],J=[O,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],K=[O,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
L=[K,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],O=[O,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],M=[G,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
N=[G,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],R=[G,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],G=[G,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],Q=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
S=/\S/,T=t({keywords:[J,L,O,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",M,N,G],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),U={};i(T,["default-code"]);i(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);i(C([["pln",/^\s+/,r," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,r,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);i(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);i(t({keywords:J,hashComments:!0,cStyleComments:!0,types:Q}),["c","cc","cpp","cxx","cyc","m"]);i(t({keywords:"null,true,false"}),["json"]);i(t({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:Q}),
["cs"]);i(t({keywords:K,cStyleComments:!0}),["java"]);i(t({keywords:G,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);i(t({keywords:M,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);i(t({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);i(t({keywords:N,
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);i(t({keywords:O,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);i(t({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);i(t({keywords:R,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
i(C([],[["str",/^[\S\s]+/]]),["regex"]);var X=V.PR={createSimpleLexer:C,registerLangHandler:i,sourceDecorator:t,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:function(a,d,e){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;e&&z(b,e,!0);D({h:d,j:e,c:b,i:1});return b.innerHTML},
prettyPrint:e=e=function(a,d){function e(){for(var b=V.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;p<j.length&&c.now()<b;p++){for(var d=j[p],m=k,l=d;l=l.previousSibling;){var n=l.nodeType,s=(n===7||n===8)&&l.nodeValue;if(s?!/^\??prettify\b/.test(s):n!==3||/\S/.test(l.nodeValue))break;if(s){m={};s.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){m[b]=c});break}}l=d.className;if((m!==k||f.test(l))&&!w.test(l)){n=!1;for(s=d.parentNode;s;s=s.parentNode)if(g.test(s.tagName)&&s.className&&f.test(s.className)){n=
!0;break}if(!n){d.className+=" prettyprinted";n=m.lang;if(!n){var n=l.match(q),A;if(!n&&(A=x(d))&&u.test(A.tagName))n=A.className.match(q);n&&(n=n[1])}if(y.test(d.tagName))s=1;else var s=d.currentStyle,v=i.defaultView,s=(s=s?s.whiteSpace:v&&v.getComputedStyle?v.getComputedStyle(d,r).getPropertyValue("white-space"):0)&&"pre"===s.substring(0,3);v=m.linenums;if(!(v=v==="true"||+v))v=(v=l.match(/\blinenums\b(?::(\d+))?/))?v[1]&&v[1].length?+v[1]:!0:!1;v&&z(d,v,s);t={h:n,c:d,j:v,i:s};D(t)}}}p<j.length?
P(e,250):"function"===typeof a&&a()}for(var b=d||document.body,i=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],j=[],m=0;m<b.length;++m)for(var l=0,n=b[m].length;l<n;++l)j.push(b[m][l]);var b=r,c=Date;c.now||(c={now:function(){return+new Date}});var p=0,t,q=/\blang(?:uage)?-([\w.]+)(?!\S)/,f=/\bprettyprint\b/,w=/\bprettyprinted\b/,y=/pre|xmp/i,u=/^code$/i,g=/^(?:pre|code|xmp)$/i,k={};e()}};typeof define==="function"&&define.amd&&
define("google-code-prettify",[],function(){return X})})();return e}();R||P(Q,0)})();}()

View File

@ -1771,373 +1771,6 @@ http://hallojs.org
});
})(jQuery);
(function(jQuery) {
return jQuery.widget("IKS.hallo-image-insert-edit", {
options: {
editable: null,
toolbar: null,
uuid: "",
insert_file_dialog_ui_url: null,
lang: 'en',
dialogOpts: {
autoOpen: false,
width: 560,
height: 'auto',
modal: false,
resizable: true,
draggable: true,
dialogClass: 'insert-image-dialog'
},
dialog: null,
buttonCssClass: null
},
translations: {
en: {
title_insert: 'Insert Image',
title_properties: 'Image Properties',
insert: 'Insert',
chage_image: 'Change Image:',
source: 'URL',
width: 'Width',
height: 'Height',
alt: 'Alt Text',
padding: 'Padding',
txt_float: 'Float',
float_left: 'left',
float_right: 'right',
float_none: 'No'
},
de: {
title_insert: 'Bild einfügen',
title_properties: 'Bildeigenschaften',
insert: 'Einfügen',
chage_image: 'Bild ändern:',
source: 'URL',
width: 'Breite',
height: 'Höhe',
alt: 'Alt Text',
padding: 'Padding',
txt_float: 'Float',
float_left: 'Links',
float_right: 'Rechts',
float_none: 'Nein'
},
fr: {
title_insert: 'Inserer une image',
title_properties: 'Propriétés de l\'image',
insert: 'Inserer',
chage_image: 'Changer d\'image:',
source: 'URL',
width: 'Largeur',
height: 'Hauteur',
alt: 'Texte alternatif',
padding: 'Encadrement',
txt_float: 'Flotaison',
float_left: 'gauche',
float_right: 'droite',
float_none: 'non'
}
},
texts: null,
dialog_image_selection_ui_loaded: false,
$image: null,
populateToolbar: function($toolbar) {
var $buttonHolder, $buttonset, dialog_html, widget;
widget = this;
this.texts = this.translations[this.options.lang];
this.options.toolbar = $toolbar;
dialog_html = "<div id='hallo_img_properties'></div>";
if (this.options.insert_file_dialog_ui_url) {
dialog_html += "<div id='hallo_img_file_select_ui'></div>";
}
this.options.dialog = jQuery("<div>").attr('id', this.options.uuid + "-insert-image-dialog").html(dialog_html);
$buttonset = jQuery("<span>").addClass(this.widgetName);
$buttonHolder = jQuery('<span>');
$buttonHolder.hallobutton({
label: this.texts.title_insert,
icon: 'fa-picture-o',
editable: this.options.editable,
command: null,
queryState: false,
uuid: this.options.uuid,
cssClass: this.options.buttonCssClass
});
$buttonset.append($buttonHolder);
this.button = $buttonHolder;
this.button.click(function() {
if (widget.options.dialog.dialog("isOpen")) {
widget._closeDialog();
} else {
widget.lastSelection = widget.options.editable.getSelection();
widget._openDialog();
}
return false;
});
this.options.editable.element.on("halloselected, hallounselected", function() {
if (widget.options.dialog.dialog("isOpen")) {
return widget.lastSelection = widget.options.editable.getSelection();
}
});
this.options.editable.element.on("hallodeactivated", function() {
return widget._closeDialog();
});
jQuery(this.options.editable.element).on("click", "img", function(e) {
widget._openDialog(jQuery(this));
return false;
});
this.options.editable.element.on('halloselected', function(event, data) {
var toolbar_option;
toolbar_option = widget.options.editable.options.toolbar;
if (toolbar_option === "halloToolbarContextual" && jQuery(data.originalEvent.target).is('img')) {
$toolbar.hide();
return false;
}
});
$toolbar.append($buttonset);
return this.options.dialog.dialog(this.options.dialogOpts);
},
_openDialog: function($image) {
var $editableEl, widget, xposition, yposition;
this.$image = $image;
widget = this;
$editableEl = jQuery(this.options.editable.element);
xposition = $editableEl.offset().left + $editableEl.outerWidth() + 10;
if (this.$image) {
yposition = this.$image.offset().top - jQuery(document).scrollTop();
} else {
yposition = this.options.toolbar.offset().top - jQuery(document).scrollTop();
}
this.options.dialog.dialog("option", "position", [xposition, yposition]);
this.options.editable.keepActivated(true);
this.options.dialog.dialog("open");
if (this.$image) {
this.options.dialog.dialog("option", "title", this.texts.title_properties);
jQuery(document).keyup(function(e) {
if (e.keyCode === 46 || e.keyCode === 8) {
jQuery(document).off();
widget._closeDialog();
widget.$image.remove();
widget.$image = null;
}
return e.preventDefault();
});
this.options.editable.element.on("click", function() {
widget.$image = null;
return widget._closeDialog();
});
} else {
this.options.dialog.children('#hallo_img_properties').hide();
this.options.dialog.dialog("option", "title", this.texts.title_insert);
if (jQuery('#hallo_img_file_select_title').length > 0) {
jQuery('#hallo_img_file_select_title').text('');
}
}
this._load_dialog_image_properties_ui();
this.options.dialog.on('dialogclose', (function(_this) {
return function() {
var scrollbar_pos;
jQuery('label', _this.button).removeClass('ui-state-active');
scrollbar_pos = jQuery(document).scrollTop();
_this.options.editable.element.focus();
jQuery(document).scrollTop(scrollbar_pos);
return _this.options.editable.keepActivated(false);
};
})(this));
if (this.options.insert_file_dialog_ui_url && !this.dialog_image_selection_ui_loaded) {
this.options.dialog.on('click', ".reload_link", function() {
widget._load_dialog_image_selection_ui();
return false;
});
this.options.dialog.on('click', '.file_preview img', function() {
var new_source;
if (widget.$image) {
new_source = jQuery(this).attr('src').replace(/-thumb/, '');
widget.$image.attr('src', new_source);
jQuery('#hallo_img_source').val(new_source);
} else {
widget._insert_image(jQuery(this).attr('src').replace(/-thumb/, ''));
}
return false;
});
return this._load_dialog_image_selection_ui();
}
},
_insert_image: function(source) {
this.options.editable.restoreSelection(this.lastSelection);
document.execCommand("insertImage", null, source);
this.options.editable.element.trigger('change');
this.options.editable.removeAllSelections();
return this._closeDialog();
},
_closeDialog: function() {
return this.options.dialog.dialog("close");
},
_load_dialog_image_selection_ui: function() {
var widget;
widget = this;
return jQuery.ajax({
url: this.options.insert_file_dialog_ui_url,
success: function(data, textStatus, jqXHR) {
var $properties, file_select_title, t;
file_select_title = '';
$properties = widget.options.dialog.children('#hallo_img_properties');
if ($properties.is(':visible')) {
file_select_title = widget.texts.change_image;
}
t = "<div id='hallo_img_file_select_title'>" + file_select_title + "</div>";
widget.options.dialog.children('#hallo_img_file_select_ui').html(t + data);
return widget.dialog_image_selection_ui_loaded = true;
},
beforeSend: function() {
return widget.options.dialog.children('#hallo_img_file_select_ui').html('<div class="hallo_insert_file_loader"></div>');
}
});
},
_load_dialog_image_properties_ui: function() {
var $img_properties, button, height, html, widget, width;
widget = this;
$img_properties = this.options.dialog.children('#hallo_img_properties');
if (this.$image) {
width = this.$image.is('[width]') ? this.$image.attr('width') : '';
height = this.$image.is('[height]') ? this.$image.attr('height') : '';
html = this._property_input_html('source', this.$image.attr('src'), {
label: this.texts.source
}) + this._property_input_html('alt', this.$image.attr('alt') || '', {
label: this.texts.alt
}) + this._property_row_html(this._property_input_html('width', width, {
label: this.texts.width,
row: false
}) + this._property_input_html('height', height, {
label: this.texts.height,
row: false
})) + this._property_input_html('padding', this.$image.css('padding'), {
label: this.texts.padding
}) + this._property_row_html(this._property_cb_html('float_left', this.$image.css('float') === 'left', {
label: this.texts.float_left,
row: false
}) + this._property_cb_html('float_right', this.$image.css('float') === 'right', {
label: this.texts.float_right,
row: false
}) + this._property_cb_html('unfloat', this.$image.css('float') === 'none', {
label: this.texts.float_none,
row: false
}), this.texts.txt_float);
$img_properties.html(html);
$img_properties.show();
} else {
if (!this.options.insert_file_dialog_ui_url) {
$img_properties.html(this._property_input_html('source', '', {
label: this.texts.source
}));
$img_properties.show();
}
}
if (this.$image) {
if (!this.options.insert_file_dialog_ui_url) {
jQuery('#insert_image_btn').remove();
}
if (jQuery('#hallo_img_file_select_title').length > 0) {
jQuery('#hallo_img_file_select_title').text(this.texts.chage_image);
}
jQuery('#hallo_img_properties #hallo_img_source').keyup(function() {
return widget.$image.attr('src', this.value);
});
jQuery('#hallo_img_properties #hallo_img_alt').keyup(function() {
return widget.$image.attr('alt', this.value);
});
jQuery('#hallo_img_properties #hallo_img_padding').keyup(function() {
return widget.$image.css('padding', this.value);
});
jQuery('#hallo_img_properties #hallo_img_height').keyup(function() {
widget.$image.css('height', this.value);
return widget.$image.attr('height', this.value);
});
jQuery('#hallo_img_properties #hallo_img_width').keyup(function() {
widget.$image.css('width', this.value);
return widget.$image.attr('width', this.value);
});
jQuery('#hallo_img_properties #hallo_img_float_left').click(function() {
if (!this.checked) {
return false;
}
widget.$image.css('float', 'left');
jQuery('#hallo_img_properties #hallo_img_float_right').removeAttr('checked');
return jQuery('#hallo_img_properties #hallo_img_unfloat').removeAttr('checked');
});
jQuery('#hallo_img_properties #hallo_img_float_right').click(function() {
if (!this.checked) {
return false;
}
widget.$image.css('float', 'right');
jQuery('#hallo_img_properties #hallo_img_unfloat').removeAttr('checked');
return jQuery('#hallo_img_properties #hallo_img_float_left').removeAttr('checked');
});
return jQuery('#hallo_img_properties #hallo_img_unfloat').click(function() {
if (!this.checked) {
return false;
}
widget.$image.css('float', 'none');
jQuery('#hallo_img_properties #hallo_img_float_right').removeAttr('checked');
return jQuery('#hallo_img_properties #hallo_img_float_left').removeAttr('checked');
});
} else {
if (!this.options.insert_file_dialog_ui_url) {
button = "<button id=\"insert_image_btn\">" + this.texts.insert + "</button>";
$img_properties.after(button);
return jQuery('#insert_image_btn').click(function() {
var $img_source;
$img_source = jQuery('#hallo_img_properties #hallo_img_source');
return widget._insert_image($img_source.val());
});
}
}
},
_property_col_html: function(col_html) {
return "<div class='hallo_img_property_col'>" + col_html + "</div>";
},
_property_row_html: function(row_html, label) {
if (label == null) {
label = '';
}
row_html = this._property_col_html(label) + this._property_col_html(row_html);
return "<div class='hallo_img_property_row'>" + row_html + "</div>";
},
_property_html: function(property_html, options) {
var entry;
if (options == null) {
options = {};
}
if (options.row === false) {
if (options.label) {
entry = options.label + " " + property_html;
property_html = "<span class='img_property_entry'>" + entry + "</span>";
}
return property_html;
} else {
entry = "<span class='img_property_entry'>" + property_html + "</span>";
return this._property_row_html(entry, options.label);
}
},
_property_input_html: function(id, value, options) {
var text_field;
if (options == null) {
options = {};
}
text_field = "<input type='text' id='hallo_img_" + id + "' value='" + value + "'>";
return this._property_html(text_field, options);
},
_property_cb_html: function(id, checked, options) {
var cb, checked_attr;
if (options == null) {
options = {};
}
checked_attr = checked ? 'checked=checked' : '';
cb = "<input type='checkbox' id='hallo_img_" + id + "' " + checked_attr + "'>";
return this._property_html(cb, options);
}
});
})(jQuery);
(function(jQuery) {
return jQuery.widget('IKS.halloindicator', {
options: {
@ -3183,4 +2816,367 @@ http://hallojs.org
});
})(jQuery);
(function(jQuery) {
return jQuery.widget("IKS.hallo-image-insert-edit", {
options: {
editable: null,
toolbar: null,
uuid: "",
insert_file_dialog_ui_url: null,
lang: 'en',
dialogOpts: {
autoOpen: false,
width: 560,
height: 'auto',
modal: false,
resizable: true,
draggable: true,
dialogClass: 'insert-image-dialog'
},
dialog: null,
buttonCssClass: null
},
translations: {
en: {
title_insert: 'Insert Image',
title_properties: 'Image Properties',
insert: 'Insert',
chage_image: 'Change Image:',
source: 'URL',
width: 'Width',
height: 'Height',
alt: 'Alt Text',
padding: 'Padding',
txt_float: 'Float',
float_left: 'left',
float_right: 'right',
float_none: 'No'
},
de: {
title_insert: 'Bild einfügen',
title_properties: 'Bildeigenschaften',
insert: 'Einfügen',
chage_image: 'Bild ändern:',
source: 'URL',
width: 'Breite',
height: 'Höhe',
alt: 'Alt Text',
padding: 'Padding',
txt_float: 'Float',
float_left: 'Links',
float_right: 'Rechts',
float_none: 'Nein'
},
fr: {
title_insert: 'Inserer une image',
title_properties: 'Propriétés de l\'image',
insert: 'Inserer',
chage_image: 'Changer d\'image:',
source: 'URL',
width: 'Largeur',
height: 'Hauteur',
alt: 'Texte alternatif',
padding: 'Encadrement',
txt_float: 'Flotaison',
float_left: 'gauche',
float_right: 'droite',
float_none: 'non'
}
},
texts: null,
dialog_image_selection_ui_loaded: false,
$image: null,
populateToolbar: function($toolbar) {
var $buttonHolder, $buttonset, dialog_html, widget;
widget = this;
this.texts = this.translations[this.options.lang];
this.options.toolbar = $toolbar;
dialog_html = "<div id='hallo_img_properties'></div>";
if (this.options.insert_file_dialog_ui_url) {
dialog_html += "<div id='hallo_img_file_select_ui'></div>";
}
this.options.dialog = jQuery("<div>").attr('id', this.options.uuid + "-insert-image-dialog").html(dialog_html);
$buttonset = jQuery("<span>").addClass(this.widgetName);
$buttonHolder = jQuery('<span>');
$buttonHolder.hallobutton({
label: this.texts.title_insert,
icon: 'fa-picture-o',
editable: this.options.editable,
command: null,
queryState: false,
uuid: this.options.uuid,
cssClass: this.options.buttonCssClass
});
$buttonset.append($buttonHolder);
this.button = $buttonHolder;
this.button.click(function() {
if (widget.options.dialog.dialog("isOpen")) {
widget._closeDialog();
} else {
widget.lastSelection = widget.options.editable.getSelection();
widget._openDialog();
}
return false;
});
this.options.editable.element.on("halloselected, hallounselected", function() {
if (widget.options.dialog.dialog("isOpen")) {
return widget.lastSelection = widget.options.editable.getSelection();
}
});
this.options.editable.element.on("hallodeactivated", function() {
return widget._closeDialog();
});
jQuery(this.options.editable.element).on("click", "img", function(e) {
widget._openDialog(jQuery(this));
return false;
});
this.options.editable.element.on('halloselected', function(event, data) {
var toolbar_option;
toolbar_option = widget.options.editable.options.toolbar;
if (toolbar_option === "halloToolbarContextual" && jQuery(data.originalEvent.target).is('img')) {
$toolbar.hide();
return false;
}
});
$toolbar.append($buttonset);
return this.options.dialog.dialog(this.options.dialogOpts);
},
_openDialog: function($image) {
var $editableEl, widget, xposition, yposition;
this.$image = $image;
widget = this;
$editableEl = jQuery(this.options.editable.element);
xposition = $editableEl.offset().left + $editableEl.outerWidth() + 10;
if (this.$image) {
yposition = this.$image.offset().top - jQuery(document).scrollTop();
} else {
yposition = this.options.toolbar.offset().top - jQuery(document).scrollTop();
}
this.options.dialog.dialog("option", "position", [xposition, yposition]);
this.options.editable.keepActivated(true);
this.options.dialog.dialog("open");
if (this.$image) {
this.options.dialog.dialog("option", "title", this.texts.title_properties);
this.options.editable.element.on("click", function() {
widget.$image = null;
return widget._closeDialog();
});
} else {
this.options.dialog.children('#hallo_img_properties').hide();
this.options.dialog.dialog("option", "title", this.texts.title_insert);
if (jQuery('#hallo_img_file_select_title').length > 0) {
jQuery('#hallo_img_file_select_title').text('');
}
}
this._load_dialog_image_properties_ui();
this.options.dialog.on('dialogclose', (function(_this) {
return function() {
var scrollbar_pos;
jQuery('label', _this.button).removeClass('ui-state-active');
scrollbar_pos = jQuery(document).scrollTop();
_this.options.editable.element.focus();
jQuery(document).scrollTop(scrollbar_pos);
return _this.options.editable.keepActivated(false);
};
})(this));
if (this.options.insert_file_dialog_ui_url && !this.dialog_image_selection_ui_loaded) {
this.options.dialog.on('click', ".reload_link", function() {
widget._load_dialog_image_selection_ui();
return false;
});
this.options.dialog.on('click', '.file_preview img', function() {
var new_source;
if (widget.$image) {
new_source = jQuery(this).attr('src').replace(/-thumb/, '');
widget.$image.attr('src', new_source);
jQuery('#hallo_img_source').val(new_source);
} else {
widget._insert_image(jQuery(this).attr('src').replace(/-thumb/, ''));
}
return false;
});
return this._load_dialog_image_selection_ui();
}
},
_insert_image: function(source) {
this.options.editable.restoreSelection(this.lastSelection);
document.execCommand("insertImage", null, source);
this.options.editable.element.trigger('change');
this.options.editable.removeAllSelections();
return this._closeDialog();
},
_closeDialog: function() {
return this.options.dialog.dialog("close");
},
_load_dialog_image_selection_ui: function() {
var widget;
widget = this;
return jQuery.ajax({
url: this.options.insert_file_dialog_ui_url,
success: function(data, textStatus, jqXHR) {
var $properties, file_select_title, t;
file_select_title = '';
$properties = widget.options.dialog.children('#hallo_img_properties');
if ($properties.is(':visible')) {
file_select_title = widget.texts.change_image;
}
t = "<div id='hallo_img_file_select_title'>" + file_select_title + "</div>";
widget.options.dialog.children('#hallo_img_file_select_ui').html(t + data);
return widget.dialog_image_selection_ui_loaded = true;
},
beforeSend: function() {
return widget.options.dialog.children('#hallo_img_file_select_ui').html('<div class="hallo_insert_file_loader"></div>');
}
});
},
_load_dialog_image_properties_ui: function() {
var $img_properties, button, height, html, widget, width;
widget = this;
$img_properties = this.options.dialog.children('#hallo_img_properties');
if (this.$image) {
width = this.$image.is('[width]') ? this.$image.attr('width') : '';
height = this.$image.is('[height]') ? this.$image.attr('height') : '';
html = this._property_input_html('source', this.$image.attr('src'), {
label: this.texts.source
}) + this._property_input_html('alt', this.$image.attr('alt') || '', {
label: this.texts.alt
}) + this._property_row_html(this._property_input_html('width', width, {
label: this.texts.width,
row: false
}) + this._property_input_html('height', height, {
label: this.texts.height,
row: false
})) + this._property_input_html('padding', this.$image.css('padding'), {
label: this.texts.padding
}) + this._property_row_html(this._property_cb_html('float_left', this.$image.css('float') === 'left', {
label: this.texts.float_left,
row: false
}) + this._property_cb_html('float_right', this.$image.css('float') === 'right', {
label: this.texts.float_right,
row: false
}) + this._property_cb_html('unfloat', this.$image.css('float') === 'none', {
label: this.texts.float_none,
row: false
}), this.texts.txt_float);
$img_properties.html(html);
$img_properties.show();
} else {
if (!this.options.insert_file_dialog_ui_url) {
$img_properties.html(this._property_input_html('source', '', {
label: this.texts.source
}));
$img_properties.show();
}
}
if (this.$image) {
if (!this.options.insert_file_dialog_ui_url) {
jQuery('#insert_image_btn').remove();
}
if (jQuery('#hallo_img_file_select_title').length > 0) {
jQuery('#hallo_img_file_select_title').text(this.texts.chage_image);
}
jQuery('#hallo_img_properties #hallo_img_source').keyup(function() {
widget.$image.attr('src', this.value);
return widget.options.editable.element.trigger('change');
});
jQuery('#hallo_img_properties #hallo_img_alt').keyup(function() {
widget.$image.attr('alt', this.value);
return widget.options.editable.element.trigger('change');
});
jQuery('#hallo_img_properties #hallo_img_padding').keyup(function() {
widget.$image.css('padding', this.value);
return widget.options.editable.element.trigger('change');
});
jQuery('#hallo_img_properties #hallo_img_height').keyup(function() {
widget.$image.css('height', this.value);
widget.$image.attr('height', this.value);
return widget.options.editable.element.trigger('change');
});
jQuery('#hallo_img_properties #hallo_img_width').keyup(function() {
widget.$image.css('width', this.value);
widget.$image.attr('width', this.value);
return widget.options.editable.element.trigger('change');
});
jQuery('#hallo_img_properties #hallo_img_float_left').click(function() {
if (!this.checked) {
return false;
}
widget.$image.css('float', 'left');
jQuery('#hallo_img_properties #hallo_img_float_right').removeAttr('checked');
return jQuery('#hallo_img_properties #hallo_img_unfloat').removeAttr('checked');
});
jQuery('#hallo_img_properties #hallo_img_float_right').click(function() {
if (!this.checked) {
return false;
}
widget.$image.css('float', 'right');
jQuery('#hallo_img_properties #hallo_img_unfloat').removeAttr('checked');
return jQuery('#hallo_img_properties #hallo_img_float_left').removeAttr('checked');
});
return jQuery('#hallo_img_properties #hallo_img_unfloat').click(function() {
if (!this.checked) {
return false;
}
widget.$image.css('float', 'none');
jQuery('#hallo_img_properties #hallo_img_float_right').removeAttr('checked');
return jQuery('#hallo_img_properties #hallo_img_float_left').removeAttr('checked');
});
} else {
if (!this.options.insert_file_dialog_ui_url) {
button = "<button id=\"insert_image_btn\">" + this.texts.insert + "</button>";
$img_properties.after(button);
return jQuery('#insert_image_btn').click(function() {
var $img_source;
$img_source = jQuery('#hallo_img_properties #hallo_img_source');
return widget._insert_image($img_source.val());
});
}
}
},
_property_col_html: function(col_html) {
return "<div class='hallo_img_property_col'>" + col_html + "</div>";
},
_property_row_html: function(row_html, label) {
if (label == null) {
label = '';
}
row_html = this._property_col_html(label) + this._property_col_html(row_html);
return "<div class='hallo_img_property_row'>" + row_html + "</div>";
},
_property_html: function(property_html, options) {
var entry;
if (options == null) {
options = {};
}
if (options.row === false) {
if (options.label) {
entry = options.label + " " + property_html;
property_html = "<span class='img_property_entry'>" + entry + "</span>";
}
return property_html;
} else {
entry = "<span class='img_property_entry'>" + property_html + "</span>";
return this._property_row_html(entry, options.label);
}
},
_property_input_html: function(id, value, options) {
var text_field;
if (options == null) {
options = {};
}
text_field = "<input type='text' id='hallo_img_" + id + "' value='" + value + "'>";
return this._property_html(text_field, options);
},
_property_cb_html: function(id, checked, options) {
var cb, checked_attr;
if (options == null) {
options = {};
}
checked_attr = checked ? 'checked=checked' : '';
cb = "<input type='checkbox' id='hallo_img_" + id + "' " + checked_attr + "'>";
return this._property_html(cb, options);
}
});
})(jQuery);
}).call(this);

View File

@ -0,0 +1,189 @@
// knockout-jqAutocomplete 0.4.3 | (c) 2015 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
;(function(factory) {
if (typeof define === "function" && define.amd) {
// AMD anonymous module
define(["knockout", "jquery", "jquery-ui/autocomplete"], factory);
} else {
// No module loader - put directly in global namespace
factory(window.ko, jQuery);
}
})(function(ko, $) {
var JqAuto = function() {
var self = this,
unwrap = ko.utils.unwrapObservable; //support older KO versions that did not have ko.unwrap
//binding's init function
this.init = function(element, valueAccessor, allBindings, data, context) {
var existingSelect, existingChange,
options = unwrap(valueAccessor()),
config = {},
filter = typeof options.filter === "function" ? options.filter : self.defaultFilter;
//extend with global options
ko.utils.extend(config, self.options);
//override with options passed in binding
ko.utils.extend(config, options.options);
//get source from a function (can be remote call)
if (typeof options.source === "function" && !ko.isObservable(options.source)) {
config.source = function(request, response) {
//provide a wrapper to the normal response callback
var callback = function(data) {
self.processOptions(valueAccessor, null, data, request, response);
};
//call the provided function for retrieving data
options.source.call(context.$data, request.term, callback);
};
}
else {
//process local data
config.source = self.processOptions.bind(self, valueAccessor, filter, options.source);
}
//save any passed in select/change calls
existingSelect = typeof config.select === "function" && config.select;
existingChange = typeof config.change === "function" && config.change;
//handle updating the actual value
config.select = function(event, ui) {
if (ui.item && ui.item.actual) {
options.value(ui.item.actual);
if (ko.isWriteableObservable(options.dataValue)) {
options.dataValue(ui.item.data);
}
}
if (existingSelect) {
existingSelect.apply(this, arguments);
}
};
//user made a change without selecting a value from the list
config.change = function(event, ui) {
if (!ui.item || !ui.item.actual) {
options.value(event.target && event.target.value);
if (ko.isWriteableObservable(options.dataValue)) {
options.dataValue(null);
}
}
if (existingChange) {
existingChange.apply(this, arguments);
}
};
//initialize the widget
var widget = $(element).autocomplete(config).data("ui-autocomplete");
//render a template for the items
if (options.template) {
widget._renderItem = self.renderItem.bind(self, options.template, context);
}
//destroy the widget if KO removes the element
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
if (widget && typeof widget.destroy === "function") {
widget.destroy();
widget = null;
}
});
};
//the binding's update function. keep value in sync with model
this.update = function(element, valueAccessor) {
var propNames, sources,
options = unwrap(valueAccessor()),
value = unwrap(options && options.value);
if (!value && value !== 0) {
value = "";
}
// find the appropriate value for the input
sources = unwrap(options.source);
propNames = self.getPropertyNames(valueAccessor);
// if there is local data, then try to determine the appropriate value for the input
if ($.isArray(sources) && propNames.value) {
value = ko.utils.arrayFirst(sources, function (opt) {
return opt[propNames.value] == value;
}
) || value;
}
if (propNames.input && value && typeof value === "object") {
element.value = value[propNames.input];
}
else {
element.value = value;
}
};
//if dealing with local data, the default filtering function
this.defaultFilter = function(item, term) {
term = term && term.toLowerCase();
return (item || item === 0) && ko.toJSON(item).toLowerCase().indexOf(term) > -1;
};
//filter/map options to be in a format that autocomplete requires
this.processOptions = function(valueAccessor, filter, data, request, response) {
var item, index, length,
items = unwrap(data) || [],
results = [],
props = this.getPropertyNames(valueAccessor);
//filter/map items
for (index = 0, length = items.length; index < length; index++) {
item = items[index];
if (!filter || filter(item, request.term)) {
results.push({
label: props.label ? item[props.label] : item.toString(),
value: props.input ? item[props.input] : item.toString(),
actual: props.value ? item[props.value] : item,
data: item
});
}
}
//call autocomplete callback to display list
response(results);
};
//if specified, use a template to render an item
this.renderItem = function(templateName, context, ul, item) {
var $li = $("<li></li>").appendTo(ul),
itemContext = context.createChildContext(item.data);
//apply the template binding
ko.applyBindingsToNode($li[0], { template: templateName }, itemContext);
//clean up
$li.one("remove", ko.cleanNode.bind(ko, $li[0]));
return $li;
};
//retrieve the property names to use for the label, input, and value
this.getPropertyNames = function(valueAccessor) {
var options = ko.toJS(valueAccessor());
return {
label: options.labelProp || options.valueProp,
input: options.inputProp || options.labelProp || options.valueProp,
value: options.valueProp
};
};
//default global options passed into autocomplete widget
this.options = {
autoFocus: true,
delay: 50
};
};
ko.bindingHandlers.jqAuto = new JqAuto();
});

View File

@ -0,0 +1,2 @@
// knockout-jqAutocomplete 0.4.3 | (c) 2015 Ryan Niemeyer | http://www.opensource.org/licenses/mit-license
!function(a){"function"==typeof define&&define.amd?define(["knockout","jquery","jquery-ui/autocomplete"],a):a(window.ko,jQuery)}(function(a,b){var c=function(){var c=this,d=a.utils.unwrapObservable;this.init=function(e,f,g,h,i){var j,k,l=d(f()),m={},n="function"==typeof l.filter?l.filter:c.defaultFilter;a.utils.extend(m,c.options),a.utils.extend(m,l.options),m.source="function"!=typeof l.source||a.isObservable(l.source)?c.processOptions.bind(c,f,n,l.source):function(a,b){var d=function(d){c.processOptions(f,null,d,a,b)};l.source.call(i.$data,a.term,d)},j="function"==typeof m.select&&m.select,k="function"==typeof m.change&&m.change,m.select=function(b,c){c.item&&c.item.actual&&(l.value(c.item.actual),a.isWriteableObservable(l.dataValue)&&l.dataValue(c.item.data)),j&&j.apply(this,arguments)},m.change=function(b,c){c.item&&c.item.actual||(l.value(b.target&&b.target.value),a.isWriteableObservable(l.dataValue)&&l.dataValue(null)),k&&k.apply(this,arguments)};var o=b(e).autocomplete(m).data("ui-autocomplete");l.template&&(o._renderItem=c.renderItem.bind(c,l.template,i)),a.utils.domNodeDisposal.addDisposeCallback(e,function(){o&&"function"==typeof o.destroy&&(o.destroy(),o=null)})},this.update=function(e,f){var g,h,i=d(f()),j=d(i&&i.value);j||0===j||(j=""),h=d(i.source),g=c.getPropertyNames(f),b.isArray(h)&&g.value&&(j=a.utils.arrayFirst(h,function(a){return a[g.value]==j})||j),e.value=g.input&&j&&"object"==typeof j?j[g.input]:j},this.defaultFilter=function(b,c){return c=c&&c.toLowerCase(),(b||0===b)&&a.toJSON(b).toLowerCase().indexOf(c)>-1},this.processOptions=function(a,b,c,e,f){var g,h,i,j=d(c)||[],k=[],l=this.getPropertyNames(a);for(h=0,i=j.length;i>h;h++)g=j[h],(!b||b(g,e.term))&&k.push({label:l.label?g[l.label]:g.toString(),value:l.input?g[l.input]:g.toString(),actual:l.value?g[l.value]:g,data:g});f(k)},this.renderItem=function(c,d,e,f){var g=b("<li></li>").appendTo(e),h=d.createChildContext(f.data);return a.applyBindingsToNode(g[0],{template:c},h),g.one("remove",a.cleanNode.bind(a,g[0])),g},this.getPropertyNames=function(b){var c=a.toJS(b());return{label:c.labelProp||c.valueProp,input:c.inputProp||c.labelProp||c.valueProp,value:c.valueProp}},this.options={autoFocus:!0,delay:50}};a.bindingHandlers.jqAuto=new c});

74
web/Scripts/parralax.js Normal file
View File

@ -0,0 +1,74 @@
//
// parralax.js
//
// 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/>.
$(document).ready(function(){
var $window = $(window);
$('[data-type="background"]').each(function(){
var $bgobj = $(this); // assigning the object
// get the initial background position, assumes a "X% Yem" ?
var orgpos = $bgobj.css('backgroundPosition');
var bgpos = orgpos.split(" ");
var bgposx = bgpos[0];
var bgposy = bgpos[1];
if (/%$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-1);
$bgobj.attr('orgbgpxu','% ');
}
else if (/em$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-2);
$bgobj.attr('orgbgpxu','em ');
}
else if (/px$/.test(bgposx)){
bgposx = bgposx.substr(0,bgposx.length-2);
$bgobj.attr('orgbgpxu','px ');
}
else { $bgobj.attr('orgbgpxu','px '); }
if (/%$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-1);
$bgobj.attr('orgbgpyu','% ');
}
else if (/em$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-2);
$bgobj.attr('orgbgpyu','em ');
}
else if (/px$/.test(bgposy)){
bgposy = bgposy.substr(0,bgposy.length-2);
$bgobj.attr('orgbgpyu','px ');
}
else { $bgobj.attr('orgbgpyu','px '); }
$bgobj.attr('orgbgpx',parseInt(bgposx));
$bgobj.attr('orgbgpy',parseInt(bgposy));
$(window).scroll(function() {
var speed = $bgobj.data('speed');
var xPos = $bgobj.attr('orgbgpx') - Math.round($window.scrollLeft() / speed);
var yPos = $bgobj.attr('orgbgpy') - Math.round($window.scrollTop() / speed);
// Put together our final background position
var coords = '' + xPos + $bgobj.attr('orgbgpxu') + yPos + $bgobj.attr('orgbgpyu');
// Move the background
$bgobj.css({ backgroundPosition: coords });
// console.log($bgobj.get()[0].localName+' backgroundPosition: '+coords);
});
});
});

View File

@ -507,9 +507,9 @@ module.exports = [
{
filter: 'img',
replacement: function(content, node) {
var alt = node.alt || '';
var alt = node.getAttribute("alt") || '';
var src = node.getAttribute('src') || '';
var title = node.title || '';
var title = node.getAttribute('title') || '';
var titlePart = title ? ' "'+ title +'"' : '';
return src ? '![' + alt + ']' + '(' + src + titlePart + ')' : '';
}

View File

@ -31,7 +31,7 @@ function onCircleChanged()
{ $('#fncirc').addClass("dirty"); }
function removeCircle() {
Yavsc.message(false);
Yavsc.notice(false);
var id = $(this).attr('cid');
$.ajax({
url: CirclesApiUrl+"/Delete/"+id,
@ -44,12 +44,13 @@ function removeCircle() {
400: onAjaxBadInput,
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
Yavsc.message(xhr.status+" : "+xhr.responseText);
else Yavsc.message(false);
Yavsc.notice(xhr.status+" : "+xhr.responseText);
else Yavsc.notice(false);
}}});
}
function modifyCircle() {
Yavsc.message(false);
Yavsc.notice(false);
var id = $('#id').val();
var circle = { title: $("#title").val(), id: id} ;
$.ajax({
@ -69,7 +70,7 @@ function removeCircle() {
function addCircle()
{
Yavsc.message(false);
Yavsc.notice(false);
var circle = { title: $("#title").val() } ;
$("#title").text('');
$.ajax({

View File

@ -1,6 +1,13 @@
var Yavsc = (function(apiBaseUrl){
var self = {};
function dumpprops(obj) {
var str = "";
for(var k in obj)
if (obj.hasOwnProperty(k))
str += k + " = " + obj[k] + "\n";
return (str); }
self.apiBaseUrl = (apiBaseUrl || '/api');
self.showHide = function () {
@ -33,8 +40,11 @@ self.notice = function (msg, msgok) {
self.onAjaxBadInput = function (data)
{
if (!data) { Yavsc.notice('no data'); return; }
if (!data.responseJSON) { Yavsc.notice('no json data:'+data); return; }
if (!Array.isArray(data.responseJSON)) { Yavsc.notice('Bad Input: '+data.responseJSON); return; }
$.each(data.responseJSON, function (key, value) {
var errspanid = "Err_cr_" + value.key.replace("model.","");
var errspanid = "Err_" + value.key;
var errspan = document.getElementById(errspanid);
if (errspan==null)
alert('enoent '+errspanid);
@ -47,9 +57,34 @@ self.notice = function (msg, msgok) {
self.onAjaxError = function (xhr, ajaxOptions, thrownError) {
if (xhr.status!=400)
Yavsc.notice(xhr.status+" : "+xhr.responseText);
else Yavsc.notice(false);
};
return self;
})();
<<<<<<< HEAD
=======
$(document).ready(function(){
$body = $("body");
$(document).on({
ajaxStart: function() { $body.addClass("loading"); },
ajaxStop: function() { $body.removeClass("loading"); }
});
var $window = $(window);
$(window).scroll(function() {
var $ns = $('#notifications');
if ($ns.has('*').length>0) {
if ($window.scrollTop()>375) {
$ns.css('position','fixed');
$ns.css('z-index',2);
$ns.css('top',0);
}
else {
$ns.css('position','static');
$ns.css('z-index',1);
}}
});
});
>>>>>>> 5cb90afe2ce804d06034b0e0aa52e73c33baff83

32
web/Scripts/yavsc.tags.js Normal file
View File

@ -0,0 +1,32 @@
var Tags = (function(apiBaseUrl){
var self = {};
self.blogsApiUrl = (apiBaseUrl || '/api') + "/Blogs";
self.tag = function (postid,tagname,callback) {
$.ajax({
url: CirclesApiUrl+"/Tag",
type: "POST",
data: { postid: postid, tag: tagname },
success: function () {
if (callback) callback(postid,tagname);
},
statusCode: {
400: Yavsc.onAjaxBadInput
},
error: Yavsc.onAjaxError});
}
self.untag = function (postid,tagname,callback) {
$.ajax({
url: CirclesApiUrl+"/Untag",
type: "POST",
data: { postid: postid, tag: tagname },
success: function () {
if (callback) callback(postid,tagname);
},
statusCode: {
400: Yavsc.onAjaxBadInput
},
error: Yavsc.onAjaxError});
}
return self;
})();

View File

@ -20,7 +20,7 @@
<input type="submit"/>
<% } %></div>
<div class="panel">
<%= Html.ActionLink("S'enregistrer","RegisterForm",new {returnUrl=ViewData["returnUrl"]}, new { @class="actionlink" }) %>
<%= Html.ActionLink("S'enregistrer","GetRegister",new {returnUrl=ViewData["returnUrl"]}, new { @class="actionlink" }) %>
</div>
<div class="panel">
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority + "/Google/Login"%>?returnUrl=<%=ViewData["returnUrl"]==null?Request.Url.PathAndQuery:(string)ViewData["returnUrl"]%>" class="actionlink">

View File

@ -1,7 +1,7 @@
<%@ Page Title="Profile" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<Profile>" %>
<%@ Page Title="Profile_edition" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage<Profile>" %>
<asp:Content ContentPlaceHolderID="init" ID="init1" runat="server">
<% Title = ViewData["UserName"]+" at "+ YavscHelpers.SiteName +" - profile edition" ; %>
<% Title = ViewData["UserName"] + " : " +Html.Translate("Profile_edition"); %>
</asp:Content>
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
@ -28,84 +28,89 @@ table.layout TR TD { max-width:40%; }
<%= Html.ValidationMessage("WebSite", "*") %>
<br>
Avatar : <img class="avatar" src="<%=Model.avatar%>?version=<%=Html.Encode(DateTime.Now.ToString())%>" alt=""/>
Avatar : <img src="<%=Url.AvatarUrl(HttpContext.Current.User.Identity.Name)%>" alt="avatar" class="iconsmall" />
<input type="file" id="AvatarFile" name="AvatarFile"/>
<%= Html.ValidationMessage("AvatarFile", "*") %>
</fieldset>
<fieldset><legend>Blog</legend>
<div class="spanel">
<%= Html.LabelFor(model => model.BlogVisible) %> :
<%= Html.CheckBox("BlogVisible") %>
<%= Html.ValidationMessage("BlogVisible", "*") %>
<br>
</div><div class="spanel">
<%= Html.LabelFor(model => model.BlogTitle) %> :
<%= Html.TextBox("BlogTitle") %>
<%= Html.ValidationMessage("BlogTitle", "*") %>
</div>
</fieldset>
<fieldset><legend>Contact</legend>
<div class="spanel">
<%= Html.LabelFor(model => model.Phone) %>
<%= Html.TextBox("Phone") %>
<%= Html.ValidationMessage("Phone", "*") %>
</div><div class="spanel">
<%= Html.LabelFor(model => model.Mobile) %>
<%= Html.TextBox("Mobile") %>
<%= Html.ValidationMessage("Mobile", "*") %>
</div><div class="spanel">
<%= Html.LabelFor(model => model.Address) %>
<%= Html.TextBox("Address") %>
<%= Html.ValidationMessage("Address", "*") %>
</div><div class="spanel">
<%= Html.LabelFor(model => model.CityAndState) %>
<%= Html.TextBox("CityAndState") %>
<%= Html.ValidationMessage("CityAndState", "*") %>
</div><div class="spanel">
<%= Html.LabelFor(model => model.ZipCode) %>
<%= Html.TextBox("ZipCode") %>
<%= Html.ValidationMessage("ZipCode", "*") %>
</div><div class="spanel">
<%= Html.LabelFor(model => model.Country) %>
<%= Html.TextBox("Country") %>
<%= Html.ValidationMessage("Country", "*") %>
</div>
</fieldset>
<fieldset><legend>Disponibilité</legend>
<div class="spanel">
<%= Html.LabelFor(model => model.GoogleCalendar) %> :
<%= Html.Encode(Model.GoogleCalendar) %>
<%= Html.ActionLink("Choisir l'agenda","ChooseCalendar","Google",new { returnUrl= Request.Url.AbsolutePath }, new { @class="actionlink" }) %>
</fieldset>
</div></fieldset>
<fieldset><legend>Informations de facturation</legend>
<div class="spanel">
<%= Html.LabelFor(model => model.BankCode) %> :
<%= Html.TextBox("BankCode") %>
<%= Html.ValidationMessage("BankCode", "*") %>
<br>
</div><div class="spanel">
<%= Html.LabelFor(model => model.WicketCode) %> :
<%= Html.TextBox("WicketCode") %>
<%= Html.ValidationMessage("WicketCode", "*") %>
<br>
</div><div class="spanel">
<%= Html.LabelFor(model => model.AccountNumber) %> :
<%= Html.TextBox("AccountNumber") %>
<%= Html.ValidationMessage("AccountNumber", "*") %>
<br>
</div><div class="spanel">
<%= Html.LabelFor(model => model.BankedKey) %> :
<%= Html.TextBox("BankedKey") %>
<%= Html.ValidationMessage("BankedKey", "*") %>
<br>
</div><div class="spanel">
<%= Html.LabelFor(model => model.BIC) %> :
<%= Html.TextBox("BIC") %>
<%= Html.ValidationMessage("BIC", "*") %>
<br>
</div><div class="spanel">
<%= Html.LabelFor(model => model.IBAN) %> :
<%= Html.TextBox("IBAN") %>
<%= Html.ValidationMessage("IBAN", "*") %>
</div>
</fieldset>
<input type="submit"/>
@ -118,13 +123,13 @@ Avatar : <img class="avatar" src="<%=Model.avatar%>?version=<%=Html.Encode(DateT
<% if (Roles.IsUserInRole((string)ViewData ["UserName"],"Admin")) { %>
This user is Admin.
<% } %>
HasBankAccount:<%= Model.HasBankAccount %>
<% if (!Model.HasBankAccount) { %>
(IBAN+BIC ou Codes banque, guichet, compte et clé RIB)
<% } %>, IsBillable:<%=Model.IsBillable%>
<code>HasBankAccount:<%= Model.HasBankAccount %></code>
<% if (!Model.HasBankAccount) { %><span class="hint">
IBAN+BIC ou Codes banque, guichet, compte et clé RIB</span>
<% } %>, <code>IsBillable:<%=Model.IsBillable%></code>
<% if (!Model.IsBillable) { %>
(un nom et au choix, une adresse postale valide,
ou un téléphone, ou un email, ou un Mobile) <% } %>
<span class="hint">un nom et au choix, une adresse postale valide,
ou un téléphone, ou un email, ou un Mobile</span> <% } %>
</aside>
</asp:Content>

View File

@ -11,45 +11,36 @@
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<div>
<% using(Html.BeginForm("ValidateEdit","Blogs")) { %>
<fieldset>
<legend>Billet</legend>
<%= Html.LabelFor(model => model.Title) %> <%= Html.ValidationMessage("Title") %> : <br>
<input name="Title" id="Title" class="fullwidth">
<br>
<%= Html.LabelFor(model => model.Content) %>
<%= Html.ValidationMessage("Content") %>: <br>
<style> #Content { }
</style>
<textarea id="Content" name="Content" class="fullwidth" ><%=Html.Markdown(Model.Content)%></textarea><br>
<%= Html.CheckBox( "Visible" ) %>
<%= Html.LabelFor(model => model.Visible) %>
<%= Html.ValidationMessage("Visible", "*") %>
<br/>
<%= Html.LabelFor(model => model.AllowedCircles) %>
<%= Html.ListBox("AllowedCircles") %>
<%= Html.ValidationMessage("AllowedCircles", "*") %>
<%=Html.Hidden("Author")%>
<%=Html.Hidden("Id")%>
<input type="submit">
</fieldset>
<% } %>
</div>
<div class="post">
<h1><div id="vtitle" for="Title" class="post title editable"><%=Html.Markdown(Model.Title)%></div></h1>
<div id="vcontent" for="Content" class="post content editable">
<span class="placard editable" for="Photo">
<img src="<%=Model.Photo%>" alt="photo" id="vphoto" >
</span>
<!-- TODO? Model.Photo.(Legend|Date|Location|ref) -->
<h1 id="vtitle" for="Title" class="editable" ><%=Html.Markdown(Model.Title)%></h1>
<div id="vcontent" for="Content" class="editable">
<%=Html.Markdown(Model.Content,"/bfiles/"+Model.Id+"/")%>
</div>
</div>
<hr><h2>Fichiers attachées</h2>
<%= Html.FileList("~/bfiles/"+Model.Id) %>
<hr>
<script>
$(document).ready(function(){
$('#hidesource').click(function(){
$('#source').addClass('hidden');
$('#viewsource').removeClass('hidden');
$('#hidesource').addClass('hidden');
});
$('#viewsource').click(function(){
$('#source').removeClass('hidden');
$('#viewsource').addClass('hidden');
$('#hidesource').removeClass('hidden');
});
jQuery('.placard').hallo({plugins: {'hallo-image-insert-edit': { lang: 'fr' } } });
jQuery('#vtitle').hallo({
plugins: {
'halloformat': {},
@ -67,12 +58,6 @@ jQuery('#vcontent').hallo({
'hallo-image-insert-edit': {
lang: 'fr'
},
'halloimage': {
searchUrl: apiBaseUrl+'/Blogs/SearchFile/'+$('#Id').val(),
uploadUrl: apiBaseUrl+'/Blogs/PostFile/'+$('#Id').val(),
suggestions: true,
insert_file_dialog_ui_url: '<%= Url.Content("~/Blog/ChooseMedia/?id="+Model.Id) %>'
},
'halloreundo': {},
'hallocleanhtml': {
format: false,
@ -102,6 +87,7 @@ jQuery('#vcontent').hallo({
});
var markdownize = function(content) {
if (!content) return '';
var html = content.split("\n").map($.trim).filter(function(line) {
return line != "";
}).join("\n");
@ -115,26 +101,36 @@ var converter = new showdown.Converter(),
// Method that converts the HTML contents to Markdown
var showSource = function(id,content) {
if (!content) content = '';
var markdown = markdownize(content);
if (jQuery('#'+id).get(0).value == markdown) {
if (jQuery('#'+id).val() === markdown) {
return;
}
jQuery('#'+id).get(0).value = markdown;
jQuery('#'+id).val( markdown );
};
var updateHtml = function(id,content) {
var jView = jQuery('div[for="'+id+'"]');
if (markdownize(jView.html()) == content) {
var jView = jQuery('*[for="'+id+'"]');
if (markdownize(jView.html()) === content) {
return;
}
var html = htmlize(content);
jView.html(html);
};
jQuery('.placard').bind('hallomodified', function(event, data) {
// TODO get image source from data.content
$('#'+this.attributes["for"].value).val(
$('#vphoto').attr('src'));
});
// Update Markdown every time content is modified
jQuery('.editable').bind('hallomodified', function(event, data) {
var onMDModified = ( function (event, data) {
showSource(this.attributes["for"].value, data.content);
});
jQuery('#vtitle').bind('hallomodified', onMDModified);
jQuery('#vcontent').bind('hallomodified', onMDModified);
jQuery('#Content').bind('keyup', function() {
updateHtml(this.id, this.value);
});
@ -142,9 +138,9 @@ var updateHtml = function(id,content) {
updateHtml(this.id, this.value);
});
showSource("Title",jQuery('#vtitle').html());
showSource("Content",jQuery('#vcontent').html());
// showSource("Title",jQuery('#vtitle').html());
// showSource("Content",jQuery('#vcontent').html());
});
</script>
@ -152,8 +148,8 @@ var updateHtml = function(id,content) {
function submitFilesTo(method)
{
var data = new FormData($('#uploads').get()[0]);
Yavsc.message('Submitting via '+method);
var data = new FormData($('#frmajax').get()[0]);
Yavsc.notice('Submitting via '+method);
$.ajax({
url: apiBaseUrl+'/Blogs/'+method+'/'+$('#Id').val(),
type: "POST",
@ -162,7 +158,7 @@ function submitFilesTo(method)
contentType: false,
success: function(data) {
$('#Content').val(data+"\n"+$('#Content').val());
Yavsc.message(false);
Yavsc.notice(false);
},
error: Yavsc.onAjaxError,
});
@ -173,20 +169,70 @@ function submitImport()
function submitFile()
{ submitFilesTo('PostFile'); }
function submitBaseDoc()
{
var data = new FormData($('#frmajax').get()[0]);
Yavsc.notice('Submitting via '+method);
$.ajax({
url: apiBaseUrl+'/Blogs/'+method+'/'+$('#Id').val(),
type: "POST",
data: data,
processData: false,
contentType: false,
success: function(data) {
$('#Content').val(data+"\n"+$('#Content').val());
Yavsc.notice('Posted updated');
},
error: Yavsc.onAjaxError,
});
}
</script>
<form id="uploads" method="post" enctype="multipart/form-data">
<form id="frmajax">
<fieldset>
<legend>Fichiers attachés</legend>
<legend>Attacher des fichiers</legend>
<input type="file" name="attached" id="postedfile" multiple>
<input type="button" value="attacher les ficher" onclick="submitFile()">
<input type="button" value="importer les documents" onclick="submitImport()">
</fieldset>
</form>
<% using(Html.BeginForm("ValidateEdit","Blogs")) { %>
<fieldset>
<legend>Contrôle d'accès au Billet</legend>
<%= Html.LabelFor(model => model.Visible) %> : <%= Html.CheckBox( "Visible" ) %>
<i id="note_visible">Note: Si un ou plusieurs cercles sont séléctionnés ici,
le billet ne sera visible qu'aux membres de ces cercles.</i>
<%= Html.ValidationMessage("Visible", "*") %>
<%= Html.LabelFor(model => model.AllowedCircles) %>
<%= Html.ListBox("AllowedCircles") %>
<%= Html.ValidationMessage("AllowedCircles", "*") %>
</fieldset>
<span id="viewsource">
<i class="fa fa-code menuitem"><%=Html.Translate("View_source")%></i></span>
<span id="hidesource" class="hidden">
<i class="fa fa-code menuitem"><%=Html.Translate("Hide_source")%></i>
</span>
<fieldset id="source" class="hidden">
<%=Html.Hidden("Author")%>
<%=Html.Hidden("Id")%>
<%= Html.LabelFor(model => model.Photo) %>
<%=Html.TextBox("Photo")%>
<%=Html.ValidationMessage("Photo")%><br>
<%= Html.LabelFor(model => model.Title) %>
<%=Html.TextBox("Title")%>
<%=Html.ValidationMessage("Title")%><br>
<%=Html.TextArea("Content")%>
<%=Html.ValidationMessage("Content")%>
</fieldset>
<input type="submit" id="validate" value="Valider" class="fa fa-check menuitem">
<% } %>
<aside>
Id:<%= Html.ActionLink( Model.Id.ToString() , "UserPost", new { user= Model.Author, title=Model.Title, id = Model.Id }, new { @class = "usertitleref actionlink" }) %>
, Posted: <%= Model.Posted.ToString("yyyy/MM/dd") %> - Modified: <%= Model.Modified.ToString("yyyy/MM/dd") %>
Visible: <%= Model.Visible? "oui":"non" %> <%= Html.ActionLink("Supprimer","RemovePost", new { user=Model.Author, title = Model.Title }, new { @class="actionlink" } ) %>
Visible: <%= Model.Visible? "oui":"non" %> <%= Html.ActionLink("Supprimer","RemovePost", new { user=Model.Author, title = Model.Title, id = Model.Id }, new { @class="actionlink" } ) %>
</aside>
</asp:Content>

View File

@ -1,9 +0,0 @@
<%@ Page Title="Comptes utilisateur - Erreur" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<div>
<%= Html.Encode(ViewData["Message"]) %></div>
Your UID :
<%= Html.Encode(ViewData ["UID"]) %> </br>
<a class="actionlink" href="<%=ViewData["returnUrl"]%>">Retour</a>
</asp:Content>

View File

@ -1,38 +1,16 @@
<%@ Page Title="Blogs - Index" Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntryCollection>" MasterPageFile="~/Models/App.master" EnableTheming="True" StylesheetTheme="dark" %>
<%@ Page Title="Articles" Language="C#" Inherits="System.Web.Mvc.ViewPage<BlogEntryCollection>" MasterPageFile="~/Models/App.master" EnableTheming="True" StylesheetTheme="dark" %>
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<div>
<% foreach (var g in Model.GroupByUser()) { %>
<h2><a href="<%= Url.Content("~/Blog/"+g.Key) %>" class="actionlink userref">
<%=g.Key%></a></h2>
<% foreach (var g in Model.GroupByTitle()) { %>
<h2><a href="<%= Url.RouteUrl("Titles", new { title = g.Key }) %>" class="usertitleref"><%=Html.Encode(g.Key)%></a></h2>
<% foreach (var p in g) { %>
<div class="postpreview">
<%= Html.ActionLink(p.Title, "UserPost",
new { user = g.Key, title = p.Title }, new { @class = "usertitleref" } ) %>
<p><%= Html.Markdown(p.Intro,"/bfiles/"+p.Id+"/") %></p>
<aside>
(Posté le <%=p.Posted.ToString("D") %>)
<% if (Membership.GetUser()!=null)
if ((Membership.GetUser().UserName==g.Key)
|| (Roles.IsUserInRole ("Admin")))
{ %>
<%= Html.ActionLink("Editer","Edit", new { id = p.Id }, new { @class="actionlink" }) %>
<%= Html.ActionLink("Supprimer","RemovePost", new { id = p.Id }, new { @class="actionlink" } ) %>
<% } %> </aside>
<%= Html.Partial("PostActions",p)%>
</div> <% } %>
<% } %>
</div>
<form runat="server" id="form1" method="GET">
<% rp1.ResultCount = (int) ViewData["ResultCount"];
rp1.PageSize = (int) ViewData ["PageSize"];
rp1.PageIndex = (int) ViewData["PageIndex"];
rp1.None = Html.Translate("no content");
%>
<yavsc:ResultPages id="rp1" runat="server" >
<None>Aucun résultat</None>
</yavsc:ResultPages>
</form>
<%= Html.RenderPageLinks((int)ViewData["PageIndex"],(int)ViewData["PageSize"],(int)ViewData["ResultCount"])%>
</asp:Content>

View File

@ -0,0 +1,15 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BasePost>" %>
<aside>
(<%= Model.Posted.ToString("D") %>
- <%= Model.Modified.ToString("D") %> <%= Model.Visible? "":", Invisible!" %>)
<% if (Membership.GetUser()!=null) {
if (Membership.GetUser().UserName==Model.Author || Roles.IsUserInRole("Admin"))
{ %>
<% if (Model is BlogEntry) { %><%= Html.Partial("TagControl",Model)%><% } %>
<a href="<%= Url.RouteUrl("Default", new { action = "Edit", postid = Model.Id })%>" class="actionlink">
<i class="fa fa-pencil"><%=Html.Translate("Edit")%></i>
</a>
<a href="<%= Url.RouteUrl("Default", new { action = "RemovePost", postid = Model.Id })%>" class="actionlink">
<i class="fa fa-remove"><%=Html.Translate("Remove")%></i></a>
<% }} %>
</aside>

View File

@ -0,0 +1,97 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BlogEntry>" %>
<ul id="tags">
<% if (Model.Tags != null) foreach (string tagname in Model.Tags) { %>
<li><%= tagname %></li>
<% } %>
</ul>
<% if (Membership.GetUser()!=null) { %>
<% if (Membership.GetUser().UserName==Model.Author || Roles.IsUserInRole("Admin"))
{ // grant all permissions: to choose a given set of tags, also create some new tags %>
<span id="viewtagger">
<i class="fa fa-tag menuitem" id="viewtaggerbtn"><%=Html.Translate("DoTag")%></i></span>
<span id="hidetagger" class="hidden">
<i class="fa fa-tag menuitem" id="hidetaggerbtn" ><%=Html.Translate("Hide")%></i>
Note: Ils sont utilisé pour classifier le document. Par exemple, le tag <code>Accueil</code> rend le document
éligible à une place en page d'Accueil.
</span>
<form id="tagger" class="hidden">
<fieldset>
<legend>Associer des tags au billet</legend>
<label for="newtag"><%= Html.Translate("Tag_name")%>: </label>
<span id="Err_tag" class="error"></span>
<input type="text" id="newtag">
<span id="Err_model" class="error"></span>
<input id="sendnewtag" type="submit" class="fa fa-tag" value="<%=Html.Translate("Submit")%>">
</fieldset>
</form>
<script>
$(document).ready(function(){
$('#hidetaggerbtn').click(function(){
$('#tagger').addClass('hidden');
$('#viewtagger').removeClass('hidden');
$('#hidetagger').addClass('hidden');
});
$('#viewtaggerbtn').click(function(){
$('#tagger').removeClass('hidden');
$('#viewtagger').addClass('hidden');
$('#hidetagger').removeClass('hidden');
});
$('#newtag').autocomplete({
minLength: 0,
delay: 200,
source: function( request, response ) {
$.ajax({
url: "/api/Blogs/Tags",
type: "POST",
data: {
pattern: request.term
},
success: function( data ) {
response( data );
}
});
},
select: function( event, ui ) {
console.log( ui.item ?
"Selected: " + ui.item.label :
"Nothing selected, input was " + this.value);
},
open: function() {
$( this ).removeClass( "ui-corner-all" ).addClass( "ui-corner-top" );
},
close: function() {
$( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
}
});
$('#tagger').on('submit', function(e) { e.preventDefault(); });
$('#sendnewtag').click(function(){
var data = {
postid: <%= Model.Id %>,
tag: $('#newtag').val()
}
$.ajax({
url: '/api/Blogs/Tag/',
type: 'POST',
data: data,
success: function() {
$('<li>'+data.tag+'</li>').appendTo('#tags');
$('#newtag').val('');
},
statusCode: {
400: Yavsc.onAjaxBadInput
},
error: Yavsc.onAjaxError
});
});
});
</script>
<% } %>
<% } %>

View File

@ -0,0 +1,10 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TagInfo>" %>
<div class="panel">
<i class="fa fa-tag"><%=Model.Name%></i>
<ul>
<% foreach (BasePostInfo be in Model.Titles) { %>
<li><%= be.Title %>
<span><%= be.Intro %></span>
</li>
<% } %></ul>
</div>

View File

@ -0,0 +1,34 @@
<%@ Page Title="Titre" Language="C#" Inherits="System.Web.Mvc.ViewPage<UTBlogEntryCollection>" MasterPageFile="~/Models/App.master"%>
<%@ Register Assembly="Yavsc.WebControls" TagPrefix="yavsc" Namespace="Yavsc.WebControls" %>
<asp:Content ContentPlaceHolderID="init" ID="init1" runat="server">
<% Title = Model.Title + " - " + YavscHelpers.SiteName; %>
</asp:Content>
<asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server">
<h1>
<%=Html.ActionLink(Model.Title, "Title", new{title=Model.Title}, null)%>
- <a href="<%= Url.RouteUrl("Default",new {controller="Home" }) %>"><%= YavscHelpers.SiteName %></a>
</h1>
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<% foreach (BlogEntry e in this.Model) { %>
<div class="post<% if (!e.Visible) { %> hiddenpost<% } %>" >
<% if (e.Photo!=null) { %><img src="<%=e.Photo%>" alt="" class="photo"><% } %>
<%= Html.Markdown(e.Content,"/bfiles/"+e.Id+"/") %>
<%= Html.Partial("PostActions",e)%>
</div>
<% } %>
<%
if (((int) ViewData["RecordCount"]) > ((int) ViewData["PageSize"])) {
rp1.ResultCount = (int) ViewData["RecordCount"];
rp1.PageIndex = (int) ViewData["PageIndex"];
rp1.PageSize = (int) ViewData["PageSize"];
%><aside><form runat="server" id="form1">
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server">
<None><i>Pas de contenu</i></None>
</yavsc:ResultPages>
</form>
</aside>
<% } %>
</asp:Content>

View File

@ -3,41 +3,49 @@
<% Title = Model.Title+ " - " + ViewData ["BlogTitle"] ; %>
</asp:Content>
<asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server">
<h1 class="blogtitle"><% if (ViewData["Avatar"]!=null) { %>
<img src="<%=ViewData["Avatar"]%>" alt="" id="logo"/>
<% } %>
<%= Html.ActionLink(Model.Title,"UserPost", new{user=Model.Author, title = Model.Title}, null) %>
<span> - <%= Html.ActionLink((string)ViewData ["BlogTitle"] ,"UserPosts",new{user=Model.Author}, null) %>
</span>
<span> -
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority%>"><%= YavscHelpers.SiteName %></a>
</span>
<% if (!string.IsNullOrEmpty((string)ViewData["Avatar"])) { %>
<a href="<%= Url.Action("UserPosts", new{user=Model.Author}) %>" id="avatar">
<img src="<%=ViewData["Avatar"]%>" />
</a>
<% } %>
<h1 class="blogtitle">
<a href="<%= Url.Action("UserPost", new{user=Model.Author, title = Model.Title}) %>">
<%=Model.Title%>
</a>
- <%= Html.ActionLink((string)ViewData ["BlogTitle"] ,"UserPosts",new{user=Model.Author}, null) %>
-
<a href="<%=Url.Content("~/")%>"><%= YavscHelpers.SiteName %></a>
</h1>
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<% foreach (var be in Model) { %>
<div class="post">
<% if (be.Photo != null) { %>
<img src="<%=Url.Content(be.Photo)%>" alt="<%=be.Title%>" class="photo">
<% } %>
<%= Html.Markdown(be.Content,"/bfiles/"+be.Id+"/") %>
<% string username = Membership.GetUser()==null ? null : Membership.GetUser().UserName; %>
<% foreach (var c in (Comment[]) BlogManager.GetComments(be.Id)) { %>
<div class="comment" style="min-height:32px;"> <img style="clear:left;float:left;max-width:32px;max-height:32px;margin:.3em;" src="<%= Url.Content("~/Account/Avatar/"+c.From) %>" alt="<%=c.From%>"/>
<div class="comment" style="min-height:32px;">
<img style="clear:left;float:left;max-width:32px;max-height:32px;margin:.3em;" src="<%= Url.RouteUrl("Blogs", new { user = c.From } ) %>" alt="<%=c.From%>"/>
<%= Html.Markdown(c.CommentText) %>
<% if (Model.Author == username || c.From == username ) { %>
<%= Html.ActionLink("Supprimer","RemoveComment", new { cmtid = c.Id } , new { @class="actionlink" })%>
<% } %>
</div><% } %>
<% if (Membership.GetUser()!=null) {
if (Membership.GetUser().UserName==be.Author)
{ %> <div class="metapost">
{ %> <div class="control">
<%= Html.ActionLink("Editer","Edit", new { id = be.Id }, new { @class="actionlink" }) %>
<%= Html.ActionLink("Supprimer","RemovePost", new { id = be.Id }, new { @class="actionlink" } ) %>
<i class="fa fa-tag">Tagger</i>
</div> <% } %>
<aside>
<aside class="control">
<% using (Html.BeginForm("Comment","Blogs")) { %>
<%=Html.Hidden("Author")%>
<%=Html.Hidden("Title")%>

View File

@ -5,47 +5,44 @@
</asp:Content>
<asp:Content ContentPlaceHolderID="overHeaderOne" ID="header1" runat="server">
<h1 class="blogtitle">
<a href="/Blog/<%=ViewData["BlogUser"]%>">
<% if ((bool)ViewData["Avatar"]!=null) { %>
<img class="avatar" src="<%=ViewData["Avatar"]%>" alt=""/>
<% if (!string.IsNullOrEmpty((string)ViewData["Avatar"])) { %>
<a href="<%=Url.RouteUrl( "Blogs", new { user = Model.Author } )%>" id="avatar">
<img src="<%=ViewData["Avatar"]%>" />
</a>
<% } %>
<h1 class="blogtitle">
<a href="<%=Url.RouteUrl( "Blogs", new { user = Model.Author } )%>">
<%=Html.Encode(ViewData["BlogTitle"])%></a>
-
<a href="<%=Request.Url.Scheme + "://" + Request.Url.Authority%>"><%= YavscHelpers.SiteName %></a>
- <a href="<%= Url.RouteUrl( "Default", new { controller = "Home" } ) %>"><%= YavscHelpers.SiteName %></a>
</h1>
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<% foreach (BlogEntry e in this.Model) { %>
<div class="postpreview<% if (!e.Visible) { %> hiddenpost<% } %>" >
<h2><%= Html.ActionLink(e.Title,"UserPost", new { user=e.Author, title=e.Title, id = e.Id }, new { @class = "usertitleref" }) %></h2>
<h2><a href="<%= Url.RouteUrl("BlogByTitle", new { user=e.Author, title=e.Title, postid = e.Id })%>" class="usertitleref">
<%=Html.Markdown(e.Title)%></a></h2>
<% bool truncated = false; %>
<%= Html.MarkdownToHtmlIntro(out truncated, e.Content,"/bfiles/"+e.Id+"/") %>
<% if (truncated) { %>
<i><%= Html.ActionLink( "lire la suite" ,"UserPost", new { user=e.Author, title=e.Title, id = e.Id }, new { @class = "usertitleref" }) %></i>
<a href="<%= Url.RouteUrl( "BlogByTitle", new { user=e.Author , title=e.Title, postid = e.Id}) %>">
<i>Html.Translate("ReadMore")</i></a>
<% } %>
<aside>(<%= e.Posted.ToString("yyyy/MM/dd") %>
- <%= e.Modified.ToString("yyyy/MM/dd") %> <%= e.Visible? "":", Invisible!" %>)
<% if (Membership.GetUser()!=null)
if (Membership.GetUser().UserName==e.Author)
{ %>
<%= Html.ActionLink("Editer","Edit", new { id = e.Id }, new { @class="actionlink" }) %>
<%= Html.ActionLink("Supprimer","RemovePost", new { id = e.Id }, new { @class="actionlink" } ) %>
<% } %>
</aside>
<%= Html.Partial("PostActions",e)%>
</div>
<% } %>
<aside>
<form runat="server" id="form1" method="GET">
<%
<%
rp1.ResultCount = (int) ViewData["RecordCount"];
rp1.PageIndex = (int) ViewData["PageIndex"];
%><yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server"></yavsc:ResultPages>
%>
<yavsc:ResultPages id="rp1" Action = "?pageIndex={0}" runat="server">
<None><i>Pas de contenu</i></None>
</yavsc:ResultPages>
</form>
</aside>
</asp:Content>
</asp:Content>

View File

@ -3,9 +3,6 @@
<asp:Content ContentPlaceHolderID="head" ID="head1" runat="server" >
<script type="text/javascript" src="<%=Url.Content("~/Scripts/stupidtable.js")%>"></script>
<script>
$(function(){
$("#tbwrts").stupidtable();
});
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
@ -352,6 +349,9 @@ function addRow(){
$("#wr_Count").val(1);
$("#wr_UnitaryCost").val(0);
});
$("#tbwrts").stupidtable();
});
</script>

View File

@ -1,15 +1,19 @@
<%@ Page Title="Yavsc - index" Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<System.Reflection.AssemblyName>>" MasterPageFile="~/Models/App.master"%>
<%@ Page Title="Assemblies" Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<System.Reflection.AssemblyName>>" MasterPageFile="~/Models/App.master"%>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<div class="panel">
<p>
Running assembly :
<%= GetType().Assembly.FullName %></p>
</div>
<div class="panel">
<p>
Assemblies referenced in this application :
</p>
<ul>
<% foreach (System.Reflection.AssemblyName item in Model) { %>
<li><%= item.FullName %></li>
<% } %>
</ul>
</p>
</div>
</asp:Content>

View File

@ -2,6 +2,8 @@
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<% using (Html.BeginForm("Contact", "Home")) { %>
<fieldset>
<legend>Message</legend>
<p>
<%= Html.Label("email") %>:
<%= Html.ValidationMessage("email") %><br/>
@ -17,6 +19,7 @@
<%= Html.ValidationMessage("body") %><br/>
<%= Html.TextArea("body") %>
</p>
</fieldset>
<input type="submit">
<% } %>

Some files were not shown because too many files have changed in this diff Show More