Clean up and refine serial note support, part 1
authorDan Wells <dbw2@calvin.edu>
Tue, 17 Apr 2012 21:34:06 +0000 (17:34 -0400)
committerDan Wells <dbw2@calvin.edu>
Tue, 17 Apr 2012 22:14:18 +0000 (18:14 -0400)
This commit fixes a number of minor problems with serial notes:

1) Serial notes are currently returned in "random" (database)
order.  Adding a create_date sort is a sensible default.

2) If you have many notes, they start to display in a squashed and
unreadable fashion.  Switching from a groupbox to a styled vbox
provides a simple workaround.

3) It is currently impossible to display newlines in notes.  We can
deal with this by changing the display style.

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm
Open-ILS/xul/staff_client/server/serial/notes.xul

index 6d645ae..377069d 100644 (file)
@@ -65,6 +65,11 @@ my %MFHD_TAGS_BY_NAME = (  $MFHD_NAMES[0] => '853',
                         $MFHD_NAMES[1] => '854',
                         $MFHD_NAMES[2] => '855');
 my $_strp_date = new DateTime::Format::Strptime(pattern => '%F');
+my %FM_NAME_TO_ID = (
+    'subscription' => 'ssub',
+    'distribution' => 'sdist',
+    'item' => 'sitem'
+    );
 
 # helper method for conforming dates to ISO8601
 sub _cleanse_dates {
@@ -1947,18 +1952,19 @@ sub fetch_notes {
 
     my $id = $$args{object_id};
     my $authtoken = $$args{authtoken};
+    my $order_by = $$args{order_by} || 'create_date';
     my( $r, $evt);
 
     if( $$args{pub} ) {
         return $U->cstorereq(
             'open-ils.cstore.direct.serial.'.$type.'_note.search.atomic',
-            { $type => $id, pub => 't' } );
+            { $type => $id, pub => 't' }, {'order_by' => {$FM_NAME_TO_ID{$type}.'n' => $order_by}} );
     } else {
         # FIXME: restore perm check
         # ( $r, $evt ) = $U->checksesperm($authtoken, 'VIEW_COPY_NOTES');
         # return $evt if $evt;
         return $U->cstorereq(
-            'open-ils.cstore.direct.serial.'.$type.'_note.search.atomic', {$type => $id} );
+            'open-ils.cstore.direct.serial.'.$type.'_note.search.atomic', {$type => $id}, {'order_by' => {$FM_NAME_TO_ID{$type}.'n' => $order_by}} );
     }
 
     return undef;
index 895b913..bb6ce84 100644 (file)
        <messagecatalog id="serialStrings" src="/xul/server/locale/<!--#echo var='locale'-->/serial.properties" />
 
        <stack hidden="true" id="note_template" flex="1">
-               <groupbox flex="1" style="background-color: black;"/>
-               <groupbox flex="1" style="background-color: #FFDE00; -moz-border-radius-topright: 35px;" >
+               <vbox flex="1" style="background-color: black; margin:3px"/>
+               <vbox flex="1" style="background-color: #FFDE00; -moz-border-radius-topright: 35px; border: 2px groove ThreeDFace; margin:3px;" >
                        <hbox>
                                <description name="title" style="font-weight: bold"/>
                                <spacer flex="1"/>
                                <description name="create_date" style="font-weight: bold"/>
                                <description name="pub" style="font-weight: bold"/>
                        </hbox>
-                       <description name="value"/>
-               </groupbox>
+                       <description style="white-space: pre-wrap;" name="value"/>
+               </vbox>
        </stack>
 
        <vbox flex="1" class="my_overflow" id="notes_panel">