[user], [post], [thread], [poll] tags improved

main
Inga 🏳‍🌈 14 years ago
parent 70a8952ca8
commit 65f6dd1b99
  1. 2
      Builder/IISMainHandler/build.txt
  2. 29
      Common/BBCodes/AbstractLocalLink.cs
  3. 11
      Common/BBCodes/Poll.cs
  4. 11
      Common/BBCodes/Post.cs
  5. 11
      Common/BBCodes/Thread.cs
  6. 5
      Common/BBCodes/User.cs
  7. 1
      Common/Common.csproj

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PJonDevelopment.BBCode;
using FLocal.Common.URL;
namespace FLocal.Common.BBCodes {
abstract class AbstractLocalLink : BBCode {
protected AbstractLocalLink(string name)
: base(name) {
}
abstract protected AbstractUrl url {
get;
}
public override string Format(ITextFormatter formatter) {
var url = this.url;
var name = this.Safe(url.title);
if(this.Default != null) {
name = this.GetInnerHTML(formatter);
}
return string.Format("<a href=\"{0}\">{1}</a>", url.canonical, url.title);
}
}
}

@ -5,19 +5,16 @@ using System.Text;
using PJonDevelopment.BBCode;
namespace FLocal.Common.BBCodes {
class Poll : BBCode {
class Poll : AbstractLocalLink {
public Poll()
: base("poll") {
}
public override string Format(ITextFormatter formatter) {
var poll = dataobjects.Poll.LoadById(int.Parse(this.DefaultOrValue));
var name = poll.title;
if(this.Default != null) {
name = this.GetInnerHTML(formatter);
protected override FLocal.Common.URL.AbstractUrl url {
get {
return new URL.polls.Info(this.DefaultOrValue, null);
}
return "<a href=\"/Poll/" + poll.id.ToString() + "/\">" + name + "</a>";
}
}

@ -5,19 +5,16 @@ using System.Text;
using PJonDevelopment.BBCode;
namespace FLocal.Common.BBCodes {
class Post : BBCode {
class Post : AbstractLocalLink {
public Post()
: base("post") {
}
public override string Format(ITextFormatter formatter) {
var post = dataobjects.Post.LoadById(int.Parse(this.DefaultOrValue));
var name = this.Safe(post.title);
if(this.Default != null) {
name = this.GetInnerHTML(formatter);
protected override FLocal.Common.URL.AbstractUrl url {
get {
return new URL.forum.board.thread.post.Show(this.DefaultOrValue, null);
}
return "<a href=\"/Post/" + post.id.ToString() + "/\">" + name + "</a>";
}
}

@ -5,19 +5,16 @@ using System.Text;
using PJonDevelopment.BBCode;
namespace FLocal.Common.BBCodes {
class Thread : BBCode {
class Thread : AbstractLocalLink {
public Thread()
: base("thread") {
}
public override string Format(ITextFormatter formatter) {
var thread = dataobjects.Thread.LoadById(int.Parse(this.DefaultOrValue));
var name = this.Safe(thread.title);
if(this.Default != null) {
name = this.GetInnerHTML(formatter);
protected override FLocal.Common.URL.AbstractUrl url {
get {
return new URL.forum.board.thread.Posts(this.DefaultOrValue, null);
}
return "<a href=\"/Thread/" + thread.id.ToString() + "/\">" + name + "</a>";
}
}

@ -12,8 +12,9 @@ namespace FLocal.Common.BBCodes {
}
public override string Format(ITextFormatter formatter) {
var user = dataobjects.User.LoadByName(this.Default);
return String.Format("<a class=\"separate UG_{0}\" href=\"/Users/User/{1}/Info/\">{2}</a>", this.Safe(user.userGroup.name), user.id, this.Safe(user.name));
var user = dataobjects.User.LoadByName(this.DefaultOrValue);
var url = new URL.users.user.Info(user.id.ToString(), null);
return String.Format("<a class=\"separate UG_{0}\" href=\"{1}\">{2}</a>", this.Safe(user.userGroup.name), url.canonical, this.Safe(user.name));
}
}

@ -57,6 +57,7 @@
<Compile Include="actions\TwoWayReferenceFieldValue.cs" />
<Compile Include="actions\UpdateChange.cs" />
<Compile Include="actions\ChangeSetUtil.cs" />
<Compile Include="BBCodes\AbstractLocalLink.cs" />
<Compile Include="BBCodes\B.cs" />
<Compile Include="BBCodes\ECode.cs" />
<Compile Include="BBCodes\Font.cs" />

Loading…
Cancel
Save