From 709e352bbc04c541a3e7fde11d087ca133a2f811 Mon Sep 17 00:00:00 2001
From: Brian Calhoun
Date: Thu, 11 Dec 2008 03:34:39 +0000
Subject: [PATCH] Added ability for comment authors to leave a URL as a
separate form field
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@68326 467b73ca-7a2a-4603-9d3b-597d59a354a9
---
code/sitefeatures/PageComment.php | 3 ++-
code/sitefeatures/PageCommentInterface.php | 2 ++
templates/PageCommentInterface_singlecomment.ss | 7 ++++++-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/code/sitefeatures/PageComment.php b/code/sitefeatures/PageComment.php
index 63306e24..8bc2f423 100755
--- a/code/sitefeatures/PageComment.php
+++ b/code/sitefeatures/PageComment.php
@@ -9,7 +9,8 @@ class PageComment extends DataObject {
"Name" => "Varchar(200)",
"Comment" => "Text",
"IsSpam" => "Boolean",
- "NeedsModeration" => "Boolean"
+ "NeedsModeration" => "Boolean",
+ "CommenterURL" => "Varchar(255)"
);
static $has_one = array(
diff --git a/code/sitefeatures/PageCommentInterface.php b/code/sitefeatures/PageCommentInterface.php
index d827349e..b501e801 100755
--- a/code/sitefeatures/PageCommentInterface.php
+++ b/code/sitefeatures/PageCommentInterface.php
@@ -122,6 +122,8 @@ class PageCommentInterface extends RequestHandler {
$fields->push(new TextField("Name", _t('PageCommentInterface.YOURNAME', 'Your name')));
}
+ // optional commenter URL
+ $fields->push(new TextField("CommenterURL", _t('PageCommentInterface.COMMENTERURL', "Your website URL")));
if(MathSpamProtection::isEnabled()){
$fields->push(new TextField("Math", sprintf(_t('PageCommentInterface.SPAMQUESTION', "Spam protection question: %s"), MathSpamProtection::getMathQuestion())));
diff --git a/templates/PageCommentInterface_singlecomment.ss b/templates/PageCommentInterface_singlecomment.ss
index 32b14941..8c0f91bf 100755
--- a/templates/PageCommentInterface_singlecomment.ss
+++ b/templates/PageCommentInterface_singlecomment.ss
@@ -6,7 +6,12 @@
<% end_if %>
- <% _t('PBY','Posted by') %> $Name.XML, $Created.Nice ($Created.Ago)
+ <% if CommenterURL %>
+ <% _t('PBY','Posted by') %> $Name.XML, $Created.Nice ($Created.Ago)
+ <% else %>
+ <% _t('PBY','Posted by') %> $Name.XML, $Created.Nice ($Created.Ago)
+ <% end_if %>
+