Browse files

Adding ability to select a form for a particular print; adding abilit…

…y to move atlas-ui upon map resize
  • Loading branch information...
1 parent 27ff4fe commit 230434a24e98aca7a0b7af4ee8295961e719b847 Michael Lawrence Evans committed Feb 23, 2012
Showing with 59 additions and 13 deletions.
  1. +49 −13 site/templates/make-atlas.html.tpl
  2. +10 −0 site/www/make-atlas.php
View
62 site/templates/make-atlas.html.tpl
@@ -251,25 +251,37 @@
scaleControlCoordinates.y = scaleControlCoordinates.y + dy;
}
- function checkAtlasOverflow(topLeftPoint, bottomRightPoint)
+ function checkAtlasOverflow(topLeftPoint, bottomRightPoint, resize)
{
var map_extent = map.getExtent();
var map_top_left_point = map.locationPoint(map_extent[0]);
var map_bottom_right_point = map.locationPoint(map_extent[1]);
if (topLeftPoint.x < map_top_left_point.x || topLeftPoint.y < map_top_left_point.y ||
bottomRightPoint.x > map_bottom_right_point.x || bottomRightPoint.y > map_bottom_right_point.y)
- {
- //return true;
- var dragControlLocation = map.pointLocation(dragControlCoordinates);
- var scaleControlLocation = map.pointLocation(scaleControlCoordinates);
-
- map.zoomOut();
-
- dragControlCoordinates = map.locationPoint(dragControlLocation);
- scaleControlCoordinates = map.locationPoint(scaleControlLocation);
-
- resetAtlas();
+ {
+ if (resize === true)
+ {
+ //var dragControlLocation = map.pointLocation(dragControlCoordinates);
+ //var scaleControlLocation = map.pointLocation(scaleControlCoordinates);
+
+ dragControlCoordinates = map.locationPoint(map.getCenter());
+
+ scaleControlCoordinates = {x: dragControlCoordinates.x + page_dimensions.width,
+ y: dragControlCoordinates.y + page_dimensions.height};
+
+ resetAtlas();
+ } else {
+ var dragControlLocation = map.pointLocation(dragControlCoordinates);
+ var scaleControlLocation = map.pointLocation(scaleControlCoordinates);
+
+ map.setCenterZoom(map.getCenter(),map.getZoom()-1);
+
+ dragControlCoordinates = map.locationPoint(dragControlLocation);
+ scaleControlCoordinates = map.locationPoint(scaleControlLocation);
+
+ resetAtlas();
+ }
}
}
@@ -649,6 +661,13 @@
map.addCallback('zoomed', function(m) {
document.getElementById('page_zoom').value = map.getZoom();
});
+
+ map.addCallback('resized', function(m) {
+ console.log('resize');
+ // Check bounds
+ // Move to center of the map
+ checkAtlasOverflow(dragControlCoordinates, scaleControlCoordinates,true);
+ });
}
{/literal}
</script>
@@ -725,14 +744,31 @@
<option>Open Street Map</option>
</select>
<span style="margin-left:10px"><span id="page-count">1 Page</span>
+
+
<form id="compose_print" method="post" action="{$base_dir}/compose-print.php">
<input type="hidden" name="action" value="compose">
<input type="hidden" id="page_zoom" name="page_zoom">
<input type="hidden" id="paper_size" name="paper_size">
<input type="hidden" id="orientation" name="orientation">
<input type="hidden" id="provider" name="provider">
- <input type="hidden" id="form_id" name="form_id" value="Select a Form for this Atlas">
+ <!-- <input type="hidden" id="form_id" name="form_id"> -->
+
+ <select id="forms" name="form_id" style="margin-left: 30px">
+ {if $default_form == 'none'}
+ <option selected>Select a Form for this Atlas</option>
+ {else}
+ <option>Forms</option>
+ <option value="{$default_form.id}" selected>{$default_form.title} ({$default_form.id})</option>
+ {/if}
+
+ {foreach from=$forms item="form"}
+ {if $form.id != $default_form.id}
+ <option value="{$form.id}">{$form.title} ({$form.id})</option>
+ {/if}
+ {/foreach}
+ </select>
<input class="atlas_inputs" type="button" onclick="setAndSubmitData()" value="Make Atlas" />
</form>
View
10 site/www/make-atlas.php
@@ -10,6 +10,16 @@
/**** ... ****/
+ $forms = get_forms($dbh); //forms
+
+ if ($_GET["form_id"])
+ {
+ $default_form_id = $_GET["form_id"];
+ $default_form = get_form($dbh, $default_form_id);
+ } else {
+ $default_form = 'none';
+ }
+
$extent = array('ne' => $_GET['ne'], 'sw' => $_GET['sw']);
$center = $_GET['center'];

0 comments on commit 230434a

Please sign in to comment.