[open-ils-commits] r19075 - branches/rel_2_0/Open-ILS/web/js/ui/default/cat/authority (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Dec 28 23:16:27 EST 2010


Author: dbs
Date: 2010-12-28 23:16:24 -0500 (Tue, 28 Dec 2010)
New Revision: 19075

Modified:
   branches/rel_2_0/Open-ILS/web/js/ui/default/cat/authority/list.js
Log:
Enhance usability of authority record deletion dialogue

Don't show the number of linked bib records unless it is
a non-zero sum.

Make "Cancel" the button with focus in the dialog, so that
an errant press of the "Enter" key doesn't do the wrong thing.

Trim space from the authority text in the display. Move the
authority text from the dialog title to the contents of the
dialog.

Do not display the MARC for the authority record by default;
add a "View MARC" button and toggle it to show/hide MARC.


Modified: branches/rel_2_0/Open-ILS/web/js/ui/default/cat/authority/list.js
===================================================================
--- branches/rel_2_0/Open-ILS/web/js/ui/default/cat/authority/list.js	2010-12-29 04:15:33 UTC (rev 19074)
+++ branches/rel_2_0/Open-ILS/web/js/ui/default/cat/authority/list.js	2010-12-29 04:16:24 UTC (rev 19075)
@@ -122,16 +122,31 @@
                 var delDlg = dijit.byId("delDialog_" + auth.id);
 
                 dojo.query('#auth' + auth.id + ' span.text').forEach(function(node) {
-                    auth.text += dojox.xml.parser.textContent(node); 
+                    auth.text += dojo.trim(dojox.xml.parser.textContent(node)); 
                 });
 
                 if (!delDlg) {
+                    var content = '<div>Delete the authority record: "' + auth.text + '"?</div>';
+                    if (parseInt(linkedBibs) > 0) {
+                        content = "<div id='delAuthSum_" + auth.id + "'>Number of linked bibliographic records: " + linkedBibs + "</div>";
+                    }
+                    content += "<div id='authMARC" + auth.id + "' style='width: 100%; display:none;'>";
+                    content += "<hr style='width: 100%;' />";
+                    content += marcToHTML(auth_rec.marc());
+                    content += "</div><hr style='width: 100%;' /><div>";
+                    content += "<input type='button' dojoType='dijit.form.Button' label='Cancel' onClick='cancelDelete(" + auth.id + ")'/>";
+                    content += "<input type='button' dojoType='dijit.form.Button' label='Delete' onClick='confirmDelete(" + auth.id + ")'/>";
+                    content += "<input id='viewMARC" + auth.id + "' type='button' "
+                        + "style='float:right;' dojoType='dijit.form.Button' "
+                        + "label='View MARC' onClick='viewMARC(" + auth.id + ")'/>";
+                    content += "<input id='hideMARC" + auth.id + "' type='button' "
+                        + "style='display: none; float:right;' dojoType='dijit.form.Button' "
+                        + "label='Hide MARC' onClick='hideMARC(" + auth.id + ")'/>";
+                    content += "</div>";
                     delDlg = new dijit.Dialog({
                         "id":"delDialog_" + auth.id,
-                        "title":"Confirm deletion of record # " + auth.id + " (" + auth.text + ") ",
-                        "content":"<div id='delAuthSum_" + auth.id + "'>Number of linked bibliographic records: " + linkedBibs + "</div><hr />" + 
-                            marcToHTML(auth_rec.marc()) +
-                            "<hr /><div><input type='button' dojoType='dijit.form.Button' label='Delete' onClick='confirmDelete(" + auth.id + ")'/><input type='button' dojoType='dijit.form.Button' label='Cancel' onClick='cancelDelete(" + auth.id + ")'/></div>"
+                        "title":"Confirm deletion of record # " + auth.id,
+                        "content": content
                     });
                 }
                 delDlg.show();
@@ -146,6 +161,18 @@
     showBibCount(idArr);
 }
 
+function viewMARC(recId) {
+    dojo.style(dojo.byId("authMARC" + recId), 'display', 'block');
+    dojo.style(dijit.byId("viewMARC" + recId).domNode, 'display', 'none');
+    dojo.style(dijit.byId("hideMARC" + recId).domNode, 'display', 'block');
+}
+
+function hideMARC(recId) {
+    dojo.style(dojo.byId("authMARC" + recId), 'display', 'none');
+    dojo.style(dijit.byId("hideMARC" + recId).domNode, 'display', 'none');
+    dojo.style(dijit.byId("viewMARC" + recId).domNode, 'display', 'block');
+}
+
 function marcToHTML(marc) {
     var html = '<table><tbody>';
     marc = dojox.xml.parser.parse(marc);



More information about the open-ils-commits mailing list