Commit 4e6603ce authored by Richard Mansfield's avatar Richard Mansfield

Use tinymce to edit feedback and remove bbcode formatting from existing feedback

Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 804ef618
......@@ -2,13 +2,13 @@
function addFeedbackSuccess(form, data) {
addElementClass('add_feedback_form', 'js-hidden');
$('add_feedback_form_message').innerHTML = '';
paginator.updateResults(data);
$('add_feedback_form_message').value = '';
}
function objectionSuccess() {
addElementClass('objection_form', 'js-hidden');
$('objection_form_message').innerHTML = '';
$('objection_form_message').value = '';
}
addLoadEvent(function () {
......@@ -19,7 +19,6 @@ addLoadEvent(function () {
if ($('objection_form')) {
addElementClass('objection_form', 'js-hidden');
}
$('add_feedback_form').reset();
removeElementClass('add_feedback_form', 'js-hidden');
return false;
});
......@@ -38,7 +37,6 @@ addLoadEvent(function () {
if ($('add_feedback_form')) {
addElementClass('add_feedback_form', 'js-hidden');
}
$('objection_form').reset();
removeElementClass('objection_form', 'js-hidden');
return false;
});
......
......@@ -1216,6 +1216,22 @@ function xmldb_core_upgrade($oldversion=0) {
ensure_record_exists('event_type', $event, $event);
}
if ($oldversion < 2009101600) {
// Remove bbcode formatting from existing feedback
if ($records = get_records_sql_array("SELECT * FROM {view_feedback} WHERE message LIKE '%[%'", array())) {
foreach ($records as &$r) {
$r->message = parse_bbcode($r->message);
update_record('view_feedback', $r);
}
}
if ($records = get_records_sql_array("SELECT * FROM {artefact_feedback} WHERE message LIKE '%[%'", array())) {
foreach ($records as &$r) {
$r->message = parse_bbcode($r->message);
update_record('artefact_feedback', $r);
}
}
}
return $status;
}
......
......@@ -2220,7 +2220,7 @@ function build_portfolio_search_html(&$data) {
function build_feedback_html(&$data) {
foreach ($data->data as &$item) {
$item->date = format_date(strtotime($item->ctime), 'strftimedatetime');
$item->message = clean_html(parse_bbcode($item->message));
$item->message = clean_html($item->message);
$item->name = $item->author ? display_name($item->author) : $item->authorname;
if (!empty($item->attachment)) {
$item->attachid = $item->attachment;
......
......@@ -28,7 +28,7 @@
defined('INTERNAL') || die();
$config = new StdClass;
$config->version = 2009101501;
$config->version = 2009101600;
$config->release = '1.2.0beta5dev';
$config->minupgradefrom = 2008040200;
$config->minupgraderelease = '1.0.0 (release tag 1.0.0_RELEASE)';
......
......@@ -2683,11 +2683,10 @@ function add_feedback_form($attachments=false) {
);
}
$form['elements']['message'] = array(
'type' => 'textarea',
'type' => 'wysiwyg',
'title' => get_string('message'),
'rows' => 5,
'cols' => 80,
'description' => bbcode_format_post_message(),
);
$form['elements']['ispublic'] = array(
'type' => 'checkbox',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment