2014-08-07 14:08:52 +00:00
|
|
|
"use strict";
|
2010-01-06 17:10:08 +00:00
|
|
|
/**
|
2014-08-07 14:08:52 +00:00
|
|
|
* @copyright 2014 City of Bloomington, Indiana
|
2011-06-14 13:29:37 +00:00
|
|
|
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
|
2010-01-06 17:10:08 +00:00
|
|
|
* @author Cliff Ingham <inghamn@bloomington.in.gov>
|
|
|
|
*/
|
2014-08-07 14:08:52 +00:00
|
|
|
var COB = {
|
|
|
|
populateSections: function (cemetery_id, select_id, BASE_URL) {
|
|
|
|
var url = BASE_URL + '/cemeteries/viewCemetery.php?format=json;cemetery_id=' + cemetery_id;
|
2010-01-06 17:10:08 +00:00
|
|
|
|
2014-08-07 14:08:52 +00:00
|
|
|
YUI().use('io', 'json', function (Y) {
|
|
|
|
Y.io(url, {
|
|
|
|
on: {
|
|
|
|
complete: function (id, o, args) {
|
|
|
|
var select = document.getElementById(select_id),
|
|
|
|
sections = Y.JSON.parse(o.responseText).sections,
|
|
|
|
i = 0;
|
2010-01-06 17:10:08 +00:00
|
|
|
|
2014-08-07 14:08:52 +00:00
|
|
|
select.innerHTML = '';
|
|
|
|
select.appendChild(document.createElement('option'));
|
2010-01-06 17:10:08 +00:00
|
|
|
|
2014-08-07 14:08:52 +00:00
|
|
|
for (i in sections) {
|
|
|
|
var option = document.createElement('option');
|
|
|
|
option.setAttribute('value',sections[i].id);
|
|
|
|
option.appendChild(document.createTextNode(sections[i].code));
|
|
|
|
select.appendChild(option);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
2010-01-06 17:10:08 +00:00
|
|
|
|
2014-08-07 14:08:52 +00:00
|
|
|
// A handy function for doing pop-up confirmations when deleting something
|
|
|
|
deleteConfirmation: function (url) {
|
|
|
|
if (confirm("Are you really sure you want to delete this?\n\nOnce deleted it will be gone forever.")) {
|
|
|
|
document.location.href = url;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return false;
|
2010-01-06 17:10:08 +00:00
|
|
|
}
|
2010-01-29 18:33:16 +00:00
|
|
|
}
|
|
|
|
};
|