Link checker: Links to MARC Editor in verification review interface
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 19 Oct 2012 18:34:49 +0000 (14:34 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 14 Feb 2013 19:19:17 +0000 (14:19 -0500)
Now you can click on the number in the Record ID column on any row in
the verification review interface to launch the MARC Editor for that
record.

This is only supports the most basic of possible mediation workflows to
follow a link checker run, but more could be done with future
development.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/templates/url_verify/review_attempt.tt2
Open-ILS/web/js/dojo/openils/URLVerify/ReviewAttempt.js
Open-ILS/web/js/dojo/openils/URLVerify/nls/URLVerify.js

index 8252bfd..a087c7f 100644 (file)
@@ -67,7 +67,7 @@
                 <th field="author" fpath="url.item.target_biblio_record_entry.simple_record.author"></th>
                 <th field="isbn" fpath="url.item.target_biblio_record_entry.simple_record.isbn" _visible="false"></th>
                 <th field="issn" fpath="url.item.target_biblio_record_entry.simple_record.issn" _visible="false"></th>
-                <th field="bib_id" fpath="url.item.target_biblio_record_entry.id" _visible="false"></th>
+                <th field="bib_id" fpath="url.item.target_biblio_record_entry.id" _visible="false" formatter="module.format_bib_id"></th>
             </tr>
         </thead>
     </table>
index d9a1cf5..33162be 100644 (file)
@@ -2,6 +2,7 @@ if (!dojo._hasResource["openils.URLVerify.ReviewAttempt"]) {
     dojo.require("dojo.string");
     dojo.require("openils.CGI");
     dojo.require("openils.PermaCrud");
+    dojo.require("openils.XUL");
     dojo.require("dijit.Tooltip");
 
     dojo.requireLocalization("openils.URLVerify", "URLVerify");
@@ -62,6 +63,45 @@ if (!dojo._hasResource["openils.URLVerify.ReviewAttempt"]) {
         module.progress_dialog.hide();
     };
 
+    module.open_marc_editor = function(/* bib id */ id) {
+        openils.XUL.newTabEasy(
+            "oils://remote/xul/server/cat/marcedit.xul",
+            dojo.string.substitute(localeStrings.MARC_EDITOR_TITLE, [id]), {
+                "record": {
+                    "url": "/opac/extras/supercat/retrieve/marcxml/record/"+id,
+                    "id": id,
+                    "rtype": "bre"
+                },
+                "save": {
+                    "label": localeStrings.MARC_EDITOR_SAVE_RECORD,
+                    "func": function(marcxml) {
+                        fieldmapper.standardRequest(
+                            ["open-ils.cat", "open-ils.cat.biblio.record.xml.update"], {
+                                "async": true,
+                                "params": [openils.User.authtoken, id, marcxml],
+                                "onresponse": function(r) {
+                                    /* just to do /something/ upon error */
+                                    openils.Util.readResponse(r);
+                                }
+                            }
+                        );
+                        /* marcedit.js just expects this kind of result; meh */
+                        return {"id": id, "oncomplete": function() { }};
+                    }
+                }
+            }
+        );
+    };
+
+    module.format_bib_id = function(id) {
+        if (!id) return "";
+
+        return "<a title='" + localeStrings.MARC_EDITOR_LINK +
+            "' href='javascript:void(0);' " +
+            "onclick='openils.URLVerify.ReviewAttempt.open_marc_editor(" +
+            id + "); return false;'>" + id + "</a>";
+    };
+
 }());
 
 }
index d2128db..c9302db 100644 (file)
@@ -17,5 +17,8 @@
     "CLONE_SESSION_NAME": "Copy of ${0}",
     "XPATH": "XPath",
     "SESSION_NAME": "Session '${0}'",
-    "SELECT_MORE": "Click here to review all session URLs and/or select other URLs to verify"
+    "SELECT_MORE": "Click here to review all session URLs and/or select other URLs to verify",
+    "MARC_EDITOR_LINK": "Click to open MARC Editor for this record",
+    "MARC_EDITOR_TITLE": "Record ID #${0}",
+    "MARC_EDITOR_SAVE_RECORD": "Save Record"
 }