Browse files

Working on Auth

  • Loading branch information...
1 parent 8e8441c commit 08294665277fba2f2f0af1c6d4c27dca315cf255 iplk committed Oct 10, 2012
View
13 web/approvecomment.html
@@ -59,20 +59,21 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <li><a id = "logoutButton" href="#">Log out</a></li>
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
+ </form>
</ul>
</li>
<li id="loginMenu" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Log in <b class="caret"></b>
</a>
<ul class="dropdown-menu">
- <form action="" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
- <input id="usernameInput" type="text" placeholder="UserName">
- <input id="passwordInput" type="password" placeholder="Password">
-
+ <form action="http://api.riverwatch.co.nz:80/wainz/login" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input id="usernameInput" name="username" type="text" placeholder="UserName">
+ <input id="passwordInput" name="password" type="password" placeholder="Password">
+ <input class="btn btn-primary" id = "loginButton" type="submit" value="Submit">
</form>
- <li><a class="" id = "loginButton" href="#">Log In</a></li>
</ul>
</li>
View
13 web/approveincident.html
@@ -59,20 +59,21 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <li><a id = "logoutButton" href="#">Log out</a></li>
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
+ </form>
</ul>
</li>
<li id="loginMenu" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Log in <b class="caret"></b>
</a>
<ul class="dropdown-menu">
- <form action="" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
- <input id="usernameInput" type="text" placeholder="UserName">
- <input id="passwordInput" type="password" placeholder="Password">
-
+ <form action="http://api.riverwatch.co.nz:80/wainz/login" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input id="usernameInput" name="username" type="text" placeholder="UserName">
+ <input id="passwordInput" name="password" type="password" placeholder="Password">
+ <input class="btn btn-primary" id = "loginButton" type="submit" value="Submit">
</form>
- <li><a class="" id = "loginButton" href="#">Log In</a></li>
</ul>
</li>
View
2 web/assets/cslib/AjaxCommons.coffee
@@ -6,7 +6,7 @@ Author Matthew Betts
# Globals
-BASE_URL = "http://barretts.ecs.vuw.ac.nz:4567/wainz/"
+BASE_URL = "http://api.riverwatch.co.nz/wainz/"
CONTENT_TYPE = "contentType"
PROCESS_DATA = false
TIMEOUT = 5000
View
14 web/assets/cslib/Users.coffee
@@ -2,6 +2,9 @@ adminMenu = $ "#adminMenu"
logoutButton = $ "#logoutButton"
loginMenu = $ "#loginMenu"
loginButton = $ "#loginButton"
+usernameInput = $ "#usernameInput"
+passwordInput = $ "#passwordInput"
+form_login = $ "form_login"
setCookie = (name, value) ->
c_value = escape value
@@ -23,22 +26,25 @@ isAdmin = () ->
setLogInControl = () ->
if isAdmin()
- console.log "Showing admin menu"
adminMenu.css {display: "block"}
loginMenu.css {display: "none"}
else
- console.log "Hiding admin menu"
adminMenu.css {display: "none"}
loginMenu.css {display: "block"}
+### Old Testing controls
logoutButton.click ->
setCookie "status", "User"
setLogInControl()
-
+
loginButton.click ->
- setCookie "status", "Admin"
+ form_login.submit ->
+ alert "Done"
+
setLogInControl()
+###
+# Check for the admin cookie and set the status...
setLogInControl()
View
160 web/assets/cslib/mapview.coffee
@@ -1,160 +0,0 @@
-# Set up the Google map
-
-overlaysOnMap = []
-
-RemoveFromMap = () ->
- for o in overlaysOnMap
- o.setMap null
-
- overlaysOnMap = []
-
-SetupMap = () ->
-
- # Map set up
- mapCenter = new google.maps.LatLng -41.288889, 174.777222
-
-
- style = `
- [
- {
- "stylers": [
- { "visibility": "off" }
- ]
- },{
- "featureType": "water",
- "elementType": "geometry.fill",
- "stylers": [
- { "visibility": "on" },
- { "lightness": 1 },
- { "color": "#19232F" }
- ]
- },{
- "featureType": "landscape",
- "elementType": "geometry.fill",
- "stylers": [
- { "visibility": "on" },
- { "color": "#B4B577" }
- ]
- },{
- "featureType": "poi",
- "elementType": "geometry",
- "stylers": [
- { "visibility": "on" },
- { "color": "#C8DE9B" }
- ]
- }
- ]`
-
- mapOptions = {
- styles: style
- zoom: 9,
- center: mapCenter,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- disableDefaultUI: true
- }
-
- elem = document.getElementById 'map_canvas'
-
- new google.maps.Map elem, mapOptions
-
-
-googleMap = SetupMap()
-google.maps.event.addDomListener(window, "load", googleMap);
-
-# Fix the height of the map, twitter bootstrap fucks it up, it probbly fucks up some other map things aswell
-mapCanvas = $ "#map_canvas"
-mapCanvas.css {height: "100%" }
-# mapCanvasHeight = mapCanvas.css "height"
-# mapCanvas.css {height: "#{mapCanvasHeight - 50}px"}
-
-# Zoom listner
-# google.maps.event.addListener googleMap, "zoom_changed", ->
-# console.log "Zoom #{googleMap.getZoom()} "
-size = 0.05
-current = 0;
-range = 16;
-
-createOverlay = (incident) ->
-
- geo = incident.geolocation
-
- lat = new google.maps.LatLng geo.lat - size, geo.long - size * 2
- lng = new google.maps.LatLng geo.lat + size, geo.long + size * 2
-
- imageBounds = new google.maps.LatLngBounds lat, lng
- overlay = new google.maps.GroundOverlay "#{incident.thumbnail_url}", imageBounds
-
- google.maps.event.addListener overlay, 'click', () =>
- window.CreateIncidentModal incident.id
-
- overlay.setMap googleMap
- overlaysOnMap.push overlay
-
-onSuccess = (data) ->
- for incident in data.incidents
- console.log "creating incident #{current}"
- current++
- createOverlay incident
-
-onFail = (data) ->
- console.log "Rest Call failed"
-
-window.RWCall onSuccess, onFail, {}, "approved", "/start=#{current}/number=#{range}", "GET"
-
-
-# Controls
-nextButton = $ "#nextBtn"
-prevButton = $ "#prevBtn"
-d16Button = $ "#d16"
-d32Button = $ "#d32"
-d64Button = $ "#d64"
-d128Button = $ "#d128"
-d256Button = $ "#d256"
-
-nextButton.click ->
- RemoveFromMap()
- console.log "Clicked Next"
- window.RWCall onSuccess, onFail, {}, "approved", "/start=#{current}/number=#{range}", "GET"
-
-prevButton.click ->
- RemoveFromMap()
- console.log "Clicked Prev"
- current = if current - range > 0 then current - range else 0;
- window.RWCall onSuccess, onFail, {}, "approved", "/start=#{current}/number=#{range}", "GET"
-
-changeRange = (newRange) ->
- RemoveFromMap()
- current = if current - range > 0 then current - range else 0;
- range = newRange;
- window.RWCall onSuccess, onFail, {}, "approved", "/start=#{current}/number=#{range}", "GET"
-
-d16Button.click -> changeRange 16
-d32Button.click -> changeRange 32
-d64Button.click -> changeRange 64
-d128Button.click -> changeRange 128
-d256Button.click -> changeRange 256
-
-###
-for incident in incidentList.Incidents
-
- newarkLat = new google.maps.LatLng incident.Lat - size, incident.Lng - size * 2
- newarkLng = new google.maps.LatLng incident.Lat + size, incident.Lng + size * 2
-
- borderCoordinates = [
- new google.maps.LatLng incident.Lat - size, incident.Lng - size * 2
- new google.maps.LatLng incident.Lat - size, incident.Lng + size * 2
- new google.maps.LatLng incident.Lat + size, incident.Lng + size * 2
- new google.maps.LatLng incident.Lat + size, incident.Lng - size * 2
- new google.maps.LatLng incident.Lat - size, incident.Lng - size * 2
- ]
-
- border = new google.maps.Polyline {
- path: borderCoordinates,
- strokeColor: "000000",
- strokeOpacity: 1,
- strokeWeight: 1
- }
-
-
- border.setMap googleMap
-###
View
2 web/assets/js/AjaxCommons.js 100755 → 100644
@@ -7,7 +7,7 @@ Author Matthew Betts
(function() {
var BASE_URL, CONTENT_TYPE, DATA_TYPE, PROCESS_DATA, RWCall, TIMEOUT;
- BASE_URL = "http://api.riverwatch:80/wainz/";
+ BASE_URL = "http://api.riverwatch.co.nz/wainz/";
CONTENT_TYPE = "contentType";
View
0 web/assets/js/AjaxCommonsMock.js 100755 → 100644
File mode changed.
View
0 web/assets/js/ApproveComment.js 100755 → 100644
File mode changed.
View
0 web/assets/js/ApproveIncident.js 100755 → 100644
File mode changed.
View
0 web/assets/js/Feedback.js 100755 → 100644
File mode changed.
View
0 web/assets/js/GridView.js 100755 → 100644
File mode changed.
View
0 web/assets/js/IncidentModal.js 100755 → 100644
File mode changed.
View
0 web/assets/js/IncidentThumbnail.js 100755 → 100644
File mode changed.
View
0 web/assets/js/Index.js 100755 → 100644
File mode changed.
View
190 web/assets/js/MapView.js
@@ -1,190 +0,0 @@
-// Generated by CoffeeScript 1.3.3
-(function() {
- var RemoveFromMap, SetupMap, changeRange, createOverlay, current, d128Button, d16Button, d256Button, d32Button, d64Button, googleMap, mapCanvas, nextButton, onFail, onSuccess, overlaysOnMap, prevButton, range, size;
-
- overlaysOnMap = [];
-
- RemoveFromMap = function() {
- var o, _i, _len;
- for (_i = 0, _len = overlaysOnMap.length; _i < _len; _i++) {
- o = overlaysOnMap[_i];
- o.setMap(null);
- }
- return overlaysOnMap = [];
- };
-
- SetupMap = function() {
- var elem, mapCenter, mapOptions, style;
- mapCenter = new google.maps.LatLng(-41.288889, 174.777222);
- style =
- [
- {
- "stylers": [
- { "visibility": "off" }
- ]
- },{
- "featureType": "water",
- "elementType": "geometry.fill",
- "stylers": [
- { "visibility": "on" },
- { "lightness": 1 },
- { "color": "#19232F" }
- ]
- },{
- "featureType": "landscape",
- "elementType": "geometry.fill",
- "stylers": [
- { "visibility": "on" },
- { "color": "#B4B577" }
- ]
- },{
- "featureType": "poi",
- "elementType": "geometry",
- "stylers": [
- { "visibility": "on" },
- { "color": "#C8DE9B" }
- ]
- }
- ];
- mapOptions = {
- styles: style,
- zoom: 9,
- center: mapCenter,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- disableDefaultUI: true
- };
- elem = document.getElementById('map_canvas');
- return new google.maps.Map(elem, mapOptions);
- };
-
- googleMap = SetupMap();
-
- google.maps.event.addDomListener(window, "load", googleMap);
-
- mapCanvas = $("#map_canvas");
-
- mapCanvas.css({
- height: "100%"
- });
-
- size = 0.05;
-
- current = 0;
-
- range = 16;
-
- createOverlay = function(incident) {
- var geo, imageBounds, lat, lng, overlay,
- _this = this;
- geo = incident.geolocation;
- lat = new google.maps.LatLng(geo.lat - size, geo.long - size * 2);
- lng = new google.maps.LatLng(geo.lat + size, geo.long + size * 2);
- imageBounds = new google.maps.LatLngBounds(lat, lng);
- overlay = new google.maps.GroundOverlay("" + incident.thumbnail_url, imageBounds);
- google.maps.event.addListener(overlay, 'click', function() {
- return window.CreateIncidentModal(incident.id);
- });
- overlay.setMap(googleMap);
- return overlaysOnMap.push(overlay);
- };
-
- onSuccess = function(data) {
- var incident, _i, _len, _ref, _results;
- _ref = data.incidents;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- incident = _ref[_i];
- console.log("creating incident " + current);
- current++;
- _results.push(createOverlay(incident));
- }
- return _results;
- };
-
- onFail = function(data) {
- return console.log("Rest Call failed");
- };
-
- window.RWCall(onSuccess, onFail, {}, "approved", "/start=" + current + "/number=" + range, "GET");
-
- nextButton = $("#nextBtn");
-
- prevButton = $("#prevBtn");
-
- d16Button = $("#d16");
-
- d32Button = $("#d32");
-
- d64Button = $("#d64");
-
- d128Button = $("#d128");
-
- d256Button = $("#d256");
-
- nextButton.click(function() {
- RemoveFromMap();
- console.log("Clicked Next");
- return window.RWCall(onSuccess, onFail, {}, "approved", "/start=" + current + "/number=" + range, "GET");
- });
-
- prevButton.click(function() {
- RemoveFromMap();
- console.log("Clicked Prev");
- current = current - range > 0 ? current - range : 0;
- return window.RWCall(onSuccess, onFail, {}, "approved", "/start=" + current + "/number=" + range, "GET");
- });
-
- changeRange = function(newRange) {
- RemoveFromMap();
- current = current - range > 0 ? current - range : 0;
- range = newRange;
- return window.RWCall(onSuccess, onFail, {}, "approved", "/start=" + current + "/number=" + range, "GET");
- };
-
- d16Button.click(function() {
- return changeRange(16);
- });
-
- d32Button.click(function() {
- return changeRange(32);
- });
-
- d64Button.click(function() {
- return changeRange(64);
- });
-
- d128Button.click(function() {
- return changeRange(128);
- });
-
- d256Button.click(function() {
- return changeRange(256);
- });
-
- /*
- for incident in incidentList.Incidents
-
- newarkLat = new google.maps.LatLng incident.Lat - size, incident.Lng - size * 2
- newarkLng = new google.maps.LatLng incident.Lat + size, incident.Lng + size * 2
-
- borderCoordinates = [
- new google.maps.LatLng incident.Lat - size, incident.Lng - size * 2
- new google.maps.LatLng incident.Lat - size, incident.Lng + size * 2
- new google.maps.LatLng incident.Lat + size, incident.Lng + size * 2
- new google.maps.LatLng incident.Lat + size, incident.Lng - size * 2
- new google.maps.LatLng incident.Lat - size, incident.Lng - size * 2
- ]
-
- border = new google.maps.Polyline {
- path: borderCoordinates,
- strokeColor: "000000",
- strokeOpacity: 1,
- strokeWeight: 1
- }
-
-
- border.setMap googleMap
- */
-
-
-}).call(this);
View
30 web/assets/js/Users.js 100755 → 100644
@@ -1,5 +1,5 @@
(function() {
- var adminMenu, getCookie, isAdmin, loginButton, loginMenu, logoutButton, setCookie, setLogInControl;
+ var adminMenu, form_login, getCookie, isAdmin, loginButton, loginMenu, logoutButton, passwordInput, setCookie, setLogInControl, usernameInput;
adminMenu = $("#adminMenu");
@@ -9,6 +9,12 @@
loginButton = $("#loginButton");
+ usernameInput = $("#usernameInput");
+
+ passwordInput = $("#passwordInput");
+
+ form_login = $("form_login");
+
setCookie = function(name, value) {
var c_name, c_value;
c_value = escape(value);
@@ -35,15 +41,13 @@
setLogInControl = function() {
if (isAdmin()) {
- console.log("Showing admin menu");
adminMenu.css({
display: "block"
});
return loginMenu.css({
display: "none"
});
} else {
- console.log("Hiding admin menu");
adminMenu.css({
display: "none"
});
@@ -53,15 +57,17 @@
}
};
- logoutButton.click(function() {
- setCookie("status", "User");
- return setLogInControl();
- });
-
- loginButton.click(function() {
- setCookie("status", "Admin");
- return setLogInControl();
- });
+ /* Old Testing controls
+ logoutButton.click ->
+ setCookie "status", "User"
+ setLogInControl()
+
+ loginButton.click ->
+ form_login.submit ->
+ alert "Done"
+
+ setLogInControl()
+ */
setLogInControl();
View
169 web/assets/js/bootstrap-carousel.js
@@ -1,169 +0,0 @@
-/* ==========================================================
- * bootstrap-carousel.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#carousel
- * ==========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* CAROUSEL CLASS DEFINITION
- * ========================= */
-
- var Carousel = function (element, options) {
- this.$element = $(element)
- this.options = options
- this.options.slide && this.slide(this.options.slide)
- this.options.pause == 'hover' && this.$element
- .on('mouseenter', $.proxy(this.pause, this))
- .on('mouseleave', $.proxy(this.cycle, this))
- }
-
- Carousel.prototype = {
-
- cycle: function (e) {
- if (!e) this.paused = false
- this.options.interval
- && !this.paused
- && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
- return this
- }
-
- , to: function (pos) {
- var $active = this.$element.find('.active')
- , children = $active.parent().children()
- , activePos = children.index($active)
- , that = this
-
- if (pos > (children.length - 1) || pos < 0) return
-
- if (this.sliding) {
- return this.$element.one('slid', function () {
- that.to(pos)
- })
- }
-
- if (activePos == pos) {
- return this.pause().cycle()
- }
-
- return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
- }
-
- , pause: function (e) {
- if (!e) this.paused = true
- clearInterval(this.interval)
- this.interval = null
- return this
- }
-
- , next: function () {
- if (this.sliding) return
- return this.slide('next')
- }
-
- , prev: function () {
- if (this.sliding) return
- return this.slide('prev')
- }
-
- , slide: function (type, next) {
- var $active = this.$element.find('.active')
- , $next = next || $active[type]()
- , isCycling = this.interval
- , direction = type == 'next' ? 'left' : 'right'
- , fallback = type == 'next' ? 'first' : 'last'
- , that = this
- , e = $.Event('slide')
-
- this.sliding = true
-
- isCycling && this.pause()
-
- $next = $next.length ? $next : this.$element.find('.item')[fallback]()
-
- if ($next.hasClass('active')) return
-
- if ($.support.transition && this.$element.hasClass('slide')) {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $next.addClass(type)
- $next[0].offsetWidth // force reflow
- $active.addClass(direction)
- $next.addClass(direction)
- this.$element.one($.support.transition.end, function () {
- $next.removeClass([type, direction].join(' ')).addClass('active')
- $active.removeClass(['active', direction].join(' '))
- that.sliding = false
- setTimeout(function () { that.$element.trigger('slid') }, 0)
- })
- } else {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $active.removeClass('active')
- $next.addClass('active')
- this.sliding = false
- this.$element.trigger('slid')
- }
-
- isCycling && this.cycle()
-
- return this
- }
-
- }
-
-
- /* CAROUSEL PLUGIN DEFINITION
- * ========================== */
-
- $.fn.carousel = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('carousel')
- , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
- if (!data) $this.data('carousel', (data = new Carousel(this, options)))
- if (typeof option == 'number') data.to(option)
- else if (typeof option == 'string' || (option = options.slide)) data[option]()
- else if (options.interval) data.cycle()
- })
- }
-
- $.fn.carousel.defaults = {
- interval: 5000
- , pause: 'hover'
- }
-
- $.fn.carousel.Constructor = Carousel
-
-
- /* CAROUSEL DATA-API
- * ================= */
-
- $(function () {
- $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
- var $this = $(this), href
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
- $target.carousel(options)
- e.preventDefault()
- })
- })
-
-}(window.jQuery);
View
218 web/assets/js/bootstrap-modal.js
@@ -1,218 +0,0 @@
-/* =========================================================
- * bootstrap-modal.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#modals
- * =========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================= */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* MODAL CLASS DEFINITION
- * ====================== */
-
- var Modal = function (content, options) {
- this.options = options
- this.$element = $(content)
- .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
- }
-
- Modal.prototype = {
-
- constructor: Modal
-
- , toggle: function () {
- return this[!this.isShown ? 'show' : 'hide']()
- }
-
- , show: function () {
- var that = this
- , e = $.Event('show')
-
- this.$element.trigger(e)
-
- if (this.isShown || e.isDefaultPrevented()) return
-
- $('body').addClass('modal-open')
-
- this.isShown = true
-
- escape.call(this)
- backdrop.call(this, function () {
- var transition = $.support.transition && that.$element.hasClass('fade')
-
- if (!that.$element.parent().length) {
- that.$element.appendTo(document.body) //don't move modals dom position
- }
-
- that.$element
- .show()
-
- if (transition) {
- that.$element[0].offsetWidth // force reflow
- }
-
- that.$element.addClass('in')
-
- transition ?
- that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
- that.$element.trigger('shown')
-
- })
- }
-
- , hide: function (e) {
- e && e.preventDefault()
-
- var that = this
-
- e = $.Event('hide')
-
- this.$element.trigger(e)
-
- if (!this.isShown || e.isDefaultPrevented()) return
-
- this.isShown = false
-
- $('body').removeClass('modal-open')
-
- escape.call(this)
-
- this.$element.removeClass('in')
-
- $.support.transition && this.$element.hasClass('fade') ?
- hideWithTransition.call(this) :
- hideModal.call(this)
- }
-
- }
-
-
- /* MODAL PRIVATE METHODS
- * ===================== */
-
- function hideWithTransition() {
- var that = this
- , timeout = setTimeout(function () {
- that.$element.off($.support.transition.end)
- hideModal.call(that)
- }, 500)
-
- this.$element.one($.support.transition.end, function () {
- clearTimeout(timeout)
- hideModal.call(that)
- })
- }
-
- function hideModal(that) {
- this.$element
- .hide()
- .trigger('hidden')
-
- backdrop.call(this)
- }
-
- function backdrop(callback) {
- var that = this
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
-
- if (this.isShown && this.options.backdrop) {
- var doAnimate = $.support.transition && animate
-
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
- .appendTo(document.body)
-
- if (this.options.backdrop != 'static') {
- this.$backdrop.click($.proxy(this.hide, this))
- }
-
- if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
-
- this.$backdrop.addClass('in')
-
- doAnimate ?
- this.$backdrop.one($.support.transition.end, callback) :
- callback()
-
- } else if (!this.isShown && this.$backdrop) {
- this.$backdrop.removeClass('in')
-
- $.support.transition && this.$element.hasClass('fade')?
- this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
- removeBackdrop.call(this)
-
- } else if (callback) {
- callback()
- }
- }
-
- function removeBackdrop() {
- this.$backdrop.remove()
- this.$backdrop = null
- }
-
- function escape() {
- var that = this
- if (this.isShown && this.options.keyboard) {
- $(document).on('keyup.dismiss.modal', function ( e ) {
- e.which == 27 && that.hide()
- })
- } else if (!this.isShown) {
- $(document).off('keyup.dismiss.modal')
- }
- }
-
-
- /* MODAL PLUGIN DEFINITION
- * ======================= */
-
- $.fn.modal = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('modal')
- , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
- if (!data) $this.data('modal', (data = new Modal(this, options)))
- if (typeof option == 'string') data[option]()
- else if (options.show) data.show()
- })
- }
-
- $.fn.modal.defaults = {
- backdrop: true
- , keyboard: true
- , show: true
- }
-
- $.fn.modal.Constructor = Modal
-
-
- /* MODAL DATA-API
- * ============== */
-
- $(function () {
- $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
- var $this = $(this), href
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
-
- e.preventDefault()
- $target.modal(option)
- })
- })
-
-}(window.jQuery);
View
188 web/assets/js/mapview.js
@@ -1,188 +0,0 @@
-(function() {
- var RemoveFromMap, SetupMap, changeRange, createOverlay, current, d128Button, d16Button, d256Button, d32Button, d64Button, googleMap, mapCanvas, nextButton, onFail, onSuccess, overlaysOnMap, prevButton, range, size;
-
- overlaysOnMap = [];
-
- RemoveFromMap = function() {
- var o, _i, _len;
- for (_i = 0, _len = overlaysOnMap.length; _i < _len; _i++) {
- o = overlaysOnMap[_i];
- o.setMap(null);
- }
- return overlaysOnMap = [];
- };
-
- SetupMap = function() {
- var elem, mapCenter, mapOptions, style;
- mapCenter = new google.maps.LatLng(-41.288889, 174.777222);
- style =
- [
- {
- "stylers": [
- { "visibility": "off" }
- ]
- },{
- "featureType": "water",
- "elementType": "geometry.fill",
- "stylers": [
- { "visibility": "on" },
- { "lightness": 1 },
- { "color": "#19232F" }
- ]
- },{
- "featureType": "landscape",
- "elementType": "geometry.fill",
- "stylers": [
- { "visibility": "on" },
- { "color": "#B4B577" }
- ]
- },{
- "featureType": "poi",
- "elementType": "geometry",
- "stylers": [
- { "visibility": "on" },
- { "color": "#C8DE9B" }
- ]
- }
- ];
- mapOptions = {
- styles: style,
- zoom: 9,
- center: mapCenter,
- mapTypeId: google.maps.MapTypeId.ROADMAP,
- disableDefaultUI: true
- };
- elem = document.getElementById('map_canvas');
- return new google.maps.Map(elem, mapOptions);
- };
-
- googleMap = SetupMap();
-
- google.maps.event.addDomListener(window, "load", googleMap);
-
- mapCanvas = $("#map_canvas");
-
- mapCanvas.css({
- height: "100%"
- });
-
- size = 0.05;
-
- current = 0;
-
- range = 16;
-
- createOverlay = function(incident) {
- var geo, imageBounds, lat, lng, overlay,
- _this = this;
- geo = incident.geolocation;
- lat = new google.maps.LatLng(geo.lat - size, geo.long - size * 2);
- lng = new google.maps.LatLng(geo.lat + size, geo.long + size * 2);
- imageBounds = new google.maps.LatLngBounds(lat, lng);
- overlay = new google.maps.GroundOverlay("" + incident.thumbnail_url, imageBounds);
- google.maps.event.addListener(overlay, 'click', function() {
- return window.CreateIncidentModal(incident.id);
- });
- overlay.setMap(googleMap);
- return overlaysOnMap.push(overlay);
- };
-
- onSuccess = function(data) {
- var incident, _i, _len, _ref, _results;
- _ref = data.incidents;
- _results = [];
- for (_i = 0, _len = _ref.length; _i < _len; _i++) {
- incident = _ref[_i];
- console.log("creating incident " + current);
- current++;
- _results.push(createOverlay(incident));
- }
- return _results;
- };
-
- onFail = function(data) {
- return console.log("Rest Call failed");
- };
-
- window.RWCall(onSuccess, onFail, {}, "approved", "/start=" + current + "/number=" + range, "GET");
-
- nextButton = $("#nextBtn");
-
- prevButton = $("#prevBtn");
-
- d16Button = $("#d16");
-
- d32Button = $("#d32");
-
- d64Button = $("#d64");
-
- d128Button = $("#d128");
-
- d256Button = $("#d256");
-
- nextButton.click(function() {
- RemoveFromMap();
- console.log("Clicked Next");
- return window.RWCall(onSuccess, onFail, {}, "approved", "/start=" + current + "/number=" + range, "GET");
- });
-
- prevButton.click(function() {
- RemoveFromMap();
- console.log("Clicked Prev");
- current = current - range > 0 ? current - range : 0;
- return window.RWCall(onSuccess, onFail, {}, "approved", "/start=" + current + "/number=" + range, "GET");
- });
-
- changeRange = function(newRange) {
- RemoveFromMap();
- current = current - range > 0 ? current - range : 0;
- range = newRange;
- return window.RWCall(onSuccess, onFail, {}, "approved", "/start=" + current + "/number=" + range, "GET");
- };
-
- d16Button.click(function() {
- return changeRange(16);
- });
-
- d32Button.click(function() {
- return changeRange(32);
- });
-
- d64Button.click(function() {
- return changeRange(64);
- });
-
- d128Button.click(function() {
- return changeRange(128);
- });
-
- d256Button.click(function() {
- return changeRange(256);
- });
-
- /*
- for incident in incidentList.Incidents
-
- newarkLat = new google.maps.LatLng incident.Lat - size, incident.Lng - size * 2
- newarkLng = new google.maps.LatLng incident.Lat + size, incident.Lng + size * 2
-
- borderCoordinates = [
- new google.maps.LatLng incident.Lat - size, incident.Lng - size * 2
- new google.maps.LatLng incident.Lat - size, incident.Lng + size * 2
- new google.maps.LatLng incident.Lat + size, incident.Lng + size * 2
- new google.maps.LatLng incident.Lat + size, incident.Lng - size * 2
- new google.maps.LatLng incident.Lat - size, incident.Lng - size * 2
- ]
-
- border = new google.maps.Polyline {
- path: borderCoordinates,
- strokeColor: "000000",
- strokeOpacity: 1,
- strokeWeight: 1
- }
-
-
- border.setMap googleMap
- */
-
-}).call(this);
View
13 web/feedback.html
@@ -59,20 +59,21 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <li><a id = "logoutButton" href="#">Log out</a></li>
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
+ </form>
</ul>
</li>
<li id="loginMenu" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Log in <b class="caret"></b>
</a>
<ul class="dropdown-menu">
- <form action="" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
- <input id="usernameInput" type="text" placeholder="UserName">
- <input id="passwordInput" type="password" placeholder="Password">
-
+ <form action="http://api.riverwatch.co.nz:80/wainz/login" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input id="usernameInput" name="username" type="text" placeholder="UserName">
+ <input id="passwordInput" name="password" type="password" placeholder="Password">
+ <input class="btn btn-primary" id = "loginButton" type="submit" value="Submit">
</form>
- <li><a class="" id = "loginButton" href="#">Log In</a></li>
</ul>
</li>
</ul>
View
13 web/gridview.html
@@ -59,20 +59,21 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <li><a id = "logoutButton" href="#">Log out</a></li>
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
+ </form>
</ul>
</li>
<li id="loginMenu" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Log in <b class="caret"></b>
</a>
<ul class="dropdown-menu">
- <form action="" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
- <input id="usernameInput" type="text" placeholder="UserName">
- <input id="passwordInput" type="password" placeholder="Password">
-
+ <form action="http://api.riverwatch.co.nz:80/wainz/login" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input id="usernameInput" name="username" type="text" placeholder="UserName">
+ <input id="passwordInput" name="password" type="password" placeholder="Password">
+ <input class="btn btn-primary" id = "loginButton" type="submit" value="Submit">
</form>
- <li><a class="" id = "loginButton" href="#">Log In</a></li>
</ul>
</li>
</ul>
View
13 web/index.html
@@ -60,20 +60,21 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <li><a id = "logoutButton" href="#">Log out</a></li>
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
+ </form>
</ul>
</li>
<li id="loginMenu" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Log in <b class="caret"></b>
</a>
<ul class="dropdown-menu">
- <form action="" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
- <input id="usernameInput" type="text" placeholder="UserName">
- <input id="passwordInput" type="password" placeholder="Password">
-
+ <form action="http://api.riverwatch.co.nz:80/wainz/login" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input id="usernameInput" name="username" type="text" placeholder="UserName">
+ <input id="passwordInput" name="password" type="password" placeholder="Password">
+ <input class="btn btn-primary" id = "loginButton" type="submit" value="Submit">
</form>
- <li><a class="" id = "loginButton" href="#">Log In</a></li>
</ul>
</li>
</ul>
View
15 web/mapview.html
@@ -61,20 +61,21 @@
<ul class="dropdown-menu">
<li><a href="approveincident.html">Approve Incidents</a></li>
<li><a href="approvecomment.html">Approve Comments</a></li>
- <li><a id = "logoutButton" href="#">Log out</a></li>
+ <form action="http://api.riverwatch.co.nz:80/wainz/logout" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input class="btn btn-primary" id = "logoutButton" type="submit" value="Log Out">
+ </form>
</ul>
</li>
<li id="loginMenu" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Log in <b class="caret"></b>
</a>
<ul class="dropdown-menu">
- <form action="" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
- <input id="usernameInput" type="text" placeholder="UserName">
- <input id="passwordInput" type="password" placeholder="Password">
-
+ <form action="http://api.riverwatch.co.nz:80/wainz/login" id="form_login" style= "padding:5px;margin:0px;" accept-charset="utf-8" method="post">
+ <input id="usernameInput" name="username" type="text" placeholder="UserName">
+ <input id="passwordInput" name="password" type="password" placeholder="Password">
+ <input class="btn btn-primary" id = "loginButton" type="submit" value="Submit">
</form>
- <li><a class="" id = "loginButton" href="#">Log In</a></li>
</ul>
</li>
</ul>
@@ -132,7 +133,7 @@
<script src="assets/js/bootstrap-modal.js"></script>
<script src="assets/js/AjaxCommons.js"></script>
- <script src="assets/js/MapView.js"></script>
+ <script src="assets/js/Mapview.js"></script>
<script src="assets/js/IncidentModal.js"></script>
<script src="assets/js/Users.js"></script>

0 comments on commit 0829466

Please sign in to comment.