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 * @subpackage comments
*/ */
class PageComment extends DataObject { class PageComment extends DataObject {
static $db = array( static $db = array(
"Name" => "Varchar(200)", "Name" => "Varchar(200)",
"Comment" => "Text", "Comment" => "Text",
@ -18,6 +19,12 @@ class PageComment extends DataObject {
"Author" => "Member" // Only set when the user is logged in when posting "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( static $casting = array(
"RSSTitle" => "Varchar", "RSSTitle" => "Varchar",
); );

View File

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

View File

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

View File

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

View File

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

View File

@ -115,7 +115,7 @@ Behaviour.register({
'#EditMemberProfile': { '#EditMemberProfile': {
onclick: function(e) { onclick: function(e) {
var el = Event.element(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); Event.stop(e);
} }
} }

View File

@ -163,7 +163,7 @@ CMSForm.prototype = {
var __callAfter = callAfter; var __callAfter = callAfter;
var __form = this; 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 // validate if required
if(this.validate && !this.validate()) { if(this.validate && !this.validate()) {
@ -179,7 +179,7 @@ CMSForm.prototype = {
Ajax.Evaluator(response); Ajax.Evaluator(response);
__form.resetElements(); __form.resetElements();
if(__callAfter) __callAfter(); 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(); if($('Form_EditForm_action_save') && $('Form_EditForm_action_save').stopLoading) $('Form_EditForm_action_save').stopLoading();
_AJAX_LOADING = false; _AJAX_LOADING = false;
} }

View File

@ -96,24 +96,10 @@ PageCommentInterface.prototype = {
onFailure : function(response) { onFailure : function(response) {
alert(response.responseText); alert(response.responseText);
} }
}); });
// Clear the fields
// form.elements.Name.value = "";
form.elements.Comment.value = "";
} else { } else {
message.style.display = ''; 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; return false;

View File

@ -51,6 +51,8 @@
<div style="display:none" id="Text$Column" class="SearchCriteria">$Title:</div> <div style="display:none" id="Text$Column" class="SearchCriteria">$Title:</div>
<input style="display:none" id="Input$Column" name="$Column" class="SearchCriteria" /> <input style="display:none" id="Input$Column" name="$Column" class="SearchCriteria" />
<% end_control %> <% end_control %>
<div id="addCriteria">
<select id="SiteTreeFilterAddCriteria"> <select id="SiteTreeFilterAddCriteria">
<option><% _t('ADDSEARCHCRITERIA','Add Criteria...') %></option> <option><% _t('ADDSEARCHCRITERIA','Add Criteria...') %></option>
<option value="SiteTreeFilterDate"><% _t('EDITEDSINCE','Edited Since') %></option> <option value="SiteTreeFilterDate"><% _t('EDITEDSINCE','Edited Since') %></option>
@ -59,6 +61,7 @@
<% end_control %> <% end_control %>
</select> </select>
</div> </div>
</div>
</form> </form>
<div id="batchactionsforms" style="display: none"> <div id="batchactionsforms" style="display: none">
$DeleteItemsForm $DeleteItemsForm
@ -98,10 +101,14 @@
</h2> </h2>
<div class="listpane" id="versions_holder" style="display:none"> <div class="listpane" id="versions_holder" style="display:none">
<p class="pane_actions" id="versions_actions"> <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 />
<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> <input type="checkbox" id="versions_showall" /> <label for="versions_showall"><% _t('SHOWUNPUB','Show unpublished versions') %></label>
</span>
</p> </p>
<div class="unitBody"> <div class="unitBody">