From: erickson Date: Wed, 20 Jul 2005 16:32:16 +0000 (+0000) Subject: more web work X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ba1d3f4aef475118ce6ad040df881870e94fa54a;p=Evergreen.git more web work added classes to web fieldmapper updated method.pm to use the right param names (in case it's ever used again) git-svn-id: svn://svn.open-ils.org/ILS/trunk@1312 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/extras/fieldmapper.pl b/Open-ILS/src/extras/fieldmapper.pl index 72b55ae944..f8dbca05d4 100755 --- a/Open-ILS/src/extras/fieldmapper.pl +++ b/Open-ILS/src/extras/fieldmapper.pl @@ -10,7 +10,7 @@ my $web = $ARGV[0]; # List of classes needed by the opac my @web_hints = qw/ex mvr au aou aout asv asva asvr asvq circ acp acpl acn ccs perm_ex ahn ahr aua ac - actscecm crcd crmf crrf mus mbts/; + actscecm crcd crmf crrf mus mbts aoc aus/; print <{$object}->{fields}}) { my $position = $map->{$object}->{fields}->{$field}->{position}; print < 0) renewboxlink = buildRenewBoxLink(circ); @@ -196,8 +165,8 @@ function _drawCheckedOut(obj, data) { org = org.name(); /* for each circulation, build a row of data */ - var titleCell = circRow.insertCell(circRow.cells.length); var dueCell = circRow.insertCell(circRow.cells.length); + var titleCell = circRow.insertCell(circRow.cells.length); var durationCell = circRow.insertCell(circRow.cells.length); var barcodeCell = circRow.insertCell(circRow.cells.length); var circLibCell = circRow.insertCell(circRow.cells.length); @@ -247,9 +216,7 @@ function renewCheckout(circ) { globalmyopac.user.session_id, circ ); req.send(true); - try{var ret = req.getResultObject();}catch(E){return;} - - //alert(js2JSON(ret)); + try{req.getResultObject();}catch(E){return;} alert("Renewal completed successfully"); globalmyopac.draw("checked"); } @@ -710,6 +677,10 @@ MyOPACSPage.prototype._drawHolds = function() { var cell = row.insertCell(row.cells.length); add_css_class(cell, "my_opac_info_table_header"); + cell.appendChild(mktext("Request Date")); + + cell = row.insertCell(row.cells.length); + add_css_class(cell, "my_opac_info_table_header"); cell.appendChild(mktext("Title")); cell = row.insertCell(row.cells.length); @@ -720,13 +691,18 @@ MyOPACSPage.prototype._drawHolds = function() { add_css_class(cell, "my_opac_info_table_header"); cell.appendChild(mktext("Format(s)")); + cell = row.insertCell(row.cells.length); add_css_class(cell, "my_opac_info_table_header"); - cell.appendChild(mktext("Pickup Location")); + cell.appendChild(mktext("Notify Email / Phone")); cell = row.insertCell(row.cells.length); add_css_class(cell, "my_opac_info_table_header"); - cell.appendChild(mktext("Notify Email / Phone")); + cell.appendChild(mktext("Status")); + + cell = row.insertCell(row.cells.length); + add_css_class(cell, "my_opac_info_table_header"); + cell.appendChild(mktext("Pickup Location")); cell = row.insertCell(row.cells.length); add_css_class(cell, "my_opac_info_table_header"); @@ -734,18 +710,27 @@ MyOPACSPage.prototype._drawHolds = function() { /* ---------------------------------------- */ row = table.insertRow(table.rows.length); + row.id = "holds_waiting"; cell = row.insertCell(row.cells.length); cell.appendChild(mktext("Retrieving holds...")); /* ---------------------------------------- */ var holds = this.grabHolds(); - table.firstChild.removeChild(table.firstChild.childNodes[1]); for( var idx = 0; idx != holds.length; idx++ ) { - debug("Displaying hold " + holds[idx].id()); - _doCallbackDance(table, holds[idx], this.user.session_id, this); + var hold = holds[idx]; + var r = table.insertRow(table.rows.length); + r.id = "hold_display_row_" + hold.id(); + debug("Displaying hold " + hold.id()); + _doCallbackDance(table, hold, this.user.session_id, this); + } + + if(!holds || holds.length == 0) { + var z = getById("holds_waiting"); + z.firstChild.innerHTML = "No holds currently placed"; } + } function _doCallbackDance(table, hold, session_id, obj) { @@ -767,9 +752,16 @@ function _drawHoldsRow(table, hold, record, session_id, obj) { if(record == null || record.length == 0) return; debug("In holds callback with hold " + hold ); - var row = table.insertRow(table.rows.length); + //var row = table.insertRow(table.rows.length); + var row = getById("hold_display_row_" + hold.id()); + var cell = row.insertCell(row.cells.length); + add_css_class(cell, "my_opac_profile_cell"); + var t = hold.request_time().replace(/[0-9][0-9]:.*$/,""); + cell.appendChild(mktext(t)); + + cell = row.insertCell(row.cells.length); add_css_class(cell, "my_opac_profile_cell"); cell.style.width = "35%"; @@ -778,7 +770,6 @@ function _drawHoldsRow(table, hold, record, session_id, obj) { {href:prefix + "?sub_frame=1&target=record_detail&record="+encodeURIComponent(record.doc_id())}, null, record.title()); tl.setAttribute("target","_top"); - //cell.appendChild(mktext(record.title())); cell.appendChild(tl); cell = row.insertCell(row.cells.length); @@ -790,7 +781,6 @@ function _drawHoldsRow(table, hold, record, session_id, obj) { al.setAttribute("target","_top"); add_css_class(cell, "my_opac_profile_cell"); - //cell.appendChild(mktext(record.author())); cell.appendChild(al); cell = row.insertCell(row.cells.length); @@ -804,9 +794,6 @@ function _drawHoldsRow(table, hold, record, session_id, obj) { cell.noWrap = "nowrap"; cell.setAttribute("nowrap", "nowrap"); - cell = row.insertCell(row.cells.length); - add_css_class(cell, "my_opac_profile_cell"); - cell.appendChild(mktext(findOrgUnit(hold.pickup_lib()).name())); cell = row.insertCell(row.cells.length); add_css_class(cell, "my_opac_profile_cell"); @@ -815,11 +802,37 @@ function _drawHoldsRow(table, hold, record, session_id, obj) { cell.appendChild(_buildChangePhoneNotify(hold)); cell = row.insertCell(row.cells.length); + add_css_class(cell, "my_opac_profile_cell"); + var stat = _fetchHoldStatus(hold); + cell.appendChild(mktext(stat)); + + cell = row.insertCell(row.cells.length); + add_css_class(cell, "my_opac_profile_cell"); + cell.appendChild(mktext(findOrgUnit(hold.pickup_lib()).name())); + + cell = row.insertCell(row.cells.length); var a = elem("a",{href:"javascript:void(0);", style:"text-decoration:underline"},null, "Cancel"); a.onclick = function(){_cancelHoldRequest(hold, a, session_id, obj);}; add_css_class(cell, "my_opac_profile_cell"); cell.appendChild(a); + + var z = getById("holds_waiting"); + if(z) table.firstChild.removeChild(z); +} + +function _fetchHoldStatus(hold) { + var req = new RemoteRequest( + "open-ils.circ", + "open-ils.circ.hold.status.retrieve", + globalmyopac.user.session_id, hold.id()); + req.send(true); + var stat = req.getResultObject(); + if(stat == "1") stat = "Waiting for available copy"; + if(stat == "2") stat = "Copy found, waiting for capture"; + if(stat == "3") stat = "In Transit"; + if(stat == "4") stat = "Available"; + return stat; } @@ -1296,9 +1309,8 @@ MyOPACSPage.prototype._addCircs = function(data) { /* for each circulation, build a small table of data */ var table = createAppElement("table"); - this._mkCircRow(table, "Title", title_href); - //this._mkCircRow(table, "Due Date", mktext(due)); this._mkCircRow(table, "Due Date", mktext(due)); + this._mkCircRow(table, "Title", title_href); this._mkCircRow(table, "Duration", mktext(circ.duration())); this._mkCircRow(table, "Barcode", mktext(copy.barcode())); this._mkCircRow(table, "Circulating Library", mktext(org)); @@ -1332,4 +1344,189 @@ MyOPACSPage.prototype._getOrgUnit = function(org_id) { } +var showTransactions = false; +MyOPACSPage.prototype._drawFines = function() { + this.drawFinesSummary(); + this.infoPane.appendChild(elem("hr")); + this.infoPane.appendChild(elem("br")); + if(showTransactions) this.drawTransactions(); +} + + +MyOPACSPage.prototype.drawFinesSummary = function() { + + var bigt = this.infoTable; + var table = elem("table"); + bigt.insertRow(0).insertCell(0).appendChild(table); + + var title = table.insertRow(table.rows.length); + var tcell = title.insertCell(0); + tcell.setAttribute("style", "font-weight: bolder"); + tcell.appendChild(mktext("Fines Summary")); + + var torow = table.insertRow(table.rows.length); + var tprow = table.insertRow(table.rows.length); + var borow = table.insertRow(table.rows.length); + + var to = torow.insertCell(torow.cells.length); + var tp = tprow.insertCell(tprow.cells.length); + var bo = borow.insertCell(borow.cells.length); + + add_css_class(to, "my_opac_info_table_header"); + add_css_class(tp, "my_opac_info_table_header"); + add_css_class(bo, "my_opac_info_table_header"); + + to.appendChild(mktext("Total Amount Owed")); + tp.appendChild(mktext("Total Amoun Paid")); + bo.appendChild(mktext("* Balance Owed")); + + to = torow.insertCell(torow.cells.length); + tp = tprow.insertCell(tprow.cells.length); + bo = borow.insertCell(borow.cells.length); + + add_css_class(to, "my_opac_profile_cell"); + add_css_class(tp, "my_opac_profile_cell"); + add_css_class(bo, "my_opac_profile_cell"); + + var summary = grabUserFinesSummary( + globalmyopac.user.session_id, globalmyopac.user.userObject.id()); + + var owed; + var paid; + var bowed; + + if(instanceOf(summary, mus)) { + showTransactions = true; + owed = _finesFormatNumber(summary.total_owed()); + paid = _finesFormatNumber(summary.total_paid()); + bowed = _finesFormatNumber(summary.balance_owed()); + + } else { + showTransactions = false; + owed = _finesFormatNumber("0.00"); + paid = _finesFormatNumber("0.00"); + bowed = _finesFormatNumber("0.00"); + } + + to.appendChild(mktext(owed)); + tp.appendChild(mktext(paid)); + bo.appendChild(mktext(bowed)); + +} + +function _finesFormatNumber(num) { + if(num.length == "1" || !num.match(/\./)) num += ".00"; + num = "$" + num; + return num; +} + + +MyOPACSPage.prototype.drawTransactions = function() { + var table = elem("table"); + var d = elem("div", {style:"font-weight: bolder"}, null, "Summary of Charges"); + this.infoPane.appendChild(d); + this.infoPane.appendChild(table); + + var row = table.insertRow(table.rows.length); + + var cella = row.insertCell(row.cells.length); + var cellb = row.insertCell(row.cells.length); + var cellc = row.insertCell(row.cells.length); + var celld = row.insertCell(row.cells.length); + var celle = row.insertCell(row.cells.length); + var cellf = row.insertCell(row.cells.length); + var cellg = row.insertCell(row.cells.length); + + add_css_class(cella, "my_opac_info_table_header"); + add_css_class(cellb, "my_opac_info_table_header"); + add_css_class(cellc, "my_opac_info_table_header"); + add_css_class(celld, "my_opac_info_table_header"); + add_css_class(celle, "my_opac_info_table_header"); + add_css_class(cellf, "my_opac_info_table_header"); + add_css_class(cellg, "my_opac_info_table_header"); + + cella.appendChild(mktext("Transaction Start Time")); + cellb.appendChild(mktext("Last Billing Time")); + cellc.appendChild(mktext("Last Payment Time")); + celld.appendChild(mktext("Initial Amount Owed")); + celle.appendChild(mktext("Total Amount Paid")); + cellf.appendChild(mktext("* Balance Owed")); + cellg.appendChild(mktext("Type")); + + var transactions = grabUserTransactions( + globalmyopac.user.session_id, globalmyopac.user.userObject.id()); + + for( var t in transactions ) _addTransactionRow(table, transactions[t]); + +} + + +function _addTransactionRow(table, transaction) { + + var trans = transaction.transaction; + var circ = transaction.circ; + var record = transaction.record; + + var row = table.insertRow(table.rows.length); + var cella = row.insertCell(row.cells.length); + var cellb = row.insertCell(row.cells.length); + var cellc = row.insertCell(row.cells.length); + var celld = row.insertCell(row.cells.length); + var celle = row.insertCell(row.cells.length); + var cellf = row.insertCell(row.cells.length); + var cellg = row.insertCell(row.cells.length); + + add_css_class(cella, "my_opac_profile_cell"); + add_css_class(cellb, "my_opac_profile_cell"); + add_css_class(cellc, "my_opac_profile_cell"); + add_css_class(celld, "my_opac_profile_cell"); + add_css_class(celle, "my_opac_profile_cell"); + add_css_class(cellf, "my_opac_profile_cell"); + add_css_class(cellg, "my_opac_profile_cell"); + + var owed = _finesFormatNumber(trans.total_owed()); + var paid = _finesFormatNumber(trans.total_paid()); + var bowed = _finesFormatNumber(trans.balance_owed()); + + var stime = _trimSeconds(trans.xact_start()); + var last_bill = _trimSeconds(trans.last_billing_ts()); + var last_payment = _trimSeconds(trans.last_payment_ts()); + + cella.appendChild(mktext(stime)); + cellb.appendChild(mktext(last_bill)); + cellc.appendChild(mktext(last_payment)); + celld.appendChild(mktext(owed)); + celle.appendChild(mktext(paid)); + cellf.appendChild(mktext(bowed)); + cellg.appendChild(mktext(trans.xact_type())); + + +} + +function _trimSeconds(time) { if(!time) return ""; return time.replace(/\..*/,""); } + +function grabUserTransactions(session, usrid) { + var req = new RemoteRequest( + "open-ils.actor", + "open-ils.actor.user.transactions.have_charge.fleshed", + session, usrid ); + req.send(true); + return req.getResultObject(); +} + + +function grabUserFinesSummary(session, usrid) { + var req = new RemoteRequest( + "open-ils.actor", + "open-ils.actor.user.fines.summary", + session, usrid ); + req.send(true); + return req.getResultObject(); +} + + + + + + diff --git a/Open-ILS/src/javascript/opac/Page.js b/Open-ILS/src/javascript/opac/Page.js index 07eb0d8cf4..377713886f 100644 --- a/Open-ILS/src/javascript/opac/Page.js +++ b/Open-ILS/src/javascript/opac/Page.js @@ -136,6 +136,7 @@ Page.prototype.resetRange = function() { "mr_search_query", lastSearchString, "mr_search_location", location, "mr_search_depth", globalSearchDepth, + "format", paramObj.__format, "page", 0 ] ); } @@ -211,8 +212,10 @@ Page.prototype.buildNavBox = function(full) { arr.push(elem("a", {href: prefix + '?target=advanced_search'}, null, "Advanced Search")); - var mylink = elem("a", {href: "?target=my_opac"}, null, "My OPAC"); - arr.push(mylink); + if(!isXUL()) { + var mylink = elem("a", {href: "?target=my_opac"}, null, "My OPAC"); + arr.push(mylink); + } /* if user is not logged in, popup the login dialog when they select the myopac link */ diff --git a/Open-ILS/src/javascript/opac/RecordResultPage.js b/Open-ILS/src/javascript/opac/RecordResultPage.js index 33fa4d075d..478156fa83 100644 --- a/Open-ILS/src/javascript/opac/RecordResultPage.js +++ b/Open-ILS/src/javascript/opac/RecordResultPage.js @@ -210,7 +210,7 @@ RecordResultPage.prototype.doSearch = function() { if(recordResultRedirect) { /* if the user is just hitting the 'back' button */ recordResultRedirect = false; - history.back(); + history.go(-1); return; } @@ -355,13 +355,14 @@ RecordResultPage.prototype.mrSearch = function(mrid) { recordResultRedirect = true; debug("Redirecting to record detail page with record " + obj.recordIDs[0] ); url_redirect( [ + "goto", "-2", "target", "record_detail", "record", obj.recordIDs[0] ] ); return; } } else { recordResultRedirect = false; - history.back(); + history.go(-1); } obj.collectRecords(); diff --git a/Open-ILS/src/javascript/opac/SearchBarFormChunk.js b/Open-ILS/src/javascript/opac/SearchBarFormChunk.js index 82f9b27d76..6b2d752f2c 100644 --- a/Open-ILS/src/javascript/opac/SearchBarFormChunk.js +++ b/Open-ILS/src/javascript/opac/SearchBarFormChunk.js @@ -14,7 +14,6 @@ SearchBarFormChunk.prototype.init = function() { this.search_query = getById("mr_search_query"); this.search_type = getById("mr_search_type"); this.search_button = getById("mr_search_button"); - this.searchRange = getById("search_range_select"); this.setFormat(); } @@ -37,7 +36,6 @@ SearchBarFormChunk.prototype.resetPage = function() { this.init(); this.search_button.onclick = mrSearchSubmitForm; - this.search_query.onkeydown = mrSearchSubmitOnEnter; this.search_type.onkeydown = mrSearchSubmitOnEnter; @@ -50,8 +48,6 @@ SearchBarFormChunk.prototype.resetPage = function() { try{ this.search_query.focus(); } catch(E) {} -// this.resetRange(); - } @@ -62,11 +58,8 @@ function mrSearchSubmitForm() { var search_type = getById("mr_search_type").value; var form = getById("mr_search_format").value - /* - var fsel = getById("mr_search_format"); - var form = fsel.options[fsel.selectedIndex].value - */ - + if(search_query == null || search_query == "") + return false; var depth = globalSearchDepth; var location = globalSelectedLocation; diff --git a/Open-ILS/src/javascript/util/ils_utils.js b/Open-ILS/src/javascript/util/ils_utils.js index 0d0b6b65b9..478b081a03 100644 --- a/Open-ILS/src/javascript/util/ils_utils.js +++ b/Open-ILS/src/javascript/util/ils_utils.js @@ -337,14 +337,15 @@ function cleanISBN(isbn) { } -function grabUserByBarcode(barcode) { +function grabUserByBarcode(login, barcode) { if(!barcode) return null; var req = new RemoteRequest( "open-ils.actor", "open-ils.actor.user.fleshed.retrieve_by_barcode", - barcode ); + login, barcode ); - return req.send(true).getResultObject(); + req.send(true); + return req.getResultObject(); } diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/Method.pm b/Open-ILS/src/perlmods/OpenILS/WWW/Method.pm index c870432e30..5d8678ab41 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/Method.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/Method.pm @@ -56,8 +56,8 @@ sub handler { warn "here\n"; - if(defined($cgi->param("__param"))) { - for my $param ( $cgi->param("__param")) { + if(defined($cgi->param("param"))) { + for my $param ( $cgi->param("param")) { push( @param_array, JSON->JSON2perl( $param )); } } else { diff --git a/Open-ILS/src/templates/opac/pages/main.ttk b/Open-ILS/src/templates/opac/pages/main.ttk index 1fe4a22eaa..5ce1ad7ac3 100644 --- a/Open-ILS/src/templates/opac/pages/main.ttk +++ b/Open-ILS/src/templates/opac/pages/main.ttk @@ -15,7 +15,7 @@