Merge serials-integration branch, incorporating new work from Dan Wells.
authorsenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 10 Nov 2010 17:54:34 +0000 (17:54 +0000)
committersenator <senator@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 10 Nov 2010 17:54:34 +0000 (17:54 +0000)
Specifically, this contains changesets 18670, 18669, 18379, and 18373.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@18685 dcc99617-32d9-48b4-a31d-7c20da2025e4

18 files changed:
Open-ILS/src/perlmods/OpenILS/Application/Serial.pm
Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/chrome/content/main/constants.js
Open-ILS/xul/staff_client/server/locale/en-US/serial.properties
Open-ILS/xul/staff_client/server/serial/editor_base.js
Open-ILS/xul/staff_client/server/serial/manage_dists.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/serial/manage_dists.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/serial/manage_subs.js
Open-ILS/xul/staff_client/server/serial/sbsum_editor.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/serial/sbsum_editor.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/serial/sdist2_editor.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/serial/sdist_editor.js
Open-ILS/xul/staff_client/server/serial/sisum_editor.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/serial/sisum_editor.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/serial/sssum_editor.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/serial/sssum_editor.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/server/serial/sstr_editor.js [new file with mode: 0644]
Open-ILS/xul/staff_client/server/serial/sstr_editor.xul [new file with mode: 0644]

index dcdb11d..adcbe48 100644 (file)
@@ -668,7 +668,7 @@ sub make_predictions {
 
     my $editor = OpenILS::Utils::CStoreEditor->new();
     my $ssub_id = $args->{ssub_id};
-    my $all_dists = $args->{all_dists};
+    my $all_dists = $args->{all_dists}; #TODO: this option supports test-level code, will be removed (i.e. always 'true')
     my $mfhd = MFHD->new(MARC::Record->new());
 
     my $ssub = $editor->retrieve_serial_subscription([$ssub_id]);
@@ -893,17 +893,47 @@ __PACKAGE__->register_method(
                  name => 'items',
                  desc => 'array of serial items',
                  type => 'array'
+            },
+            {
+                 name => 'barcodes',
+                 desc => 'hash of item_ids => barcodes',
+                 type => 'hash'
+            }
+        ],
+        'return' => {
+            desc => 'Returns number of received items (num_items) and new unit ID, if applicable (new_unit_id)',
+            type => 'hashref'
+        }
+    }
+);
+
+__PACKAGE__->register_method(
+    method    => 'unitize_items',
+    api_name  => 'open-ils.serial.bind_items',
+    api_level => 1,
+    argc      => 1,
+    signature => {
+        desc     => 'Marks an item as bound, updates the shelving unit (creating a new shelving unit if needed)',
+        'params' => [ {
+                 name => 'items',
+                 desc => 'array of serial items',
+                 type => 'array'
+            },
+            {
+                 name => 'barcodes',
+                 desc => 'hash of item_ids => barcodes',
+                 type => 'hash'
             }
         ],
         'return' => {
-            desc => 'Returns number of received items',
-            type => 'int'
+            desc => 'Returns number of bound items (num_items) and new unit ID, if applicable (new_unit_id)',
+            type => 'hashref'
         }
     }
 );
 
 sub unitize_items {
-    my ($self, $conn, $auth, $items) = @_;
+    my ($self, $conn, $auth, $items, $barcodes) = @_;
 
     my( $reqr, $evt ) = $U->checkses($auth);
     return $evt if $evt;
@@ -959,7 +989,8 @@ sub unitize_items {
         if ($unit_id == -1 or (!$new_unit_id and $unit_id == -2)) { # create unit per item
             my $unit;
             my $sdists = $editor->search_serial_distribution([{"+sstr" => {"id" => $stream_id}}, { "join" => {"sstr" => {}} }]);
-            $unit = _build_unit($editor, $sdists->[0], $mode);
+            $unit = _build_unit($editor, $sdists->[0], $mode, 0, $barcodes->{$item->id});
+            # TODO: catch events from _build_unit
             my $evt =  _create_sunit($editor, $unit);
             return $evt if $evt;
             if ($unit_id == -2) {
@@ -995,7 +1026,7 @@ sub unitize_items {
     foreach my $unit_id (keys %found_unit_ids) {
 
         # get all the needed issuances for unit
-        my $issuances = $editor->search_serial_issuance([ {"+sitem" => {"unit" => $unit_id, "status" => "Received"}}, {"join" => {"sitem" => {}}, "order_by" => {"siss" => "date_published"}} ]);
+        my $issuances = $editor->search_serial_issuance([ {"+sitem" => {"unit" => $unit_id, "status" => ["Received", "Bindery"]}}, {"join" => {"sitem" => {}}, "order_by" => {"siss" => "date_published"}} ]);
         #TODO: evt on search failure
 
         my ($mfhd, $formatted_parts) = _summarize_contents($editor, $issuances);
@@ -1038,7 +1069,11 @@ sub unitize_items {
         return $evt if $evt;
     }
 
-    # TODO: cleanup 'dead' units (units which are now emptied of their items)
+    # cleanup 'dead' units (units which are now emptied of their items)
+    my $dead_units = $editor->search_serial_unit([{'+sitem' => {'id' => undef}, 'deleted' => 'f'}, {'join' => {'sitem' => {'type' => 'left'}}}]);
+    foreach my $unit (@$dead_units) {
+        _delete_sunit($editor, undef, $unit);
+    }
 
     if ($mode eq 'receive') { # the summary holdings do not change when binding
         # deal with stream level summaries
@@ -1090,7 +1125,7 @@ sub unitize_items {
     }
 
     $editor->commit;
-    return {'num_items_received' => scalar @$items, 'new_unit_id' => $new_unit_id};
+    return {'num_items' => scalar @$items, 'new_unit_id' => $new_unit_id};
 }
 
 sub _find_or_create_call_number {
@@ -1438,6 +1473,7 @@ sub _build_unit {
     my $sdist = shift;
     my $mode = shift;
     my $skip_call_number = shift;
+    my $barcode = shift;
 
     my $attr = $mode . '_unit_template';
     my $template = $editor->retrieve_asset_copy_template($sdist->$attr) or
@@ -1465,7 +1501,11 @@ sub _build_unit {
         $unit->call_number($cn);
     }
 
-    $unit->barcode('AUTO');
+    if ($barcode) {
+        $unit->barcode($barcode);
+    } else {
+        $unit->barcode('AUTO');
+    }
     $unit->sort_key('');
     $unit->summary_contents('');
     $unit->detailed_contents('');
@@ -2068,6 +2108,81 @@ sub fleshed_serial_distribution_retrieve_batch {
         });
 }
 
+__PACKAGE__->register_method(
+    method  => "retrieve_dist_tree",
+    authoritative => 1,
+    api_name    => "open-ils.serial.distribution_tree.retrieve"
+);
+
+__PACKAGE__->register_method(
+    method  => "retrieve_dist_tree",
+    api_name    => "open-ils.serial.distribution_tree.global.retrieve"
+);
+
+sub retrieve_dist_tree {
+    my( $self, $client, $user_session, $docid, @org_ids ) = @_;
+
+    if(ref($org_ids[0])) { @org_ids = @{$org_ids[0]}; }
+
+    $docid = "$docid";
+
+    # TODO: permission support
+    if(!@org_ids and $user_session) {
+        my $user_obj =
+            OpenILS::Application::AppUtils->check_user_session( $user_session ); #throws EX on error
+            @org_ids = ($user_obj->home_ou);
+    }
+
+    my $e = new_editor();
+
+    if( $self->api_name =~ /global/ ) {
+        return $e->search_serial_distribution([{'+ssub' => { record_entry => $docid }},
+            {   flesh => 1,
+                flesh_fields => {sdist => [ qw/ holding_lib receive_call_number receive_unit_template bind_call_number bind_unit_template streams basic_summary supplement_summary index_summary / ]},
+                order_by => {'sdist' => 'id'},
+                'join' => {'ssub' => {}}
+            }
+        ]); # TODO: filter for !deleted?
+
+    } else {
+        my @all_dists;
+        for my $orgid (@org_ids) {
+            my $dists = $e->search_serial_distribution([{'+ssub' => { record_entry => $docid }, holding_lib => $orgid},
+                {   flesh => 1,
+                    flesh_fields => {sdist => [ qw/ holding_lib receive_call_number receive_unit_template bind_call_number bind_unit_template streams basic_summary supplement_summary index_summary / ]},
+                    order_by => {'sdist' => 'id'},
+                    'join' => {'ssub' => {}}
+                }
+            ]); # TODO: filter for !deleted?
+            push( @all_dists, @$dists ) if $dists;
+        }
+
+        return \@all_dists;
+    }
+
+    return undef;
+}
+
+
+__PACKAGE__->register_method(
+    method  => "distribution_orgs_for_title",
+    authoritative => 1,
+    api_name    => "open-ils.serial.distribution.retrieve_orgs_by_title"
+);
+
+sub distribution_orgs_for_title {
+    my( $self, $client, $record_id ) = @_;
+
+    my $dists = $U->cstorereq(
+        "open-ils.cstore.direct.serial.distribution.search.atomic",
+        { '+ssub' => { record_entry => $record_id } },
+        { 'join' => {'ssub' => {}} }); # TODO: filter on !deleted?
+
+    my $orgs = { map {$_->holding_lib => 1 } @$dists };
+    return [ keys %$orgs ];
+}
+
+
 ##########################################################################
 # caption and pattern methods
 #
@@ -2179,6 +2294,288 @@ sub serial_caption_and_pattern_retrieve_batch {
     );
 }
 
+##########################################################################
+# stream methods
+#
+__PACKAGE__->register_method(
+    method    => 'sstr_alter',
+    api_name  => 'open-ils.serial.stream.batch.update',
+    api_level => 1,
+    argc      => 2,
+    signature => {
+        desc     => 'Receives an array of one or more streams and updates the database as needed',
+        'params' => [ {
+                 name => 'authtoken',
+                 desc => 'Authtoken for current user session',
+                 type => 'string'
+            },
+            {
+                 name => 'sstrs',
+                 desc => 'Array of streams',
+                 type => 'array'
+            }
+
+        ],
+        'return' => {
+            desc => 'Returns 1 if successful, event if failed',
+            type => 'mixed'
+        }
+    }
+);
+
+sub sstr_alter {
+    my( $self, $conn, $auth, $sstrs ) = @_;
+    return 1 unless ref $sstrs;
+    my( $reqr, $evt ) = $U->checkses($auth);
+    return $evt if $evt;
+    my $editor = new_editor(requestor => $reqr, xact => 1);
+    my $override = $self->api_name =~ /override/;
+
+# TODO: permission check
+#        return $editor->event unless
+#            $editor->allowed('UPDATE_COPY', $class->copy_perm_org($vol, $copy));
+
+    for my $sstr (@$sstrs) {
+        my $sstrid = $sstr->id;
+
+        if( $sstr->isdeleted ) {
+            $evt = _delete_sstr( $editor, $override, $sstr);
+        } elsif( $sstr->isnew ) {
+            $evt = _create_sstr( $editor, $sstr );
+        } else {
+            $evt = _update_sstr( $editor, $override, $sstr );
+        }
+    }
+
+    if( $evt ) {
+        $logger->info("stream-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $editor->rollback;
+        return $evt;
+    }
+    $logger->debug("stream-alter: done updating stream batch");
+    $editor->commit;
+    $logger->info("stream-alter successfully updated ".scalar(@$sstrs)." streams");
+    return 1;
+}
+
+sub _delete_sstr {
+    my ($editor, $override, $sstr) = @_;
+    $logger->info("stream-alter: delete stream ".OpenSRF::Utils::JSON->perl2JSON($sstr));
+    my $sitems = $editor->search_serial_item(
+            { stream => $sstr->id }, { limit => 1 } ); #TODO: 'deleted' support?
+    return OpenILS::Event->new(
+            'SERIAL_STREAM_HAS_ITEMS', payload => $sstr->id ) if (@$sitems);
+
+    return $editor->event unless $editor->delete_serial_stream($sstr);
+    return 0;
+}
+
+sub _create_sstr {
+    my ($editor, $sstr) = @_;
+
+    $logger->info("stream-alter: new stream ".OpenSRF::Utils::JSON->perl2JSON($sstr));
+    return $editor->event unless $editor->create_serial_stream($sstr);
+    return 0;
+}
+
+sub _update_sstr {
+    my ($editor, $override, $sstr) = @_;
+
+    $logger->info("stream-alter: retrieving stream ".$sstr->id);
+    my $orig_sstr = $editor->retrieve_serial_stream($sstr->id);
+
+    $logger->info("stream-alter: original stream ".OpenSRF::Utils::JSON->perl2JSON($orig_sstr));
+    $logger->info("stream-alter: updated stream ".OpenSRF::Utils::JSON->perl2JSON($sstr));
+    return $editor->event unless $editor->update_serial_stream($sstr);
+    return 0;
+}
+
+__PACKAGE__->register_method(
+    method  => "serial_stream_retrieve_batch",
+    authoritative => 1,
+    api_name    => "open-ils.serial.stream.batch.retrieve"
+);
+
+sub serial_stream_retrieve_batch {
+    my( $self, $client, $ids ) = @_;
+    $logger->info("Fetching streams @$ids");
+    return $U->cstorereq(
+        "open-ils.cstore.direct.serial.stream.search.atomic",
+        { id => $ids }
+    );
+}
+
+
+##########################################################################
+# summary methods
+#
+__PACKAGE__->register_method(
+    method    => 'sum_alter',
+    api_name  => 'open-ils.serial.basic_summary.batch.update',
+    api_level => 1,
+    argc      => 2,
+    signature => {
+        desc     => 'Receives an array of one or more summaries and updates the database as needed',
+        'params' => [ {
+                 name => 'authtoken',
+                 desc => 'Authtoken for current user session',
+                 type => 'string'
+            },
+            {
+                 name => 'sbsums',
+                 desc => 'Array of basic summaries',
+                 type => 'array'
+            }
+
+        ],
+        'return' => {
+            desc => 'Returns 1 if successful, event if failed',
+            type => 'mixed'
+        }
+    }
+);
+
+__PACKAGE__->register_method(
+    method    => 'sum_alter',
+    api_name  => 'open-ils.serial.supplement_summary.batch.update',
+    api_level => 1,
+    argc      => 2,
+    signature => {
+        desc     => 'Receives an array of one or more summaries and updates the database as needed',
+        'params' => [ {
+                 name => 'authtoken',
+                 desc => 'Authtoken for current user session',
+                 type => 'string'
+            },
+            {
+                 name => 'sbsums',
+                 desc => 'Array of supplement summaries',
+                 type => 'array'
+            }
+
+        ],
+        'return' => {
+            desc => 'Returns 1 if successful, event if failed',
+            type => 'mixed'
+        }
+    }
+);
+
+__PACKAGE__->register_method(
+    method    => 'sum_alter',
+    api_name  => 'open-ils.serial.index_summary.batch.update',
+    api_level => 1,
+    argc      => 2,
+    signature => {
+        desc     => 'Receives an array of one or more summaries and updates the database as needed',
+        'params' => [ {
+                 name => 'authtoken',
+                 desc => 'Authtoken for current user session',
+                 type => 'string'
+            },
+            {
+                 name => 'sbsums',
+                 desc => 'Array of index summaries',
+                 type => 'array'
+            }
+
+        ],
+        'return' => {
+            desc => 'Returns 1 if successful, event if failed',
+            type => 'mixed'
+        }
+    }
+);
+
+sub sum_alter {
+    my( $self, $conn, $auth, $sums ) = @_;
+    return 1 unless ref $sums;
+
+    $self->api_name =~ /serial\.(\w*)_summary/;
+    my $type = $1;
+
+    my( $reqr, $evt ) = $U->checkses($auth);
+    return $evt if $evt;
+    my $editor = new_editor(requestor => $reqr, xact => 1);
+    my $override = $self->api_name =~ /override/;
+
+# TODO: permission check
+#        return $editor->event unless
+#            $editor->allowed('UPDATE_COPY', $class->copy_perm_org($vol, $copy));
+
+    for my $sum (@$sums) {
+        my $sumid = $sum->id;
+
+        # XXX: (for now, at least) summaries should be created/deleted by the distribution functions
+        if( $sum->isdeleted ) {
+            $evt = OpenILS::Event->new('SERIAL_SUMMARIES_NOT_INDEPENDENT');
+        } elsif( $sum->isnew ) {
+            $evt = OpenILS::Event->new('SERIAL_SUMMARIES_NOT_INDEPENDENT');
+        } else {
+            $evt = _update_sum( $editor, $override, $sum, $type );
+        }
+    }
+
+    if( $evt ) {
+        $logger->info("${type}_summary-alter failed with event: ".OpenSRF::Utils::JSON->perl2JSON($evt));
+        $editor->rollback;
+        return $evt;
+    }
+    $logger->debug("${type}_summary-alter: done updating ${type}_summary batch");
+    $editor->commit;
+    $logger->info("${type}_summary-alter successfully updated ".scalar(@$sums)." ${type}_summaries");
+    return 1;
+}
+
+sub _update_sum {
+    my ($editor, $override, $sum, $type) = @_;
+
+    $logger->info("${type}_summary-alter: retrieving ${type}_summary ".$sum->id);
+    my $retrieve_method = "retrieve_serial_${type}_summary";
+    my $orig_sum = $editor->$retrieve_method($sum->id);
+
+    $logger->info("${type}_summary-alter: original ${type}_summary ".OpenSRF::Utils::JSON->perl2JSON($orig_sum));
+    $logger->info("${type}_summary-alter: updated ${type}_summary ".OpenSRF::Utils::JSON->perl2JSON($sum));
+    my $update_method = "update_serial_${type}_summary";
+    return $editor->event unless $editor->$update_method($sum);
+    return 0;
+}
+
+__PACKAGE__->register_method(
+    method  => "serial_summary_retrieve_batch",
+    authoritative => 1,
+    api_name    => "open-ils.serial.basic_summary.batch.retrieve"
+);
+
+__PACKAGE__->register_method(
+    method  => "serial_summary_retrieve_batch",
+    authoritative => 1,
+    api_name    => "open-ils.serial.supplement_summary.batch.retrieve"
+);
+
+__PACKAGE__->register_method(
+    method  => "serial_summary_retrieve_batch",
+    authoritative => 1,
+    api_name    => "open-ils.serial.index_summary.batch.retrieve"
+);
+
+sub serial_summary_retrieve_batch {
+    my( $self, $client, $ids ) = @_;
+
+    $self->api_name =~ /serial\.(\w*)_summary/;
+    my $type = $1;
+
+    $logger->info("Fetching ${type}_summaries @$ids");
+    return $U->cstorereq(
+        "open-ils.cstore.direct.serial.".$type."_summary.search.atomic",
+        { id => $ids }
+    );
+}
+
+
+##########################################################################
+# other methods
+#
 __PACKAGE__->register_method(
     "method" => "bre_by_identifier",
     "api_name" => "open-ils.serial.biblio.record_entry.by_identifier",
index a125142..c0e49b5 100644 (file)
 <!ENTITY staff.serial.scap_editor.create.accesskey "C">
 <!ENTITY staff.serial.scap_editor.notes "Caption and Pattern Notes">
 <!ENTITY staff.serial.scap_editor.notes.accesskey "N">
+<!ENTITY staff.serial.sbsum_editor.modify "Modify Basic Summary">
+<!ENTITY staff.serial.sbsum_editor.modify.accesskey "M">
+<!ENTITY staff.serial.sisum_editor.modify "Modify Index Summary">
+<!ENTITY staff.serial.sisum_editor.modify.accesskey "M">
+<!ENTITY staff.serial.sssum_editor.modify "Modify Supplement Summary">
+<!ENTITY staff.serial.sssum_editor.modify.accesskey "M">
 <!ENTITY staff.serial.sdist_editor.modify "Modify Distribution(s)">
 <!ENTITY staff.serial.sdist_editor.modify.accesskey "M">
 <!ENTITY staff.serial.sdist_editor.create "Create Distribution(s)">
 <!ENTITY staff.serial.sitem_editor.create.accesskey "C">
 <!ENTITY staff.serial.sitem_editor.notes "Item Notes">
 <!ENTITY staff.serial.sitem_editor.notes.accesskey "N">
+<!ENTITY staff.serial.sstr_editor.modify "Modify Stream(s)">
+<!ENTITY staff.serial.sstr_editor.modify.accesskey "M">
+<!ENTITY staff.serial.sstr_editor.create "Create Stream(s)">
+<!ENTITY staff.serial.sstr_editor.create.accesskey "C">
 <!ENTITY staff.serial.ssub_editor.modify "Modify Subscription(s)">
 <!ENTITY staff.serial.ssub_editor.modify.accesskey "M">
 <!ENTITY staff.serial.ssub_editor.create "Create Subscription(s)">
index 459cd65..00521de 100644 (file)
@@ -281,13 +281,19 @@ var api = {
     'MARC_HTML_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.html', 'secure' : false },
     'FM_BLOB_RETRIEVE_VIA_Z3950_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_class' },
     'FM_BLOB_RETRIEVE_VIA_Z3950_RAW_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_service' },
+    'FM_SBSUM_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.basic_summary.batch.retrieve', 'secure' : false },
+    'FM_SBSUM_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.basic_summary.batch.retrieve.authoritative', 'secure' : false },
     'FM_SCAP_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.caption_and_pattern.batch.retrieve', 'secure' : false },
     'FM_SCAP_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.caption_and_pattern.batch.retrieve', 'secure' : false },
+    'FM_SDIST_AOU_IDS_RETRIEVE_VIA_RECORD_ID' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution.retrieve_orgs_by_title', 'secure' : false },
+    'FM_SDIST_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution.retrieve_orgs_by_title.authoritative', 'secure' : false },
     'FM_SDIST_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution.fleshed.batch.retrieve', 'secure' : false },
     'FM_SDIST_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution.fleshed.batch.retrieve.authoritative', 'secure' : false },
     'FM_SDIST_ID_LIST' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.id_list.sdist'},
     'FM_SDIST_RETRIEVE' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.retrieve.sdist'},
     'FM_SDIST_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.sdist'},
