Initial commit

This commit is contained in:
Sebastiaan Janssen
2012-12-17 09:41:11 +01:00
commit 810cbd267f
10368 changed files with 822114 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
dependencies/Marketplace*
*.obj
*.pdb
*.user
*.aps
*.pch
*.vspscc
[Bb]in
[Db]ebug*/
obj/
[Rr]elease*/
_ReSharper*/
*.ncrunchsolution
*.ncrunchsolution.user
*.ncrunchproject
*.crunchsolution.cache
[Tt]est[Rr]esult*
[Bb]uild[Ll]og.*
*.[Pp]ublish.xml
*.suo
[sS]ource
[sS]andbox
umbraco.config
*.vs10x
*OurUmbraco.Site/App_Data/TEMP*/
*OurUmbraco.Site/App_Data/ClientDependency*/
*OurUmbraco.Site/App_Data/Logs*/
*OurUmbraco.Site/App_Data/Preview*/
*OurUmbraco.Site/install*/
_BuildOutput/*
*.ncrunchsolution
build/*.nupkg
*.orig
*.[Dd]ot[Ss]ettings
*.js.map
/packages/*
!packages/repositories.config
+22
View File
@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
using uForum.Businesslogic;
namespace NotificationsCore.EventHandlers
{
public class Forum : umbraco.BusinessLogic.ApplicationBase
{
public Forum()
{
Comment.AfterCreate += new EventHandler<CreateEventArgs>(Comment_AfterCreate);
}
void Comment_AfterCreate(object sender, uForum.Businesslogic.CreateEventArgs e)
{
Comment c = (Comment)sender;
//InstantNotification.Execute("NewComment", c.Id);
}
}
}
+72
View File
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Reflection;
namespace NotificationsCore
{
public class InstantNotification
{
private delegate void ExecuteDelegate(string config, string assemblydir, string name, params object[] args);
private ExecuteDelegate ed;
public InstantNotification()
{
ed = new ExecuteDelegate(this.Execute);
}
public void Invoke(string config, string assemblydir, string name, params object[] args)
{
ed.BeginInvoke(config, assemblydir, name, args, null, null);
}
public void Execute(string config,string assemblydir, string name, params object[] args)
{
try
{
XmlDocument notifications = new XmlDocument();
notifications.Load(config);
XmlNode settings = notifications.SelectSingleNode("//global");
XmlNode node = notifications.SelectSingleNode(
string.Format("//instant//notification [@name = '{0}']", name));
XmlDocument details = new XmlDocument();
XmlNode cont = details.CreateElement("details");
cont.AppendChild(details.ImportNode(settings,true));
cont.AppendChild(details.ImportNode(node,true));
details.AppendChild(cont);
if (node != null)
{
string assemblyFile =
String.Format("{0}{1}.dll", assemblydir, node.Attributes["assembly"].Value);
Assembly nAssembly = System.Reflection.Assembly.LoadFrom(assemblyFile);
Notification n =
(Notification)Activator.CreateInstance(
nAssembly.GetType(node.Attributes["type"].Value));
n.SendNotification(details, args);
}
else
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, 666, "not found");
}
}
catch (Exception e)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, 666, e.Message);
}
}
}
}
+12
View File
@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace NotificationsCore.Interfaces
{
interface INotification
{
bool SendNotification(XmlNode details, params object[] args);
}
}
+94
View File
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!-- these global settings will be passed together with the notification specific settings -->
<global>
<conn><![CDATA[server=.\sqlexpress;database=databae;user id=user;password=password; Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;]]></conn>
<smtp>mx01.fab-it.dk</smtp>
<domain>dev.our.umbraco.org</domain>
<from>
<name>Our umbraco</name>
<email>robot@umbraco.org</email>
</from>
</global>
<sheduled>
<notification name="MarkAsSolutionReminder" interval="360000"
assembly="NotificationsCore"
type="NotificationsCore.NotificationTypes.MarkAsSolutionReminder">
<subject>Did you find a solution?</subject>
<body>Be sure to spread some karma...
Did you find a solution to your '{0}' topic?
Mark a reply as the solution.
Go to your topic here {1}
----
Don't want to get these notifications? Simply update your profile on our.umbraco.org
</body>
</notification>
</sheduled>
<instant>
<notification name="VoteForProjectReminderSinglee"
assembly="NotificationsCore"
type="NotificationsCore.NotificationTypes.VoteForProjectReminderSingle">
<subject>Don't forget to spread some karma</subject>
<body>
You recently downloaded the '{0}' project.
Go to the project here {1}
----
Don't want to get these notifications? Simply update your profile on our.umbraco.org
</body>
</notification>
<notification name="MarkAsSolutionReminderSingle"
assembly="NotificationsCore"
type="NotificationsCore.NotificationTypes.MarkAsSolutionReminderSingle">
<subject>Did you find a solution?</subject>
<body>Be sure to spread some karma...
Did you find a solution to your '{0}' topic?
Mark a reply as the solution.
Go to your topic here {1}
----
Don't want to get these notifications? Simply update your profile on our.umbraco.org
</body>
</notification>
<notification name="NewTopic"
assembly="NotificationsCore"
type="NotificationsCore.NotificationTypes.NewForumTopic">
<subject>New topic in '{0}' forum</subject>
<body>Somebody just added a new topic to the '{0}' forum.
View it here {1}
----
You get this notification because you are subscribed to the '{0}' forum notifications.
You can unsubscribe from your profile on our.umbraco.org
</body>
</notification>
<notification name="NewComment"
assembly="NotificationsCore"
type="NotificationsCore.NotificationTypes.NewForumTopicComment">
<subject>New reply on forum topic '{0}'</subject>
<body>Somebody just added a new reply to the '{0}' topic.
View it here {1}.
----
You get this notification because you are subscribed to the '{0}' topic notifications.
You can unsubscribe from your profile on our.umbraco.org
</body>
</notification>
</instant>
</configuration>
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
using NotificationsCore.Interfaces;
using System.Xml;
namespace NotificationsCore
{
public abstract class Notification: INotification
{
#region INotification Members
public virtual bool SendNotification(XmlNode details, params object[] args) { return false; }
#endregion
}
}
+93
View File
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NotificationsCore</RootNamespace>
<AssemblyName>NotificationsCore</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="businesslogic, Version=1.0.3496.7966, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dependencies\4.11.2\businesslogic.dll</HintPath>
</Reference>
<Reference Include="cms, Version=1.0.3502.37200, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dependencies\4.11.2\cms.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="umbraco, Version=1.0.3441.17657, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\dependencies\4.11.2\umbraco.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="InstantNotification.cs" />
<Compile Include="Interfaces\INotification.cs" />
<Compile Include="Notification.cs" />
<Compile Include="NotificationTypes\DailyDigest.cs" />
<Compile Include="NotificationTypes\MarkAsSolutionReminder.cs" />
<Compile Include="NotificationTypes\MarkAsSolutionReminderSingle.cs" />
<Compile Include="NotificationTypes\NewForumTopic.cs" />
<Compile Include="NotificationTypes\NewForumTopicComment.cs" />
<Compile Include="NotificationTypes\VoteForProjectReminder.cs" />
<Compile Include="NotificationTypes\VoteForProjectReminderSingle.cs" />
<Compile Include="SheduledNotification.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Notification.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\uForum\uForum.csproj">
<Project>{547C2D0D-1B55-493B-AE0B-E031A5B8EE77}</Project>
<Name>uForum</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+52
View File
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
using System.Reflection;
using System.Xml;
namespace NotificationsCore
{
public class NotificationExecuter
{
public string Name { get; set; }
public double Interval { get; set; }
public string Assembly { get; set; }
public string Type { get; set; }
public XmlNode Details { get; set; }
Timer timer = new Timer();
public NotificationExecuter(string name, double interval, string assembly, string type, XmlNode details)
{
this.Name = name;
this.Interval = interval;
this.Assembly = assembly;
this.Type = type;
this.Details = details;
}
public void Start()
{
timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
timer.Interval = Interval;
timer.Enabled = true;
}
void timer_Elapsed(object sender, ElapsedEventArgs e)
{
string assemblyFile =
String.Format("{0}.dll", Assembly);
Assembly nAssembly = System.Reflection.Assembly.LoadFrom(assemblyFile);
Notification n =
(Notification)Activator.CreateInstance(
nAssembly.GetType(Type));
n.SendNotification(Details);
}
}
}
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace NotificationsCore.NotificationTypes
{
public class DailyDigest: Notification
{
public DailyDigest()
{
}
public override bool SendNotification(System.Xml.XmlNode details, params object[] args)
{
return true;
}
}
}
@@ -0,0 +1,93 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using umbraco.cms.businesslogic.member;
using System.Net.Mail;
namespace NotificationsCore.NotificationTypes
{
public class MarkAsSolutionReminder: Notification
{
public MarkAsSolutionReminder()
{
}
public override bool SendNotification(System.Xml.XmlNode details, params object[] args)
{
SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText);
MailAddress from = new MailAddress(
details.SelectSingleNode("//from/email").InnerText,
details.SelectSingleNode("//from/name").InnerText);
string subject = details.SelectSingleNode("//subject").InnerText;
string body = details.SelectSingleNode("//body").InnerText;
SqlConnection conn = new SqlConnection(details.SelectSingleNode("//conn").InnerText);
string select = @"select id, memberId from forumTopics where answer = 0
and created < getdate() - 7
and created > '2010-06-10 00:00:00'
and id not in (select topicId from notificationMarkAsSolution)
order by created desc;";
SqlCommand comm = new SqlCommand(
select, conn);
conn.Open();
SqlDataReader dr = comm.ExecuteReader();
string domain = details.SelectSingleNode("//domain").InnerText;
while (dr.Read())
{
int topicId = dr.GetInt32(0);
uForum.Businesslogic.Topic t = new uForum.Businesslogic.Topic(topicId);
string mbody = string.Format(body,
t.Title,
"http://" + domain + args[1].ToString());
Member m = new Member(dr.GetInt32(1));
if (m.getProperty("bugMeNot") != null || m.getProperty("bugMeNot").Value.ToString() != "1")
{
MailMessage mm = new MailMessage();
mm.Subject = subject;
mm.Body = mbody;
mm.To.Add(m.Email);
mm.From = from;
c.Send(mm);
}
string insert =
"Insert into notificationMarkAsSolution(topicId, memberID, timestamp) values(@topicId, @memberID, getdate())";
SqlCommand icomm = new SqlCommand(insert, conn);
icomm.Parameters.AddWithValue("@topicId", topicId);
icomm.Parameters.AddWithValue("@memberID", m.Id);
icomm.ExecuteNonQuery();
}
conn.Close();
return true;
}
}
}
@@ -0,0 +1,82 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using System.Data.SqlClient;
using umbraco.cms.businesslogic.member;
namespace NotificationsCore.NotificationTypes
{
public class MarkAsSolutionReminderSingle : Notification
{
public MarkAsSolutionReminderSingle()
{
}
public override bool SendNotification(System.Xml.XmlNode details, params object[] args)
{
try
{
SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText);
MailAddress from = new MailAddress(
details.SelectSingleNode("//from/email").InnerText,
details.SelectSingleNode("//from/name").InnerText);
string subject = details.SelectSingleNode("//subject").InnerText;
string body = details.SelectSingleNode("//body").InnerText;
string domain = details.SelectSingleNode("//domain").InnerText;
int topicId = int.Parse(args[0].ToString());
int memberId = int.Parse(args[1].ToString());
uForum.Businesslogic.Topic t = new uForum.Businesslogic.Topic(topicId);
Member m = new Member(memberId);
body = string.Format(body,
t.Title,
"http://" + domain + args[2].ToString());
if (m.getProperty("bugMeNot").Value.ToString() != "1")
{
MailMessage mm = new MailMessage();
mm.Subject = subject;
mm.Body = body;
mm.To.Add(m.Email);
mm.From = from;
c.Send(mm);
}
SqlConnection conn = new SqlConnection(details.SelectSingleNode("//conn").InnerText);
conn.Open();
string insert =
"Insert into notificationMarkAsSolution(topicId, memberID, timestamp) values(@topicId, @memberID, getdate())";
SqlCommand icomm = new SqlCommand(insert, conn);
icomm.Parameters.AddWithValue("@topicId", topicId);
icomm.Parameters.AddWithValue("@memberID", m.Id);
icomm.ExecuteNonQuery();
conn.Close();
}
catch (Exception e)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message);
}
return true;
}
}
}
@@ -0,0 +1,110 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using uForum.Businesslogic;
using System.Data.SqlClient;
using umbraco.cms.businesslogic.member;
using umbraco.presentation.nodeFactory;
using umbraco.cms.businesslogic.web;
using System.Web;
namespace NotificationsCore.NotificationTypes
{
public class NewForumTopic: Notification
{
public NewForumTopic()
{
}
public override bool SendNotification(System.Xml.XmlNode details, params object[] args)
{
try
{
SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText);
MailAddress from = new MailAddress(
details.SelectSingleNode("//from/email").InnerText,
details.SelectSingleNode("//from/name").InnerText);
string subject = details.SelectSingleNode("//subject").InnerText;
string body = details.SelectSingleNode("//body").InnerText;
Topic t = (Topic)args[0];
Member s = (Member)args[2];
//currently using document api instead of nodefactory
Document f = new Document(t.ParentId);
subject = string.Format(subject, f.Text);
string domain = details.SelectSingleNode("//domain").InnerText;
body = string.Format(body,
f.Text,
"http://" + domain + args[1].ToString(), s.Text, t.Title, HttpUtility.HtmlDecode(umbraco.library.StripHtml(t.Body)));
SqlConnection conn = new SqlConnection(details.SelectSingleNode("//conn").InnerText);
SqlCommand comm = new SqlCommand("Select memberId from forumSubscribers where forumId = @forumId", conn);
comm.Parameters.AddWithValue("@forumId", t.ParentId);
conn.Open();
SqlDataReader dr = comm.ExecuteReader();
while (dr.Read())
{
int mid = dr.GetInt32(0);
try
{
Member m = new Member(mid);
if (m.Id != t.MemberId
&& (m.getProperty("bugMeNot").Value.ToString() != "1"))
{
MailMessage mm = new MailMessage();
mm.Subject = subject;
mm.Body = body;
mm.To.Add(m.Email);
mm.From = from;
c.Send(mm);
}
}
catch(Exception e)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1,
"[Notifications] Error sending mail to " + mid.ToString() + " " + e.Message);
}
}
conn.Close();
}
catch (Exception e)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message);
}
return true;
}
}
}
@@ -0,0 +1,98 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using uForum.Businesslogic;
using System.Data.SqlClient;
using umbraco.cms.businesslogic.member;
using System.Web;
namespace NotificationsCore.NotificationTypes
{
public class NewForumTopicComment: Notification
{
public NewForumTopicComment()
{
}
public override bool SendNotification(System.Xml.XmlNode details, params object[] args)
{
try
{
SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText);
MailAddress from = new MailAddress(
details.SelectSingleNode("//from/email").InnerText,
details.SelectSingleNode("//from/name").InnerText);
string subject = details.SelectSingleNode("//subject").InnerText;
string body = details.SelectSingleNode("//body").InnerText;
Comment com = (Comment)args[0];
Topic t = new Topic(com.TopicId);
subject = string.Format(subject, t.Title);
Member s = (Member)args[2];
string domain = details.SelectSingleNode("//domain").InnerText;
body = string.Format(body,
t.Title,
"http://" + domain + args[1].ToString(), s.Text, HttpUtility.HtmlDecode(umbraco.library.StripHtml(com.Body)));
SqlConnection conn = new SqlConnection(details.SelectSingleNode("//conn").InnerText);
SqlCommand comm = new SqlCommand("Select memberId from forumTopicSubscribers where topicId = @topicId", conn);
comm.Parameters.AddWithValue("@topicId", t.Id);
conn.Open();
SqlDataReader dr = comm.ExecuteReader();
while (dr.Read())
{
int mid = dr.GetInt32(0);
try
{
Member m = new Member(mid);
if (m.Id != com.MemberId
&& m.getProperty("bugMeNot").Value.ToString() != "1")
{
MailMessage mm = new MailMessage();
mm.Subject = subject;
mm.Body = body;
mm.To.Add(m.Email);
mm.From = from;
c.Send(mm);
}
}
catch (Exception e)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1,
"[Notifications] Error sending mail to " + mid.ToString() + " " + e.Message);
}
}
conn.Close();
}
catch (Exception e)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications]" + e.Message);
}
return true;
}
}
}
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
namespace NotificationsCore.NotificationTypes
{
public class SampleNotification: Notification
{
public SampleNotification()
{
}
public override bool SendNotification(System.Xml.XmlNode details, params object[] args)
{
//int i = 0;
//while (i < 10)
//{
// HttpWebRequest request = (HttpWebRequest)
// WebRequest.Create("http://www.google.com");
// // execute the request
// HttpWebResponse response = (HttpWebResponse)
// request.GetResponse();
// i++;
//}
return true;
}
}
}
@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using umbraco.cms.businesslogic.member;
using System.Data.SqlClient;
using umbraco.cms.businesslogic.web;
namespace NotificationsCore.NotificationTypes
{
public class VoteForProjectReminder : Notification
{
public VoteForProjectReminder()
{
}
public override bool SendNotification(System.Xml.XmlNode details, params object[] args)
{
SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText);
MailAddress from = new MailAddress(
details.SelectSingleNode("//from/email").InnerText,
details.SelectSingleNode("//from/name").InnerText);
string subject = details.SelectSingleNode("//subject").InnerText;
string body = details.SelectSingleNode("//body").InnerText;
SqlConnection conn = new SqlConnection(details.SelectSingleNode("//conn").InnerText);
string select = @"SELECT projectId, memberId
FROM [projectDownload] d
where memberId not in
(select memberId from powersProject
where id = d.projectId and memberId = d.memberId)
and memberId != 0
and memberId not in
(select memberId from notificationVoteForProject
where projectId = d.projectId and memberId = d.memberId)
and timestamp < getdate() - 1";
SqlCommand comm = new SqlCommand(
select, conn);
conn.Open();
SqlDataReader dr = comm.ExecuteReader();
while (dr.Read())
{
int projectId = dr.GetInt32(0);
Member m = new Member(dr.GetInt32(1));
Document d = new Document(projectId);
if (m.getProperty("bugMeNot").Value.ToString() != "1")
{
MailMessage mm = new MailMessage();
mm.Subject = subject;
mm.Body = body;
mm.To.Add(m.Email);
mm.From = from;
c.Send(mm);
}
string insert =
@"Insert into notificationVoteForProject(projectId, memberID, timestamp)
values(@projectId, @memberId, getdate())";
SqlCommand icomm = new SqlCommand(insert, conn);
icomm.Parameters.AddWithValue("@projectId", projectId);
icomm.Parameters.AddWithValue("@memberId", m.Id);
icomm.ExecuteNonQuery();
}
conn.Close();
return true;
}
}
}
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using System.Data.SqlClient;
using umbraco.cms.businesslogic.member;
using umbraco.cms.businesslogic.web;
namespace NotificationsCore.NotificationTypes
{
public class VoteForProjectReminderSingle : Notification
{
public VoteForProjectReminderSingle()
{
}
public override bool SendNotification(System.Xml.XmlNode details, params object[] args)
{
try
{
SmtpClient c = new SmtpClient(details.SelectSingleNode("//smtp").InnerText);
MailAddress from = new MailAddress(
details.SelectSingleNode("//from/email").InnerText,
details.SelectSingleNode("//from/name").InnerText);
string subject = details.SelectSingleNode("//subject").InnerText;
string body = details.SelectSingleNode("//body").InnerText;
int projectId = int.Parse(args[0].ToString());
int memberId = int.Parse(args[1].ToString());
string domain = details.SelectSingleNode("//domain").InnerText;
Member m = new Member(memberId);
Document d = new Document(projectId);
body = string.Format(body,
d.Text,
"http://" + domain + args[2].ToString());
if (m.getProperty("bugMeNot").Value.ToString() != "1" &&
d.getProperty("owner").Value.ToString() != m.Id.ToString())
{
MailMessage mm = new MailMessage();
mm.Subject = subject;
mm.Body = body;
mm.To.Add(m.Email);
mm.From = from;
c.Send(mm);
}
SqlConnection conn = new SqlConnection(details.SelectSingleNode("//conn").InnerText);
conn.Open();
string insert =
@"Insert into notificationVoteForProject(projectId, memberID, timestamp)
values(@projectId, @memberId, getdate())";
SqlCommand icomm = new SqlCommand(insert, conn);
icomm.Parameters.AddWithValue("@projectId", projectId);
icomm.Parameters.AddWithValue("@memberId", memberId);
icomm.ExecuteNonQuery();
conn.Close();
}
catch (Exception e)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1,"[Notifications]" + e.Message);
}
return true;
}
}
}
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Notification")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Notification")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("df83d509-8920-49a4-a9e0-41665d8bfa42")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+52
View File
@@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
using System.Reflection;
using System.Xml;
namespace NotificationsCore
{
public class SheduledNotification
{
public string Name { get; set; }
public double Interval { get; set; }
public string Assembly { get; set; }
public string Type { get; set; }
public XmlNode Details { get; set; }
Timer timer = new Timer();
public SheduledNotification(string name, double interval, string assembly, string type, XmlNode details)
{
this.Name = name;
this.Interval = interval;
this.Assembly = assembly;
this.Type = type;
this.Details = details;
}
public void Start()
{
timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
timer.Interval = Interval;
timer.Enabled = true;
}
void timer_Elapsed(object sender, ElapsedEventArgs e)
{
string assemblyFile =
String.Format("{0}.dll", Assembly);
Assembly nAssembly = System.Reflection.Assembly.LoadFrom(assemblyFile);
Notification n =
(Notification)Activator.CreateInstance(
nAssembly.GetType(Type));
n.SendNotification(Details);
}
}
}
+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="url" value="http://dreamingofawhitechristmas.our.umbraco.org/umbraco/plugins/Notifications/SheduledTaskTrigger.aspx" />
<add key="interval" value="900000" />
<!--
<add key="configFile" value="C:\Users\Tim Geyssens\Documents\Visual Studio 2008\Umbraco\OUR\NotificationMailer\NotificationMailer.config"/>
-->
</appSettings>
</configuration>
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<notification name="New forum post" interval="200" assembly="temp" type="temp">
<from>
<name>Our umbraco</name>
<email>robot@umbraco.org</email>
</from>
<subject>There has been a new post</subject>
<body>There has been a new post</body>
</notification>
<notification name="Another forum post" interval="100" assembly="temp" type="temp">
<from>
<name>Our umbraco</name>
<email>robot@umbraco.org</email>
</from>
<subject>There has been a new post</subject>
<body>There has been a new post</body>
</notification>
</configuration>
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;
using System.Reflection;
using Notifications;
using System.Xml;
namespace NotificationMailer
{
public class NotificationExecuter
{
public string Name { get; set; }
public double Interval { get; set; }
public string Assembly { get; set; }
public string Type { get; set; }
public XmlNode Details { get; set; }
Timer timer = new Timer();
public NotificationExecuter(string name, double interval, string assembly, string type, XmlNode details)
{
this.Name = name;
this.Interval = interval;
this.Assembly = assembly;
this.Type = type;
this.Details = details;
}
public void Start()
{
timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
timer.Interval = Interval;
timer.Enabled = true;
}
void timer_Elapsed(object sender, ElapsedEventArgs e)
{
string assemblyFile =
String.Format("{0}.dll", Assembly);
Assembly nAssembly = System.Reflection.Assembly.LoadFrom(assemblyFile);
Notification n =
(Notification)Activator.CreateInstance(
nAssembly.GetType(Type));
n.SendNotification(Details);
}
}
}
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F41D51B7-3ECF-4C4C-955E-6E761345E18E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NotificationMailer</RootNamespace>
<AssemblyName>NotificationMailer</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="NotificationService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="NotificationService.Designer.cs">
<DependentUpon>NotificationService.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="ProjectInstaller.Designer.cs">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="NotificationService.resx">
<DependentUpon>NotificationService.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+40
View File
@@ -0,0 +1,40 @@
namespace NotificationMailer
{
partial class NotificationService
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
//
// NotificationService
//
this.ServiceName = "NotificationService";
}
#endregion
}
}
+88
View File
@@ -0,0 +1,88 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using System.Xml;
using System.Configuration;
using System.Threading;
using System.Net;
namespace NotificationMailer
{
public partial class NotificationService : ServiceBase
{
public NotificationService()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
System.Timers.Timer timer = new System.Timers.Timer();
timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
timer.Interval = double.Parse(ConfigurationSettings.AppSettings["interval"]);
timer.Enabled = true;
timer.Start();
//XmlDocument notifications = new XmlDocument();
//notifications.Load(ConfigurationSettings.AppSettings["configFile"]);
//XmlNode settings = notifications.SelectSingleNode("//global");
//XmlNodeList xnl = notifications.SelectNodes("//sheduled//notification");
//foreach (XmlNode node in xnl)
//{
// XmlDocument details = new XmlDocument();
// XmlNode cont = details.CreateElement("details");
// cont.AppendChild(details.ImportNode(settings, true));
// cont.AppendChild(details.ImportNode(node, true));
// details.AppendChild(cont);
// SheduledNotification n =
// new SheduledNotification(
// node.Attributes["name"].Value,
// double.Parse(node.Attributes["interval"].Value),
// node.Attributes["assembly"].Value,
// node.Attributes["type"].Value,
// details);
// Thread nThread = new Thread(new ThreadStart(n.Start));
// nThread.Start();
//}
}
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
HttpWebRequest request = (HttpWebRequest)
WebRequest.Create(ConfigurationSettings.AppSettings["url"]);
HttpWebResponse response = (HttpWebResponse)
request.GetResponse();
}
protected override void OnStop()
{
}
//public static string GetNodeValue(XmlNode n)
//{
// if (n == null || n.FirstChild == null)
// return string.Empty;
// return n.FirstChild.Value;
//}
}
}
+123
View File
@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ServiceProcess;
using System.Text;
namespace NotificationMailer
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ServiceBase[] ServicesToRun;
ServicesToRun = new ServiceBase[]
{
new NotificationService()
};
ServiceBase.Run(ServicesToRun);
}
}
}
+58
View File
@@ -0,0 +1,58 @@
namespace NotificationMailer
{
partial class ProjectInstaller
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.serviceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
this.serviceInstaller1 = new System.ServiceProcess.ServiceInstaller();
//
// serviceProcessInstaller1
//
this.serviceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
this.serviceProcessInstaller1.Password = null;
this.serviceProcessInstaller1.Username = null;
//
// serviceInstaller1
//
this.serviceInstaller1.ServiceName = "NotificationService";
this.serviceInstaller1.StartType = System.ServiceProcess.ServiceStartMode.Automatic;
//
// ProjectInstaller
//
this.Installers.AddRange(new System.Configuration.Install.Installer[] {
this.serviceProcessInstaller1,
this.serviceInstaller1});
}
#endregion
private System.ServiceProcess.ServiceProcessInstaller serviceProcessInstaller1;
private System.ServiceProcess.ServiceInstaller serviceInstaller1;
}
}
+19
View File
@@ -0,0 +1,19 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;
using System.Linq;
namespace NotificationMailer
{
[RunInstaller(true)]
public partial class ProjectInstaller : System.Configuration.Install.Installer
{
public ProjectInstaller()
{
InitializeComponent();
}
}
}
+129
View File
@@ -0,0 +1,129 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="serviceProcessInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="serviceInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>196, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NotificationMailer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NotificationMailer")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d9a67c91-946c-4774-b7d7-dc4f97a17a1d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.DataLayer;
namespace NotificationsWeb.BusinessLogic
{
public class Data
{
private static string _ConnString = umbraco.GlobalSettings.DbDSN;
private static ISqlHelper _sqlHelper;
public static ISqlHelper SqlHelper
{
get
{
if (_sqlHelper == null)
{
try
{
_sqlHelper = DataLayerHelper.CreateSqlHelper(_ConnString);
}
catch { }
}
return _sqlHelper;
}
}
}
}
+41
View File
@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace NotificationsWeb.BusinessLogic
{
public class Forum
{
public static void Subscribe(int forumId, int memberId)
{
if (!(BusinessLogic.Data.SqlHelper.ExecuteScalar<int>("SELECT 1 FROM forumSubscribers WHERE forumId = @forumId and memberId = @memberId",
BusinessLogic.Data.SqlHelper.CreateParameter("@forumId", forumId),
BusinessLogic.Data.SqlHelper.CreateParameter("@memberId", memberId)) > 0))
{
Data.SqlHelper.ExecuteNonQuery(
"INSERT INTO forumSubscribers (forumId, memberId) VALUES(@forumId, @memberId)",
Data.SqlHelper.CreateParameter("@forumId", forumId),
Data.SqlHelper.CreateParameter("@memberId", memberId));
}
}
public static void UnSubscribe(int forumId, int memberId)
{
Data.SqlHelper.ExecuteNonQuery(
"DELETE FROM forumSubscribers WHERE forumId = @forumId and memberId = @memberId",
Data.SqlHelper.CreateParameter("@forumId", forumId),
Data.SqlHelper.CreateParameter("@memberId", memberId));
}
public static void RemoveAllSubscriptions(int forumId)
{
Data.SqlHelper.ExecuteNonQuery(
"DELETE FROM forumSubscribers WHERE forumId = @forumId",
Data.SqlHelper.CreateParameter("@forumId", forumId));
}
}
}
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using uForum.Businesslogic;
namespace NotificationsWeb.BusinessLogic
{
public class ForumTopic
{
public static void Subscribe(int topicId, int memberId)
{
if(!(BusinessLogic.Data.SqlHelper.ExecuteScalar<int>("SELECT 1 FROM forumTopicSubscribers WHERE topicId = @topicId and memberId = @memberId",
BusinessLogic.Data.SqlHelper.CreateParameter("@topicId", topicId),
BusinessLogic.Data.SqlHelper.CreateParameter("@memberId", memberId)) > 0))
{
Data.SqlHelper.ExecuteNonQuery(
"INSERT INTO forumTopicSubscribers (topicId, memberId) VALUES(@topicId, @memberId)",
Data.SqlHelper.CreateParameter("@topicId", topicId),
Data.SqlHelper.CreateParameter("@memberId", memberId));
}
}
public static void UnSubscribe(int topicId, int memberId)
{
Data.SqlHelper.ExecuteNonQuery(
"DELETE FROM forumTopicSubscribers WHERE topicId = @topicId and memberId = @memberId",
Data.SqlHelper.CreateParameter("@topicId", topicId),
Data.SqlHelper.CreateParameter("@memberId", memberId));
}
public static List<uForum.Businesslogic.Forum> GetSubscribedForums(int memberId)
{
List<uForum.Businesslogic.Forum> lt = new List<uForum.Businesslogic.Forum>();
umbraco.DataLayer.IRecordsReader dr = Data.SqlHelper.ExecuteReader(
"SELECT forumId FROM forumSubscribers WHERE memberId = " + memberId.ToString()
);
while (dr.Read())
{
lt.Add(new uForum.Businesslogic.Forum(dr.GetInt("forumId")));
}
dr.Close();
dr.Dispose();
return lt;
}
public static List<Topic> GetSubscribedTopics(int memberId)
{
List<Topic> lt = new List<Topic>();
umbraco.DataLayer.IRecordsReader dr = Data.SqlHelper.ExecuteReader(
"SELECT topicId FROM forumTopicSubscribers WHERE memberId = " + memberId.ToString()
);
while (dr.Read())
{
lt.Add(new Topic(dr.GetInt("topicId")));
}
dr.Close();
return lt;
}
}
}
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace NotificationsWeb.BusinessLogic
{
public class ForumTopicSubsriber
{
public static void Subscribe(int topicId, int memberId)
{
umbraco.DataLayer.IRecordsReader dr =
Data.SqlHelper.ExecuteReader("SELECT FROM forumTopicSubscribers WHERE topicId = @topicId and memberId = @memberId",
Data.SqlHelper.CreateParameter("@topicId", topicId),
Data.SqlHelper.CreateParameter("@memberId", topicId));
if (!dr.Read())
{
Data.SqlHelper.ExecuteNonQuery(
"INSERT INTO forumTopicSubscribers (topicId, memberId) VALUES(@topicId, @memberId)",
Data.SqlHelper.CreateParameter("@topicId", topicId),
Data.SqlHelper.CreateParameter("@memberId", topicId));
}
}
public static void UnSubscribe(int topicId, int memberId)
{
Data.SqlHelper.ExecuteNonQuery(
"DELETE FROM forumTopicSubscribers WHERE topicId = @topicId and memberId = @memberId",
Data.SqlHelper.CreateParameter("@topicId", topicId),
Data.SqlHelper.CreateParameter("@memberId", topicId));
}
}
}
+31
View File
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
namespace NotificationsWeb
{
public class Config
{
private static string _path = umbraco.GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar;
private static string _filename = "Notification.config";
public static string AssemblyDir
{
get
{
return umbraco.GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "bin" + Path.DirectorySeparatorChar;
}
}
public static string ConfigurationFile
{
get
{
return _path + _filename;
}
}
}
}
+144
View File
@@ -0,0 +1,144 @@
using System;
using System.Collections.Generic;
using System.Text;
using uForum.Businesslogic;
using NotificationsCore;
using umbraco.presentation.nodeFactory;
using umbraco.cms.businesslogic.member;
namespace NotificationsWeb.EventHandlers
{
public class Forum : umbraco.BusinessLogic.ApplicationBase
{
public Forum()
{
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "NotificationsWeb.EventHandlers.Forum class events - starting");
Comment.AfterCreate += new EventHandler<CreateEventArgs>(Comment_AfterCreate);
Topic.AfterCreate += new EventHandler<CreateEventArgs>(Topic_AfterCreate);
uForum.Businesslogic.Forum.AfterCreate += new EventHandler<CreateEventArgs>(Forum_AfterCreate);
uForum.Businesslogic.Forum.BeforeDelete += new EventHandler<DeleteEventArgs>(Forum_BeforeDelete);
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "NotificationsWeb.EventHandlers.Forum class events - finishing");
}
void Forum_BeforeDelete(object sender, DeleteEventArgs e)
{
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Forum_BeforeDelete in NotificationsWeb.EventHandlers.Forum() class is starting");
BusinessLogic.Forum.RemoveAllSubscriptions(((uForum.Businesslogic.Forum)sender).Id);
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Forum_BeforeDelete in NotificationsWeb.EventHandlers.Forum() class is finishing");
}
void Forum_AfterCreate(object sender, CreateEventArgs e)
{
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Forum_AfterCreate in NotificationsWeb.EventHandlers.Forum() class is starting");
//subscribe project owner to created forum
uForum.Businesslogic.Forum f = (uForum.Businesslogic.Forum)sender;
Node n = new Node(f.ParentId);
if (n.NodeTypeAlias == "Project")
{
NotificationsWeb.BusinessLogic.Forum.Subscribe(
f.Id, Convert.ToInt32(n.GetProperty("owner").Value));
}
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "Forum_AfterCreate in NotificationsWeb.EventHandlers.Forum() class is finishing");
}
void Comment_AfterCreate(object sender, uForum.Businesslogic.CreateEventArgs e)
{
Comment c = (Comment)sender;
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, c.Id, "Comment_AfterCreate in NotificationsWeb.EventHandlers.Forum() class is starting");
NotificationsWeb.BusinessLogic.ForumTopic.Subscribe
(c.TopicId, c.MemberId);
//send notifications
InstantNotification not = new InstantNotification();
Member m = new Member(c.MemberId);
not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewComment", c, NiceCommentUrl(c.TopicId,c,10),m);
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, c.Id, "Comment_AfterCreate in NotificationsWeb.EventHandlers.Forum() class is finishing");
}
private static string NiceCommentUrl(int topicId, Comment c, int itemsPerPage)
{
string url = uForum.Library.Xslt.NiceTopicUrl(topicId);
if (!string.IsNullOrEmpty(url))
{
int position = c.Position - 1;
int page = (int)(position / itemsPerPage);
url += "?p=" + page.ToString() + "#comment" + c.Id.ToString();
}
return url;
}
void Topic_AfterCreate(object sender, CreateEventArgs e)
{
//subscribe topic created to notification
Topic t = (Topic)sender;
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, t.Id, "Topic_AfterCreate in NotificationsWeb.EventHandlers.Forum() class is starting");
NotificationsWeb.BusinessLogic.ForumTopic.Subscribe
(t.Id, t.MemberId);
Member m = new Member(t.MemberId);
//send notification
InstantNotification not = new InstantNotification();
not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewTopic", t, NiceTopicUrl(t),m);
//WB added to show these events are firing...
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, t.Id, "Topic_AfterCreate in NotificationsWeb.EventHandlers.Forum() class is finishing");
}
private static string NiceTopicUrl(Topic t)
{
if (t.Exists)
{
string _url = umbraco.library.NiceUrl(t.ParentId);
if (umbraco.GlobalSettings.UseDirectoryUrls)
{
return "/" + _url.Trim('/') + "/" + t.Id.ToString() + "-" + t.UrlName;
}
else
{
return "/" + _url.Substring(0, _url.LastIndexOf('.')).Trim('/') + "/" + t.Id.ToString() + "-" + t.UrlName + ".aspx";
}
}
else
{
return "";
}
}
}
}
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.web;
using NotificationsCore;
namespace NotificationsWeb.EventHandlers
{
public class Test: ApplicationBase
{
public Test()
{
//Document.AfterPublish += new Document.PublishEventHandler(Document_AfterPublish);
}
void Document_AfterPublish(Document sender, umbraco.cms.businesslogic.PublishEventArgs e)
{
InstantNotification not = new InstantNotification();
not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "NewComment", sender);
}
}
}
+69
View File
@@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
namespace NotificationsWeb.Library
{
public class Rest
{
public static string SubscribeToForumTopic(int topicId)
{
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
if (_currentMember > 0)
{
BusinessLogic.ForumTopic.Subscribe(topicId, _currentMember);
return "true";
}
return "false";
}
public static string UnSubscribeFromForumTopic(int topicId)
{
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
if (_currentMember > 0)
{
BusinessLogic.ForumTopic.UnSubscribe(topicId, _currentMember);
return "true";
}
return "false";
}
public static string SubscribeToForum(int forumId)
{
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
if (_currentMember > 0)
{
BusinessLogic.Forum.Subscribe(forumId, _currentMember);
return "true";
}
return "false";
}
public static string UnSubscribeFromForum(int forumId)
{
int _currentMember = HttpContext.Current.User.Identity.IsAuthenticated ? (int)Membership.GetUser().ProviderUserKey : 0;
if (_currentMember > 0)
{
BusinessLogic.Forum.UnSubscribe(forumId, _currentMember);
return "true";
}
return "false";
}
}
}
+55
View File
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.XPath;
using System.Xml;
using NotificationsWeb.BusinessLogic;
namespace NotificationsWeb.Library
{
public class Xslt
{
public static bool IsSubscribedToForum(int forumId, int memberId)
{
return (BusinessLogic.Data.SqlHelper.ExecuteScalar<int>("SELECT 1 FROM forumSubscribers WHERE forumId = @forumId and memberId = @memberId",
BusinessLogic.Data.SqlHelper.CreateParameter("@forumId", forumId),
BusinessLogic.Data.SqlHelper.CreateParameter("@memberId", memberId)) > 0);
}
public static bool IsSubscribedToForumTopic(int topicId, int memberId)
{
return (BusinessLogic.Data.SqlHelper.ExecuteScalar<int>("SELECT 1 FROM forumTopicSubscribers WHERE topicId = @topicId and memberId = @memberId",
BusinessLogic.Data.SqlHelper.CreateParameter("@topicId", topicId),
BusinessLogic.Data.SqlHelper.CreateParameter("@memberId", memberId)) > 0);
}
public static XPathNodeIterator SubscribedForums(int memberId)
{
XmlDocument xd = new XmlDocument();
XmlNode x = xd.CreateElement("forums");
List<uForum.Businesslogic.Forum> forums = ForumTopic.GetSubscribedForums(memberId);
foreach (uForum.Businesslogic.Forum f in forums)
{
x.AppendChild(f.ToXml(xd,false));
}
return x.CreateNavigator().Select(".");
}
public static XPathNodeIterator SubscribedTopics(int memberId)
{
XmlDocument xd = new XmlDocument();
XmlNode x = xd.CreateElement("topics");
List<uForum.Businesslogic.Topic> topics = ForumTopic.GetSubscribedTopics(memberId);
foreach (uForum.Businesslogic.Topic t in topics)
{
x.AppendChild(t.ToXml(xd));
}
return x.CreateNavigator().Select(".");
}
}
}
+116
View File
@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6CF53D68-BD81-47BB-8F56-350A1B04F114}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NotificationsWeb</RootNamespace>
<AssemblyName>NotificationsWeb</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="businesslogic">
<HintPath>..\dependencies\4.11.2\businesslogic.dll</HintPath>
</Reference>
<Reference Include="cms">
<HintPath>..\dependencies\4.11.2\cms.dll</HintPath>
</Reference>
<Reference Include="interfaces">
<HintPath>..\dependencies\4.11.2\interfaces.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Mobile" />
<Reference Include="System.Xml.Linq" />
<Reference Include="umbraco">
<HintPath>..\dependencies\4.11.2\umbraco.dll</HintPath>
</Reference>
<Reference Include="umbraco.DataLayer">
<HintPath>..\dependencies\4.11.2\umbraco.DataLayer.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="BusinessLogic\Data.cs" />
<Compile Include="BusinessLogic\Forum.cs" />
<Compile Include="BusinessLogic\ForumTopic.cs" />
<Compile Include="Config.cs" />
<Compile Include="EventHandlers\Forum.cs" />
<Compile Include="Library\Rest.cs" />
<Compile Include="Library\Xslt.cs" />
<Compile Include="Pages\SheduledTaskTrigger.aspx.cs">
<DependentUpon>SheduledTaskTrigger.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Pages\SheduledTaskTrigger.aspx.designer.cs">
<DependentUpon>SheduledTaskTrigger.aspx</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Notification\Notification.csproj">
<Project>{80E5F59D-A7A0-4CEE-AEB6-6C626C44B2B2}</Project>
<Name>Notification</Name>
</ProjectReference>
<ProjectReference Include="..\uForum\uForum.csproj">
<Project>{547C2D0D-1B55-493B-AE0B-E031A5B8EE77}</Project>
<Name>uForum</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Pages\SheduledTaskTrigger.aspx" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<ProjectExtensions />
</Project>
@@ -0,0 +1 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SheduledTaskTrigger.aspx.cs" Inherits="NotificationsWeb.Pages.SheduledTaskTriggerTest" %>
@@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using NotificationsCore;
using uForum.Businesslogic;
using umbraco.cms.businesslogic.web;
namespace NotificationsWeb.Pages
{
public partial class SheduledTaskTriggerTest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications] sheduled trigger");
SendMarkAsSolutionReminders();
SendProjectVoteReminders();
}
private void SendMarkAsSolutionReminders()
{
// Mark As Solution Reminder
using (SqlConnection conn = new SqlConnection(umbraco.GlobalSettings.DbDSN))
{
try
{
string select = @"select id, memberId from forumTopics where answer = 0
and created < getdate() - 7
and created > '2012-09-16 00:00:00'
and replies > 0
and id not in (select topicId from notificationMarkAsSolution)
order by created desc;";
SqlCommand comm = new SqlCommand(
select, conn);
conn.Open();
SqlDataReader dr = comm.ExecuteReader();
while (dr.Read())
{
InstantNotification not = new InstantNotification();
int topicId = dr.GetInt32(0);
int memberId = dr.GetInt32(1);
Topic t = new Topic(topicId);
not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "MarkAsSolutionReminderSingle", topicId, memberId, NiceTopicUrl(t));
}
}
catch (Exception ex)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications] " + ex.Message);
}
finally
{
if(conn != null)
conn.Close();
}
}
}
private void SendProjectVoteReminders()
{
//Project vote
using (SqlConnection conn = new SqlConnection(umbraco.GlobalSettings.DbDSN))
{
try
{
string selectp = @"SELECT projectId, memberId
FROM [projectDownload] d
where memberId not in
(select memberId from powersProject
where id = d.projectId and memberId = d.memberId)
and memberId != 0
and memberId not in
(select memberId from notificationVoteForProject
where projectId = d.projectId and memberId = d.memberId)
and timestamp < getdate() - 1
and timestamp > '2012-09-22 00:00:00'";
SqlCommand commp = new SqlCommand(
selectp, conn);
conn.Open();
SqlDataReader drp = commp.ExecuteReader();
while (drp.Read())
{
InstantNotification not = new InstantNotification();
int projectId = drp.GetInt32(0);
int memberId = drp.GetInt32(1);
Document d = new Document(projectId);
not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "VoteForProjectReminderSingle", projectId, memberId, umbraco.library.NiceUrl(d.Id));
}
}
catch (Exception ex)
{
umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "[Notifications] " + ex.Message);
}
finally
{
if(conn != null)
conn.Close();
}
}
}
private static string NiceTopicUrl(Topic t)
{
if (t.Exists)
{
string _url = umbraco.library.NiceUrl(t.ParentId);
if (umbraco.GlobalSettings.UseDirectoryUrls)
{
return "/" + _url.Trim('/') + "/" + t.Id.ToString() + "-" + t.UrlName;
}
else
{
return "/" + _url.Substring(0, _url.LastIndexOf('.')).Trim('/') + "/" + t.Id.ToString() + "-" + t.UrlName + ".aspx";
}
}
else
{
return "";
}
}
}
}
@@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace NotificationsWeb.Pages {
public partial class SheduledTaskTriggerTest {
}
}
@@ -0,0 +1,17 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SheduledTaskTriggerTest.aspx.cs" Inherits="NotificationsWeb.Pages.SheduledTaskTriggerTest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
</div>
</form>
</body>
</html>
@@ -0,0 +1,116 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using NotificationsCore;
using uForum.Businesslogic;
using umbraco.cms.businesslogic.web;
namespace NotificationsWeb.Pages
{
public partial class SheduledTaskTriggerTest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
// Mark As Solution Reminder
SqlConnection conn = new SqlConnection(umbraco.GlobalSettings.DbDSN);
string select = @"select id, memberId from forumTopics where answer = 0
and created < getdate() - 7
and created > '2010-06-10 00:00:00'
and id not in (select topicId from notificationMarkAsSolution)
order by created desc;";
SqlCommand comm = new SqlCommand(
select, conn);
conn.Open();
SqlDataReader dr = comm.ExecuteReader();
while (dr.Read())
{
InstantNotification not = new InstantNotification();
int topicId = dr.GetInt32(0);
int memberId = dr.GetInt32(1);
Topic t = new Topic(topicId);
not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "MarkAsSolutionReminderSingle", topicId, memberId, NiceTopicUrl(t));
}
conn.Close();
//Project vote
string selectp = @"SELECT projectId, memberId
FROM [projectDownload] d
where memberId not in
(select memberId from powersProject
where id = d.projectId and memberId = d.memberId)
and memberId != 0
and memberId not in
(select memberId from notificationVoteForProject
where projectId = d.projectId and memberId = d.memberId)
and timestamp < getdate() - 1";
SqlCommand commp = new SqlCommand(
selectp, conn);
conn.Open();
SqlDataReader drp = commp.ExecuteReader();
while (drp.Read())
{
InstantNotification not = new InstantNotification();
int projectId = drp.GetInt32(0);
int memberId = drp.GetInt32(1);
Document d = new Document(projectId);
not.Invoke(Config.ConfigurationFile, Config.AssemblyDir, "VoteForProjectReminderSingle", projectId, memberId, umbraco.library.NiceUrl(d.Id));
}
conn.Close();
}
private static string NiceTopicUrl(Topic t)
{
if (t.Exists)
{
string _url = umbraco.library.NiceUrl(t.ParentId);
if (umbraco.GlobalSettings.UseDirectoryUrls)
{
return "/" + _url.Trim('/') + "/" + t.Id.ToString() + "-" + t.UrlName;
}
else
{
return "/" + _url.Substring(0, _url.LastIndexOf('.')).Trim('/') + "/" + t.Id.ToString() + "-" + t.UrlName + ".aspx";
}
}
else
{
return "";
}
}
}
}
@@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace NotificationsWeb.Pages {
public partial class SheduledTaskTriggerTest {
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// Button1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button Button1;
}
}
@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("NotificationsWeb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NotificationsWeb")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+10
View File
@@ -0,0 +1,10 @@
<browsers>
<browser refID="Default">
<controlAdapters>
<adapter controlType="System.Web.UI.HtmlControls.HtmlForm"
adapterType="umbraco.presentation.urlRewriter.FormRewriterControlAdapter" />
</controlAdapters>
</browser>
</browsers>
@@ -0,0 +1,26 @@
<browsers>
<!--
Browser capability file for the w3c validator
sample UA: "W3C_Validator/1.305.2.148 libwww-perl/5.803"
-->
<browser id="w3cValidator" parentID="default">
<identification>
<userAgent match="^W3C_Validator" />
</identification>
<capture>
<userAgent match="^W3C_Validator/(?'version'(?'major'\d+)(?'minor'\.\d+)\w*).*" />
</capture>
<capabilities>
<capability name="browser" value="w3cValidator" />
<capability name="majorversion" value="${major}" />
<capability name="minorversion" value="${minor}" />
<capability name="version" value="${version}" />
<capability name="w3cdomversion" value="1.0" />
<capability name="xml" value="true" />
<capability name="tagWriter" value="System.Web.UI.HtmlTextWriter" />
</capabilities>
</browser>
</browsers>
+14
View File
@@ -0,0 +1,14 @@
<access>
<page id="1057" loginPage="4729" noRightsPage="4729" simple="False">
<group id="standard" />
</page>
<page id="6772" loginPage="1056" noRightsPage="1056" simple="False">
<group id="standard" />
</page>
<page id="8283" loginPage="1056" noRightsPage="4729" simple="False">
<group id="wiki editor" />
</page>
<page id="8615" loginPage="1056" noRightsPage="4729" simple="False">
<group id="wiki editor" />
</page>
</access>
+11
View File
@@ -0,0 +1,11 @@
<access>
<page id="1057" loginPage="4729" noRightsPage="4729" simple="False">
<group id="standard" />
</page>
<page id="6772" loginPage="1056" noRightsPage="1056" simple="False">
<group id="standard" />
</page>
<page id="8283" loginPage="1056" noRightsPage="4729" simple="False">
<group id="wiki editor" />
</page>
</access>
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="1" version="NewMacros" url="NewMacros" name="NewMacros" folder="670134fc-198c-46e6-a785-6c45b4f1bb9b" packagepath="~/media/created-packages/NewMacros_NewMacros.zip" repositoryGuid="" packageGuid="99b813d2-a256-4c09-b7f2-f2a5ed4362c6" hasUpdate="False">
<license url="http://www.opensource.org/licenses/mit-license.php">MIT license</license>
<author url="NewMacros">NewMacros</author>
<readme><![CDATA[NewMacros]]></readme>
<actions>
</actions>
<datatypes>
</datatypes>
<content nodeId="" loadChildNodes="False">
</content>
<templates>8231,8246,8222,8221,8281,8247,8229,8230,8225,8253,8212,8244</templates>
<stylesheets>
</stylesheets>
<documenttypes>
</documenttypes>
<macros>85,77,81,86,78,80,83,82,84,76,79,87</macros>
<files>
</files>
<languages>
</languages>
<dictionaryitems>
</dictionaryitems>
<loadcontrol>
</loadcontrol>
</package>
<package id="2" version="" url="" name="Repository - Popular Packages" folder="a7c8734a-e5fc-4f36-b6e3-61d06d47e999" packagepath="" repositoryGuid="" packageGuid="337046de-b5e3-4088-8c50-971bc4262586" hasUpdate="false" enableSkins="false" skinRepoGuid="">
<license url="http://www.opensource.org/licenses/mit-license.php">MIT license</license>
<author url="">
</author>
<readme>
</readme>
<actions>
</actions>
<datatypes>
</datatypes>
<content nodeId="" loadChildNodes="false">
</content>
<templates>
</templates>
<stylesheets>
</stylesheets>
<documenttypes>
</documenttypes>
<macros>
</macros>
<files>
</files>
<languages>
</languages>
<dictionaryitems>
</dictionaryitems>
<loadcontrol>
</loadcontrol>
</package>
<package id="3" version="1.0.10.20202.1" url="http://our.umbraco.org" name="NielskShowExport" folder="e12a7e06-017a-4d4c-b6dc-8151073515bb" packagepath="~/media/created-packages/NielskShowExport_1.0.10.20202.1.zip" repositoryGuid="" packageGuid="840c7bb7-8300-4c6e-a6a7-4448aeb80c77" hasUpdate="False" enableSkins="False" skinRepoGuid="00000000-0000-0000-0000-000000000000">
<license url="http://www.opensource.org/licenses/mit-license.php">MIT license</license>
<author url="http://sdjklskjaskl">Kong</author>
<readme><![CDATA[Hest]]></readme>
<actions>
</actions>
<datatypes>
</datatypes>
<content nodeId="1113" loadChildNodes="True">
</content>
<templates>
</templates>
<stylesheets>
</stylesheets>
<documenttypes>1110,1115,5741,1048</documenttypes>
<macros>
</macros>
<files>
</files>
<languages>
</languages>
<dictionaryitems>
</dictionaryitems>
<loadcontrol>
</loadcontrol>
</package>
</packages>
@@ -0,0 +1,396 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="1" version="1" url="" name="ASP.NET Security Vulnerability Patch" folder="2b94f9a6-bb69-4dc0-886e-96bd69257866" packagepath="" repositoryGuid="" packageGuid="" hasUpdate="False">
<license url="http://www.opensource.org/licenses/mit-license.php">None</license>
<author url="http://umbraco.org">Umbraco Corp</author>
<readme><![CDATA[
<p>
This package will check if your site is open to the ASP.NET security vulnerability described here: <br/> <a href='http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx' target='_blank'>http://weblogs.asp.net/scottgu/archive/2010/09/18/important-asp-net-security-vulnerability.aspx</a><br/>
and it will try to apply the workaround or provide details on how to execute the workaround manually.
</p>
]]></readme>
<actions>
</actions>
<datatypes>
</datatypes>
<content nodeId="" loadChildNodes="False">
</content>
<templates>
</templates>
<stylesheets>
</stylesheets>
<documenttypes>
</documenttypes>
<macros>
</macros>
<files>
<file>/bin/Umbraco.PoetPatcher.dll</file>
<file>/umbraco/plugins/PoetPatcher/CustomError.aspx</file>
<file>/umbraco/plugins/PoetPatcher/Guide.pdf</file>
<file>/umbraco/plugins/PoetPatcher/patch.ascx</file>
</files>
<languages>
</languages>
<dictionaryitems>
</dictionaryitems>
<loadcontrol>
</loadcontrol>
</package>
<package id="2" version="1.1.6" url="" name="Umbraco Contour" folder="b0a2dcd8-5b91-4fd7-b6bc-f16225b8aae5" packagepath="" repositoryGuid="65194810-1f85-11dd-bd0b-0800200c9a66" packageGuid="6da629d5-177a-4ace-875b-a06b13ccec48" hasUpdate="False">
<license url="http://www.opensource.org/licenses/mit-license.php">Umbraco Commercial License</license>
<author url="http://umbraco.org">Umbraco Corp</author>
<readme><![CDATA[
<p>Thank you for installing Contour - the tool that makes creating contact forms, entry forms and questionnaires just as easy as using Word.</p>
<p>IMPORTANT: This installer will need modify rights to folders: /bin, /umbraco, /usercontrols and the web.config,
as well as be allowed to create tables in the database to be able to perform the following changes:</p>
<ul>
<li>Install the Contour Database schema</li>
<li>Modify the web.config if needed</li>
<li>Add the contour application to the current user</li>
<li>Add the Contour xslt library</li>
<li>Modify the /umbraco/config/create/ui.xml file</li>
</ul>
<p>
If your permissions or other settings is in conflict with the above changes, we advice you to use the manual installation which is available
from the same location you downloaded this package from.
</p>
]]></readme>
<actions>
<Action runat="install" alias="addApplication" appName="Umbraco Contour" appAlias="contour" appIcon="contour.png" />
<Action runat="install" alias="addApplicationTree" silent="false" initialize="true" sortOrder="0" applicationAlias="contour" treeAlias="forms" treeTitle="Forms" iconOpened="legacy" iconClosed="legacy" assemblyName="Umbraco.Forms.UI" treeHandlerType="Trees.LoadForm" action="" />
<Action runat="install" alias="addApplicationTree" silent="false" initialize="true" sortOrder="1" applicationAlias="contour" treeAlias="formdatasources" treeTitle="Data Sources" iconOpened="legacy" iconClosed="legacy" assemblyName="Umbraco.Forms.UI" treeHandlerType="Trees.LoadDataSource" action="" />
<Action runat="install" alias="addApplicationTree" silent="false" initialize="true" sortOrder="2" applicationAlias="contour" treeAlias="formprevaluesource" treeTitle="Prevalue Sources" iconOpened="legacy" iconClosed="legacy" assemblyName="Umbraco.Forms.UI" treeHandlerType="Trees.LoadPreValueSource" action="" />
<Action runat="install" alias="addApplicationTree" silent="false" initialize="true" sortOrder="5" applicationAlias="users" treeAlias="formssecurity" treeTitle="Contour security" iconOpened="legacy" iconClosed="legacy" assemblyName="Umbraco.Forms.UI" treeHandlerType="Trees.LoadFormsSecurity" action="" />
<Action runat="install" alias="addXsltExtension" assembly="/bin/Umbraco.Forms.Core" type="Umbraco.Forms.Library" extensionAlias="umbraco.contour" />
<Action runat="install" alias="AddToLanguageFile" key="contour" area="sections" language="en">Umbraco Contour</Action>
<Action runat="install" alias="ContourUninstall" />
</actions>
<datatypes>
</datatypes>
<content nodeId="" loadChildNodes="False">
</content>
<templates>
</templates>
<stylesheets>
</stylesheets>
<documenttypes>
</documenttypes>
<macros>89</macros>
<files>
<file>/bin/AjaxControlToolkit.dll</file>
<file>/bin/Fizzler.dll</file>
<file>/bin/Fizzler.Systems.HtmlAgilityPack.dll</file>
<file>/bin/HtmlAgilityPack.dll</file>
<file>bin/Umbraco.Forms.Core.dll</file>
<file>/bin/Umbraco.Forms.Core.pdb</file>
<file>/bin/Umbraco.Forms.UI.dll</file>
<file>/bin/Umbraco.Forms.UI.pdb</file>
<file>/bin/Umbraco.Licensing.dll</file>
<file>/umbraco/images/tray/contour.png</file>
<file>/umbraco/images/umbraco/icon_archive.png</file>
<file>/umbraco/images/umbraco/icon_datasource.gif</file>
<file>/umbraco/images/umbraco/icon_entries.gif</file>
<file>/umbraco/images/umbraco/icon_exportform.gif</file>
<file>/umbraco/images/umbraco/icon_form.gif</file>
<file>/umbraco/images/umbraco/icon_importform.gif</file>
<file>/umbraco/images/umbraco/icon_prevaluesource.gif</file>
<file>/umbraco/images/umbraco/icon_workflow.gif</file>
<file>/umbraco/plugins/umbracoContour/css/img/add.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/add_small.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/bullet_arrow_down.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/bullet_arrow_up.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/contextMenuBg.gif</file>
<file>/umbraco/plugins/umbracoContour/css/img/copy_small.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/datasource_small.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/delete.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/delete_small.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/edit.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/edit_small.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/entries.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/options.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/workflow.png</file>
<file>/umbraco/plugins/umbracoContour/css/img/x.png</file>
<file>/umbraco/plugins/umbracoContour/css/datatables.css</file>
<file>/umbraco/plugins/umbracoContour/css/dd.css</file>
<file>/umbraco/plugins/umbracoContour/css/dd_arrow.gif</file>
<file>/umbraco/plugins/umbracoContour/css/defaultform.css</file>
<file>/umbraco/plugins/umbracoContour/css/dialogs.css</file>
<file>/umbraco/plugins/umbracoContour/css/style.css</file>
<file>/umbraco/plugins/umbracoContour/css/TableTools.css</file>
<file>/umbraco/plugins/umbracoContour/images/fieldtypes/checkbox.png</file>
<file>/umbraco/plugins/umbracoContour/images/fieldtypes/checkboxlist.png</file>
<file>/umbraco/plugins/umbracoContour/images/fieldtypes/datepicker.png</file>
<file>/umbraco/plugins/umbracoContour/images/fieldtypes/dropdownlist.png</file>
<file>/umbraco/plugins/umbracoContour/images/fieldtypes/hiddenfield.png</file>
<file>/umbraco/plugins/umbracoContour/images/fieldtypes/passwordfield.png</file>
<file>/umbraco/plugins/umbracoContour/images/fieldtypes/radiobuttonlist.png</file>
<file>/umbraco/plugins/umbracoContour/images/fieldtypes/textarea.png</file>
<file>/umbraco/plugins/umbracoContour/images/fieldtypes/textfield.png</file>
<file>/umbraco/plugins/umbracoContour/images/fieldtypes/upload.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/approve.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/copy.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/copy_hover.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/csv.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/csv_hover.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/delete.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/edit.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/print.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/print_hover.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/xls.png</file>
<file>/umbraco/plugins/umbracoContour/images/recordviewericons/xls_hover.png</file>
<file>/umbraco/plugins/umbracoContour/images/back.png</file>
<file>/umbraco/plugins/umbracoContour/images/Calendar.png</file>
<file>/umbraco/plugins/umbracoContour/images/down-arrow.gif</file>
<file>/umbraco/plugins/umbracoContour/images/drag.png</file>
<file>/umbraco/plugins/umbracoContour/images/forward.png</file>
<file>/umbraco/plugins/umbracoContour/images/icon_bug.gif</file>
<file>/umbraco/plugins/umbracoContour/images/icon_export.gif</file>
<file>/umbraco/plugins/umbracoContour/images/icon_field.gif</file>
<file>/umbraco/plugins/umbracoContour/images/icon_fieldset.gif</file>
<file>/umbraco/plugins/umbracoContour/images/icon_page.gif</file>
<file>/umbraco/plugins/umbracoContour/images/icon_preview.gif</file>
<file>/umbraco/plugins/umbracoContour/images/icon_workflow.gif</file>
<file>/umbraco/plugins/umbracoContour/images/sort_asc.png</file>
<file>/umbraco/plugins/umbracoContour/images/sort_both.png</file>
<file>/umbraco/plugins/umbracoContour/images/sort_dsc.png</file>
<file>/umbraco/plugins/umbracoContour/scripts/designsurface.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/jquery-1.3.2.min.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/jquery-ui-1.7.2.custom.min.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/jquery.datatables.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/jquery.dd.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/jquery.inlineedit.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/jquery.jfeed.pack.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/jquery.simplemodal-1.2.3.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/jquery.validate.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/TableTools.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/umbracoforms.designsurface.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/umbracoforms.documentmapper.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/umbracoforms.editformpage.eventhandlers.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/umbracoforms.eventhandlers.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/umbracoforms.fieldmapper.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/umbracoforms.formpickercreateformdialog.eventhandlers.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/umbracoforms.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/umbracoforms.limitedmode.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/umbracoforms.readonlymode.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/ZeroClipboard.js</file>
<file>/umbraco/plugins/umbracoContour/scripts/ZeroClipboard.swf</file>
<file>/umbraco/plugins/umbracoContour/templates/Comment form.ucf</file>
<file>/umbraco/plugins/umbracoContour/templates/Contact form.ucf</file>
<file>/umbraco/plugins/umbracoContour/tinymce/insertForm.aspx</file>
<file>/umbraco/plugins/umbracoContour/webservices/RecordActions.aspx</file>
<file>/umbraco/plugins/umbracoContour/webservices/Records.aspx</file>
<file>/umbraco/plugins/umbracoContour/xslt/DataTables_json.xslt</file>
<file>/umbraco/plugins/umbracoContour/xslt/excel.xslt</file>
<file>/umbraco/plugins/umbracoContour/xslt/Html.xslt</file>
<file>/umbraco/plugins/umbracoContour/xslt/postAsXmlSample.xslt</file>
<file>/umbraco/plugins/umbracoContour/xslt/sendXsltEmailSample.xslt</file>
<file>/umbraco/plugins/umbracoContour/xslt/xml.xslt</file>
<file>/umbraco/plugins/umbracoContour/Analyzer.aspx</file>
<file>/umbraco/plugins/umbracoContour/archiveForm.aspx</file>
<file>/umbraco/plugins/umbracoContour/createForm.ascx</file>
<file>/umbraco/plugins/umbracoContour/createFormFromDataSourceDialog.aspx</file>
<file>/umbraco/plugins/umbracoContour/Designer.asmx</file>
<file>/umbraco/plugins/umbracoContour/editDataSource.aspx</file>
<file>/umbraco/plugins/umbracoContour/editForm.aspx</file>
<file>/umbraco/plugins/umbracoContour/editFormEntries.aspx</file>
<file>/umbraco/plugins/umbracoContour/editFormsSecurity.aspx</file>
<file>/umbraco/plugins/umbracoContour/editFormWorkflows.aspx</file>
<file>/umbraco/plugins/umbracoContour/editPrevalueProvider.aspx</file>
<file>/umbraco/plugins/umbracoContour/editPrevalues.aspx</file>
<file>/umbraco/plugins/umbracoContour/editPrevalueSource.aspx</file>
<file>/umbraco/plugins/umbracoContour/editWorkflow.aspx</file>
<file>/umbraco/plugins/umbracoContour/editWorkflowDialog.aspx</file>
<file>/umbraco/plugins/umbracoContour/executeRecordAction.aspx</file>
<file>/umbraco/plugins/umbracoContour/exportForm.aspx</file>
<file>/umbraco/plugins/umbracoContour/ExportFormEntries.aspx</file>
<file>/umbraco/plugins/umbracoContour/exportFormEntriesDialog.aspx</file>
<file>/umbraco/plugins/umbracoContour/FeedProxy.aspx</file>
<file>/umbraco/plugins/umbracoContour/FileProxy.aspx</file>
<file>/umbraco/plugins/umbracoContour/formPickerChooseFormDialog.aspx</file>
<file>/umbraco/plugins/umbracoContour/formPickerCreateFormDialog.aspx</file>
<file>/umbraco/plugins/umbracoContour/formPickerDialog.aspx</file>
<file>/umbraco/plugins/umbracoContour/Forms.asmx</file>
<file>/umbraco/plugins/umbracoContour/FormsDashboard.ascx</file>
<file>/umbraco/plugins/umbracoContour/importForm.aspx</file>
<file>/umbraco/plugins/umbracoContour/previewFormDialog.aspx</file>
<file>/umbraco/plugins/umbracoContour/test.asmx</file>
<file>/umbraco/plugins/umbracoContour/UmbracoContour.config</file>
<file>/umbraco/plugins/umbracoContour/Workflows.asmx</file>
<file>/umbraco/xslt/templates/Schema2/UmbracoContourListComments.xslt</file>
<file>/umbraco/xslt/templates/UmbracoContourListComments.xslt</file>
<file>/usercontrols/umbracoContour/EditForm.ascx</file>
<file>/usercontrols/umbracoContour/Installer.ascx</file>
<file>/usercontrols/umbracoContour/RenderForm.ascx</file>
</files>
<languages>
</languages>
<dictionaryitems>
</dictionaryitems>
<loadcontrol>
</loadcontrol>
</package>
<package id="3" version="2.0 Maintance Release 1" url="" name="Umbraco Courier" folder="a1738ace-22a3-48c1-a774-4d04b0e8afd1" packagepath="" repositoryGuid="" packageGuid="" hasUpdate="False" enableSkins="False" skinRepoGuid="00000000-0000-0000-0000-000000000000">
<license url="http://www.opensource.org/licenses/mit-license.php">Umbraco Commercial License</license>
<author url="http://umbraco.org">Umbraco HQ</author>
<readme><![CDATA[Umbraco Courier 2 redefines the Umbraco deployment process giving you the power to deploy your website changes using only a right click.
Courier 2 compares, transfers and merges your content, document types, templates, media, media types, macros, CSS, images and scripts without
you having to lift more than one finger.
With a new, more powerful deployment engine Courier 2 will take away the headaches of website deployments.
Notice, this is a release candidate, which will expire on June 30th
]]></readme>
<actions>
<Action runat="install" alias="addApplication" appName="Umbraco Courier" appAlias="courier" appIcon="courier.jpg" />
<Action runat="install" alias="addApplicationTree" silent="false" initialize="true" sortOrder="0" applicationAlias="courier" treeAlias="repositories" treeTitle="Repositories" iconOpened="legacy" iconClosed="legacy" assemblyName="Umbraco.Courier.UI" treeHandlerType="Trees.LoadRepositories" action="" />
<Action runat="install" alias="addApplicationTree" silent="false" initialize="true" sortOrder="0" applicationAlias="courier" treeAlias="revisions" treeTitle="Revisions" iconOpened="legacy" iconClosed="legacy" assemblyName="Umbraco.Courier.UI" treeHandlerType="Trees.LoadRevisions" action="" />
<Action runat="install" alias="addApplicationTree" silent="false" initialize="true" sortOrder="5" applicationAlias="users" treeAlias="courierSecurity" treeTitle="Courier security" iconOpened="legacy" iconClosed="legacy" assemblyName="Umbraco.Courier.UI" treeHandlerType="Trees.LoadCourierSecurity" action="" />
</actions>
<datatypes>
</datatypes>
<content nodeId="" loadChildNodes="False">
</content>
<templates>
</templates>
<stylesheets>
</stylesheets>
<documenttypes>
</documenttypes>
<macros>
</macros>
<files>
<file>/bin/Antlr3.Runtime.dll</file>
<file>/bin/Castle.Core.dll</file>
<file>/bin/Castle.Core.xml</file>
<file>/bin/Castle.DynamicProxy2.dll</file>
<file>/bin/Castle.DynamicProxy2.xml</file>
<file>/bin/FluentNHibernate.dll</file>
<file>/bin/FluentNHibernate.pdb</file>
<file>/bin/FluentNHibernate.xml</file>
<file>/bin/Iesi.Collections.dll</file>
<file>/bin/log4net.dll</file>
<file>/bin/NHibernate.ByteCode.Castle.dll</file>
<file>/bin/NHibernate.ByteCode.Castle.xml</file>
<file>/bin/NHibernate.dll</file>
<file>/bin/NHibernate.xml</file>
<file>bin/Umbraco.Courier.Core.dll</file>
<file>/bin/Umbraco.Courier.Core.pdb</file>
<file>/bin/Umbraco.Courier.DataResolvers.dll</file>
<file>/bin/Umbraco.Courier.DataResolvers.pdb</file>
<file>/bin/Umbraco.Courier.Persistence.V4.NHibernate.dll</file>
<file>/bin/Umbraco.Courier.Persistence.V4.NHibernate.pdb</file>
<file>/bin/Umbraco.Courier.Providers.dll</file>
<file>/bin/Umbraco.Courier.Providers.pdb</file>
<file>/bin/Umbraco.Courier.RepositoryProviders.dll</file>
<file>/bin/Umbraco.Courier.RepositoryProviders.pdb</file>
<file>/bin/Umbraco.Courier.UI.dll</file>
<file>/bin/Umbraco.Courier.UI.pdb</file>
<file>/bin/Umbraco.Licensing.dll</file>
<file>/bin/Umbraco.Licensing.pdb</file>
<file>/config/courier.config</file>
<file>/umbraco/images/tray/courier.jpg</file>
<file>/umbraco/plugins/courier/css/img/x.png</file>
<file>/umbraco/plugins/courier/css/dialogs.css</file>
<file>/umbraco/plugins/courier/css/pages.css</file>
<file>/umbraco/plugins/courier/css/style.css</file>
<file>/umbraco/plugins/courier/dashboard/CourierDashboard.ascx</file>
<file>/umbraco/plugins/courier/dialogs/addItemsToLocalRevision.aspx</file>
<file>/umbraco/plugins/courier/dialogs/CommitItem.aspx</file>
<file>/umbraco/plugins/courier/dialogs/ResourceBrowser.aspx</file>
<file>/umbraco/plugins/courier/dialogs/transferItem.aspx</file>
<file>/umbraco/plugins/courier/dialogs/transferRevision.aspx</file>
<file>/umbraco/plugins/courier/dialogs/UpdateItem.aspx</file>
<file>/umbraco/plugins/courier/images/bug.gif</file>
<file>/umbraco/plugins/courier/images/courier.jpg</file>
<file>/umbraco/plugins/courier/images/Courier.png</file>
<file>/umbraco/plugins/courier/images/deploy.gif</file>
<file>/umbraco/plugins/courier/images/edit.png</file>
<file>/umbraco/plugins/courier/images/extract.png</file>
<file>/umbraco/plugins/courier/images/install.png</file>
<file>/umbraco/plugins/courier/images/package.gif</file>
<file>/umbraco/plugins/courier/images/package_all.gif</file>
<file>/umbraco/plugins/courier/images/package_selection.gif</file>
<file>/umbraco/plugins/courier/images/transfer.gif</file>
<file>/umbraco/plugins/courier/images/transfer.png</file>
<file>/umbraco/plugins/courier/masterpages/CourierDialog.Master</file>
<file>/umbraco/plugins/courier/masterpages/CourierPage.Master</file>
<file>/umbraco/plugins/courier/pages/deployRevision.aspx</file>
<file>/umbraco/plugins/courier/pages/deployRevisions.aspx</file>
<file>/umbraco/plugins/courier/pages/editCourierSecurity.aspx</file>
<file>/umbraco/plugins/courier/pages/editLocalRevision.aspx</file>
<file>/umbraco/plugins/courier/pages/editRemoteRevision.aspx</file>
<file>/umbraco/plugins/courier/pages/editRepository.aspx</file>
<file>/umbraco/plugins/courier/pages/extractRevision.aspx</file>
<file>/umbraco/plugins/courier/pages/feedproxy.aspx</file>
<file>/umbraco/plugins/courier/pages/LicenseError.aspx</file>
<file>/umbraco/plugins/courier/pages/status.aspx</file>
<file>/umbraco/plugins/courier/pages/ViewRepositories.aspx</file>
<file>/umbraco/plugins/courier/pages/ViewRevision.aspx</file>
<file>/umbraco/plugins/courier/pages/ViewRevisionDetails.aspx</file>
<file>/umbraco/plugins/courier/pages/ViewRevisions.aspx</file>
<file>/umbraco/plugins/courier/scripts/courier.js</file>
<file>/umbraco/plugins/courier/scripts/jquery.simplemodal-1.2.3.js</file>
<file>/umbraco/plugins/courier/scripts/RevisionDetails.js</file>
<file>/umbraco/plugins/courier/usercontrols/DependencySelector.ascx</file>
<file>/umbraco/plugins/courier/usercontrols/Installer.ascx</file>
<file>/umbraco/plugins/courier/usercontrols/ProviderSecurity.ascx</file>
<file>/umbraco/plugins/courier/usercontrols/RevisionContentsOverview.ascx</file>
<file>/umbraco/plugins/courier/usercontrols/SystemItemSelector.ascx</file>
<file>/umbraco/plugins/courier/usercontrols/test.ascx</file>
<file>/umbraco/plugins/courier/webservices/Courier.asmx</file>
<file>/umbraco/plugins/courier/webservices/Packager.asmx</file>
<file>/umbraco/plugins/courier/webservices/Repository.asmx</file>
<file>/umbraco/plugins/courier/deployRevision.aspx</file>
<file>/umbraco/plugins/courier/deployRevisions.aspx</file>
<file>/umbraco/plugins/courier/editCourierSecurity.aspx</file>
<file>/umbraco/plugins/courier/editLocalRevision.aspx</file>
<file>/umbraco/plugins/courier/editRemoteRevision.aspx</file>
<file>/umbraco/plugins/courier/editRepository.aspx</file>
<file>/umbraco/plugins/courier/extractRevision.aspx</file>
<file>/umbraco/plugins/courier/feedproxy.aspx</file>
<file>/umbraco/plugins/courier/LicenseError.aspx</file>
<file>/umbraco/plugins/courier/status.aspx</file>
<file>/umbraco/plugins/courier/ViewRepositories.aspx</file>
<file>/umbraco/plugins/courier/ViewRevision.aspx</file>
<file>/umbraco/plugins/courier/ViewRevisionDetails.aspx</file>
<file>/umbraco/plugins/courier/ViewRevisions.aspx</file>
</files>
<languages>
</languages>
<dictionaryitems>
</dictionaryitems>
<loadcontrol>
</loadcontrol>
</package>
<package id="4" version="1" url="" name="Contribute Section" folder="140b5bc1-e6e4-4d1c-9439-e185803d7ef6" packagepath="" repositoryGuid="" packageGuid="" hasUpdate="False" enableSkins="False" skinRepoGuid="00000000-0000-0000-0000-000000000000">
<license url="http://www.opensource.org/licenses/mit-license.php">MIT license</license>
<author url="umbraco.com">Peter</author>
<readme><![CDATA[contribute dammit!]]></readme>
<actions>
</actions>
<datatypes>
</datatypes>
<content nodeId="49905" loadChildNodes="False">
</content>
<templates>49904</templates>
<stylesheets>
</stylesheets>
<documenttypes>
</documenttypes>
<macros>130</macros>
<files>
<file>/macroScripts/GoogleDevGroupRSS.cshtml</file>
</files>
<languages>
</languages>
<dictionaryitems>
</dictionaryitems>
<loadcontrol>
</loadcontrol>
</package>
</packages>
@@ -0,0 +1 @@
# Sample Property Editor
@@ -0,0 +1,61 @@
# Structure
_Belle introduces a new default location for all client files like JS, CSS and related assets._
## /umbraco/Client
The mother folder, containing all sub folders related to the client. If you have any files related to the UI
or a UI component, they should be placed here and afterwards loaded with clientdependency.
### Subfolders
Inside /umbraco/Client, is a number of subfolders, which are described below
## /Lib
Library folder, which contains all 3rd party libraries used by umbraco. such as JQuery and TinyMCE. Each library
has it's own folder, but beyond that it follows the library's own folder structure for easy copy-paste updates.
All files in the this folder must remain *unchanged* as these will get upgraded with new versions and no-one will check
for customizations.
## /Modules
Contains individual UI components, grouped by a namespace and module name. A module is basicly a group of js, css and image files, used
by this module, so everything is in one place for that specific component, and thereby easier to load dependencies into the browser.
*The /Modules folder is devided into subfolders:*
#### /Modules/Umbraco.Application
Modules used by the application in generel, such as the tree, search, popovers and so on.
#### /Modules/Umbraco.PropertyEditors
Modules used by individual property editors / data types. Like the Content Picker, Date picker etc. Each module contains the js and css files for
that module, but not any dependencies, these are still located in /Lib
#### /Modules/Umbraco.Editors
Modules / classes used by individual editor pages, so for exemple editTemplates.aspx has all its clientside logic in
/Modules/Umbraco.Editors/Settings/editTemplate.js
#### /Modules/Umbraco.Utills
Utility classes which are available on all pages
#### /Modules/Umbraco.System
Underlying System classes currently used for the NameSpace Manager and History manager
## /Css
Contains the main stylesheets for the application, currently it contains:
- *login.css* only used on the login.aspx page
- *application.css* which is only used by the main window
- *page.css* added on all pages
- *dialog.css* only added to pages which uses the dialog masterpage
*Also: * the default stylesheet from twitter bootstrap is available on all pages
For anything else, css should be placed in its relevant module folder *Notice:* this is not the case YET, but what we try to get to.
## /Js
This folder is legacy and will at some point be removed, please use /modules if you need to add some javascript to the application to hook into
the page load event use /modules/umbraco.editors/default.js which is loaded on all pages and /Modules/Umbraco.Application/window to hook into the
general application window.
## /img
For any non-css images
@@ -0,0 +1,38 @@
#Project "Belle"
_"Belle" is the codename for the next version of the Umbraco backoffice UI._
After 10 years as an open source project, the UI has barely changed. There has been tweaks here and there, but overall
the experience of using Umbraco, has stayed the same.
Project Belle intends to overhaul the entire UI with a simpler visual theme, and at the same time, replacing most of the internal code.
###Getting belle up and running
Currently there are 2 ways, either get it from nightly.umbraco.org and run it as a normal umbraco installation, or build it from source.
####From nightly
To download from nightly, download a zip of the latest build here:
http://nightly.umbraco.org/umbraco%20belle/
Files named UmbracoCms.4.11.0.build.*.zip are the complete website package
Unzip the files to disk and use either IIS or IIS express to run the site.
####From source
At the moment, we host the belle source at a seperate repository here:
https://bitbucket.org/UmbracoHQ/umbracocms-belleui
To get the source, open cmd.exe in a directory and enter:
hg clone https://bitbucket.org/UmbracoHQ/umbracocms-belleui
This will download the source and you can open it in visual studio and run it from there.
@@ -0,0 +1,12 @@
#Coding standards and naming conventions
_Coding standards and naming conventions for all languages used in the Umbraco core_
##[Naming conventions](naming-conventions.md)
The naming conventions used throughout the codebase including C#, JS and CSS
##[JavaScript coding standards](js-guidelines.md)
The coding standards and guidelines for JavaScript to be used in the Umbraco codebase
##[JQuery coding standards](jquery-guidelines.md)
The coding standards and guidelines for using JQuery to be used in the Umbraco codebase
@@ -0,0 +1,94 @@
#JQuery coding guidelines
_Ensure that you have read the [JavaScript Guidelines](js-guidelines.md) document before continuing. As documented in [JavaScript Guidelines](js-guidelines.md) method names are named in "camelCase" and therefore jQuery plugins (since they are methods) are named as "camelCase"._
Just like with other JavaScript in the Umbraco back-office, you need to wrap your class in the jQuery self executing function if you want to use the dollar ($) operator.
##Simple jQuery plugins
Simple jQuery plugins don't require an internal class to perform the functionality and therefor do not expose or return an API. These could be as simple as vertically aligning something:
(function($) {
$.fn.verticalAlign = function(opts) {
//were not using opts (options) for this plugin
//but you could!
return this.each(function() {
var top = (($(this).parent().height() - $(this).height()) / 2);
$(this).css('margin-top', top);
});
};
})(jQuery);
##Standard jQuery plugins
Most jQuery plugins will expose an API or a way in which a developer can interact with the plugin, not just instantiating it. To do this we need to create a class that does the work of the plugin and then expose that class via a different jQuery plugin.
###Naming Conventions
There's many different ways to expose an API for a jQuery plugin, in Umbraco the standard will be:
* `$("#myId").myFirstJQueryPlugin();` = to instantiate the plugin
* `var pluginApi = $("#myId").myFirstJQueryPluginApi();` = to retrieve the plugin API for that selector
So essentially, we'll be creating 2 plugins, one to instantiate it and one to retrieve the API. The naming conventions are obvious, create your plugin name and then append the term *Api* to it to create your API plugin name.
###Creating the plugins
//using the same vertical align concept but we'll expose an API for it
//( not that this is very useful :) )
Umbraco.Sys.registerNamespace("MyProject.MyNamespace");
(function($) {
//create the standard jQuery plugin
$.fn.verticalAlign = function(opts) {
//were not using opts (options) for this plugin
//but you could!
return this.each(function() {
//create the aligner for the current element
var aligner = new MyProject.MyNamespace.VerticalAligner($(this));
});
};
//create the Api retriever plugin
$.fn.verticalAlignApi = function () {
//ensure there's only 1
if ($(this).length != 1) {
throw "Requesting the API can only match one element";
}
//ensure this has a vertical aligner applied to it
if ($(this).data("api") == null) {
throw "The matching element had not been bound to a VerticalAligner ";
}
return $(this).data("api");
}
//Create a js class to support the plugin
MyProject.MyNamespace.verticalAligner = function(elem) {
//the jQuery selector
var _e = elem;
var api = {
align: function() {
var top = ((_e.parent().height() - _e.height()) / 2);
_e.css('margin-top', top);
}
}
//store the api object in the jquery data object for
//the current selector
_e.data("api", api);
//return the api object
return api;
}
})(jQuery);
###Consuming the plugins
To use the plugin and api is very easy:
NOTE: this is an example plugin, i realize this is not really that useful as a non-simple plugin!
$("#myId").verticalAlign();
//now to get the api and do the alignment
$("#myId").verticalAlignApi().align();
@@ -0,0 +1,158 @@
#JavaScript coding standards and guidelines
_All JavaScript in the Umbraco core should adhere to these guidelines. The legacy JS code in the core doesn't adhere to these guidelines but should be refactored so that it does._
**All JavaScript in the back-office needs to be in a namespace and defined in a class.**
##Namespaces
To declare a namespace for your JavaScript class you simply use the following command (as an example to create a namespace called 'Umbraco.Controls'):
Umbraco.Sys.registerNamespace("Umbraco.Controls");
The above code will require a reference to the NamespaceManager.js file which should generally be included by default in all pages in Umbraco.
##jQuery
If you are going to use jQuery and it's dollar ($) operator, you will need to wrap your code in a self executing function, this is to ensure that your code will still work with jQuery.noConflict() turned on. Example:
(function($) {
//your code goes here
alert($);
})(jQuery);
To create jQuery plugins, see the [jQuery Plugin Guidelines](jquery-guidelines.md)
##Creating classes
There are actually quite a few different ways to create classes in JavaScript. For Umbraco we have opted to use the 3rd party, classical inheritance library, [Base2](http://base2.googlecode.com/svn/version/1.0.2/doc/base2.html#/doc/!base2) to make class declarations simple and extendable:
Umbraco.Sys.registerNamespace("MyProject.MyNamespace");
MyProject.MyNamespace.NamePrinter = base2.Base.extend({
//in order to make private methods/variables accessible
//to derived types, everything actually has to be public
//so to identify private variables, just prefix with an underscore
//private methods/variables
_isDebug: true,
_timer: 100,
_currIndex: 0,
_log: function (p) {
//this is a private method that can only be
//accessed inside of this class
if (this._isDebug) {
console.dir(p);
}
}
//public methods/variables
name: ctorParams,
start: function() {
this._log("start method called");
//need to create a closure so we have a reference to our
//current this object in the interval function
var _this = this;
//this will write the name out to the console one letter
//at a time every _timer interval
setInterval(function() {
if (_this._currIndex < _this.name.length) {
console.info(_this.name[_this._currIndex]);
_this._currIndex++;
}
}, _this._timer);
}
})
Using the class above is easy:
var printer = new NamePrinter("Shannon");
printer.start();
//or since we exposed the name property publicly,
//we can set it after the constructor
var printer2 = new NamePrinter();
printer2.name = "Shannon";
printer2.start();
##Singleton classes
Sometimes it's useful to have a class that can only be instantiated once and shared, rather than have multiple unsynchronised instances floating around. In those circumstances a Singleton pattern should be used.
Define a singleton class:
Umbraco.Sys.registerNamespace("MyProject.MyNamespace");
MyProject.MyNamespace.NamePrinterManager = base2.Base.extend({
//in order to make private methods/variables accessible
//to derived types, everything actually has to be public
//so to identify private variables, just prefix with an underscore
//private methods/variables
_registeredPrinters: [],
//public methods/variables
registerPrinter: function(printer) {
this._registeredPrinters[printer.name] = printer;
},
getPrinter: function(name) {
return this._registeredPrinters[printer.name];
}
}, { //Static members
//private methods/variables
_instance: null,
// Singleton accessor
getInstance: function () {
if(this._instance == null)
this._instance = new MyProject.MyNamespace.NamePrinterManager();
return this._instance;
}
});
Defining a singleton is the same as defining a regular class, except that we also define a static "getInstance" accessor for accessing the entity in a controlled mannor. By providing the static accessor we can ensure only one instance of the class is created per request.
Using the singleton is very easy:
var printer = new NamePrinter("Shannon");
MyProject.MyNamespace.NamePrinterManager.getInstance().registerPrinter(printer);
##Static classes
Sometimes its useful to have static classes that require no constructor. Before you make one of these, definitely make sure that you wont require different instances of one.
Static classes are very easy:
Umbraco.Sys.registerNamespace("MyProject.MyNamespace");
MyProject.MyNamespace.Utility = base2.Base.extend(null, {
showMsg: function(msg) {
alert(msg);
}
})
Using the class/method requires no instantiation but you can therefore have no separate instances of Utility:
MyProject.MyNamespace.Utility.showMsg("hello");
##The different between a Singleton class and Static class
Both singleton and static classes allow you access methods directly without having to create an entity of your own. The main difference between the two, and what should govern when to use one over the other, is one of state.
A singleton class can hold information which can be manipulated and retrieved via it's public methods and will be stored between method calls, where as static methods should only manipulate and return values which it can gather from it's parameters and should not be persisted between individual method calls.
A good example of a Singleton is the one highlighted above, "NamePrinterManager". Here printers can be registered using the registerPrinter method for storage, and later retrieved using the getPrinter method. Here, a singleton is used as you will only want one central repository of printers.
A good example use of a Static class is for helper methods, where each method will perform a single self contained task based upon the parameters passed in and will return a immediate response.
@@ -0,0 +1,19 @@
#Naming conventions
##HTML & CSS
* CSS class names will be **.lowercase-hyphenated-names**
* HTML IDs will be **camelCasedNames**
##JavaScript
* Namespaces: **ProperCase**
* Class names: **ProperCase**
* Method names: **camelCase**
* Property names: **camelCase**
* Private property names: **_camelCase**
##C&#35;
When developing new Class Libraries we will be adhereing as closely as possible to the official guidelines as proposed by Microsoft [http://msdn.microsoft.com/en-us/library/ms229042.aspx](http://msdn.microsoft.com/en-us/library/ms229042.aspx)
Another good reference is "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries" book by Krzysztof Cwalina and Brad Abrams
Resharper settings are included with the solution, so developers can cleanup code in a consistent manner.
@@ -0,0 +1,15 @@
#Development Guidelines
_All about working with the Umbraco codebase_
##[Coding and naming conventions](Coding-Standards/index.md)
The naming conventions used throughout the codebase including C#, JS and CSS and how classes in C# and JavaScript should be created and used.
##[The solution and project structure](project-structure.md)
How the Visual Studio solution is put together, what the funtionality of each project is what the end goal of the structure is.
##[Working with the code](working-with-code.md)
Describes the process of creating new classes and where they should be stored in regards to namespaces and projects. Also describes how to deal with updating legacy code and how it should be updated.
##[Unit testing](unit-testing.md)
Describes how to write unit testable code and how to write unit tests for the code in Umbraco.
@@ -0,0 +1,52 @@
#Solution and project structure
_How the Visual Studio solution is structured and what the funcionality of each project is. This also describes the end goal of how we'd like the solution structured._
##The goal
The goal of the Umbraco project is to be able to be left with only a few Visual Studio projects:
* Umbraco.Core
* Umbraco.Web
* Umbraco.Web.UI
* Umbraco.Tests
Acheiving this goal will take quite a lot of time by slowly migrating over old code and refactoring it into new code under new namespaces and projects. This cannot all happen at the same time but starting down this path now means that we can realize this goal sooner.
##The structure
* Umbraco.Core
* Contains all functionality in Umbraco that does not pertain to the Web. For example, it contains any classes and objects that could be used in a console application.
* Assembly: **Umbraco.Core.dll**
* Does not reference ANY other project except for *umbraco.interfaces*
* Umbraco.Web
* Contains all functionality in Umbraco pertaining to the web.
* Contains all of the legacy code (including code behinds) that exists in the umbraco.dll file under the old namespaces but this code will slowly be migrated over to the new namespaces
* Assembly: **umbraco.dll**
* Unfortunately due to the legacy code this project cannot produce a consistent DLL called Umbraco.Web.dll so we are stuck with umbraco.dll until maybe one day when 'the goal' is acheived we might be able to make a switch but this is low priority.
* Umbraco.Web.UI
* Contains ONLY rendering files, webforms files and MVC Views: *JS, CSS, ASPX, ASCX, ASMX, CSHTML*
* Legacy webforms files have their codebehind files in the Umbraco.Web project. If these legacy webforms files need to be worked on, we can migrate their codebehind files to the Umbraco.Web.UI project as we see fit.
* **ALL NEW ASPX, ASCX, ASMX and any other webforms file that requires a codebehind will exist under the Umbraco.Web.UI project**
* **MORE IMPORTANT -> BECAUSE THE NAMES OF THE FOLDERS ARE NOT PROPER CASE YOU WILL NEED TO ENSURE THAT THE NAMESPACE IS OF THE CORRECT CASE. SO WHEN YOU CREATE YOUR ASPX PAGE, THE NAMESPACE NAME MIGHT BE: *Umbraco.Web.UI.umbraco.settings* . YOU NEED TO CHANGE THIS TO: *Umbraco.Web.UI.Umbraco.Settings***
* Umbraco.Tests
* Contains all unit tests for Umbraco
* Uses Nunit for unit tests
##Legacy projects
_The code in the legacy projects will eventually be migrated and refactored with correct naming and code conventions into the new projects and namespaces_
**TODO: Documentation to be completed**
* SqlCE4Umbraco
* umbraco.businesslogic
* umbraco.cms
* umbraco.controls
* umbraco.datalayer
* umbraco.editorControls
* umbraco.interfaces
* umbraco.MacroEngines
* umbraco.MacroEngines.Iron
* umbraco.macroRenderings
* umbraco.providers
* umbraco.webservices
@@ -0,0 +1,12 @@
#Unit testing
_Describes how to write unit testable code and how to write the unit tests for your code in Umbraco_
##Writing unit testable code
**TODO: Documentation to be completed**
##Writing unit tests
**TODO: Documentation to be completed**
###Unit test helper classes
**TODO: Documentation to be completed**
@@ -0,0 +1,24 @@
#Working with the code
_Guidelines for creating and updating code in the Umbraco core_
##Guidelines
* All new code goes in either *Umbraco.Core* or *Umbraco.Web*
* Depending on what type of code you are writing. If it has to do with the web, then of course it goes in Umbraco.Web. If you could use it in a console app or something like that, then it goes in Umbraco.Core
* *Umbraco.Web.UI* is **only** for rendering files: *JS, CSS, ASPX, ASCX, CSHTML*
* Any new *ASPX, ASCX* will also put their code behind files here too
* All old code behind files exist in *Umbraco.Web*, these can be migrated over to *Umbraco.Web.UI* if and when you work on them
* If you are updating existing code, you should consider moving it to the correct project and namespace, refactoring it to have consistent and correct naming conventions and code reviewing the legacy code to bring it up to date (i.e. removing what isn't needed and fixing what you see)
* This is however not a requirement as in some cases this may take more time than you wish to commit to which is ok. Eventually this code will be moved and refactored, we don't have to do it all at once
* If you are updating existing code you should still put any new classes that are created for the legacy code into the new projects/namespaces
* New code should be written as unit testable code, you should always use constructor dependencies where possible instead of relying on global singletons to access services. Of course this is not always possible when you don't have control over instantiating objects but when it is you should always use constructor dependencies. This forces you to write clean and unit testable code.
* New and updated code should have unit tests written for them in the Umbraco.Tests project which uses Nunit, by writing unit tests for your code you realize how to improve the APIs you are writing and of course create something that we can test.
* When obsoleting old code be sure to remove references throughout the codebase to this obsolete code and update the codebase to use the new classes and methods
* All new classes should be marked 'internal' until we decide we want to publicly expose the APIs.
##Potential issues
* You may come across some issues when developing new classes in *Umbraco.Core* because you may need objects that exist in other projects
* This is because *Umbraco.Core* doesn't reference any other projects (except for umbraco.interfaces) and it **never** should
* To get around these problems you will need to migrate the code you want to reference in to the *Umbraco.Core* project and obsolete the old code, sometimes this is very easy to do, othertimes it could mean a bit of work and in those cases it will be up to you to decide if you will just put the new code where the legacy code is if time does not permit. However, the new code still needs to be marked internal so we can easily move later on
@@ -0,0 +1,15 @@
#This section is waiting for content
This documention has not been written yet, but it is on the roadmap.
###Progress
Consult the Umbraco 4 documentation trello board to see what we are currently working on.
[See the TrelloBoard here](https://trello.com/board/umbraco-4-documentation/4fdb02df8fc3ef067e809e95)
###Contribution
Umbraco is a community powered project and we welcome any contribution, big or small, even fixing a typo is a valuable contribution.
[See how to contribute](https://github.com/umbraco/Umbraco4Docs)
@@ -0,0 +1,17 @@
#Macro Parameter Editors
This documention has not been written yet, but it is on the roadmap.
In the meantime, you can find details of how to create a Macro Parameter Editor [here](http://www.richardsoeteman.net/2010/01/04/CreateACustomMacroParameterType.aspx)
###Progress
Consult the Umbraco 4 documentation trello board to see what we are currently working on.
[See the TrelloBoard here](https://trello.com/board/umbraco-4-documentation/4fdb02df8fc3ef067e809e95)
###Contribution
Umbraco is a community powered project and we welcome any contribution, big or small, even fixing a typo is a valuable contribution.
[See how to contribute](https://github.com/umbraco/Umbraco4Docs)
@@ -0,0 +1,15 @@
#This section is waiting for content
This documention has not been written yet, but it is on the roadmap.
###Progress
Consult the Umbraco 4 documentation trello board to see what we are currently working on.
[See the TrelloBoard here](https://trello.com/board/umbraco-4-documentation/4fdb02df8fc3ef067e809e95)
###Contribution
Umbraco is a community powered project and we welcome any contribution, big or small, even fixing a typo is a valuable contribution.
[See how to contribute](https://github.com/umbraco/Umbraco4Docs)
@@ -0,0 +1,17 @@
##Creating Property Editors
There are two types of property editors in Umbraco
###Abstract Data Editor
Content to come from
http://www.nibble.be/?p=91
###User Control Wrapper
Content to come from
http://www.nibble.be/?p=93
@@ -0,0 +1,15 @@
#This section is waiting for content
This documention has not been written yet, but it is on the roadmap.
###Progress
Consult the Umbraco 4 documentation trello board to see what we are currently working on.
[See the TrelloBoard here](https://trello.com/board/umbraco-4-documentation/4fdb02df8fc3ef067e809e95)
###Contribution
Umbraco is a community powered project and we welcome any contribution, big or small, even fixing a typo is a valuable contribution.
[See how to contribute](https://github.com/umbraco/Umbraco4Docs)
@@ -0,0 +1,21 @@
#Extending Umbraco
###[Dashboards](Dashboards/index.md)
A Dashboard is a component for displaying elements on the right-hand side of the backoffice UI area. **(coming soon)**
###[Macro Parameter Editors](Macro-Parameter-Editors/index.md)
A parameter editor defines the usage of a property editor for use as a parameter for Macros. **(coming soon)**
###[Packaging](Packaging/index.md)
Information on the packaging manifest format and how assets should be packaged as a zip file for easy distribution
**(coming soon)**
###[Property Editors](Property-Editors/index.md)
A property editor is a way to insert content into Umbraco. An example of a property editor is the Rich Text Editor. It may be confused with Data Types. Its possible to have many Rich Text Editor Data Types with different settings that all use the Rich Text Editor property editor. **(coming soon)**
###[Trees and Applications](Trees/index.md)
**(coming soon)**
Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 416 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 368 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 408 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 KiB

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