From 5e868986ac720b6d00bae3b202b57dac5349f23b Mon Sep 17 00:00:00 2001 From: Jonathan Date: Mon, 29 Jun 2015 10:45:14 +0700 Subject: [PATCH 1/3] SAMBRO Layout SAMBRO template updates --- modules/templates/SAMBRO/controllers.py | 2 +- modules/templates/SAMBRO/css.cfg | 3 + modules/templates/SAMBRO/views/index.html | 20 ++ static/themes/SAMBRO/style.css | 223 ++++++++++++++++++++++ 4 files changed, 247 insertions(+), 1 deletion(-) create mode 100644 modules/templates/SAMBRO/css.cfg create mode 100644 modules/templates/SAMBRO/views/index.html create mode 100644 static/themes/SAMBRO/style.css diff --git a/modules/templates/SAMBRO/controllers.py b/modules/templates/SAMBRO/controllers.py index a646553e93..a469702f70 100644 --- a/modules/templates/SAMBRO/controllers.py +++ b/modules/templates/SAMBRO/controllers.py @@ -14,7 +14,7 @@ from s3 import S3LocationFilter, S3OptionsFilter, S3FilterForm, S3CustomController -THEME = "CAP" +THEME = "SAMBRO" # ============================================================================= class subscriptions(S3CustomController): diff --git a/modules/templates/SAMBRO/css.cfg b/modules/templates/SAMBRO/css.cfg new file mode 100644 index 0000000000..5b7b359830 --- /dev/null +++ b/modules/templates/SAMBRO/css.cfg @@ -0,0 +1,3 @@ +../themes/SAMBRO/style.css +bootstrap/font-awesome.css +# Final line required for parsing \ No newline at end of file diff --git a/modules/templates/SAMBRO/views/index.html b/modules/templates/SAMBRO/views/index.html new file mode 100644 index 0000000000..cd39aa78ad --- /dev/null +++ b/modules/templates/SAMBRO/views/index.html @@ -0,0 +1,20 @@ +{{extend "layout.html"}}{{theme=response.s3.theme}} + +
+
+
+ + +
+
+
\ No newline at end of file diff --git a/static/themes/SAMBRO/style.css b/static/themes/SAMBRO/style.css new file mode 100644 index 0000000000..6afb107a67 --- /dev/null +++ b/static/themes/SAMBRO/style.css @@ -0,0 +1,223 @@ +body { + font: normal 13px arial,sans-serif; + margin: 0px; + padding: 0px; +} + +a { + text-decoration: none; +} + +ul, li { + margin: 0px; + padding: 0px; + list-style: none; +} + +.fa { + color: #FFF; +} + +#sambro-menu { + background-color: #000; + height: 40px; + width: 100%; + position: relative; +} + + #sambro-menu img { + vertical-align: middle; + margin-right: 5px; + } + + #sambro-menu ul { + margin: 0px; + } + + #sambro-menu li { + padding: 8px; + } + + #sambro-menu li a { + color: #FFF; + } + + #sambro-menu ul.menu-right { + position: absolute; + top: 5px; + right: 10px; + } + + #sambro-menu ul.menu-right .fa { + margin-right: 5px; + } + +#sambro-title { + background-color: #FFF; + height: 40px; + width: 100%; + border-bottom: 1px solid #CCC; +} + + #sambro-title h1 { + color: #080; + font-size: 24px; + font-weight: normal; + margin: 10px 0px 0px 15px; + padding: 0px; + } + +#sambro-header { + position: fixed; + top: 0px; + height: 70px; + width: 100%; +} + +#sambro-footer { + background-color: #EEE; + position: fixed; + height: 30px; + width: 100%; + bottom: 0px; + padding: 10px; +} + +#sambro-body { + position: fixed; + width: 100%; + top: 90px; + bottom: 50px; +} + +#sambro-left { + border-right: 1px solid #CCC; + position: absolute; + left: 0px; + width: 320px; + top: 0px; + bottom: 0px; +} + +#sambro-right { + border-left: 1px solid #CCC; + position: absolute; + right: 0px; + width: 320px; + top: 0px; + bottom: 0px; +} + +#sambro-center { + position: absolute; + left: 320px; + right: 320px; + top: 0px; + bottom: 0px; +} + +div.sambro-feeds { + position: absolute; + top: 36px; + bottom: 0px; + overflow: auto; + padding-top: 15px; +} + + div.sambro-feeds .fa { + background-color: #F00; + color: #FFF; + display: inline; + border-radius: 30px; + padding: 5px; + position: absolute; + left: 10px; + } + + div.sambro-feeds ul, div.sambro-feeds li { + position: relative; + } + + div.sambro-feeds a { + color: #0026ff; + font-weight: normal; + } + + div.sambro-feeds h3 { + margin: 0px; + padding: 0px; + font-size: 15px; + } + + div.sambro-feeds li { + padding: 0px 20px; + } + +#sambro-left div.sambro-feeds li { + padding: 0px 20px 0px 40px; +} + +div.sambro-feeds li div { + border-bottom: 1px solid #CCC; + padding-bottom: 5px; +} + +div.sambro-feeds li p { + margin-bottom: 20px; +} + +div.sambro-panel-title { + border-bottom: 1px solid #CCC; + border-top: 1px solid #CCC; + background-color: #EEE; + padding: 10px 10px 10px; + font-weight: bold; +} + +span.alert-type { + color: #FFF; + padding: 1px 10px; + border-radius: 10px; +} + +span.type-1 { + background-color: #080; +} + +span.type-2 { + background-color: #C00; +} + +span.type-3 { + background-color: #00A; +} + +span.type-4 { + background-color: #F80; +} + +span.type-5 { + background-color: #08F; +} + +#sahana-icon img { + vertical-align: middle; + margin-right: 5px; +} + +::-webkit-scrollbar { + width: 0.8em; + height: 0.8em; +} + +::-webkit-scrollbar-button { + background: #CCC; +} + +::-webkit-scrollbar-track-piece { + background: #FFF; +} + +::-webkit-scrollbar-thumb { + background: #CCC; +} From 1168b9ef07e016a0814f0ac39d2f4fa4ab913c80 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Tue, 30 Jun 2015 10:26:56 +0700 Subject: [PATCH 2/3] SAMBRO Layout Update Contents are temporary. Will be connected to the real data. --- modules/templates/SAMBRO/config.py | 115 ++++----- modules/templates/SAMBRO/controllers.py | 14 ++ modules/templates/SAMBRO/css.cfg | 41 +++- modules/templates/SAMBRO/views/footer.html | 4 + modules/templates/SAMBRO/views/index.html | 21 +- modules/templates/SAMBRO/views/layout.html | 204 ++++++++++++++++ static/scripts/SAMBRO/sambro.js | 2 + static/themes/SAMBRO/style.css | 257 +++++++++++++-------- 8 files changed, 479 insertions(+), 179 deletions(-) create mode 100644 modules/templates/SAMBRO/views/footer.html create mode 100644 modules/templates/SAMBRO/views/layout.html create mode 100644 static/scripts/SAMBRO/sambro.js diff --git a/modules/templates/SAMBRO/config.py b/modules/templates/SAMBRO/config.py index d5948d1cc3..20817c5e2a 100644 --- a/modules/templates/SAMBRO/config.py +++ b/modules/templates/SAMBRO/config.py @@ -21,7 +21,7 @@ def config(settings): settings.base.prepopulate = ("SAMBRO", "default/users") # Theme (folder to use for views/layout.html) - #settings.base.theme = "SAMBRO" + settings.base.theme = "SAMBRO" # The Registration functionality shouldn't be visible to the Public settings.security.registration_visible = False @@ -50,6 +50,7 @@ def onaccept(form): s3db.msg_parser_enable(_id) async = current.s3task.async + # Poll async("msg_poll", args=["msg_rss_channel", channel_id]) @@ -108,25 +109,25 @@ def onaccept(form): #description = "Selective translation of strings based on module.", module_type = None, )), - ("gis", Storage( - name_nice = T("Map"), - #description = "Situation Awareness & Geospatial Analysis", - restricted = True, - module_type = 6, # 6th item in the menu - )), - ("pr", Storage( - name_nice = T("Person Registry"), - #description = "Central point to record details on People", - restricted = True, - access = "|1|", # Only Administrators can see this module in the default menu (access to controller is possible to all still) - module_type = 10 - )), - ("org", Storage( - name_nice = T("Organizations"), - #description = 'Lists "who is doing what & where". Allows relief agencies to coordinate their activities', - restricted = True, - module_type = 10 - )), + #("gis", Storage( + # name_nice = T("Map"), + # #description = "Situation Awareness & Geospatial Analysis", + # restricted = True, + # module_type = 6, # 6th item in the menu + #)), + #("pr", Storage( + # name_nice = T("Person Registry"), + # #description = "Central point to record details on People", + # restricted = True, + # access = "|1|", # Only Administrators can see this module in the default menu (access to controller is possible to all still) + # module_type = 10 + #)), + #("org", Storage( + # name_nice = T("Organizations"), + # #description = 'Lists "who is doing what & where". Allows relief agencies to coordinate their activities', + # restricted = True, + # module_type = 10 + #)), # All modules below here should be possible to disable safely #("hrm", Storage( # name_nice = T("Staff"), @@ -134,43 +135,43 @@ def onaccept(form): # restricted = True, # module_type = 2, #)), - ("cap", Storage( - name_nice = T("CAP"), - #description = "Create & broadcast CAP alerts", - restricted = True, - module_type = 1, - )), - ("cms", Storage( - name_nice = T("Content Management"), - #description = "Content Management System", - restricted = True, - module_type = 10, - )), - ("doc", Storage( - name_nice = T("Documents"), - #description = "A library of digital resources, such as photos, documents and reports", - restricted = True, - module_type = 10, - )), - ("msg", Storage( - name_nice = T("Messaging"), - #description = "Sends & Receives Alerts via Email & SMS", - restricted = True, - # The user-visible functionality of this module isn't normally required. Rather it's main purpose is to be accessed from other modules. - module_type = None, - )), - ("irs", Storage( - name_nice = T("Incidents"), - #description = "Incident Reporting System", - restricted = True, - module_type = 10 - )), - ("event", Storage( - name_nice = T("Events"), - #description = "Activate Events (e.g. from Scenario templates) for allocation of appropriate Resources (Human, Assets & Facilities).", - restricted = True, - module_type = 10, - )), + #("cap", Storage( + # name_nice = T("CAP"), + # #description = "Create & broadcast CAP alerts", + # restricted = True, + # module_type = 1, + #)), + #("cms", Storage( + # name_nice = T("Content Management"), + # #description = "Content Management System", + # restricted = True, + # module_type = 10, + #)), + #("doc", Storage( + # name_nice = T("Documents"), + # #description = "A library of digital resources, such as photos, documents and reports", + # restricted = True, + # module_type = 10, + #)), + #("msg", Storage( + # name_nice = T("Messaging"), + # #description = "Sends & Receives Alerts via Email & SMS", + # restricted = True, + # # The user-visible functionality of this module isn't normally required. Rather it's main purpose is to be accessed from other modules. + # module_type = None, + #)), + #("irs", Storage( + # name_nice = T("Incidents"), + # #description = "Incident Reporting System", + # restricted = True, + # module_type = 10 + #)), + #("event", Storage( + # name_nice = T("Events"), + # #description = "Activate Events (e.g. from Scenario templates) for allocation of appropriate Resources (Human, Assets & Facilities).", + # restricted = True, + # module_type = 10, + #)), ]) # END ========================================================================= diff --git a/modules/templates/SAMBRO/controllers.py b/modules/templates/SAMBRO/controllers.py index a469702f70..0828f46552 100644 --- a/modules/templates/SAMBRO/controllers.py +++ b/modules/templates/SAMBRO/controllers.py @@ -16,6 +16,20 @@ THEME = "SAMBRO" +# ============================================================================= +class index(S3CustomController): + """ Custom Home Page """ + + def __call__(self): + response = current.response + s3 = response.s3 + T = current.T + + map = current.gis.show_map() + + self._view(THEME, "index.html") + return dict(title = T("CAP Alert"), map = map) + # ============================================================================= class subscriptions(S3CustomController): """ Custom page to manage subscriptions """ diff --git a/modules/templates/SAMBRO/css.cfg b/modules/templates/SAMBRO/css.cfg index 5b7b359830..0af9f05d63 100644 --- a/modules/templates/SAMBRO/css.cfg +++ b/modules/templates/SAMBRO/css.cfg @@ -1,3 +1,42 @@ -../themes/SAMBRO/style.css +../themes/default/layout.css +../themes/default/footer.css +../themes/default/widgets.css +../themes/default/shortcut.css +../themes/default/homepage.css bootstrap/font-awesome.css +plugins/jquery.cluetip.css +plugins/jquery.dataTables.css +plugins/jquery.dataTables.responsive.css +#ui/accordion.css +ui/core.css +ui/autocomplete.css +ui/button.css +ui/datepicker.css +ui/dialog.css +# Needed for Delphi +ui/draggable.css +ui/menu.css +#ui/progressbar.css +ui/resizable.css +ui/selectmenu.css +ui/slider.css +#ui/sortable.css +#ui/spinner.css +ui/tabs.css +#ui/tooltip.css +ui/fgtimepicker.css +ui/multiselect.css +ui/timepicker-addon.css +calendars/ui-smoothness.calendars.picker.css +foundation/jquery-ui.theme.css +gis/style.css +zocial/zocial.css +../themes/default/gis.css +../themes/foundation/map.css +../themes/default/mobile.css +../themes/default/print.css +d3/nv.d3.css +../themes/default/report.css +../themes/default/survey.css +../themes/SAMBRO/style.css # Final line required for parsing \ No newline at end of file diff --git a/modules/templates/SAMBRO/views/footer.html b/modules/templates/SAMBRO/views/footer.html new file mode 100644 index 0000000000..0bfcce0994 --- /dev/null +++ b/modules/templates/SAMBRO/views/footer.html @@ -0,0 +1,4 @@ +{{if settings.ui.get("social_buttons"):}}
{{pass}} +

+ {{=T("Powered by Sahana Eden")}}{{=T("Powered by Sahana Eden")}} +

diff --git a/modules/templates/SAMBRO/views/index.html b/modules/templates/SAMBRO/views/index.html index cd39aa78ad..14e1b6e38d 100644 --- a/modules/templates/SAMBRO/views/index.html +++ b/modules/templates/SAMBRO/views/index.html @@ -1,20 +1 @@ -{{extend "layout.html"}}{{theme=response.s3.theme}} - -
-
-
- - -
-
-
\ No newline at end of file +{{extend "layout.html"}}{{theme=response.s3.theme}} \ No newline at end of file diff --git a/modules/templates/SAMBRO/views/layout.html b/modules/templates/SAMBRO/views/layout.html new file mode 100644 index 0000000000..dcb5463252 --- /dev/null +++ b/modules/templates/SAMBRO/views/layout.html @@ -0,0 +1,204 @@ + + +{{# class="no-js" needed for modernizr }} + + {{theme=response.s3.theme}} + + {{# Always force latest IE rendering engine (even in intranet) & Chrome Frame }} + + {{try:}}{{=title}}{{except:}}{{=response.title or settings.get_system_name_short()}}{{pass}} + {{if response.refresh:}}{{=XML(response.refresh)}}{{pass}} + {{# http://dev.w3.org/html5/markup/meta.name.html }} + + {{# Set your site up with Google: http://google.com/webmasters }} + {{# }} + {{ +a=""" """ + }} + + {{# Place favicon.ico and apple-touch-icon.png in the root of your domain and delete these references }} + + {{# }} + {{# All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects }}{{# This kills the map in IE8: VML.js }} + {{#}} + {{for sheet in s3.external_stylesheets:}} + + {{pass}} + {{include "foundation.css.html"}} + {{for sheet in s3.stylesheets:}} + + {{pass}} + {{if s3.debug:}}{{=s3base.s3_include_debug_css()}}{{else:}} + {{# Built by /static/scripts/tools/build.sahana.py }} + + {{pass}} + {{include "scripts_top.html"}} + + + + +{{try:}} +{{if r.representation == "popup":}}{{representation = "popup"}} +{{elif r.representation == "iframe":}}{{representation = "iframe"}} +{{else:}}{{representation = ""}}{{pass}} +{{except:}}{{representation = ""}}{{pass}} +{{if representation == "popup":}} + + {{if response.flash or response.confirmation:}}{{include "layout_popup.html"}} + {{else:}}{{include}}{{pass}} + {{if s3.debug:}}{{s3.scripts.append(URL(c="static", f="scripts", args=["S3", "s3.popup.js"]))}} + {{else:}}{{s3.scripts.append(URL(c="static", f="scripts", args=["S3", "s3.popup.min.js"]))}}{{pass}} + {{elif representation == "iframe":}} + {{include "layout_iframe.html"}} + {{include}} + {{else:}} + +
+ {{=current.menu.main}} +
+ +
+
ALERTS
+
+ +
+
+ +
+
+

Sahana Alert System

Welcome to the Sahana alert system

+ {{=XML(map)}} +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
TitleTypeDateDescription
EarthquakeAlert Title - This is the alert titleJune 1, 2015This is the content of alert no. This is the content of alert no.
TyphoonAlert Title - This is the alert titleJune 1, 2015This is the content of alert no. This is the content of alert no.
Volcanic EruptionAlert Title - This is the alert titleJune 1, 2015This is the content of alert no. This is the content of alert no.
FloodAlert Title - This is the alert titleJune 1, 2015This is the content of alert no. This is the content of alert no.
+
+
+ +
+
FEEDS
+
+ +
+
+ +
+ {{if current.menu.options is not None:}} + {{=T("Show Options")}} + +
+ {{else:}} +
+ {{pass}} +
+
+ {{if response.error:}}
{{=response.error}}
{{pass}} + {{if response.warning:}}
{{=response.warning}}
{{pass}} + {{if response.information:}}
{{=response.information}}
{{pass}} + {{if response.confirmation:}}
{{=response.confirmation}}
{{pass}} + {{if response.flash:}}
{{=response.flash}}
{{pass}} +
+
+ {{#include "breadcrumbs.html"}} + {{include}} +
+
+ + + {{pass}} + {{include "scripts.html"}} + {{include "foundation.js.html"}} +
+ + + diff --git a/static/scripts/SAMBRO/sambro.js b/static/scripts/SAMBRO/sambro.js new file mode 100644 index 0000000000..6b4b9067bf --- /dev/null +++ b/static/scripts/SAMBRO/sambro.js @@ -0,0 +1,2 @@ +$(document).ready(function () { +}); \ No newline at end of file diff --git a/static/themes/SAMBRO/style.css b/static/themes/SAMBRO/style.css index 6afb107a67..02356b98a1 100644 --- a/static/themes/SAMBRO/style.css +++ b/static/themes/SAMBRO/style.css @@ -1,11 +1,15 @@ -body { +body { + background-color: #EEE; font: normal 13px arial,sans-serif; + font-family: "Open Sans", Helvetica, Arial, sans-serif; margin: 0px; padding: 0px; + color: #333; } a { text-decoration: none; + color: #08F; } ul, li { @@ -18,11 +22,67 @@ ul, li { color: #FFF; } +p { + font-size: 13px; +} + + p.alert-content { + line-height: 18px; + } + + +.top-bar { + height: inherit; + -webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); + box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); +} + +.top-bar-section ul li { + background: #888; +} + +.top-bar-section li:not(.has-form) a:not(.button) { + padding: 0px 15px; + line-height: 45px; +} + +.top-bar-section li.active:not(.has-form) a:not(.button) { + padding: 0 15px; + line-height: 45px; + background: #008CBA; +} + +.top-bar-section ul.right ul.dropdown { + width: 320px; +} + + .top-bar-section ul.right ul.dropdown li { + width: 160px; + float: left; + } + +.top-bar-section .has-dropdown.hover > .dropdown, .top-bar-section .has-dropdown.not-click:hover > .dropdown { + display: block; + position: static !important; + height: auto; + width: 320px; + overflow: visible; + clip: auto; + position: absolute !important; + background-color: #888; + background: #888; +} + +.top-bar-section .dropdown li:not(.has-form):not(.active) > a:not(.button) { + color: #FFFFFF; + background: #444; + border-bottom: 1px solid #555; + border-left: 1px solid #555; +} + #sambro-menu { - background-color: #000; - height: 40px; + background-color: #FFF; width: 100%; - position: relative; } #sambro-menu img { @@ -34,14 +94,10 @@ ul, li { margin: 0px; } - #sambro-menu li { - padding: 8px; + #sambro-menu li a { + color: #FFF; } - #sambro-menu li a { - color: #FFF; - } - #sambro-menu ul.menu-right { position: absolute; top: 5px; @@ -52,86 +108,79 @@ ul, li { margin-right: 5px; } -#sambro-title { - background-color: #FFF; - height: 40px; +#default_map { width: 100%; - border-bottom: 1px solid #CCC; } - #sambro-title h1 { - color: #080; - font-size: 24px; - font-weight: normal; - margin: 10px 0px 0px 15px; - padding: 0px; - } - -#sambro-header { - position: fixed; - top: 0px; - height: 70px; +#sambro-footer { + background-color: #FFF; + margin-top: 20px; width: 100%; } -#sambro-footer { - background-color: #EEE; - position: fixed; - height: 30px; - width: 100%; - bottom: 0px; - padding: 10px; +#sambro-map { + background-color: #FFF; + margin: 20px 320px 0px 320px; + -webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); + box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); } -#sambro-body { - position: fixed; - width: 100%; - top: 90px; - bottom: 50px; +#sambro-alert-table { + background-color: #FFF; + margin: 20px 320px 0px 320px; + -webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); + box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); } + #sambro-alert-table table { + width: 100%; + } + + #sambro-alert-table table th { + border-bottom: 1px solid #CCC; + font-weight: bold; + text-align: center; + color: #333; + } + + #sambro-alert-table table .fa { + margin-right: 5px; + color: #F83; + } + #sambro-left { - border-right: 1px solid #CCC; - position: absolute; - left: 0px; - width: 320px; - top: 0px; - bottom: 0px; + background-color: #FFF; + margin: 20px 0px 0px 20px; + width: 280px; + float: left; + -webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); + box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); } #sambro-right { - border-left: 1px solid #CCC; + background-color: #FFF; + margin: 0px 20px 0px 0px; + width: 280px; position: absolute; + top: 65px; right: 0px; - width: 320px; - top: 0px; - bottom: 0px; -} - -#sambro-center { - position: absolute; - left: 320px; - right: 320px; - top: 0px; - bottom: 0px; + -webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); + box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); } div.sambro-feeds { - position: absolute; - top: 36px; - bottom: 0px; - overflow: auto; padding-top: 15px; } div.sambro-feeds .fa { - background-color: #F00; + background-color: #F83; color: #FFF; display: inline; - border-radius: 30px; + border-radius: 3px; padding: 5px; position: absolute; left: 10px; + font-size: 12px; } div.sambro-feeds ul, div.sambro-feeds li { @@ -144,13 +193,14 @@ div.sambro-feeds { } div.sambro-feeds h3 { - margin: 0px; + margin: 0px 0px 0px 0px; padding: 0px; font-size: 15px; } div.sambro-feeds li { padding: 0px 20px; + font-size: 12px; } #sambro-left div.sambro-feeds li { @@ -158,46 +208,50 @@ div.sambro-feeds { } div.sambro-feeds li div { - border-bottom: 1px solid #CCC; - padding-bottom: 5px; + padding: 3px; } div.sambro-feeds li p { - margin-bottom: 20px; + margin-bottom: 10px; + padding-bottom: 10px; } div.sambro-panel-title { - border-bottom: 1px solid #CCC; - border-top: 1px solid #CCC; - background-color: #EEE; - padding: 10px 10px 10px; + border-top: 5px solid #DDD; + border-bottom: 2px solid #EEE; + background-color: #FFF; + padding: 15px 10px; font-weight: bold; + color: #888; } -span.alert-type { - color: #FFF; - padding: 1px 10px; - border-radius: 10px; -} - -span.type-1 { - background-color: #080; -} + div.sambro-panel-title h1 { + font-size: 24px; + margin: 0px 0px; + padding: 0px; + } -span.type-2 { - background-color: #C00; -} + div.sambro-panel-title p { + color: #888; + margin: 0px 0px; + padding: 0px; + } -span.type-3 { - background-color: #00A; -} + div.sambro-panel-title .fa { + color: #888; + display: inline; + margin-right: 10px; + font-size: 18px; + } -span.type-4 { - background-color: #F80; +span.alert-date { + color: #888; + text-transform: uppercase; } -span.type-5 { - background-color: #08F; +span.alert-type { + color: #888; + text-transform: uppercase; } #sahana-icon img { @@ -205,19 +259,20 @@ span.type-5 { margin-right: 5px; } -::-webkit-scrollbar { - width: 0.8em; - height: 0.8em; +#poweredby { + float: none; + margin: 20px 0px; } -::-webkit-scrollbar-button { - background: #CCC; -} - -::-webkit-scrollbar-track-piece { - background: #FFF; -} +@media (max-width: 1200px) { + #sambro-right, #sambro-map, #sambro-alert-table { + margin: 0px 20px 20px 320px; + width: inherit; + position: inherit; + top: 0px; + } -::-webkit-scrollbar-thumb { - background: #CCC; + #sambro-map { + margin-top: 20px; + } } From b57505085e37d0ccbd02b516a93f5722ef46d763 Mon Sep 17 00:00:00 2001 From: Jonathan Date: Thu, 2 Jul 2015 15:57:23 +0700 Subject: [PATCH 3/3] SAMBRO Main Page Update main page update --- modules/templates/SAMBRO/config.py | 114 ++++----- modules/templates/SAMBRO/controllers.py | 109 ++++++-- modules/templates/SAMBRO/views/footer.html | 4 - modules/templates/SAMBRO/views/index.html | 54 +++- modules/templates/SAMBRO/views/layout.html | 204 --------------- static/themes/SAMBRO/style.css | 276 ++------------------- 6 files changed, 213 insertions(+), 548 deletions(-) delete mode 100644 modules/templates/SAMBRO/views/footer.html delete mode 100644 modules/templates/SAMBRO/views/layout.html diff --git a/modules/templates/SAMBRO/config.py b/modules/templates/SAMBRO/config.py index 20817c5e2a..2b88c4f7ec 100644 --- a/modules/templates/SAMBRO/config.py +++ b/modules/templates/SAMBRO/config.py @@ -21,7 +21,7 @@ def config(settings): settings.base.prepopulate = ("SAMBRO", "default/users") # Theme (folder to use for views/layout.html) - settings.base.theme = "SAMBRO" + #settings.base.theme = "SAMBRO" # The Registration functionality shouldn't be visible to the Public settings.security.registration_visible = False @@ -109,25 +109,25 @@ def onaccept(form): #description = "Selective translation of strings based on module.", module_type = None, )), - #("gis", Storage( - # name_nice = T("Map"), - # #description = "Situation Awareness & Geospatial Analysis", - # restricted = True, - # module_type = 6, # 6th item in the menu - #)), - #("pr", Storage( - # name_nice = T("Person Registry"), - # #description = "Central point to record details on People", - # restricted = True, - # access = "|1|", # Only Administrators can see this module in the default menu (access to controller is possible to all still) - # module_type = 10 - #)), - #("org", Storage( - # name_nice = T("Organizations"), - # #description = 'Lists "who is doing what & where". Allows relief agencies to coordinate their activities', - # restricted = True, - # module_type = 10 - #)), + ("gis", Storage( + name_nice = T("Map"), + #description = "Situation Awareness & Geospatial Analysis", + restricted = True, + module_type = 6, # 6th item in the menu + )), + ("pr", Storage( + name_nice = T("Person Registry"), + #description = "Central point to record details on People", + restricted = True, + access = "|1|", # Only Administrators can see this module in the default menu (access to controller is possible to all still) + module_type = 10 + )), + ("org", Storage( + name_nice = T("Organizations"), + #description = 'Lists "who is doing what & where". Allows relief agencies to coordinate their activities', + restricted = True, + module_type = 10 + )), # All modules below here should be possible to disable safely #("hrm", Storage( # name_nice = T("Staff"), @@ -135,43 +135,43 @@ def onaccept(form): # restricted = True, # module_type = 2, #)), - #("cap", Storage( - # name_nice = T("CAP"), - # #description = "Create & broadcast CAP alerts", - # restricted = True, - # module_type = 1, - #)), - #("cms", Storage( - # name_nice = T("Content Management"), - # #description = "Content Management System", - # restricted = True, - # module_type = 10, - #)), - #("doc", Storage( - # name_nice = T("Documents"), - # #description = "A library of digital resources, such as photos, documents and reports", - # restricted = True, - # module_type = 10, - #)), - #("msg", Storage( - # name_nice = T("Messaging"), - # #description = "Sends & Receives Alerts via Email & SMS", - # restricted = True, - # # The user-visible functionality of this module isn't normally required. Rather it's main purpose is to be accessed from other modules. - # module_type = None, - #)), - #("irs", Storage( - # name_nice = T("Incidents"), - # #description = "Incident Reporting System", - # restricted = True, - # module_type = 10 - #)), - #("event", Storage( - # name_nice = T("Events"), - # #description = "Activate Events (e.g. from Scenario templates) for allocation of appropriate Resources (Human, Assets & Facilities).", - # restricted = True, - # module_type = 10, - #)), + ("cap", Storage( + name_nice = T("CAP"), + #description = "Create & broadcast CAP alerts", + restricted = True, + module_type = 1, + )), + ("cms", Storage( + name_nice = T("Content Management"), + #description = "Content Management System", + restricted = True, + module_type = 10, + )), + ("doc", Storage( + name_nice = T("Documents"), + #description = "A library of digital resources, such as photos, documents and reports", + restricted = True, + module_type = 10, + )), + ("msg", Storage( + name_nice = T("Messaging"), + #description = "Sends & Receives Alerts via Email & SMS", + restricted = True, + # The user-visible functionality of this module isn't normally required. Rather it's main purpose is to be accessed from other modules. + module_type = None, + )), + ("irs", Storage( + name_nice = T("Incidents"), + #description = "Incident Reporting System", + restricted = True, + module_type = 10 + )), + ("event", Storage( + name_nice = T("Events"), + #description = "Activate Events (e.g. from Scenario templates) for allocation of appropriate Resources (Human, Assets & Facilities).", + restricted = True, + module_type = 10, + )), ]) # END ========================================================================= diff --git a/modules/templates/SAMBRO/controllers.py b/modules/templates/SAMBRO/controllers.py index 0828f46552..8ef0173eb2 100644 --- a/modules/templates/SAMBRO/controllers.py +++ b/modules/templates/SAMBRO/controllers.py @@ -7,7 +7,6 @@ import simplejson as json # try external module except: import gluon.contrib.simplejson as json # fallback to pure-Python module - from gluon import current from gluon.html import * from gluon.storage import Storage @@ -27,8 +26,44 @@ def __call__(self): map = current.gis.show_map() + output = {} + output["map"] = map + + # Image Carousel + # Latest 4 Events and Alerts + from s3.s3query import FS + s3db = current.s3db + layout = s3.render_posts + list_id = "news_datalist" + limit = 4 + list_fields = ["series_id", + "location_id", + "date", + "body", + "created_by", + "created_by$organisation_id", + "document.file", + "event_post.event_id", + ] + + resource = s3db.resource("cms_post") + resource.add_filter(FS("series_id$name") == "Event") + # Only show Future Events + resource.add_filter(resource.table.date >= current.request.now) + # Order with next Event first + orderby = "date" + output["events"] = latest_records(resource, layout, list_id, limit, list_fields, orderby) + + resource = s3db.resource("cms_post") + resource.add_filter(FS("series_id$name") == "Alert") + # Order with most recent Alert first + orderby = "date desc" + output["alerts"] = latest_records(resource, layout, list_id, limit, list_fields, orderby) + + self._view(THEME, "index.html") - return dict(title = T("CAP Alert"), map = map) + + return output # ============================================================================= class subscriptions(S3CustomController): @@ -51,8 +86,7 @@ def __call__(self): # Available resources resources = [dict(resource="cap_alert", url="cap/alert", - label=T("Updates")), - ] + label=T("Updates")),] # Filter widgets # @note: subscription manager has no resource context, so @@ -63,23 +97,19 @@ def __call__(self): options = s3db.cap_info_category_opts, represent = "%(name)s", resource = "cap_info", - _name = "category-filter", - ), + _name = "category-filter",), S3LocationFilter("location_id", label = T("Location(s)"), levels = ("L0",), resource = "cap_area_location", options = gis.get_countries().keys(), - _name = "location-filter", - ), + _name = "location-filter",), S3OptionsFilter("language", label = T("Language"), options = settings.get_cap_languages(), represent = "%(name)s", resource = "cap_info", - _name = "language-filter", - ), - ] + _name = "language-filter",),] # Title and view title = T("Notification Settings") @@ -105,20 +135,16 @@ def _manage_subscriptions(self, resources, filters): # L10n T = current.T - labels = Storage( - RESOURCES = T("Subscribe To"), + labels = Storage(RESOURCES = T("Subscribe To"), NOTIFY_ON = T("Notify On"), FREQUENCY = T("Frequency"), NOTIFY_BY = T("Notify By"), MORE = T("More Options"), - LESS = T("Less Options"), - ) - messages = Storage( - ERROR = T("Error: could not update notification settings"), - SUCCESS = T("Notification settings updated"), - ) - - # Get current subscription settings resp. form defaults + LESS = T("Less Options"),) + messages = Storage(ERROR = T("Error: could not update notification settings"), + SUCCESS = T("Notification settings updated"),) + + # Get current subscription settings resp. form defaults subscription = self._get_subscription() # Formstyle bootstrap @@ -334,8 +360,7 @@ def _update_subscription(self, subscription): method=subscription["method"]) subscription_id = success else: - success = db(stable.id == subscription_id).update( - pe_id=pe_id, + success = db(stable.id == subscription_id).update(pe_id=pe_id, filter_id=filter_id, notify_on=subscription["notify_on"], frequency=frequency, @@ -411,4 +436,42 @@ def _update_subscription(self, subscription): subscription["filter_id"] = filter_id return subscription + # ============================================================================= +def latest_records(resource, layout, list_id, limit, list_fields, orderby): + """ + Display a dataList of the latest records for a resource + @todo: remove this wrapper + """ + + #orderby = resource.table[orderby] + datalist, numrows, ids = resource.datalist(fields=list_fields, + start=None, + limit=limit, + list_id=list_id, + orderby=orderby, + layout=layout) + if numrows == 0: + # Empty table or just no match? + from s3.s3crud import S3CRUD + table = resource.table + if "deleted" in table: + available_records = current.db(table.deleted != True) + else: + available_records = current.db(table._id > 0) + if available_records.select(table._id, + limitby=(0, 1)).first(): + msg = DIV(S3CRUD.crud_string(resource.tablename, + "msg_no_match"), + _class="empty") + else: + msg = DIV(S3CRUD.crud_string(resource.tablename, + "msg_list_empty"), + _class="empty") + data = msg + else: + # Render the list + data = datalist.html() + + return data + # END ========================================================================= diff --git a/modules/templates/SAMBRO/views/footer.html b/modules/templates/SAMBRO/views/footer.html deleted file mode 100644 index 0bfcce0994..0000000000 --- a/modules/templates/SAMBRO/views/footer.html +++ /dev/null @@ -1,4 +0,0 @@ -{{if settings.ui.get("social_buttons"):}}
{{pass}} -

- {{=T("Powered by Sahana Eden")}}{{=T("Powered by Sahana Eden")}} -

diff --git a/modules/templates/SAMBRO/views/index.html b/modules/templates/SAMBRO/views/index.html index 14e1b6e38d..9c3e577ff5 100644 --- a/modules/templates/SAMBRO/views/index.html +++ b/modules/templates/SAMBRO/views/index.html @@ -1 +1,53 @@ -{{extend "layout.html"}}{{theme=response.s3.theme}} \ No newline at end of file +{{extend "layout.html"}}{{theme=response.s3.theme}} + + +
+
+
+ +
+
+

{{=T("Alerts")}}

+ + + + + +
+
+ +
+
+

{{=T("Sahana Alert System")}}

+ {{=XML(map)}} +
+
+ +
+
+

{{=T("Events")}}

+
+ {{=events}} +
+
+
+

{{=T("Feeds")}}

+
+ {{=alerts}} +
+
+
+
+
+
+ \ No newline at end of file diff --git a/modules/templates/SAMBRO/views/layout.html b/modules/templates/SAMBRO/views/layout.html deleted file mode 100644 index dcb5463252..0000000000 --- a/modules/templates/SAMBRO/views/layout.html +++ /dev/null @@ -1,204 +0,0 @@ - - -{{# class="no-js" needed for modernizr }} - - {{theme=response.s3.theme}} - - {{# Always force latest IE rendering engine (even in intranet) & Chrome Frame }} - - {{try:}}{{=title}}{{except:}}{{=response.title or settings.get_system_name_short()}}{{pass}} - {{if response.refresh:}}{{=XML(response.refresh)}}{{pass}} - {{# http://dev.w3.org/html5/markup/meta.name.html }} - - {{# Set your site up with Google: http://google.com/webmasters }} - {{# }} - {{ -a=""" """ - }} - - {{# Place favicon.ico and apple-touch-icon.png in the root of your domain and delete these references }} - - {{# }} - {{# All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects }}{{# This kills the map in IE8: VML.js }} - {{#}} - {{for sheet in s3.external_stylesheets:}} - - {{pass}} - {{include "foundation.css.html"}} - {{for sheet in s3.stylesheets:}} - - {{pass}} - {{if s3.debug:}}{{=s3base.s3_include_debug_css()}}{{else:}} - {{# Built by /static/scripts/tools/build.sahana.py }} - - {{pass}} - {{include "scripts_top.html"}} - - - - -{{try:}} -{{if r.representation == "popup":}}{{representation = "popup"}} -{{elif r.representation == "iframe":}}{{representation = "iframe"}} -{{else:}}{{representation = ""}}{{pass}} -{{except:}}{{representation = ""}}{{pass}} -{{if representation == "popup":}} - - {{if response.flash or response.confirmation:}}{{include "layout_popup.html"}} - {{else:}}{{include}}{{pass}} - {{if s3.debug:}}{{s3.scripts.append(URL(c="static", f="scripts", args=["S3", "s3.popup.js"]))}} - {{else:}}{{s3.scripts.append(URL(c="static", f="scripts", args=["S3", "s3.popup.min.js"]))}}{{pass}} - {{elif representation == "iframe":}} - {{include "layout_iframe.html"}} - {{include}} - {{else:}} - -
- {{=current.menu.main}} -
- -
-
ALERTS
-
- -
-
- -
-
-

Sahana Alert System

Welcome to the Sahana alert system

- {{=XML(map)}} -
- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TitleTypeDateDescription
EarthquakeAlert Title - This is the alert titleJune 1, 2015This is the content of alert no. This is the content of alert no.
TyphoonAlert Title - This is the alert titleJune 1, 2015This is the content of alert no. This is the content of alert no.
Volcanic EruptionAlert Title - This is the alert titleJune 1, 2015This is the content of alert no. This is the content of alert no.
FloodAlert Title - This is the alert titleJune 1, 2015This is the content of alert no. This is the content of alert no.
-
-
- -
-
FEEDS
-
- -
-
- -
- {{if current.menu.options is not None:}} - {{=T("Show Options")}} - -
- {{else:}} -
- {{pass}} -
-
- {{if response.error:}}
{{=response.error}}
{{pass}} - {{if response.warning:}}
{{=response.warning}}
{{pass}} - {{if response.information:}}
{{=response.information}}
{{pass}} - {{if response.confirmation:}}
{{=response.confirmation}}
{{pass}} - {{if response.flash:}}
{{=response.flash}}
{{pass}} -
-
- {{#include "breadcrumbs.html"}} - {{include}} -
-
- - - {{pass}} - {{include "scripts.html"}} - {{include "foundation.js.html"}} -
- - - diff --git a/static/themes/SAMBRO/style.css b/static/themes/SAMBRO/style.css index 02356b98a1..251790dc8d 100644 --- a/static/themes/SAMBRO/style.css +++ b/static/themes/SAMBRO/style.css @@ -1,278 +1,36 @@ body { - background-color: #EEE; - font: normal 13px arial,sans-serif; - font-family: "Open Sans", Helvetica, Arial, sans-serif; - margin: 0px; - padding: 0px; - color: #333; + background-color: #FAFAFA; } -a { - text-decoration: none; - color: #08F; -} - -ul, li { - margin: 0px; - padding: 0px; - list-style: none; -} - -.fa { - color: #FFF; -} - -p { - font-size: 13px; -} - - p.alert-content { - line-height: 18px; - } - - -.top-bar { - height: inherit; - -webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); - box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); -} - -.top-bar-section ul li { - background: #888; -} - -.top-bar-section li:not(.has-form) a:not(.button) { - padding: 0px 15px; - line-height: 45px; -} - -.top-bar-section li.active:not(.has-form) a:not(.button) { - padding: 0 15px; - line-height: 45px; - background: #008CBA; -} - -.top-bar-section ul.right ul.dropdown { - width: 320px; -} - - .top-bar-section ul.right ul.dropdown li { - width: 160px; - float: left; - } - -.top-bar-section .has-dropdown.hover > .dropdown, .top-bar-section .has-dropdown.not-click:hover > .dropdown { - display: block; - position: static !important; - height: auto; - width: 320px; - overflow: visible; - clip: auto; - position: absolute !important; - background-color: #888; - background: #888; -} - -.top-bar-section .dropdown li:not(.has-form):not(.active) > a:not(.button) { - color: #FFFFFF; - background: #444; - border-bottom: 1px solid #555; - border-left: 1px solid #555; -} - -#sambro-menu { - background-color: #FFF; - width: 100%; -} - - #sambro-menu img { - vertical-align: middle; - margin-right: 5px; - } - - #sambro-menu ul { - margin: 0px; - } - - #sambro-menu li a { - color: #FFF; - } - - #sambro-menu ul.menu-right { - position: absolute; - top: 5px; - right: 10px; - } - - #sambro-menu ul.menu-right .fa { - margin-right: 5px; - } - -#default_map { - width: 100%; -} - -#sambro-footer { - background-color: #FFF; - margin-top: 20px; - width: 100%; -} - -#sambro-map { - background-color: #FFF; - margin: 20px 320px 0px 320px; - -webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); - box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); -} - -#sambro-alert-table { - background-color: #FFF; - margin: 20px 320px 0px 320px; - -webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); - box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); -} - - #sambro-alert-table table { - width: 100%; - } - - #sambro-alert-table table th { - border-bottom: 1px solid #CCC; - font-weight: bold; - text-align: center; - color: #333; - } - - #sambro-alert-table table .fa { - margin-right: 5px; - color: #F83; - } - -#sambro-left { - background-color: #FFF; - margin: 20px 0px 0px 20px; - width: 280px; - float: left; - -webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); - box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); -} - -#sambro-right { - background-color: #FFF; - margin: 0px 20px 0px 0px; - width: 280px; - position: absolute; - top: 65px; - right: 0px; - -webkit-box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); - box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.08), 0px 2px 0px 0px rgba(0, 0, 0, 0.02); -} - -div.sambro-feeds { - padding-top: 15px; +.icon { + margin-right: 5px; } - div.sambro-feeds .fa { - background-color: #F83; - color: #FFF; - display: inline; - border-radius: 3px; - padding: 5px; - position: absolute; - left: 10px; - font-size: 12px; - } - - div.sambro-feeds ul, div.sambro-feeds li { - position: relative; - } - - div.sambro-feeds a { - color: #0026ff; - font-weight: normal; - } - - div.sambro-feeds h3 { - margin: 0px 0px 0px 0px; - padding: 0px; - font-size: 15px; - } - - div.sambro-feeds li { - padding: 0px 20px; - font-size: 12px; - } - -#sambro-left div.sambro-feeds li { - padding: 0px 20px 0px 40px; +#sambro-body { } -div.sambro-feeds li div { - padding: 3px; +#sambro-center { } -div.sambro-feeds li p { - margin-bottom: 10px; - padding-bottom: 10px; +.sambro-list { + padding: 5px 5px; } -div.sambro-panel-title { - border-top: 5px solid #DDD; - border-bottom: 2px solid #EEE; +.sambro-panel { background-color: #FFF; - padding: 15px 10px; - font-weight: bold; - color: #888; + margin: 20px 0px 0px 0px; + border: 1px solid #e7eaec; + border-top: 4px solid #e7eaec; } - div.sambro-panel-title h1 { - font-size: 24px; - margin: 0px 0px; - padding: 0px; + .sambro-panel div { } - div.sambro-panel-title p { + .sambro-panel h4 { + border-bottom: 1px solid #DDD; + font-size: 16px; color: #888; - margin: 0px 0px; + margin: 0px; padding: 0px; + padding: 10px 10px; } - - div.sambro-panel-title .fa { - color: #888; - display: inline; - margin-right: 10px; - font-size: 18px; - } - -span.alert-date { - color: #888; - text-transform: uppercase; -} - -span.alert-type { - color: #888; - text-transform: uppercase; -} - -#sahana-icon img { - vertical-align: middle; - margin-right: 5px; -} - -#poweredby { - float: none; - margin: 20px 0px; -} - -@media (max-width: 1200px) { - #sambro-right, #sambro-map, #sambro-alert-table { - margin: 0px 20px 20px 320px; - width: inherit; - position: inherit; - top: 0px; - } - - #sambro-map { - margin-top: 20px; - } -}