Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/flavour/eden

  • Loading branch information...
commit 505eb6ffbb8fc32fdbbe63fdab4c19d87e53ca86 2 parents 7b34081 + 9c4c78f
@flavour authored
Showing with 2,457 additions and 3,381 deletions.
  1. +1 −1  controllers/project.py
  2. +2 −1  modules/eden/asset.py
  3. +4 −3 modules/eden/hrm.py
  4. +2 −2 modules/eden/menus.py
  5. +6 −5 modules/eden/project.py
  6. +325 −169 modules/eden/transport.py
  7. +8 −6 modules/s3/s3search.py
  8. +2 −2 modules/s3cfg.py
  9. +3 −2 modules/tests/asset/asset.py
  10. +10 −5 modules/tests/asset/create_asset.py
  11. +4 −3 modules/tests/hrm/create_staff.py
  12. +4 −3 modules/tests/hrm/create_volunteer.py
  13. +3 −3 modules/tests/inv/create_catalog.py
  14. +1 −1  modules/tests/inv/create_warehouse.py
  15. +6 −2 modules/tests/inv/receive_item.py
  16. +4 −0 modules/tests/inv/send_item.py
  17. +8 −0 modules/tests/inv/send_receive_item.py
  18. +1 −1  modules/tests/member/create_member.py
  19. +5 −8 modules/tests/project/create_project.py
  20. +4 −3 modules/unit_tests/s3/s3widgets.py
  21. +132 −127 private/templates/IFRC/project_activity_type.csv
  22. +71 −67 private/templates/IFRC/project_theme.csv
  23. +1 −1  static/formats/s3csv/project/activity_type.csv
  24. +1 −0  static/formats/s3csv/project/activity_type.xsl
  25. +23 −9 static/scripts/S3/S3.js
  26. +23 −21 static/scripts/S3/S3.min.js
  27. +5 −3 static/scripts/S3/s3.dataTables.js
  28. +1 −1  static/scripts/S3/s3.dataTables.min.js
  29. +8 −8 static/scripts/S3/s3.gis.controls.js
  30. +2 −2 static/scripts/S3/s3.gis.min.js
  31. +3 −1 static/scripts/S3/s3.locationselector.widget.js
  32. +2 −2 static/scripts/S3/s3.locationselector.widget.min.js
  33. +41 −2 static/scripts/S3/s3.search.js
  34. +109 −111 static/scripts/gis/GeoExt.js
  35. +12 −12 static/scripts/gis/MGRS.min.js
  36. +1,459 −2,633 static/scripts/gis/OpenLayers.js
  37. +161 −161 static/scripts/gis/gxp.js
