[open-ils-commits] r14285 - in trunk/Open-ILS/web: js/ui/default/actor/user templates/default/actor/user (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Oct 6 16:42:41 EDT 2009
Author: erickson
Date: 2009-10-06 16:42:36 -0400 (Tue, 06 Oct 2009)
New Revision: 14285
Modified:
trunk/Open-ILS/web/js/ui/default/actor/user/register.js
trunk/Open-ILS/web/templates/default/actor/user/register.tt2
Log:
plugged in link to address owner when address is owned by another user (e.g. via cloning)
Modified: trunk/Open-ILS/web/js/ui/default/actor/user/register.js
===================================================================
--- trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2009-10-06 17:44:48 UTC (rev 14284)
+++ trunk/Open-ILS/web/js/ui/default/actor/user/register.js 2009-10-06 20:42:36 UTC (rev 14285)
@@ -797,6 +797,9 @@
if(id == null)
id = --uEditAddrVirtId; // new address
+ var addr = patron.addresses().filter(
+ function(i) { return (i.id() == id) })[0];
+
dojo.forEach(addrTemplateRows,
function(row) {
@@ -813,9 +816,6 @@
} else if(row.getAttribute('name') == 'uedit-addr-pending-row') {
- var addr = patron.addresses().filter(
- function(i) { return (i.id() == id) })[0];
-
// if it's a pending address, show the 'approve' button
if(addr && openils.Util.isTrue(addr.pending())) {
openils.Util.show(row, 'table-row');
@@ -830,6 +830,43 @@
}
}
+ } else if(row.getAttribute('name') == 'uedit-addr-owner-row') {
+ // address is owned by someone else. provide option to load the
+ // user in a different tab
+
+ if(addr && addr.usr() != patron.id()) {
+ openils.Util.show(row, 'table-row');
+ var link = getByName(row, 'addr-owner');
+
+ // fetch the linked user so we can present their name in the UI
+ var addrUser;
+ if(cloneUserObj && cloneUserObj.id() == addr.usr()) {
+ addrUser = [
+ cloneUserObj.first_given_name(),
+ cloneUserObj.second_given_name(),
+ cloneUserObj.family_name()
+ ];
+ } else {
+ addrUser = fieldmapper.standardRequest(
+ ['open-ils.actor', 'open-ils.actor.user.retrieve.parts'],
+ {params: [
+ openils.User.authtoken,
+ addr.usr(),
+ ['first_given_name', 'second_given_name', 'family_name']
+ ]}
+ );
+ }
+
+ link.innerHTML = addrUser[0] + ' ' + addrUser[1] + ' ' + addrUser[2]; // TODO i18n
+ link.onclick = function() {
+ if(openils.XUL.isXUL()) {
+ window.xulG.spawn_editor({ses:openils.User.authtoken, usr:addr.usr()})
+ } else {
+ parent.location.href = location.href.replace(/clone=\d+/, 'usr=' + addr.usr());
+ }
+ }
+ }
+
} else if(row.getAttribute('name') == 'uedit-addr-divider') {
// link up the billing/mailing address and give the inputs IDs so we can acces the later
Modified: trunk/Open-ILS/web/templates/default/actor/user/register.tt2
===================================================================
--- trunk/Open-ILS/web/templates/default/actor/user/register.tt2 2009-10-06 17:44:48 UTC (rev 14284)
+++ trunk/Open-ILS/web/templates/default/actor/user/register.tt2 2009-10-06 20:42:36 UTC (rev 14285)
@@ -143,6 +143,14 @@
</td>
</tr>
+ <tr name='uedit-addr-owner-row' type='addr-template' class='pending-addr-row hidden'>
+ <td colspan='3'>
+ <span style='padding-right:10px;'>This address is owned by another user: </span>
+ <a href='javascript:void(0);' name='addr-owner'></a>
+ </td>
+ </tr>
+
+
<tr fmclass='aua' fmfield='address_type' type='addr-template' required='show'/>
<tr fmclass='aua' fmfield='post_code' type='addr-template' required='required'/>
<tr fmclass='aua' fmfield='street1' type='addr-template' required='required'/>
More information about the open-ils-commits
mailing list