Enhance usability of authority record deletion dialogue
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 28 Dec 2010 17:26:57 +0000 (17:26 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 28 Dec 2010 17:26:57 +0000 (17:26 +0000)
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.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@19071 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/cat/authority/list.js

index 68b75f7..6c24621 100644 (file)
@@ -108,16 +108,31 @@ function displayAuthorities(data) {
                 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();
@@ -132,6 +147,18 @@ function displayAuthorities(data) {
     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);