From 5e83c482c7b6eef437c7892bc543f99e15136d79 Mon Sep 17 00:00:00 2001
From: tworrall
- ${statement.street}
-
+ ${lines}
+
+ ${statement.street}
+ ${cityStateZip} ${statement.country!} ${statement.country!}
+
${statement.country}
#if> diff --git a/productMods/templates/freemarker/edit/forms/js/mailingAddressUtils.js b/productMods/templates/freemarker/edit/forms/js/mailingAddressUtils.js new file mode 100644 index 00000000..d2104330 --- /dev/null +++ b/productMods/templates/freemarker/edit/forms/js/mailingAddressUtils.js @@ -0,0 +1,51 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + + +var mailingAddressUtils = { + + onLoad: function(editMode) { + this.initObjectReferences(); + this.bindEventListeners(); + + if ( editMode != "add" ) { + this.setStreetAddressDisplayFields(); + } + }, + + initObjectReferences: function() { + + this.form = $('#personHasMailingAddress'); + this.street1 = $('#streetAddressOne'); + this.street2 = $('#streetAddressTwo'); + this.streetAddress = $('#streetAddress'); + + }, + + bindEventListeners: function() { + this.idCache = {}; + + this.form.submit(function() { + mailingAddressUtils.setStreetAddressField(); + }); + + }, + + // the vcard only has one address field, so combine the two + // displayed addresses into the hidden field which gets asserted in the N3 + setStreetAddressField: function() { + var tempString = this.street1.val() + "; " + this.street2.val(); + this.streetAddress.val(tempString); + }, + + // in edit mode, take the asserted streetAddress value and parse it into + // the two displayed address fields + setStreetAddressDisplayFields: function() { + var tempString = this.streetAddress.val(); + var lineOne = tempString.substring(0,tempString.lastIndexOf(";")); + var lineTwo = tempString.substring(tempString.lastIndexOf(";") + 2); + + this.street1.val(lineOne); + this.street2.val(lineTwo); + } + +} \ No newline at end of file diff --git a/productMods/templates/freemarker/edit/forms/subjectHasMailingAddress.ftl b/productMods/templates/freemarker/edit/forms/subjectHasMailingAddress.ftl index 99236069..e44041ea 100644 --- a/productMods/templates/freemarker/edit/forms/subjectHasMailingAddress.ftl +++ b/productMods/templates/freemarker/edit/forms/subjectHasMailingAddress.ftl @@ -68,13 +68,19 @@