We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
About menu:  glitch on home page functionality
On **homepage only** and only in Chrome.
Click on about to open the submenu.
Click again to close the menu.
Move the cursor around the `About` text.
The menu text 'About' disappears and reappears unreliably as the cursor moves around it.  This is on chrome.  Does not occur in firefox.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ckanext-hdx_theme/ckanext/hdx_theme/version.py`
Content:
```
1 hdx_version='v0.2.3'
```

Path: `ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py`
Content:
```
1 import sys, re
2 import ckan.lib.base as base
3 from ckan.lib.base import request
4 from ckan.lib.base import c,g,h
5 from ckan.lib.base import model
6 from ckan.lib.base import render
7 from ckan.lib.base import _
8 import ckan.logic as logic
9 import ckan.plugins.toolkit as tk
10 
11 from ckan.controllers.group import GroupController as gc
12 from ckan.controllers.home import HomeController
13 
14 import ckanext.hdx_theme.caching as caching
15 
16 NotAuthorized = logic.NotAuthorized
17 check_access = logic.check_access
18 get_action = logic.get_action
19 
20 
21 class SplashPageController(HomeController):
22 
23 	group_type = 'group'
24 
25 	def index(self):
26 		group_type = None
27 		context = {'model': model, 'session': model.Session,
28 				   'user': c.user or c.author, 'for_view': True,
29 				   'with_private': False}
30 
31 		q = c.q = request.params.get('q', '')
32 		data_dict = {'all_fields': True, 'q': q}
33 		sort_by = c.sort_by_selected = request.params.get('sort')
34 		if sort_by:
35 			data_dict['sort'] = sort_by
36 		try:
37 			self._check_access('site_read', context)
38 		except NotAuthorized:
39 			abort(401, _('Not authorized to see this page'))
40 		if c.userobj:
41 			context['user_id'] = c.userobj.id
42 			context['user_is_admin'] = c.userobj.sysadmin
43 		
44 		
45 		
46 		c.group_package_stuff = caching.cached_get_group_package_stuff()
47 
48 		##Removing groups without geojson for the map
49 		c.group_map = []
50 		for gp in c.group_package_stuff:
51 			for e in gp['extras']:
52 				if e['key'] == 'geojson' and e['value']:
53 					c.group_map.append(gp)
54 
55 		#print c.group_package_stuff
56 
57 		if c.userobj is not None:
58 			msg = None
59 			url = h.url_for(controller='user', action='edit')
60 			is_google_id = \
61 				c.userobj.name.startswith('https://www.google.com/accounts/o8/id')
62 			if not c.userobj.email and (is_google_id and not c.userobj.fullname):
63 				msg = _(u'Please <a href="{link}">update your profile</a>'
64 						u' and add your email address and your full name. '
65 						u'{site} uses your email address'
66 						u' if you need to reset your password.'.format(
67 							link=url, site=g.site_title))
68 			elif not c.userobj.email:
69 				msg = _('Please <a href="%s">update your profile</a>'
70 						' and add your email address. ') % url + \
71 					_('%s uses your email address'
72 						' if you need to reset your password.') \
73 					% g.site_title
74 			elif is_google_id and not c.userobj.fullname:
75 				msg = _('Please <a href="%s">update your profile</a>'
76 						' and add your full name.') % (url)
77 			if msg:
78 				h.flash_notice(msg, allow_html=True)
79 
80 		return base.render('home/index.html', cache_force=True)
81 
82 	def _check_access(self, action_name, *args, **kw):
83 		''' select the correct group/org check_access '''
84 		return check_access(self._replace_group_org(action_name), *args, **kw)
85 
86 	def _replace_group_org(self, string):
87 		''' substitute organization for group if this is an org'''
88 		if self.group_type == 'organization':
89 			string = re.sub('^group', 'organization', string)
90 		return string
91 
92 	def _action(self, action_name):
93 		''' select the correct group/org action '''
94 		return get_action(self._replace_group_org(action_name))
95 	
96
```

Path: `ckanext-hdx_theme/ckanext/hdx_theme/plugin.py`
Content:
```
1 import ckanext.hdx_theme.licenses as hdx_licenses
2 
3 import ckan.plugins as plugins
4 import ckan.plugins.toolkit as toolkit
5 import ckan.model.package as package
6 import ckan.model.license as license
7 import version
8 
9 import ckanext.hdx_theme.caching as caching
10 import ckanext.hdx_theme.auth as auth
11 
12 
13 def run_on_startup():
14     _generate_license_list()
15     
16     caching.cached_get_group_package_stuff()
17     
18 
19 def _generate_license_list():
20     package.Package._license_register = license.LicenseRegister() 
21     package.Package._license_register.licenses = [
22                                                   license.License(hdx_licenses.LicenseCreativeCommonsIntergovernmentalOrgs()),
23                                                   license.License(license.LicenseCreativeCommonsAttribution()),
24                                                   license.License(license.LicenseCreativeCommonsAttributionShareAlike()),
25                                                   license.License(hdx_licenses.LicenseOtherPublicDomainNoRestrictions()),
26                                                   license.License(hdx_licenses.LicenseHdxMultiple()),
27                                                   license.License(hdx_licenses.LicenseHdxOther())
28                                                   ]
29 
30 class HDXThemePlugin(plugins.SingletonPlugin):
31     plugins.implements(plugins.IConfigurer)
32     plugins.implements(plugins.IRoutes, inherit=True)
33     plugins.implements(plugins.ITemplateHelpers)
34     plugins.implements(plugins.IActions)
35     plugins.implements(plugins.IAuthFunctions)
36     plugins.implements(plugins.IGroupController, inherit=True)
37     plugins.implements(plugins.IMiddleware, inherit=True)
38     
39     def update_config(self, config):
40         toolkit.add_template_directory(config, 'templates')
41         toolkit.add_public_directory(config, 'public')
42         toolkit.add_resource('fanstatic', 'hdx_theme')
43         
44 
45     def before_map(self, map):
46         map.connect('home', '/', controller='ckanext.hdx_theme.splash_page:SplashPageController', action='index')
47         map.connect('/count/dataset', controller='ckanext.hdx_theme.count:CountController', action='dataset')
48         map.connect('/count/country', controller='ckanext.hdx_theme.count:CountController', action='country')
49         map.connect('/count/source', controller='ckanext.hdx_theme.count:CountController', action='source')
50         map.connect('/user/logged_in', controller='ckanext.hdx_theme.login:LoginController', action='logged_in')
51         map.connect('/contribute', controller='ckanext.hdx_theme.login:LoginController', action='contribute')
52         
53         map.connect('/count/test', controller='ckanext.hdx_theme.count:CountController', action='test')
54         
55         map.connect('/organization/{id}/request_membership', controller='ckanext.hdx_theme.org_controller:HDXOrgController', action='request_membership')
56         return map
57     
58     def create(self, entity):
59         caching.invalidate_group_caches()
60 
61     def edit(self, entity):
62         caching.invalidate_group_caches()
63 
64     def get_helpers(self):
65         from ckanext.hdx_theme import helpers as hdx_helpers
66         return {
67             'is_downloadable': hdx_helpers.is_downloadable,
68             'get_facet_items_dict':hdx_helpers.get_facet_items_dict,
69             'get_last_modifier_user': hdx_helpers.get_last_modifier_user,
70             'get_filtered_params_list':hdx_helpers.get_filtered_params_list,
71             'get_last_revision_package':hdx_helpers.get_last_revision_package,
72             'get_last_modifier_user':hdx_helpers.get_last_modifier_user,
73             'get_last_revision_group':hdx_helpers.get_last_revision_group,
74             'get_group_followers':hdx_helpers.get_group_followers,
75             'get_group_members':hdx_helpers.get_group_members,
76             'markdown_extract_strip':hdx_helpers.markdown_extract_strip,
77             'render_date_from_concat_str':hdx_helpers.render_date_from_concat_str,
78             'hdx_version':hdx_helpers.hdx_version,
79             'hdx_build_nav_icon_with_message':hdx_helpers.hdx_build_nav_icon_with_message,
80             'hdx_num_of_new_related_items':hdx_helpers.hdx_num_of_new_related_items,
81             'hdx_get_extras_element':hdx_helpers.hdx_get_extras_element,
82             'hdx_get_user_info':hdx_helpers.hdx_get_user_info,
83             'hdx_linked_user':hdx_helpers.hdx_linked_user,
84             'hdx_show_singular_plural':hdx_helpers.hdx_show_singular_plural,
85             'hdx_member_roles_list':hdx_helpers.hdx_member_roles_list
86             
87         }
88         
89     def get_actions(self):
90         from ckanext.hdx_theme import actions as hdx_actions
91         return {
92             'organization_list_for_user':hdx_actions.organization_list_for_user, 
93             'cached_group_list': hdx_actions.cached_group_list,
94             'hdx_basic_user_info': hdx_actions.hdx_basic_user_info,
95             'member_list': hdx_actions.member_list,
96             'hdx_get_sys_admins': hdx_actions.hdx_get_sys_admins
97             
98         }
99     def get_auth_functions(self):
100         return {
101                 'hdx_basic_user_info': auth.hdx_basic_user_info
102                 }
103     
104     def make_middleware(self, app, config):
105         run_on_startup()
106         return app
107 
108         
109         
110 
111
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/plugin.py b/ckanext-hdx_theme/ckanext/hdx_theme/plugin.py
--- a/ckanext-hdx_theme/ckanext/hdx_theme/plugin.py
+++ b/ckanext-hdx_theme/ckanext/hdx_theme/plugin.py
@@ -53,6 +53,8 @@
         map.connect('/count/test', controller='ckanext.hdx_theme.count:CountController', action='test')
         
         map.connect('/organization/{id}/request_membership', controller='ckanext.hdx_theme.org_controller:HDXOrgController', action='request_membership')
