added queue delete option and begining of support for auto-import on non-colidding...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 18 Sep 2008 21:28:02 +0000 (21:28 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 18 Sep 2008 21:28:02 +0000 (21:28 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10638 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Vandelay.pm
Open-ILS/web/vandelay/vandelay.html
Open-ILS/web/vandelay/vandelay.js

index 4f90680..b827613 100644 (file)
@@ -398,6 +398,37 @@ sub import_record_list {
     return {complete => 1};
 }
 
+=head note done
+__PACKAGE__->register_method(  
+       api_name        => "open-ils.vandelay.bib_queue.import",
+       method          => 'import_queue',
+       api_level       => 1,
+       argc            => 2,
+    stream      => 1,
+       record_type     => 'bib'
+);
+
+__PACKAGE__->register_method(  
+       api_name        => "open-ils.vandelay.auth_queue.import",
+       method          => 'import_queue',
+       api_level       => 1,
+       argc            => 2,
+    stream      => 1,
+       record_type     => 'auth'
+);
+
+sub import_record_list {
+    my($self, $conn, $auth, $rec_ids, $args) = @_;
+    my $e = new_editor(xact => 1, authtoken => $auth);
+    return $e->die_event unless $e->checkauth;
+    $args ||= {};
+    my $err = import_record_list_impl($self, $conn, $auth, $e, $rec_ids, $args);
+    return $err if $err;
+    $e->commit;
+    return {complete => 1};
+}
+=cut
+
 sub import_record_list_impl {
     my($self, $conn, $auth, $e, $rec_ids, $args) = @_;
 
@@ -537,6 +568,40 @@ sub owner_queue_retrieve {
     return undef;
 }
 
+__PACKAGE__->register_method(  
+       api_name        => "open-ils.vandelay.bib_queue.delete",
+       method          => "delete_queue",
+       api_level       => 1,
+       argc            => 2,
+       record_type     => 'bib'
+);            
+__PACKAGE__->register_method(  
+       api_name        => "open-ils.vandelay.auth_queue.delete",
+       method          => "delete_queue",
+       api_level       => 1,
+       argc            => 2,
+       record_type     => 'auth'
+);  
 
+sub delete_queue {
+    my($self, $conn, $auth, $q_id) = @_;
+    my $e = new_editor(xact => 1, authtoken => $auth);
+    return $e->die_event unless $e->checkauth;
+    if($self->{record_type} eq 'bib') {
+           return $e->die_event unless $e->allowed('CREATE_BIB_IMPORT_QUEUE');
+        my $queue = $e->retrieve_vandelay_bib_queue($q_id)
+            or return $e->die_event;
+        $e->delete_vandelay_bib_queue($queue)
+            or return $e->die_event;
+    } else {
+           return $e->die_event unless $e->allowed('CREATE_AUTHORITY_IMPORT_QUEUE');
+        my $queue = $e->retrieve_vandelay_authority_queue($q_id)
+            or return $e->die_event;
+        $e->delete_vandelay_authority_queue($queue)
+            or return $e->die_event;
+    }
+    $e->commit;
+    return 1;
+}
 
 1;
index 47b9f79..cfbd741 100644 (file)
                             </select>
                         </td>
                     </tr>
+                    <!--
                     <tr>
                         <td>Purpose</td>
                         <td colspan='4'>
                             </select>
                         </td>
                     </tr>
+                    -->
+                    <tr>
+                        <td>Auto-Import Non-Colliding Records</td>
+                        <td colspan='4'>
+                            <input jsId='vlUploadQueueAutoImport' checked='checked' dojoType='dijit.form.CheckBox'/>
+                        </td>
+                    </tr>
                     <tr>
                         <td>
                             <span id="vl-file-label">File to Upload:</span>
                     <tr>
                         <td align='left'>
                             <button dojoType='dijit.form.Button' onclick='vlImportSelectedRecords();'>Import Selected</button>
+                            <button dojoType='dijit.form.Button' onclick='
+                                if(confirm("Are you sure want to delete this queue?")) {
+                                    vlDeleteQueue(currentType, currentQueueId, 
+                                        function() { displayGlobalDiv("vl-marc-upload-div"); });
+                                }'>Delete Queue</button>
                         </td>
                         <td align='middle'>
                             <style>.filter_td { padding-right: 5px; border-right: 2px solid #e8e1cf; } </style>
                             <table><tr>
                                 <td class='filter_td'>
-                                    Only show records with possible matches
+                                    Limit to Collision Matches
                                     <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches' checked='checked'/>
                                 </td>
                                 <td class='filter_td' style='padding-left:5px;'>
                                     Results Per Page 
-                                    <select style='width:50px;' jsId='vlQueueDisplayLimit' dojoType='dijit.form.FilteringSelect' value='10'>
+                                    <select style='width:56px;' jsId='vlQueueDisplayLimit' dojoType='dijit.form.FilteringSelect' value='10'>
                                         <option value='10'>10</option>
                                         <option value='20'>20</option>
                                         <option value='50'>50</option>
index 3f3c28c..3528bf8 100644 (file)
@@ -514,6 +514,21 @@ function buildRecordGrid(type) {
     }
 }
 
+function vlDeleteQueue(type, queueId, onload) {
+    fieldmapper.standardRequest(
+        ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.delete'],
+        {   async: true,
+            params: [authtoken, queueId],
+            oncomplete: function(r) {
+                var resp = r.recv().content();
+                if(e = openils.Event.parse(resp))
+                    return alert(e);
+                onload();
+            }
+        }
+    );
+}
+
 
 function vlQueueGridDrawSelectBox(rowIdx) {
     var data = this.grid.model.getRow(rowIdx);