mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-24 18:24:31 +01:00
implementing custom js
This commit is contained in:
parent
f61c7908cb
commit
61df2094c4
@ -244,6 +244,19 @@ class LdapCherry(object):
|
|||||||
self._handle_exception(e)
|
self._handle_exception(e)
|
||||||
raise BackendModuleInitFail(module)
|
raise BackendModuleInitFail(module)
|
||||||
|
|
||||||
|
def _init_custom_js(self, config):
|
||||||
|
self.custom_js = []
|
||||||
|
if '/custom' not in config:
|
||||||
|
return
|
||||||
|
directory = self._get_param(
|
||||||
|
'/custom',
|
||||||
|
'tools.staticdir.dir',
|
||||||
|
config,
|
||||||
|
)
|
||||||
|
for file in os.listdir(directory):
|
||||||
|
if file.endswith(".js"):
|
||||||
|
self.custom_js.append(file)
|
||||||
|
|
||||||
def _init_ppolicy(self, config):
|
def _init_ppolicy(self, config):
|
||||||
module = self._get_param(
|
module = self._get_param(
|
||||||
'ppolicy',
|
'ppolicy',
|
||||||
@ -515,6 +528,9 @@ class LdapCherry(object):
|
|||||||
# loading the ppolicy
|
# loading the ppolicy
|
||||||
self._init_ppolicy(config)
|
self._init_ppolicy(config)
|
||||||
|
|
||||||
|
# loading custom javascript
|
||||||
|
self._init_custom_js(config)
|
||||||
|
|
||||||
cherrypy.log.error(
|
cherrypy.log.error(
|
||||||
msg="application started",
|
msg="application started",
|
||||||
severity=logging.INFO
|
severity=logging.INFO
|
||||||
@ -970,7 +986,8 @@ class LdapCherry(object):
|
|||||||
return self.temp_searchuser.render(
|
return self.temp_searchuser.render(
|
||||||
searchresult=res,
|
searchresult=res,
|
||||||
attrs_list=attrs_list,
|
attrs_list=attrs_list,
|
||||||
is_admin=is_admin
|
is_admin=is_admin,
|
||||||
|
custom_js=self.custom_js,
|
||||||
)
|
)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@ -1005,7 +1022,8 @@ class LdapCherry(object):
|
|||||||
return self.temp_searchadmin.render(
|
return self.temp_searchadmin.render(
|
||||||
searchresult=res,
|
searchresult=res,
|
||||||
attrs_list=attrs_list,
|
attrs_list=attrs_list,
|
||||||
is_admin=is_admin
|
is_admin=is_admin,
|
||||||
|
custom_js=self.custom_js,
|
||||||
)
|
)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@ -1051,7 +1069,8 @@ class LdapCherry(object):
|
|||||||
form=form,
|
form=form,
|
||||||
roles=roles,
|
roles=roles,
|
||||||
is_admin=is_admin,
|
is_admin=is_admin,
|
||||||
notification=notification
|
notification=notification,
|
||||||
|
custom_js=self.custom_js,
|
||||||
)
|
)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
@ -1131,6 +1150,7 @@ class LdapCherry(object):
|
|||||||
notification=notification,
|
notification=notification,
|
||||||
standalone_groups=user_lonely_groups,
|
standalone_groups=user_lonely_groups,
|
||||||
backends_display_names=self.backends_display_names,
|
backends_display_names=self.backends_display_names,
|
||||||
|
custom_js=self.custom_js,
|
||||||
)
|
)
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
|
@ -42,6 +42,11 @@
|
|||||||
<script type="text/javascript" src="/static/js/removediacritic.js"></script>
|
<script type="text/javascript" src="/static/js/removediacritic.js"></script>
|
||||||
<script type="text/javascript" src="/static/js/lc-filler.js"></script>
|
<script type="text/javascript" src="/static/js/lc-filler.js"></script>
|
||||||
<script type="text/javascript" src="/static/js/sha1.js"></script>
|
<script type="text/javascript" src="/static/js/sha1.js"></script>
|
||||||
|
% if custom_js:
|
||||||
|
% for js in custom_js:
|
||||||
|
<script type="text/javascript" src="/custom/${js}"></script>
|
||||||
|
% endfor
|
||||||
|
%endif
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function(){
|
$(function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user