[open-ils-commits] r19272 - in trunk/Open-ILS: web/css/skin/default web/js/dojo/openils web/js/ui/default/serial/subscription xul/staff_client/server/serial xul/staff_client/server/skin (senator)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Jan 24 17:15:02 EST 2011
Author: senator
Date: 2011-01-24 17:14:57 -0500 (Mon, 24 Jan 2011)
New Revision: 19272
Modified:
trunk/Open-ILS/web/css/skin/default/serial.css
trunk/Open-ILS/web/js/dojo/openils/Util.js
trunk/Open-ILS/web/js/ui/default/serial/subscription/caption_and_pattern.js
trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard.js
trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard.xul
trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard_overlay.xul
trunk/Open-ILS/xul/staff_client/server/serial/scap_editor.js
trunk/Open-ILS/xul/staff_client/server/skin/serial.css
Log:
Serials: A batch of improvements to the caption/pattern wizard
- Using a numeric frequency ($w) now pre-selects the regularity page
- Switch the regularity page from a box layout to a grid layout for legibility
- Simplify and unify month/date control pairs, enforcing correct limits
on days in each month
- Scrollbars!
- If the user creates $y data in the regularity page, but then unchecks the
"use specific regularity information" box, the $y stuff will be correctly
excluded from the compiled pattern code.
- "Display in Holding Field" replaced with text that better explains what it
means
- The wizard's dialog window has a title now
- In alternate serials control -> subscription details -> captions/patterns tab,
if the user has already typed something in the Pattern Code field, they
now get a warning that using the wizard will erase their existing work
if they click the Wizard button
- The captions/pattern tab now treats pattern codes as immutable once created,
which is what was apparently intended from the beginning. See
http://list.georgialibraries.org/pipermail/open-ils-dev/2010-May/006079.html
Modified: trunk/Open-ILS/web/css/skin/default/serial.css
===================================================================
--- trunk/Open-ILS/web/css/skin/default/serial.css 2011-01-24 21:38:14 UTC (rev 19271)
+++ trunk/Open-ILS/web/css/skin/default/serial.css 2011-01-24 22:14:57 UTC (rev 19272)
@@ -25,3 +25,4 @@
.serial-holding-code tr { border: 0 !important; margin: 0 !important; }
.serial-holding-code td { border: 0 !important; padding: 3px; margin: 0 !important; }
.serial-holding-code td[colspan="2"] { text-align:center; }
+input[readonly] { color: #999; }
Modified: trunk/Open-ILS/web/js/dojo/openils/Util.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/Util.js 2011-01-24 21:38:14 UTC (rev 19271)
+++ trunk/Open-ILS/web/js/dojo/openils/Util.js 2011-01-24 22:14:57 UTC (rev 19272)
@@ -289,6 +289,13 @@
};
/**
+ * Convenience function to trim leading and trailing whitespace at once.
+ */
+ openils.Util.trimString = function(s) {
+ return s.replace(/^\s*(.+)?\s*$/,"$1");
+ }
+
+ /**
* Assume a space-separated interval string, with optional comma
* E.g. "1 year, 2 days" "3 days 6 hours"
*/
Modified: trunk/Open-ILS/web/js/ui/default/serial/subscription/caption_and_pattern.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/serial/subscription/caption_and_pattern.js 2011-01-24 21:38:14 UTC (rev 19271)
+++ trunk/Open-ILS/web/js/ui/default/serial/subscription/caption_and_pattern.js 2011-01-24 22:14:57 UTC (rev 19272)
@@ -28,6 +28,17 @@
"[name='pattern_code'] button", this.element
)[0];
this.wizard_button.onclick = function() {
+ if (
+ openils.Util.trimString(
+ self.controls.pattern_code.value
+ ).length &&
+ !confirm(
+ "Are you sure you want to erase this pattern code\n" +
+ "and create a new one via the Wizard?" /* XXX i18n */
+ )
+ ) {
+ return;
+ }
try {
netscape.security.PrivilegeManager.enablePrivilege(
"UniversalXPConnect"
@@ -35,7 +46,7 @@
window.openDialog(
xulG.url_prefix("/xul/server/serial/pattern_wizard.xul"),
"pattern_wizard",
- "scrollbars=yes,width=1024",
+ "width=800",
function(value) {
self.controls.pattern_code.value = value;
self.controls.pattern_code.onchange();
@@ -74,6 +85,18 @@
this.controls.create_date.innerHTML =
openils.Util.timeStamp(datum.create_date());
+ /* Once created, scap objects' pattern_code field is meant to
+ * be immutable.
+ *
+ * See http://list.georgialibraries.org/pipermail/open-ils-dev/2010-May/006079.html
+ *
+ * The DB trigger mentioned was never created to enforce this
+ * immutability at that level, but this should keep users from
+ * doing the wrong thing by mistake.
+ */
+ this.controls.pattern_code.readOnly = true;
+ this.wizard_button.disabled = true;
+
this.has_changed(false);
} else {
this.datum = new scap();
@@ -334,7 +357,6 @@
);
progress_dialog.hide();
}
-
};
this.init.apply(this, arguments);
Modified: trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard.js 2011-01-24 21:38:14 UTC (rev 19271)
+++ trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard.js 2011-01-24 22:14:57 UTC (rev 19272)
@@ -49,24 +49,23 @@
}
}
-function _date_validate(date_val, month_val) {
- /* general purpose date validation irrespective of year */
- date_val = date_val.trim();
+function _cap_number_textbox_value(node, max) {
+ if (node.value > max) node.value = max;
+ node.max = max;
+}
- if (!date_val.match(/^[0123]?\d$/))
- return false;
+function _cap_to_month(month, date_box) {
+ if (!date_box)
+ return;
- date_val = Number(date_val); /* do NOT use parseInt */
- month_val = Number(month_val);
-
- if (date_val < 1) {
- return false;
- } else if (month_val == 2) {
- return date_val <= 29;
- } else if ([1,3,5,7,8,10,12].indexOf(month_val) != -1) {
- return date_val <= 31;
+ if (month == "02") {
+ _cap_number_textbox_value(date_box, 29);
+ } else if (
+ ["09", "04", "06", "11"].indexOf(month) != -1
+ ) {
+ _cap_number_textbox_value(date_box, 30);
} else {
- return date_val <= 30;
+ _cap_number_textbox_value(date_box, 31);
}
}
@@ -91,17 +90,13 @@
}
);
- var date_month_selector = node_by_name("date_month", this.element);
-
dojo.attr(
- node_by_name("date_day", this.element), "onchange", function(ev) {
- if (_date_validate(ev.target.value,date_month_selector.value)){
- return true;
- } else {
- alert(S("bad_date_value"));
- ev.target.focus();
- return false;
- }
+ node_by_name("date_month", this.element),
+ "oncommand",
+ function(ev){
+ _cap_to_month(
+ ev.target.value, node_by_name("date_day", self.element)
+ );
}
);
@@ -291,9 +286,22 @@
);
},
"MM": function() {
- return _menulist(
+ var mm = _menulist(
_chronstants.month.values, _chronstants.month.names
);
+ dojo.attr(
+ mm, "oncommand", function(ev) {
+ _cap_to_month(
+ dojo.attr(ev.target, "value"),
+ dojo.query(
+ 'textbox[type="number"]',
+ ev.target.parentNode.parentNode.parentNode
+ /* ev.target is the menuITEM node */
+ )[0]
+ );
+ }
+ );
+ return mm;
},
"SS": function() {
return _menulist(
@@ -372,7 +380,7 @@
this.rows[id] = new RegularityRow(this.template, id, this);
- dojo.place(this.rows[id].element, "y_row_before_this", "before");
+ dojo.place(this.rows[id].element, "y_rows_here", "last");
};
this.remove_row = function(id) {
@@ -384,10 +392,14 @@
};
this.compile = function() {
- return openils.Util.objectProperties(this.rows).sort().reduce(
- function(a, b) { return a.concat(["y", self.rows[b].compile()]); },
- []
- );
+ if (!this.active) {
+ return [];
+ } else {
+ return openils.Util.objectProperties(this.rows).sort().reduce(
+ function(a, b){return a.concat(["y",self.rows[b].compile()]);},
+ []
+ );
+ }
};
this._init.apply(this, arguments);
@@ -822,6 +834,15 @@
this.regularity_editor = new RegularityEditor();
this.field_w = dojo.byId("hard_w");
+ dojo.attr(
+ dojo.byId("soft_w"), "onchange", function(ev) {
+ var use_regularity = dojo.byId("use_regularity");
+ if (ev.target.value && !use_regularity.checked) {
+ use_regularity.checked = true;
+ use_regularity.doCommand();
+ }
+ }
+ );
};
this.reset = function() {
Modified: trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard.xul 2011-01-24 21:38:14 UTC (rev 19271)
+++ trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard.xul 2011-01-24 22:14:57 UTC (rev 19272)
@@ -9,6 +9,7 @@
<?xul-overlay href="/xul/server/serial/pattern_wizard_overlay.xul"?>
<window id="pattern_wizard_win"
+ title="Pattern Code Wizard"
onload="try{my_init();font_helper();persist_helper();}catch(E){alert(E);}"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
Modified: trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard_overlay.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard_overlay.xul 2011-01-24 21:38:14 UTC (rev 19271)
+++ trunk/Open-ILS/xul/staff_client/server/serial/pattern_wizard_overlay.xul 2011-01-24 22:14:57 UTC (rev 19272)
@@ -135,7 +135,8 @@
<menupopup>
</menupopup>
</menulist>
- <textbox name="date_day" size="3" />
+ <textbox name="date_day" size="3"
+ type="number" min="1" max="31" />
</hbox>
</hbox>
<button icon="remove" name="remover" label="Remove" />
@@ -171,7 +172,7 @@
<row id="chron_row_headings">
<label />
<label value="Caption" />
- <label value="Display in holding field?" />
+ <label value="Include this actual word in the caption?" />
<label />
</row>
<row id="chron_row_template">
@@ -277,47 +278,57 @@
<vbox id="wizard_step_regularity" class="hideme">
<checkbox id="use_regularity"
oncommand="wizard.regularity_editor.toggle(event);"
- label="Specify regularity information (extra, omitted,
- and/or combined issues)?" />
+ label="Use specific regularity information (published,
+ omitted, and/or combined issues)?" />
<vbox id="regularity_editor_here" class="hideme">
- <hbox id="regularity_template_y" align="top">
- <menulist name="poc">
- <menupopup>
- <menuitem disabled="true" label="---" />
- <menuitem value="p" label="Published" />
- <menuitem value="o" label="Omitted" />
- <menuitem value="c" label="Combined" />
- </menupopup>
- </menulist>
- <menulist name="type_and_code_pattern">
- <menupopup>
- <menuitem disabled="true" label="---" />
- <menuitem value="d:dd"
- label="Day of the week" />
- <menuitem value="d:DD"
- label="Day of the month" />
- <menuitem value="d:MMDD"
- label="Date of the year" />
- <menuitem value="m:MM" label="Month" />
- <menuitem value="s:SS" label="Season" />
- <menuitem value="w:WWdd"
- label="Weekday of the month" />
- <menuitem value="w:MMWWdd"
- label="Weekday of specific month" />
- <menuitem value="w:MMWW"
- label="Week of specific month" />
- <menuitem value="y:YYYY"
- label="Span over two years" />
- </menupopup>
- </menulist>
- <vbox name="sub_rows_here"></vbox>
- <vbox align="top">
- <button label="Add sub-row" icon="add"
- disabled="true" name="add_sub_row" />
- <button label="Remove whole row"
- icon="remove" name="remove" />
- </vbox>
- </hbox>
+ <grid>
+ <columns>
+ <column />
+ <column />
+ <column />
+ <column />
+ </columns>
+ <rows id="y_rows_here">
+ <row id="regularity_template_y" align="top">
+ <menulist name="poc">
+ <menupopup>
+ <menuitem disabled="true" label="---" />
+ <menuitem value="p" label="Published" />
+ <menuitem value="o" label="Omitted" />
+ <menuitem value="c" label="Combined" />
+ </menupopup>
+ </menulist>
+ <menulist name="type_and_code_pattern">
+ <menupopup>
+ <menuitem disabled="true" label="---" />
+ <menuitem value="d:dd"
+ label="Day of the week" />
+ <menuitem value="d:DD"
+ label="Day of the month" />
+ <menuitem value="d:MMDD"
+ label="Date of the year" />
+ <menuitem value="m:MM" label="Month" />
+ <menuitem value="s:SS" label="Season" />
+ <menuitem value="w:WWdd"
+ label="Weekday of the month" />
+ <menuitem value="w:MMWWdd"
+ label="Weekday of specific month" />
+ <menuitem value="w:MMWW"
+ label="Week of specific month" />
+ <menuitem value="y:YYYY"
+ label="Span over two years" />
+ </menupopup>
+ </menulist>
+ <vbox name="sub_rows_here"></vbox>
+ <vbox align="top">
+ <button label="Add sub-row" icon="add"
+ disabled="true" name="add_sub_row" />
+ <button label="Remove whole row"
+ icon="remove" name="remove" />
+ </vbox>
+ </row>
+ </rows>
+ </grid>
<hbox id="y_row_before_this" pack="center"
style="padding-top: 1ex;">
<button id="regularity_add_y"
Modified: trunk/Open-ILS/xul/staff_client/server/serial/scap_editor.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/serial/scap_editor.js 2011-01-24 21:38:14 UTC (rev 19271)
+++ trunk/Open-ILS/xul/staff_client/server/serial/scap_editor.js 2011-01-24 22:14:57 UTC (rev 19272)
@@ -146,7 +146,7 @@
window.openDialog(
xulG.url_prefix("/xul/server/serial/pattern_wizard.xul"),
"pattern_wizard",
- "scrollbars=yes", /* XXX FIXME: scrollbars aren't working. what to do? */
+ "width=800",
onsubmit
);
},
Modified: trunk/Open-ILS/xul/staff_client/server/skin/serial.css
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/skin/serial.css 2011-01-24 21:38:14 UTC (rev 19271)
+++ trunk/Open-ILS/xul/staff_client/server/skin/serial.css 2011-01-24 22:14:57 UTC (rev 19272)
@@ -21,3 +21,5 @@
}
.padded_bottom { padding-bottom: 10px; }
description#print_routing_desc { margin: 0; padding: 0 1em; }
+#pattern_wizard_main > vbox { padding: 0.5em 0; }
+#pattern_wizard_main { overflow: auto; }
More information about the open-ils-commits
mailing list