+    'FM_SDIST_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution_tree.retrieve', 'secure' : false },
+    'FM_SDIST_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution_tree.retrieve.authoritative', 'secure' : false },
     'FM_SDISTN_CREATE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution_note.create' },
     'FM_SDISTN_DELETE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution_note.delete', 'secure' : false },
     'FM_SDISTN_RETRIEVE_ALL' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution_note.retrieve.all', 'secure' : false },
@@ -296,6 +302,8 @@ var api = {
     'FM_SIN_RETRIEVE_ALL' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.item_note.retrieve.all', 'secure' : false },
     'FM_SISS_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.issuance.fleshed.batch.retrieve', 'secure' : false },
     'FM_SISS_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.issuance.fleshed.batch.retrieve.authoritative', 'secure' : false },
+    'FM_SISUM_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.index_summary.batch.retrieve', 'secure' : false },
+    'FM_SISUM_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.index_summary.batch.retrieve.authoritative', 'secure' : false },
     'FM_SITEM_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.item.fleshed.batch.retrieve', 'secure' : false },
     'FM_SITEM_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.item.fleshed.batch.retrieve.authoritative', 'secure' : false },
     'FM_SITEM_ID_LIST' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.id_list.sitem'},
@@ -303,6 +311,10 @@ var api = {
     'FM_SITEM_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.sitem'},
     'FM_SRE_RETRIEVE' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.retrieve.sre'},
     'FM_SRE_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.sre'},
+    'FM_SSSUM_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.supplement_summary.batch.retrieve', 'secure' : false },
+    'FM_SSSUM_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.supplement_summary.batch.retrieve.authoritative', 'secure' : false },
+    'FM_SSTR_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.stream.batch.retrieve', 'secure' : false },
+    'FM_SSTR_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.stream.batch.retrieve.authoritative', 'secure' : false },
     'FM_SSUB_AOU_IDS_RETRIEVE_VIA_RECORD_ID' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription.retrieve_orgs_by_title', 'secure' : false },
     'FM_SSUB_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription.retrieve_orgs_by_title.authoritative', 'secure' : false },
     'FM_SSUB_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription.fleshed.batch.retrieve', 'secure' : false },
index 84b0669..9df7045 100644 (file)
@@ -1,5 +1,17 @@
 staff.serial.editor_base.handle_update.error=serial update error:
 staff.serial.editor_base.handle_update.success=Save Successful
+staff.serial.sbsum_editor.count=1 summary
+staff.serial.sbsum_editor.count.plural=%1$s summaries
+staff.serial.sbsum_editor.modify=Modify Basic Summary
+staff.serial.sbsum_editor.modify.accesskey=M
+staff.serial.sisum_editor.count=1 summary
+staff.serial.sisum_editor.count.plural=%1$s summaries
+staff.serial.sisum_editor.modify=Modify Index Summary
+staff.serial.sisum_editor.modify.accesskey=M
+staff.serial.sssum_editor.count=1 summary
+staff.serial.sssum_editor.count.plural=%1$s summaries
+staff.serial.sssum_editor.modify=Modify Supplement Summary
+staff.serial.sssum_editor.modify.accesskey=M
 staff.serial.scap_editor.count=1 caption and pattern
 staff.serial.scap_editor.count.plural=%1$s caption and patterns
 staff.serial.scap_editor.create=Create Caption and Pattern(s)
@@ -28,6 +40,12 @@ staff.serial.sitem_editor.create.accesskey=C
 staff.serial.sitem_editor.modify=Modify Item(s)
 staff.serial.sitem_editor.modify.accesskey=M
 staff.serial.sitem_editor.notes=Item Notes
+staff.serial.sstr_editor.count=1 stream
+staff.serial.sstr_editor.count.plural=%1$s streams
+staff.serial.sstr_editor.create=Create Stream(s)
+staff.serial.sstr_editor.create.accesskey=C
+staff.serial.sstr_editor.modify=Modify Stream(s)
+staff.serial.sstr_editor.modify.accesskey=M
 staff.serial.ssub_editor.count=1 subscription
 staff.serial.ssub_editor.count.plural=%1$s subscriptions
 staff.serial.ssub_editor.create=Create Subscription(s)
