From ded6557043cec59fcc632841d2c554c86c579486 Mon Sep 17 00:00:00 2001 From: Brendan Collins Date: Wed, 17 Dec 2014 11:12:46 -0500 Subject: [PATCH 1/8] adding custom mbtile overlays to map creation --- VAGRANT.md | 2 ++ Vagrantfile | 1 + provisioning/playbook.yml | 1 + site/lib/lib.compose.php | 7 ++++++ site/templates/make-step2-geography.html.tpl | 14 +++++++++++- site/templates/make-step3-info.html.tpl | 4 ++++ site/templates/make-step4-layout.html.tpl | 4 ++++ site/www/js/make_geography.js | 23 ++++++++++++++++++-- site/www/make-step1-search.php | 1 + site/www/make-step2-geography.php | 9 ++++++++ site/www/make-step3-info.php | 3 +++ site/www/make-step4-layout.php | 3 +++ 12 files changed, 69 insertions(+), 3 deletions(-) diff --git a/VAGRANT.md b/VAGRANT.md index cd231943..add9700e 100644 --- a/VAGRANT.md +++ b/VAGRANT.md @@ -37,3 +37,5 @@ From the fieldpapers checkout on your host machine *Celery logging* `vagrant ssh -c "screen -r celery"` +"mysql --user=fieldpapers --password=w4lks fieldpapers" + diff --git a/Vagrantfile b/Vagrantfile index a45291fe..6dd93248 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -14,6 +14,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.provider :virtualbox do |vb, override| vb.memory = 1024 vb.cpus = 1 + vb.name = "Field Papers" override.vm.box = "precise64" override.vm.box_url = "http://files.vagrantup.com/precise64.box" override.vm.network :private_network, ip: "192.168.33.10" diff --git a/provisioning/playbook.yml b/provisioning/playbook.yml index d886ae26..4168b73b 100644 --- a/provisioning/playbook.yml +++ b/provisioning/playbook.yml @@ -22,6 +22,7 @@ - apache2 - php5 - php5-mysql + - php5-sqlite - phpmyadmin - build-essential - libcairo2-dev diff --git a/site/lib/lib.compose.php b/site/lib/lib.compose.php index edbaa48b..b7fa6511 100644 --- a/site/lib/lib.compose.php +++ b/site/lib/lib.compose.php @@ -344,6 +344,7 @@ function compose_from_postvars(&$dbh, $post, $user_id) $orientation = isset($post['orientation']) ? $post['orientation'] : 'portrait'; $layout = isset($post['layout']) ? $post['layout'] : 'full-page'; $provider = $post['provider']; + $overlay = $post['overlay']; $title = $post['atlas_title']; $grid = filter_var($post['grid'], FILTER_VALIDATE_BOOLEAN) ? 1 : 0; $redcross = filter_var($post['redcross'], FILTER_VALIDATE_BOOLEAN) ? 1 : 0; @@ -455,6 +456,12 @@ function compose_from_postvars(&$dbh, $post, $user_id) if($redcross) $message['pages'][$i]['provider'] = "{$value['provider']},http://a.tiles.mapbox.com/v3/americanredcross.HAIYAN_Atlas_Bounds/{Z}/{X}/{Y}.png"; + + if($overlay) + $message['pages'][$i]['provider'] = "{$value['provider']},{$overlay}"; + + + } // Deal with WOEIDs diff --git a/site/templates/make-step2-geography.html.tpl b/site/templates/make-step2-geography.html.tpl index a5077efc..90a634ff 100644 --- a/site/templates/make-step2-geography.html.tpl +++ b/site/templates/make-step2-geography.html.tpl @@ -27,7 +27,10 @@ var mbtiles_data = {$mbtiles_data|@json_encode} || null, center = {$center|json_encode} || null, - zoom = {$zoom|json_encode} || null; + zoom = {$zoom|json_encode} || null, + zoom = {$zoom|json_encode} || null, + user_mbtiles = {$user_mbtiles|@json_encode} || null; +