Align Sahana files with upstream

This commit is contained in:
Disassembler 2018-07-12 22:31:50 +02:00
parent 7db69ccf13
commit 5c4d526660
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
7 changed files with 203 additions and 15 deletions

View File

@ -130,9 +130,6 @@ settings.frontpage.rss = [
# Uncomment to enable a guided tour # Uncomment to enable a guided tour
#settings.base.guided_tour = True #settings.base.guided_tour = True
# Instance Name - for management scripts
#settings.base.instance_name = "test"
# Bing API Key (for Map layers) # Bing API Key (for Map layers)
# http://www.microsoft.com/maps/create-a-bing-maps-key.aspx # http://www.microsoft.com/maps/create-a-bing-maps-key.aspx
#settings.gis.api_bing = "" #settings.gis.api_bing = ""

View File

@ -130,9 +130,6 @@ settings.frontpage.rss = [
# Uncomment to enable a guided tour # Uncomment to enable a guided tour
#settings.base.guided_tour = True #settings.base.guided_tour = True
# Instance Name - for management scripts
#settings.base.instance_name = "test"
# Bing API Key (for Map layers) # Bing API Key (for Map layers)
# http://www.microsoft.com/maps/create-a-bing-maps-key.aspx # http://www.microsoft.com/maps/create-a-bing-maps-key.aspx
#settings.gis.api_bing = "" #settings.gis.api_bing = ""

View File

@ -58,6 +58,8 @@ def config(settings):
settings.auth.registration_requests_organisation = True settings.auth.registration_requests_organisation = True
# Uncomment this to have the Organisation selection during registration be mandatory # Uncomment this to have the Organisation selection during registration be mandatory
settings.auth.registration_organisation_required = True settings.auth.registration_organisation_required = True
# Uncomment this to hide the Create-Organisation link in registration forms
#settings.auth.registration_organisation_link_create = False
# Uncomment this to have the Organisation input hidden unless the user enters a non-whitelisted domain # Uncomment this to have the Organisation input hidden unless the user enters a non-whitelisted domain
#settings.auth.registration_organisation_hidden = True #settings.auth.registration_organisation_hidden = True
# Uncomment this to default the Organisation during registration # Uncomment this to default the Organisation during registration
@ -417,6 +419,11 @@ def config(settings):
# Uncomment to modify the main menu logo # Uncomment to modify the main menu logo
#settings.ui.menu_logo = URL(c="static", f="img", args=["S3menulogo.png"]) #settings.ui.menu_logo = URL(c="static", f="img", args=["S3menulogo.png"])
# -------------------------------------------------------------------------
# Sync
# Uncomment if this deployment exposes public data sets
settings.sync.data_repository = True
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Asset # Asset
# Uncomment to have a specific asset type for Telephones # Uncomment to have a specific asset type for Telephones
@ -528,6 +535,8 @@ def config(settings):
# Events # Events
# Uncomment to use the term Disaster instead of Event # Uncomment to use the term Disaster instead of Event
#settings.event.label = "Disaster" #settings.event.label = "Disaster"
# Uncomment to not use Incidents under Events
#settings.event.incident = False
# Uncomment to preserve linked Incidents when an Event is deleted # Uncomment to preserve linked Incidents when an Event is deleted
# NB Changing this setting requires a DB migration # NB Changing this setting requires a DB migration
#settings.event.cascade_delete_incidents = False #settings.event.cascade_delete_incidents = False
@ -592,6 +601,8 @@ def config(settings):
#settings.org.autocomplete = True #settings.org.autocomplete = True
# Enable the Organisation Sector field # Enable the Organisation Sector field
settings.org.sector = True settings.org.sector = True
# But hide it from the rheader
#settings.org.sector_rheader = False
# Enable the use of Organisation Branches # Enable the use of Organisation Branches
settings.org.branches = True settings.org.branches = True
# Show branches as tree rather than as table # Show branches as tree rather than as table
@ -607,6 +618,8 @@ def config(settings):
settings.org.organisation_types_hierarchical = True settings.org.organisation_types_hierarchical = True
# Make Organisation Types Multiple # Make Organisation Types Multiple
settings.org.organisation_types_multiple = True settings.org.organisation_types_multiple = True
# Show Organisation Types in the rheader
settings.org.organisation_type_rheader = True
# Enable the use of Organisation Regions # Enable the use of Organisation Regions
settings.org.regions = True settings.org.regions = True
# Make Organisation Regions Hierarchical # Make Organisation Regions Hierarchical
@ -877,9 +890,12 @@ def config(settings):
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Supply # Supply
# Name of the Default Item Catalog. Do not edit after deployment
#settings.supply.catalog_default = "Default"
# Disable the use of Multiple Item Catalogs
#settings.supply.catalog_multi = False
# Disable the use of Alternative Items
#settings.supply.use_alt_name = False #settings.supply.use_alt_name = False
# Do not edit after deployment
#settings.supply.catalog_default = T("Default")
# ------------------------------------------------------------------------- # -------------------------------------------------------------------------
# Projects # Projects
@ -899,6 +915,10 @@ def config(settings):
settings.project.activity_types = True settings.project.activity_types = True
# Uncomment this to filter dates in Activities # Uncomment this to filter dates in Activities
#settings.project.activity_filter_year = True #settings.project.activity_filter_year = True
# Uncomment this to not use Beneficiaries for Activities
#settings.project.get_project_activity_beneficiaries = False
# Uncomment this to not use Item Catalog for Distributions
#settings.project.activity_items = False
# Uncomment this to use Codes for projects # Uncomment this to use Codes for projects
#settings.project.codes = True #settings.project.codes = True
# Uncomment this to call project locations 'Communities' # Uncomment this to call project locations 'Communities'

View File

@ -42,5 +42,6 @@ d3/nv.d3.css
../themes/default/report.css ../themes/default/report.css
../themes/default/survey.css ../themes/default/survey.css
../themes/default/newsfeed.css ../themes/default/newsfeed.css
../themes/default/style.css ../themes/default/theme.css
# Final line required for parsing #../themes/default/style.css
# Final line required for parsing

View File

@ -3,6 +3,7 @@ SITE_DEFAULT,,"State / Province","County / District","City / Town / Village","Vi
,AF,Province,District,Village,,, ,AF,Province,District,Village,,,
,AL,County,District,Municipality,,, ,AL,County,District,Municipality,,,
,AM,Province,Community,Settlement,,, ,AM,Province,Community,Settlement,,,
,AR,Province,Department,Municipality,
,AS,District,County,Village,,, ,AS,District,County,Village,,,
,AT,State,"District / City",Municipality, ,AT,State,"District / City",Municipality,
,AU,"State / Territory",Local Government Area,,,, ,AU,"State / Territory",Local Government Area,,,,
@ -12,52 +13,79 @@ SITE_DEFAULT,,"State / Province","County / District","City / Town / Village","Vi
,BE,Region,Province,Arrondissement,Commune, ,BE,Region,Province,Arrondissement,Commune,
,BG,Province,Municipality,,, ,BG,Province,Municipality,,,
,BI,Province,Commune,Colline,Sous Colline, ,BI,Province,Commune,Colline,Sous Colline,
,BN,District,Mukim,,
,BO,Department,Province,Municipality,Canton
,BR,State,Municipality,District,,
,BT,District,Sub-District,,
,BZ,District,,,
,CF,Prefecture,Sub-Prefecture,Commune,, ,CF,Prefecture,Sub-Prefecture,Commune,,
,CK,Island Council,Village Committee,,,
,CL,Region,Province,Commune,,
,CM,Region,Division,Sub-Division,Village, ,CM,Region,Division,Sub-Division,Village,
,CO,Department,Municipality,Corregimiento,
,CR,Province,Canton,District,
,CU,Province,Municipality,
,DE,"Federal State","Rural District / District","Town / Municipality",Village, ,DE,"Federal State","Rural District / District","Town / Municipality",Village,
,DO,Province,Municipality,,,,
,EC,Province,Canton,Parish,,, ,EC,Province,Canton,Parish,,,
,FI,Regional State Administrative Agency,Region,Sub-region,Municipality,, ,FI,Regional State Administrative Agency,Region,Sub-region,Municipality,,
,FJ,Division,Province,District,,,, ,FJ,Division,Province,District,,,,
,GE,"Region / Republic",District,,,, ,GE,"Region / Republic",District,,,,
,GN,Region,Prefecture,Sub-prefecture,,, ,GN,Region,Prefecture,Sub-prefecture,,,
,GR,Decentralized Administration,Region,Regional Unit,Municipality,, ,GR,Decentralized Administration,Region,Regional Unit,Municipality,,
,GT,Department,Municipality,
,HN,Department,Municipality,Village,,, ,HN,Department,Municipality,Village,,,
,HR,County,"Town / Municipality",,,, ,HR,County,"Town / Municipality",,,,
,HT,Department,Commune,Communal section,,
,HU,County,District,,,, ,HU,County,District,,,,
,ID,Province,"Regency / City",District,Administrative Village,, ,ID,Province,"Regency / City",District,Administrative Village,,
,IN,State,District,Subdistrict,,, ,IN,State,District,Sub-District,,,
,IQ,Province,District,,,, ,IQ,Province,District,,,,
,IT,Region,Province,Commune,,, ,IT,Region,Province,Commune,,,
,KE,County,Constituency,Location,SubLocation, ,KE,County,Constituency,Location,SubLocation,
,KG,"Oblast / State City","District (Rayon) / Oblast City","Town / Village Group",Village,, ,KG,"Oblast / State City","District (Rayon) / Oblast City","Town / Village Group",Village,,
,KH,Province,District,Commune,Village, ,KH,Province,District,Commune,Village,
,KI,Island Council,,,,
,KZ,Province,District,,,, ,KZ,Province,District,,,,
,LA,Province,District,Village,,,
,LK,Province,District,Divisional Secretariat,Grama Niladhari,, ,LK,Province,District,Divisional Secretariat,Grama Niladhari,,
,LR,County,District,Clan,,, ,LR,County,District,Clan,,,
,LT,County,Municipality,Eldership,,,
,LY,District,"City / Town / Village",,,, ,LY,District,"City / Town / Village",,,,
,MG,Region,District,Commune,Fokontany, ,MG,Region,District,Commune,Fokontany,
,MK,Municipality,,,, ,MK,Municipality,,,,
,MM,State,District,Township,Village Tract,Village, ,MM,State,District,Township,Village Tract,Village,
,MN,Province,District,Subdistrict,,, ,MN,Province,District,Sub-District,,,
,MP,Municipality,Village,,,, ,MP,Municipality,Village,,,,
,MV,"Atoll/City",Island,,,, ,MV,"Atoll/City",Island,,,,
,MX,State,Municipality,
,MY,State,District,Mukim,,, ,MY,State,District,Mukim,,,
,NI,Department,Municipality,
,NP,Region,Zone,District,Village Development Committee,Ward, ,NP,Region,Zone,District,Village Development Committee,Ward,
,NZ,Region,Territorial Authority,,,, ,NZ,Region,Territorial Authority,,,,
,PA,Province,District,Corregimiento,,
,PE,Region,Province,District,,
,PG,Province,District,LLG,Village,, ,PG,Province,District,LLG,Village,,
,PH,Region,Province,"City / Municipality",Barangay,, ,PH,Region,Province,"City / Municipality",Barangay,,
,PK,Province,District,Tehsil,Union Council,Village, ,PK,Province,District,Tehsil,Union Council,Village,
,PY,Department,District,"City / Town / Village",,, ,PY,Department,District,"City / Town / Village",,,
,RS,District,"Municipality / City",,,, ,RS,District,"Municipality / City",,,,
,SB,Province,Ward,,
,SE,County,Municipality,,,, ,SE,County,Municipality,,,,
,SG,Region,,,
,SL,Province,District,Chiefdom,,, ,SL,Province,District,Chiefdom,,,
,SV,Department,Municipality,
,TD,Region,Department,Sub-Prefecture,Canton, ,TD,Region,Department,Sub-Prefecture,Canton,
,TH,Province,District,Sub-District,,,
,TJ,Province,District,Jamoat,Village,, ,TJ,Province,District,Jamoat,Village,,
,TL,District,SubDistrict,Suco,Aldeia,, ,TL,District,SubDistrict,Suco,Aldeia,,
,TM,Province,District,,,, ,TM,Province,District,,,,
,TO,Island Group,District,,,,
,TR,City,Town,District,,, ,TR,City,Town,District,,,
,TV,Island Council,,,,
,PR,Municipality,Barrio,,,, ,PR,Municipality,Barrio,,,,
,US,State,County,City,Neighborhood,,False ,US,State,County,City,Neighborhood,,False
,UZ,Province,District,,,, ,UZ,Province,District,,,,
,VU,Province,Area Council,,
,VN,Province,District,Commune,,, ,VN,Province,District,Commune,,,
,XK,District,Municipality,,,, ,XK,District,Municipality,,,,

Can't render this file because it has a wrong number of fields in line 7.

View File

@ -0,0 +1,148 @@
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
""" Monitoring
Template-specific Monitoring Tasks are defined here.
@copyright: 2014-2018 (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__ = ("S3Monitor",)
import datetime
import platform
import subprocess
from gluon import current
#from gluon.tools import fetch
# =============================================================================
class S3Monitor(object):
"""
Monitoring Check Scripts
"""
# -------------------------------------------------------------------------
@staticmethod
def ping(task_id, run_id):
"""
Ping a server
"""
s3db = current.s3db
# Read the IP to Ping
ttable = s3db.setup_monitor_task
stable = s3db.setup_server
query = (ttable.id == task_id) & \
(ttable.server_id == stable.id)
row = current.db(query).select(stable.host_ip,
limitby = (0, 1)
).first()
host_ip = row.host_ip
try:
output = subprocess.check_output("ping -{} 1 {}".format("n" if platform.system().lower == "windows" else "c", host_ip), shell=True)
except Exception, e:
# Critical: Ping failed
return 3
else:
# OK
return 1
# -------------------------------------------------------------------------
#@staticmethod
#def http(task_id, run_id):
# """
# Test that HTTP is accessible
# """
# -------------------------------------------------------------------------
#@staticmethod
#def https(task_id, run_id):
# """
# Test that HTTPS is accessible
# @ToDo: Check that SSL certificate hasn't expired
# """
# -------------------------------------------------------------------------
@staticmethod
def email_round_trip(task_id, run_id):
"""
Check that a Mailbox is being Polled & Parsed OK and can send replies
"""
# Read the Task Options
otable = current.s3db.setup_monitor_task_option
query = (otable.task_id == task_id) & \
(otable.deleted == False)
rows = current.db(query).select(otable.tag,
otable.value,
)
options = dict((row.tag, row.value) for row in rows)
to = options.get("to", None)
if not to:
return False
subject = options.get("subject", "")
message = options.get("message", "")
reply_to = options.get("reply_to")
if not reply_to:
# Use the outbound email address
reply_to = current.deployment_settings.get_mail_sender()
if not reply_to:
return False
# Append the run_id for the remote parser to identify as a monitoring message & return to us to be able to match the run
message = "%s\n%s" % (message, ":run_id:%s:" % run_id)
# Append the reply_to address for the remote parser
message = "%s\n%s" % (message, ":reply_to:%s:" % reply_to)
# Send the Email
result = current.msg.send_email(to,
subject,
message,
reply_to=reply_to)
if result:
# Schedule a task to see if the reply has arrived after 1 hour
start_time = datetime.datetime.utcnow() + datetime.timedelta(hours=1)
current.s3task.schedule_task("setup_monitor_check_email_reply",
args = [run_id],
start_time = start_time,
timeout = 300, # seconds
repeats = 1 # one-time
)
# Warning: No reply received yet
return 2
else:
# Critical: Unable to send Email
return 3
# END =========================================================================

View File

@ -130,9 +130,6 @@ settings.frontpage.rss = [
# Uncomment to enable a guided tour # Uncomment to enable a guided tour
#settings.base.guided_tour = True #settings.base.guided_tour = True
# Instance Name - for management scripts
#settings.base.instance_name = "test"
# Bing API Key (for Map layers) # Bing API Key (for Map layers)
# http://www.microsoft.com/maps/create-a-bing-maps-key.aspx # http://www.microsoft.com/maps/create-a-bing-maps-key.aspx
#settings.gis.api_bing = "" #settings.gis.api_bing = ""