Merged from branches/2.3

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@71267 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-02-03 03:26:44 +00:00
parent 3680bbea46
commit 9d32dd4026
9 changed files with 97 additions and 47 deletions

View File

@ -5,6 +5,7 @@
* @subpackage comments
*/
class PageComment extends DataObject {
static $db = array(
"Name" => "Varchar(200)",
"Comment" => "Text",
@ -18,6 +19,12 @@ class PageComment extends DataObject {
"Author" => "Member" // Only set when the user is logged in when posting
);
static $has_many = array();
static $many_many = array();
static $defaults = array();
static $casting = array(
"RSSTitle" => "Varchar",
);
@ -28,7 +35,7 @@ class PageComment extends DataObject {
static $moderate = false;
static $bbcode = false;
/**
* Return a link to this comment
* @return string link to this comment.

View File

@ -137,6 +137,8 @@ class PageCommentInterface extends RequestHandler {
$form->loadDataFrom(array(
"Name" => Cookie::get("PageCommentInterface_Name"),
"Comment" => Cookie::get("PageCommentInterface_Comment"),
"URL" => Cookie::get("PageCommentInterface_CommenterURL")
));
return $form;
@ -175,6 +177,10 @@ class PageCommentInterface extends RequestHandler {
class PageCommentInterface_Form extends Form {
function postcomment($data) {
// Spam filtering
Cookie::set("PageCommentInterface_Name", $data['Name']);
Cookie::set("PageCommentInterface_CommenterURL", $data['CommenterURL']);
Cookie::set("PageCommentInterface_Comment", $data['Comment']);
if(SSAkismet::isEnabled()) {
try {
$akismet = new SSAkismet();
@ -210,7 +216,6 @@ class PageCommentInterface_Form extends Form {
return "spamprotectionfailed"; //used by javascript for checking if the spam question was wrong
}
}
Cookie::set("PageCommentInterface_Name", $data['Name']);
// If commenting can only be done by logged in users, make sure the user is logged in
$member = Member::currentUser();
@ -226,7 +231,7 @@ class PageCommentInterface_Form extends Form {
$comment->IsSpam = false;
$comment->NeedsModeration = PageComment::moderationEnabled();
$comment->write();
Cookie::set("PageCommentInterface_Comment", '');
if(Director::is_ajax()) {
if($comment->NeedsModeration){
echo _t('PageCommentInterface_Form.AWAITINGMODERATION', "Your comment has been submitted and is now awaiting moderation.");

View File

@ -1,7 +1,9 @@
#left form.actionparams {
background: #eee;
padding: 0 0 5px 0;
padding: 0 5px 5px 5px;
_padding-left: 5px;
float: left;
width: 100%;
}
#left form#search_options {
padding-bottom: 8px;
@ -65,6 +67,9 @@
#left div.field select {
width: 100%;
}
#TreeTools select {
margin-left: 2px;
}
#left .SelectionGroup li.selected label.selector {
font-weight: bold;
}
@ -267,6 +272,7 @@ ul.tree span.a span.modified,
background-color: #aaa;
color: #fff;
border-bottom: 2px #ccc solid;
padding: 0 3px;
}
#treepanes table tbody tr {
@ -275,10 +281,10 @@ ul.tree span.a span.modified,
#treepanes table tbody td {
font-size: 11px;
padding:0 2px;
padding: 1px 3px;
}
#treepanes table tbody tr.odd td {
#treepanes table tbody tr.even td {
background-color: #EEE;
}
#treepanes table tbody tr.over td {
@ -289,7 +295,6 @@ ul.tree span.a span.modified,
background-color: #BBBBFF;
}
#treepanes #Versions tbody tr.internal {
color: #777;
}
@ -297,6 +302,10 @@ ul.tree span.a span.modified,
color: black;
}
.SideReport_RecentlyEdited li a:hover {
background-color: #FFFFBB;
}
/**
* Change the styling of the root tree node
*/
@ -406,20 +415,44 @@ ul.tree span.untranslated a:visited {
float: left;
margin: 0 3px 0 0;
}
#versions_actions {
float: left;
width: 100%;
border-bottom:1px solid #CCC;
}
#versions_actions .versionChoice {
float: left;
display: block;
margin: 0 0 5px 0;
}
.versionChoice label {
display: block;
float: left;
margin-top: 3px;
_margin-top: 4px;
}
#versions_actions input, #Remember input {
float: left;
display: block;
padding-top: 2px;
margin: 0 3px 0 0;
}
#ReportSelector_holder {
background: #EEE;
margin: 0 !important;
padding: 3px 3px 7px;
border-bottom: 1px solid #CCC;
}
#versions_actions {
background: #EEE;
overflow: hidden;
margin: 0 !important;
padding: 4px 7px;
}
/**
* i18n

View File

@ -6,7 +6,7 @@
margin: 7px 0;
}
#right .optionset li {
margin: 4px 0;
margin: 8px 0;
}
/**
@ -142,6 +142,11 @@
.right form .htmleditor select,
.right form input.action {
width: auto;
margin-right: 4px;
}
.right form #Root_Access input {
float: left;
}
.right form ul.optionset {
@ -428,7 +433,7 @@ div.originallang_holder.field.CompositeField.nolabel {
overflow-x: scroll;
}
#contentPanel ul.tree a {
padding-left: 15px;
padding-left: 20px;
}
#contentPanel h2 img {
float: right;

View File

@ -333,19 +333,28 @@ body.stillLoading select {
#sitetree_holder #TreeTools {
float: left;
width: inherit;
background: #EEE;
}
#SearchBox {
float: left;
width: 100%;
margin-bottom: 5px;
margin: 0 0 5px 0;
padding-left: 5px;
}
#SearchBox #SiteTreeSearchTerm {
padding: 1px 0 2px 0;
}
#sitetree_ul {
#addCriteria {
float: left;
width: 100%;
}
#sitetree_ul, ul#sitetree {
padding: 3px 0 0 3px;
clear: left;
}
#sitetree_ul ul#sitetree {
padding: 0;
}
#sitetree {
width: 500px; /* IE's chocking right now */
}
@ -361,7 +370,7 @@ body.stillLoading select {
}
#left #SortItems {
border-bottom: 1px solid #CCC;
margin-bottom: 5px;
margin-bottom: 2px;
}
#TreeTools label {
display: block;
@ -370,8 +379,7 @@ body.stillLoading select {
}
#TreeTools #batchactionsforms {
padding: 0 0 7px 1px;
float: left;
padding: 0 5px 7px 5px;
}
#TreeTools div p, #ShowChanged {
@ -389,7 +397,6 @@ body.stillLoading select {
padding: 2px 1px;
float: left;
}
div.spacer,
li.spacer {

View File

@ -115,7 +115,7 @@ Behaviour.register({
'#EditMemberProfile': {
onclick: function(e) {
var el = Event.element(e);
GB_show('Edit Profile', el.attributes.href.value, 390, 560);
GB_show('Edit Profile', el.attributes.href.value, 290, 500);
Event.stop(e);
}
}

View File

@ -163,7 +163,7 @@ CMSForm.prototype = {
var __callAfter = callAfter;
var __form = this;
if(__form.notify) __form.notify('BeforeSave', __form.elements.ID.value);
if(__form.notify && __form.elements.ID != undefined) __form.notify('BeforeSave', __form.elements.ID.value);
// validate if required
if(this.validate && !this.validate()) {
@ -179,7 +179,7 @@ CMSForm.prototype = {
Ajax.Evaluator(response);
__form.resetElements();
if(__callAfter) __callAfter();
if(__form.notify) __form.notify('PageSaved', __form.elements.ID.value);
if(__form.notify && __form.elements.ID != undefined) __form.notify('PageSaved', __form.elements.ID.value);
if($('Form_EditForm_action_save') && $('Form_EditForm_action_save').stopLoading) $('Form_EditForm_action_save').stopLoading();
_AJAX_LOADING = false;
}

View File

@ -96,24 +96,10 @@ PageCommentInterface.prototype = {
onFailure : function(response) {
alert(response.responseText);
}
});
// Clear the fields
// form.elements.Name.value = "";
form.elements.Comment.value = "";
} else {
message.style.display = '';
message.innerHTML = "Please enter your name and a comment to be posted to the site.";
message.innerHTML = "Please enter your name and a comment to be posted to the site.";
}
return false;

View File

@ -37,7 +37,7 @@
</form>
<% end_control %>
<form class="actionparams" style="display: none" id="search_options" action="admin/filterSiteTree">
<div>
<div>
<input type="hidden" id="SiteTreeIsFiltered" value="0" />
<div id="SearchBox">
@ -51,14 +51,17 @@
<div style="display:none" id="Text$Column" class="SearchCriteria">$Title:</div>
<input style="display:none" id="Input$Column" name="$Column" class="SearchCriteria" />
<% end_control %>
<select id="SiteTreeFilterAddCriteria">
<option><% _t('ADDSEARCHCRITERIA','Add Criteria...') %></option>
<option value="SiteTreeFilterDate"><% _t('EDITEDSINCE','Edited Since') %></option>
<% control SiteTreeFilterOptions %>
<option value="$Column">$Title</option>
<% end_control %>
</select>
<div id="addCriteria">
<select id="SiteTreeFilterAddCriteria">
<option><% _t('ADDSEARCHCRITERIA','Add Criteria...') %></option>
<option value="SiteTreeFilterDate"><% _t('EDITEDSINCE','Edited Since') %></option>
<% control SiteTreeFilterOptions %>
<option value="$Column">$Title</option>
<% end_control %>
</select>
</div>
</div>
</form>
<div id="batchactionsforms" style="display: none">
$DeleteItemsForm
@ -98,10 +101,14 @@
</h2>
<div class="listpane" id="versions_holder" style="display:none">
<p class="pane_actions" id="versions_actions">
<input type="checkbox" id="versions_comparemode" /> <label for="versions_comparemode"><% _t('COMPAREMODE','Compare mode (click 2 below)') %></label>
<br />
<input type="checkbox" id="versions_showall" /> <label for="versions_showall"><% _t('SHOWUNPUB','Show unpublished versions') %></label>
<span class="versionChoice">
<input type="checkbox" id="versions_comparemode" /> <label for="versions_comparemode"><% _t('COMPAREMODE','Compare mode (click 2 below)') %></label>
</span>
<span class="versionChoice">
<input type="checkbox" id="versions_showall" /> <label for="versions_showall"><% _t('SHOWUNPUB','Show unpublished versions') %></label>
</span>
</p>
<div class="unitBody">