merged master

This commit is contained in:
Jens W. Klein
2014-08-17 04:48:44 +02:00
140 changed files with 8593 additions and 5378 deletions
@@ -35,8 +35,9 @@
*/
reply_div.appendTo(comment_div).css("display", "none");
/* Remove id="reply" attribute, since we use it to uniquely
/* Remove id="commenting" attribute, since we use it to uniquely define
the main reply form. */
// Still belongs to class="reply"
reply_div.removeAttr("id");
/* Hide the reply button (only hide, because we may want to show it
@@ -47,6 +48,13 @@
/* Fetch the reply form inside the reply div */
var reply_form = reply_div.find("form");
/* Change the id of the textarea of the reply form
* To avoid conflict later between textareas with same id 'form-widgets-comment-text' while implementing a seperate instance of TinyMCE
* */
reply_form.find('#formfield-form-widgets-comment-text').attr('id', 'formfield-form-widgets-new-textarea'+comment_id );
reply_form.find('#form-widgets-comment-text').attr('id', 'form-widgets-new-textarea'+comment_id );
/* Populate the hidden 'in_reply_to' field with the correct comment
id */
reply_form.find("input[name='form.widgets.in_reply_to']")
@@ -127,23 +135,23 @@
parents().
filter(".comment").
find(".reply-to-comment-button");
/* Find the reply-to-comment form and hide and remove it again. */
$.reply_to_comment_form = $(this).parents().filter(".reply");
$.reply_to_comment_form.slideUp("slow", function () {
$(this).remove();
});
/* Show the reply-to-comment button again. */
reply_to_comment_button.css("display", "inline");
});
/**********************************************************************
* Publish a single comment.
**********************************************************************/
$("input[name='form.button.PublishComment']").live('click', function () {
$("input[name='form.button.PublishComment']").on('click', function () {
var trigger = this;
var form = $(this).parents("form");
var data = $(form).serialize();
@@ -151,7 +159,7 @@
$.ajax({
type: "GET",
url: form_url,
data: "workflow_action=publish",
data: data,
context: trigger,
success: function (msg) {
// remove button (trigger object can't be directly removed)
@@ -165,11 +173,20 @@
return false;
});
/**********************************************************************
* Edit a comment
**********************************************************************/
$("form[name='edit']").prepOverlay({
cssclass: 'overlay-edit-comment',
width: '60%',
subtype: 'ajax',
filter: '#content>*'
})
/**********************************************************************
* Delete a comment and its answers.
**********************************************************************/
$("input[name='form.button.DeleteComment']").live('click', function () {
$("input[name='form.button.DeleteComment']").on('click', function () {
var trigger = this;
var form = $(this).parents("form");
var data = $(form).serialize();
@@ -177,6 +194,7 @@
$.ajax({
type: 'POST',
url: form_url,
data: data,
context: $(trigger).parents(".comment"),
success: function (data) {
var comment = $(this);
@@ -7,39 +7,40 @@
// This unnamed function allows us to use $ inside of a block of code
// without permanently overwriting $.
// http://docs.jquery.com/Using_jQuery_with_Other_Libraries
/* Disable a control panel setting */
$.disableSettings = function (settings) {
$.each(settings, function (intIndex, setting) {
setting.addClass('unclickable');
var setting_field = $(setting).find("input,select");
setting_field.attr('disabled', 'disabled');
});
});
};
/* Enable a control panel setting */
$.enableSettings = function (settings) {
$.each(settings, function (intIndex, setting) {
setting.removeClass('unclickable');
var setting_field = $(setting).find("input,select");
setting_field.removeAttr('disabled');
});
});
};
/* Update settings */
$.updateSettings = function () {
var globally_enabled = $("#content").hasClass("globally_enabled");
var anonymous_comments = $("#content").hasClass("anonymous_comments");
var moderation_enabled = $("#content").hasClass("moderation_enabled");
var moderation_custom = $("#content").hasClass("moderation_custom");
var invalid_mail_setup = $("#content").hasClass("invalid_mail_setup");
/* If commenting is globally disabled, disable all settings. */
if (globally_enabled === true) {
$.enableSettings([
$('#formfield-form-widgets-anonymous_comments'),
$('#formfield-form-widgets-moderation_enabled'),
$('#formfield-form-widgets-edit_comment_enabled'),
$('#formfield-form-widgets-text_transform'),
$('#formfield-form-widgets-captcha'),
$('#formfield-form-widgets-show_commenter_image'),
@@ -52,6 +53,7 @@
$.disableSettings([
$('#formfield-form-widgets-anonymous_comments'),
$('#formfield-form-widgets-moderation_enabled'),
$('#formfield-form-widgets-edit_comment_enabled'),
$('#formfield-form-widgets-text_transform'),
$('#formfield-form-widgets-captcha'),
$('#formfield-form-widgets-show_commenter_image'),
@@ -60,7 +62,7 @@
$('#formfield-form-widgets-user_notification_enabled')
]);
}
/* If the mail setup is invalid, disable the mail settings. */
if (invalid_mail_setup === true) {
$.disableSettings([
@@ -73,14 +75,14 @@
/* Enable mail setup only if discussion is enabled. */
if (globally_enabled === true) {
$.enableSettings([
$('#formfield-form-widgets-moderator_notification_enabled'),
$('#formfield-form-widgets-moderator_email'),
$('#formfield-form-widgets-moderator_notification_enabled'),
$('#formfield-form-widgets-moderator_email'),
$('#formfield-form-widgets-user_notification_enabled')
]);
}
}
/* If a custom workflow for comments is enabled, disable the moderation
/* If a custom workflow for comments is enabled, disable the moderation
switch. */
if (moderation_custom === true) {
$.disableSettings([
@@ -89,21 +91,21 @@
}
};
//#JSCOVERAGE_IF 0
/**************************************************************************
* Window Load Function: Executes when complete page is fully loaded,
* including all frames,
**************************************************************************/
$(window).load(function () {
// Update settings on page load
$.updateSettings();
// Set #content class and update settings afterwards
$("input,select").live("change", function (e) {
$("input,select").on("change", function (e) {
var id = $(this).attr("id");
if (id === "form-widgets-globally_enabled-0") {
if ($(this).attr("checked") === true) {
if (id === "form-widgets-globally_enabled-0") {
if ($(this).attr("checked")) {
$("#content").addClass("globally_enabled");
}
else {
@@ -112,17 +114,16 @@
$.updateSettings();
}
});
/**********************************************************************
* Remove the disabled attribute from all form elements before
* Remove the disabled attribute from all form elements before
* submitting the form. Otherwise the z3c.form will raise errors on
* the required attributes.
**********************************************************************/
$("form#DiscussionSettingsEditForm").bind("submit", function (e) {
$(this).find("input,select").removeAttr('disabled');
$(this).submit();
});
});
//#JSCOVERAGE_ENDIF
@@ -17,7 +17,7 @@ content object. Each comment div has a unique id::
<div class="documentByLine"></div>
<div class="commentBody"> </div>
<div class="commentActions">
<button class="reply-to-comment-button">Reply</button>
<button class="reply-to-comment-button">Reply</button>
</div>
</div>
@@ -34,7 +34,7 @@ The comment form is rendered inside a "commenting" div::
<div id="formfield-form-widgets-in_reply_to">
<input id="form-widgets-in_reply_to"
name="form.widgets.in_reply_to" value=
type="hidden"
type="hidden"
/>
</div>
</form>
@@ -1,22 +1,22 @@
/******************************************************************************
*
*
* jQuery functions for the plone.app.discussion bulk moderation.
*
*
******************************************************************************/
(function ($) {
// This unnamed function allows us to use $ inside of a block of code
// This unnamed function allows us to use $ inside of a block of code
// without permanently overwriting $.
// http://docs.jquery.com/Using_jQuery_with_Other_Libraries
//#JSCOVERAGE_IF 0
/**************************************************************************
* Window Load Function: Executes when complete page is fully loaded,
* Window Load Function: Executes when complete page is fully loaded,
* including all frames,
**************************************************************************/
**************************************************************************/
$(window).load(function () {
/**********************************************************************
* Delete a single comment.
**********************************************************************/
@@ -47,8 +47,8 @@
}
});
});
/**********************************************************************
* Publish a single comment.
**********************************************************************/
@@ -78,8 +78,8 @@
}
});
});
/**********************************************************************
* Bulk actions for comments (delete, publish)
**********************************************************************/
@@ -116,8 +116,8 @@
selectField.find("option[value='-1']").attr('selected', 'selected');
}
});
/**********************************************************************
* Check or uncheck all checkboxes from the batch moderation page.
**********************************************************************/
@@ -134,12 +134,12 @@
$(this).val("0");
}
});
/**********************************************************************
* Show full text of a comment in the batch moderation page.
**********************************************************************/
$(".show-full-comment-text").click(function (e) {
$(".show-full-comment-text").click(function (e) {
e.preventDefault();
var target = $(this).attr("href");
var td = $(this).parent();
@@ -156,9 +156,9 @@
}
});
});
});
//#JSCOVERAGE_ENDIF
}(jQuery));