View
2  controllers/project.py
@@ -549,7 +549,7 @@ def demographic_data():
return s3db.stats_demographic_data_controller()
# -----------------------------------------------------------------------------
-def community_contact():
+def location_contact():
""" Show a list of all community contacts """
return s3_rest_controller()
View
3  modules/eden/asset.py
@@ -155,7 +155,8 @@ def model(self):
widget = None,
script = None, # No Item Pack Filter
),
- organisation_id(script = SCRIPT('''
+ organisation_id(required = True,
+ script = SCRIPT('''
$(document).ready(function(){
S3FilterFieldChange({
'FilterField':'organisation_id',
View
7 modules/eden/hrm.py
@@ -132,6 +132,7 @@ def model(self):
S3FilterFieldChange({
'FilterField':'organisation_id',
'Field':'site_id',
+ 'FieldID':'site_id',
'FieldResource':'site',
'FieldPrefix':'org',
})
@@ -1903,9 +1904,9 @@ def model(self):
cols=report_fields,
facts=report_fields,
methods=["count", "list"],
- defaults=Storage(rows="hrm_training.course_id",
- cols="hrm_training.month",
- fact="hrm_training.person_id",
+ defaults=Storage(rows="training.course_id",
+ cols="training.month",
+ fact="training.person_id",
aggregate="count"),
),
list_fields = [
View
4 modules/eden/menus.py
@@ -1481,8 +1481,8 @@ def project(self):
M("List All"),
M("Map", m="map"),
M("Search", m="search"),
- M("List All Community Contacts", f="community_contact"),
- M("Search Community Contacts", f="community_contact",
+ M("List All Community Contacts", f="location_contact"),
+ M("Search Community Contacts", f="location_contact",
m="search"),
),
)
View
11 modules/eden/project.py
@@ -705,6 +705,7 @@ def model(self):
table = define_table(tablename,
Field("name", length=128,
notnull=True, unique=True),
+ s3_comments(),
*s3_meta_fields())
# Field configuration?
@@ -1516,9 +1517,9 @@ def model(self):
msg_record_deleted = T("Contact Deleted"),
msg_list_empty = T("No Contacts Found"))
- community_contact_search = S3Search(
+ location_contact_search = S3Search(
advanced=(S3SearchSimpleWidget(
- name = "community_contact_search_simple",
+ name = "location_contact_search_simple",
label = T("Name"),
comment = T("You can search by person name - enter any of the first, middle or last names, separated by spaces. You may use % as wildcard. Press 'Search' without input to list all persons."),
field = ["person_id$first_name",
@@ -1527,13 +1528,13 @@ def model(self):
]
),
S3SearchOptionsWidget(
- name="community_contact_search_L1",
+ name="location_contact_search_L1",
field="person_id$L1",
location_level="L1",
cols = 3,
),
S3SearchOptionsWidget(
- name="community_contact_search_L2",
+ name="location_contact_search_L2",
field="person_id$L2",
location_level="L2",
cols = 3,
@@ -1543,7 +1544,7 @@ def model(self):
# Resource configuration
#hierarchy = current.gis.get_location_hierarchy()
configure(tablename,
- search_method=community_contact_search,
+ search_method=location_contact_search,
list_fields=["person_id",
# (hierarchy["L0"], "person_id$L0"),
# (hierarchy["L1"], "person_id$L1"),
View
494 modules/eden/transport.py
@@ -1,169 +1,325 @@
-# -*- coding: utf-8 -*-
-
-""" Sahana Eden Transport Model
-
- @copyright: 2012 (c) Sahana Software Foundation
- @license: MIT
-
- Permission is hereby granted, free of charge, to any person
- obtaining a copy of this software and associated documentation
- files (the "Software"), to deal in the Software without
- restriction, including without limitation the rights to use,
- copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the
- Software is furnished to do so, subject to the following
- conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- OTHER DEALINGS IN THE SOFTWARE.
-"""
-
-__all__ = ["S3TransportModel",
- ]
-
-from gluon import *
-from gluon.storage import Storage
-
-from ..s3 import *
-
-# =============================================================================
-class S3TransportModel(S3Model):
- """
- http://eden.sahanafoundation.org/wiki/BluePrint/Transport
- """
-
- names = ["transport_airport",
- "transport_seaport",
- ]
-
- def model(self):
-
- T = current.T
-
- configure = self.configure
- crud_strings = current.response.s3.crud_strings
- define_table = self.define_table
- super_link = self.super_link
-
- # ---------------------------------------------------------------------
- # Airports
- #
- tablename = "transport_airport"
- table = define_table(tablename,
- self.super_link("site_id", "org_site"),
- Field("name", notnull=True,
- length=64, # Mayon Compatibility
- label=T("Name")),
- Field("code",
- length=10,
- # Deployments that don't wants office codes can hide them
- #readable=False,
- #writable=False,
- # Mayon compatibility
- # @ToDo: Deployment Setting to add validator to make these unique
- #notnull=True,
- #unique=True,
- label=T("Code")),
- self.org_organisation_id(widget=S3OrganisationAutocompleteWidget(
- default_from_profile=True)),
- self.gis_location_id(),
- Field("obsolete", "boolean",
- label=T("Obsolete"),
- represent=lambda bool: \
- (bool and [T("Obsolete")] or [current.messages.NONE])[0],
- default=False,
- readable=False,
- writable=False),
- s3_comments(),
- *s3_meta_fields())
-
- # CRUD strings
- crud_strings[tablename] = Storage(
- title_create=T("Add Airport"),
- title_display=T("Airport Details"),
- title_list=T("Airports"),
- title_update=T("Edit Airport"),
- title_search=T("Search Facilities"),
- title_upload=T("Import Facilities"),
- subtitle_create=T("Add New Airport"),
- label_list_button=T("List Airports"),
- label_create_button=T("Add New Airport"),
- label_delete_button=T("Delete Airport"),
- msg_record_created=T("Airport added"),
- msg_record_modified=T("Airport updated"),
- msg_record_deleted=T("Airport deleted"),
- msg_list_empty=T("No Airports currently registered"))
-
- configure(tablename,
- super_entity="org_site"
- )
-
- # ---------------------------------------------------------------------
- # Seaports
- #
- tablename = "transport_seaport"
- table = define_table(tablename,
- self.super_link("site_id", "org_site"),
- Field("name", notnull=True,
- length=64, # Mayon Compatibility
- label=T("Name")),
- Field("code",
- length=10,
- # Deployments that don't wants office codes can hide them
- #readable=False,
- #writable=False,
- # Mayon compatibility
- # @ToDo: Deployment Setting to add validator to make these unique
- #notnull=True,
- #unique=True,
- label=T("Code")),
- self.org_organisation_id(widget=S3OrganisationAutocompleteWidget(
- default_from_profile=True)),
- self.gis_location_id(),
- Field("obsolete", "boolean",
- label=T("Obsolete"),
- represent=lambda bool: \
- (bool and [T("Obsolete")] or [current.messages.NONE])[0],
- default=False,
- readable=False,
- writable=False),
- s3_comments(),
- *s3_meta_fields())
-
- # CRUD strings
- crud_strings[tablename] = Storage(
- title_create=T("Add Seaport"),
- title_display=T("Seaport Details"),
- title_list=T("Seaports"),
- title_update=T("Edit Seaport"),
- title_search=T("Search Facilities"),
- title_upload=T("Import Facilities"),
- subtitle_create=T("Add New Seaport"),
- label_list_button=T("List Seaports"),
- label_create_button=T("Add New Seaport"),
- label_delete_button=T("Delete Seaport"),
- msg_record_created=T("Seaport added"),
- msg_record_modified=T("Seaport updated"),
- msg_record_deleted=T("Seaport deleted"),
- msg_list_empty=T("No Seaports currently registered"))
-
- configure(tablename,
- super_entity="org_site"
- )
-
- # ---------------------------------------------------------------------
- # Pass variables back to global scope (s3db.*)
- #
- return Storage(
- )
-
-# END =========================================================================
+# -*- coding: utf-8 -*-
+
+""" Sahana Eden Transport Model
+
+ @copyright: 2012 (c) Sahana Software Foundation
+ @license: MIT
+
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+"""
+
+__all__ = ["S3TransportModel",
+ ]
+
+from gluon import *
+from gluon.storage import Storage
+
+from ..s3 import *
+
+# =============================================================================
+class S3TransportModel(S3Model):
+ """
+ http://eden.sahanafoundation.org/wiki/BluePrint/Transport
+ """
+
+ names = ["transport_airport",
+ "transport_seaport",
+ ]
+
+ def model(self):
+
+ T = current.T
+ messages = current.messages
+ UNKNOWN_OPT = messages.UNKNOWN_OPT
+ configure = self.configure
+ crud_strings = current.response.s3.crud_strings
+ define_table = self.define_table
+ super_link = self.super_link
+
+ # ---------------------------------------------------------------------
+ # Airports
+ #
+ storage_types = {
+ 1: T("covered"),
+ 2: T("uncovered"),
+ }
+ transport_airport_capacity_opts = {
+ 1: "",
+ 2: T("number of planes"),
+ 3: T("m3")
+ }
+
+ tablename = "transport_airport"
+ table = define_table(tablename,
+ self.super_link("site_id", "org_site"),
+ Field("name", notnull=True,
+ length=64, # Mayon Compatibility
+ label=T("Name")),
+ Field("code",
+ length=10,
+ # Deployments that don't wants office codes can hide them
+ #readable=False,
+ #writable=False,
+ # Mayon compatibility
+ # @ToDo: Deployment Setting to add validator to make these unique
+ #notnull=True,
+ #unique=True,
+ label=T("Code")),
+ self.org_organisation_id(widget=S3OrganisationAutocompleteWidget(
+ default_from_profile=True)),
+ self.gis_location_id(),
+ Field("restrictions", "text",
+ label=T("Restrictions")),
+ Field("ils", "boolean",
+ represent=lambda bool: \
+ (bool and [T("Yes")] or [T("No")])[0],
+ label=T("Instrument Landing System")),
+ Field("lighting", "boolean",
+ represent=lambda bool: \
+ (bool and [T("Yes")] or [T("No")])[0],
+ label=T("Lighting")),
+ Field("immigration_customs_capabilities", "text",
+ label=T("Immigration and Customs Capabilities")),
+ Field("aircraft_max_size", "text",
+ label=T("Aircraft Maximum Size")),
+ Field("security_desc", "text",
+ label=T("Security Description"),
+ comment=DIV(_class="tooltip",
+ _title="%s|%s" % (T("Security Description"),
+ T("Description of perimeter fencing, security guards, security lighting.")))),
+ # @ToDo: put storage type inline
+ Field("storage_capacity", "double",
+ label=T("Storage Capacity (m3)")),
+ Field("storage_type", "integer",
+ requires = IS_NULL_OR(IS_IN_SET(storage_types)),
+ label=T("Storage Type")),
+ # @ToDo: put units inline
+ Field("parking_tarmac_space", "double",
+ label=T("Parking/Tarmac Space Capacity")),
+ Field("capacity", "integer",
+ label = T("Parking/Tarmac Space Units"),
+ requires = IS_IN_SET(transport_airport_capacity_opts, zero=None),
+ default = 1,
+ represent = lambda opt: \
+ transport_airport_capacity_opts.get(opt, UNKNOWN_OPT)),
+ Field("helipad_info", "text",
+ label=T("Helipad Information")),
+ self.pr_person_id(label=T("Information Source")),
+ Field("obsolete", "boolean",
+ label=T("Obsolete"),
+ represent=lambda bool: \
+ (bool and [T("Obsolete")] or [current.messages.NONE])[0],
+ default=False,
+ readable=False,
+ writable=False),
+ s3_comments(),
+ *s3_meta_fields())
+
+ # CRUD strings
+ crud_strings[tablename] = Storage(
+ title_create=T("Add Airport"),
+ title_display=T("Airport Details"),
+ title_list=T("Airports"),
+ title_update=T("Edit Airport"),
+ title_search=T("Search Facilities"),
+ title_upload=T("Import Facilities"),
+ subtitle_create=T("Add New Airport"),
+ label_list_button=T("List Airports"),
+ label_create_button=T("Add New Airport"),
+ label_delete_button=T("Delete Airport"),
+ msg_record_created=T("Airport added"),
+ msg_record_modified=T("Airport updated"),
+ msg_record_deleted=T("Airport deleted"),
+ msg_list_empty=T("No Airports currently registered"))
+
+ configure(tablename,
+ super_entity="org_site"
+ )
+
+ # ---------------------------------------------------------------------
+ # Seaports
+ #
+
+ ownership_opts = {
+ 1: T("Public"),
+ 2: T("Private")
+ }
+
+ unit_opts = {
+ 1: T("ft"),
+ 2: T("m")
+ }
+
+ tablename = "transport_seaport"
+ table = define_table(tablename,
+ self.super_link("site_id", "org_site"),
+ Field("name", notnull=True,
+ length=64, # Mayon Compatibility
+ label=T("Name")),
+ Field("code",
+ length=10,
+ # Deployments that don't wants office codes can hide them
+ #readable=False,
+ #writable=False,
+ # Mayon compatibility
+ # @ToDo: Deployment Setting to add validator to make these unique
+ #notnull=True,
+ #unique=True,
+ label=T("Code")),
+
+ Field("ownership_type", "integer",
+ requires = IS_IN_SET(ownership_opts, zero=None),
+ default = 1,
+ label = T("Ownership"),
+ represent = lambda opt: \
+ ownership_opts.get(opt, UNKNOWN_OPT)),
+ Field("max_height", "double",
+ label=T("Max Height")),
+ Field("max_height_units", "integer",
+ requires = IS_IN_SET(unit_opts, zero=None),
+ default = 1,
+ label = T("Units"),
+ represent = lambda opt: \
+ unit_opts.get(opt, UNKNOWN_OPT)),
+ Field("roll_on_off", "boolean",
+ default=False,
+ represent=lambda bool: \
+ (bool and [T("Yes")] or [T("No")])[0],
+ label=T("Roll On Roll Off Berth")),
+ Field("cargo_pier_depth", "double",
+ label=T("Cargo Pier Depth")),
+ Field("cargo_pier_depth_units", "integer",
+ requires = IS_IN_SET(unit_opts, zero=None),
+ default = 1,
+ label = T("Units"),
+ represent = lambda opt: \
+ unit_opts.get(opt, UNKNOWN_OPT)),
+ Field("oil_terminal_depth", "double",
+ label=T("Oil Terminal Depth")),
+ Field("oil_terminal_depth_units", "integer",
+ requires = IS_IN_SET(unit_opts, zero=None),
+ default = 1,
+ label = T("Units"),
+ represent = lambda opt: \
+ unit_opts.get(opt, UNKNOWN_OPT)),
+ Field("dry_dock", "boolean",
+ default=False,
+ represent=lambda bool: \
+ (bool and [T("Yes")] or [T("No")])[0],
+ label=T("Dry Dock")),
+ Field("vessel_max_length", "double",
+ label=T("Vessel Max Length")),
+ Field("vessel_max_length_units", "integer",
+ requires = IS_IN_SET(unit_opts, zero=None),
+ default = 1,
+ label = T("Units"),
+ represent = lambda opt: \
+ unit_opts.get(opt, UNKNOWN_OPT)),
+ Field("repairs", "text",
+ label=T("Repairs")),
+ Field ("shelter", "text",
+ label=T("Shelter")),
+ Field("warehouse_capacity", "double",
+ label=T("Warehousing Storage Capacity")),
+ Field("secure_storage_capacity", "double",
+ label=T("Secure Storage Capacity")),
+ Field("customs_warehouse_capacity", "double",
+ label=T("Customs Warehousing Storage Capacity")),
+ Field("tugs", "integer",
+ label=T("Number of Tugboats")),
+ Field("tug_capacity", "double",
+ label=T("Tugboat Capacity")),
+ Field("barges", "integer",
+ label=T("Number of Barges")),
+ Field("barge_capacity", "double",
+ label=T("Barge Capacity")),
+ Field("loading_equipment", "text",
+ label=T("Loading Equipment")),
+ Field("customs_capacity", "text",
+ label=T("Customs Capacity")),
+ Field ("security", "text",
+ label=T("Security")),
+ Field("high_tide_depth", "double",
+ label=T("High Tide Depth")),
+ Field("high_tide_depth_units", "integer",
+ requires = IS_IN_SET(unit_opts, zero=None),
+ default = 1,
+ label = T("Units"),
+ represent = lambda opt: \
+ unit_opts.get(opt, UNKNOWN_OPT)),
+ Field("low_tide_depth", "double",
+ label=T("Low Tide Depth")),
+ Field("low_tide_depth_units", "integer",
+ requires = IS_IN_SET(unit_opts, zero=None),
+ default = 1,
+ label = T("Units"),
+ represent = lambda opt: \
+ unit_opts.get(opt, UNKNOWN_OPT)),
+ Field("flood_depth", "double",
+ label=T("Flood Depth")),
+ Field("flood_depth_units", "integer",
+ requires = IS_IN_SET(unit_opts, zero=None),
+ default = 1,
+ label = T("Units"),
+ represent = lambda opt: \
+ unit_opts.get(opt, UNKNOWN_OPT)),
+
+ self.org_organisation_id(widget=S3OrganisationAutocompleteWidget(
+ default_from_profile=True)),
+ self.gis_location_id(),
+ Field("obsolete", "boolean",
+ label=T("Obsolete"),
+ represent=lambda bool: \
+ (bool and [T("Closed")] or [T("Operational")])[0],
+ default=False,
+ ),
+ s3_comments(),
+ *s3_meta_fields())
+
+ # CRUD strings
+ crud_strings[tablename] = Storage(
+ title_create=T("Add Seaport"),
+ title_display=T("Seaport Details"),
+ title_list=T("Seaports"),
+ title_update=T("Edit Seaport"),
+ title_search=T("Search Facilities"),
+ title_upload=T("Import Facilities"),
+ subtitle_create=T("Add New Seaport"),
+ label_list_button=T("List Seaports"),
+ label_create_button=T("Add New Seaport"),
+ label_delete_button=T("Delete Seaport"),
+ msg_record_created=T("Seaport added"),
+ msg_record_modified=T("Seaport updated"),
+ msg_record_deleted=T("Seaport deleted"),
+ msg_list_empty=T("No Seaports currently registered"))
+
+ configure(tablename,
+ super_entity="org_site"
+ )
+
+ # ---------------------------------------------------------------------
+ # Pass variables back to global scope (s3db.*)
+ #
+ return Storage(
+ )
+
+# END =========================================================================
View
14 modules/s3/s3search.py
@@ -803,17 +803,19 @@ def widget(self, resource, vars):
# Button to open the Map
OPEN_MAP = T("Open Map")
- map_button = A(OPEN_MAP,
- _style="cursor:pointer; cursor:hand",
- _id="gis_search_map-btn")
+ CLEAR_MAP = T("Clear selection")
+ map_buttons = TAG[""](BUTTON(OPEN_MAP,
+ _id="gis_search_map-btn"),
+ BUTTON(CLEAR_MAP,
+ _id="gis_search_polygon_input_clear"))
# Settings to be read by static/scripts/S3/s3.gis.js
- js_location_search = """S3.gis.draw_polygon = true;"""
+ js_location_search = '''S3.gis.draw_polygon=true'''
# The overall layout of the components
return TAG[""](
polygon_input,
- map_button,
+ map_buttons,
#map_popup,
SCRIPT(js_location_search)
)
@@ -2379,7 +2381,7 @@ def search_json(self, r, **attr):
resource.add_filter(query)
- limit = int(_vars.limit or 0)
+ limit = int(_vars.limit or MAX_SEARCH_RESULTS)
if (not limit or limit > MAX_SEARCH_RESULTS) and resource.count() > MAX_SEARCH_RESULTS:
output = jsons([dict(id="",
name="Search results are over %d. Please input more characters." \
View
4 modules/s3cfg.py
@@ -313,9 +313,9 @@ def get_base_session_memcache(self):
# -------------------------------------------------------------------------
# Database settings
def get_database_type(self):
- return self.database.get("db_type", "sqlite")
+ return self.database.get("db_type", "sqlite").lower()
def get_database_string(self):
- db_type = self.database.get("db_type", "sqlite")
+ db_type = self.database.get("db_type", "sqlite").lower()
pool_size = self.database.get("pool_size", 30)
if (db_type == "sqlite"):
db_string = "sqlite://storage.db"
View
5 modules/tests/asset/asset.py
@@ -57,14 +57,15 @@ def test_asset001_create_asset(self):
"WS-100-17"),
( "item_id",
"Water Purification Unit",
- "autocomplete"),
+ "option"),
#( "type",
# "Other"
# "option"),
( "sn",
"WPU-4536-9381"),
( "supplier",
- "Breville"),
+ "Acme Suppliers",
+ "option"),
( "purchase_date",
today ),
( "purchase_price",
View
15 modules/tests/asset/create_asset.py
@@ -54,14 +54,19 @@ def test_asset001_create_asset(self):
"WS_100_17"),
( "item_id",
"Blankets",
- "autocomplete"),
- ( "site_id",
- "AP Zone (Office)",
"option"),
+ ("organisation_id",
+ "International Federation of Red Cross and Red Crescent Societies (IFRC)",
+ "option"),
+ ( "site_id",
+ "AP Zone",
+ "option",
+ 4),
( "sn",
"WPU-4536-9381"),
- ( "supplier",
- "Breville"),
+ ( "supply_org_id",
+ "Acme Suppliers",
+ "option"),
( "purchase_date",
today),
( "purchase_price",
View
7 modules/tests/hrm/create_staff.py
@@ -49,7 +49,7 @@ def test_hrm001_create_staff(self):
self.create("hrm_human_resource",
[( "organisation_id",
- "Acme Suppliers",
+ "International Federation of Red Cross and Red Crescent Societies (IFRC)",
"option"),
( "first_name",
"Robert",
@@ -67,8 +67,9 @@ def test_hrm001_create_staff(self):
"Warehouse Manager",
"option"),
( "site_id",
- "AP Zone (Office)",
- "option"),
+ "AP Zone",
+ "option",
+ 3),
]
)
View
7 modules/tests/hrm/create_volunteer.py
@@ -49,7 +49,7 @@ def test_hrm002_create_volunteer(self):
self.create("hrm_human_resource",
[( "organisation_id",
- "Acme Suppliers",
+ "International Federation of Red Cross and Red Crescent Societies (IFRC)",
"option"),
( "first_name",
"John",
@@ -64,8 +64,9 @@ def test_hrm002_create_volunteer(self):
"Security",
"option"),
( "site_id",
- "AP Zone (Office)",
- "option"),
+ "AP Zone",
+ "option",
+ 3),
]
)
View
6 modules/tests/inv/create_catalog.py
@@ -47,10 +47,10 @@ def test_inv006_create_catalog(self):
self.login(account="admin", nexturl="supply/catalog/create")
self.create("supply_catalog",
[( "name",
- "Romanian Food Catalogue" ),
+ "IFRC Food Catalogue" ),
( "organisation_id",
- "Romanian Food Assistance Association",
- "autocomplete" ),
+ "International Federation of Red Cross and Red Crescent Societies (IFRC)",
+ "option" ),
( "comments",
"This is a test Catalogue")
]
View
2  modules/tests/inv/create_warehouse.py
@@ -56,7 +56,7 @@ def test_inv004_create_warehouse(self, items=[0]):
# 1st field used to check whether record already exists
("name", "Bucharest RFAAT Central Warehouse (Test)"),
("code", "12345679"),
- ("organisation_id", "Romanian Food Assistance Association", "autocomplete"),
+ ("organisation_id", "International Federation of Red Cross and Red Crescent Societies (IFRC)", "option"),
("comments", "This is a Test Warehouse"),
],
]
View
8 modules/tests/inv/receive_item.py
@@ -60,9 +60,13 @@ def test_inv002a_receive_items(self):
"option",
),
("type",
- "-",
+ "Internal Shipment",
"option",
- )
+ ),
+ ("from_site_id",
+ "Ainaro Warehouse (Warehouse)",
+ "option",
+ ),
]
item_data = [
View
4 modules/tests/inv/send_item.py
@@ -55,6 +55,10 @@ def test_inv001_send_items(self):
"Timor-Leste Red Cross Society (CVTL) National Warehouse (Warehouse)",
"option",
),
+ ("type",
+ "Internal Shipment",
+ "option",
+ ),
("to_site_id",
"Lospalos Warehouse (Warehouse)",
"option",
View
8 modules/tests/inv/send_receive_item.py
@@ -53,6 +53,10 @@ def test_inv003_send_receive_items(self):
"Timor-Leste Red Cross Society (CVTL) National Warehouse (Warehouse)",
"option",
),
+ ("type",
+ "Internal Shipment",
+ "option",
+ ),
("to_site_id",
"Lospalos Warehouse (Warehouse)",
"option",
@@ -126,6 +130,10 @@ def test_inv021_send_and_confirm(self):
"Timor-Leste Red Cross Society (CVTL) National Warehouse (Warehouse)",
"option",
),
+ ("type",
+ "Internal Shipment",
+ "option",
+ ),
("to_site_id",
"Lori (Facility)",
"option",
View
2  modules/tests/member/create_member.py
@@ -49,7 +49,7 @@ def test_mem001_create_member(self):
self.login(account="admin", nexturl="member/membership/create")
self.create("member_membership",
[( "organisation_id",
- "Timor-Leste Red Cross Society",
+ "Timor-Leste Red Cross Society (CVTL)",
"option"),
( "first_name",
"Denise",
View
13 modules/tests/project/create_project.py
@@ -51,7 +51,10 @@ def test_project001_create_project(self):
self.login(account="admin", nexturl="project/project/create")
self.create("project_project",
- [( "name",
+ [("organisation_id",
+ "International Federation of Red Cross and Red Crescent Societies (IFRC)",
+ "option"),
+ ( "name",
"Community Strengthening through Dance" ),
( "comments",
"Host National Society")
@@ -100,14 +103,8 @@ def test_project001_create_project(self):
"gis_location"),
( "lon",
"0",
- "gis_location"),
+ "gis_location")
# @ToDo: Activities - Community Organisation, Contingency Planning, Logistics
- ( "population",
- "1000"),
- ( "number_families",
- "200"),
- ( "comments",
- "First Community")
]
)
View
7 modules/unit_tests/s3/s3widgets.py
@@ -531,17 +531,18 @@ def testWidget(self):
multiple=True))
self.assertEqual(str(widget),
str(TAG[""](DIV(DIV("A - O",
- _class="s3-grouped-checkboxes-widget-label",
+ _class="s3-grouped-checkboxes-widget-label expanded",
_id="f-group-label-0"),
s3_checkboxes_widget(f1,
[]),
DIV("T - Z",
- _class="s3-grouped-checkboxes-widget-label",
+ _class="s3-grouped-checkboxes-widget-label expanded",
_id="f-group-label-1"),
s3_checkboxes_widget(f2,
[],
start_at_id=1),
- _class="s3-grouped-checkboxes-widget"))))
+ _class="s3-grouped-checkboxes-widget",
+ _name="f_widget"))))
# =============================================================================
def run_suite(*test_classes):
View
259 private/templates/IFRC/project_activity_type.csv
@@ -1,127 +1,132 @@
-Name,Sector:Health,Sector:DRR,Sector:OD,Sector:WatSan,Notes
-Auxiliary role,,Yes,,,
-Climate change awareness ,,Yes,,,
-"Climate change mainstreaming, ",,Yes,,,
-Coastal conservation ,,Yes,,,
-Community disaster awareness,,Yes,,,
-Community early warning systems,,Yes,,,
-Education & advocacy,,Yes,,,
-"Financial risk sharing (community funds, etc.), ",,Yes,,,
-Insurance ,,Yes,,,
-"legislation/IDRL, ",,Yes,,,
-Logistics & warehouses,,Yes,,,
-National DM planning ,,Yes,,,
-Provision of tools and equipment,,Yes,,,
-RDRT (Regional disaster response teams),,Yes,,,
-"School safety and children education,",,Yes,,,
-"Simulation small scale mitigation, ",,Yes,,,
-"Staff/volunteer capacity building, (does this mean volunteering development guidelines??)",,Yes,,,
-Tree and mangrove planting ,,Yes,,,
-Volunteering in emergencies guidelines/toolkit,,Yes,,,
-Vulnerability and Capacity Assessments,,Yes,,,
-Advocacy,Yes,,,,
-Behaviour change communication,Yes,,,,
-Better programming initiative guidance,Yes,,,,DRR
-Blood banking,Yes,,,,
-Club 25 / Pledge 25,Yes,,,,
-Community action planning,Yes,,,,DRR
-Community health committees,Yes,,,,
-Community health initiative/projects,Yes,,,,
-Community health risk assessments,Yes,,,,
-Community mobilisation,Yes,,,,
-Community preparedness,Yes,,,,
-Contingency planning/preparedness planning,Yes,,,,
-Coordination and partnerships,Yes,,,,
-Disease prevention,Yes,,,,
-"Distribution of prevention items � such as condoms, mosquito nets, soap",Yes,,,,
-Donor recruitment,Yes,,,,
-Feeding programmes,Yes,,,,
-First Aid,Yes,,,,
-Food supplementation,Yes,,,,
-"Health awareness, promotion",Yes,,,,
-Health facilities - construction and operation,Yes,,,,
-"Health policy, strategy development",Yes,,,,
-Immunisation campaigns,Yes,,,,
-Infant and young child feeding,Yes,,,,
-Knowledge management ,Yes,,,,
-Medical supplies and equipment,Yes,,,,
-Mobile health units,Yes,,,,
-Monitoring and evaluation,Yes,,,,
-Nutritional assessments,Yes,,,,
-Organisational preparedness � NHQ and branches,Yes,,,,
-Peer support,Yes,,,,
-Project assessments and planning,Yes,,,,
-Psychosocial support (tools/guidelines/trainings in cross-cultural contexts),Yes,,,,
-Referral,Yes,,,,
-Risk management and quality assurance,Yes,,,,
-School-based activities,Yes,,,,
-Situation monitoring/community surveillance,Yes,,,,
-Staff capacity building,Yes,,,,
-"Stockpiling, prepositioning of supplies",Yes,,,,
-Tools and guidelines development,Yes,,,,
-Training of community/first responders ,Yes,,,,
-Training of master trainers/trainers,Yes,,,,
-Vector control,Yes,,,,
-Volunteer capacity building - training and mobilisation,Yes,,,,
-Volunteer training,Yes,,,,
-Volunteering in pandemic emergency situations (Jim had shared guidelines earlier?),Yes,,,,
-Branch planning,,,Yes,,
-Capacity building of governance,,,Yes,,
-Capacity building of management staff,,,Yes,,
-"Database development (vol, member, donors)",,,Yes,,
-Policy development,,,Yes,,
-"Resource Mobilisation (fundraising, income generation, in-kind support, partnership) ",,,Yes,,
-School RC units development,,,Yes,,
-SOPs and guidelines development,,,Yes,,
-Strategy development,,,Yes,,
-Training ,,,Yes,,
-Volunteer insurance,,,Yes,,
-Volunteer recognition,,,Yes,,
-Volunteer recruitment (normal and ViE too),,,Yes,,
-Volunteer training,,,Yes,,
-Youth leadership development,,,Yes,,
-Catchment protection,,,,Yes,
-Clean-up campaign,,,,Yes,
-"Construction of water supply systems (gravity-fed, shallow wells, boreholes)",,,,Yes,
-Desluding ,,,,Yes,
-Emergency householdwater treatment and storage,,,,Yes,
-Emergency water supply,,,,Yes,
-Hand washing facilities and demonstration,,,,Yes,
-Installation of rainwater harvesting systems,,,,Yes,
-latrine construction (emergency and permanent),,,,Yes,
-Participatory Hygiene and Sanitation Transformation,,,,Yes,
-Planning and construction of drainage systems ,,,,Yes,
-Solid waste management,,,,Yes,
-Spraying of vectors,,,,Yes,
-Training and capacity building,,,,Yes,
-Water testing,,,,Yes,
-Advocacy,,,,,
-Awareness raising,,,,,
-BDRT (Branch disaster response teams),,,,,DRR
-Capacity Building,,,,,
-CDRT (Community disaster response teams),,,,,DRR
-Children's Education,,,,,
-Climate change mitigation,,,,,
-Climate change preparedness,,,,,DRR
-Community Based Health and First Aid (CBHFA),,,,,
-Community organisation,,,,,DRR
-Contingency planning,,,,,DRR
-DM Planning,,,,,
-Early warning,,,,,
-Evacuation drills,,,,,DRR
-Food security ,,,,,
-Hygiene promotion,,,,,
-IDRL,,,,,
-IEC Materials,,,,,"Development/dissemination WatSan,DRR"
-Livelihoods,,,,,
-Logistics,,,,,
-Mainstreaming DRR,,,,,DRR
-NDRT (National disaster response teams),,,,,DRR
-Nutrition,,,,,
-Risk transfer,,,,,
-Sanitation,,,,,
-School Safety,,,,,
-Small scale mitigation,,,,,
-Tools & Equipment,,,,,
-VCA (Vulnerability and Capacity Assessment),,,,,
-Water Supply,,,,,
+Name,Comments,Sector:Health,Sector:DRR,Sector:Od,Sector:Watsan,Sector:Livelihoods,Sector:Shelter,Notes
+Advocacy,,,,,,,,
+Assessment and Community/Beneficiary Identification,,,,,,,,
+Auxiliary Role,,,,,,,,
+Awareness Raising,,,,,,,,
+Bdrt (Branch Disaster Response Teams),,,Yes,,,,,
+Behaviour Change Communication,,,,,,,,
+Better Programming Initiative Guidance,,,,,,,,
+Blood Banking,,Yes,,,,,,
+Blood Donor Recruitment,,Yes,,,,,,
+Boq and Cost Estimation,,,,,,,Yes,
+Branch Planning,,,,Yes,,,,
+Capacity Building,,,,,,,,
+Capacity Building of Governance,,,,Yes,,,,
+Capacity Building of Management Staff,,,,Yes,,,,
+Capacity Building of Staff,,,,,,,,
+Capacity Building of Volunteers,training and mobilisation,,,,,,,
+Catchment Protection,,,,,Yes,,,
+CDRT (Community Disaster Response Teams),,,,Yes,,,,
+Children'S Education,,,,,,,,
+Clean-Up Campaign,,,,,Yes,,,
+Climate Change Adaptation ,,,,,,,,
+Climate Change Mitigation,,,,,,,,
+Club 25 / Pledge 25,,Yes,,,,,,
+Coastal Conservation ,,,Yes,,,,,
+Community Action Planning,,,,,,,,DRR
+Community Based Health and First Aid (Cbhfa),,Yes,,,,,,
+Community Disaster Awareness,,,Yes,,,,,
+Community Early Warning Systems,,,Yes,,,,,
+Community Health Committees,,Yes,,,,,,
+Community Health Initiative/Projects,,Yes,,,,,,
+Community Health Risk Assessments,,Yes,,,,,,
+Community Mobilisation,,,,,,,,
+Community Organisation,,,,,,,,
+Community Preparedness,,Yes,Yes,,,,,
+Construction Activities,,,,,,,Yes,
+Construction of Water Supply Systems,"gravity-fed, shallow wells, boreholes",,,,Yes,,,
+Contingency/Preparedness Planning,,,,,,,,
+Contractual Agreements (Community/Individual),,,,,,,Yes,
+Contractual Agreements (Governmental),,,,,,,Yes,
+Coordination and Partnerships,,,,,,,,
+Database Development,,,,,,,,
+Desluding ,,,,,Yes,,,
+Disaster Law,,,,,,,,
+Disease Prevention,,Yes,,,,,,
+Distribution of Food,,,,,,,,
+Distribution of Non-Food Items,,,,,,,,
+DM Planning,,,,,,,,
+Early Warning Systems,,,Yes,,,,,
+Education & Advocacy,,,Yes,,,,,
+Emergency Householdwater Treatment and Storage,,,,,Yes,,,
+Emergency Water Supply,,,,,Yes,,,
+Enterprise Development Training ,"Financial, Planning, etc",,,,,Yes,,
+Evacuation Drills,,Yes,,,,,,
+Feeding Programmes,,Yes,,,,,,
+Financial Risk Sharing ,"community funds, etc",,Yes,,,,,
+Financial Services,"savings, credit, insurance",,,,,Yes,,
+First Aid,,Yes,,,,,,
+Food Security ,,,,,,,,
+Food Supplementation,,Yes,,,,,,
+Hand Washing Facilities,,,,,Yes,,,
+"Health Awareness, Promotion",,Yes,,,,,,
+Health Facilities - Construction and Operation,,Yes,,,,,,
+"Health Policy, Strategy Development",,Yes,,,,,,
+House Design,,,,,,,Yes,
+IEC Materials,,,,,,,,
+Immunisation Campaigns,,Yes,,,,,,
+Improved Production Techniques,"demonstration, training and support",,,,,Yes,,
+Infant and Young Child Feeding,,Yes,,,,,,
+Installation of Rainwater Harvesting Systems,,,,,Yes,,,
+Insurance ,,,Yes,,,,,
+Irrigation and Watershed Management,,,,,,Yes,,
+Knowledge Management ,,,,,,,,
+Latrine Construction,emergency and permanent,,,,Yes,,,
+Legal Approvals,,,,,,,Yes,
+Logistics & Warehouses,,,,,,,,
+Mainstreaming DRR,,,,,,,,DRR
+"Markets/Marketing Analysis, Linkages and Support",,,,,,Yes,,
+Medical Supplies and Equipment,,Yes,,,,,,
+Mobile Health Units,,Yes,,,,,,
+Monitoring and Evaluation,,Yes,,,,,,
+NDRT (National Disaster Response Teams),,,,,,,,DRR
+Nutrition,,,,,,,,
+Nutritional Assessments,,Yes,,,,,,
+Organisational Preparedness � Nhq and Branches,,Yes,,,,,,
+Participatory Hygiene Promotion,,Yes,,,Yes,,,
+Peer Support,,Yes,,,,,,
+Planning and Construction of Drainage Systems ,,,,,Yes,,,
+Policy Development,,,,Yes,,,,
+Post Harvest Storage and Management,,,,,,Yes,,
+"Programme Preparation and Action Plan, Budget & Schedule",,,,,,,,
+Project Assessments and Planning,,,,,,,,
+Provision of Inputs,"seeds, tools, fertilizers, fishing nets, other equipment for livelihoods activities",,,,,Yes,,
+Provision of Tools and Equipment,,,,,,,,
+Psychosocial Support,tools/guidelines/trainings in cross-cultural contexts,Yes,,,,,,
+"Rangeland, Fisheries and Forest Management",,,,,,Yes,,
+RDRT (Regional Disaster Response Teams),,,Yes,,,,,
+Referral,,Yes,,,,,,
+Resource Transfers for Acquiring Assets,"cash, voucher, food aid",,,,,Yes,,
+Resource Transfers for Replacing/ Provisioning Or Consumption,"cash, vouchers, food aid",,,,,Yes,,
+Risk Management and Quality Assurance,,Yes,,,,,,
+Risk Transfer,,,,,,,,
+Sanitation,,,,,,,,
+School RC Units Development,,,,Yes,,,,
+"School Safety and Children Education,",,,Yes,,,,,
+Simulation ,,,Yes,,,,,
+Site Planning,,,,,,,Yes,
+Site Selection,,,,,,,Yes,
+Situation Monitoring/Community Surveillance,,Yes,,,,,,
+Small Scale Mitigation,,,Yes,,,,,
+Social Mobilisation,,,,,,,Yes,
+Solid Waste Management,,,,,Yes,,,
+Sops and Guidelines Development,,,,,,,,
+Spraying of Vectors,,,,,Yes,,,
+"Stockpiling, Prepositioning of Supplies",,Yes,,,,,,
+Strategy Development,,,,Yes,,,,
+Tools and Guidelines Development,,,,,,,,
+Training ,,,,Yes,,,,
+Training of Community/First Responders ,,Yes,,,,,,
+Training of Master Trainers/Trainers,,Yes,,,,,,
+Tree and Mangrove Planting ,,,Yes,,,,,
+VCA (Vulnerability and Capacity Assessment),,,,,,,,
+Vector Control,,Yes,,,,,,
+Vocational Training and Employment Skills,,,,,,Yes,,
+Volunteer Insurance,,,,Yes,,,,
+Volunteer Recognition,,,,Yes,,,,
+Volunteer Recruitment,normal and ViE too,,,Yes,,,,
+Volunteer Training,,Yes,,,,,,
+Volunteering in Emergencies Guidelines/Toolkit,,,Yes,,,,,
+Volunteering in Pandemic Emergency Situations,,Yes,,,,,,
+Water Testing,,,,,Yes,,,
+Youth Leadership Development,,,,Yes,,,,
View
138 private/templates/IFRC/project_theme.csv
@@ -1,67 +1,71 @@
-Name,Comments,Sector:Health,Sector:DRR,Sector:OD,Sector:WatSan,Notes
-CBDRM ,,,Yes,,,
-Climate Change Adaptation and Mitigation,,,Yes,,,
-Early Warning Systems,,,Yes,,,
-Gender and DM sensitisation guidelines,,,Yes,,,
-Infrastructure Development,,,Yes,,,
-Partnerships ,,,Yes,,,
-Risk transfer mechanism ,,,Yes,,,
-Urban Risk Management,,,Yes,,,
-Blood donation and services,,Yes,,,,
-"Communicable diseases (including emerging and re-emerging diseases, vaccine preventable diseases, HIV, TB)",,Yes,,,,
-Community health,,Yes,,,,
-Emergency health,,Yes,,,,
-Epidemic preparedness/pandemic preparedness,,Yes,,,,
-"Maternal, newborn and child health",,Yes,,,,
-Medical services,,Yes,,,,
-Non-communicable diseases,,Yes,,,,
-Nutrition,,Yes,,,,
-Psychosocial support,,Yes,,,,
-Road safety,,Yes,,,,
-School health,,Yes,,,,
-Sexual and reproductive health,,Yes,,,,
-Branch Capacity development ,,,,Yes,,
-Communication capacity building,,,,Yes,,
-Financial system development,,,,Yes,,
-Gender sensitisation and guidelines,,,,Yes,,
-Human Resource development ,,,,Yes,,
-IT � Digital Divide,,,,Yes,,
-Member base development,,,,Yes,,
-PMER development,,,,Yes,,
-Programme planning and management ,,,,Yes,,
-"RM (fundraising, income generation, in-kind support, partnership)",,,,Yes,,
-Social inclusion/ diversity/ violence prevention,,,,Yes,,
-Volunteer and staff Management or HR,,,,Yes,,
-Youth Development,,,,Yes,,
-Drainage,,,,,Yes,
-Excreta Disposal,,,,,Yes,
-Hygiene promotion,,,,,Yes,
-Solid Waste Management,,,,,Yes,
-Vector Control,,,,,Yes,
-Water Supply,,,,,Yes,
-Capacity Development,"training and development, institutional strengthening, institutional learning",,,,,DRR
-Civil Society/NGOs,"civic action, collective community action, community-based organization (CBO) action, grassroots action, integrative DRR, non-governmental organization (NGO) action",,,,,
-Climate Change,"adaptation to climate change, sustainable development",,,,,
-Community-based DRR,"local knowledge, local risk mapping",,,,,
-Complex Emergency,"multiple hazard crisis, humanitarian crisis, conflict",,,,,
-Critical Infrastructure,"communications systems, health facilities, 'lifelines', power and energy, emergency evacuation shelters, financial infrastructure, schools, transportation, waste disposal, water supplies",,,,,
-Disaster Risk Management,"civil protection, contingency and emergency planning, early recovery, preparedness",,,,,
-Early Warning,"risk knowledge, monitoring and warning service, risk communication, response capability, disaster preparedness, risk modelling",,,,,
-Economics of DRR,"cost benefit analysis, disaster risk financing, financial effects of disasters, poverty and disaster risk, risk sharing, socio-economic impacts of disasters",,,,,
-Education & School Safety,"learning, safe schools",,,,,
-Environment,"sustainable development, environmental degradation, ecosystems and environmental management",,,,,
-Gender,"gendered vulnerability, gender-sensitive disaster risk management",,,,,
-GIS & Mapping,"geographic information systems, hazard exposure mapping, vulnerability mapping, risk mapping",,,,,
-Governance,"disaster risk reduction policy and legislation, National Platform for disaster risk reduction, Regional Platforms for disaster risk reduction",,,,,
-Health & Health Facilities,"capacity of health practitioners, mental health",,,,,
-Information Management,"disaster databases, disaster information, disaster risk information portals, ICT",,,,,
-Media,"disaster reporting, disaster information dissemination",,,,,
-Private-public Partnerships,"corporate social responsibility, private sector engagement in DRR",,,,,
-Recovery,"building back better, long-term recovery and reconstruction, rehabilitation, shelter",,,,,
-Risk Identification & Assessment,"risk assessment, loss data, disaster risk management",,,,,DRR
-Risk Transfer & Insurance,"disaster insurance, contingency funding, micro-insurance, post-disaster loans, risk financing, risk insurance, risk sharing, pooling",,,,,
-Social Impacts & Resilience,"coping capacity, loss absorption, loss acceptance, psychosocial support, social vulnerability, trauma prevention",,,,,
-Structural Safety,"building codes, building standards, building materials, construction, retrofitting",,,,,
-Urban Risk & Planning,"urban planning, urban management",,,,,
-Vulnerable Populations,,,,,,
-Water,"drinking water, freshwater, irrigation, potable water, water and sanitation, water resource management",HHH,EEE,LLL,PPP,
+Name,Comments,Sector:Health,Sector:DRR,Sector:OD,Sector:WatSan,Sector:Livelihoods,Sector:Shelter,Notes
+Blood Donation and Services,,Yes,,,,,,
+Branch Capacity Development ,,,,Yes,,,,
+Capacity Development,"training and development, institutional strengthening, institutional learning",,,,,,,
+CBDRM ,,,Yes,,,,,
+Civil Society/NGOs,"civic action, collective community action, community-based organization (CBO) action, grassroots action, integrative DRR, non-governmental organization (NGO) action",,,,,,,
+Climate Change,"adaptation to climate change, sustainable development",,,,,,,
+Communicable Diseases,"Including emerging and re-emerging diseases, vaccine preventable diseases, HIV, TB",Yes,,,,,,
+Community health,,Yes,,,,,,
+Community-based DRR,"local knowledge, local risk mapping",,Yes,,,,,
+Complex Emergency,"multiple hazard crisis, humanitarian crisis, conflict",,,,,,,
+Critical Infrastructure,"communications systems, health facilities, 'lifelines', power and energy, emergency evacuation shelters, financial infrastructure, schools, transportation, waste disposal, water supplies",,,,,,,
+Disaster Risk Management,"civil protection, contingency and emergency planning, early recovery, preparedness",,Yes,,,,,
+Diversifying Livelihoods,,,,,,Yes,,
+Donor Driven Housing Reconstruction,,,,,,,Yes,
+Drainage,,,,,Yes,,,
+Early Warning,"risk knowledge, monitoring and warning service, risk communication, response capability, disaster preparedness, risk modelling",,Yes,,,,,
+Economics of DRR,"cost benefit analysis, disaster risk financing, financial effects of disasters, poverty and disaster risk, risk sharing, socio-economic impacts of disasters",,Yes,,,,,
+Education & School Safety,"learning, safe schools",,,,,,,
+Emergency Health,,Yes,,,,,,
+Environment,"sustainable development, environmental degradation, ecosystems and environmental management",,,,,,,
+Epidemic/Pandemic Preparedness,,Yes,,,,,,
+Excreta Disposal,,,,,Yes,,,
+Financial System Development,,,,Yes,,,,
+Gender,"gendered vulnerability, gender-sensitive disaster risk management",,,,,,,
+GIS & Mapping,"geographic information systems, hazard exposure mapping, vulnerability mapping, risk mapping",,,,,,,
+Governance,"disaster risk reduction policy and legislation, National Platform for disaster risk reduction, Regional Platforms for disaster risk reduction",,,,,,,
+Health & Health Facilities,"capacity of health practitioners, mental health",,,,,,,
+Housing Repair and Retrofitting ,,,,,,,Yes,
+Human Resource development ,,,,Yes,,,,
+Hygiene Promotion,,,,,Yes,,,
+Information Management,"disaster databases, disaster information, disaster risk information portals, ICT",,,,,,,
+Information Technology,,,,Yes,,,,
+Infrastructure Development,,,Yes,,,,,
+"Maternal, Newborn and Child Health",,Yes,,,,,,
+Media,"disaster reporting, disaster information dissemination",,,,,,,
+Medical Services,,Yes,,,,,,
+Member Base Development,,,,Yes,,,,
+Non-Communicable Diseases,,Yes,,,,,,
+Nutrition,,Yes,,,,,,
+Owner Driven Housing Reconstruction,,,,,,,Yes,
+Partnerships ,,,,,,,,
+PASSA,,,,,,,Yes,
+PMER development,,,,Yes,,,,
+Private-Public Partnerships,"corporate social responsibility, private sector engagement in DRR",,,,,,,
+Programme planning and management ,,,,Yes,,,,
+Protecting Livelihoods,,,,,,Yes,,
+Psychosocial Support,,Yes,,,,,,
+Recovery,"building back better, long-term recovery and reconstruction, rehabilitation, shelter",,,,,,,
+Replacing or Provisioning Livelihoods,,,,,,Yes,,
+Resource Mobilization,"Fundraising, income generation, in-kind support, partnership",,,Yes,,,,
+Restarting Livelihoods,,,,,,Yes,,
+Risk Identification & Assessment,"risk assessment, loss data, disaster risk management",,Yes,,,,,
+Risk Transfer & Insurance,"disaster insurance, contingency funding, micro-insurance, post-disaster loans, risk financing, risk insurance, risk sharing, pooling",,Yes,,,,,
+Road Safety,,Yes,,,,,,
+School Health,,Yes,,,,,,
+Sexual and Reproductive Health,,Yes,,,,,,
+Social Impacts & Resilience,"coping capacity, loss absorption, loss acceptance, psychosocial support, social vulnerability, trauma prevention",,,,,,,
+Social Inclusion / Diversity,,,,Yes,,,,
+Solid Waste Management,,,,,Yes,,,
+Strengthening Livelihoods,,,,,,Yes,,
+Structural Safety,"building codes, building standards, building materials, construction, retrofitting",,,,,,,
+Transitional Shelter Construction ,,,,,,,Yes,
+Urban Risk & Planning,"urban planning, urban management",,Yes,,,,,
+Vector Control,,,,,Yes,,,
+Violence Prevention,,,,Yes,,,,
+Volunteer and Staff Management,,,,Yes,,,,
+Vulnerable Populations,,,,,,,,
+Water,"drinking water, freshwater, irrigation, potable water, water and sanitation, water resource management",,,,,,,
+Water Supply,,,,,Yes,,,
+Youth Development,,,,Yes,,,,
View
2  static/formats/s3csv/project/activity_type.csv
@@ -1 +1 @@
-Name
+Name,Comments
View
1  static/formats/s3csv/project/activity_type.xsl
@@ -8,6 +8,7 @@
CSV column...........Format..........Content
Name.................string..........Name
+ Comments.............string..........Comments
Sector:<Sector Abrv>.Yes/blank.......Flag to link activity type to Sector
*********************************************************************** -->
View
32 static/scripts/S3/S3.js
@@ -78,32 +78,32 @@ S3.addTooltips = function() {
$('label[title]').cluetip({splitTitle: '|', showTitle:false});
$('.tooltipbody').cluetip({activation: 'hover', sticky: false, splitTitle: '|', showTitle: false});
var tipCloseText = '<img src="' + S3.Ap.concat('/static/img/cross2.png') + '" alt="close" />';
- $('.stickytip').cluetip( {
+ $('.stickytip').cluetip({
activation: 'hover',
sticky: true,
closePosition: 'title',
closeText: tipCloseText,
splitTitle: '|'
- } );
- $('.errortip').cluetip( {
+ });
+ $('.errortip').cluetip({
activation: 'click',
sticky: true,
closePosition: 'title',
closeText: tipCloseText,
splitTitle: '|'
- } );
- $('.ajaxtip').cluetip( {
+ });
+ $('.ajaxtip').cluetip({
activation: 'click',
sticky: true,
closePosition: 'title',
closeText: tipCloseText,
width: 380
- } );
+ });
}
$(document).ready(function() {
// Web2Py Layer
- $('.error').hide().slideDown('slow')
+ $('.error').hide().slideDown('slow');
$('.error').click(function() { $(this).fadeOut('slow'); return false; });
$('.warning').hide().slideDown('slow')
$('.warning').click(function() { $(this).fadeOut('slow'); return false; });
@@ -111,7 +111,21 @@ $(document).ready(function() {
$('.information').click(function() { $(this).fadeOut('slow'); return false; });
$('.confirmation').hide().slideDown('slow')
$('.confirmation').click(function() { $(this).fadeOut('slow'); return false; });
- $("input[type='checkbox'].delete").click(function() { if(this.checked) if(!confirm(S3.i18n.delete_confirmation)) this.checked=false; });
+ $("input[type='checkbox'].delete").click(function() {
+ if ((this.checked) && (!confirm(S3.i18n.delete_confirmation))) {
+ this.checked=false;
+ }
+ });
+
+ // If a form is submitted with errors, this will scroll
+ // the window to the first form error message
+ inputErrorId = $('form .error[id]').eq(0).attr('id');
+ if (inputErrorId != undefined) {
+ inputName = inputErrorId.replace('__error', '');
+ inputId = $('[name=' + inputName + ']').attr('id');
+ inputLabel = $('[for=' + inputId + ']');
+ window.scrollTo(0, inputLabel.offset().top)
+ }
// T2 Layer
//try { $('.zoom').fancyZoom( {
@@ -657,7 +671,7 @@ function S3FilterFieldChange (setting) {
FieldVal.push($(this).val());
});
}
- if (url.indexOf("?")) {
+ if (url.indexOf("?") != -1) {
url = url.concat("&value=");
} else {
url = url.concat("?value=");
View
44 static/scripts/S3/S3.min.js
@@ -123,12 +123,13 @@ var S3={gis:{},timeline:{},JSONRequest:{},TimeoutVar:{},uid:function(){return(65
S3.addTooltips=function(){$.cluetip.defaults.cluezIndex=9999;$(".tooltip").cluetip({activation:"hover",sticky:!1,splitTitle:"|"});$("label[title]").cluetip({splitTitle:"|",showTitle:!1});$(".tooltipbody").cluetip({activation:"hover",sticky:!1,splitTitle:"|",showTitle:!1});var b='<img src="'+S3.Ap.concat("/static/img/cross2.png")+'" alt="close" />';$(".stickytip").cluetip({activation:"hover",sticky:!0,closePosition:"title",closeText:b,splitTitle:"|"});$(".errortip").cluetip({activation:"click",sticky:!0,
closePosition:"title",closeText:b,splitTitle:"|"});$(".ajaxtip").cluetip({activation:"click",sticky:!0,closePosition:"title",closeText:b,width:380})};
$(document).ready(function(){$(".error").hide().slideDown("slow");$(".error").click(function(){$(this).fadeOut("slow");return!1});$(".warning").hide().slideDown("slow");$(".warning").click(function(){$(this).fadeOut("slow");return!1});$(".information").hide().slideDown("slow");$(".information").click(function(){$(this).fadeOut("slow");return!1});$(".confirmation").hide().slideDown("slow");$(".confirmation").click(function(){$(this).fadeOut("slow");return!1});$("input[type='checkbox'].delete").click(function(){this.checked&&
-!confirm(S3.i18n.delete_confirmation)&&(this.checked=!1)});S3.interactive&&$("a.delete-btn").live("click",function(b){if(confirm(S3.i18n.delete_confirmation))return!0;b.preventDefault();return!1});$("input.int_amount").keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-,]|\-(?=.)/g,"").reverse()});$("input.float_amount").keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.](?=[0-9]*[\.])/g,"").reverse()});$("textarea.resizable:not(.textarea-processed)").each(function(){function b(a){e.height(Math.max(32,
-g+a.pageY)+"px");return!1}function a(){$(document).unbind("mousemove",b).unbind("mouseup",a);e.css("opacity",1)}if($(this).is("textarea.teaser:not(.teaser-processed)"))return!1;var e=$(this).addClass("textarea-processed"),g=null;$(this).wrap('<div class="resizable-textarea"><span></span></div>').parent().append($('<div class="grippie"></div>').mousedown(function(f){g=e.height()-f.pageY;e.css("opacity",0.25);$(document).mousemove(b).mouseup(a);return!1}));var f=$("div.grippie",$(this).parent())[0];
-f.style.marginRight=f.offsetWidth-$(this)[0].offsetWidth+"px"});$("#modulenav .hoverable").hover(function(){$(this).addClass("hovered")},function(){$(this).removeClass("hovered")});$("#modulenav li").hover(function(){var b=$(this).width(),a=$("ul",this).width();null!=a&&a<b&&$("ul",this).css({width:b.toString()+"px"});$("ul",this).css("display","block")},function(){$("ul",this).css("display","none")});$("a.colorbox").attr("href",function(b,a){var e="";try{e=$(this).parents("tr").attr("id").replace(/__row/,
-"")}catch(g){if(""==e)return a}var f=a;-1==a.indexOf("&caller=")&&(f=a+"&caller="+e);return f});$(".colorbox").click(function(){$.fn.colorbox({iframe:!0,width:"99%",height:"99%",href:this.href,title:this.title});return!1});S3.addTooltips();now=new Date;$("form").append("<input type='hidden' value="+now.getTimezoneOffset()+" name='_utc_offset'/>");if(0<$("#socialmedia_share").length){var b=document.location.href;$("#socialmedia_share").append("<div class='socialmedia_element'><script src='//platform.linkedin.com/in.js'><\/script><script type='IN/Share' data-counter='right'><\/script></div>");
-$("#socialmedia_share").append("<div class='socialmedia_element'><a href='https://twitter.com/share' class='twitter-share-button' data-count='none' data-hashtags='sahana-eden'>Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='//platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','twitter-wjs');<\/script></div>");$("#socialmedia_share").append("<div class='socialmedia_element'><div id='fb-root'></div><script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = '//connect.facebook.net/en_US/all.js#xfbml=1'; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));<\/script> <div class='fb-like' data-send='false' data-layout='button_count' data-show-faces='true' data-href='"+
-b+"'></div></div>")}});function s3_tb_remove(){$.fn.colorbox.close()}function S3ConfirmClick(b,c){S3.interactive&&$(b).click(function(b){if(confirm(c))return!0;b.preventDefault();return!1})}function S3SetNavigateAwayConfirm(){window.onbeforeunload=function(){return S3.i18n.unsaved_changes}}function S3ClearNavigateAwayConfirm(){window.onbeforeunload=function(){}}
+!confirm(S3.i18n.delete_confirmation)&&(this.checked=!1)});inputErrorId=$("form .error[id]").eq(0).attr("id");void 0!=inputErrorId&&(inputName=inputErrorId.replace("__error",""),inputId=$("[name="+inputName+"]").attr("id"),inputLabel=$("[for="+inputId+"]"),window.scrollTo(0,inputLabel.offset().top));S3.interactive&&$("a.delete-btn").live("click",function(b){if(confirm(S3.i18n.delete_confirmation))return true;b.preventDefault();return false});$("input.int_amount").keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-,]|\-(?=.)/g,
+"").reverse()});$("input.float_amount").keyup(function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.](?=[0-9]*[\.])/g,"").reverse()});$("textarea.resizable:not(.textarea-processed)").each(function(){function b(a){e.height(Math.max(32,g+a.pageY)+"px");return false}function a(){$(document).unbind("mousemove",b).unbind("mouseup",a);e.css("opacity",1)}if($(this).is("textarea.teaser:not(.teaser-processed)"))return false;var e=$(this).addClass("textarea-processed"),g=null;$(this).wrap('<div class="resizable-textarea"><span></span></div>').parent().append($('<div class="grippie"></div>').mousedown(function(f){g=
+e.height()-f.pageY;e.css("opacity",0.25);$(document).mousemove(b).mouseup(a);return false}));var f=$("div.grippie",$(this).parent())[0];f.style.marginRight=f.offsetWidth-$(this)[0].offsetWidth+"px"});$("#modulenav .hoverable").hover(function(){$(this).addClass("hovered")},function(){$(this).removeClass("hovered")});$("#modulenav li").hover(function(){var b=$(this).width(),a=$("ul",this).width();a!=null&&a<b&&$("ul",this).css({width:b.toString()+"px"});$("ul",this).css("display","block")},function(){$("ul",
+this).css("display","none")});$("a.colorbox").attr("href",function(b,a){var e="";try{e=$(this).parents("tr").attr("id").replace(/__row/,"")}catch(g){if(e=="")return a}var f=a;a.indexOf("&caller=")==-1&&(f=a+"&caller="+e);return f});$(".colorbox").click(function(){$.fn.colorbox({iframe:true,width:"99%",height:"99%",href:this.href,title:this.title});return false});S3.addTooltips();now=new Date;$("form").append("<input type='hidden' value="+now.getTimezoneOffset()+" name='_utc_offset'/>");if(0<$("#socialmedia_share").length){var b=
+document.location.href;$("#socialmedia_share").append("<div class='socialmedia_element'><script src='//platform.linkedin.com/in.js'><\/script><script type='IN/Share' data-counter='right'><\/script></div>");$("#socialmedia_share").append("<div class='socialmedia_element'><a href='https://twitter.com/share' class='twitter-share-button' data-count='none' data-hashtags='sahana-eden'>Tweet</a><script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src='//platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document,'script','twitter-wjs');<\/script></div>");
+$("#socialmedia_share").append("<div class='socialmedia_element'><div id='fb-root'></div><script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = '//connect.facebook.net/en_US/all.js#xfbml=1'; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));<\/script> <div class='fb-like' data-send='false' data-layout='button_count' data-show-faces='true' data-href='"+b+"'></div></div>")}});
+function s3_tb_remove(){$.fn.colorbox.close()}function S3ConfirmClick(b,c){S3.interactive&&$(b).click(function(b){if(confirm(c))return!0;b.preventDefault();return!1})}function S3SetNavigateAwayConfirm(){window.onbeforeunload=function(){return S3.i18n.unsaved_changes}}function S3ClearNavigateAwayConfirm(){window.onbeforeunload=function(){}}
function S3EnableNavigateAwayConfirm(){$(document).ready(function(){0<$("[class=error]").length&&S3SetNavigateAwayConfirm();$(":input:not(input[id=gis_location_advanced_checkbox])").keypress(S3SetNavigateAwayConfirm);$(":input:not(input[id=gis_location_advanced_checkbox])").change(S3SetNavigateAwayConfirm);$("form").submit(S3ClearNavigateAwayConfirm)})}
(function(b){b.ajaxS3=function(c){var a=b.extend({},b.ajaxS3Settings,c);a.tryCount=0;c.message&&s3_showStatus(S3.i18n.ajax_get+" "+(c.message?c.message:S3.i18n.ajax_fmd)+"...",this.ajaxS3Settings.msgTimeout);a.success=function(b,a){s3_hideStatus();c.success&&c.success(b,a)};a.error=function(a,g){"timeout"==g?(this.tryCount++,this.tryCount<=this.retryLimit?(s3_showStatus(S3.i18n.ajax_get+" "+(c.message?c.message:S3.i18n.ajax_fmd)+"... "+S3.i18n.ajax_rtr+" "+this.tryCount,b.ajaxS3Settings.msgTimeout),
b.ajax(this)):s3_showStatus(S3.i18n.ajax_wht+" "+(this.retryLimit+1)+" "+S3.i18n.ajax_gvn,b.ajaxS3Settings.msgTimeout,!1,!0)):500==a.status?s3_showStatus(S3.i18n.ajax_500,b.ajaxS3Settings.msgTimeout,!1,!0):s3_showStatus(S3.i18n.ajax_dwn,b.ajaxS3Settings.msgTimeout,!1,!0)};b.ajax(a)};b.postS3=function(c,a,e,g){return b.ajaxS3({type:"POST",url:c,data:a,success:e,dataType:g})};b.getS3=function(c,a,e,g,f,j){b.isFunction(a)&&(j=f,f=g,g=e,e=a,a=null);if(j)var h=!1;return b.ajaxS3({type:"GET",url:c,async:h,
@@ -140,7 +141,7 @@ function s3_viewMap(b){var b=S3.Ap.concat("/gis/display_feature/")+b,c=$("#map")
function s3_viewMapMulti(b,c,a,e){var b=S3.Ap.concat("/gis/display_feature//?module=")+b+"&resource="+c+"&instance="+a+"&jresource="+e,g=$("#map").html(),b='<iframe width="640" height="480" src="'+b+'"></iframe>',c=$('<a href="#">'+S3.i18n.close_map+"</a>");c.bind("click",function(b){$("#map").html(g);b.preventDefault()});$("#map").html(b);$("#map").append($("<div style='margin-bottom: 10px' />").append(c))}
function s3_showMap(b){b=S3.Ap.concat("/gis/display_feature/")+b;(new Ext.Window({autoWidth:!0,floating:!0,items:[{xtype:"component",autoEl:{tag:"iframe",width:650,height:490,src:b}}]})).show()}
function S3FilterFieldChange(b){var c=b.FilterField,a=$('[name = "'+c+'"]');if(void 0!=a[0]){var e=b.Field,g=$('[name = "'+e+'"]'),f=void 0!=b.FilterOnLoad?b.FilterOnLoad:!0;a.change(function(){try{S3.JSONRequest[$(this).attr("id")].abort()}catch(f){}var h;0==a.length||void 0==a.length?h="":1==a.length?h=a.val():(h=[],a.filter("input:checked").each(function(){h.push($(this).val())}));if(""==h||void 0==h)g.attr("disabled","disabled");else{var m=b.FieldResource,k=$('[name = "'+(void 0!=b.Widget?b.Widget:
-e)+'"]'),l=void 0!=b.FieldKey?b.FieldKey:c,p=b.FieldID;void 0==p&&(p="id");l=void 0!=b.url&&null!=b.url?b.url:S3.Ap.concat("/",b.FieldPrefix,"/",m,".json?",m,".",l,"=");l=l.concat(h);0==g.length||void 0==g.length?FieldVal="":1==g.length?FieldVal=g.val():(FieldVal=[],g.filter("input:checked").each(function(){FieldVal.push($(this).val())}));var l=l.indexOf("?")?l.concat("&value="):l.concat("?value="),l=l.concat(FieldVal),v=b.GetWidgetHTML;void 0==v&&(v=!1);var r=void 0!=b.ShowEmptyField?b.ShowEmptyField:
+e)+'"]'),l=void 0!=b.FieldKey?b.FieldKey:c,p=b.FieldID;void 0==p&&(p="id");l=void 0!=b.url&&null!=b.url?b.url:S3.Ap.concat("/",b.FieldPrefix,"/",m,".json?",m,".",l,"=");l=l.concat(h);0==g.length||void 0==g.length?FieldVal="":1==g.length?FieldVal=g.val():(FieldVal=[],g.filter("input:checked").each(function(){FieldVal.push($(this).val())}));var l=-1!=l.indexOf("?")?l.concat("&value="):l.concat("?value="),l=l.concat(FieldVal),v=b.GetWidgetHTML;void 0==v&&(v=!1);var r=void 0!=b.ShowEmptyField?b.ShowEmptyField:
!0;void 0==b.msgNoRecords&&(b.msgNoRecords="-");if(void 0!=b.fncPrep)var s=b.fncPrep;else s=function(){return null},b.fncPrep=s;void 0==b.fncRepresent&&(b.fncRepresent=function(b){return b.name});k.hide();0==$("#"+m+"_ajax_throbber").length&&k.after('<div id="'+m+'_ajax_throbber" class="ajax_throbber"/>');v?S3.JSONRequest[$(this).attr("id")]=$.ajax({url:l,dataType:"html",context:b,success:function(b){$('[name = "'+this.Field+'"]');b!=""?k.html(b).change().removeAttr("disabled").show():k.attr("disabled",
"disabled");$("#"+m+"_ajax_throbber").remove()}}):S3.JSONRequest[$(this).attr("id")]=$.ajax({url:l,dataType:"json",context:b,success:function(b){var a="",c=this.FilterField,f=this.FieldResource,e=$('[name = "'+this.Field+'"]');$('[name = "'+c+'"]');PrepResult=s(b);if(b.length==0){if(r)var j=0,a=a+('<option value="">'+this.msgNoRecords+"</options>")}else for(var g=0;g<b.length;g++){g==0&&(j=b[g][p]);a=a+('<option value="'+b[g][p]+'">');a=a+this.fncRepresent(b[g],PrepResult);a=a+"</option>"}a!=""?e.html(a).val(j).change().removeAttr("disabled").show():
e.attr("disabled","disabled");selFieldAdd=$("#"+f+"_add");href=selFieldAdd.attr("href")+"&' + FilterField + '="+$('[name = "'+c+'"]').val();selFieldAdd.attr("href",href).show();$("#"+f+"_ajax_throbber").remove()}})}});""==g.val()&&f&&a.change()}}
@@ -336,19 +337,20 @@ S3.i18n.ac_widget_more_results+"</I></LI>"))}a.append(c+"</UL>")}k.remove();$('[
$(document).ready(function(){void 0!=$(".advanced-form").val()&&(void 0==$(".simple-form").val()?($(".simple-form").addClass("hide").hide(),$(".advanced-form").removeClass("hide").show()):("advanced"==$("#search-mode").attr("mode")?($(".simple-form").addClass("hide").hide(),$(".advanced-form").removeClass("hide").show()):$(".advanced-form").addClass("hide").hide(),$(".advanced-lnk").click(function(b){b.preventDefault();b=$('.search_form[fieldname="'+$(this).attr("fieldname")+'"]');b.length==0&&(b=
$(".search_form"));b.find(".simple-form").addClass("hide").hide();b.find(".advanced-form").removeClass("hide").show();return false}),$(".simple-lnk").click(function(b){b.preventDefault();b=$('.search_form[fieldname="'+$(this).attr("fieldname")+'"]');b.length==0&&(b=$(".search_form"));b.find(".advanced-form").addClass("hide").hide();b.find(".simple-form").removeClass("hide").show();return false})));$(".search_select_letter_label,.s3-grouped-checkboxes-widget-label").live("click",function(){var b=$(this);
b.next("table").toggleClass("hide");b.toggleClass("expanded")}).each(function(){widget=$(this).next();$(":checked",widget).length<1&&$(this).click()});$("div.simple-form").keyup(S3.search.AutocompleteTimer).click(S3.search.AutocompleteTimer).keypress(S3.search.CancelEnterPress);$("div.advanced-form").keyup(S3.search.AutocompleteTimer).click(S3.search.AutocompleteTimer).keypress(S3.search.ancelEnterPress);$(".search_autocomplete_result_list li span").live("click",function(){var b=$(this).parent(),
-c=b.parent(),a=c.parent(),e=a.parent().find(".hidden_input"),a=a.attr("fieldname"),b=b.attr("id");if(b!=void 0){e.val(b);e.change();e=$('[name ^= "'+a+'_search_simple"]');b=$(this).text();e.val(b);c.remove()}});$("button#save-search").on("click",S3.search.saveCurrentSearch)});
-(function(b){b.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var c=this.options,a=c.accept;this.isover=0;this.isout=1;this.accept=b.isFunction(a)?a:function(b){return b.is(a)};this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};b.ui.ddmanager.droppables[c.scope]=b.ui.ddmanager.droppables[c.scope]||[];b.ui.ddmanager.droppables[c.scope].push(this);
-c.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var c=b.ui.ddmanager.droppables[this.options.scope],a=0;a<c.length;a++)c[a]==this&&c.splice(a,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(c,a){"accept"==c&&(this.accept=b.isFunction(a)?a:function(b){return b.is(a)});b.Widget.prototype._setOption.apply(this,arguments)},_activate:function(c){var a=b.ui.ddmanager.current;this.options.activeClass&&
-this.element.addClass(this.options.activeClass);a&&this._trigger("activate",c,this.ui(a))},_deactivate:function(c){var a=b.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);a&&this._trigger("deactivate",c,this.ui(a))},_over:function(c){var a=b.ui.ddmanager.current;if(a&&(a.currentItem||a.element)[0]!=this.element[0])if(this.accept.call(this.element[0],a.currentItem||a.element))this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",
-c,this.ui(a))},_out:function(c){var a=b.ui.ddmanager.current;if(a&&(a.currentItem||a.element)[0]!=this.element[0])if(this.accept.call(this.element[0],a.currentItem||a.element))this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",c,this.ui(a))},_drop:function(c,a){var e=a||b.ui.ddmanager.current;if(!e||(e.currentItem||e.element)[0]==this.element[0])return!1;var g=!1;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var a=b.data(this,
-"droppable");if(a.options.greedy&&!a.options.disabled&&a.options.scope==e.options.scope&&a.accept.call(a.element[0],e.currentItem||e.element)&&b.ui.intersect(e,b.extend(a,{offset:a.element.offset()}),a.options.tolerance))return g=!0,!1});return g?!1:this.accept.call(this.element[0],e.currentItem||e.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",c,this.ui(e)),this.element):
-!1},ui:function(b){return{draggable:b.currentItem||b.element,helper:b.helper,position:b.position,offset:b.positionAbs}}});b.extend(b.ui.droppable,{version:"1.8.23"});b.ui.intersect=function(c,a,e){if(!a.offset)return!1;var g=(c.positionAbs||c.position.absolute).left,f=g+c.helperProportions.width,j=(c.positionAbs||c.position.absolute).top,h=j+c.helperProportions.height,m=a.offset.left,k=m+a.proportions.width,l=a.offset.top,p=l+a.proportions.height;switch(e){case "fit":return m<=g&&f<=k&&l<=j&&h<=p;
-case "intersect":return m<g+c.helperProportions.width/2&&f-c.helperProportions.width/2<k&&l<j+c.helperProportions.height/2&&h-c.helperProportions.height/2<p;case "pointer":return b.ui.isOver((c.positionAbs||c.position.absolute).top+(c.clickOffset||c.offset.click).top,(c.positionAbs||c.position.absolute).left+(c.clickOffset||c.offset.click).left,l,m,a.proportions.height,a.proportions.width);case "touch":return(j>=l&&j<=p||h>=l&&h<=p||j<l&&h>p)&&(g>=m&&g<=k||f>=m&&f<=k||g<m&&f>k);default:return!1}};
-b.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(c,a){var e=b.ui.ddmanager.droppables[c.options.scope]||[],g=a?a.type:null,f=(c.currentItem||c.element).find(":data(droppable)").andSelf(),j=0;a:for(;j<e.length;j++)if(!(e[j].options.disabled||c&&!e[j].accept.call(e[j].element[0],c.currentItem||c.element))){for(var h=0;h<f.length;h++)if(f[h]==e[j].element[0]){e[j].proportions.height=0;continue a}e[j].visible="none"!=e[j].element.css("display");e[j].visible&&("mousedown"==
-g&&e[j]._activate.call(e[j],a),e[j].offset=e[j].element.offset(),e[j].proportions={width:e[j].element[0].offsetWidth,height:e[j].element[0].offsetHeight})}},drop:function(c,a){var e=!1;b.each(b.ui.ddmanager.droppables[c.options.scope]||[],function(){if(this.options&&(!this.options.disabled&&this.visible&&b.ui.intersect(c,this,this.options.tolerance)&&(e=this._drop.call(this,a)||e),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],c.currentItem||c.element)))this.isout=1,this.isover=
-0,this._deactivate.call(this,a)});return e},dragStart:function(c,a){c.element.parents(":not(body,html)").bind("scroll.droppable",function(){c.options.refreshPositions||b.ui.ddmanager.prepareOffsets(c,a)})},drag:function(c,a){c.options.refreshPositions&&b.ui.ddmanager.prepareOffsets(c,a);b.each(b.ui.ddmanager.droppables[c.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var e=b.ui.intersect(c,this,this.options.tolerance);if(e=!e&&1==this.isover?"isout":e&&0==
-this.isover?"isover":null){var g;if(this.options.greedy){var f=this.element.parents(":data(droppable):eq(0)");f.length&&(g=b.data(f[0],"droppable"),g.greedyChild="isover"==e?1:0)}g&&"isover"==e&&(g.isover=0,g.isout=1,g._out.call(g,a));this[e]=1;this["isout"==e?"isover":"isout"]=0;this["isover"==e?"_over":"_out"].call(this,a);g&&"isout"==e&&(g.isout=0,g.isover=1,g._over.call(g,a))}}})},dragStop:function(c,a){c.element.parents(":not(body,html)").unbind("scroll.droppable");c.options.refreshPositions||
-b.ui.ddmanager.prepareOffsets(c,a)}}})(jQuery);
+c=b.parent(),a=c.parent(),e=a.parent().find(".hidden_input"),a=a.attr("fieldname"),b=b.attr("id");if(b!=void 0){e.val(b);e.change();e=$('[name ^= "'+a+'_search_simple"]');b=$(this).text();e.val(b);c.remove()}});$("button#save-search").on("click",S3.search.saveCurrentSearch);$("button#gis_search_polygon_input_clear").on("click",function(b){S3.search.clearMapPolygon();b.preventDefault()});$("input#gis_search_polygon_input").on("change",S3.search.toggleMapClearButton).trigger("change")});
+S3.search.clearMapPolygon=function(){S3.gis.lastDraftFeature&&S3.gis.lastDraftFeature.destroy();$("input#gis_search_polygon_input").val("").trigger("change")};
+S3.search.toggleMapClearButton=function(b){var b=$(b.currentTarget),c=b.siblings("button#gis_search_polygon_input_clear");b.val()?c.show():c.hide()}(function(b){b.widget("ui.droppable",{widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect"},_create:function(){var c=this.options,a=c.accept;this.isover=0;this.isout=1;this.accept=b.isFunction(a)?a:function(b){return b.is(a)};this.proportions={width:this.element[0].offsetWidth,
+height:this.element[0].offsetHeight};b.ui.ddmanager.droppables[c.scope]=b.ui.ddmanager.droppables[c.scope]||[];b.ui.ddmanager.droppables[c.scope].push(this);c.addClasses&&this.element.addClass("ui-droppable")},destroy:function(){for(var c=b.ui.ddmanager.droppables[this.options.scope],a=0;a<c.length;a++)c[a]==this&&c.splice(a,1);this.element.removeClass("ui-droppable ui-droppable-disabled").removeData("droppable").unbind(".droppable");return this},_setOption:function(c,a){"accept"==c&&(this.accept=
+b.isFunction(a)?a:function(b){return b.is(a)});b.Widget.prototype._setOption.apply(this,arguments)},_activate:function(c){var a=b.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass);a&&this._trigger("activate",c,this.ui(a))},_deactivate:function(c){var a=b.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass);a&&this._trigger("deactivate",c,this.ui(a))},_over:function(c){var a=b.ui.ddmanager.current;if(a&&(a.currentItem||
+a.element)[0]!=this.element[0])if(this.accept.call(this.element[0],a.currentItem||a.element))this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",c,this.ui(a))},_out:function(c){var a=b.ui.ddmanager.current;if(a&&(a.currentItem||a.element)[0]!=this.element[0])if(this.accept.call(this.element[0],a.currentItem||a.element))this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",c,this.ui(a))},_drop:function(c,a){var e=a||
+b.ui.ddmanager.current;if(!e||(e.currentItem||e.element)[0]==this.element[0])return!1;var g=!1;this.element.find(":data(droppable)").not(".ui-draggable-dragging").each(function(){var a=b.data(this,"droppable");if(a.options.greedy&&!a.options.disabled&&a.options.scope==e.options.scope&&a.accept.call(a.element[0],e.currentItem||e.element)&&b.ui.intersect(e,b.extend(a,{offset:a.element.offset()}),a.options.tolerance))return g=!0,!1});return g?!1:this.accept.call(this.element[0],e.currentItem||e.element)?
+(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",c,this.ui(e)),this.element):!1},ui:function(b){return{draggable:b.currentItem||b.element,helper:b.helper,position:b.position,offset:b.positionAbs}}});b.extend(b.ui.droppable,{version:"1.8.23"});b.ui.intersect=function(c,a,e){if(!a.offset)return!1;var g=(c.positionAbs||c.position.absolute).left,f=g+c.helperProportions.width,j=
+(c.positionAbs||c.position.absolute).top,h=j+c.helperProportions.height,m=a.offset.left,k=m+a.proportions.width,l=a.offset.top,p=l+a.proportions.height;switch(e){case "fit":return m<=g&&f<=k&&l<=j&&h<=p;case "intersect":return m<g+c.helperProportions.width/2&&f-c.helperProportions.width/2<k&&l<j+c.helperProportions.height/2&&h-c.helperProportions.height/2<p;case "pointer":return b.ui.isOver((c.positionAbs||c.position.absolute).top+(c.clickOffset||c.offset.click).top,(c.positionAbs||c.position.absolute).left+
+(c.clickOffset||c.offset.click).left,l,m,a.proportions.height,a.proportions.width);case "touch":return(j>=l&&j<=p||h>=l&&h<=p||j<l&&h>p)&&(g>=m&&g<=k||f>=m&&f<=k||g<m&&f>k);default:return!1}};b.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(c,a){var e=b.ui.ddmanager.droppables[c.options.scope]||[],g=a?a.type:null,f=(c.currentItem||c.element).find(":data(droppable)").andSelf(),j=0;a:for(;j<e.length;j++)if(!(e[j].options.disabled||c&&!e[j].accept.call(e[j].element[0],c.currentItem||
+c.element))){for(var h=0;h<f.length;h++)if(f[h]==e[j].element[0]){e[j].proportions.height=0;continue a}e[j].visible="none"!=e[j].element.css("display");e[j].visible&&("mousedown"==g&&e[j]._activate.call(e[j],a),e[j].offset=e[j].element.offset(),e[j].proportions={width:e[j].element[0].offsetWidth,height:e[j].element[0].offsetHeight})}},drop:function(c,a){var e=!1;b.each(b.ui.ddmanager.droppables[c.options.scope]||[],function(){if(this.options&&(!this.options.disabled&&this.visible&&b.ui.intersect(c,
+this,this.options.tolerance)&&(e=this._drop.call(this,a)||e),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],c.currentItem||c.element)))this.isout=1,this.isover=0,this._deactivate.call(this,a)});return e},dragStart:function(c,a){c.element.parents(":not(body,html)").bind("scroll.droppable",function(){c.options.refreshPositions||b.ui.ddmanager.prepareOffsets(c,a)})},drag:function(c,a){c.options.refreshPositions&&b.ui.ddmanager.prepareOffsets(c,a);b.each(b.ui.ddmanager.droppables[c.options.scope]||
+[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var e=b.ui.intersect(c,this,this.options.tolerance);if(e=!e&&1==this.isover?"isout":e&&0==this.isover?"isover":null){var g;if(this.options.greedy){var f=this.element.parents(":data(droppable):eq(0)");f.length&&(g=b.data(f[0],"droppable"),g.greedyChild="isover"==e?1:0)}g&&"isover"==e&&(g.isover=0,g.isout=1,g._out.call(g,a));this[e]=1;this["isout"==e?"isover":"isout"]=0;this["isover"==e?"_over":"_out"].call(this,a);g&&"isout"==
+e&&(g.isout=0,g.isover=1,g._over.call(g,a))}}})},dragStop:function(c,a){c.element.parents(":not(body,html)").unbind("scroll.droppable");c.options.refreshPositions||b.ui.ddmanager.prepareOffsets(c,a)}}})(jQuery);
(function(b,c){function a(){this.debug=!0;this._curInst=null;this._isInline=!1;this._disabledInputs=[];this._inDialog=this._timepickerShowing=!1;this._dialogClass="ui-timepicker-dialog";this._mainDivId="ui-timepicker-div";this._inlineClass="ui-timepicker-inline";this._currentClass="ui-timepicker-current";this._dayOverClass="ui-timepicker-days-cell-over";this.regional=[];this.regional[""]={hourText:"Hour",minuteText:"Minute",amPmText:["AM","PM"],closeButtonText:"Done",nowButtonText:"Now",deselectButtonText:"Deselect"};
this._defaults={showOn:"focus",button:null,showAnim:"fadeIn",showOptions:{},appendText:"",beforeShow:null,onSelect:null,onClose:null,timeSeparator:":",periodSeparator:" ",showPeriod:!1,showPeriodLabels:!0,showLeadingZero:!0,showMinutesLeadingZero:!0,altField:"",defaultTime:"now",myPosition:"left top",atPosition:"left bottom",onHourShow:null,onMinuteShow:null,hours:{starts:0,ends:23},minutes:{starts:0,ends:55,interval:5},rows:4,showHours:!0,showMinutes:!0,optionalMinutes:!1,showCloseButton:!1,showNowButton:!1,
showDeselectButton:!1};b.extend(this._defaults,this.regional[""]);this.tpDiv=b('<div id="'+this._mainDivId+'" class="ui-timepicker ui-widget ui-helper-clearfix ui-corner-all " style="display: none"></div>')}function e(a,e){b.extend(a,e);for(var h in e)if(null==e[h]||e[h]==c)a[h]=e[h];return a}b.extend(b.ui,{timepicker:{version:"0.2.9"}});var g=(new Date).getTime();b.extend(a.prototype,{markerClassName:"hasTimepicker",log:function(){this.debug&&console.log.apply("",arguments)},_widgetTimepicker:function(){return this.tpDiv},
@@ -376,7 +378,7 @@ b.hours?" ui-state-active ":" ")+'">'+k.toString()+"</span></td>"},_generateHTML
'<td><span class="ui-state-default ui-state-disabled" >'+e+"</span></td>"},_enableTimepicker:function(a){var c=b(a),e=c.attr("id"),g=b.data(a,"timepicker");if(c.hasClass(this.markerClassName)){var k=a.nodeName.toLowerCase();"input"==k?(a.disabled=!1,g.trigger.filter("button").each(function(){this.disabled=!1}).end()):("div"==k||"span"==k)&&c.children("."+this._inlineClass).children().removeClass("ui-state-disabled");this._disabledInputs=b.map(this._disabledInputs,function(b){return b==e?null:b})}},
_disableTimepicker:function(a){var c=b(a),e=b.data(a,"timepicker");if(c.hasClass(this.markerClassName)){var g=a.nodeName.toLowerCase();"input"==g?(a.disabled=!0,e.trigger.filter("button").each(function(){this.disabled=!0}).end()):("div"==g||"span"==g)&&c.children("."+this._inlineClass).children().addClass("ui-state-disabled");this._disabledInputs=b.map(this._disabledInputs,function(b){return b==a?null:b});this._disabledInputs[this._disabledInputs.length]=c.attr("id")}},_isDisabledTimepicker:function(b){if(!b)return!1;
for(var a=0;a<this._disabledInputs.length;a++)if(this._disabledInputs[a]==b)return!0;return!1},_checkOffset:function(a,c,e){var g=a.tpDiv.outerWidth(),k=a.tpDiv.outerHeight(),l=a.input?a.input.outerWidth():0,p=a.input?a.input.outerHeight():0,v=document.documentElement.clientWidth+b(document).scrollLeft(),r=document.documentElement.clientHeight+b(document).scrollTop();c.left-=this._get(a,"isRTL")?g-l:0;c.left-=e&&c.left==a.input.offset().left?b(document).scrollLeft():0;c.top-=e&&c.top==a.input.offset().top+
-p?b(document).scrollTop():0;c.left-=Math.min(c.left,c.left+g>v&&v>g?Math.abs(c.left+g-v):0);c.top-=Math.min(c.top,c.top+k>r&&r>k?Math.abs(k+p):0);return c},_findPos:function(a){for(var c=this._get(this._getInst(a),"isRTL");a&&("hidden"==a.type||1!=a.nodeType);)a=a[c?"previousSibling":"nextSibling"];a=b(a).offset();return[a.left,a.top]},_getBorders:function(a){var b=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},
+p?b(document).scrollTop():0;c.left-=Math.min(c.left,c.left+g>v&&v>g?Math.abs(c.left+g-v):0);c.top-=Math.min(c.top,c.top+k>r&&r>k?Math.abs(k+p):0);return c},_findPos:function(a){for(var c=this._get(this._getInst(a),"isRTL");a&&("hidden"==a.type||1!=a.nodeType);)a=a[c?"previousSibling":"nextSibling"];a=b(a).offset();return[a.left,a.top]},_getBorders:function(b){var a=function(b){return{thin:1,medium:2,thick:3}[b]||b};return[parseFloat(a(b.css("border-left-width"))),parseFloat(a(b.css("border-top-width")))]},
_checkExternalClick:function(a){b.timepicker._curInst&&(a=b(a.target),a[0].id!=b.timepicker._mainDivId&&0==a.parents("#"+b.timepicker._mainDivId).length&&!a.hasClass(b.timepicker.markerClassName)&&!a.hasClass(b.timepicker._triggerClass)&&b.timepicker._timepickerShowing&&(!b.timepicker._inDialog||!b.blockUI)&&b.timepicker._hideTimepicker())},_hideTimepicker:function(a){var c=this._curInst;if(c&&!(a&&c!=b.data(a,"timepicker"))&&this._timepickerShowing){var a=this._get(c,"showAnim"),e=this._get(c,"duration"),
g=function(){b.timepicker._tidyDialog(c);this._curInst=null};if(b.effects&&b.effects[a])c.tpDiv.hide(a,b.timepicker._get(c,"showOptions"),e,g);else c.tpDiv["slideDown"==a?"slideUp":"fadeIn"==a?"fadeOut":"hide"](a?e:null,g);a||g();(a=this._get(c,"onClose"))&&a.apply(c.input?c.input[0]:null,[c.input?c.input.val():"",c]);this._timepickerShowing=!1;this._lastInput=null;this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),b.blockUI&&(b.unblockUI(),b("body").append(this.tpDiv)));
this._inDialog=!1}},_tidyDialog:function(a){a.tpDiv.removeClass(this._dialogClass).unbind(".ui-timepicker")},_getInst:function(a){try{return b.data(a,"timepicker")}catch(c){throw"Missing instance data for this timepicker";}},_get:function(a,b){return a.settings[b]!==c?a.settings[b]:this._defaults[b]},_setTimeFromField:function(a){if(a.input.val()!=a.lastVal){var c=this._get(a,"defaultTime"),c="now"==c?this._getCurrentTimeRounded(a):c;!1==a.inline&&""!=a.input.val()&&(c=a.input.val());if(c instanceof
View
8 static/scripts/S3/s3.dataTables.js
@@ -524,7 +524,7 @@ $(document).ready(function() {
/****************************************************************/
/* Helper function to add the new group row */
- /****************************************************************/
+ /****************************************************************/
function addNewGroup(t,
sGroup,
level,
@@ -614,7 +614,7 @@ $(document).ready(function() {
/*********************************************************************
* Function to group the data
- *
+ *
* @param oSettings the dataTable settings
* @param t the index of the table
* @param group The index of the colum that will be grouped
@@ -1020,7 +1020,9 @@ Ext.onReady(function(){
}
var s3_search_mapButton = Ext.get('gis_search_map-btn');
if (s3_search_mapButton) {
- s3_search_mapButton.on('click', function() {
+ s3_search_mapButton.on('click', function(evt) {
+ // prevent button submitting the form
+ evt.preventDefault();
// Enable the polygon control
S3.gis.polygonButton.enable();
// @ToDo: Set appropriate Bounds
View
2  static/scripts/S3/s3.dataTables.min.js
@@ -167,4 +167,4 @@ r-s.iCacheLower);json.aaData.splice(m,json.aaData.length)}k(json)}};else fa=ba=!
function s3FormatRequest(f,q,m){t=tableIdReverse("#"+q);dt=oDataTable[t];if(oSetting=dt.dataTableSettings[t]){argData="id="+q;serverFilterArgs=$("#"+q+"_dataTable_filter");""!=serverFilterArgs.val()&&(argData+="&sFilter="+serverFilterArgs.val());argData+="&sSearch="+oSetting.oPreviousSearch.sSearch;sSort=[];aaSort=null!==oSetting.aaSortingFixed?oSetting.aaSortingFixed.concat(oSetting.aaSorting):oSetting.aaSorting.slice();argData+="&iSortingCols="+aaSort.length;for(i=0;i<aaSort.length;i++)argData+=
"&iSortCol_"+i+"="+aaSort[i][0],argData+="&sSortDir_"+i+"="+aaSort[i][1];m=m+"."+f+"?"+argData}else m=m+"."+f;window.location=m}function s3_gis_search_layer_loadend(f){var q=f.object;(f=q.getDataExtent())&&map.zoomToExtent(f);Ext.iterate(q.strategies,function(f,p){"OpenLayers.Strategy.AttributeCluster"==f.CLASS_NAME&&q.strategies[p].activate()});q.events.un({loadend:s3_gis_search_layer_loadend})}
Ext.onReady(function(){var f=Ext.get("gis_datatables_map-btn");if(f)f.on("click",function(){Ext.iterate(map.layers,function(f,m){if("search_results"==f.s3_layer_id){var p=map.layers[m];p.events.on({loadend:s3_gis_search_layer_loadend});Ext.iterate(p.strategies,function(f,d){"OpenLayers.Strategy.AttributeCluster"==f.CLASS_NAME&&p.strategies[d].deactivate()});p.setVisibility(!0)}});S3.gis.polygonButton&&S3.gis.polygonButton.disable();S3.gis.mapWin.show();$(".olMapViewport").removeClass("crosshair");
-$("#gis_datatables_map-btn").parent().addClass("tab_here");$("#gis_datatables_list_tab").parent().removeClass("tab_here").addClass("tab_other");$("div.x-tool-close").click(function(){$("#gis_datatables_map-btn").parent().removeClass("tab_here").addClass("tab_other");$("#gis_datatables_list_tab").parent().removeClass("tab_other").addClass("tab_here")})});if(f=Ext.get("gis_search_map-btn"))f.on("click",function(){S3.gis.polygonButton.enable();S3.gis.mapWin.show();$(".olMapViewport").addClass("crosshair")})});
+$("#gis_datatables_map-btn").parent().addClass("tab_here");$("#gis_datatables_list_tab").parent().removeClass("tab_here").addClass("tab_other");$("div.x-tool-close").click(function(){$("#gis_datatables_map-btn").parent().removeClass("tab_here").addClass("tab_other");$("#gis_datatables_list_tab").parent().removeClass("tab_other").addClass("tab_here")})});if(f=Ext.get("gis_search_map-btn"))f.on("click",function(f){f.preventDefault();S3.gis.polygonButton.enable();S3.gis.mapWin.show();$(".olMapViewport").addClass("crosshair")})});
View
16 static/scripts/S3/s3.gis.controls.js
@@ -339,7 +339,7 @@ function googleEarthKmlLoaded(object) {
// Google Streetview control
function addGoogleStreetviewControl(toolbar) {
- var Clicker = OpenLayers.Class(OpenLayers.Control, {
+ var Clicker = OpenLayers.Class(OpenLayers.Control, {
defaults: {
pixelTolerance: 1,
stopSingle: true
@@ -348,11 +348,11 @@ function addGoogleStreetviewControl(toolbar) {
this.handlerOptions = OpenLayers.Util.extend(
{}, this.defaults
);
- OpenLayers.Control.prototype.initialize.apply(this, arguments);
+ OpenLayers.Control.prototype.initialize.apply(this, arguments);
this.handler = new OpenLayers.Handler.Click(
this, {click: this.trigger}, this.handlerOptions
);
- },
+ },
trigger: function(event) {
openStreetviewPopup(map.getLonLatFromViewPortPx(event.xy));
}
@@ -491,7 +491,7 @@ function addMeasureControls(toolbar) {
allowDepress: true,
enableToggle: true
});
-
+
toolbar.add(areaButton);
}
}
@@ -587,7 +587,7 @@ function addPolygonControl(toolbar, polygon_pressed, not_regular) {
}
// update Form Field
var WKT = feature.geometry.transform(S3.gis.projection_current, S3.gis.proj4326).toString();
- $('#gis_search_polygon_input').val(WKT);
+ $('#gis_search_polygon_input').val(WKT).trigger('change');
$('#gis_location_wkt').val(WKT);
// Prepare in case user draws a new polygon
S3.gis.lastDraftFeature = feature;
@@ -846,13 +846,13 @@ function addRemoveLayersControl() {
uploadText: S3.i18n.gis_uploadlayer,
relativeUploadOnly: false
});
-
+
// @ToDo: Populate this from disabled Catalogue Layers (to which the user has access)
// Use WMStore for the GeoServer which we can write to?
// Use current layerStore for Removelayer()?
//var store = S3.gis.mapPanel.layers;
var store = new GeoExt.data.LayerStore();
-
+
// Set up shortcuts to allow GXP Plugin to work
S3.gis.addLayersControl.target = S3.gis.layerTree;
S3.gis.layerTree.proxy = OpenLayers.ProxyHost; // Required for 'Add a New Server'
@@ -981,7 +981,7 @@ function addLayerPropertiesButton() {
var pcs = [];
for (i=0; i < ids.length; i++) {
q = $('#' + ids[i]).serialize();
- if (q) {
+ if (q) {
pcs.push(q);
}
}
View
4 static/scripts/S3/s3.gis.min.js
@@ -93,8 +93,8 @@ function addMeasureControls(a){var b=new OpenLayers.Style;b.addRules([new OpenLa
function addNavigationControl(a){var b=new OpenLayers.Control.NavigationHistory;map.addControl(b);b.activate();var c=new Ext.Toolbar.Button({iconCls:"back",tooltip:S3.i18n.gis_navPrevious,handler:b.previous.trigger}),b=new Ext.Toolbar.Button({iconCls:"next",tooltip:S3.i18n.gis_navNext,handler:b.next.trigger});a.addButton(c);a.addButton(b)}
function addPointControl(a,b){OpenLayers.Handler.PointS3=OpenLayers.Class(OpenLayers.Handler.Point,{dblclick:function(){return!0},CLASS_NAME:"OpenLayers.Handler.PointS3"});S3.gis.pointButton=new GeoExt.Action({control:new OpenLayers.Control.DrawFeature(S3.gis.draftLayer,OpenLayers.Handler.PointS3,{featureAdded:function(a){S3.gis.lastDraftFeature?S3.gis.lastDraftFeature.destroy():1<S3.gis.draftLayer.features.length&&S3.gis.draftLayer.features[0].destroy();var b=a.geometry.getBounds().getCenterLonLat();
b.transform(S3.gis.projection_current,S3.gis.proj4326);$("#gis_location_lon").val(b.lon);$("#gis_location_lat").val(b.lat);S3.gis.lastDraftFeature=a}}),handler:function(){S3.gis.pointButton.items[0].pressed?$(".olMapViewport").addClass("crosshair"):$(".olMapViewport").removeClass("crosshair")},map:map,iconCls:"drawpoint-off",tooltip:S3.i18n.gis_draw_feature,toggleGroup:"controls",allowDepress:!0,enableToggle:!0,pressed:b});a.add(S3.gis.pointButton)}
-function addPolygonControl(a,b,c){S3.gis.polygonButton=new GeoExt.Action({control:new OpenLayers.Control.DrawFeature(S3.gis.draftLayer,c?OpenLayers.Handler.Polygon:OpenLayers.Handler.RegularPolygon,{handlerOptions:c?{sides:4,snapAngle:90}:{},featureAdded:function(a){S3.gis.lastDraftFeature&&S3.gis.lastDraftFeature.destroy();var b=a.geometry.transform(S3.gis.projection_current,S3.gis.proj4326).toString();$("#gis_search_polygon_input").val(b);$("#gis_location_wkt").val(b);S3.gis.lastDraftFeature=a}}),
-handler:function(){S3.gis.polygonButton.items[0].pressed?$(".olMapViewport").addClass("crosshair"):$(".olMapViewport").removeClass("crosshair")},map:map,iconCls:"drawpolygon-off",tooltip:S3.i18n.gis_draw_polygon,toggleGroup:"controls",allowDepress:!0,pressed:b,enableToggle:!0,activateOnEnable:!0,deactivateOnDisable:!0});a.add(S3.gis.polygonButton)}
+function addPolygonControl(a,b,c){S3.gis.polygonButton=new GeoExt.Action({control:new OpenLayers.Control.DrawFeature(S3.gis.draftLayer,c?OpenLayers.Handler.Polygon:OpenLayers.Handler.RegularPolygon,{handlerOptions:c?{sides:4,snapAngle:90}:{},featureAdded:function(a){S3.gis.lastDraftFeature&&S3.gis.lastDraftFeature.destroy();var b=a.geometry.transform(S3.gis.projection_current,S3.gis.proj4326).toString();$("#gis_search_polygon_input").val(b).trigger("change");$("#gis_location_wkt").val(b);S3.gis.lastDraftFeature=
+a}}),handler:function(){S3.gis.polygonButton.items[0].pressed?$(".olMapViewport").addClass("crosshair"):$(".olMapViewport").removeClass("crosshair")},map:map,iconCls:"drawpolygon-off",tooltip:S3.i18n.gis_draw_polygon,toggleGroup:"controls",allowDepress:!0,pressed:b,enableToggle:!0,activateOnEnable:!0,deactivateOnDisable:!0});a.add(S3.gis.polygonButton)}
function addPotlatchButton(a){var b=new Ext.Toolbar.Button({iconCls:"potlatch",tooltip:S3.i18n.gis_potlatch,handler:function(){var a=map.getZoom();if(14>a)alert(S3.gis.osm_oauth);else{var b=map.getCenter();b.transform(map.getProjectionObject(),S3.gis.proj4326);a=S3.Ap.concat("/gis/potlatch2/potlatch2.html")+"?lat="+b.lat+"&lon="+b.lon+"&zoom="+a;window.open(a)}}});a.addSeparator();a.addButton(b)}
function addSaveButton(a){var b=new Ext.Toolbar.Button({iconCls:"save",tooltip:S3.i18n.gis_save,handler:function(){var a=getState(),b=Ext.util.JSON.encode(a.layers),e=Ext.util.JSON.encode(a.plugins),f=S3.gis.config_id?S3.Ap.concat("/gis/config/"+S3.gis.config_id+".url/update"):S3.Ap.concat("/gis/config.url/create");Ext.Ajax.request({url:f,method:"POST",success:function(a){if(a=Ext.decode(a.responseText).message.split("=",2)[1])S3.gis.config_id=a,a=S3.Ap.concat("/gis/config/",a,"/layer_entity"),$("#gis_menu_config").attr("href",
a)},params:{lat:a.lat,lon:a.lon,zoom:a.zoom,layers:b,plugins:e}})}});a.addSeparator();a.addButton(b)}
View
4 static/scripts/S3/s3.locationselector.widget.js
@@ -11,7 +11,7 @@ $(function() {
});
function s3_gis_locationselector_jQuery_onReady() {
- if ( typeof(S3.gis.location_id) == 'undefined' ) {
+ if (typeof(S3.gis.location_id) == 'undefined') {
// This page doesn't include the Location Selector Widget
} else {
// Hide the Label row
@@ -170,6 +170,7 @@ function s3_gis_autocomplete(level) {
if (undefined != $('#gis_location_L' + level + '_ac').val()) {
$('#gis_location_L' + level + '_ac').autocomplete({
source: s3_gis_ac_set_source(level),
+ delay: 500,
minLength: 2,
search: function(event, ui) {
$( '#gis_location_L' + level + '_throbber' ).removeClass('hide').show();
@@ -211,6 +212,7 @@ function s3_gis_autocomplete_search() {
if (undefined != $('#gis_location_search_ac').val()) {
$('#gis_location_search_ac').autocomplete({
source: s3_gis_ac_set_search_source(),
+ delay: 500,
minLength: 2,
search: function(event, ui) {
$('#gis_location_search_throbber').removeClass('hide').show();
View
4 static/scripts/S3/s3.locationselector.widget.min.js
@@ -4,9 +4,9 @@ $("#gis_location_name").val(a)}});$("#gis_location_L0").change(function(){s3_gis
(s3_gis_hide_selector(),$("#gis_location_expand").addClass("expanded"),$("#gis_location_expand").removeClass("expand")):(s3_gis_show_tab("add"),$("#gis_location_expand").addClass("expand"),$("#gis_location_expand").removeClass("expanded"));a.preventDefault()});$("#gis_location_search_select-btn").click(function(a){s3_gis_select_search_result();a.preventDefault()});$("form").submit(function(){S3ClearNavigateAwayConfirm();return s3_gis_save_locations()?!0:!1})}}Ext.onReady(function(){s3_gis_locationselector_Ext_onReady()});
function s3_gis_locationselector_Ext_onReady(){var a=Ext.get("gis_location_map-btn");if(a)a.on("click",function(){S3.gis.mapWin.show();var a=$("#gis_location_lat").val(),c=$("#gis_location_lon").val();if(!a||!c)$(".olMapViewport").addClass("crosshair"),S3.gis.pointButton.control.activate()})}function s3_gis_locationselector_activate(){s3_gis_locationselector_jQuery_onReady();s3_gis_locationselector_Ext_onReady()}
function s3_gis_autocompletes(){s3_gis_autocomplete(1);s3_gis_autocomplete(2);s3_gis_autocomplete(3);s3_gis_autocomplete(4);s3_gis_autocomplete(5);s3_gis_autocomplete_search()}
-function s3_gis_autocomplete(a){void 0!=$("#gis_location_L"+a+"_ac").val()&&($("#gis_location_L"+a+"_ac").autocomplete({source:s3_gis_ac_set_source(a),minLength:2,search:function(){$("#gis_location_L"+a+"_throbber").removeClass("hide").show();$("#gis_location_L"+a).val("");return!0},response:function(b,c,f){$("#gis_location_L"+a+"_throbber").hide();return f},focus:function(b,c){$("#gis_location_L"+a+"_ac").val(c.item.name);return!1},select:function(b,c){$("#gis_location_L"+a+"_ac").val(c.item.name);
+function s3_gis_autocomplete(a){void 0!=$("#gis_location_L"+a+"_ac").val()&&($("#gis_location_L"+a+"_ac").autocomplete({source:s3_gis_ac_set_source(a),delay:500,minLength:2,search:function(){$("#gis_location_L"+a+"_throbber").removeClass("hide").show();$("#gis_location_L"+a).val("");return!0},response:function(b,c,f){$("#gis_location_L"+a+"_throbber").hide();return f},focus:function(b,c){$("#gis_location_L"+a+"_ac").val(c.item.name);return!1},select:function(b,c){$("#gis_location_L"+a+"_ac").val(c.item.name);
$("#gis_location_L"+a).val(c.item.id);"L1"==c.item.level&&c.item.parent&&""==$("#gis_location_L0").val()&&$("#gis_location_L0").val(c.item.parent);$("ul.ui-autocomplete").hide();s3_gis_autocomplete(parseInt(c.item.level.replace("L",""))+1);return!1}}).data("autocomplete")._renderItem=function(a,c){return $("<li></li>").data("item.autocomplete",c).append("<a>"+c.name+"</a>").appendTo(a)})}
-function s3_gis_autocomplete_search(){void 0!=$("#gis_location_search_ac").val()&&($("#gis_location_search_ac").autocomplete({source:s3_gis_ac_set_search_source(),minLength:2,search:function(){$("#gis_location_search_throbber").removeClass("hide").show();$("#gis_location_search_select-btn").hide();return!0},response:function(a,b,c){$("#gis_location_search_throbber").hide();return c},focus:function(a,b){$("#gis_location_search_ac").val(b.item.name);return!1},select:function(a,b){$("#gis_location_search_ac").val(b.item.name);
+function s3_gis_autocomplete_search(){void 0!=$("#gis_location_search_ac").val()&&($("#gis_location_search_ac").autocomplete({source:s3_gis_ac_set_search_source(),delay:500,minLength:2,search:function(){$("#gis_location_search_throbber").removeClass("hide").show();$("#gis_location_search_select-btn").hide();return!0},response:function(a,b,c){$("#gis_location_search_throbber").hide();return c},focus:function(a,b){$("#gis_location_search_ac").val(b.item.name);return!1},select:function(a,b){$("#gis_location_search_ac").val(b.item.name);
$("ul.ui-autocomplete").hide();s3_gis_ac_search_selected(b.item);return!1}}).data("autocomplete")._renderItem=function(a,b){var c=b.name&&b.addr_street?"<a>"+b.name+", "+b.addr_street.split(",")[0].split("\n")[0]+"</a>":b.name?"<a>"+b.name+"</a>":"<a>"+b.addr_street.split(",")[0].split("\n")[0]+"</a>";return $("<li></li>").data("item.autocomplete",b).append(c).appendTo(a)})}
function s3_gis_ac_set_source(a){var b=$("#gis_location_L"+(a-1)).val(),c;""==b&&1<a&&(c=$("#gis_location_L"+(a-2)).val(),""==c&&2<a&&(c=$("#gis_location_L"+(a-2)).val(),""==c&&3<a&&(c=$("#gis_location_L"+(a-3)).val(),""==c&&4<a&&(c=$("#gis_location_L"+(a-4)).val(),""==c&&5<a&&(c=$("#gis_location_L"+(a-5)).val())))));return b?S3.gis.url+"/search.json?filter=~&field=name&level=L"+a+"&parent="+b:c?S3.gis.url+"/search.json?filter=~&field=name&level=L"+a+"&children="+c:S3.gis.url+"/search.json?filter=~&field=name&level=L"+
a}function s3_gis_ac_set_search_source(){return S3.gis.url+"/search.json?filter=~&field=name&field2=addr_street&level=nullnone"}
View
43 static/scripts/S3/s3.search.js
@@ -88,7 +88,7 @@ S3.search.AutocompleteAjax = function(selSearchDiv) {
var selInput = $('[name ^= "' + Fieldname + '_search_simple"]');
// Clear the current input
- selHiddenInput.val("");
+ selHiddenInput.val('');
selHiddenInput.change(); // Trigger other events
var selResultList = $('#' + Fieldname + '_result_list');
@@ -279,5 +279,44 @@ $(document).ready(function() {
});
// Activate the Save Search buttons
- $('button#save-search').on('click', S3.search.saveCurrentSearch);
+ $('button#save-search').on('click', S3.search.saveCurrentSearch);
+
+ // S3SearchLocationWidget
+ // Allow clearing of map polygons in search forms
+ $('button#gis_search_polygon_input_clear').on('click', function(event) {
+ S3.search.clearMapPolygon();
+ // prevent form submission
+ event.preventDefault();
+ });
+ $('input#gis_search_polygon_input').on('change', S3.search.toggleMapClearButton)
+ .trigger('change');
});
+
+/*
+ * S3SearchLocationWidget
+ *
+ * Clears the map widget in a search form and also removes the
+ * polygon from the map itself
+ */
+S3.search.clearMapPolygon = function() {
+ if (S3.gis.lastDraftFeature) {
+ S3.gis.lastDraftFeature.destroy();
+ }
+ $('input#gis_search_polygon_input').val('').trigger('change');
+}
+
+/*
+ * S3SearchLocationWidget
+ *
+ * If the map widget has a value, a clear button will be shown
+ * otherwise it is hidden
+ */
+S3.search.toggleMapClearButton = function(event) {
+ var inputElement = $(event.currentTarget);
+ var clearButton = inputElement.siblings('button#gis_search_polygon_input_clear');
+ if (inputElement.val()) {
+ clearButton.show();
+ } else {
+ clearButton.hide();
+ }
+}
View
220 static/scripts/gis/GeoExt.js
109 additions, 111 deletions not shown
View
24 static/scripts/gis/MGRS.min.js
@@ -1,15 +1,15 @@
-function USNG2(){var d="ABCDEFGHJKLMNPQRSTUV".split(""),f="FGHJKLMNPQRSTUVABCDE".split(""),n="ABCDEFGH".split(""),q="JKLMNPQR".split(""),t="STUVWXYZ".split(""),w="CDEFGHJKLMNPQRSTUVWX".split(""),B=[-80,-72,-64,-56,-48,-40,-32,-24,-16,-8,0,8,16,24,32,40,48,58,64,72],z=Array(20);for(i=0;20>i;i++)z[i]=110946.259*B[i];this.llDistance=function(b,o){lat_s=b.lat*Math.PI/180;lat_f=o.lat*Math.PI/180;d_lon=(o.lon-b.lon)*Math.PI/180;return Math.atan2(Math.sqrt(Math.pow(Math.cos(lat_f)*Math.sin(d_lon),2)+Math.pow(Math.cos(lat_s)*
-Math.sin(lat_f)-Math.sin(lat_s)*Math.cos(lat_f)*Math.cos(d_lon),2)),Math.sin(lat_s)*Math.sin(lat_f)+Math.cos(lat_s)*Math.cos(lat_f)*Math.cos(d_lon))};this.fromUTM=function(b,o,g,s,p){var k;grid_square_set=b%6;ew_idx=Math.floor(g/1E5)-1;ns_idx=Math.floor(s%2E6/1E5);switch(grid_square_set){case 1:k=n[ew_idx]+d[ns_idx];break;case 2:k=q[ew_idx]+f[ns_idx];break;case 3:k=t[ew_idx]+d[ns_idx];break;case 4:k=n[ew_idx]+f[ns_idx];break;case 5:k=q[ew_idx]+d[ns_idx];break;case 0:k=t[ew_idx]+f[ns_idx];break;default:throw"USNG: can't get here";
-}for(var c=Math.floor(g%1E5).toString(),a=Math.floor(s%1E5).toString();5>c.length;)c="0"+c;for(;5>a.length;)a="0"+a;5<p?(digits=p-5,g=c+(g%1).toFixed(digits).substr(2,digits),s=a+(s%1).toFixed(digits).substr(2,digits)):(g=c.substr(0,p),s=a.substr(0,p));return usng_string=String(b)+o+k+g+s};this.toUTMFromFullParsedUSNG=function(b,o,g,s,p,k){var c=0,a=0;switch(b%6){case 1:c=d;a=n;break;case 2:c=f;a=q;break;case 3:c=d;a=t;break;case 4:c=f;a=n;break;case 5:c=d;a=q;break;case 0:c=f;a=t;break;default:throw"Can't get here";
-}ew_idx=a.indexOf(g[0]);ns_idx=c.indexOf(g[1]);if(-1==ew_idx||-1==ns_idx)throw"USNG: Invalid USNG 100km grid designator.";c=1E5*(ew_idx+1)+s;a=1E5*(ns_idx+0)+p;min_northing=z[w.indexOf(o)];a+=2E6*Math.ceil((min_northing-a)/2E6);ll=utm_proj.invProj(b,c,a);ll_utm_zone=Math.floor((ll.lon- -180)/6)+1;ll_grid_zone=w[Math.floor((ll.lat- -80)/8)];ll_grid_zone!=o&&(a-=2E6,ll=utm_proj.invProj(b,c,a),ll_utm_zone=Math.floor((ll.lon- -180)/6)+1,ll_grid_zone=w[Math.floor((ll.lat- -80)/8)]);if(ll_utm_zone!=b||
-ll_grid_zone!=o)throw"USNG: calculated coordinate not in correct UTM or grid zone! Supplied: "+b+o+" Calculated: "+ll_utm_zone+ll_grid_zone;return{zone:b,easting:c,northing:a,precision:k}};this.toUTM=function(b,o){var g=0,s=0,p=0,k=null,c=null,a=null,e=null,b=b.replace(/ /g,"");re=/([0-9]+)$/;if(fields=re.exec(b))k=fields[0],p=k.length/2,scale_factor=Math.pow(10,5-p),g=Number(k.substr(0,p))*scale_factor,s=Number(k.substr(p,p))*scale_factor;b=b.substr(0,b.length-2*p);re=/([A-Z][A-Z]$)/;(fields=re.exec(b))&&
-(c=fields[0]);b=b.substr(0,b.length-2);re=/([0-9]+)([A-Z])/;if(fields=re.exec(b))e=fields[1],a=fields[2];if(!e||!a||!c)if(c&&o){for(var j=1E3,m=null,h=null,l=Math.floor((o.lon- -180)/6)+1,e=l-1;e<=l+1;e++)for(grid_zone_idx=0;20>grid_zone_idx;grid_zone_idx++){a=w[grid_zone_idx];try{result=this.toLonLat(e%60+a+c+k),arc_distance=this.llDistance(o,result),arc_distance<j&&(j=arc_distance,m=e%60,h=a)}catch(C){}}if(m&&h)e=m,a=h;else throw"USNG: Couldn't find a match";}else if(o){for(var j=1E3,r=h=m=null,
-l=Math.floor((o.lon- -180)/6)+1,A=Math.floor((o.lat- -80)/8),e=l-1;e<=l+1;e++)for(grid_zone_idx=A-1;grid_zone_idx<=A+1;grid_zone_idx++){var a=w[grid_zone_idx],u,v;switch(e%6){case 1:u=d;v=n;break;case 2:u=f;v=q;break;case 3:u=d;v=t;break;case 4:u=f;v=n;break;case 5:u=d;v=q;break;case 0:u=f;v=t;break;default:throw"Can't get here";}for(ns_idx=0;20>ns_idx;ns_idx++)for(ew_idx=0;8>ew_idx;ew_idx++)try{c=v[ew_idx]+u[ns_idx],result=this.toLonLat(e%60+a+c+k),arc_distance=this.llDistance(o,result),arc_distance<
-j&&(j=arc_distance,m=e%60,h=a,r=c)}catch(D){}}if(m&&h)e=m,a=h,c=r;else throw"USNG: Couldn't find a match";}else throw"USNG: Not enough information to locate point.";return this.toUTMFromFullParsedUSNG(e,a,c,g,s,p)};this.fromLonLat=function(b,o){usng_string=new String;for(var g=b.lon,d=b.lat;-180>g;)g+=180;for(;180<g;)g-=180;utm_zone=Math.floor((g- -180)/6)+1;if(!(-80<d&&80>d))throw"USNG: Latitude must be between -80 and 80. (Zones A and B are not implemented yet.)";var f=w[Math.floor((d- -80)/8)],
-g=utm_proj.proj(utm_zone,g,d);return this.fromUTM(utm_zone,f,g.utm_easting,g.utm_northing,o)};this.toLonLat=function(b,d){result=this.toUTM(b,d);ll=utm_proj.invProj(result.zone,result.easting,result.northing);ll.precision=result.precision;return ll};this.UTM=function(){var b=(40680631590769-6356752.3*6356752.3)/40680631590769,d=b/(1-b),g=b*b,f=b*g,p=Math.PI/180;this.proj=function(k,c,a){var e=-(6*(30-k)+3)*p,j=a*p,m=c*p,h=Math.sin(j),l=Math.cos(j),c=h/l,a=c*c,n=a*a,h=6378137/Math.sqrt(1-b*h*h),r=
-d*l*l,e=l*(m-e),m=6378137*(15*g/256+45*f/1024),l=-223234795*f/3072,j=6378137*(1-b/4-3*g/64-5*f/256)*j+-6378137*(3*b/8+3*g/32+45*f/1024)*Math.sin(2*j)+m*Math.sin(4*j)+l*Math.sin(6*j),l=1-a+r,q=5-18*a+n+72*r-58*d,m=Math.pow(e,5);x=0.9996*h*(e+l*Math.pow(e,3)/6+q*m/120)+5E5;l=(5-a+9*r+4*r*r)*Math.pow(e,4)/24;y=0.9996*(j+h*c*(e*e/2+l+(61-58*a+n+600*r-330*d)*(m*e/720)));return{utm_zone:k,utm_easting:x,utm_northing:y}};this.invProj=function(k,c,a){var k=-(6*(30-k)+3)*p,e=Math.sqrt(1-b),e=(1-e)/(1+e),j=
-e*e,m=e*j,c=c-5E5,a=a/0.9996/(6378137*(1-b/4-3*(g/64)-5*(f/256))),j=1.3125*j-1.71875*j*j,a=a+(1.5*e-0.84375*m)*Math.sin(2*a)+j*Math.sin(4*a)+151*m/96*Math.sin(6*a),h=Math.sin(a),e=Math.cos(a),m=h/e,j=6378137/Math.sqrt(1-b*h*h),l=m*m,n=d*e*e,h=1-b*h*h,h=6378137*(1-b)/Math.sqrt(h*h*h),c=c/(0.9996*j),r=c*c,q=c*r,u=r*r,v=l*l,t=n*n;temp2=5+3*l+10*n-4*t-9*d;temp4=61+90*l+298*n+45*v-252*d-3*t;temp5=(1+2*l+n)*q/6;temp6=5-2*n+28*l-3*t+8*d+24*v;lat=180*(a-j*m/h*(r/2-temp2*(u/24)+temp4*q*q/720))/Math.PI;lon=
-180*(k+(c-temp5+temp6*c*u/120)/e)/Math.PI;return{lon:lon,lat:lat}}};utm_proj=new this.UTM}
+function USNG2(){var d="A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,U,V".split(","),f="F,G,H,J,K,L,M,N,P,Q,R,S,T,U,V,A,B,C,D,E".split(","),n="A,B,C,D,E,F,G,H".split(","),q="J,K,L,M,N,P,Q,R".split(","),t="S,T,U,V,W,X,Y,Z".split(","),w="C,D,E,F,G,H,J,K,L,M,N,P,Q,R,S,T,U,V,W,X".split(","),B=[-80,-72,-64,-56,-48,-40,-32,-24,-16,-8,0,8,16,24,32,40,48,58,64,72],z=Array(20);for(i=0;20>i;i++)z[i]=110946.259*B[i];this.llDistance=function(b,o){lat_s=b.lat*Math.PI/180;lat_f=o.lat*Math.PI/180;d_lon=(o.lon-b.lon)*Math.PI/
+180;return Math.atan2(Math.sqrt(Math.pow(Math.cos(lat_f)*Math.sin(d_lon),2)+Math.pow(Math.cos(lat_s)*Math.sin(lat_f)-Math.sin(lat_s)*Math.cos(lat_f)*Math.cos(d_lon),2)),Math.sin(lat_s)*Math.sin(lat_f)+Math.cos(lat_s)*Math.cos(lat_f)*Math.cos(d_lon))};this.fromUTM=function(b,o,g,s,p){var k;grid_square_set=b%6;ew_idx=Math.floor(g/1E5)-1;ns_idx=Math.floor(s%2E6/1E5);switch(grid_square_set){case 1:k=n[ew_idx]+d[ns_idx];break;case 2:k=q[ew_idx]+f[ns_idx];break;case 3:k=t[ew_idx]+d[ns_idx];break;case 4:k=
+n[ew_idx]+f[ns_idx];break;case 5:k=q[ew_idx]+d[ns_idx];break;case 0:k=t[ew_idx]+f[ns_idx];break;default:throw"USNG: can't get here";}for(var c=Math.floor(g%1E5).toString(),a=Math.floor(s%1E5).toString();5>c.length;)c="0"+c;for(;5>a.length;)a="0"+a;5<p?(digits=p-5,g=c+(g%1).toFixed(digits).substr(2,digits),s=a+(s%1).toFixed(digits).substr(2,digits)):(g=c.substr(0,p),s=a.substr(0,p));return usng_string=""+b+o+k+g+s};this.toUTMFromFullParsedUSNG=function(b,o,g,s,p,k){var c=0,a=0;switch(b%6){case 1:c=
+d;a=n;break;case 2:c=f;a=q;break;case 3:c=d;a=t;break;case 4:c=f;a=n;break;case 5:c=d;a=q;break;case 0:c=f;a=t;break;default:throw"Can't get here";}ew_idx=a.indexOf(g[0]);ns_idx=c.indexOf(g[1]);if(-1==ew_idx||-1==ns_idx)throw"USNG: Invalid USNG 100km grid designator.";c=1E5*(ew_idx+1)+s;a=1E5*(ns_idx+0)+p;min_northing=z[w.indexOf(o)];a+=2E6*Math.ceil((min_northing-a)/2E6);ll=utm_proj.invProj(b,c,a);ll_utm_zone=Math.floor((ll.lon- -180)/6)+1;ll_grid_zone=w[Math.floor((ll.lat- -80)/8)];ll_grid_zone!=
+o&&(a-=2E6,ll=utm_proj.invProj(b,c,a),ll_utm_zone=Math.floor((ll.lon- -180)/6)+1,ll_grid_zone=w[Math.floor((ll.lat- -80)/8)]);if(ll_utm_zone!=b||ll_grid_zone!=o)throw"USNG: calculated coordinate not in correct UTM or grid zone! Supplied: "+b+o+" Calculated: "+ll_utm_zone+ll_grid_zone;return{zone:b,easting:c,northing:a,precision:k}};this.toUTM=function(b,o){var g=0,s=0,p=0,k=null,c=null,a=null,e=null,b=b.replace(/ /g,"");re=/([0-9]+)$/;if(fields=re.exec(b))k=fields[0],p=k.length/2,scale_factor=Math.pow(10,
+5-p),g=Number(k.substr(0,p))*scale_factor,s=Number(k.substr(p,p))*scale_factor;b=b.substr(0,b.length-2*p);re=/([A-Z][A-Z]$)/;(fields=re.exec(b))&&(c=fields[0]);b=b.substr(0,b.length-2);re=/([0-9]+)([A-Z])/;if(fields=re.exec(b))e=fields[1],a=fields[2];if(!e||!a||!c)if(c&&o){for(var j=1E3,m=null,h=null,l=Math.floor((o.lon- -180)/6)+1,e=l-1;e<=l+1;e++)for(grid_zone_idx=0;20>grid_zone_idx;grid_zone_idx++){a=w[grid_zone_idx];try{result=this.toLonLat(e%60+a+c+k),arc_distance=this.llDistance(o,result),arc_distance<
+j&&(j=arc_distance,m=e%60,h=a)}catch(C){}}if(m&&h)e=m,a=h;else throw"USNG: Couldn't find a match";}else if(o){for(var j=1E3,r=h=m=null,l=Math.floor((o.lon- -180)/6)+1,A=Math.floor((o.lat- -80)/8),e=l-1;e<=l+1;e++)for(grid_zone_idx=A-1;grid_zone_idx<=A+1;grid_zone_idx++){var a=w[grid_zone_idx],u,v;switch(e%6){case 1:u=d;v=n;break;case 2:u=f;v=q;break;case 3:u=d;v=t;break;case 4:u=f;v=n;break;case 5:u=d;v=q;break;case 0:u=f;v=t;break;default:throw"Can't get here";}for(ns_idx=0;20>ns_idx;ns_idx++)for(ew_idx=
+0;8>ew_idx;ew_idx++)try{c=v[ew_idx]+u[ns_idx],result=this.toLonLat(e%60+a+c+k),arc_distance=this.llDistance(o,result),arc_distance<j&&(j=arc_distance,m=e%60,h=a,r=c)}catch(D){}}if(m&&h)e=m,a=h,c=r;else throw"USNG: Couldn't find a match";}else throw"USNG: Not enough information to locate point.";return this.toUTMFromFullParsedUSNG(e,a,c,g,s,p)};this.fromLonLat=function(b,o){usng_string=new String;for(var g=b.lon,d=b.lat;-180>g;)g+=180;for(;180<g;)g-=180;utm_zone=Math.floor((g- -180)/6)+1;if(!(-80<
+d&&80>d))throw"USNG: Latitude must be between -80 and 80. (Zones A and B are not implemented yet.)";var f=w[Math.floor((d- -80)/8)],g=utm_proj.proj(utm_zone,g,d);return this.fromUTM(utm_zone,f,g.utm_easting,g.utm_northing,o)};this.toLonLat=function(b,d){result=this.toUTM(b,d);ll=utm_proj.invProj(result.zone,result.easting,result.northing);ll.precision=result.precision;return ll};this.UTM=function(){var b=(40680631590769-6356752.3*6356752.3)/40680631590769,d=b/(1-b),g=b*b,f=b*g,p=Math.PI/180;this.proj=
+function(k,c,a){var e=-(6*(30-k)+3)*p,j=a*p,m=c*p,h=Math.sin(j),l=Math.cos(j),c=h/l,a=c*c,n=a*a,h=6378137/Math.sqrt(1-b*h*h),r=d*l*l,e=l*(m-e),m=6378137*(15*g/256+45*f/1024),l=-223234795*f/3072,j=6378137*(1-b/4-3*g/64-5*f/256)*j+-6378137*(3*b/8+3*g/32+45*f/1024)*Math.sin(2*j)+m*Math.sin(4*j)+l*Math.sin(6*j),l=1-a+r,q=5-18*a+n+72*r-58*d,m=Math.pow(e,5);x=0.9996*h*(e+l*Math.pow(e,3)/6+q*m/120)+5E5;l=(5-a+9*r+4*r*r)*Math.pow(e,4)/24;y=0.9996*(j+h*c*(e*e/2+l+(61-58*a+n+600*r-330*d)*(m*e/720)));return{utm_zone:k,
+utm_easting:x,utm_northing:y}};this.invProj=function(k,c,a){var k=-(6*(30-k)+3)*p,e=Math.sqrt(1-b),e=(1-e)/(1+e),j=e*e,m=e*j,c=c-5E5,a=a/0.9996/(6378137*(1-b/4-3*(g/64)-5*(f/256))),j=1.3125*j-1.71875*j*j,a=a+(1.5*e-0.84375*m)*Math.sin(2*a)+j*Math.sin(4*a)+151*m/96*Math.sin(6*a),h=Math.sin(a),e=Math.cos(a),m=h/e,j=6378137/Math.sqrt(1-b*h*h),l=m*m,n=d*e*e,h=1-b*h*h,h=6378137*(1-b)/Math.sqrt(h*h*h),c=c/(0.9996*j),r=c*c,q=c*r,u=r*r,v=l*l,t=n*n;temp2=5+3*l+10*n-4*t-9*d;temp4=61+90*l+298*n+45*v-252*d-3*
+t;temp5=(1+2*l+n)*q/6;temp6=5-2*n+28*l-3*t+8*d+24*v;lat=180*(a-j*m/h*(r/2-temp2*(u/24)+temp4*q*q/720))/Math.PI;lon=180*(k+(c-temp5+temp6*c*u/120)/e)/Math.PI;return{lon:lon,lat:lat}}};utm_proj=new this.UTM}
OpenLayers.Control.MGRSMousePosition=OpenLayers.Class(OpenLayers.Control,{element:null,prefix:"",separator:", ",suffix:"",numDigits:5,granularity:10,lastXy:null,displayProjection:null,initialize:function(d){OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.map&&this.map.events.unregister("mousemove",this,this.redraw);OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.element||
(this.div.left="",this.div.top="",this.element=this.div);this.redraw();return this.div},redraw:function(d){var f;if(null==d)f=new OpenLayers.LonLat(0,0);else{if(null==this.lastXy||Math.abs(d.xy.x-this.lastXy.x)>this.granularity||Math.abs(d.xy.y-this.lastXy.y)>this.granularity){this.lastXy=d.xy;return}f=this.map.getLonLatFromPixel(d.xy);if(!f)return;this.displayProjection&&f.transform(this.map.getProjectionObject(),this.displayProjection);this.lastXy=d.xy}d=this.formatOutput(f);d!=this.element.innerHTML&&
(this.element.innerHTML=d)},formatOutput:function(d){var f=OpenLayers.INCHES_PER_UNIT,f=this.map.getResolution()*f[this.map.getUnits()]*(1/f.m),n=parseInt(6-Math.ceil(Math.log(f)/2.302585092994046)),f=parseInt(this.numDigits),q=new USNG2,n=-80<d.lat&&80>d.lat?q.fromLonLat(d,n-1):"undefined";return this.prefix+d.lon.toFixed(f)+this.separator+d.lat.toFixed(f)+" / MGRS: "+n+this.suffix},setMap:function(){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("mousemove",this,
View
4,092 static/scripts/gis/OpenLayers.js
1,459 additions, 2,633 deletions not shown
View
322 static/scripts/gis/gxp.js
161 additions, 161 deletions not shown
Please sign in to comment.
Something went wrong with that request. Please try again.