index 4caf526..13f1736 100644 (file)
@@ -45,6 +45,11 @@ serial.editor_base = {
             if (!retrieve_params) {
                 retrieve_params = [];
             }
+            if (params.xul_id_prefix) {
+                obj.xul_id_prefix = params.xul_id_prefix;
+            } else {
+                obj.xul_id_prefix = fm_type;
+            }
 
             /******************************************************************************************************/
             /* Get the fm_type ids from various sources and flesh them */
@@ -136,7 +141,7 @@ serial.editor_base = {
                 }
 
                 if (obj.do_edit) {
-                    $(fm_type + '_save').setAttribute('hidden','false'); 
+                    $(obj.xul_id_prefix + '_save').setAttribute('hidden','false'); 
                 } else {
                     $('top_nav').setAttribute('hidden','true');
                 }
@@ -147,14 +152,14 @@ serial.editor_base = {
 
             if (obj[fm_type_plural].length > 0 && obj[fm_type_plural][0].isnew()) {
                 obj.mode = 'create';
-                if (obj.can_have_notes) $(fm_type + '_notes').setAttribute('hidden','true');
-                $(fm_type + '_save').setAttribute('label', $('serialStrings').getString('staff.serial.' + fm_type + '_editor.create'));
-                $(fm_type + '_save').setAttribute('accesskey', $('serialStrings').getString('staff.serial.' + fm_type + '_editor.create.accesskey'));
+                if (obj.can_have_notes) $(obj.xul_id_prefix + '_notes').setAttribute('hidden','true');
+                $(obj.xul_id_prefix + '_save').setAttribute('label', $('serialStrings').getString('staff.serial.' + fm_type + '_editor.create'));
+                $(obj.xul_id_prefix + '_save').setAttribute('accesskey', $('serialStrings').getString('staff.serial.' + fm_type + '_editor.create.accesskey'));
             } else if (obj.mode == 'create') { // switching from create to modify
                 obj.mode = 'modify';
-                if (obj.can_have_notes) $(fm_type + '_notes').setAttribute('hidden','false');
-                $(fm_type + '_save').setAttribute('label', $('serialStrings').getString('staff.serial.' + fm_type + '_editor.modify'));
-                $(fm_type + '_save').setAttribute('accesskey', $('serialStrings').getString('staff.serial.' + fm_type + '_editor.modify.accesskey'));
+                if (obj.can_have_notes) $(obj.xul_id_prefix + '_notes').setAttribute('hidden','false');
+                $(obj.xul_id_prefix + '_save').setAttribute('label', $('serialStrings').getString('staff.serial.' + fm_type + '_editor.modify'));
+                $(obj.xul_id_prefix + '_save').setAttribute('accesskey', $('serialStrings').getString('staff.serial.' + fm_type + '_editor.modify.accesskey'));
             }
 /*else {
                 obj.panes_and_field_names.left_pane = 
@@ -171,7 +176,7 @@ serial.editor_base = {
             }*/
 
             if (obj[fm_type_plural].length != 1) {
-                document.getElementById(fm_type + '_notes').setAttribute('hidden','true');
+                if (obj.can_have_notes) $(obj.xul_id_prefix + '_notes').setAttribute('hidden','true');
             }
 
             // clear change markers
diff --git a/Open-ILS/xul/staff_client/server/serial/manage_dists.js b/Open-ILS/xul/staff_client/server/serial/manage_dists.js
new file mode 100644 (file)
index 0000000..2adcd4a
--- /dev/null
@@ -0,0 +1,1337 @@
+dump('entering serial/manage_dists.js\n');
+// vim:noet:sw=4:ts=4:
+
+if (typeof serial == 'undefined') serial = {};
+serial.manage_dists = function (params) {
+    try {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+        JSAN.use('util.error'); this.error = new util.error();
+    } catch(E) {
+        dump('serial/manage_dists: ' + E + '\n');
+    }
+};
+
+serial.manage_dists.prototype = {
+
+    'map_tree' : {},
+    'map_sdist' : {},
+    //'map_sstr' : {},
+    'sel_list' : [],
+    'funcs' : [],
+    'editor_indexes' : { 'sdist' : 1, 'sstr' : 2, 'sbsum' : 3, 'sssum' : 4, 'sisum' : 5 },
+
+    'ids_from_sel_list' : function(type) {
+        var obj = this;
+        JSAN.use('util.functional');
+
+        var list = util.functional.map_list(
+            util.functional.filter_list(
+                obj.sel_list,
+                function (o) {
+                    return o.split(/_/)[0] == type;
+                }
+            ),
+            function (o) {
+                return o.split(/_/)[1];
+            }
+        );
+
+        return list;
+    },
+
+    'editor_init' : function(type, mode, params) {
+        var obj = this;
+        try {
+            $('serial_manage_dists_editor_deck').selectedIndex = obj.editor_indexes[type];
+            var editor_type = type + '_editor';
+            if (typeof obj[editor_type] == 'undefined') {
+                JSAN.use('serial.' + editor_type);
+                obj[editor_type] = new serial[editor_type](); 
+            }
+
+            params.do_edit = true;
+            params.handle_update = true;
+            if (mode == 'add') {
+                params.trigger_refresh = true;
+                params.refresh_command = function () {obj.refresh_list();};
+            }
+            obj[editor_type].init(params);
+        } catch(E) {
+            obj.error.standard_unexpected_error_alert('editor_init() error',E);
+        }
+    },
+
+    'do_delete' : function(type, method, overridable_events) {
+        var obj = this;
+        try {
+            JSAN.use('util.functional');
+
+            var list = util.functional.filter_list(
+                obj.sel_list,
+                function (o) {
+                    return o.split(/_/)[0] == type;
+                }
+            );
+
+            list = util.functional.map_list(
+                list,
+                function (o) {
+                    return JSON2js( js2JSON( obj['map_' + type][ type + '_' + o.split(/_/)[1] ] ) );
+                }
+            );
+
+            //TODO: proper messages
+            var delete_msg;
+            if (list.length != 1) {
+                delete_msg = document.getElementById('serialStrings').getFormattedString('staff.serial.manage_subs.delete_' + type + '.confirm.plural', [list.length]);
+            } else {
+                delete_msg = document.getElementById('serialStrings').getString('staff.serial.manage_subs.delete_' + type + '.confirm');
+            }
+            var r = obj.error.yns_alert(
+                    delete_msg,
+                    document.getElementById('serialStrings').getString('staff.serial.manage_subs.delete_' + type + '.title'),
+                    document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_items.delete'),
+                    document.getElementById('catStrings').getString('staff.cat.copy_browser.delete_items.cancel'),
+                    null,
+                    document.getElementById('commonStrings').getString('common.confirm')
+            );
+
+            if (r == 0) {
+                for (var i = 0; i < list.length; i++) {
+                    list[i].isdeleted('1');
+                }
+                var robj = obj.network.request(
+                    'open-ils.serial', 
+                    method, 
+                    [ ses(), list, true ],
+                    null,
+                    {
+                        'title' : document.getElementById('serialStrings').getString('staff.serial.manage_subs.delete_' + type + '.override'),
+                        'overridable_events' : overridable_events
+                    }
+                );
+                if (robj == null) throw(robj);
+                if (typeof robj.ilsevent != 'undefined') {
+                    if (robj.ilsevent != 0) {
+                        var overridable = false;
+                        for (i = 0; i < overridable_events.length; i++) {
+                            if (overridable_events[i] == robj.ilsevent) {
+                                overridable = true;
+                                break;
+                            }
+                        }
+                        if (!overridable) throw(robj);
+                    }
+                }
+                obj.refresh_list();
+            }
+        } catch(E) {
+            obj.error.standard_unexpected_error_alert(document.getElementById('serialStrings').getString('staff.serial.manage_subs.delete.error'),E);
+            obj.refresh_list();
+        }
+    },
+
+    'init' : function( params ) {
+
+        try {
+            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+            var obj = this;
+
+            obj.docid = params.docid;
+
+            JSAN.use('util.network'); obj.network = new util.network();
+            JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+            JSAN.use('util.controller'); obj.controller = new util.controller();
+            obj.controller.init(
+                {
+                    control_map : {
+                        'save_columns' : [ [ 'command' ], function() { obj.list.save_columns(); } ],
+                        'sel_clip' : [
+                            ['command'],
+                            function() { obj.list.clipboard(); }
+                        ],
+                        'cmd_broken' : [
+                            ['command'],
+                            function() { 
+                                alert(document.getElementById('commonStrings').getString('common.unimplemented'));
+                            }
+                        ],
+                        'cmd_show_my_libs' : [
+                            ['command'],
+                            function() { 
+                                obj.show_my_libs(); 
+                            }
+                        ],
+                        'cmd_clear' : [
+                            ['command'],
+                            function() {
+                                obj.map_tree = {};
+                                obj.list.clear();
+                            }
+                        ],
+                        'cmd_add_siss' : [
+                            ['command'],
+                            function() {
+                                try {
+                                    var list = obj.ids_from_sel_list('sdist');
+                                    if (list.length == 0) list = obj.ids_from_sel_list('siss-group');
+                                    if (list.length == 0) return;
+
+                                    /*TODO: permission check?
+                                    //populate 'list' with owning_libs of subs, TODO
+                                    var edit = 0;
+                                    try {
+                                        edit = obj.network.request(
+                                            api.PERM_MULTI_ORG_CHECK.app,
+                                            api.PERM_MULTI_ORG_CHECK.method,
+                                            [ 
+                                                ses(), 
+                                                obj.data.list.au[0].id(), 
+                                                list,
+                                                [ 'CREATE_COPY' ]
+                                            ]
+                                        ).length == 0 ? 1 : 0;
+                                    } catch(E) {
+                                        obj.error.sdump('D_ERROR','batch permission check: ' + E);
+                                    }
+
+                                    if (edit==0) return; // no read-only view for this interface */
+                                    var new_siss = new siss();
+                                    new_siss.subscription(list[0]);//TODO: add multiple at once support?
+                                    new_siss.isnew(1);
+                                    var params = {};
+                                    params.sisses = [new_siss];
+                                    obj.editor_init('siss', 'add', params);
+                                } catch(E) {
+                                    obj.error.standard_unexpected_error_alert(document.getElementById('serialStrings').getString('staff.serial.manage_subs.add.error'),E);
+                                }
+                            }
+                        ],
+                        'cmd_add_sstr' : [
+                            ['command'],
+                            function() {
+                                try {
+                                    var list = obj.ids_from_sel_list('sdist');
+                                    if (list.length == 0) list = obj.ids_from_sel_list('sstr-group');
+                                    if (list.length == 0) return;
+
+                                    /*TODO: permission check?
+                                    //populate 'list' with owning_libs of subs, TODO
+                                    var edit = 0;
+                                    try {
+                                        edit = obj.network.request(
+                                            api.PERM_MULTI_ORG_CHECK.app,
+                                            api.PERM_MULTI_ORG_CHECK.method,
+                                            [ 
+                                                ses(), 
+                                                obj.data.list.au[0].id(), 
+                                                list,
+                                                [ 'CREATE_COPY' ]
+                                            ]
+                                        ).length == 0 ? 1 : 0;
+                                    } catch(E) {
+                                        obj.error.sdump('D_ERROR','batch permission check: ' + E);
+                                    }
+
+                                    if (edit==0) return; // no read-only view for this interface */
+                                    var new_sstr = new sstr();
+                                    new_sstr.subscription(list[0]);//TODO: add multiple at once support?
+                                    new_sstr.holding_lib(obj.map_sdist['sdist_' + list[0]].owning_lib());//default to sub owning lib
+                                    new_sstr.label('Default');
+                                    new_sstr.isnew(1);
+                                    var params = {};
+                                    params.sstrs = [new_sstr];
+                                    obj.editor_init('sstr', 'add', params);
+                                } catch(E) {
+                                    obj.error.standard_unexpected_error_alert(document.getElementById('serialStrings').getString('staff.serial.manage_subs.add.error'),E);
+                                }
+                            }
+                        ],
+                        'cmd_delete_sstr' : [
+                            ['command'],
+                            function() {
+                                var overridable_events = [ //TODO: proper overrides
+                                ];
+                                obj.do_delete('sstr', 'open-ils.serial.distribution.fleshed.batch.update', overridable_events);
+                            }
+                        ],
+                        'cmd_delete_siss' : [
+                            ['command'],
+                            function() {
+                                var overridable_events = [ //TODO: proper overrides
+                                ];
+                                obj.do_delete('siss', 'open-ils.serial.issuance.fleshed.batch.update', overridable_events);
+                            }
+                        ],
+                        'cmd_delete_sdist' : [
+                            ['command'],
+                            function() {
+                                var overridable_events = [
+                                    11000 // SERIAL_SUBSCRIPTION_NOT_EMPTY
+                                ];
+                                obj.do_delete('sdist', 'open-ils.serial.subscription.fleshed.batch.update', overridable_events);
+                            }
+                        ],
+                        'cmd_mark_library' : [
+                            ['command'],
+                            function() {
+                                try {
+                                    var list = obj.ids_from_sel_list('aou');
+                                    if (list.length == 1) {
+                                        obj.data.marked_library = { 'lib' : list[0], 'docid' : obj.docid };
+                                        obj.data.stash('marked_library');
+                                        alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_library.alert'));
+                                    } else {
+                                        obj.error.yns_alert(
+                                                document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_library.prompt'),
+                                                document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_library.title'),
+                                                document.getElementById('commonStrings').getString('common.ok'),
+                                                null,
+                                                null,
+                                                document.getElementById('commonStrings').getString('common.confirm')
+                                                );
+                                    }
+                                } catch(E) {
+                                    obj.error.standard_unexpected_error_alert('manage_dists.js -> mark library',E);
+                                }
+                            }
+                        ],
+
+                        'cmd_mark_distribution' : [
+                            ['command'],
+                            function() {
+                                try {
+                                    var list = obj.ids_from_sel_list('sdist');
+                                    if (list.length == 1) {
+                                        obj.data.marked_distribution = list[0];
+                                        obj.data.stash('marked_distribution');
+                                        alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_volume.alert'));
+                                    } else {
+                                        obj.error.yns_alert(
+                                                document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_volume.prompt'),
+                                                document.getElementById('catStrings').getString('staff.cat.copy_browser.mark_volume.title'),
+                                                document.getElementById('commonStrings').getString('common.ok'),
+                                                null,
+                                                null,
+                                                document.getElementById('commonStrings').getString('common.confirm')
+                                                );
+                                    }
+                                } catch(E) {
+                                    obj.error.standard_unexpected_error_alert('manage_dists.js -> mark distribution',E);
+                                }
+                            }
+                        ],
+                        'cmd_add_distributions' : [
+                            ['command'],
+                            function() {
+                                try {
+                                    var list = obj.ids_from_sel_list('aou');
+                                    if (list.length == 0) return;
+                                    //TODO: permission check?
+                                    /*var edit = 0;
+                                    try {
+                                        edit = obj.network.request(
+                                            api.PERM_MULTI_ORG_CHECK.app,
+                                            api.PERM_MULTI_ORG_CHECK.method,
+                                            [ 
+                                                ses(), 
+                                                obj.data.list.au[0].id(), 
+                                                list,
+                                                [ 'CREATE_VOLUME', 'CREATE_COPY' ]
+                                            ]
+                                        ).length == 0 ? 1 : 0;
+                                    } catch(E) {
+                                        obj.error.sdump('D_ERROR','batch permission check: ' + E);
+                                    }
+
+                                    if (edit==0) {
+                                        alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.add_volume.permission_error'));
+                                        return; // no read-only view for this interface
+                                    } */
+                                    var new_sdist = new sdist();
+                                    new_sdist.owning_lib(list[0]);//TODO: add multiple at once support?
+                                    new_sdist.isnew(1);
+                                    new_sdist.record_entry(obj.docid);
+                                    var params = {};
+                                    params.sdists = [new_sdist];
+                                    obj.editor_init('sdist', 'add', params);
+                                } catch(E) {
+                                    obj.error.standard_unexpected_error_alert(document.getElementById('serialStrings').getString('staff.serial.manage_subs.add.error'),E);
+                                }
+                            }
+                        ],
+                        'cmd_transfer_distribution' : [
+                            ['command'],
+                            function() {
+                                try {
+                                    obj.data.stash_retrieve();
+                                    if (!obj.data.marked_library) {
+                                        alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer_volume.alert'));
+                                        return;
+                                    }
+                                    
+                                    var list = obj.ids_from_sel_list('sdist');
+
+                                    netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
+
+                                    JSAN.use('util.functional');
+
+                                    var sdist_list = util.functional.map_list(
+                                        list,
+                                        function (o) {
+                                            return obj.map_sdist[ 'sdist_' + o ].start_date();
+                                        }
+                                    ).join(document.getElementById('commonStrings').getString('common.grouping_string'));
+
+                                    var xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" style="overflow: auto">';
+                                    xml += '<description>';
+                                    xml += document.getElementById('catStrings').getFormattedString('staff.cat.copy_browser.transfer.prompt', [sdist_list, obj.data.hash.aou[ obj.data.marked_library.lib ].shortname()]);
+                                    xml += '</description>';
+                                    xml += '<hbox><button label="' + document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.submit.label') + '" name="fancy_submit"/>';
+                                    xml += '<button label="' 
+                                        + document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.cancel.label') 
+                                        + '" accesskey="' 
+                                        + document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.cancel.accesskey') 
+                                        + '" name="fancy_cancel"/></hbox>';
+                                    xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + obj.data.marked_library.docid + '"/>';
+                                    xml += '</vbox>';
+                                    JSAN.use('OpenILS.data');
+                                    var data = new OpenILS.data(); data.init({'via':'stash'});
+                                    //data.temp_transfer = xml; data.stash('temp_transfer');
+                                    JSAN.use('util.window'); var win = new util.window();
+                                    var fancy_prompt_data = win.open(
+                                        urls.XUL_FANCY_PROMPT,
+                                        //+ '?xml_in_stash=temp_transfer'
+                                        //+ '&title=' + window.escape('Volume Transfer'),
+                                        'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
+                                        {
+                                            'xml' : xml,
+                                            'title' : document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.title')
+                                        }
+                                    );
+
+                                    if (fancy_prompt_data.fancy_status == 'incomplete') {
+                                        alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.incomplete'));
+                                        return;
+                                    }
+
+                                    var robj = obj.network.simple_request(
+                                        'FM_ACN_TRANSFER', 
+                                        [ ses(), { 'docid' : obj.data.marked_library.docid, 'lib' : obj.data.marked_library.lib, 'distributions' : list } ],
+                                        null,
+                                        {
+                                            'title' : document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.override.failure'),
+                                            'overridable_events' : [
+                                                1208, // TITLE_LAST_COPY
+                                                1219, // COPY_REMOTE_CIRC_LIB
+                                            ],
+                                        }
+                                    );
+
+                                    if (typeof robj.ilsevent != 'undefined') {
+                                        if (robj.ilsevent == 1221) { // ORG_CANNOT_HAVE_VOLS
+                                            alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.ineligible_destination'));
+                                        } else {
+                                            throw(robj);
+                                        }
+                                    } else {
+                                        alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.success'));
+                                    }
+
+                                } catch(E) {
+                                    obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer.unexpected_error'),E);
+                                }
+                                obj.refresh_list();
+                            }
+                        ],
+
+                        'cmd_transfer_sstrs' : [
+                            ['command'],
+                            function() {
+                                try {
+                                    obj.data.stash_retrieve();
+                                    if (!obj.data.marked_distribution) {
+                                        alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer_items.missing_volume'));
+                                        return;
+                                    }
+                                    
+                                    JSAN.use('util.functional');
+
+                                    var list = obj.ids_from_sel_list('sstr');
+                                    var distribution = obj.network.simple_request('FM_ACN_RETRIEVE.authoritative',[ obj.data.marked_distribution ]);
+
+                                    JSAN.use('cat.util'); cat.util.transfer_copies( { 
+                                        'distribution_ids' : list, 
+                                        'docid' : distribution.record(),
+                                        'distribution_label' : distribution.start_date(),
+                                        'owning_lib' : distribution.owning_lib(),
+                                    } );
+
+                                } catch(E) {
+                                    obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.transfer_items.unexpected_error'),E);
+                                }
+                                obj.refresh_list();
+                            }
+                        ],
+                        'cmd_refresh_list' : [
+                            ['command'],
+                            function() {
+                                obj.refresh_list();
+                            }
+                        ],
+/*dbw2                      'sel_distribution_details' : [
+                            ['command'],
+                            function() {
+                                JSAN.use('util.functional');
+
+                                var list = util.functional.filter_list(
+                                    obj.sel_list,
+                                    function (o) {
+                                        return o.split(/_/)[0] == 'sstr';
+                                    }
+                                );
+
+                                list = util.functional.map_list(
+                                    list,
+                                    function (o) {
+                                        return o.split(/_/)[1];
+                                    }
+                                );
+    
+                                JSAN.use('circ.util');
+                                for (var i = 0; i < list.length; i++) {
+                                    circ.util.show_copy_details( list[i] );
+                                }
+                            }
+                        ],
+                        'cmd_edit_sstrs' : [
+                            ['command'],
+                            function() {
+                                try {
+                                    JSAN.use('util.functional');
+
+                                    var list = util.functional.filter_list(
+                                        obj.sel_list,
+                                        function (o) {
+                                            return o.split(/_/)[0] == 'sstr';
+                                        }
+                                    );
+
+                                    list = util.functional.map_list(
+                                        list,
+                                        function (o) {
+                                            return o.split(/_/)[1];
+                                        }
+                                    );
+
+                                    JSAN.use('cat.util'); cat.util.spawn_copy_editor( { 'copy_ids' : list, 'edit' : 1 } );
+                                    obj.refresh_list();
+
+                                } catch(E) {
+                                    obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.edit_items.error'),E);
+                                }
+                            }
+                        ], dbw2*/
+
+/*dbw2                      'cmd_print_spine_labels' : [
+                            ['command'],
+                            function() {
+                                try {
+                                    JSAN.use('util.functional');
+                                    
+                                    var list = util.functional.filter_list(
+                                        obj.sel_list,
+                                        function (o) {
+                                            return o.split(/_/)[0] == 'sstr';
+                                        }
+                                    );
+
+                                    list = util.functional.map_list(
+                                        list,
+                                        function (o) {
+                                            return obj.map_sstr[ o ];
+                                        }
+                                    );
+
+                                    obj.data.temp_barcodes_for_labels = util.functional.map_list( list, function(o){return o.barcode();}) ; 
+                                    obj.data.stash('temp_barcodes_for_labels');
+                                    xulG.new_tab(
+                                        xulG.url_prefix( urls.XUL_SPINE_LABEL ),
+                                        { 'tab_name' : document.getElementById('catStrings').getString('staff.cat.copy_browser.print_spine.tab') },
+                                        {}
+                                    );
+                                } catch(E) {
+                                    obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.print_spine.error'),E);
+                                }
+                            }
+                        ]
+                        dbw2*/
+                    }
+                }
+            );
+
+            obj.list_init(params);
+
+            obj.org_ids = obj.network.simple_request('FM_SDIST_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative',[ obj.docid ]);
+            if (typeof obj.org_ids.ilsevent != 'undefined') throw(obj.org_ids);
+            JSAN.use('util.functional'); 
+            obj.org_ids = util.functional.map_list( obj.org_ids, function (o) { return Number(o); });
+
+            var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
+            //obj.show_libs( org );
+
+            //obj.show_my_libs();
+
+            JSAN.use('util.file'); JSAN.use('util.widgets');
+
+            var file; var list_data; var ml; 
+
+            file = new util.file('offline_ou_list'); 
+            if (file._file.exists()) {
+                list_data = file.get_object(); file.close();
+                for (var i = 0; i < list_data[0].length; i++) { // make sure all entries are enabled
+                    list_data[0][i][2] = false;
+                }
+                ml = util.widgets.make_menulist( list_data[0], list_data[1] );
+                ml.setAttribute('id','sdist_lib_menu'); document.getElementById('serial_dist_lib_menu').appendChild(ml);
+                //TODO: class this menu properly
+                for (var i = 0; i < obj.org_ids.length; i++) {
+                    ml.getElementsByAttribute('value',obj.org_ids[i])[0].setAttribute('class','has_distributions');
+                }
+                ml.firstChild.addEventListener(
+                    'popupshown',
+                    function(ev) {
+                        document.getElementById('legend').setAttribute('hidden','false');
+                    },
+                    false
+                );
+                ml.firstChild.addEventListener(
+                    'popuphidden',
+                    function(ev) {
+                        document.getElementById('legend').setAttribute('hidden','true');
+                    },
+                    false
+                );
+                ml.addEventListener(
+                    'command',
+                    function(ev) {
+                        if (document.getElementById('refresh_button')) document.getElementById('refresh_button').focus(); 
+                        JSAN.use('util.file'); var file = new util.file('manage_dists_prefs.'+obj.data.server_unadorned);
+                        util.widgets.save_attributes(file, { 'sdist_lib_menu' : [ 'value' ], 'show_sdists' : [ 'checked' ], 'show_groups' : [ 'checked' ] });
+                        obj.refresh_list();
+                    },
+                    false
+                );
+            } else {
+                throw(document.getElementById('catStrings').getString('staff.cat.copy_browser.missing_library') + '\n');
+            }
+
+            file = new util.file('manage_dists_prefs.'+obj.data.server_unadorned);
+            util.widgets.load_attributes(file);
+            obj.default_lib = ml.getAttribute('value');
+            ml.value = obj.default_lib;
+            if (! obj.default_lib) {
+                obj.default_lib = org.id();
+                ml.setAttribute('value',obj.default_lib);
+                ml.value = obj.default_lib;
+            }
+
+            document.getElementById('show_sdists').addEventListener(
+                'command',
+                function(ev) {
+                    JSAN.use('util.file'); var file = new util.file('manage_dists_prefs.'+obj.data.server_unadorned);
+                    util.widgets.save_attributes(file, { 'sdist_lib_menu' : [ 'value' ], 'show_sdists' : [ 'checked' ], 'show_groups' : [ 'checked' ] });
+                },
+                false
+            );
+
+            document.getElementById('show_groups').addEventListener(
+                'command',
+                function(ev) {
+                    JSAN.use('util.file'); var file = new util.file('manage_dists_prefs.'+obj.data.server_unadorned);
+                    util.widgets.save_attributes(file, { 'sdist_lib_menu' : [ 'value' ], 'show_sdists' : [ 'checked' ], 'show_groups' : [ 'checked' ] });
+                },
+                false
+            );
+
+            obj.show_my_libs( obj.default_lib );
+
+            JSAN.use('util.exec'); var exec = new util.exec(20); exec.timer(obj.funcs,100);
+
+            obj.toggle_actions(); // disable menus initially
+
+        } catch(E) {
+            this.error.standard_unexpected_error_alert('serial/manage_dists.init: ',E);
+        }
+    },
+
+    'show_my_libs' : function(org) {
+        var obj = this;
+        try {
+            if (!org) {
+                org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
+            } else {
+                if (typeof org != 'object') org = obj.data.hash.aou[ org ];
+            }
+            obj.show_libs( org, false );
+        } catch(E) {
+            alert(E);
+        }
+    },
+
+    'show_libs' : function(start_aou,show_open) {
+        var obj = this;
+        try {
+            if (!start_aou) throw('show_libs: Need a start_aou');
+            JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+            JSAN.use('util.functional'); 
+
+            var parents = [];
+            var temp_aou = start_aou;
+            while ( temp_aou.parent_ou() ) {
+                temp_aou = obj.data.hash.aou[ temp_aou.parent_ou() ];
+                parents.push( temp_aou );
+            }
+            parents.reverse();
+
+            for (var i = 0; i < parents.length; i++) {
+                obj.funcs.push(
+                    function(o,p) {
+                        return function() { 
+                            obj.append_org(o,p,{'container':'true','open':'true'}); 
+                        };
+                    }(parents[i], obj.data.hash.aou[ parents[i].parent_ou() ])
+                );
+            }
+
+            obj.funcs.push(
+                function(o,p) {
+                    return function() { obj.append_org(o,p); };
+                }(start_aou,obj.data.hash.aou[ start_aou.parent_ou() ])
+            );
+
+            obj.funcs.push(
+                function() {
+                    if (start_aou.children()) {
+                        var x = obj.map_tree[ 'aou_' + start_aou.id() ];
+                        x.setAttribute('container','true');
+                        if (show_open) x.setAttribute('open','true');
+                        for (var i = 0; i < start_aou.children().length; i++) {
+                            obj.funcs.push(
+                                function(o,p) {
+                                    return function() { obj.append_org(o,p); };
+                                }( start_aou.children()[i], start_aou )
+                            );
+                        }
+                    }
+                }
+            );
+
+        } catch(E) {
+            alert(E);
+        }
+    },
+
+    'on_select' : function(list,twisty) {
+        var obj = this;
+        var sel_lists = {};
+
+        for (var i = 0; i < list.length; i++) {
+            var row_type = list[i].split('_')[0];
+            var id = list[i].split('_')[1];
+
+            if (!sel_lists[row_type]) sel_lists[row_type] = [];
+            sel_lists[row_type].push(id);
+
+            if (twisty) {
+                switch(row_type) {
+                    case 'aou' : obj.on_click_aou(id,twisty); break;
+                    case 'sdist' : obj.on_select_sdist(id,twisty); break;
+                    default: break;
+                }
+            }
+        }
+
+        if (!obj.focused_node_retrieve_id) return;
+
+        var row_type = obj.focused_node_retrieve_id.split('_')[0];
+        var id = obj.focused_node_retrieve_id.split('_')[1];
+
+        if (sel_lists[row_type]) { // the type focused is in the selection (usually the case)
+            switch(row_type) {
+                case 'aou' : obj.on_click_aou(id,twisty); break;
+                default: if (obj['on_click_' + row_type]) obj['on_click_' + row_type](sel_lists[row_type],twisty);
+            }
+        }
+    },
+
+    'on_select_sdist' : function(sdist_id,twisty) {
+        var obj = this;
+        try {
+            var sdist_tree = obj.map_sdist[ 'sdist_' + sdist_id ];
+            obj.funcs.push( function() { 
+                document.getElementById('cmd_refresh_list').setAttribute('disabled','true'); 
+                document.getElementById('sdist_lib_menu').setAttribute('disabled','true'); 
+            } );
+            if (sdist_tree.basic_summary()) {
+                obj.funcs.push(
+                    function(c,a) {
+                        return function() {
+                            obj.append_member(c,a,[],'sbsum', false);
+                        }
+                    }( sdist_tree.basic_summary(), sdist_tree )
+                );
+            }
+            if (sdist_tree.supplement_summary()) {
+                obj.funcs.push(
+                    function(c,a) {
+                        return function() {
+                            obj.append_member(c,a,[],'sssum', false);
+                        }
+                    }( sdist_tree.supplement_summary(), sdist_tree )
+                );
+            }
+            if (sdist_tree.index_summary()) {
+                obj.funcs.push(
+                    function(c,a) {
+                        return function() {
+                            obj.append_member(c,a,[],'sisum', false);
+                        }
+                    }( sdist_tree.index_summary(), sdist_tree )
+                );
+            }
+            if (sdist_tree.streams()) {
+                for (var i = 0; i < sdist_tree.streams().length; i++) {
+                    obj.funcs.push(
+                        function(c,a) {
+                            return function() {
+                                obj.append_member(c,a,[],'sstr', true);
+                            }
+                        }( sdist_tree.streams()[i], sdist_tree )
+                    )
+                }
+            }
+            /* TODO: template editing would be convenient here, but a little too confusing
+            // add template nodes
+            var same_templates;
+            var has_bind_template;
+            if (sdist_tree.receive_unit_template()) {
+                if (sdist_tree.bind_unit_template()) {
+                    has_bind_template = true;                    
+                    if (sdist_tree.receive_unit_template().id() == sdist_tree.bind_unit_template().id()) {
+                        same_templates = true;
+                        obj.funcs.push(
+                            function(c,a) {
+                                return function() {
+                                    obj.append_member(c,a,[],'act', false, 'Receive/Bind Unit Template');
+                                }
+                            }( sdist_tree.receive_unit_template(), sdist_tree )
+                        )
+                    }
+                }
+
+                if (!same_templates) {
+                    obj.funcs.push(
+                        function(c,a) {
+                            return function() {
+                                obj.append_member(c,a,[],'act', false, 'Receive Unit Template');
+                            }
+                        }( sdist_tree.receive_unit_template(), sdist_tree )
+                    )
+                }
+            }
+            if (has_bind_template && !same_templates) {
+                obj.funcs.push(
+                    function(c,a) {
+                        return function() {
+                            obj.append_member(c,a,[],'act', false, 'Bind Unit Template');
+                        }
+                    }( sdist_tree.bind_unit_template(), sdist_tree )
+                )
+            }
+            */
+            obj.funcs.push( function() { 
+                document.getElementById('cmd_refresh_list').setAttribute('disabled','false'); 
+                document.getElementById('sdist_lib_menu').setAttribute('disabled','false'); 
+            } );
+        } catch(E) {
+            alert(E);
+        }
+    },
+
+    'on_click_sdist' : function(sdist_ids,twisty) {
+        var obj = this;
+        try {
+            // draw sdist editor
+            if (typeof twisty == 'undefined') {
+                var params = {};
+                params.sdist_ids = sdist_ids;
+                params.xul_id_prefix = 'sdist2';
+                obj.editor_init('sdist', 'edit', params);
+            }
+        } catch(E) {
+            alert(E);
+        }
+    },
+
+    'on_click_sstr' : function(sstr_ids,twisty) {
+        var obj = this;
+        try {
+            // draw sstr editor
+            if (typeof twisty == 'undefined') {
+                var params = {};
+                params.sstr_ids = sstr_ids;
+                obj.editor_init('sstr', 'edit', params);
+            }
+        } catch(E) {
+            alert(E);
+        }
+    },
+
+    'on_click_sbsum' : function(sbsum_ids,twisty) {
+        var obj = this;
+        try {
+            // draw sbsum editor
+            if (typeof twisty == 'undefined') {
+                var params = {};
+                params.sbsum_ids = sbsum_ids;
+                obj.editor_init('sbsum', 'edit', params);
+            }
+        } catch(E) {
+            alert(E);
+        }
+    },
+
+    'on_click_sssum' : function(sssum_ids,twisty) {
+        var obj = this;
+        try {
+            // draw sssum editor
+            if (typeof twisty == 'undefined') {
+                var params = {};
+                params.sssum_ids = sssum_ids;
+                obj.editor_init('sssum', 'edit', params);
+            }
+        } catch(E) {
+            alert(E);
+        }
+    },
+
+    'on_click_sisum' : function(sisum_ids,twisty) {
+        var obj = this;
+        try {
+            // draw sisum editor
+            if (typeof twisty == 'undefined') {
+                var params = {};
+                params.sisum_ids = sisum_ids;
+                obj.editor_init('sisum', 'edit', params);
+            }
+        } catch(E) {
+            alert(E);
+        }
+    },
+
+    'on_click_aou' : function(org_id,twisty) {
+        var obj = this;
+        var org = obj.data.hash.aou[ org_id ];
+        var default_aou = obj.data.hash.aou[obj.default_lib];
+        obj.funcs.push( function() { 
+            document.getElementById('cmd_refresh_list').setAttribute('disabled','true'); 
+            document.getElementById('sdist_lib_menu').setAttribute('disabled','true'); 
+        } );
+        if (org.children()) {
+            for (var i = 0; i < org.children().length; i++) {
+                var child = org.children()[i];
+                if (orgIsMine(default_aou,child)) {
+                    obj.funcs.push(
+                        function(o,p) {
+                            return function() {
+                                obj.append_org(o,p)
+                            }
+                        }(child,org)
+                    );
+                }
+            }
+        } 
+        if (obj.map_sdist[ 'aou_' + org_id ]) {
+            for (var i = 0; i < obj.map_sdist[ 'aou_' + org_id ].length; i++) {
+                obj.funcs.push(
+                    function(o,a) {
+                        return function() {
+                            obj.append_sdist(o,a);
+                        }
+                    }( org, obj.map_sdist[ 'aou_' + org_id ][i] )
+                );
+            }
+        }
+        obj.funcs.push( function() { 
+            document.getElementById('cmd_refresh_list').setAttribute('disabled','false'); 
+            document.getElementById('sdist_lib_menu').setAttribute('disabled','false'); 
+        } );
+
+        // remove current editor
+        if (typeof twisty == 'undefined') {
+            document.getElementById('serial_manage_dists_editor_deck').selectedIndex = 0;
+        }
+    },
+
+    'append_org' : function (org,parent_org,params) {
+        var obj = this;
+        try {
+            if (obj.map_tree[ 'aou_' + org.id() ]) {
+                var x = obj.map_tree[ 'aou_' + org.id() ];
+                if (params) {
+                    for (var i in params) {
+                        x.setAttribute(i,params[i]);
+                    }
+                }
+                return x;
+            }
+
+            var data = {
+                'row' : {
+                    'my' : {
+                        'aou' : org,
+                    }
+                },
+                'skip_all_columns_except' : [0,1,2],
+                'retrieve_id' : 'aou_' + org.id(),
+                'to_bottom' : true,
+                'no_auto_select' : true,
+            };
+        
+            var sdist_tree_list;
+            if ( obj.org_ids.indexOf( Number( org.id() ) ) == -1 ) {
+                if ( get_bool( obj.data.hash.aout[ org.ou_type() ].can_have_vols() ) ) {
+                    data.row.my.distribution_count = '0';
+                } else {
+                    data.row.my.distribution_count = '';
+                }
+            } else {
+                var d_count = 0;
+                sdist_tree_list = obj.network.simple_request(
+                    'FM_SDIST_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS.authoritative',
+                    [ ses(), obj.docid, [ org.id() ] ]
+                );
+                for (var i = 0; i < sdist_tree_list.length; i++) {
+                    d_count++;
+                    obj.map_sdist[ 'sdist_' + sdist_tree_list[i].id() ] = function(r){return r;}(sdist_tree_list[i]);
+                    /*var streams = sdist_tree_list[i].streams();
+                    for (var j = 0; j < streams.length; j++) {
+                        obj.map_sstr[ 'sstr_' + streams[j].id() ] = function(r){return r;}(streams[j]);
+                    }*/
+                }
+                data.row.my.distribution_count = d_count;
+            }
+            if (parent_org) {
+                data.node = obj.map_tree[ 'aou_' + parent_org.id() ];
+            }
+            var nparams = obj.list.append(data);
+            var node = nparams.my_node;
+            if (params) {
+                for (var i in params) {
+                    node.setAttribute(i,params[i]);
+                }
+            }
+            obj.map_tree[ 'aou_' + org.id() ] = node;
+
+            if (org.children()) {
+                node.setAttribute('container','true');
+            }
+
+            if (parent_org) {
+                if ( obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ].parent_ou() == parent_org.id() ) {
+                    data.node.setAttribute('open','true');
+                }
+            } else {
+                obj.map_tree[ 'aou_' + org.id() ].setAttribute('open','true');
+            }
+
+            if (sdist_tree_list) {
+                obj.map_sdist[ 'aou_' + org.id() ] = sdist_tree_list;
+                node.setAttribute('container','true');
+            }
+
+            if (document.getElementById('show_sdists').checked) {
+                obj.funcs.push( function() { obj.on_click_aou( org.id() ); } );
+                node.setAttribute('open','true');
+            }
+
+        } catch(E) {
+            dump(E+'\n');
+            alert(E);
+        }
+    },
+
+    'append_sdist' : function( org, sdist_tree, params ) {
+        var obj = this;
+        try {
+            if (obj.map_tree[ 'sdist_' + sdist_tree.id() ]) {
+                var x = obj.map_tree[ 'sdist_' + sdist_tree.id() ];
+                if (params) {
+                    for (var i in params) {
+                        x.setAttribute(i,params[i]);
+                    }
+                }
+                return x;
+            }
+
+            var parent_node = obj.map_tree[ 'aou_' + org.id() ];
+            var data = {
+                'row' : {
+                    'my' : {
+                        'aou' : org,
+                        'sdist' : sdist_tree,
+                        'distribution_count' : ''
+                    }
+                },
+                'skip_all_columns_except' : [0,1,2],
+                'retrieve_id' : 'sdist_' + sdist_tree.id(),
+                'node' : parent_node,
+                'to_bottom' : true,
+                'no_auto_select' : true,
+            };
+            var nparams = obj.list.append(data);
+            var node = nparams.my_node;
+            obj.map_tree[ 'sdist_' + sdist_tree.id() ] =  node;
+            if (params) {
+                for (var i in params) {
+                    node.setAttribute(i,params[i]);
+                }
+            }
+            node.setAttribute('container','true');
+            if (document.getElementById('show_groups').checked) {
+                node.setAttribute('open','true');
+                obj.funcs.push( function() { obj.on_select_sdist( sdist_tree.id(), true ); } );
+            }
+            var sstr_group_node_data = {
+                'row' : {
+                    'my' : {
+                        'label' : 'Streams',
+                    }
+                },
+                'retrieve_id' : 'sstr-group_' + sdist_tree.id(),
+                'node' : node,
+                'to_bottom' : true,
+                'no_auto_select' : true,
+            };
+            nparams = obj.list.append(sstr_group_node_data);
+            obj.map_tree[ 'sdist_sstr_group_' + sdist_tree.id() ] =  nparams.my_node;
+        } catch(E) {
+            dump(E+'\n');
+            alert(E);
+        }
+    },
+
+    'append_member' : function( item, sdist_tree, attributes, type, group, label ) {
+        var obj = this;
+        try {
+            if (obj.map_tree[ type + '_' + sdist_tree.id() + '_' + item.id() ]) {
+                var x = obj.map_tree[ type + '_' + item.id() ];
+                if (attributes) {
+                    for (var i in attributes) {
+                        x.setAttribute(i,attributes[i]);
+                    }
+                }
+                return x;
+            }
+
+            var parent_node;
+            if (group) {
+                parent_node = obj.map_tree[ 'sdist_' + type + '_group_' + sdist_tree.id() ];
+            } else {
+                parent_node = obj.map_tree[ 'sdist_' + sdist_tree.id() ];
+            }
+            var data = {
+                'row' : {
+                    'my' : {
+                        'aou' : obj.data.hash.aou[ sdist_tree.holding_lib() ],
+                        'sdist' : sdist_tree,
+                        'distribution_count' : ''
+                    }
+                },
+                'retrieve_id' : type + '_' + item.id(),
+                'node' : parent_node,
+                'to_bottom' : true,
+                'no_auto_select' : true,
+            };
+            data['row']['my'][type] = item; // TODO: future optimization: get only the IDs of these leaves, then fetch the full row in 'retrieve_row'
+            var nparams = obj.list.append(data);
+            var node = nparams.my_node;
+            obj.map_tree[ type + '_' + sdist_tree.id() + '_' + item.id() ] =  node;
+            if (label) {
+                data['row']['my']['label'] = label;
+            }
+            if (attributes) {
+                for (var i in attributes) {
+                    node.setAttribute(i,attributes[i]);
+                }
+            }
+
+        } catch(E) {
+            dump(E+'\n');
+            alert(E);
+        }
+    },
+
+    'list_init' : function( params ) {
+
+        try {
+            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+            var obj = this;
+            
+            JSAN.use('circ.util');
+            var columns = [
+                {
+                    'id' : 'tree_location',
+                    'label' : 'Location',
+                    'flex' : 1, 'primary' : true, 'hidden' : false, 
+                    'render' : function(my) { return my.label ? my.label : my.sstr ? 'Stream : #' + my.sstr.id() : my.sbsum ? 'Basic Summary' : my.sssum ? 'Supplement Summary' : my.sisum ? 'Index Summary' : my.sdist ? my.sdist.label() : my.aou ? my.aou.shortname() + " : " + my.aou.name() : "???"; },
+                },
+                {
+                    'id' : 'distribution_count',
+                    'label' : 'Distributions',
+                    'flex' : 0, 'primary' : false, 'hidden' : false, 
+                    'render' : function(my) { return my.distribution_count; },
+                }
+            ];
+            JSAN.use('util.list'); obj.list = new util.list('sdists_tree');
+            obj.list.init(
+                {
+                    'no_auto_select' : true,
+                    'columns' : columns,
+                    'map_row_to_columns' : circ.util.std_map_row_to_columns(' '),
+                    'retrieve_row' : function(params) {
+
+                        var row = params.row;
+                        obj.funcs.push(
+                            function() {
+
+                                if (typeof params.on_retrieve == 'function') {
+                                    params.on_retrieve(row);
+                                }
+
+                            }
+                        );
+
+                        return row;
+                    },
+                    'on_click' : function(ev) {
+                        netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserRead');
+                        var row = {}; var col = {}; var nobj = {};
+                        obj.list.node.treeBoxObject.getCellAt(ev.clientX,ev.clientY,row,col,nobj); 
+                        if ((row.value == -1)||(nobj.value != 'twisty')) { return; } // on_click runs for twistys only
+
+                        var node = obj.list.node.contentView.getItemAtIndex(row.value);
+                        var list = [ node.getAttribute('retrieve_id') ];
+                        if (typeof obj.on_select == 'function') {
+                            obj.on_select(list,true);
+                        }
+                        if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
+                            window.xulG.on_select(list);
+                        }
+                    },
+                    'on_select' : function(ev) {
+                        JSAN.use('util.functional');
+                        
+                        // get the actual node clicked to determine which editor to use
+                        if (obj.list.node.view.selection.currentIndex > -1) {
+                            var node = obj.list.node.contentView.getItemAtIndex(obj.list.node.view.selection.currentIndex);
+                            obj.focused_node_retrieve_id = node.getAttribute('retrieve_id');
+                        }
+
+                        var sel = obj.list.retrieve_selection();
+                        obj.controller.view.sel_clip.disabled = sel.length < 1;
+                        obj.sel_list = util.functional.map_list(
+                            sel,
+                            function(o) { return o.getAttribute('retrieve_id'); }
+                        );
+                        obj.toggle_actions();
+                        if (typeof obj.on_select == 'function') {
+                            obj.on_select(obj.sel_list);
+                        }
+                        if (typeof window.xulG == 'object' && typeof window.xulG.on_select == 'function') {
+                            window.xulG.on_select(obj.sel_list);
+                        }
+                    },
+                }
+            );
+
+            obj.controller.render();
+
+        } catch(E) {
+            this.error.sdump('D_ERROR','serial/manage_dists.list_init: ' + E + '\n');
+            alert(E);
+        }
+    },
+
+    'toggle_actions' : function() {
+        var obj = this;
+        try {
+            var found_aou = false; var found_sdist = false; var found_sstr = false; var found_sbsum = false; var found_sssum = false; var found_sisum = false; var found_sstr_group = false;
+            for (var i = 0; i < obj.sel_list.length; i++) {
+                var type = obj.sel_list[i].split(/_/)[0];
+                switch(type) {
+                    case 'aou' : 
+                        found_aou = true; 
+                    break;
+                    case 'sdist' : found_sdist = true; break;
+                    case 'sstr' : found_sstr = true; break;
+                    case 'sbsum' : found_sbsum = true; break;
+                    case 'sssum' : found_sssum = true; break;
+                    case 'sisum' : found_sisum = true; break;
+                    case 'sstr-group' : found_sstr_group = true; break;
+                }
+            }
+            obj.controller.view.cmd_add_sstr.setAttribute('disabled','true');
+            obj.controller.view.cmd_delete_sstr.setAttribute('disabled','true');
+            obj.controller.view.cmd_mark_library.setAttribute('disabled','true');
+            obj.controller.view.cmd_delete_sdist.setAttribute('disabled','true');
+            if (found_aou) {
+                obj.controller.view.cmd_mark_library.setAttribute('disabled','false');
+            }
+            if (found_sdist) {
+                obj.controller.view.cmd_delete_sdist.setAttribute('disabled','false');
+                obj.controller.view.cmd_add_sstr.setAttribute('disabled','false');
+            }
+            if (found_sstr_group) {
+                obj.controller.view.cmd_add_sstr.setAttribute('disabled','false');
+            }
+            if (found_sstr) {
+                obj.controller.view.cmd_delete_sstr.setAttribute('disabled','false');
+                obj.controller.view.cmd_transfer_sstrs.setAttribute('disabled','false');
+            }
+            if (found_sbsum) {
+            }
+            if (found_sssum) {
+            }
+            if (found_sisum) {
+            }
+        } catch(E) {
+            obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.actions.error'),E);
+        }
+    },
+
+    'refresh_list' : function() { 
+        try {
+            var obj = this;
+            obj.list.clear();
+            obj.map_tree = {};
+            obj.map_sdist = {};
+            //obj.map_sstr = {};
+            obj.org_ids = obj.network.simple_request('FM_SDIST_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative',[ obj.docid ]);
+            if (typeof obj.org_ids.ilsevent != 'undefined') throw(obj.org_ids);
+            JSAN.use('util.functional'); 
+            obj.org_ids = util.functional.map_list( obj.org_ids, function (o) { return Number(o); });
+            /*
+            var org = obj.data.hash.aou[ obj.data.list.au[0].ws_ou() ];
+            obj.show_libs( org );
+            */
+            obj.default_lib = document.getElementById('sdist_lib_menu').value;
+            obj.show_my_libs( obj.default_lib );
+        } catch(E) {
+            this.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.refresh_list.error'),E);
+        }
+    },
+};
+
+dump('exiting serial/manage_dists.js\n');
diff --git a/Open-ILS/xul/staff_client/server/serial/manage_dists.xul b/Open-ILS/xul/staff_client/server/serial/manage_dists.xul
new file mode 100644 (file)
index 0000000..5192e8e
--- /dev/null
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Manage Distributions Overlay -->
+<!--
+vim:noet:sw=4:ts=4:
+-->
+<!DOCTYPE overlay PUBLIC "" ""[
+    <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<?xul-overlay href="/xul/server/serial/sdist2_editor.xul"?>
+<?xul-overlay href="/xul/server/serial/sstr_editor.xul"?>
+<?xul-overlay href="/xul/server/serial/sbsum_editor.xul"?>
+<?xul-overlay href="/xul/server/serial/sisum_editor.xul"?>
+<?xul-overlay href="/xul/server/serial/sssum_editor.xul"?>
+<overlay id="serial_manage_dists_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+            <tab id="serial_manage_dists_tab" label="Distributions" oncommand="manage_dists_init()"/>
+            <tabpanel id="serial_manage_dists" orient="vertical" flex="1">
+                 <script>
+                    <![CDATA[
+                        manage_dists_inited = 0;
+                        function manage_dists_init() {
+                            if (manage_dists_inited) {
+                                return;
+                            }
+                            try {
+                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                                if (typeof JSAN == 'undefined') { 
+                                    throw( document.getElementById("commonStrings").getString('common.jsan.missing') );
+                                }
+                                JSAN.errorLevel = "die"; // none, warn, or die
+                                JSAN.addRepository('/xul/server/');
+                                JSAN.use('util.error'); g.error = new util.error();
+                                g.error.sdump('D_TRACE','manage_dists_init() for serial/manage_dists.xul');
+                                JSAN.use('serial.manage_dists'); g.manage_dists = new serial.manage_dists();
+
+                                g.manage_dists.init( { 'docid' : xul_param('docid') } );
+                                manage_dists_inited = 1;
+
+                            } catch(E) {
+                                var err_msg = document.getElementById("commonStrings").getFormattedString('common.exception', ['serial/manage_dists.xul', E]);
+                                try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+                                alert(err_msg);
+                            }
+                        }
+
+                    ]]>
+                </script>
+
+                <popupset>
+                    <popup id="serial_manage_dists_popup">
+                        <menuitem command="cmd_add_sdist" label="Add Distribution"/>
+                        <menuitem command="cmd_add_siss" label="Add Issuance"/>
+                        <menuitem command="cmd_add_scap" label="Add Caption/Pattern"/>
+                        <menuseparator/>
+                        <menuitem command="cmd_make_predictions" label="Make Predictions"/>
+                        <menuseparator/>
+                        <menuitem command="cmd_delete_sdist" label="Delete Distribution"/>
+                        <menuitem command="cmd_delete_siss" label="Delete Issuance"/>
+                        <menuitem command="cmd_delete_scap" label="Delete Caption/Pattern"/>
+                    </popup>
+                </popupset>
+
+                <hbox flex="1">
+                    <vbox flex="1" id="before_splitter" oils_persist="width">
+                        <hbox id="serial_dist_lib_menu"/>
+                        <hbox>
+                            <checkbox id="show_sdists" label="Show Dists." />
+                            <checkbox id="show_groups" label="Show Groups" />
+                            <button id="serial_dist_add_button" label="&staff.cat.copy_browser.holdings_maintenance.refresh_button.label;" command="cmd_refresh_list" />
+                            <spacer flex="1"/>
+                            <menubar>
+                                <menu label="Actions for Selected Row">
+                                    <menupopup>
+                                        <menuitem command="cmd_add_sdist" label="Add Distribution"/>
+                                        <menuitem command="cmd_add_siss" label="Add Issuance"/>
+                                        <menuitem command="cmd_add_scap" label="Add Caption/Pattern"/>
+                                        <menuseparator/>
+                                        <menuitem command="cmd_make_predictions" label="Make Predictions"/>
+                                        <menuseparator/>
+                                        <menuitem command="cmd_delete_sdist" label="Delete Distribution"/>
+                                        <menuitem command="cmd_delete_siss" label="Delete Issuance"/>
+                                        <menuitem command="cmd_delete_scap" label="Delete Caption/Pattern"/>
+                                    </menupopup>
+                                </menu>
+                            </menubar>
+                        </hbox>
+                        <tree id="sdists_tree" flex="15" enableColumnDrag="true" context="serial_manage_dists_popup"/>
+                    </vbox>
+                    <splitter state="open" collapse="before" resizebefore="closest" resizeafter="farthest" id="splitter" oils_persist="state hidden" oils_persist_peers="before_splitter serial_manage_dists_editor_deck"/>
+                    <deck id="serial_manage_dists_editor_deck" flex="20" oils_persist="width">
+                        <description value="Please select an object to edit"/>
+                        <vbox id="serial_sdist2_editor_panel" />
+                        <vbox id="serial_sstr_editor_panel" />
+                        <vbox id="serial_sbsum_editor_panel" />
+                        <vbox id="serial_sssum_editor_panel" />
+                        <vbox id="serial_sisum_editor_panel" />
+                    </deck>
+                </hbox>
+            </tabpanel>
+
+</overlay>
index 307cc49..0e4a51f 100644 (file)
@@ -1557,7 +1557,7 @@ serial.manage_subs.prototype = {
             var columns = [
                 {
                     'id' : 'tree_location',
-                    'label' : document.getElementById('catStrings').getString('staff.cat.copy_browser.list_init.tree_location'),
+                    'label' : 'Location',
                     'flex' : 1, 'primary' : true, 'hidden' : false, 
                     'render' : function(my) { return my.sdist ? my.sdist.label() : my.siss ? my.siss.label() : my.scap ? 'C/P : #' + my.scap.id() : my.ssub ? 'Subscription : #' + my.ssub.id() : my.aou ? my.aou.shortname() + " : " + my.aou.name() : my.label ? my.label : "???"; },
                 },
diff --git a/Open-ILS/xul/staff_client/server/serial/sbsum_editor.js b/Open-ILS/xul/staff_client/server/serial/sbsum_editor.js
new file mode 100644 (file)
index 0000000..fe7e9f2
--- /dev/null
@@ -0,0 +1,121 @@
+dump('entering serial/sbsum_editor.js\n');
+// vim:noet:sw=4:ts=4:
+
+JSAN.use('serial.editor_base');
+
+if (typeof serial == 'undefined') serial = {};
+serial.sbsum_editor = function (params) {
+    try {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+        JSAN.use('util.error'); this.error = new util.error();
+        JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+        JSAN.use('util.network'); this.network = new util.network();
+    } catch(E) {
+        dump('serial/sbsum_editor: ' + E + '\n');
+    }
+
+    /* This keeps track of what fields have been edited for styling purposes */
+    this.changed = {};
+
+    /* This holds the original values for prepopulating the field editors */
+    this.editor_values = {};
+
+};
+
+serial.sbsum_editor.prototype = {
+    // we could do this with non-standard '__proto__' property instead
+    'editor_base_init' : serial.editor_base.editor_base_init,
+    'editor_base_apply' : serial.editor_base.editor_base_apply,
+    'editor_base_save' : serial.editor_base.editor_base_save,
+
+    'fm_type' : 'sbsum',
+    'fm_type_plural' : 'sbsums',
+
+    'init' : function (params) {
+        var obj = this;
+
+        params.retrieve_function = 'FM_SBSUM_BATCH_RETRIEVE.authoritative';
+
+        obj.editor_base_init(params);
+
+        /* Do it */
+        obj.summarize( obj.sbsums );
+        obj.render();
+    },
+
+    /******************************************************************************************************/
+    /* Restore backup copies */
+
+    'reset' :  serial.editor_base.editor_base_reset,
+
+    /******************************************************************************************************/
+    /* Apply a value to a specific field on all the copies being edited */
+
+    'apply' : function(field,value) {
+        var obj = this;
+
+        obj.editor_base_apply(field, value);
+    },
+
+    /******************************************************************************************************/
+
+    'init_panes' : function () {
+        var obj = this;
+        obj.panes_and_field_names = {
+
+        /* These get shown in the left panel */
+        'sbsum_editor_left_pane' :
+        [
+            [
+                'ID',
+                { 
+                    render: '"ID : " + fm.id();', 
+                    //input: 'c = function(v){ obj.apply("distribution",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+
+                }
+            ],
+            [
+                'Textual Holdings',
+                { 
+                    render: 'fm.textual_holdings() == null ? "" : fm.textual_holdings();',
+                    input: 'c = function(v){ obj.apply("textual_holdings",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("size", 85); x.setAttribute("value",obj.editor_values.textual_holdings); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+                    value_key: 'textual_holdings'
+                }
+            ],
+            [
+                'Generated Coverage',
+                {
+                    render: 'fm.generated_coverage() == null ? "" : fm.generated_coverage();'
+                }
+            ]
+        ]
+        };
+    },
+
+    /******************************************************************************************************/
+    /* This loops through all our fieldnames and all the copies, tallying up counts for the different values */
+
+    'summarize' :  serial.editor_base.editor_base_summarize,
+
+    /******************************************************************************************************/
+    /* Display the summarized data and inputs for editing */
+
+    'render' :  serial.editor_base.editor_base_render,
+
+    /******************************************************************************************************/
+    /* This actually draws the change button and input widget for a given field */
+    'render_input' : serial.editor_base.editor_base_render_input,
+
+    /******************************************************************************************************/
+    /* save the streams */
+
+    'save' : function() {
+        var obj = this;
+        obj.editor_base_save('open-ils.serial.basic_summary.batch.update');
+    },
+
+    /******************************************************************************************************/
+    'save_attributes' : serial.editor_base.editor_base_save_attributes
+};
+
+dump('exiting serial/sbsum_editor.js\n');
diff --git a/Open-ILS/xul/staff_client/server/serial/sbsum_editor.xul b/Open-ILS/xul/staff_client/server/serial/sbsum_editor.xul
new file mode 100644 (file)
index 0000000..9880c5d
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Stream Editor Overlay -->
+
+<!-- LOCALIZATION -->
+<!DOCTYPE overlay PUBLIC "" ""[
+    <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<overlay id="serial_sbsum_editor_panel_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <vbox flex="1" id="serial_sbsum_editor_panel" class="my_overflow">
+        <vbox id="brief_display_box"/>
+
+               <hbox flex="1" style="overflow: auto">
+                       <vbox flex="1">
+                               <label value="Basic Summary" style="font-weight: bold; font-size: large"/>
+                               <vbox id="sbsum_editor_left_pane" flex="1"/>
+                       </vbox>
+        </hbox>
+
+               <hbox id="sbsum_editor_nav">
+                       <spacer flex="1"/>
+                       <button id="sbsum_save" label="&staff.serial.sbsum_editor.modify;" hidden="true" accesskey="&staff.serial.sbsum_editor.modify.accesskey;" oncommand="g.manage_dists.sbsum_editor.save()" />
+                       <!--<button id="cancel" label="&staff.cat.copy_editor.cancel.label;" accesskey="&staff.cat.copy_editor.cancel.accesskey;" oncommand="window.close();"/>-->
+               </hbox>
+
+               <spacer/>
+       </vbox>
+
+</overlay>
+
diff --git a/Open-ILS/xul/staff_client/server/serial/sdist2_editor.xul b/Open-ILS/xul/staff_client/server/serial/sdist2_editor.xul
new file mode 100644 (file)
index 0000000..91444f2
--- /dev/null
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Distribution Editor Overlay -->
+<!-- THIS IS A DUPLICATE OF sdist_editor.xul to allow easy overlay in two places -->
+
+<!-- LOCALIZATION -->
+<!DOCTYPE overlay PUBLIC "" ""[
+    <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<overlay id="serial_sdist2_editor_panel_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <vbox flex="1" id="serial_sdist2_editor_panel" class="my_overflow">
+        <vbox id="brief_display_box"/>
+
+               <hbox flex="1" style="overflow: auto">
+                       <vbox flex="1" id="before_splitter" oils_persist="height">
+                               <label value="Distribution" style="font-weight: bold; font-size: large"/>
+                               <vbox id="sdist2_editor_left_pane" flex="1"/>
+                       </vbox>
+                       <splitter id="splitter" oils_persist="state hidden" oils_persist_peers="before_splitter after_splitter"><grippy /></splitter>
+                       <vbox flex="1" id="after_splitter" oils_persist="height">
+                               <vbox id="sdist2_editor_right_pane"/>
+                <groupbox>
+                    <caption label="Library Specific Options" />
+                    <description>Note: Changing the 'Holding Lib' will unset all of these values</description>
+                    <vbox id="sdist2_editor_lso_pane" flex="1"/>
+                </groupbox>
+                       </vbox>
+               </hbox>
+
+               <hbox id="sdist2_editor_nav">
+                       <spacer flex="1"/>
+                       <button id="sdist2_notes" label="&staff.serial.sdist_editor.notes;" accesskey="&staff.serial.sdist_editor.notes.accesskey;" oncommand="g.manage_dists.sdist2_editor.notes()" />
+                       <button id="sdist2_save" label="&staff.serial.sdist_editor.modify;" hidden="true" accesskey="&staff.serial.ssub_editor.modify.accesskey;" oncommand="g.manage_dists.sdist2_editor.save()" />
+                       <!--<button id="cancel" label="&staff.cat.copy_editor.cancel.label;" accesskey="&staff.cat.copy_editor.cancel.accesskey;" oncommand="window.close();"/>-->
+               </hbox>
+
+               <spacer/>
+       </vbox>
+
+</overlay>
+
index 3272a33..95fd9a5 100644 (file)
@@ -27,7 +27,10 @@ serial.sdist_editor = function (params) {
     if (parent_g.mfhd) {
         var mfhd_details = parent_g.mfhd.details;
         for (var i = 0; i < mfhd_details.length; i++) {
-            var mfhd_detail = mfhd_details[i];
+            var mfhd_detail = {};
+            for (j in mfhd_details[i]) {
+                mfhd_detail[j] = mfhd_details[i][j];
+            }
             mfhd_detail.label = mfhd_detail.label + ' (' + (mfhd_detail.entryNum + 1) + ')';
             var sre_id = mfhd_detail.id;
             var org_unit_id = mfhd_detail.owning_lib;
@@ -144,7 +147,7 @@ serial.sdist_editor.prototype = {
         obj.panes_and_field_names = {
 
         /* These get shown in the left panel */
-        'sdist_editor_left_pane' :
+        '_editor_left_pane' :
         [
             [
                 'ID',
@@ -180,7 +183,7 @@ serial.sdist_editor.prototype = {
             ],
         ],
         /* These get shown in the right panel */
-            'sdist_editor_right_pane' :
+            '_editor_right_pane' :
         [
             [
                 'Holding Lib',
@@ -193,7 +196,7 @@ serial.sdist_editor.prototype = {
             ],
         ],
         /* These get shown in the right 'library-specific-options' panel */
-        'sdist_editor_lso_pane' :
+        '_editor_lso_pane' :
         [
             [
                 'Legacy Record Entry',
@@ -243,6 +246,9 @@ serial.sdist_editor.prototype = {
         ],
 
         };
+        for (i in obj.panes_and_field_names) {
+            obj.panes_and_field_names[obj.xul_id_prefix + i] = obj.panes_and_field_names[i];
+        }
     },
 
     /******************************************************************************************************/
diff --git a/Open-ILS/xul/staff_client/server/serial/sisum_editor.js b/Open-ILS/xul/staff_client/server/serial/sisum_editor.js
new file mode 100644 (file)
index 0000000..18c248f
--- /dev/null
@@ -0,0 +1,121 @@
+dump('entering serial/sisum_editor.js\n');
+// vim:noet:sw=4:ts=4:
+
+JSAN.use('serial.editor_base');
+
+if (typeof serial == 'undefined') serial = {};
+serial.sisum_editor = function (params) {
+    try {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+        JSAN.use('util.error'); this.error = new util.error();
+        JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+        JSAN.use('util.network'); this.network = new util.network();
+    } catch(E) {
+        dump('serial/sisum_editor: ' + E + '\n');
+    }
+
+    /* This keeps track of what fields have been edited for styling purposes */
+    this.changed = {};
+
+    /* This holds the original values for prepopulating the field editors */
+    this.editor_values = {};
+
+};
+
+serial.sisum_editor.prototype = {
+    // we could do this with non-standard '__proto__' property instead
+    'editor_base_init' : serial.editor_base.editor_base_init,
+    'editor_base_apply' : serial.editor_base.editor_base_apply,
+    'editor_base_save' : serial.editor_base.editor_base_save,
+
+    'fm_type' : 'sisum',
+    'fm_type_plural' : 'sisums',
+
+    'init' : function (params) {
+        var obj = this;
+
+        params.retrieve_function = 'FM_SISUM_BATCH_RETRIEVE.authoritative';
+
+        obj.editor_base_init(params);
+
+        /* Do it */
+        obj.summarize( obj.sisums );
+        obj.render();
+    },
+
+    /******************************************************************************************************/
+    /* Restore backup copies */
+
+    'reset' :  serial.editor_base.editor_base_reset,
+
+    /******************************************************************************************************/
+    /* Apply a value to a specific field on all the copies being edited */
+
+    'apply' : function(field,value) {
+        var obj = this;
+
+        obj.editor_base_apply(field, value);
+    },
+
+    /******************************************************************************************************/
+
+    'init_panes' : function () {
+        var obj = this;
+        obj.panes_and_field_names = {
+
+        /* These get shown in the left panel */
+        'sisum_editor_left_pane' :
+        [
+            [
+                'ID',
+                { 
+                    render: '"ID : " + fm.id();' 
+                    //input: 'c = function(v){ obj.apply("distribution",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+
+                }
+            ],
+            [
+                'Textual Holdings',
+                { 
+                    render: 'fm.textual_holdings() == null ? "" : fm.textual_holdings();',
+                    input: 'c = function(v){ obj.apply("textual_holdings",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("size", 85); x.setAttribute("value",obj.editor_values.textual_holdings); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+                    value_key: 'textual_holdings'
+                }
+            ],
+            [
+                'Generated Coverage',
+                { 
+                    render: 'fm.generated_coverage() == null ? "" : fm.generated_coverage();'
+                }
+            ]
+        ]
+        };
+    },
+
+    /******************************************************************************************************/
+    /* This loops through all our fieldnames and all the copies, tallying up counts for the different values */
+
+    'summarize' :  serial.editor_base.editor_base_summarize,
+
+    /******************************************************************************************************/
+    /* Display the summarized data and inputs for editing */
+
+    'render' :  serial.editor_base.editor_base_render,
+
+    /******************************************************************************************************/
+    /* This actually draws the change button and input widget for a given field */
+    'render_input' : serial.editor_base.editor_base_render_input,
+
+    /******************************************************************************************************/
+    /* save the streams */
+
+    'save' : function() {
+        var obj = this;
+        obj.editor_base_save('open-ils.serial.index_summary.batch.update');
+    },
+
+    /******************************************************************************************************/
+    'save_attributes' : serial.editor_base.editor_base_save_attributes
+};
+
+dump('exiting serial/sisum_editor.js\n');
diff --git a/Open-ILS/xul/staff_client/server/serial/sisum_editor.xul b/Open-ILS/xul/staff_client/server/serial/sisum_editor.xul
new file mode 100644 (file)
index 0000000..b34bd1b
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Index Summary Editor Overlay -->
+
+<!-- LOCALIZATION -->
+<!DOCTYPE overlay PUBLIC "" ""[
+    <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<overlay id="serial_sisum_editor_panel_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <vbox flex="1" id="serial_sisum_editor_panel" class="my_overflow">
+        <vbox id="brief_display_box"/>
+
+               <hbox flex="1" style="overflow: auto">
+                       <vbox flex="1">
+                               <label value="Index Summary" style="font-weight: bold; font-size: large"/>
+                               <vbox id="sisum_editor_left_pane" flex="1"/>
+                       </vbox>
+        </hbox>
+
+               <hbox id="sisum_editor_nav">
+                       <spacer flex="1"/>
+                       <button id="sisum_save" label="&staff.serial.sisum_editor.modify;" hidden="true" accesskey="&staff.serial.sisum_editor.modify.accesskey;" oncommand="g.manage_dists.sisum_editor.save()" />
+                       <!--<button id="cancel" label="&staff.cat.copy_editor.cancel.label;" accesskey="&staff.cat.copy_editor.cancel.accesskey;" oncommand="window.close();"/>-->
+               </hbox>
+
+               <spacer/>
+       </vbox>
+
+</overlay>
+
diff --git a/Open-ILS/xul/staff_client/server/serial/sssum_editor.js b/Open-ILS/xul/staff_client/server/serial/sssum_editor.js
new file mode 100644 (file)
index 0000000..2c7c8eb
--- /dev/null
@@ -0,0 +1,121 @@
+dump('entering serial/sssum_editor.js\n');
+// vim:noet:sw=4:ts=4:
+
+JSAN.use('serial.editor_base');
+
+if (typeof serial == 'undefined') serial = {};
+serial.sssum_editor = function (params) {
+    try {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+        JSAN.use('util.error'); this.error = new util.error();
+        JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+        JSAN.use('util.network'); this.network = new util.network();
+    } catch(E) {
+        dump('serial/sssum_editor: ' + E + '\n');
+    }
+
+    /* This keeps track of what fields have been edited for styling purposes */
+    this.changed = {};
+
+    /* This holds the original values for prepopulating the field editors */
+    this.editor_values = {};
+
+};
+
+serial.sssum_editor.prototype = {
+    // we could do this with non-standard '__proto__' property instead
+    'editor_base_init' : serial.editor_base.editor_base_init,
+    'editor_base_apply' : serial.editor_base.editor_base_apply,
+    'editor_base_save' : serial.editor_base.editor_base_save,
+
+    'fm_type' : 'sssum',
+    'fm_type_plural' : 'sssums',
+
+    'init' : function (params) {
+        var obj = this;
+
+        params.retrieve_function = 'FM_SSSUM_BATCH_RETRIEVE.authoritative';
+
+        obj.editor_base_init(params);
+
+        /* Do it */
+        obj.summarize( obj.sssums );
+        obj.render();
+    },
+
+    /******************************************************************************************************/
+    /* Restore backup copies */
+
+    'reset' :  serial.editor_base.editor_base_reset,
+
+    /******************************************************************************************************/
+    /* Apply a value to a specific field on all the copies being edited */
+
+    'apply' : function(field,value) {
+        var obj = this;
+
+        obj.editor_base_apply(field, value);
+    },
+
+    /******************************************************************************************************/
+
+    'init_panes' : function () {
+        var obj = this;
+        obj.panes_and_field_names = {
+
+        /* These get shown in the left panel */
+        'sssum_editor_left_pane' :
+        [
+            [
+                'ID',
+                { 
+                    render: '"ID : " + fm.id();', 
+                    //input: 'c = function(v){ obj.apply("distribution",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+
+                }
+            ],
+            [
+                'Textual Holdings',
+                { 
+                    render: 'fm.textual_holdings() == null ? "" : fm.textual_holdings();',
+                    input: 'c = function(v){ obj.apply("textual_holdings",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("size", 85); x.setAttribute("value",obj.editor_values.textual_holdings); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+                    value_key: 'textual_holdings'
+                }
+            ],
+            [
+                'Generated Coverage',
+                {
+                    render: 'fm.generated_coverage() == null ? "" : fm.generated_coverage();'
+                }
+            ]
+        ]
+        };
+    },
+
+    /******************************************************************************************************/
+    /* This loops through all our fieldnames and all the copies, tallying up counts for the different values */
+
+    'summarize' :  serial.editor_base.editor_base_summarize,
+
+    /******************************************************************************************************/
+    /* Display the summarized data and inputs for editing */
+
+    'render' :  serial.editor_base.editor_base_render,
+
+    /******************************************************************************************************/
+    /* This actually draws the change button and input widget for a given field */
+    'render_input' : serial.editor_base.editor_base_render_input,
+
+    /******************************************************************************************************/
+    /* save the streams */
+
+    'save' : function() {
+        var obj = this;
+        obj.editor_base_save('open-ils.serial.supplement_summary.batch.update');
+    },
+
+    /******************************************************************************************************/
+    'save_attributes' : serial.editor_base.editor_base_save_attributes
+};
+
+dump('exiting serial/sssum_editor.js\n');
diff --git a/Open-ILS/xul/staff_client/server/serial/sssum_editor.xul b/Open-ILS/xul/staff_client/server/serial/sssum_editor.xul
new file mode 100644 (file)
index 0000000..ed2aca0
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Supplement Summary Editor Overlay -->
+
+<!-- LOCALIZATION -->
+<!DOCTYPE overlay PUBLIC "" ""[
+    <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<overlay id="serial_sssum_editor_panel_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <vbox flex="1" id="serial_sssum_editor_panel" class="my_overflow">
+        <vbox id="brief_display_box"/>
+
+               <hbox flex="1" style="overflow: auto">
+                       <vbox flex="1">
+                               <label value="Supplement Summary" style="font-weight: bold; font-size: large"/>
+                               <vbox id="sssum_editor_left_pane" flex="1"/>
+                       </vbox>
+        </hbox>
+
+               <hbox id="sssum_editor_nav">
+                       <spacer flex="1"/>
+                       <button id="sssum_save" label="&staff.serial.sssum_editor.modify;" hidden="true" accesskey="&staff.serial.sssum_editor.modify.accesskey;" oncommand="g.manage_dists.sssum_editor.save()" />
+                       <!--<button id="cancel" label="&staff.cat.copy_editor.cancel.label;" accesskey="&staff.cat.copy_editor.cancel.accesskey;" oncommand="window.close();"/>-->
+               </hbox>
+
+               <spacer/>
+       </vbox>
+
+</overlay>
+
diff --git a/Open-ILS/xul/staff_client/server/serial/sstr_editor.js b/Open-ILS/xul/staff_client/server/serial/sstr_editor.js
new file mode 100644 (file)
index 0000000..301f092
--- /dev/null
@@ -0,0 +1,116 @@
+dump('entering serial/sstr_editor.js\n');
+// vim:noet:sw=4:ts=4:
+
+JSAN.use('serial.editor_base');
+
+if (typeof serial == 'undefined') serial = {};
+serial.sstr_editor = function (params) {
+    try {
+        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+        JSAN.use('util.error'); this.error = new util.error();
+        JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+        JSAN.use('util.network'); this.network = new util.network();
+    } catch(E) {
+        dump('serial/sstr_editor: ' + E + '\n');
+    }
+
+    /* This keeps track of what fields have been edited for styling purposes */
+    this.changed = {};
+
+    /* This holds the original values for prepopulating the field editors */
+    this.editor_values = {};
+
+};
+
+serial.sstr_editor.prototype = {
+    // we could do this with non-standard '__proto__' property instead
+    'editor_base_init' : serial.editor_base.editor_base_init,
+    'editor_base_apply' : serial.editor_base.editor_base_apply,
+    'editor_base_save' : serial.editor_base.editor_base_save,
+
+    'fm_type' : 'sstr',
+    'fm_type_plural' : 'sstrs',
+
+    'init' : function (params) {
+        var obj = this;
+
+        params.retrieve_function = 'FM_SSTR_BATCH_RETRIEVE.authoritative';
+
+        obj.editor_base_init(params);
+
+        /* Do it */
+        obj.summarize( obj.sstrs );
+        obj.render();
+    },
+
+    /******************************************************************************************************/
+    /* Restore backup copies */
+
+    'reset' :  serial.editor_base.editor_base_reset,
+
+    /******************************************************************************************************/
+    /* Apply a value to a specific field on all the copies being edited */
+
+    'apply' : function(field,value) {
+        var obj = this;
+
+        obj.editor_base_apply(field, value);
+    },
+
+    /******************************************************************************************************/
+
+    'init_panes' : function () {
+        var obj = this;
+        obj.panes_and_field_names = {
+
+        /* These get shown in the left panel */
+        'sstr_editor_left_pane' :
+        [
+            [
+                'ID',
+                { 
+                    render: '"ID : " + fm.id();', 
+                    //input: 'c = function(v){ obj.apply("distribution",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+
+                }
+            ],
+            [
+                'Routing Label',
+                { 
+                    render: 'fm.routing_label() == null ? "" : fm.routing_label();',
+                    input: 'c = function(v){ obj.apply("routing_label",v); if (typeof post_c == "function") post_c(v); }; x = document.createElement("textbox"); x.setAttribute("value",obj.editor_values.routing_label); x.addEventListener("apply",function(f){ return function(ev) { f(ev.target.value); } }(c), false);',
+                    value_key: 'routing_label'
+                }
+            ]
+        ]
+
+        };
+    },
+
+    /******************************************************************************************************/
+    /* This loops through all our fieldnames and all the copies, tallying up counts for the different values */
+
+    'summarize' :  serial.editor_base.editor_base_summarize,
+
+    /******************************************************************************************************/
+    /* Display the summarized data and inputs for editing */
+
+    'render' :  serial.editor_base.editor_base_render,
+
+    /******************************************************************************************************/
+    /* This actually draws the change button and input widget for a given field */
+    'render_input' : serial.editor_base.editor_base_render_input,
+
+    /******************************************************************************************************/
+    /* save the streams */
+
+    'save' : function() {
+        var obj = this;
+        obj.editor_base_save('open-ils.serial.stream.batch.update');
+    },
+
+    /******************************************************************************************************/
+    'save_attributes' : serial.editor_base.editor_base_save_attributes
+};
+
+dump('exiting serial/sstr_editor.js\n');
diff --git a/Open-ILS/xul/staff_client/server/serial/sstr_editor.xul b/Open-ILS/xul/staff_client/server/serial/sstr_editor.xul
new file mode 100644 (file)
index 0000000..4973d6d
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Stream Editor Overlay -->
+
+<!-- LOCALIZATION -->
+<!DOCTYPE overlay PUBLIC "" ""[
+    <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<overlay id="serial_sstr_editor_panel_overlay" 
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <vbox flex="1" id="serial_sstr_editor_panel" class="my_overflow">
+        <vbox id="brief_display_box"/>
+
+               <hbox flex="1" style="overflow: auto">
+                       <vbox flex="1">
+                               <label value="Stream" style="font-weight: bold; font-size: large"/>
+                               <vbox id="sstr_editor_left_pane" flex="1"/>
+                       </vbox>
+        </hbox>
+
+               <hbox id="sstr_editor_nav">
+                       <spacer flex="1"/>
+                       <button id="sstr_save" label="&staff.serial.sstr_editor.modify;" hidden="true" accesskey="&staff.serial.sstr_editor.modify.accesskey;" oncommand="g.manage_dists.sstr_editor.save()" />
+                       <!--<button id="cancel" label="&staff.cat.copy_editor.cancel.label;" accesskey="&staff.cat.copy_editor.cancel.accesskey;" oncommand="window.close();"/>-->
+               </hbox>
+
+               <spacer/>
+       </vbox>
+
+</overlay>
+