[open-ils-commits] r17259 - trunk/Open-ILS/web/templates/default/cat/authority (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Aug 19 00:47:57 EDT 2010
Author: dbs
Date: 2010-08-19 00:47:53 -0400 (Thu, 19 Aug 2010)
New Revision: 17259
Modified:
trunk/Open-ILS/web/templates/default/cat/authority/list.tt2
Log:
Fix some defects in the first iteration of the authority edit/delete interface
* Ensure that the correct ID is assigned to the edit/delete request
* Prevent caching of results so that when a record is deleted, we don't continue to see it
Modified: trunk/Open-ILS/web/templates/default/cat/authority/list.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/cat/authority/list.tt2 2010-08-19 03:47:35 UTC (rev 17258)
+++ trunk/Open-ILS/web/templates/default/cat/authority/list.tt2 2010-08-19 04:47:53 UTC (rev 17259)
@@ -45,24 +45,31 @@
// Create the authority record listing entry
dojo.place('<div class="authEntry" id="auth' + authId + '">' + authText + '</div>', "authlist-div", "last");
+
// Add the menu of new/edit/delete/mark-for-merge options
var auth_menu = new dijit.Menu({});
- new dijit.MenuItem({"onClick": function(){
+
+ // "Edit" menu item
+ new dijit.MenuItem({"id": "edit_" + authId, "onClick": function(){
+ recId = this.id.slice(this.id.lastIndexOf('_') + 1);
pcrud = new openils.PermaCrud();
- var auth_rec = pcrud.retrieve("are", authId);
+ auth_rec = pcrud.retrieve("are", recId);
if (auth_rec) {
loadMarcEditor(pcrud, auth_rec);
}
}, "label":"Edit"}).placeAt(auth_menu, "first");
- new dijit.MenuItem({"onClick":function(){
+
+ // "Delete" menu item
+ new dijit.MenuItem({"id": "delete_" + authId, "onClick":function(){
+ recId = this.id.slice(this.id.lastIndexOf('_') + 1);
pcrud = new openils.PermaCrud();
- var auth_rec = pcrud.retrieve("are", authId);
+ auth_rec = pcrud.retrieve("are", recId);
if (auth_rec) {
pcrud.eliminate(auth_rec);
- alert("Deleted authority record # " + authId);
+ alert("Deleted authority record # " + recId);
}
}, "label":"Delete"}).placeAt(auth_menu, "last");
- var auth_mb = new dijit.form.DropDownButton({dropDown: auth_menu, label:"Actions"});
+ auth_mb = new dijit.form.DropDownButton({dropDown: auth_menu, label:"Actions"});
auth_mb.placeAt("auth" + authId, "first");
auth_menu.startup();
});
@@ -111,6 +118,9 @@
}
/* Clear out the current contents of the page */
+ widgets = dijit.findWidgets(dojo.byId('authlist-div'));
+ dojo.forEach(widgets, function(w) { w.destroyRecursive(true); });
+
dojo.query("#authlist-div div").orphan();
url = '/opac/extras/startwith/marcxml/'
@@ -120,7 +130,7 @@
+ '/' + dijit.byId('authTerm').attr('value')
+ '/' + dijit.byId('authPage').attr('value')
;
- dojo.xhrGet({"url":url, "handleAs":"xml", "content":{"format":"marcxml"}, "load":displayAuthorities });
+ dojo.xhrGet({"url":url, "handleAs":"xml", "content":{"format":"marcxml"}, "preventCache": true, "load":displayAuthorities });
</script>
</div>
</div>
@@ -128,4 +138,3 @@
<div id='authlist-div'></div>
[% END %]
-
More information about the open-ils-commits
mailing list