Commit 17531234 authored by Pramith Dayananda's avatar Pramith Dayananda Committed by Robert Lyon
Browse files

Bug 1694875: Annotation field validated via JS

Validation on portfolio collections
Validation on smartevidence grid
Behat tests added
A new feature file added

Change-Id: Ib5adf627f3391fb53805b0566a7c405313a3066b
parent 9f5861e4
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -201,7 +201,10 @@ class PluginBlocktypeAnnotation extends MaharaCoreBlocktype {
                'width' => '100%',
                'height' => $height . 'px',
                'defaultvalue' => $text,
                'rules' => array('maxlength' => 65536),
                'rules' => array(
                    'maxlength' => 65536,
                    'required' => true
                ),
            ),
            'annotationreadonlymsg' => array(
                'type' => 'html',
@@ -455,7 +458,6 @@ class PluginBlocktypeAnnotation extends MaharaCoreBlocktype {
                });
            }
        });

EOF;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ $string['makepublicrequestbyownermessage'] = '%s has requested that you make you
$string['makepublicrequestsent'] = 'A message has been sent to %s to request that the feedback be made public.';
$string['makepublicrequestbyauthormessage'] = '%s has requested that you make their feedback public.';

$string['annotationempty'] = 'This field is required.';
$string['annotationfeedbackempty'] = 'Your feedback is empty. Please enter a message.';

$string['newannotationfeedbacknotificationsubject'] = 'New feedback on %s';
+18 −9
Original line number Diff line number Diff line
@@ -163,6 +163,14 @@ jQuery(function($) {
                        values[item.name] = item.value;
                    }
                });

                if (values["text"].length == 0) {
                    if ($("#instconf_text").parent().find('.errmsg').length == 0) {
                        $("#instconf_text").parent().append('<div class="errmsg"><span>' + get_string_ajax('annotationempty', 'artefact.annotation') + '</span></div>');
                    }
                    $('#instconf button.submitcancel.submit').prop("disabled", false);
                }
                else {
                    values['tags'] = tags.join();
                    values['framework'] = params.framework;
                    values['view'] = params.view;
@@ -173,6 +181,7 @@ jQuery(function($) {
                    }
                    editmatrix_update(values);
                    hide_dock();
                }
            });
            // When we are saving the annotation feedback form - changing the evidence status
            $('#annotationfeedback').on('submit', function(se) {