From a971ff46a109d751747ca2f1a95af13bad9b7929 Mon Sep 17 00:00:00 2001 From: senator Date: Sun, 12 Sep 2010 19:03:01 +0000 Subject: [PATCH] Serials: dojo/autogrid-based scaffolding for building serials objects Accessible from the staff client OPAC browser's "Actions for this Record" menu as "Alternate Serial Control", these minimalist interfaces should support a workflow by which the user can create a subscription and its related parts (distributions, streams, etc), and get things going in a quick and dirty way while the existing Serial Control View continues to develop. Some notable differences in orientation between this and the existing interface work include: - The disuse of call numbers on distributions, instead favoring call number application to items by issuance at receive time (i.e., all copies of the Sep 2010 issue of Popular Mechanics share a call number rather than all copies of Popular Mechanics, any issue, at a given library sharing a call number). - Lack of attention to binding (although the batch receive interface will treat each item as a single bound unit, for barcoding, or will avoid creating units altogether if you don't want to barcode your serials). If this doesn't sound like the way you would do serials, I'd definitely recommend sticking with Serials Control View and ignoring these interfaces. Dan Wells' interface work promises broader functionality in the long run. git-svn-id: svn://svn.open-ils.org/ILS/trunk@17615 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/examples/fm_IDL.xml | 38 +++- Open-ILS/web/css/skin/default.css | 1 + Open-ILS/web/css/skin/default/serial.css | 23 +++ Open-ILS/web/js/dojo/openils/XUL.js | 21 +++ Open-ILS/web/js/ui/default/serial/list_stream.js | 72 +++++++ .../web/js/ui/default/serial/list_subscription.js | 46 +++++ Open-ILS/web/js/ui/default/serial/subscription.js | 152 +++++++++++++++ .../serial/subscription/caption_and_pattern.js | 209 +++++++++++++++++++++ .../js/ui/default/serial/subscription/issuance.js | 76 ++++++++ Open-ILS/web/opac/locale/en-US/lang.dtd | 2 + .../web/templates/default/serial/list_stream.tt2 | 73 +++++++ .../templates/default/serial/list_subscription.tt2 | 59 ++++++ .../web/templates/default/serial/subscription.tt2 | 130 +++++++++++++ .../serial/subscription/caption_and_pattern.tt2 | 52 +++++ .../default/serial/subscription/distribution.tt2 | 33 ++++ .../default/serial/subscription/issuance.tt2 | 78 ++++++++ .../xul/staff_client/chrome/content/cat/opac.js | 55 +++--- .../xul/staff_client/chrome/content/cat/opac.xul | 3 +- .../chrome/locale/en-US/offline.properties | 1 + .../staff_client/server/serial/batch_receive.js | 18 +- .../server/serial/pattern_wizard_overlay.xul | 4 +- 21 files changed, 1107 insertions(+), 39 deletions(-) create mode 100644 Open-ILS/web/css/skin/default/serial.css create mode 100644 Open-ILS/web/js/ui/default/serial/list_stream.js create mode 100644 Open-ILS/web/js/ui/default/serial/list_subscription.js create mode 100644 Open-ILS/web/js/ui/default/serial/subscription.js create mode 100644 Open-ILS/web/js/ui/default/serial/subscription/caption_and_pattern.js create mode 100644 Open-ILS/web/js/ui/default/serial/subscription/issuance.js create mode 100644 Open-ILS/web/templates/default/serial/list_stream.tt2 create mode 100644 Open-ILS/web/templates/default/serial/list_subscription.tt2 create mode 100644 Open-ILS/web/templates/default/serial/subscription.tt2 create mode 100644 Open-ILS/web/templates/default/serial/subscription/caption_and_pattern.tt2 create mode 100644 Open-ILS/web/templates/default/serial/subscription/distribution.tt2 create mode 100644 Open-ILS/web/templates/default/serial/subscription/issuance.tt2 diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index d15cda05f..eca8ba3e1 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -3170,12 +3170,24 @@ SELECT usr, + + + + + + + + + + + + - + @@ -3197,7 +3209,7 @@ SELECT usr, - + @@ -3227,7 +3239,7 @@ SELECT usr, - + @@ -3257,10 +3269,10 @@ SELECT usr, - - - - + + + + @@ -3299,6 +3311,18 @@ SELECT usr, + + + + + + + + + + + + diff --git a/Open-ILS/web/css/skin/default.css b/Open-ILS/web/css/skin/default.css index 5ea73e971..a7ab2d6b6 100644 --- a/Open-ILS/web/css/skin/default.css +++ b/Open-ILS/web/css/skin/default.css @@ -1,6 +1,7 @@ /* import the default css for the install applications */ @import "default/acq.css"; @import "default/admin.css"; +@import "default/serial.css"; /* import the dojo CSS */ @import "/js/dojo/dojo/resources/dojo.css"; @import "/js/dojo/dijit/themes/tundra/tundra.css"; diff --git a/Open-ILS/web/css/skin/default/serial.css b/Open-ILS/web/css/skin/default/serial.css new file mode 100644 index 000000000..832225294 --- /dev/null +++ b/Open-ILS/web/css/skin/default/serial.css @@ -0,0 +1,23 @@ +.oils-serial-header { margin-bottom: 20px; } +.oils-serial-tab-container { height: 600px; } +.lesser { margin-top: 2px !important } +.lesser div:first-child { font-size: 110% !important; } +.lesser div:last-child { margin-right: 16px; } +#scap_editor th { + font-weight: bold; + background-color: #ccc; + padding: 2px 8px; +} +#scap_editor td { padding: 2px 8px; } +#scap_editor tr[changed="true"] td { background-color: #fc9; } +#scap_editor [name="remover"] button { color: red; font-weight: bold; } +#scap_editor tfoot td { text-align: center; padding-top: 24px; } +#scap_editor td[name] { text-align: center; } +.serial-dialog-table tr > * { padding-bottom: 1em; } +.serial-dialog-table th { text-align: left; padding-right: 1em; } +.serial-dialog-table tr:last-child td { text-align: center; } +.serial-additional-controls { + text-align: right; + margin-right: 16px; + padding: 8px 0; +} diff --git a/Open-ILS/web/js/dojo/openils/XUL.js b/Open-ILS/web/js/dojo/openils/XUL.js index 6c26acd5e..692097ee2 100644 --- a/Open-ILS/web/js/dojo/openils/XUL.js +++ b/Open-ILS/web/js/dojo/openils/XUL.js @@ -33,6 +33,27 @@ if(!dojo._hasResource["openils.XUL"]) { xulG.new_tab(path, tabInfo, options); } + openils.XUL.newTabEasy = function(url, tab_name, extra_content_params) { + var content_params = { + "session": openils.User.authtoken, + "authtime": openils.User.authtime + }; + + ["url_prefix", "new_tab", "set_tab", "close_tab", "new_patron_tab", + "set_patron_tab", "volume_item_creator", "get_new_session", + "holdings_maintenance_tab", "set_tab_name", "open_chrome_window", + "url_prefix", "network_meter", "page_meter", "set_statusbar", + "set_help_context" + ].forEach(function(k) { content_params[k] = xulG[k]; }); + + if (extra_content_params) + dojo.mixin(content_params, extra_content_params); + + xulG.new_tab( + xulG.url_prefix(url), {"tab_name": tab_name}, content_params + ); + }; + /** * @return bool True if a new session was successfully created, false otherwise. */ diff --git a/Open-ILS/web/js/ui/default/serial/list_stream.js b/Open-ILS/web/js/ui/default/serial/list_stream.js new file mode 100644 index 000000000..e61127a92 --- /dev/null +++ b/Open-ILS/web/js/ui/default/serial/list_stream.js @@ -0,0 +1,72 @@ +dojo.require("dijit.form.Button"); +dojo.require("dijit.form.NumberSpinner"); +dojo.require("dijit.form.TextBox"); +dojo.require("openils.widget.AutoGrid"); +dojo.require("openils.widget.ProgressDialog"); +dojo.require("openils.PermaCrud"); + +var pcrud; + +function format_routing_label(routing_label) { + return routing_label ? routing_label : "[None]"; +} + +function load_sstr_grid() { + sstr_grid.overrideEditWidgets.distribution = + new dijit.form.TextBox({"disabled": true, "value": dist_id}); + + sstr_grid.resetStore(); + sstr_grid.loadAll( + {"order_by": {"ssub": "start_date DESC"}}, + {"distribution": dist_id} + ); +} + +function load_sdist_display() { + pcrud.retrieve( + "sdist", dist_id, { + "onresponse": function(r) { + if (r = openils.Util.readResponse(r)) { + dojo.byId("sdist_label_here").innerHTML = r.label(); + load_sdist_org_unit_display(r); + } + } + } + ); +} + +function load_sdist_org_unit_display(dist) { + dojo.byId("sdist_org_unit_name_here").innerHTML = + aou.findOrgUnit(dist.holding_lib()).name(); +} + +function create_many_streams(fields) { + var streams = []; + for (var i = 0; i < fields.quantity; i++) { + var stream = new sstr(); + stream.distribution(dist_id); + streams.push(stream); + } + + progress_dialog.show(true); + this.pcrud.create( + streams, { + "oncomplete": function(r, list) { + progress_dialog.hide(); + sstr_grid.refresh(); + }, + "onerror": function(r) { + progress_dialog.hide(); + alert("Error creating streams!"); /* XXX i18n */ + } + } + ); +} + +openils.Util.addOnLoad( + function() { + pcrud = new openils.PermaCrud(); + load_sdist_display(); + load_sstr_grid(); + } +); diff --git a/Open-ILS/web/js/ui/default/serial/list_subscription.js b/Open-ILS/web/js/ui/default/serial/list_subscription.js new file mode 100644 index 000000000..206b7309f --- /dev/null +++ b/Open-ILS/web/js/ui/default/serial/list_subscription.js @@ -0,0 +1,46 @@ +dojo.require("dijit.form.Button"); +dojo.require("openils.widget.AutoGrid"); +dojo.require("openils.widget.OrgUnitFilteringSelect"); +dojo.require("openils.BibTemplate"); + +function format_ssub_link(id) { + return "" + id + ""; +} + +function load_ssub_grid() { + ssub_grid.resetStore(); + ssub_grid.loadAll({"order_by": {"ssub": "start_date DESC"}}, terms); +} + +openils.Util.addOnLoad( + function() { + if (terms.record_entry) + new openils.BibTemplate({"record": terms.record_entry}).render(); + + /* This should be present even if terms.record_entry is undef */ + ssub_grid.overrideEditWidgets.record_entry = new dijit.form.TextBox( + {"value": terms.record_entry, "disabled": true} + ); + + new openils.User().buildPermOrgSelector( + "ADMIN_SERIAL_SUBSCRIPTION", + ssub_owner_select, + null, + function() { + dojo.connect( + ssub_owner_select, + "onChange", + function() { + terms.owning_lib = aou.orgNodeTrail( + aou.findOrgUnit(this.attr("value")), + true /* asId */ + ); + load_ssub_grid(); + } + ); + load_ssub_grid(); + } + ); + } +); diff --git a/Open-ILS/web/js/ui/default/serial/subscription.js b/Open-ILS/web/js/ui/default/serial/subscription.js new file mode 100644 index 000000000..3f1774942 --- /dev/null +++ b/Open-ILS/web/js/ui/default/serial/subscription.js @@ -0,0 +1,152 @@ +dojo.require("dijit.form.Button"); +dojo.require("dijit.form.RadioButton"); +dojo.require("dijit.form.FilteringSelect"); +dojo.require("dijit.form.DropDownButton"); +dojo.require("dijit.TooltipDialog"); +dojo.require("dijit.layout.TabContainer"); +dojo.require("dijit.layout.ContentPane"); +dojo.require("dojox.grid.DataGrid"); +dojo.require("openils.widget.AutoGrid"); +dojo.require("openils.widget.ProgressDialog"); +dojo.require("openils.PermaCrud"); + +var pcrud; +var sub; + +/* typing save: add {get,set}Value() to all HTML + + + + + + + + + +
+ +[% END %] diff --git a/Open-ILS/web/templates/default/serial/list_subscription.tt2 b/Open-ILS/web/templates/default/serial/list_subscription.tt2 new file mode 100644 index 000000000..788177930 --- /dev/null +++ b/Open-ILS/web/templates/default/serial/list_subscription.tt2 @@ -0,0 +1,59 @@ +[% WRAPPER default/base.tt2 %] +[% ctx.page_title = "Subscriptions" %] + + +
+
+
Subscriptions
+
+ + +
+
+
+ + Show subscriptions related to + + owned at or above: + + +
+ + + + + + +
+
+[% END %] diff --git a/Open-ILS/web/templates/default/serial/subscription.tt2 b/Open-ILS/web/templates/default/serial/subscription.tt2 new file mode 100644 index 000000000..24970adb8 --- /dev/null +++ b/Open-ILS/web/templates/default/serial/subscription.tt2 @@ -0,0 +1,130 @@ +[% WRAPPER "default/base.tt2" %] + + + + + +
+
Subscription Details
+
+ + Batch Item Receive + +
+
+ +
+ + +
+ + + + + + + + + + + + +
ID + Owning Library + + Start Date + + End Date + + Bibliographic Record + Expected Date Offset
+
+ + +
+ + [% INCLUDE "default/serial/subscription/distribution.tt2" %] +
+ + +
+ + [% INCLUDE "default/serial/subscription/caption_and_pattern.tt2" %] +
+ + +
+ + [% INCLUDE "default/serial/subscription/issuance.tt2" %] +
+
+ +[% END %] diff --git a/Open-ILS/web/templates/default/serial/subscription/caption_and_pattern.tt2 b/Open-ILS/web/templates/default/serial/subscription/caption_and_pattern.tt2 new file mode 100644 index 000000000..5510cdf7c --- /dev/null +++ b/Open-ILS/web/templates/default/serial/subscription/caption_and_pattern.tt2 @@ -0,0 +1,52 @@ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Open-ILS/web/templates/default/serial/subscription/distribution.tt2 b/Open-ILS/web/templates/default/serial/subscription/distribution.tt2 new file mode 100644 index 000000000..8ad3a61d0 --- /dev/null +++ b/Open-ILS/web/templates/default/serial/subscription/distribution.tt2 @@ -0,0 +1,33 @@ +
+
Distributions
+
+ Refresh Grid + New Distribution + Delete Selected +
+
+
+ + + + + + +
+
diff --git a/Open-ILS/web/templates/default/serial/subscription/issuance.tt2 b/Open-ILS/web/templates/default/serial/subscription/issuance.tt2 new file mode 100644 index 000000000..55cf75113 --- /dev/null +++ b/Open-ILS/web/templates/default/serial/subscription/issuance.tt2 @@ -0,0 +1,78 @@ +
+
Issuances
+
+ Refresh Grid + New Issuance + Delete Selected +
+
+
+ Generate Predictions +
+
+ +
+
+ diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index a23727d0c..b496f3935 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -303,6 +303,39 @@ function open_acq_orders() { } } +function open_alt_serial_mgmt() { + try { + var content_params = { + "session": ses(), + "authtime": ses("authtime"), + "show_nav_buttons": true, + "no_xulG": false, + "show_print_button": false + }; + + ["url_prefix", "new_tab", "set_tab", "close_tab", "new_patron_tab", + "set_patron_tab", "volume_item_creator", "get_new_session", + "holdings_maintenance_tab", "set_tab_name", "open_chrome_window", + "url_prefix", "network_meter", "page_meter", "set_statusbar", + "set_help_context" + ].forEach(function(k) { content_params[k] = xulG[k]; }); + + var loc = urls.XUL_BROWSER + "?url=" + window.escape( + xulG.url_prefix("/eg/serial/list_subscription/") + docid + ); + xulG.new_tab( + loc, { + "tab_name": $("offlineStrings").getString( + "staff.cat.opac.serial_alt_mgmt" + ), + "browser": false + }, content_params + ); + } catch (E) { + g.error.sdump("D_ERROR", E); + } +} + function set_opac() { g.view = 'opac'; try { @@ -539,28 +572,6 @@ function open_marc_editor(rec, label) { }; } -function serials_mgmt_new_tab() { - try { - /* XXX should the following be put into a function somewhere? the gist - * of this setting up of content_params seems to be duplicated all - * over the place. - */ - var content_params = {"session": ses(), "authtime": ses("authtime")}; - ["url_prefix", "new_tab", "set_tab", "close_tab", "new_patron_tab", - "set_patron_tab", "volume_item_creator", "get_new_session", - "holdings_maintenance_tab", "set_tab_name", "open_chrome_window", - "url_prefix", "network_meter", "page_meter", "set_statusbar", - "set_help_context" - ].forEach(function(k) { content_params[k] = xulG[k]; }); - - xulG.new_tab( - xulG.url_prefix(urls.XUL_SERIAL_RECORD_ENTRY), {}, content_params - ); - } catch (E) { - g.error.sdump('D_ERROR', E); - } -} - function bib_in_new_tab() { try { var url = browser_frame.contentWindow.g.browser.controller.view.browser_browser.contentWindow.wrappedJSObject.location.href; diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul b/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul index 0c9396f81..5197d89c8 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul @@ -73,7 +73,8 @@ - + + diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties index e7d042506..7fec403dd 100644 --- a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties +++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties @@ -261,6 +261,7 @@ staff.cat.opac.title_for_hold_transfer.destination_needed.label=Need to mark a r staff.cat.opac.title_for_hold_transfer.success.label=Holds transferred. staff.cat.opac.title_for_hold_transfer.failure.label=Holds not transferred. staff.cat.opac.related_items=Related Lineitems +staff.cat.opac.serial_alt_mgmt=Subscriptions staff.cat.create_or_rebarcode_items=Create or Re-barcode Items printing.nothing_to_reprint=Nothing to re-print printing.prompt_for_external_print_cmd=Enter external print command and parameters (use %receipt.txt% or %receipt.html% as the file containing the print data. Those values will be substituted with the proper path.): diff --git a/Open-ILS/xul/staff_client/server/serial/batch_receive.js b/Open-ILS/xul/staff_client/server/serial/batch_receive.js index b549683f6..3fbf35046 100644 --- a/Open-ILS/xul/staff_client/server/serial/batch_receive.js +++ b/Open-ILS/xul/staff_client/server/serial/batch_receive.js @@ -21,7 +21,7 @@ function F(k, args) { function BatchReceiver() { var self = this; - this.init = function(authtoken, bib_id) { + this.init = function(authtoken, bib_id, sub_id) { if (authtoken) { this.user = new openils.User({"authtoken": authtoken}); this.pcrud = new openils.PermaCrud({"authtoken": authtoken}); @@ -73,7 +73,7 @@ function BatchReceiver() { this.item_cache = {}; if (bib_id) - this.bib_lookup(bib_id, null, true); + this.bib_lookup(bib_id, null, true, sub_id); busy(false); }; @@ -453,7 +453,7 @@ function BatchReceiver() { } }; - this.bib_lookup = function(bib_search_term, evt, is_actual_id) { + this.bib_lookup = function(bib_search_term, evt, is_actual_id, sub_id) { if (evt && evt.keyCode != 13) return; if (!bib_search_term) { @@ -497,7 +497,7 @@ function BatchReceiver() { } else { self.bibdata = list[0]; self._show_bibdata_bits(); - self.choose_subscription(); + self.choose_subscription(sub_id); } } else { alert(S("bib_lookup.not_found")); @@ -513,7 +513,7 @@ function BatchReceiver() { ); }; - this.choose_subscription = function() { + this.choose_subscription = function(sub_id) { hide("batch_receive_bib"); hide("batch_receive_entry"); hide("batch_receive_sub_bits"); @@ -521,7 +521,11 @@ function BatchReceiver() { var subs = this.bibdata.bre.subscriptions(); - if (subs.length > 1) { + if (sub_id) { + this.choose_issuance( + subs.filter(function(o) { return o.id() == sub_id; })[0] + ); + } else if (subs.length > 1) { var menulist = dojo.create("menulist", {"id": "sub_chooser"}); var menupopup = dojo.create("menupopup", {}, menulist, "only"); @@ -912,6 +916,6 @@ function my_init() { batch_receiver = new BatchReceiver( (typeof ses == "function" ? ses() : 0) || cgi.param("ses") || dojo.cookie("ses"), - cgi.param("docid") || null + cgi.param("docid") || null, cgi.param("subid") || null ); } diff --git a/Open-ILS/xul/staff_client/server/serial/pattern_wizard_overlay.xul b/Open-ILS/xul/staff_client/server/serial/pattern_wizard_overlay.xul index 47a86050d..141bbb336 100644 --- a/Open-ILS/xul/staff_client/server/serial/pattern_wizard_overlay.xul +++ b/Open-ILS/xul/staff_client/server/serial/pattern_wizard_overlay.xul @@ -157,8 +157,8 @@ label="Use chronology captions?" /> - Generally, each caption should be a smaller unit of - time than the preceding caption. + Each caption must be a smaller unit of + time than the preceding caption. -- 2.11.0