Commit 1b04d79f authored by Romain Loth's avatar Romain Loth

tidy up and add loose branches

parent b8ff0a08
...@@ -82,36 +82,36 @@ login_manager.init_app(app) ...@@ -82,36 +82,36 @@ login_manager.init_app(app)
# all inputs as they are declared in form, as a couple # all inputs as they are declared in form, as a couple
SOURCE_FIELDS = [ SOURCE_FIELDS = [
# NAME, SANITIZE? # NAME, SANITIZE? Specificity
("luid", False ), ("luid", False, None),
("doors_uid", False ), ("doors_uid", False, None),
("last_modified_date", False ), # ex 2016-11-16T17:47:07.308Z ("last_modified_date", False, None), # TODO use stamp
("email", True ), ("email", True, None),
("country", True ), ("country", True, None),
("first_name", True ), ("first_name", True, None),
("middle_name", True ), ("middle_name", True, None),
("last_name", True ), ("last_name", True, None),
("initials", True ), ("initials", True, None),
# => for *scholars* table # => for *scholars* table
("position", True ), ("position", True, None),
("hon_title", True ), ("hon_title", True, None),
("interests_text", True ), ("interests_text", True, None),
("gender", False ), # M|F ("gender", False, None), # M|F
("job_looking_date", True ), # def null: not looking for a job ("job_looking_date", True, None), # def null: not looking for a job
("home_url", True ), # scholar's homepage ("home_url", True, "url"), # scholar's homepage
("pic_url", True ), ("pic_url", True, "url"),
("pic_file", False ), # will be saved separately ("pic_file", False, None), # saved separately
# => for *scholars* table (optional) # => for *scholars* table (optional)
("org", True ), ("org", True, None),
("org_type", False ), # values are predefined for this ("org_type", False, None), # predefined values
( "other_org_type", True ), # +=> org_type in read_record() ( "other_org_type", True, None), # +=> org_type
("team_lab", True ), ("team_lab", True, None),
("org_city", True ), ("org_city", True, None),
# => for *affiliations* table # => for *affiliations* table
("keywords", True ), ("keywords", True, None),
# => for *keywords* table (after split str) # => for *keywords* table (after split str)
("hashtags", True ) ("hashtags", True )
...@@ -730,9 +730,13 @@ def read_record_from_request(request): ...@@ -730,9 +730,13 @@ def read_record_from_request(request):
for field_info in SOURCE_FIELDS: for field_info in SOURCE_FIELDS:
field = field_info[0] field = field_info[0]
do_sanitize = field_info[1] do_sanitize = field_info[1]
spec_type = field_info[2]
if field in request.form: if field in request.form:
if do_sanitize: if do_sanitize:
val = sanitize(request.form[field]) val = sanitize(
request.form[field],
is_url = (spec_type == "url")
)
if val != '': if val != '':
clean_records[field] = val clean_records[field] = val
else: else:
...@@ -773,7 +777,7 @@ def read_record_from_request(request): ...@@ -773,7 +777,7 @@ def read_record_from_request(request):
# TODO move to text submodules # TODO move to text submodules
def sanitize(value): def sanitize(value, is_url=False):
""" """
simple and radical: leaves only alphanum and '@' '.' '-' ':' ',' '(', ')', '#', ' ' simple and radical: leaves only alphanum and '@' '.' '-' ':' ',' '(', ')', '#', ' '
...@@ -784,7 +788,11 @@ def sanitize(value): ...@@ -784,7 +788,11 @@ def sanitize(value):
str_val = str(value) str_val = str(value)
clean_val = sub(r'^\s+', '', str_val) clean_val = sub(r'^\s+', '', str_val)
clean_val = sub(r'\s+$', '', clean_val) clean_val = sub(r'\s+$', '', clean_val)
san_val = sub(r'[^\w@\.:,()# -]', '_', clean_val)
if is_url:
san_val = sub(r'[^\w@\.: -/]', '_', clean_val)
else:
san_val = sub(r'[^\w@\.:,()# -]', '_', clean_val)
if vtype not in [int, str]: if vtype not in [int, str]:
raise ValueError("Value has an incorrect type %s" % str(vtype)) raise ValueError("Value has an incorrect type %s" % str(vtype))
......
...@@ -12,4 +12,10 @@ ADD init_comex_shared.sql /docker-entrypoint-initdb.d/ ...@@ -12,4 +12,10 @@ ADD init_comex_shared.sql /docker-entrypoint-initdb.d/
# if Adding data # if Adding data
# 1) a pre-existing database can be added via the volume in /data/shared_mysql_data # 1) a pre-existing database can be added via the volume in /data/shared_mysql_data
# 2) any pre-existing table-formed data can be imported if added inside into /var/lib/mysql-files
# 2) any pre-existing well-formed data can be imported if added inside into /var/lib/mysql-files
# exemple:
# ADD new_scholars_htids_mapping.tsv /var/lib/mysql-files/
# then in SQL something like:
# LOAD DATA INFILE '/var/lib/mysql-files/new_scholars_htids_mapping.tsv'
# INTO TABLE sch_ht IGNORE 1 LINES (uid,htid)
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
body { body {
margin: 0; margin: 0;
font-family: "Droid Sans", Calibri, "Helvetica Neue", Helvetica, sans-serif; font-family: "Droid Sans", Calibri, "Helvetica Neue", Helvetica, sans-serif;
letter-spacing: -0.04em; /*letter-spacing: -0.04em;*/
color: #333; color: #333;
background-color: #fff; background-color: #fff;
line-height: .9em; line-height: .9em;
......
...@@ -61,3 +61,7 @@ iframe.wwwthumbsmall { ...@@ -61,3 +61,7 @@ iframe.wwwthumbsmall {
border-radius: 1em; border-radius: 1em;
padding: .8em; padding: .8em;
} }
#news-container {
min-height: 50px !important;
}
...@@ -335,44 +335,16 @@ input.is-realperson { ...@@ -335,44 +335,16 @@ input.is-realperson {
} }
/* Autocomplete items */
.ui-menu-item { .ui-menu-item {
color: #337AB7 !important; color: #337AB7 !important;
font-family: "Droid Sans", Calibri, "Helvetica Neue", Helvetica, sans-serif; font-family: "Droid Sans", Calibri, "Helvetica Neue", Helvetica, sans-serif;
letter-spacing:normal; font-weight: bold;
} }
.ui-menu-item:hover { .ui-state-focus, .ui-state-hover, .ui-state-active {
color: #fff !important; text-shadow: none !important ; /* <=== !!! */
font-weight: bold !important; font-weight: bold !important;
background-color: #5278B3 !important;
border: .5px solid #6BB0E3 !important;
} }
/*.ui-autocomplete {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
float: left;
display: none;
min-width: 160px;
_width: 160px;
padding: 4px 0;
margin: 2px 0 0 0;
list-style: none;
background-color: #ffffff;
border-color: #ccc;
border-color: rgba(0, 0, 0, 0.2);
border-style: solid;
border-width: 1px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
*border-right-width: 2px;
*border-bottom-width: 2px;
}*/
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
// so we put an absolute path and change the domain name at rendering. // so we put an absolute path and change the domain name at rendering.
var relsrc = document.getElementById('inlink').src var relsrc = document.getElementById('inlink').src
document.getElementById('inlink').src = 'https://'+location.host+'/'+relsrc
if (! /^https/.test(relsrc)) {
relsrc = 'https://'+location.host+'/'+relsrc
}
document.getElementById('inlink').src = relsrc
console.log("rootindex controllers load OK") console.log("rootindex controllers load OK")
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<meta name="description" content="Community Explorer Wall"> <meta name="description" content="Community Explorer Wall">
<meta name="keywords" content="community, user profiles, data exploration"> <meta name="keywords" content="community, user profiles, data exploration">
<link type=text/css rel=stylesheet href="{{ url_for('static', filename='css/comex_alt.css') }}"> <link type=text/css rel=stylesheet href="{{ url_for('static', filename='css/comex_index.css') }}">
<!-- for news vertical marquee --> <!-- for news vertical marquee -->
<script type="text/javascript" src="{{ url_for('static', filename='js/jquery.vticker-min.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/jquery.vticker-min.js') }}"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment