Updated drop down javascript to YUI3

Fixes #4
This commit is contained in:
Cliff Ingham 2014-08-07 10:08:52 -04:00
parent f02681850b
commit 2538a63453
9 changed files with 74 additions and 47 deletions

3
.gitignore vendored
View File

@ -1 +1,4 @@
configuration.inc configuration.inc
build
dist
data/sessions/*

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "html/js/yui3"]
path = html/js/yui3
url = https://github.com/yui/yui3.git

17
build.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
BUILD=./build
DIST=./dist
if [ ! -d $BUILD ]
then mkdir $BUILD
else rm -Rf $BUILD/*
fi
if [ ! -d $DIST ]
then mkdir $DIST
else rm -Rf $DIST/*
fi
rsync -rlv --exclude-from=./buildignore --delete ./ ./build/
tar czvf $DIST/rosehill.tar.gz --transform=s/build/rosehill/ $BUILD

10
buildignore Normal file
View File

@ -0,0 +1,10 @@
/buildignore
/build.sh
/build
/dist
.git/
.git*
configuration.inc
/data/sessions/*
/scripts/backup.cnf
/html/js/yui3/src/

View File

@ -1,13 +1,4 @@
<?php <?php
/**
* Replace this copyright statement with your own. All the generated code
* will include this copyright statement
*/
define('COPYRIGHT',"/**
* @copyright 2007-2012 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/");
/** /**
* Used to keep sessions on the same webserver seperate; * Used to keep sessions on the same webserver seperate;
*/ */
@ -37,7 +28,8 @@ Zend_Loader_Autoloader::getInstance();
* The URL to get to this site * The URL to get to this site
* Do NOT use a trailing slash * Do NOT use a trailing slash
*/ */
define('BASE_URL','http://localhost'); define('BASE_URL','http://localhost/application_name');
define('BASE_URI', '/application_name');
/** /**
* Used when there's an error on the site. The Framework will * Used when there's an error on the site. The Framework will
@ -106,6 +98,9 @@ define('DIRECTORY_ADMIN_PASS','password');
//define('DIRECTORY_ADMIN_BINDING', 'uid=admin,'.DIRECTORY_BASE_DN); //define('DIRECTORY_ADMIN_BINDING', 'uid=admin,'.DIRECTORY_BASE_DN);
//define('DIRECTORY_ADMIN_PASS','password'); //define('DIRECTORY_ADMIN_PASS','password');
define('YUI', BASE_URI.'/js/yui3/build');
/** /**
* Import global functions that we use for many applications we write * Import global functions that we use for many applications we write
*/ */

View File

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

1
html/js/yui3 Submodule

@ -0,0 +1 @@
Subproject commit 10d1cd5e1e2266ce2ff660620bfaba2340b400a1

View File

@ -8,3 +8,5 @@
?> ?>
</p> </p>
</div> </div>
<script type="text/javascript" src="<?php echo YUI; ?>/yui/yui-min.js"></script>
<script type="text/javascript" src="<?php echo BASE_URI; ?>/js/functions.js"></script>

View File

@ -9,13 +9,5 @@
@import url('<?php echo BASE_URL; ?>/skins/origin-external/screen.css'); @import url('<?php echo BASE_URL; ?>/skins/origin-external/screen.css');
@import url('<?php echo BASE_URL; ?>/skins/local/screen.css'); @import url('<?php echo BASE_URL; ?>/skins/local/screen.css');
</style> </style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/yahoo/yahoo-min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/event/event-min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/json/json-min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/connection/connection-min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/yui/2.8.0r4/build/datasource/datasource-min.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL; ?>/js/functions.js"></script>
<title>Cemeteries</title> <title>Cemeteries</title>
</head> </head>