user feedback for catalog records - OPAC
authorGalen Charlton <gmc@equinoxinitiative.org>
Tue, 1 May 2018 04:56:38 +0000 (00:56 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Tue, 1 May 2018 04:56:38 +0000 (00:56 -0400)
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm
Open-ILS/src/templates/opac/parts/record/summary.tt2

index 2e48ce3..ae207e2 100644 (file)
@@ -26,6 +26,10 @@ sub load_record {
     return Apache2::Const::HTTP_BAD_REQUEST 
         unless $rec_id and $rec_id =~ /^\d+$/;
 
+    if (my $feedback = $self->cgi->param('record_feedback')) {
+        $self->_record_feedback($rec_id, $feedback);
+        $ctx->{feedback_left} = 1;
+    }
     $self->added_content_stage1($rec_id);
     $self->timelog("past added content stage 1");
 
@@ -252,6 +256,17 @@ sub load_record {
     return Apache2::Const::OK;
 }
 
+sub _record_feedback {
+    my ($self, $record, $feedback) = @_;
+    my $e = $self->editor;
+    my $brf = Fieldmapper::biblio::record_feedback->new;
+    $brf->record($record);
+    $brf->value($feedback);
+    $e->xact_begin;
+    $e->create_biblio_record_feedback($brf);
+    $e->xact_commit;
+}
+
 # collect IDs and info on the search that lead to this details page
 # If no search query, etc is present, we leave ctx.search_result_index == -1
 sub fetch_related_search_info {
index 7797c5e..5a72287 100644 (file)
                 </a>
             </div>
             [% END %]
+            <div class="rdetail_aux_utils feedback">
+                <img src="[% ctx.media_prefix %]/images/clipboard.png[% ctx.cache_key %]" alt="[% l('Give Feedback') %]" />
+                <a onclick="document.getElementById('record_feedback').style.display = 'block'" class="no-dec" rel="nofollow" vocab="">[% l('Give Feedback') %]</a>
+            </div>
             [%- IF ctx.is_staff %]
             <div class="rdetail_aux_utils clear_addedcontent_cache">
                 <a href="[% ctx.media_prefix %]/opac/extras/ac/clearcache/all/r/[% ctx.bre_id | uri %]" class="no-dec" target="_blank">
@@ -224,6 +228,23 @@ IF ebook_api.enabled == 'true';
 END;
 %]
 [%- END %]
+[%- IF ctx.feedback_left %]
+    <h2 class='success'>[% l('Thank you for leaving feedback about this record') %]</h2>
+[%- END %]
+<div id="record_feedback" style="display: none;">
+    <form method="post">
+        <table><tbody>
+            <tr><td>
+                <label for="record_feedback" style="vertical-align: top; font-weight: bold;">Leave feedback about this catalog record.</label>
+                <textarea name="record_feedback" id="record_feedback" rows="5" cols="80"></textarea>
+            </td></tr>
+            <tr><td>
+                <input type="reset" value="[% l('Cancel') %]" alt="[% l('Cancel') %]" onclick="document.getElementById('record_feedback').style.display = 'none'" class="opac-button" />
+                <input type="submit" value="[% l('Submit') %]" alt="[% l('Submit') %]" class="opac-button"/>
+            </td></tr>
+        </tbody></table>
+    </form>
+</div>
 <div id="copy_hold_counts">
 [%-
 # Hold/copy summary