context menus
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 15 Jul 2005 12:29:35 +0000 (12:29 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 15 Jul 2005 12:29:35 +0000 (12:29 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1197 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/circ/circ_utils.js
Evergreen/staff_client/chrome/content/evergreen/patron/patron_display.js
Evergreen/staff_client/chrome/locale/en-US/evergreen/OpenILS.properties

index fda43fd..0c40ed1 100644 (file)
@@ -8,7 +8,7 @@ function checkin_by_copy_barcode(barcode) {
                        'open-ils.circ.checkin.barcode',
                        [ mw.G.auth_ses[0], barcode ]
                )[0];
-               sdump('D_CIRC_UTILS','check = ' + check + '\n');
+               sdump('D_CIRC_UTILS','check = ' + js2JSON(check) + '\n');
                return check;
        } catch(E) {
                sdump('D_ERROR',E);
@@ -16,6 +16,21 @@ function checkin_by_copy_barcode(barcode) {
        }
 }
 
+function renew_by_circ_id(id) {
+       sdump('D_CIRC_UTILS',arg_dump(arguments,{0:true}));
+       try {
+               var check = user_request(
+                       'open-ils.circ',
+                       'open-ils.circ.renew',
+                       [ mw.G.auth_ses[0], id ]
+               )[0];
+               sdump('D_CIRC_UTILS','check = ' + js2JSON(check) + '\n');
+               return check;
+       } catch(E) {
+               sdump('D_ERROR',E);
+               return null;
+       }
+}
 
 function circ_cols() {
        return  [
index f15683f..34ceafa 100755 (executable)
@@ -115,19 +115,40 @@ function patron_display_patron_items_init(p) {
                        var patron_items = get_list_from_tree_selection( p.patron_items.paged_tree.tree );
                        var menuitem;
 
+                       /*** RENEW ***/
+                       menuitem = p.patron_items.paged_tree.w.document.createElement('menuitem');
+                       p.patron_items.paged_tree.popup.appendChild( menuitem );
+                       menuitem.setAttribute('label',getString('circ.context_renew'));
+                       menuitem.addEventListener(
+                               'command',
+                               function (ev) {
+                                       sdump('D_PATRON_DISPLAY','Firing renew context\n');
+                                       for (var i = 0; i < patron_items.length; i++) {
+                                               try {
+                                                       var idx = patron_items[i].getAttribute('record_id'); 
+                                                       var circ = p._patron.checkouts()[ idx ].circ;
+                                                       alert( js2JSON(renew_by_circ_id( circ.id() )) );
+                                               } catch(E) {
+                                                       alert(E);
+                                               }
+                                       }
+                               },
+                               false
+                       );
+
                        /*** CHECKIN ***/
                        menuitem = p.patron_items.paged_tree.w.document.createElement('menuitem');
                        p.patron_items.paged_tree.popup.appendChild( menuitem );
-                       menuitem.setAttribute('label',getString('circ.check_in'));
+                       menuitem.setAttribute('label',getString('circ.context_checkin'));
                        menuitem.addEventListener(
                                'command',
                                function (ev) {
-                                       sdump('D_PATRON_DISPLAY','Firing check-in context\n');
+                                       sdump('D_PATRON_DISPLAY','Firing checkin context\n');
                                        for (var i = 0; i < patron_items.length; i++) {
                                                try {
                                                        var idx = patron_items[i].getAttribute('record_id'); 
                                                        var copy = p._patron.checkouts()[ idx ].copy;
-                                                       alert( checkin_by_copy_barcode( copy.barcode() ) );
+                                                       alert( js2JSON(checkin_by_copy_barcode( copy.barcode() )) );
                                                } catch(E) {
                                                        alert(E);
                                                }
@@ -136,22 +157,34 @@ function patron_display_patron_items_init(p) {
                                false
                        );
 
+                       /* separator */
+                       menuitem = p.patron_items.paged_tree.w.document.createElement('menuseparator');
+                       p.patron_items.paged_tree.popup.appendChild( menuitem );
+                       
+
+                       /*** COPY EDITOR ***/
+                       menuitem = p.patron_items.paged_tree.w.document.createElement('menuitem');
+                       p.patron_items.paged_tree.popup.appendChild( menuitem );
+                       menuitem.setAttribute('label',getString('circ.context_edit'));
+                       menuitem.addEventListener(
+                               'command',
+                               function (ev) {
+                                       for (var i = 0; i < patron_items.length; i++) {
+                                               sdump('D_PATRON_DISPLAY','Firing copy edit context\n');
+                                       }
+                               },
+                               false
+                       );
+
                        /*** OPAC ***/
                        menuitem = p.patron_items.paged_tree.w.document.createElement('menuitem');
                        p.patron_items.paged_tree.popup.appendChild( menuitem );
-                       menuitem.setAttribute('label','Open in OPAC');
+                       menuitem.setAttribute('label',getString('circ.context_opac'));
                        menuitem.addEventListener(
                                'command',
                                function (ev) {
                                        for (var i = 0; i < patron_items.length; i++) {
-                                               spawn_patron_items.display(
-                                                       p.w.app_shell,'new_tab','main_tabbox', 
-                                                       { 
-                                                               'circ' : retrieve_circ_by_id( 
-                                                                       patron_items[i].getAttribute('record_id') 
-                                                               )
-                                                       }
-                                               );
+                                               sdump('D_PATRON_DISPLAY','Firing opac context\n');
                                        }
                                },
                                false
index 4657f1a..4ff7e0f 100644 (file)
@@ -22,7 +22,10 @@ xuleditor_label=XUL TEST
 filter_console_label=FCONSOLE
 
 retrieving.record=Retrieving...
-circ.check_in=Check In
+circ.context_checkin=Check In
+circ.context_renew=Renew
+circ.context_opac=Show Title in OPAC
+circ.context_editor=Edit Copy
 
 au_label_id=Record ID
 au_label_prefix=Prefix