From 2538a6345391dbae6cb2ef83f0289dff1543b2ca Mon Sep 17 00:00:00 2001 From: Cliff Ingham Date: Thu, 7 Aug 2014 10:08:52 -0400 Subject: [PATCH] Updated drop down javascript to YUI3 Fixes #4 --- .gitignore | 3 ++ .gitmodules | 3 ++ build.sh | 17 ++++++++ buildignore | 10 +++++ configuration.inc.default | 15 +++----- html/js/functions.js | 62 ++++++++++++++++-------------- html/js/yui3 | 1 + templates/html/partials/footer.inc | 2 + templates/html/partials/header.inc | 8 ---- 9 files changed, 74 insertions(+), 47 deletions(-) create mode 100644 .gitmodules create mode 100755 build.sh create mode 100644 buildignore create mode 160000 html/js/yui3 diff --git a/.gitignore b/.gitignore index 94db497..b7d6978 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ configuration.inc +build +dist +data/sessions/* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e27170e --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "html/js/yui3"] + path = html/js/yui3 + url = https://github.com/yui/yui3.git diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..23aa4f8 --- /dev/null +++ b/build.sh @@ -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 diff --git a/buildignore b/buildignore new file mode 100644 index 0000000..4443275 --- /dev/null +++ b/buildignore @@ -0,0 +1,10 @@ +/buildignore +/build.sh +/build +/dist +.git/ +.git* +configuration.inc +/data/sessions/* +/scripts/backup.cnf +/html/js/yui3/src/ diff --git a/configuration.inc.default b/configuration.inc.default index f4dea65..fb37e69 100644 --- a/configuration.inc.default +++ b/configuration.inc.default @@ -1,13 +1,4 @@ - */"); /** * Used to keep sessions on the same webserver seperate; */ @@ -37,7 +28,8 @@ Zend_Loader_Autoloader::getInstance(); * The URL to get to this site * 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 @@ -106,6 +98,9 @@ define('DIRECTORY_ADMIN_PASS','password'); //define('DIRECTORY_ADMIN_BINDING', 'uid=admin,'.DIRECTORY_BASE_DN); //define('DIRECTORY_ADMIN_PASS','password'); +define('YUI', BASE_URI.'/js/yui3/build'); + + /** * Import global functions that we use for many applications we write */ diff --git a/html/js/functions.js b/html/js/functions.js index fce07f7..6501cc6 100644 --- a/html/js/functions.js +++ b/html/js/functions.js @@ -1,40 +1,44 @@ +"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 * @author Cliff Ingham */ -var COB = {}; +var COB = { + populateSections: function (cemetery_id, select_id, BASE_URL) { + var url = BASE_URL + '/cemeteries/viewCemetery.php?format=json;cemetery_id=' + cemetery_id; -COB.populateSections = function(cemetery_id,select_id,BASE_URL) { - var url = BASE_URL + '/cemeteries/viewCemetery.php?format=json;cemetery_id=' + cemetery_id; + 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; - YAHOO.util.Connect.asyncRequest('GET',url,{ - success : function (o) { - var select = document.getElementById(select_id); - select.innerHTML = ''; - select.appendChild(document.createElement('option')); + select.innerHTML = ''; + select.appendChild(document.createElement('option')); - var sections = YAHOO.lang.JSON.parse(o.responseText).sections - 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); - } - }, + 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); + } + } + } + }); + }); + }, - failure : function (o) { + // 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; } - }); -} - -/* A handy function for doing pop-up confirmations when deleting something */ -COB.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; } }; diff --git a/html/js/yui3 b/html/js/yui3 new file mode 160000 index 0000000..10d1cd5 --- /dev/null +++ b/html/js/yui3 @@ -0,0 +1 @@ +Subproject commit 10d1cd5e1e2266ce2ff660620bfaba2340b400a1 diff --git a/templates/html/partials/footer.inc b/templates/html/partials/footer.inc index 4ef721a..b61f368 100644 --- a/templates/html/partials/footer.inc +++ b/templates/html/partials/footer.inc @@ -8,3 +8,5 @@ ?>

+ + diff --git a/templates/html/partials/header.inc b/templates/html/partials/header.inc index c0a4987..263507d 100644 --- a/templates/html/partials/header.inc +++ b/templates/html/partials/header.inc @@ -9,13 +9,5 @@ @import url('/skins/origin-external/screen.css'); @import url('/skins/local/screen.css'); - - - - - - - - Cemeteries