+
+        map.connect('/about/{page}', controller='ckanext.hdx_theme.splash_page:SplashPageController', action='about')
         return map
     
     def create(self, entity):
diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py b/ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py
--- a/ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py
+++ b/ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py
@@ -92,4 +92,14 @@
 	def _action(self, action_name):
 		''' select the correct group/org action '''
 		return get_action(self._replace_group_org(action_name))
-	
+
+	def about(self, page):
+		title = {'license': _('Data Licenses'),
+				 'terms': _('Terms of Service')}
+		html =  {'license': 'home/snippets/hdx_licenses.html',
+				 'terms': 'home/snippets/hdx_terms_of_service.html'}
+
+		extraVars = {'title': title.get(page), 'html': html.get(page), 'page': page}
+		return base.render('home/about2.html',  extra_vars = extraVars)
+
+
diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/version.py b/ckanext-hdx_theme/ckanext/hdx_theme/version.py
--- a/ckanext-hdx_theme/ckanext/hdx_theme/version.py
+++ b/ckanext-hdx_theme/ckanext/hdx_theme/version.py
@@ -1 +1 @@
-hdx_version='v0.2.3'
\ No newline at end of file
+hdx_version='v0.2.4'
\ No newline at end of file

{"golden_diff": "diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/plugin.py b/ckanext-hdx_theme/ckanext/hdx_theme/plugin.py\n--- a/ckanext-hdx_theme/ckanext/hdx_theme/plugin.py\n+++ b/ckanext-hdx_theme/ckanext/hdx_theme/plugin.py\n@@ -53,6 +53,8 @@\n         map.connect('/count/test', controller='ckanext.hdx_theme.count:CountController', action='test')\n         \n         map.connect('/organization/{id}/request_membership', controller='ckanext.hdx_theme.org_controller:HDXOrgController', action='request_membership')\n+\n+        map.connect('/about/{page}', controller='ckanext.hdx_theme.splash_page:SplashPageController', action='about')\n         return map\n     \n     def create(self, entity):\ndiff --git a/ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py b/ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py\n--- a/ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py\n+++ b/ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py\n@@ -92,4 +92,14 @@\n \tdef _action(self, action_name):\n \t\t''' select the correct group/org action '''\n \t\treturn get_action(self._replace_group_org(action_name))\n-\t\n+\n+\tdef about(self, page):\n+\t\ttitle = {'license': _('Data Licenses'),\n+\t\t\t\t 'terms': _('Terms of Service')}\n+\t\thtml =  {'license': 'home/snippets/hdx_licenses.html',\n+\t\t\t\t 'terms': 'home/snippets/hdx_terms_of_service.html'}\n+\n+\t\textraVars = {'title': title.get(page), 'html': html.get(page), 'page': page}\n+\t\treturn base.render('home/about2.html',  extra_vars = extraVars)\n+\n+\ndiff --git a/ckanext-hdx_theme/ckanext/hdx_theme/version.py b/ckanext-hdx_theme/ckanext/hdx_theme/version.py\n--- a/ckanext-hdx_theme/ckanext/hdx_theme/version.py\n+++ b/ckanext-hdx_theme/ckanext/hdx_theme/version.py\n@@ -1 +1 @@\n-hdx_version='v0.2.3'\n\\ No newline at end of file\n+hdx_version='v0.2.4'\n\\ No newline at end of file\n", "issue": "About menu:  glitch on home page functionality\nOn **homepage only** and only in Chrome.\nClick on about to open the submenu.\nClick again to close the menu.\nMove the cursor around the `About` text.\nThe menu text 'About' disappears and reappears unreliably as the cursor moves around it.  This is on chrome.  Does not occur in firefox.\n\n", "before_files": [{"content": "hdx_version='v0.2.3'", "path": "ckanext-hdx_theme/ckanext/hdx_theme/version.py"}, {"content": "import sys, re\nimport ckan.lib.base as base\nfrom ckan.lib.base import request\nfrom ckan.lib.base import c,g,h\nfrom ckan.lib.base import model\nfrom ckan.lib.base import render\nfrom ckan.lib.base import _\nimport ckan.logic as logic\nimport ckan.plugins.toolkit as tk\n\nfrom ckan.controllers.group import GroupController as gc\nfrom ckan.controllers.home import HomeController\n\nimport ckanext.hdx_theme.caching as caching\n\nNotAuthorized = logic.NotAuthorized\ncheck_access = logic.check_access\nget_action = logic.get_action\n\n\nclass SplashPageController(HomeController):\n\n\tgroup_type = 'group'\n\n\tdef index(self):\n\t\tgroup_type = None\n\t\tcontext = {'model': model, 'session': model.Session,\n\t\t\t\t   'user': c.user or c.author, 'for_view': True,\n\t\t\t\t   'with_private': False}\n\n\t\tq = c.q = request.params.get('q', '')\n\t\tdata_dict = {'all_fields': True, 'q': q}\n\t\tsort_by = c.sort_by_selected = request.params.get('sort')\n\t\tif sort_by:\n\t\t\tdata_dict['sort'] = sort_by\n\t\ttry:\n\t\t\tself._check_access('site_read', context)\n\t\texcept NotAuthorized:\n\t\t\tabort(401, _('Not authorized to see this page'))\n\t\tif c.userobj:\n\t\t\tcontext['user_id'] = c.userobj.id\n\t\t\tcontext['user_is_admin'] = c.userobj.sysadmin\n\t\t\n\t\t\n\t\t\n\t\tc.group_package_stuff = caching.cached_get_group_package_stuff()\n\n\t\t##Removing groups without geojson for the map\n\t\tc.group_map = []\n\t\tfor gp in c.group_package_stuff:\n\t\t\tfor e in gp['extras']:\n\t\t\t\tif e['key'] == 'geojson' and e['value']:\n\t\t\t\t\tc.group_map.append(gp)\n\n\t\t#print c.group_package_stuff\n\n\t\tif c.userobj is not None:\n\t\t\tmsg = None\n\t\t\turl = h.url_for(controller='user', action='edit')\n\t\t\tis_google_id = \\\n\t\t\t\tc.userobj.name.startswith('https://www.google.com/accounts/o8/id')\n\t\t\tif not c.userobj.email and (is_google_id and not c.userobj.fullname):\n\t\t\t\tmsg = _(u'Please <a href=\"{link}\">update your profile</a>'\n\t\t\t\t\t\tu' and add your email address and your full name. '\n\t\t\t\t\t\tu'{site} uses your email address'\n\t\t\t\t\t\tu' if you need to reset your password.'.format(\n\t\t\t\t\t\t\tlink=url, site=g.site_title))\n\t\t\telif not c.userobj.email:\n\t\t\t\tmsg = _('Please <a href=\"%s\">update your profile</a>'\n\t\t\t\t\t\t' and add your email address. ') % url + \\\n\t\t\t\t\t_('%s uses your email address'\n\t\t\t\t\t\t' if you need to reset your password.') \\\n\t\t\t\t\t% g.site_title\n\t\t\telif is_google_id and not c.userobj.fullname:\n\t\t\t\tmsg = _('Please <a href=\"%s\">update your profile</a>'\n\t\t\t\t\t\t' and add your full name.') % (url)\n\t\t\tif msg:\n\t\t\t\th.flash_notice(msg, allow_html=True)\n\n\t\treturn base.render('home/index.html', cache_force=True)\n\n\tdef _check_access(self, action_name, *args, **kw):\n\t\t''' select the correct group/org check_access '''\n\t\treturn check_access(self._replace_group_org(action_name), *args, **kw)\n\n\tdef _replace_group_org(self, string):\n\t\t''' substitute organization for group if this is an org'''\n\t\tif self.group_type == 'organization':\n\t\t\tstring = re.sub('^group', 'organization', string)\n\t\treturn string\n\n\tdef _action(self, action_name):\n\t\t''' select the correct group/org action '''\n\t\treturn get_action(self._replace_group_org(action_name))\n\t\n", "path": "ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py"}, {"content": "import ckanext.hdx_theme.licenses as hdx_licenses\n\nimport ckan.plugins as plugins\nimport ckan.plugins.toolkit as toolkit\nimport ckan.model.package as package\nimport ckan.model.license as license\nimport version\n\nimport ckanext.hdx_theme.caching as caching\nimport ckanext.hdx_theme.auth as auth\n\n\ndef run_on_startup():\n    _generate_license_list()\n    \n    caching.cached_get_group_package_stuff()\n    \n\ndef _generate_license_list():\n    package.Package._license_register = license.LicenseRegister() \n    package.Package._license_register.licenses = [\n                                                  license.License(hdx_licenses.LicenseCreativeCommonsIntergovernmentalOrgs()),\n                                                  license.License(license.LicenseCreativeCommonsAttribution()),\n                                                  license.License(license.LicenseCreativeCommonsAttributionShareAlike()),\n                                                  license.License(hdx_licenses.LicenseOtherPublicDomainNoRestrictions()),\n                                                  license.License(hdx_licenses.LicenseHdxMultiple()),\n                                                  license.License(hdx_licenses.LicenseHdxOther())\n                                                  ]\n\nclass HDXThemePlugin(plugins.SingletonPlugin):\n    plugins.implements(plugins.IConfigurer)\n    plugins.implements(plugins.IRoutes, inherit=True)\n    plugins.implements(plugins.ITemplateHelpers)\n    plugins.implements(plugins.IActions)\n    plugins.implements(plugins.IAuthFunctions)\n    plugins.implements(plugins.IGroupController, inherit=True)\n    plugins.implements(plugins.IMiddleware, inherit=True)\n    \n    def update_config(self, config):\n        toolkit.add_template_directory(config, 'templates')\n        toolkit.add_public_directory(config, 'public')\n        toolkit.add_resource('fanstatic', 'hdx_theme')\n        \n\n    def before_map(self, map):\n        map.connect('home', '/', controller='ckanext.hdx_theme.splash_page:SplashPageController', action='index')\n        map.connect('/count/dataset', controller='ckanext.hdx_theme.count:CountController', action='dataset')\n        map.connect('/count/country', controller='ckanext.hdx_theme.count:CountController', action='country')\n        map.connect('/count/source', controller='ckanext.hdx_theme.count:CountController', action='source')\n        map.connect('/user/logged_in', controller='ckanext.hdx_theme.login:LoginController', action='logged_in')\n        map.connect('/contribute', controller='ckanext.hdx_theme.login:LoginController', action='contribute')\n        \n        map.connect('/count/test', controller='ckanext.hdx_theme.count:CountController', action='test')\n        \n        map.connect('/organization/{id}/request_membership', controller='ckanext.hdx_theme.org_controller:HDXOrgController', action='request_membership')\n        return map\n    \n    def create(self, entity):\n        caching.invalidate_group_caches()\n\n    def edit(self, entity):\n        caching.invalidate_group_caches()\n\n    def get_helpers(self):\n        from ckanext.hdx_theme import helpers as hdx_helpers\n        return {\n            'is_downloadable': hdx_helpers.is_downloadable,\n            'get_facet_items_dict':hdx_helpers.get_facet_items_dict,\n            'get_last_modifier_user': hdx_helpers.get_last_modifier_user,\n            'get_filtered_params_list':hdx_helpers.get_filtered_params_list,\n            'get_last_revision_package':hdx_helpers.get_last_revision_package,\n            'get_last_modifier_user':hdx_helpers.get_last_modifier_user,\n            'get_last_revision_group':hdx_helpers.get_last_revision_group,\n            'get_group_followers':hdx_helpers.get_group_followers,\n            'get_group_members':hdx_helpers.get_group_members,\n            'markdown_extract_strip':hdx_helpers.markdown_extract_strip,\n            'render_date_from_concat_str':hdx_helpers.render_date_from_concat_str,\n            'hdx_version':hdx_helpers.hdx_version,\n            'hdx_build_nav_icon_with_message':hdx_helpers.hdx_build_nav_icon_with_message,\n            'hdx_num_of_new_related_items':hdx_helpers.hdx_num_of_new_related_items,\n            'hdx_get_extras_element':hdx_helpers.hdx_get_extras_element,\n            'hdx_get_user_info':hdx_helpers.hdx_get_user_info,\n            'hdx_linked_user':hdx_helpers.hdx_linked_user,\n            'hdx_show_singular_plural':hdx_helpers.hdx_show_singular_plural,\n            'hdx_member_roles_list':hdx_helpers.hdx_member_roles_list\n            \n        }\n        \n    def get_actions(self):\n        from ckanext.hdx_theme import actions as hdx_actions\n        return {\n            'organization_list_for_user':hdx_actions.organization_list_for_user, \n            'cached_group_list': hdx_actions.cached_group_list,\n            'hdx_basic_user_info': hdx_actions.hdx_basic_user_info,\n            'member_list': hdx_actions.member_list,\n            'hdx_get_sys_admins': hdx_actions.hdx_get_sys_admins\n            \n        }\n    def get_auth_functions(self):\n        return {\n                'hdx_basic_user_info': auth.hdx_basic_user_info\n                }\n    \n    def make_middleware(self, app, config):\n        run_on_startup()\n        return app\n\n        \n        \n\n", "path": "ckanext-hdx_theme/ckanext/hdx_theme/plugin.py"}], "after_files": [{"content": "hdx_version='v0.2.4'", "path": "ckanext-hdx_theme/ckanext/hdx_theme/version.py"}, {"content": "import sys, re\nimport ckan.lib.base as base\nfrom ckan.lib.base import request\nfrom ckan.lib.base import c,g,h\nfrom ckan.lib.base import model\nfrom ckan.lib.base import render\nfrom ckan.lib.base import _\nimport ckan.logic as logic\nimport ckan.plugins.toolkit as tk\n\nfrom ckan.controllers.group import GroupController as gc\nfrom ckan.controllers.home import HomeController\n\nimport ckanext.hdx_theme.caching as caching\n\nNotAuthorized = logic.NotAuthorized\ncheck_access = logic.check_access\nget_action = logic.get_action\n\n\nclass SplashPageController(HomeController):\n\n\tgroup_type = 'group'\n\n\tdef index(self):\n\t\tgroup_type = None\n\t\tcontext = {'model': model, 'session': model.Session,\n\t\t\t\t   'user': c.user or c.author, 'for_view': True,\n\t\t\t\t   'with_private': False}\n\n\t\tq = c.q = request.params.get('q', '')\n\t\tdata_dict = {'all_fields': True, 'q': q}\n\t\tsort_by = c.sort_by_selected = request.params.get('sort')\n\t\tif sort_by:\n\t\t\tdata_dict['sort'] = sort_by\n\t\ttry:\n\t\t\tself._check_access('site_read', context)\n\t\texcept NotAuthorized:\n\t\t\tabort(401, _('Not authorized to see this page'))\n\t\tif c.userobj:\n\t\t\tcontext['user_id'] = c.userobj.id\n\t\t\tcontext['user_is_admin'] = c.userobj.sysadmin\n\t\t\n\t\t\n\t\t\n\t\tc.group_package_stuff = caching.cached_get_group_package_stuff()\n\n\t\t##Removing groups without geojson for the map\n\t\tc.group_map = []\n\t\tfor gp in c.group_package_stuff:\n\t\t\tfor e in gp['extras']:\n\t\t\t\tif e['key'] == 'geojson' and e['value']:\n\t\t\t\t\tc.group_map.append(gp)\n\n\t\t#print c.group_package_stuff\n\n\t\tif c.userobj is not None:\n\t\t\tmsg = None\n\t\t\turl = h.url_for(controller='user', action='edit')\n\t\t\tis_google_id = \\\n\t\t\t\tc.userobj.name.startswith('https://www.google.com/accounts/o8/id')\n\t\t\tif not c.userobj.email and (is_google_id and not c.userobj.fullname):\n\t\t\t\tmsg = _(u'Please <a href=\"{link}\">update your profile</a>'\n\t\t\t\t\t\tu' and add your email address and your full name. '\n\t\t\t\t\t\tu'{site} uses your email address'\n\t\t\t\t\t\tu' if you need to reset your password.'.format(\n\t\t\t\t\t\t\tlink=url, site=g.site_title))\n\t\t\telif not c.userobj.email:\n\t\t\t\tmsg = _('Please <a href=\"%s\">update your profile</a>'\n\t\t\t\t\t\t' and add your email address. ') % url + \\\n\t\t\t\t\t_('%s uses your email address'\n\t\t\t\t\t\t' if you need to reset your password.') \\\n\t\t\t\t\t% g.site_title\n\t\t\telif is_google_id and not c.userobj.fullname:\n\t\t\t\tmsg = _('Please <a href=\"%s\">update your profile</a>'\n\t\t\t\t\t\t' and add your full name.') % (url)\n\t\t\tif msg:\n\t\t\t\th.flash_notice(msg, allow_html=True)\n\n\t\treturn base.render('home/index.html', cache_force=True)\n\n\tdef _check_access(self, action_name, *args, **kw):\n\t\t''' select the correct group/org check_access '''\n\t\treturn check_access(self._replace_group_org(action_name), *args, **kw)\n\n\tdef _replace_group_org(self, string):\n\t\t''' substitute organization for group if this is an org'''\n\t\tif self.group_type == 'organization':\n\t\t\tstring = re.sub('^group', 'organization', string)\n\t\treturn string\n\n\tdef _action(self, action_name):\n\t\t''' select the correct group/org action '''\n\t\treturn get_action(self._replace_group_org(action_name))\n\n\tdef about(self, page):\n\t\ttitle = {'license': _('Data Licenses'),\n\t\t\t\t 'terms': _('Terms of Service')}\n\t\thtml =  {'license': 'home/snippets/hdx_licenses.html',\n\t\t\t\t 'terms': 'home/snippets/hdx_terms_of_service.html'}\n\n\t\textraVars = {'title': title.get(page), 'html': html.get(page), 'page': page}\n\t\treturn base.render('home/about2.html',  extra_vars = extraVars)\n\n\n", "path": "ckanext-hdx_theme/ckanext/hdx_theme/splash_page.py"}, {"content": "import ckanext.hdx_theme.licenses as hdx_licenses\n\nimport ckan.plugins as plugins\nimport ckan.plugins.toolkit as toolkit\nimport ckan.model.package as package\nimport ckan.model.license as license\nimport version\n\nimport ckanext.hdx_theme.caching as caching\nimport ckanext.hdx_theme.auth as auth\n\n\ndef run_on_startup():\n    _generate_license_list()\n    \n    caching.cached_get_group_package_stuff()\n    \n\ndef _generate_license_list():\n    package.Package._license_register = license.LicenseRegister() \n    package.Package._license_register.licenses = [\n                                                  license.License(hdx_licenses.LicenseCreativeCommonsIntergovernmentalOrgs()),\n                                                  license.License(license.LicenseCreativeCommonsAttribution()),\n                                                  license.License(license.LicenseCreativeCommonsAttributionShareAlike()),\n                                                  license.License(hdx_licenses.LicenseOtherPublicDomainNoRestrictions()),\n                                                  license.License(hdx_licenses.LicenseHdxMultiple()),\n                                                  license.License(hdx_licenses.LicenseHdxOther())\n                                                  ]\n\nclass HDXThemePlugin(plugins.SingletonPlugin):\n    plugins.implements(plugins.IConfigurer)\n    plugins.implements(plugins.IRoutes, inherit=True)\n    plugins.implements(plugins.ITemplateHelpers)\n    plugins.implements(plugins.IActions)\n    plugins.implements(plugins.IAuthFunctions)\n    plugins.implements(plugins.IGroupController, inherit=True)\n    plugins.implements(plugins.IMiddleware, inherit=True)\n    \n    def update_config(self, config):\n        toolkit.add_template_directory(config, 'templates')\n        toolkit.add_public_directory(config, 'public')\n        toolkit.add_resource('fanstatic', 'hdx_theme')\n        \n\n    def before_map(self, map):\n        map.connect('home', '/', controller='ckanext.hdx_theme.splash_page:SplashPageController', action='index')\n        map.connect('/count/dataset', controller='ckanext.hdx_theme.count:CountController', action='dataset')\n        map.connect('/count/country', controller='ckanext.hdx_theme.count:CountController', action='country')\n        map.connect('/count/source', controller='ckanext.hdx_theme.count:CountController', action='source')\n        map.connect('/user/logged_in', controller='ckanext.hdx_theme.login:LoginController', action='logged_in')\n        map.connect('/contribute', controller='ckanext.hdx_theme.login:LoginController', action='contribute')\n        \n        map.connect('/count/test', controller='ckanext.hdx_theme.count:CountController', action='test')\n        \n        map.connect('/organization/{id}/request_membership', controller='ckanext.hdx_theme.org_controller:HDXOrgController', action='request_membership')\n\n        map.connect('/about/{page}', controller='ckanext.hdx_theme.splash_page:SplashPageController', action='about')\n        return map\n    \n    def create(self, entity):\n        caching.invalidate_group_caches()\n\n    def edit(self, entity):\n        caching.invalidate_group_caches()\n\n    def get_helpers(self):\n        from ckanext.hdx_theme import helpers as hdx_helpers\n        return {\n            'is_downloadable': hdx_helpers.is_downloadable,\n            'get_facet_items_dict':hdx_helpers.get_facet_items_dict,\n            'get_last_modifier_user': hdx_helpers.get_last_modifier_user,\n            'get_filtered_params_list':hdx_helpers.get_filtered_params_list,\n            'get_last_revision_package':hdx_helpers.get_last_revision_package,\n            'get_last_modifier_user':hdx_helpers.get_last_modifier_user,\n            'get_last_revision_group':hdx_helpers.get_last_revision_group,\n            'get_group_followers':hdx_helpers.get_group_followers,\n            'get_group_members':hdx_helpers.get_group_members,\n            'markdown_extract_strip':hdx_helpers.markdown_extract_strip,\n            'render_date_from_concat_str':hdx_helpers.render_date_from_concat_str,\n            'hdx_version':hdx_helpers.hdx_version,\n            'hdx_build_nav_icon_with_message':hdx_helpers.hdx_build_nav_icon_with_message,\n            'hdx_num_of_new_related_items':hdx_helpers.hdx_num_of_new_related_items,\n            'hdx_get_extras_element':hdx_helpers.hdx_get_extras_element,\n            'hdx_get_user_info':hdx_helpers.hdx_get_user_info,\n            'hdx_linked_user':hdx_helpers.hdx_linked_user,\n            'hdx_show_singular_plural':hdx_helpers.hdx_show_singular_plural,\n            'hdx_member_roles_list':hdx_helpers.hdx_member_roles_list\n            \n        }\n        \n    def get_actions(self):\n        from ckanext.hdx_theme import actions as hdx_actions\n        return {\n            'organization_list_for_user':hdx_actions.organization_list_for_user, \n            'cached_group_list': hdx_actions.cached_group_list,\n            'hdx_basic_user_info': hdx_actions.hdx_basic_user_info,\n            'member_list': hdx_actions.member_list,\n            'hdx_get_sys_admins': hdx_actions.hdx_get_sys_admins\n            \n        }\n    def get_auth_functions(self):\n        return {\n                'hdx_basic_user_info': auth.hdx_basic_user_info\n                }\n    \n    def make_middleware(self, app, config):\n        run_on_startup()\n        return app\n\n        \n        \n\n", "path": "ckanext-hdx_theme/ckanext/hdx_theme/plugin.py"}]}