diff options
-rw-r--r-- | www/around.html | 3 | ||||
-rw-r--r-- | www/js/map-OpenLayers.js | 61 | ||||
-rw-r--r-- | www/js/mobile.js | 30 | ||||
-rw-r--r-- | www/report.html | 76 |
4 files changed, 80 insertions, 90 deletions
diff --git a/www/around.html b/www/around.html index d303fbb..f37306a 100644 --- a/www/around.html +++ b/www/around.html @@ -2,7 +2,7 @@ <div class="table-cell"> <div class="container" data-enhance="false"> - <a id="mark-here"> + <a id="mark-here" class="nodisplay"> Mark this point </a> <div class="content" role="main"> @@ -38,6 +38,7 @@ <p id="sub_map_links"> <a id="hide_pins_link" rel="nofollow" href="">Hide pins</a> <a id="all_pins_link" rel="nofollow" href="">Show old</a> + <a id="saved_reports" rel="nofollow" href="my_reports.html">Saved reports</a> </p> </div> </form> diff --git a/www/js/map-OpenLayers.js b/www/js/map-OpenLayers.js index a25e43f..9abf12e 100644 --- a/www/js/map-OpenLayers.js +++ b/www/js/map-OpenLayers.js @@ -247,6 +247,7 @@ function show_map(event) { ensureNonZeroHeight(); set_map_config(); + $('#mark-here').hide(); fixmystreet.map = new OpenLayers.Map("map", { controls: fixmystreet.controls, @@ -349,6 +350,14 @@ function show_map(event) { fixmystreet_onload(); } fixContentHeight(fixmystreet.map); + + if ( fixmystreet.page == 'around' ) { + if ( localStorage.currentReport ) { + mark_here(); + } else { + $('#mark-here').show(); + } + } } $(document).delegate('#around-page', 'pageshow', show_map ); @@ -561,58 +570,6 @@ OpenLayers.Control.Click = OpenLayers.Class(OpenLayers.Control, { heightFix('#report-a-problem-sidebar', '.content', 26); } - // If we clicked the map somewhere inconvenient - var sidebar = $('#report-a-problem-sidebar'); - if (sidebar.css('position') == 'absolute') { - var w = sidebar.width(), h = sidebar.height(), - o = sidebar.offset(), - $map_box = $('#map_box'), bo = $map_box.offset(); - // e.xy is relative to top left of map, which might not be top left of page - e.xy.x += bo.left; - e.xy.y += bo.top; - if (e.xy.y <= o.top || (e.xy.x >= o.left && e.xy.x <= o.left + w + 24 && e.xy.y >= o.top && e.xy.y <= o.top + h + 64)) { - // top of the page, pin hidden by header; - // or underneath where the new sidebar will appear - lonlat.transform( - new OpenLayers.Projection("EPSG:4326"), - fixmystreet.map.getProjectionObject() - ); - var p = fixmystreet.map.getViewPortPxFromLonLat(lonlat); - p.x -= ( o.left + w ) / 2; - lonlat = fixmystreet.map.getLonLatFromViewPortPx(p); - fixmystreet.map.panTo(lonlat); - } - } - - $('#sub_map_links').hide(); - var $map_box = $('#map_box'); - $map_box.append( - '<p id="mob_sub_map_links">' + - '<a href="#" id="try_again">Try again</a>' + - '<a href="#ok" id="mob_ok">OK</a>' + - '</p>' - ); - // .css({ position: 'relative', width: width, height: height, marginBottom: '1em' }); - // Making it relative here makes it much easier to do the scrolling later - - $('.mobile-map-banner').text('Right place?').prepend('<a href="index.html">home</a>'); - - $('#try_again').on('click', function(){ - fixmystreet.bbox_strategy.activate(); - fixmystreet.markers.refresh( { force: true } ); - if ( fixmystreet.state_pins_were_hidden ) { - // If we had pins hidden when we clicked map (which had to show the pin layer as I'm doing it in one layer), hide them again. - $('#hide_pins_link').click(); - } - fixmystreet.drag.deactivate(); - $('#sub_map_links').show(); - $('#mob_sub_map_links').remove(); - }); - $('#mob_ok').on('click', function(){ - localStorage.latitude = $('#fixmystreet\\.latitude').val(); - localStorage.longitude = $('#fixmystreet\\.longitude').val(); - $.mobile.changePage('submit-problem.html') - }); fixmystreet.page = 'new'; location.hash = 'report'; diff --git a/www/js/mobile.js b/www/js/mobile.js index 98d3f2b..db5d554 100644 --- a/www/js/mobile.js +++ b/www/js/mobile.js @@ -594,7 +594,35 @@ function display_saved_report() { } } +function complete_report() { + var reports = localStorage.getObject('reports'); + var r = reports[localStorage.currentReport]; + + if ( r.lat && r.lon ) { + show_around( r.lat, r.lon ); + } else { + getPosition(); + } +} + function submit_problem_show() { + var reports, r; + + if ( localStorage.currentReport ) { + reports = localStorage.getObject('reports'); + r = reports[localStorage.currentReport]; + + $('#form_title').val(r.title); + $('#form_detail').val(r.detail); + if ( r.may_show_name == 0 ) { + $('#form_may_show_name').attr('checked', 'off'); + } + //category: $('#form_category').val(); + $('#form_phone').val(r.phone); + $('#pc').val(r.pc); + + } + $('#mapForm').submit(postReport); $('#mapForm :input[type=submit]').on('click', function() { submit_clicked = $(this); }); $('#side-form, #site-logo').show(); @@ -647,6 +675,7 @@ function decide_front_page() { } localStorage.offline = 0; + delete localStorage.currentReport; if ( navigator.network.connection.type == Connection.NONE || navigator.network.connection.type == Connection.UNKNOWN ) { @@ -673,3 +702,4 @@ $(document).delegate('#no-connection-page', 'pageshow', check_for_gps); $(document).delegate('.saved-report', 'click', open_saved_report_page); $(document).delegate('#mark-here', 'click', mark_here); $(document).delegate('#create_report', 'click', create_offline); +$(document).delegate('#complete_report', 'click', complete_report); diff --git a/www/report.html b/www/report.html index 94927ca..47656d5 100644 --- a/www/report.html +++ b/www/report.html @@ -1,44 +1,46 @@ <div class="wrapper" id="report-page" data-role="page"> <div class="table-cell"> - <div class="container" data-role="content"> <div class="content" id="report" role="main" data-enhance="false"> - - -<input type="hidden" name="zoom" value="3"> -<script type="text/javascript"> -var fixmystreet = { - 'page': 'report', - 'area': '', - 'all_pins': '', - 'latitude': 0, - 'longitude': 0, - 'zoom': 3, - 'numZoomLevels': 5, - 'zoomOffset': 13, - 'map_type': '', - 'pins': '' -}; -</script> -<div id="map_box"> - <div id="map"></div> -</div> - -<div class="problem-header cf"> - <h1 id="title"></h1> - -<div id="report-img" class="update-img"> - <a id="photo_link" href="" rel="fancy"><img id="photo" alt="Photo of this report" width="250" src=""><span>zoom</span></a> -</div> - -<div id="details"> -</div> - -</div> - - + <input type="hidden" name="zoom" value="3"> + <script type="text/javascript"> + var fixmystreet = { + 'page': 'report', + 'area': '', + 'all_pins': '', + 'latitude': 0, + 'longitude': 0, + 'zoom': 3, + 'numZoomLevels': 5, + 'zoomOffset': 13, + 'map_type': '', + 'pins': '' + }; + </script> + <div id="map_box"> + <div id="map"></div> + </div> + + <div class="problem-header cf"> + <h1 id="title"></h1> + + <div id="report-img" class="update-img"> + <a id="photo_link" href="" rel="fancy"><img id="photo" alt="Photo of this report" width="250" src=""><span>zoom</span></a> + </div> + + <div id="details"> + </div> + </div> + + <div id="report_complete" class="form-box"> + <h5>Complete this report</h5> + <div class="form-txt-submit-box"> + <input class="green-btn" type="button" id="complete_report" name="complete_report" value="Complete"> + </div> + </div> </div> </div> + <div data-role="footer" data-id="foo1" data-position="fixed"> <div data-role="navbar"> <ul> @@ -46,7 +48,7 @@ var fixmystreet = { <li><a href="account.html">Account</a></li> <li><a href="about.html">Info</a></li> </ul> - </div><!-- /navbar --> + </div> </div> - </div><!-- .table-cell --> + </div> </div> |