Skip to content

Commit c965b45

Browse files
committed
Fixed edit post validate request issue
Added Tag Description (Currently unused) Started to add emoticons to posts, still testing and not added all.
1 parent 8012f39 commit c965b45

File tree

63 files changed

+340
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+340
-201
lines changed

.nuget/NuGet.Config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
<configuration>
33
<solution>
44
<add key="disableSourceControlIntegration" value="true" />
5+
<add key="repositoryPath" value="..\packages" />
56
</solution>
67
</configuration>

MVCForum.Core/DomainModel/Entities/TopicTag.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public TopicTag()
1313
public Guid Id { get; set; }
1414
public string Tag { get; set; }
1515
public string Slug { get; set; }
16+
public string Description { get; set; }
1617

1718
public string NiceUrl
1819
{

MVCForum.Data/Mapping/TopicTagMapping.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public TopicTagMapping()
1212
HasKey(x => x.Id);
1313
Property(x => x.Id).IsRequired();
1414
Property(x => x.Tag).IsRequired().HasMaxLength(100);
15+
Property(x => x.Description).IsOptional();
1516
Property(x => x.Slug).IsRequired().HasMaxLength(100).HasColumnAnnotation("Index",
1617
new IndexAnnotation(new IndexAttribute("IX_Tag_Slug", 1) { IsUnique = true }));
1718
}

MVCForum.Services/PostService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ private MembershipRole UsersRole(MembershipUser user)
4040
public Post SanitizePost(Post post)
4141
{
4242
post.PostContent = StringUtils.GetSafeHtml(post.PostContent);
43+
post.PostContent = EmoticonUtils.Emotify(post.PostContent);
4344
return post;
4445
}
4546

MVCForum.Utilities/EmoticonUtils.cs

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
using System;
2+
using System.Collections;
3+
using System.Text;
4+
using System.Web;
5+
6+
namespace MVCForum.Utilities
7+
{
8+
public static class EmoticonUtils
9+
{
10+
public static Hashtable GetEmoticonHashTable()
11+
{
12+
var emoticons = new Hashtable(100)
13+
{
14+
{":)", "facebook-smiley-face-for-comments.png"},
15+
{":D", "big-smile-emoticon-for-facebook.png"},
16+
{":(", "facebook-frown-emoticon.png"},
17+
{":'(", "facebook-cry-emoticon-crying-symbol.png"},
18+
{":P", "facebook-tongue-out-emoticon.png"},
19+
{"O:)", "angel-emoticon.png"},
20+
{"3:)", "devil-emoticon.png"},
21+
};
22+
23+
return emoticons;
24+
}
25+
26+
public static string Emotify(string inputText)
27+
{
28+
var emoticonFolder = VirtualPathUtility.ToAbsolute("~/content/images/emoticons/");
29+
var emoticons = GetEmoticonHashTable();
30+
31+
var sb = new StringBuilder(inputText.Length);
32+
33+
for (var i = 0; i < inputText.Length; i++)
34+
{
35+
var strEmote = string.Empty;
36+
foreach (string emote in emoticons.Keys)
37+
{
38+
if (inputText.Length - i >= emote.Length && emote.Equals(inputText.Substring(i, emote.Length), StringComparison.InvariantCultureIgnoreCase))
39+
{
40+
strEmote = emote;
41+
break;
42+
}
43+
}
44+
45+
if (strEmote.Length != 0)
46+
{
47+
sb.AppendFormat("<img src=\"{0}{1}\" alt=\"\" class=\"emoticon\" />", emoticonFolder, emoticons[strEmote]);
48+
i += strEmote.Length - 1;
49+
}
50+
else
51+
{
52+
sb.Append(inputText[i]);
53+
}
54+
}
55+
return sb.ToString();
56+
}
57+
}
58+
}

MVCForum.Utilities/MVCForum.Utilities.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105
<Compile Include="CensorUtils.cs" />
106106
<Compile Include="ConfigUtils.cs" />
107107
<Compile Include="DateUtils.cs" />
108+
<Compile Include="EmoticonUtils.cs" />
108109
<Compile Include="EnumUtils.cs" />
109110
<Compile Include="ExtensionMethods.cs" />
110111
<Compile Include="GuidComb.cs" />

MVCForum.Utilities/StringUtils.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,8 @@ public static HttpWebResponse DownloadWebPage(string url)
832832
/// <returns></returns>
833833
public static string CreateUrl(string strInput, string replaceWith)
834834
{
835+
// Doing this to stop the urls having amp from &amp;
836+
strInput = HttpUtility.HtmlDecode(strInput);
835837
// Doing this to stop the urls getting encoded
836838
var url = RemoveAccents(strInput);
837839
return StripNonAlphaNumeric(url, replaceWith).ToLower();

MVCForum.Website/Areas/Admin/Views/Permissions/EditPermissions.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
<p>If you tick this, users will not be able to access or see the Category - Also they won't be able to see any posts, topics or tags that were created in it either (Private Categories).</p>
138138
<hr/>
139139
<h6>Edit Members</h6>
140-
<p>If you tick this, users will not be able to edit other users profiles and also ban them from the forum.</p>
140+
<p>If you tick this, users will be able to edit other users profiles and also ban them from the forum.</p>
141141
</div>
142142
</div>
143143

MVCForum.Website/Controllers/PostController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ private void NotifyNewTopics(Topic topic, IUnitOfWork unitOfWork)
233233
var sb = new StringBuilder();
234234
sb.AppendFormat("<p>{0}</p>", string.Format(LocalizationService.GetResourceString("Post.Notification.NewPosts"), topic.Name));
235235
sb.Append(AppHelpers.ConvertPostContent(topic.LastPost.PostContent));
236-
sb.AppendFormat("<p>{0}</p>", string.Concat(SettingsService.GetSettings().ForumUrl.TrimEnd('/'), topic.NiceUrl));
236+
sb.AppendFormat("<p><a href=\"{0}\">{0}</a></p>", string.Concat(SettingsService.GetSettings().ForumUrl.TrimEnd('/'), topic.NiceUrl));
237237

238238
// create the emails only to people who haven't had notifications disabled
239239
var emails = usersToNotify.Where(x => x.DisableEmailNotifications != true && !x.IsLockedOut).Select(user => new Email

0 commit comments

Comments
 (0)