server1118
This commit is contained in:
parent
27e4219cf9
commit
9ae0918a59
|
@ -8,7 +8,8 @@ safesite/datashow/__pycache__/
|
||||||
duibiao/__pycache__/
|
duibiao/__pycache__/
|
||||||
mysite/__pycache__/
|
mysite/__pycache__/
|
||||||
media/
|
media/
|
||||||
|
aspnet_client/
|
||||||
|
static/
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
'utc_enabled', (1024, 4)
|
'utc_enabled', (1024, 4)
|
||||||
'tz', (1536, 23)
|
'tz', (1536, 23)
|
||||||
'entries', (2048, 556)
|
'entries', (2048, 587)
|
||||||
'__version__', (512, 15)
|
'__version__', (512, 15)
|
||||||
|
|
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
'utc_enabled', (1024, 4)
|
'utc_enabled', (1024, 4)
|
||||||
'tz', (1536, 23)
|
'tz', (1536, 23)
|
||||||
'entries', (2048, 556)
|
'entries', (2048, 587)
|
||||||
'__version__', (512, 15)
|
'__version__', (512, 15)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
8252
|
1640
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -26,7 +26,7 @@ SECRET_KEY = '^2_d@h7#j5zx4=g+!=r&tdmm&)akpd_hf!7@-85#qs(+*(#o!i'
|
||||||
# SECURITY WARNING: don't run with debug turned on in production!
|
# SECURITY WARNING: don't run with debug turned on in production!
|
||||||
DEBUG = True
|
DEBUG = True
|
||||||
|
|
||||||
ALLOWED_HOSTS = ['10.7.100.160','10.7.100.250','192.168.0.100','127.0.0.1','114.115.210.98','safeyun.ctcshe.com','ctcshe.com','localhost','192.168.0.102','10.7.100.209']
|
ALLOWED_HOSTS = ['*']
|
||||||
|
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ DATABASES = {
|
||||||
'NAME': 'safedb',
|
'NAME': 'safedb',
|
||||||
'USER':'postgres',
|
'USER':'postgres',
|
||||||
'PASSWORD':'cTc1111Qa',
|
'PASSWORD':'cTc1111Qa',
|
||||||
'HOST':'114.115.210.98',
|
'HOST':'localhost',
|
||||||
'PORT':'5432',
|
'PORT':'5432',
|
||||||
'CONN_MAX_AGE': 600,
|
'CONN_MAX_AGE': 600,
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,10 +10,13 @@ colorama==0.4.1
|
||||||
Django==2.2.7
|
Django==2.2.7
|
||||||
django-ranged-response==0.2.0
|
django-ranged-response==0.2.0
|
||||||
django-simple-captcha==0.5.12
|
django-simple-captcha==0.5.12
|
||||||
|
dnspython==1.16.0
|
||||||
docutils==0.15.2
|
docutils==0.15.2
|
||||||
docxtpl==0.6.3
|
docxtpl==0.6.3
|
||||||
et-xmlfile==1.0.1
|
et-xmlfile==1.0.1
|
||||||
gensim==3.8.1
|
eventlet==0.25.1
|
||||||
|
gensim==3.4.0
|
||||||
|
greenlet==0.4.15
|
||||||
idna==2.8
|
idna==2.8
|
||||||
importlib-metadata==0.23
|
importlib-metadata==0.23
|
||||||
jdcal==1.4.1
|
jdcal==1.4.1
|
||||||
|
@ -24,6 +27,7 @@ joblib==0.14.0
|
||||||
kombu==4.6.6
|
kombu==4.6.6
|
||||||
lxml==4.4.1
|
lxml==4.4.1
|
||||||
MarkupSafe==1.1.1
|
MarkupSafe==1.1.1
|
||||||
|
monotonic==1.5
|
||||||
more-itertools==7.2.0
|
more-itertools==7.2.0
|
||||||
numpy==1.17.4
|
numpy==1.17.4
|
||||||
openpyxl==3.0.0
|
openpyxl==3.0.0
|
||||||
|
@ -35,6 +39,7 @@ python-dateutil==2.8.0
|
||||||
python-docx==0.8.7
|
python-docx==0.8.7
|
||||||
pytz==2019.3
|
pytz==2019.3
|
||||||
qrcode==6.1
|
qrcode==6.1
|
||||||
|
redis==3.3.11
|
||||||
requests==2.22.0
|
requests==2.22.0
|
||||||
s3transfer==0.2.1
|
s3transfer==0.2.1
|
||||||
scikit-learn==0.21.3
|
scikit-learn==0.21.3
|
||||||
|
@ -45,5 +50,6 @@ smart-open==1.9.0
|
||||||
sqlparse==0.3.0
|
sqlparse==0.3.0
|
||||||
urllib3==1.25.7
|
urllib3==1.25.7
|
||||||
vine==1.3.0
|
vine==1.3.0
|
||||||
|
wfastcgi==3.0.0
|
||||||
XlsxWriter==1.2.5
|
XlsxWriter==1.2.5
|
||||||
zipp==0.6.0
|
zipp==0.6.0
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
15_eb5vtB3K7Og4Bc66-8_IKKkVMBCKOiYk4LUkArIek_GirrbQk2BEg2We0WfojPyTLjP14GH4-hzwhEF2i5Mx7G8NGqbeSGWZHI3NiamHgza5JlHs9B4l32EmC6sVPZgAJABVF
|
27_Nrr7EPn934_zjHeLG6DRBRwEXlDbM5bzcILgg4urLbZmI-8pK5wAp9RM_LoeQEhD5TfjTYeqDNuLnclzD32EnEnYaY9kdD2B8F6fnrmt2LTKQ2L6fJwsAen43eF72Q0PsgWWIt_KPtTqrjMrUKAaAGAGWM
|
|
@ -423,7 +423,7 @@ textarea {
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text], input[type=password], input[type=email], input[type=url],
|
input[type=text], input[type=password], input[type=email], input[type=url],
|
||||||
input[type=number], textarea, select, .vTextField {
|
input[type=number], input[type=tel], textarea, select, .vTextField {
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 5px 6px;
|
padding: 5px 6px;
|
||||||
|
@ -431,8 +431,8 @@ input[type=number], textarea, select, .vTextField {
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus,
|
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus,
|
||||||
input[type=url]:focus, input[type=number]:focus, textarea:focus, select:focus,
|
input[type=url]:focus, input[type=number]:focus, input[type=tel]:focus,
|
||||||
.vTextField:focus {
|
textarea:focus, select:focus, .vTextField:focus {
|
||||||
border-color: #999;
|
border-color: #999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -441,6 +441,8 @@ select {
|
||||||
}
|
}
|
||||||
|
|
||||||
select[multiple] {
|
select[multiple] {
|
||||||
|
/* Allow HTML size attribute to override the height in the rule above. */
|
||||||
|
height: auto;
|
||||||
min-height: 150px;
|
min-height: 150px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -662,6 +664,11 @@ div.breadcrumbs a:focus, div.breadcrumbs a:hover {
|
||||||
|
|
||||||
/* ACTION ICONS */
|
/* ACTION ICONS */
|
||||||
|
|
||||||
|
.viewlink, .inlineviewlink {
|
||||||
|
padding-left: 16px;
|
||||||
|
background: url(../img/icon-viewlink.svg) 0 1px no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
.addlink {
|
.addlink {
|
||||||
padding-left: 16px;
|
padding-left: 16px;
|
||||||
background: url(../img/icon-addlink.svg) 0 1px no-repeat;
|
background: url(../img/icon-addlink.svg) 0 1px no-repeat;
|
||||||
|
@ -822,10 +829,12 @@ table#change-history tbody th {
|
||||||
|
|
||||||
#header {
|
#header {
|
||||||
width: auto;
|
width: auto;
|
||||||
height: 40px;
|
height: auto;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
padding: 10px 40px;
|
padding: 10px 40px;
|
||||||
background: #417690;
|
background: #417690;
|
||||||
line-height: 40px;
|
|
||||||
color: #ffc;
|
color: #ffc;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,7 +177,7 @@ form .aligned table p {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldset .field-box {
|
fieldset .fieldBox {
|
||||||
float: left;
|
float: left;
|
||||||
margin-right: 20px;
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
@ -291,12 +291,29 @@ body.popup .submit-row {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.submit-row a.closelink {
|
||||||
|
display: inline-block;
|
||||||
|
background: #bbbbbb;
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 10px 15px;
|
||||||
|
height: 15px;
|
||||||
|
line-height: 15px;
|
||||||
|
margin: 0 0 0 5px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
.submit-row a.deletelink:focus,
|
.submit-row a.deletelink:focus,
|
||||||
.submit-row a.deletelink:hover,
|
.submit-row a.deletelink:hover,
|
||||||
.submit-row a.deletelink:active {
|
.submit-row a.deletelink:active {
|
||||||
background: #a41515;
|
background: #a41515;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.submit-row a.closelink:focus,
|
||||||
|
.submit-row a.closelink:hover,
|
||||||
|
.submit-row a.closelink:active {
|
||||||
|
background: #aaaaaa;
|
||||||
|
}
|
||||||
|
|
||||||
/* CUSTOM FORM FIELDS */
|
/* CUSTOM FORM FIELDS */
|
||||||
|
|
||||||
.vSelectMultipleField {
|
.vSelectMultipleField {
|
||||||
|
@ -336,7 +353,7 @@ body.popup .submit-row {
|
||||||
width: 2.2em;
|
width: 2.2em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vTextField {
|
.vTextField, .vUUIDField {
|
||||||
width: 20em;
|
width: 20em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ body.login {
|
||||||
|
|
||||||
.login #header {
|
.login #header {
|
||||||
height: auto;
|
height: auto;
|
||||||
padding: 5px 16px;
|
padding: 15px 16px;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login #header h1 {
|
.login #header h1 {
|
||||||
|
|
|
@ -38,11 +38,9 @@ input[type="submit"], button {
|
||||||
/* Header */
|
/* Header */
|
||||||
|
|
||||||
#header {
|
#header {
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
padding: 15px 30px;
|
padding: 15px 30px;
|
||||||
height: auto;
|
justify-content: flex-start;
|
||||||
line-height: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#branding h1 {
|
#branding h1 {
|
||||||
|
|
|
@ -77,4 +77,8 @@
|
||||||
margin-left: 0;
|
margin-left: 0;
|
||||||
margin-right: 15px;
|
margin-right: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[dir="rtl"] .aligned ul {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ th {
|
||||||
margin-right: 1.5em;
|
margin-right: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.addlink, .changelink {
|
.viewlink, .addlink, .changelink {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
padding-right: 16px;
|
padding-right: 16px;
|
||||||
background-position: 100% 1px;
|
background-position: 100% 1px;
|
||||||
|
@ -170,6 +170,11 @@ form .aligned p.help, form .aligned div.help {
|
||||||
clear: right;
|
clear: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form .aligned ul {
|
||||||
|
margin-right: 163px;
|
||||||
|
margin-left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
form ul.inline li {
|
form ul.inline li {
|
||||||
float: right;
|
float: right;
|
||||||
padding-right: 0;
|
padding-right: 0;
|
||||||
|
@ -180,7 +185,7 @@ input[type=submit].default, .submit-row input.default {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldset .field-box {
|
fieldset .fieldBox {
|
||||||
float: right;
|
float: right;
|
||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
Roboto webfont source: https://www.google.com/fonts/specimen/Roboto
|
Roboto webfont source: https://www.google.com/fonts/specimen/Roboto
|
||||||
|
WOFF files extracted using https://github.com/majodev/google-webfonts-helper
|
||||||
Weights used in this project: Light (300), Regular (400), Bold (700)
|
Weights used in this project: Light (300), Regular (400), Bold (700)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,6 +1,6 @@
|
||||||
All icons are taken from Font Awesome (http://fontawesome.io/) project.
|
All icons are taken from Font Awesome (http://fontawesome.io/) project.
|
||||||
The Font Awesome font is licensed under the SIL OFL 1.1:
|
The Font Awesome font is licensed under the SIL OFL 1.1:
|
||||||
- http://scripts.sil.org/OFL
|
- https://scripts.sil.org/OFL
|
||||||
|
|
||||||
SVG icons source: https://github.com/encharm/Font-Awesome-SVG-PNG
|
SVG icons source: https://github.com/encharm/Font-Awesome-SVG-PNG
|
||||||
Font-Awesome-SVG-PNG is licensed under the MIT license (see file license
|
Font-Awesome-SVG-PNG is licensed under the MIT license (see file license
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
var box = document.getElementById(id);
|
var box = document.getElementById(id);
|
||||||
var node;
|
var node;
|
||||||
$(box).empty(); // clear all options
|
$(box).empty(); // clear all options
|
||||||
var new_options = box.outerHTML.slice(0, -9); // grab just the opening tag
|
var new_options = box.outerHTML.slice(0, -9); // grab just the opening tag
|
||||||
var cache = SelectBox.cache[id];
|
var cache = SelectBox.cache[id];
|
||||||
for (var i = 0, j = cache.length; i < j; i++) {
|
for (var i = 0, j = cache.length; i < j; i++) {
|
||||||
node = cache[i];
|
node = cache[i];
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
token = tokens[k];
|
token = tokens[k];
|
||||||
if (node_text.indexOf(token) === -1) {
|
if (node_text.indexOf(token) === -1) {
|
||||||
node.displayed = 0;
|
node.displayed = 0;
|
||||||
break; // Once the first token isn't found we're done
|
break; // Once the first token isn't found we're done
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*global SelectBox, addEvent, gettext, interpolate, quickElement, SelectFilter*/
|
/*global SelectBox, gettext, interpolate, quickElement, SelectFilter*/
|
||||||
/*
|
/*
|
||||||
SelectFilter2 - Turns a multiple-select box into a filter interface.
|
SelectFilter2 - Turns a multiple-select box into a filter interface.
|
||||||
|
|
||||||
|
@ -118,19 +118,33 @@ Requires jQuery, core.js, and SelectBox.js.
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
};
|
};
|
||||||
addEvent(choose_all, 'click', function(e) { move_selection(e, this, SelectBox.move_all, field_id + '_from', field_id + '_to'); });
|
choose_all.addEventListener('click', function(e) {
|
||||||
addEvent(add_link, 'click', function(e) { move_selection(e, this, SelectBox.move, field_id + '_from', field_id + '_to'); });
|
move_selection(e, this, SelectBox.move_all, field_id + '_from', field_id + '_to');
|
||||||
addEvent(remove_link, 'click', function(e) { move_selection(e, this, SelectBox.move, field_id + '_to', field_id + '_from'); });
|
});
|
||||||
addEvent(clear_all, 'click', function(e) { move_selection(e, this, SelectBox.move_all, field_id + '_to', field_id + '_from'); });
|
add_link.addEventListener('click', function(e) {
|
||||||
addEvent(filter_input, 'keypress', function(e) { SelectFilter.filter_key_press(e, field_id); });
|
move_selection(e, this, SelectBox.move, field_id + '_from', field_id + '_to');
|
||||||
addEvent(filter_input, 'keyup', function(e) { SelectFilter.filter_key_up(e, field_id); });
|
});
|
||||||
addEvent(filter_input, 'keydown', function(e) { SelectFilter.filter_key_down(e, field_id); });
|
remove_link.addEventListener('click', function(e) {
|
||||||
addEvent(selector_div, 'change', function(e) {
|
move_selection(e, this, SelectBox.move, field_id + '_to', field_id + '_from');
|
||||||
|
});
|
||||||
|
clear_all.addEventListener('click', function(e) {
|
||||||
|
move_selection(e, this, SelectBox.move_all, field_id + '_to', field_id + '_from');
|
||||||
|
});
|
||||||
|
filter_input.addEventListener('keypress', function(e) {
|
||||||
|
SelectFilter.filter_key_press(e, field_id);
|
||||||
|
});
|
||||||
|
filter_input.addEventListener('keyup', function(e) {
|
||||||
|
SelectFilter.filter_key_up(e, field_id);
|
||||||
|
});
|
||||||
|
filter_input.addEventListener('keydown', function(e) {
|
||||||
|
SelectFilter.filter_key_down(e, field_id);
|
||||||
|
});
|
||||||
|
selector_div.addEventListener('change', function(e) {
|
||||||
if (e.target.tagName === 'SELECT') {
|
if (e.target.tagName === 'SELECT') {
|
||||||
SelectFilter.refresh_icons(field_id);
|
SelectFilter.refresh_icons(field_id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addEvent(selector_div, 'dblclick', function(e) {
|
selector_div.addEventListener('dblclick', function(e) {
|
||||||
if (e.target.tagName === 'OPTION') {
|
if (e.target.tagName === 'OPTION') {
|
||||||
if (e.target.closest('select').id === field_id + '_to') {
|
if (e.target.closest('select').id === field_id + '_to') {
|
||||||
SelectBox.move(field_id + '_to', field_id + '_from');
|
SelectBox.move(field_id + '_to', field_id + '_from');
|
||||||
|
@ -140,7 +154,9 @@ Requires jQuery, core.js, and SelectBox.js.
|
||||||
SelectFilter.refresh_icons(field_id);
|
SelectFilter.refresh_icons(field_id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
addEvent(findForm(from_box), 'submit', function() { SelectBox.select_all(field_id + '_to'); });
|
findForm(from_box).addEventListener('submit', function() {
|
||||||
|
SelectBox.select_all(field_id + '_to');
|
||||||
|
});
|
||||||
SelectBox.init(field_id + '_from');
|
SelectBox.init(field_id + '_from');
|
||||||
SelectBox.init(field_id + '_to');
|
SelectBox.init(field_id + '_to');
|
||||||
// Move selected from_box options to to_box
|
// Move selected from_box options to to_box
|
||||||
|
@ -148,15 +164,9 @@ Requires jQuery, core.js, and SelectBox.js.
|
||||||
|
|
||||||
if (!is_stacked) {
|
if (!is_stacked) {
|
||||||
// In horizontal mode, give the same height to the two boxes.
|
// In horizontal mode, give the same height to the two boxes.
|
||||||
var j_from_box = $(from_box);
|
var j_from_box = $('#' + field_id + '_from');
|
||||||
var j_to_box = $(to_box);
|
var j_to_box = $('#' + field_id + '_to');
|
||||||
var resize_filters = function() { j_to_box.height($(filter_p).outerHeight() + j_from_box.outerHeight()); };
|
j_to_box.height($(filter_p).outerHeight() + j_from_box.outerHeight());
|
||||||
if (j_from_box.outerHeight() > 0) {
|
|
||||||
resize_filters(); // This fieldset is already open. Resize now.
|
|
||||||
} else {
|
|
||||||
// This fieldset is probably collapsed. Wait for its 'show' event.
|
|
||||||
j_to_box.closest('fieldset').one('show.fieldset', resize_filters);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initial icon refresh
|
// Initial icon refresh
|
||||||
|
@ -225,7 +235,7 @@ Requires jQuery, core.js, and SelectBox.js.
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
addEvent(window, 'load', function(e) {
|
window.addEventListener('load', function(e) {
|
||||||
$('select.selectfilter, select.selectfilterstacked').each(function() {
|
$('select.selectfilter, select.selectfilterstacked').each(function() {
|
||||||
var $el = $(this),
|
var $el = $(this),
|
||||||
data = $el.data();
|
data = $el.data();
|
||||||
|
|
|
@ -8,59 +8,59 @@
|
||||||
var actionCheckboxes = $(this);
|
var actionCheckboxes = $(this);
|
||||||
var list_editable_changed = false;
|
var list_editable_changed = false;
|
||||||
var showQuestion = function() {
|
var showQuestion = function() {
|
||||||
$(options.acrossClears).hide();
|
$(options.acrossClears).hide();
|
||||||
$(options.acrossQuestions).show();
|
$(options.acrossQuestions).show();
|
||||||
$(options.allContainer).hide();
|
$(options.allContainer).hide();
|
||||||
},
|
},
|
||||||
showClear = function() {
|
showClear = function() {
|
||||||
$(options.acrossClears).show();
|
$(options.acrossClears).show();
|
||||||
$(options.acrossQuestions).hide();
|
$(options.acrossQuestions).hide();
|
||||||
$(options.actionContainer).toggleClass(options.selectedClass);
|
$(options.actionContainer).toggleClass(options.selectedClass);
|
||||||
$(options.allContainer).show();
|
$(options.allContainer).show();
|
||||||
$(options.counterContainer).hide();
|
$(options.counterContainer).hide();
|
||||||
},
|
},
|
||||||
reset = function() {
|
reset = function() {
|
||||||
$(options.acrossClears).hide();
|
$(options.acrossClears).hide();
|
||||||
$(options.acrossQuestions).hide();
|
$(options.acrossQuestions).hide();
|
||||||
$(options.allContainer).hide();
|
$(options.allContainer).hide();
|
||||||
$(options.counterContainer).show();
|
$(options.counterContainer).show();
|
||||||
},
|
},
|
||||||
clearAcross = function() {
|
clearAcross = function() {
|
||||||
reset();
|
|
||||||
$(options.acrossInput).val(0);
|
|
||||||
$(options.actionContainer).removeClass(options.selectedClass);
|
|
||||||
},
|
|
||||||
checker = function(checked) {
|
|
||||||
if (checked) {
|
|
||||||
showQuestion();
|
|
||||||
} else {
|
|
||||||
reset();
|
reset();
|
||||||
}
|
$(options.acrossInput).val(0);
|
||||||
$(actionCheckboxes).prop("checked", checked)
|
$(options.actionContainer).removeClass(options.selectedClass);
|
||||||
.parent().parent().toggleClass(options.selectedClass, checked);
|
},
|
||||||
},
|
checker = function(checked) {
|
||||||
updateCounter = function() {
|
if (checked) {
|
||||||
var sel = $(actionCheckboxes).filter(":checked").length;
|
|
||||||
// data-actions-icnt is defined in the generated HTML
|
|
||||||
// and contains the total amount of objects in the queryset
|
|
||||||
var actions_icnt = $('.action-counter').data('actionsIcnt');
|
|
||||||
$(options.counterContainer).html(interpolate(
|
|
||||||
ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
|
|
||||||
sel: sel,
|
|
||||||
cnt: actions_icnt
|
|
||||||
}, true));
|
|
||||||
$(options.allToggle).prop("checked", function() {
|
|
||||||
var value;
|
|
||||||
if (sel === actionCheckboxes.length) {
|
|
||||||
value = true;
|
|
||||||
showQuestion();
|
showQuestion();
|
||||||
} else {
|
} else {
|
||||||
value = false;
|
reset();
|
||||||
clearAcross();
|
|
||||||
}
|
}
|
||||||
return value;
|
$(actionCheckboxes).prop("checked", checked)
|
||||||
});
|
.parent().parent().toggleClass(options.selectedClass, checked);
|
||||||
};
|
},
|
||||||
|
updateCounter = function() {
|
||||||
|
var sel = $(actionCheckboxes).filter(":checked").length;
|
||||||
|
// data-actions-icnt is defined in the generated HTML
|
||||||
|
// and contains the total amount of objects in the queryset
|
||||||
|
var actions_icnt = $('.action-counter').data('actionsIcnt');
|
||||||
|
$(options.counterContainer).html(interpolate(
|
||||||
|
ngettext('%(sel)s of %(cnt)s selected', '%(sel)s of %(cnt)s selected', sel), {
|
||||||
|
sel: sel,
|
||||||
|
cnt: actions_icnt
|
||||||
|
}, true));
|
||||||
|
$(options.allToggle).prop("checked", function() {
|
||||||
|
var value;
|
||||||
|
if (sel === actionCheckboxes.length) {
|
||||||
|
value = true;
|
||||||
|
showQuestion();
|
||||||
|
} else {
|
||||||
|
value = false;
|
||||||
|
clearAcross();
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
});
|
||||||
|
};
|
||||||
// Show counter by default
|
// Show counter by default
|
||||||
$(options.counterContainer).show();
|
$(options.counterContainer).show();
|
||||||
// Check state of checkboxes and reinit state if needed
|
// Check state of checkboxes and reinit state if needed
|
||||||
|
@ -71,16 +71,16 @@
|
||||||
showClear();
|
showClear();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(options.allToggle).show().click(function() {
|
$(options.allToggle).show().on('click', function() {
|
||||||
checker($(this).prop("checked"));
|
checker($(this).prop("checked"));
|
||||||
updateCounter();
|
updateCounter();
|
||||||
});
|
});
|
||||||
$("a", options.acrossQuestions).click(function(event) {
|
$("a", options.acrossQuestions).on('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(options.acrossInput).val(1);
|
$(options.acrossInput).val(1);
|
||||||
showClear();
|
showClear();
|
||||||
});
|
});
|
||||||
$("a", options.acrossClears).click(function(event) {
|
$("a", options.acrossClears).on('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$(options.allToggle).prop("checked", false);
|
$(options.allToggle).prop("checked", false);
|
||||||
clearAcross();
|
clearAcross();
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
updateCounter();
|
updateCounter();
|
||||||
});
|
});
|
||||||
lastChecked = null;
|
lastChecked = null;
|
||||||
$(actionCheckboxes).click(function(event) {
|
$(actionCheckboxes).on('click', function(event) {
|
||||||
if (!event) { event = window.event; }
|
if (!event) { event = window.event; }
|
||||||
var target = event.target ? event.target : event.srcElement;
|
var target = event.target ? event.target : event.srcElement;
|
||||||
if (lastChecked && $.data(lastChecked) !== $.data(target) && event.shiftKey === true) {
|
if (lastChecked && $.data(lastChecked) !== $.data(target) && event.shiftKey === true) {
|
||||||
|
@ -109,15 +109,15 @@
|
||||||
lastChecked = target;
|
lastChecked = target;
|
||||||
updateCounter();
|
updateCounter();
|
||||||
});
|
});
|
||||||
$('form#changelist-form table#result_list tr').find('td:gt(0) :input').change(function() {
|
$('form#changelist-form table#result_list tr').on('change', 'td:gt(0) :input', function() {
|
||||||
list_editable_changed = true;
|
list_editable_changed = true;
|
||||||
});
|
});
|
||||||
$('form#changelist-form button[name="index"]').click(function(event) {
|
$('form#changelist-form button[name="index"]').on('click', function(event) {
|
||||||
if (list_editable_changed) {
|
if (list_editable_changed) {
|
||||||
return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."));
|
return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('form#changelist-form input[name="_save"]').click(function(event) {
|
$('form#changelist-form input[name="_save"]').on('click', function(event) {
|
||||||
var action_changed = false;
|
var action_changed = false;
|
||||||
$('select option:selected', options.actionContainer).each(function() {
|
$('select option:selected', options.actionContainer).each(function() {
|
||||||
if ($(this).val()) {
|
if ($(this).val()) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
(function(a){var f;a.fn.actions=function(e){var b=a.extend({},a.fn.actions.defaults,e),g=a(this),k=!1,l=function(){a(b.acrossClears).hide();a(b.acrossQuestions).show();a(b.allContainer).hide()},m=function(){a(b.acrossClears).show();a(b.acrossQuestions).hide();a(b.actionContainer).toggleClass(b.selectedClass);a(b.allContainer).show();a(b.counterContainer).hide()},n=function(){a(b.acrossClears).hide();a(b.acrossQuestions).hide();a(b.allContainer).hide();a(b.counterContainer).show()},p=function(){n();
|
(function(a){var f;a.fn.actions=function(e){var b=a.extend({},a.fn.actions.defaults,e),g=a(this),k=!1,l=function(){a(b.acrossClears).hide();a(b.acrossQuestions).show();a(b.allContainer).hide()},m=function(){a(b.acrossClears).show();a(b.acrossQuestions).hide();a(b.actionContainer).toggleClass(b.selectedClass);a(b.allContainer).show();a(b.counterContainer).hide()},n=function(){a(b.acrossClears).hide();a(b.acrossQuestions).hide();a(b.allContainer).hide();a(b.counterContainer).show()},p=function(){n();
|
||||||
a(b.acrossInput).val(0);a(b.actionContainer).removeClass(b.selectedClass)},q=function(c){c?l():n();a(g).prop("checked",c).parent().parent().toggleClass(b.selectedClass,c)},h=function(){var c=a(g).filter(":checked").length,d=a(".action-counter").data("actionsIcnt");a(b.counterContainer).html(interpolate(ngettext("%(sel)s of %(cnt)s selected","%(sel)s of %(cnt)s selected",c),{sel:c,cnt:d},!0));a(b.allToggle).prop("checked",function(){var a;c===g.length?(a=!0,l()):(a=!1,p());return a})};a(b.counterContainer).show();
|
a(b.acrossInput).val(0);a(b.actionContainer).removeClass(b.selectedClass)},q=function(c){c?l():n();a(g).prop("checked",c).parent().parent().toggleClass(b.selectedClass,c)},h=function(){var c=a(g).filter(":checked").length,d=a(".action-counter").data("actionsIcnt");a(b.counterContainer).html(interpolate(ngettext("%(sel)s of %(cnt)s selected","%(sel)s of %(cnt)s selected",c),{sel:c,cnt:d},!0));a(b.allToggle).prop("checked",function(){if(c===g.length){var a=!0;l()}else a=!1,p();return a})};a(b.counterContainer).show();
|
||||||
a(this).filter(":checked").each(function(c){a(this).parent().parent().toggleClass(b.selectedClass);h();1===a(b.acrossInput).val()&&m()});a(b.allToggle).show().click(function(){q(a(this).prop("checked"));h()});a("a",b.acrossQuestions).click(function(c){c.preventDefault();a(b.acrossInput).val(1);m()});a("a",b.acrossClears).click(function(c){c.preventDefault();a(b.allToggle).prop("checked",!1);p();q(0);h()});f=null;a(g).click(function(c){c||(c=window.event);var d=c.target?c.target:c.srcElement;if(f&&
|
a(this).filter(":checked").each(function(c){a(this).parent().parent().toggleClass(b.selectedClass);h();1===a(b.acrossInput).val()&&m()});a(b.allToggle).show().on("click",function(){q(a(this).prop("checked"));h()});a("a",b.acrossQuestions).on("click",function(c){c.preventDefault();a(b.acrossInput).val(1);m()});a("a",b.acrossClears).on("click",function(c){c.preventDefault();a(b.allToggle).prop("checked",!1);p();q(0);h()});f=null;a(g).on("click",function(c){c||(c=window.event);var d=c.target?c.target:
|
||||||
a.data(f)!==a.data(d)&&!0===c.shiftKey){var e=!1;a(f).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked);a(g).each(function(){if(a.data(this)===a.data(f)||a.data(this)===a.data(d))e=e?!1:!0;e&&a(this).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked)})}a(d).parent().parent().toggleClass(b.selectedClass,d.checked);f=d;h()});a("form#changelist-form table#result_list tr").find("td:gt(0) :input").change(function(){k=!0});a('form#changelist-form button[name="index"]').click(function(a){if(k)return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."))});
|
c.srcElement;if(f&&a.data(f)!==a.data(d)&&!0===c.shiftKey){var e=!1;a(f).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked);a(g).each(function(){if(a.data(this)===a.data(f)||a.data(this)===a.data(d))e=e?!1:!0;e&&a(this).prop("checked",d.checked).parent().parent().toggleClass(b.selectedClass,d.checked)})}a(d).parent().parent().toggleClass(b.selectedClass,d.checked);f=d;h()});a("form#changelist-form table#result_list tr").on("change","td:gt(0) :input",function(){k=!0});
|
||||||
a('form#changelist-form input[name="_save"]').click(function(c){var d=!1;a("select option:selected",b.actionContainer).each(function(){a(this).val()&&(d=!0)});if(d)return k?confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")):confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."))})};
|
a('form#changelist-form button[name="index"]').on("click",function(a){if(k)return confirm(gettext("You have unsaved changes on individual editable fields. If you run an action, your unsaved changes will be lost."))});a('form#changelist-form input[name="_save"]').on("click",function(c){var d=!1;a("select option:selected",b.actionContainer).each(function(){a(this).val()&&(d=!0)});if(d)return k?confirm(gettext("You have selected an action, but you haven't saved your changes to individual fields yet. Please click OK to save. You'll need to re-run the action.")):
|
||||||
a.fn.actions.defaults={actionContainer:"div.actions",counterContainer:"span.action-counter",allContainer:"div.actions span.all",acrossInput:"div.actions input.select-across",acrossQuestions:"div.actions span.question",acrossClears:"div.actions span.clear",allToggle:"#action-toggle",selectedClass:"selected"};a(document).ready(function(){var e=a("tr input.action-select");0<e.length&&e.actions()})})(django.jQuery);
|
confirm(gettext("You have selected an action, and you haven't made any changes on individual fields. You're probably looking for the Go button rather than the Save button."))})};a.fn.actions.defaults={actionContainer:"div.actions",counterContainer:"span.action-counter",allContainer:"div.actions span.all",acrossInput:"div.actions input.select-across",acrossQuestions:"div.actions span.question",acrossClears:"div.actions span.clear",allToggle:"#action-toggle",selectedClass:"selected"};a(document).ready(function(){var e=
|
||||||
|
a("tr input.action-select");0<e.length&&e.actions()})})(django.jQuery);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*global addEvent, Calendar, cancelEventPropagation, findPosX, findPosY, getStyle, get_format, gettext, interpolate, ngettext, quickElement, removeEvent*/
|
/*global Calendar, findPosX, findPosY, getStyle, get_format, gettext, gettext_noop, interpolate, ngettext, quickElement*/
|
||||||
// Inserts shortcut buttons after all of the following:
|
// Inserts shortcut buttons after all of the following:
|
||||||
// <input type="text" class="vDateField">
|
// <input type="text" class="vDateField">
|
||||||
// <input type="text" class="vTimeField">
|
// <input type="text" class="vTimeField">
|
||||||
|
@ -8,13 +8,22 @@
|
||||||
calendars: [],
|
calendars: [],
|
||||||
calendarInputs: [],
|
calendarInputs: [],
|
||||||
clockInputs: [],
|
clockInputs: [],
|
||||||
|
clockHours: {
|
||||||
|
default_: [
|
||||||
|
[gettext_noop('Now'), -1],
|
||||||
|
[gettext_noop('Midnight'), 0],
|
||||||
|
[gettext_noop('6 a.m.'), 6],
|
||||||
|
[gettext_noop('Noon'), 12],
|
||||||
|
[gettext_noop('6 p.m.'), 18]
|
||||||
|
]
|
||||||
|
},
|
||||||
dismissClockFunc: [],
|
dismissClockFunc: [],
|
||||||
dismissCalendarFunc: [],
|
dismissCalendarFunc: [],
|
||||||
calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled
|
calendarDivName1: 'calendarbox', // name of calendar <div> that gets toggled
|
||||||
calendarDivName2: 'calendarin', // name of <div> that contains calendar
|
calendarDivName2: 'calendarin', // name of <div> that contains calendar
|
||||||
calendarLinkName: 'calendarlink',// name of the link that is used to toggle
|
calendarLinkName: 'calendarlink', // name of the link that is used to toggle
|
||||||
clockDivName: 'clockbox', // name of clock <div> that gets toggled
|
clockDivName: 'clockbox', // name of clock <div> that gets toggled
|
||||||
clockLinkName: 'clocklink', // name of the link that is used to toggle
|
clockLinkName: 'clocklink', // name of the link that is used to toggle
|
||||||
shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts
|
shortCutsClass: 'datetimeshortcuts', // class of the clock and cal shortcuts
|
||||||
timezoneWarningClass: 'timezonewarning', // class of the warning for timezone mismatch
|
timezoneWarningClass: 'timezonewarning', // class of the warning for timezone mismatch
|
||||||
timezoneOffset: 0,
|
timezoneOffset: 0,
|
||||||
|
@ -54,7 +63,6 @@
|
||||||
},
|
},
|
||||||
// Add a warning when the time zone in the browser and backend do not match.
|
// Add a warning when the time zone in the browser and backend do not match.
|
||||||
addTimezoneWarning: function(inp) {
|
addTimezoneWarning: function(inp) {
|
||||||
var $ = django.jQuery;
|
|
||||||
var warningClass = DateTimeShortcuts.timezoneWarningClass;
|
var warningClass = DateTimeShortcuts.timezoneWarningClass;
|
||||||
var timezoneOffset = DateTimeShortcuts.timezoneOffset / 3600;
|
var timezoneOffset = DateTimeShortcuts.timezoneOffset / 3600;
|
||||||
|
|
||||||
|
@ -64,7 +72,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if warning is already there.
|
// Check if warning is already there.
|
||||||
if ($(inp).siblings('.' + warningClass).length) {
|
if (inp.parentNode.querySelectorAll('.' + warningClass).length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,13 +94,11 @@
|
||||||
}
|
}
|
||||||
message = interpolate(message, [timezoneOffset]);
|
message = interpolate(message, [timezoneOffset]);
|
||||||
|
|
||||||
var $warning = $('<span>');
|
var warning = document.createElement('span');
|
||||||
$warning.attr('class', warningClass);
|
warning.className = warningClass;
|
||||||
$warning.text(message);
|
warning.textContent = message;
|
||||||
|
inp.parentNode.appendChild(document.createElement('br'));
|
||||||
$(inp).parent()
|
inp.parentNode.appendChild(warning);
|
||||||
.append($('<br>'))
|
|
||||||
.append($warning);
|
|
||||||
},
|
},
|
||||||
// Add clock widget to a given field
|
// Add clock widget to a given field
|
||||||
addClock: function(inp) {
|
addClock: function(inp) {
|
||||||
|
@ -106,15 +112,15 @@
|
||||||
inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
|
inp.parentNode.insertBefore(shortcuts_span, inp.nextSibling);
|
||||||
var now_link = document.createElement('a');
|
var now_link = document.createElement('a');
|
||||||
now_link.setAttribute('href', "#");
|
now_link.setAttribute('href', "#");
|
||||||
now_link.appendChild(document.createTextNode(gettext('Now')));
|
now_link.textContent = gettext('Now');
|
||||||
addEvent(now_link, 'click', function(e) {
|
now_link.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
DateTimeShortcuts.handleClockQuicklink(num, -1);
|
DateTimeShortcuts.handleClockQuicklink(num, -1);
|
||||||
});
|
});
|
||||||
var clock_link = document.createElement('a');
|
var clock_link = document.createElement('a');
|
||||||
clock_link.setAttribute('href', '#');
|
clock_link.setAttribute('href', '#');
|
||||||
clock_link.id = DateTimeShortcuts.clockLinkName + num;
|
clock_link.id = DateTimeShortcuts.clockLinkName + num;
|
||||||
addEvent(clock_link, 'click', function(e) {
|
clock_link.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// avoid triggering the document click handler to dismiss the clock
|
// avoid triggering the document click handler to dismiss the clock
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -152,46 +158,32 @@
|
||||||
clock_box.className = 'clockbox module';
|
clock_box.className = 'clockbox module';
|
||||||
clock_box.setAttribute('id', DateTimeShortcuts.clockDivName + num);
|
clock_box.setAttribute('id', DateTimeShortcuts.clockDivName + num);
|
||||||
document.body.appendChild(clock_box);
|
document.body.appendChild(clock_box);
|
||||||
addEvent(clock_box, 'click', cancelEventPropagation);
|
clock_box.addEventListener('click', function(e) { e.stopPropagation(); });
|
||||||
|
|
||||||
quickElement('h2', clock_box, gettext('Choose a time'));
|
quickElement('h2', clock_box, gettext('Choose a time'));
|
||||||
var time_list = quickElement('ul', clock_box);
|
var time_list = quickElement('ul', clock_box);
|
||||||
time_list.className = 'timelist';
|
time_list.className = 'timelist';
|
||||||
var time_link = quickElement("a", quickElement("li", time_list), gettext("Now"), "href", "#");
|
// The list of choices can be overridden in JavaScript like this:
|
||||||
addEvent(time_link, 'click', function(e) {
|
// DateTimeShortcuts.clockHours.name = [['3 a.m.', 3]];
|
||||||
e.preventDefault();
|
// where name is the name attribute of the <input>.
|
||||||
DateTimeShortcuts.handleClockQuicklink(num, -1);
|
var name = typeof DateTimeShortcuts.clockHours[inp.name] === 'undefined' ? 'default_' : inp.name;
|
||||||
});
|
DateTimeShortcuts.clockHours[name].forEach(function(element) {
|
||||||
time_link = quickElement("a", quickElement("li", time_list), gettext("Midnight"), "href", "#");
|
var time_link = quickElement('a', quickElement('li', time_list), gettext(element[0]), 'href', '#');
|
||||||
addEvent(time_link, 'click', function(e) {
|
time_link.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
DateTimeShortcuts.handleClockQuicklink(num, 0);
|
DateTimeShortcuts.handleClockQuicklink(num, element[1]);
|
||||||
});
|
});
|
||||||
time_link = quickElement("a", quickElement("li", time_list), gettext("6 a.m."), "href", "#");
|
|
||||||
addEvent(time_link, 'click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.handleClockQuicklink(num, 6);
|
|
||||||
});
|
|
||||||
time_link = quickElement("a", quickElement("li", time_list), gettext("Noon"), "href", "#");
|
|
||||||
addEvent(time_link, 'click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.handleClockQuicklink(num, 12);
|
|
||||||
});
|
|
||||||
time_link = quickElement("a", quickElement("li", time_list), gettext("6 p.m."), "href", "#");
|
|
||||||
addEvent(time_link, 'click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
DateTimeShortcuts.handleClockQuicklink(num, 18);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var cancel_p = quickElement('p', clock_box);
|
var cancel_p = quickElement('p', clock_box);
|
||||||
cancel_p.className = 'calendar-cancel';
|
cancel_p.className = 'calendar-cancel';
|
||||||
var cancel_link = quickElement('a', cancel_p, gettext('Cancel'), 'href', '#');
|
var cancel_link = quickElement('a', cancel_p, gettext('Cancel'), 'href', '#');
|
||||||
addEvent(cancel_link, 'click', function(e) {
|
cancel_link.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
DateTimeShortcuts.dismissClock(num);
|
DateTimeShortcuts.dismissClock(num);
|
||||||
});
|
});
|
||||||
|
|
||||||
django.jQuery(document).bind('keyup', function(event) {
|
document.addEventListener('keyup', function(event) {
|
||||||
if (event.which === 27) {
|
if (event.which === 27) {
|
||||||
// ESC key closes popup
|
// ESC key closes popup
|
||||||
DateTimeShortcuts.dismissClock(num);
|
DateTimeShortcuts.dismissClock(num);
|
||||||
|
@ -219,11 +211,11 @@
|
||||||
|
|
||||||
// Show the clock box
|
// Show the clock box
|
||||||
clock_box.style.display = 'block';
|
clock_box.style.display = 'block';
|
||||||
addEvent(document, 'click', DateTimeShortcuts.dismissClockFunc[num]);
|
document.addEventListener('click', DateTimeShortcuts.dismissClockFunc[num]);
|
||||||
},
|
},
|
||||||
dismissClock: function(num) {
|
dismissClock: function(num) {
|
||||||
document.getElementById(DateTimeShortcuts.clockDivName + num).style.display = 'none';
|
document.getElementById(DateTimeShortcuts.clockDivName + num).style.display = 'none';
|
||||||
removeEvent(document, 'click', DateTimeShortcuts.dismissClockFunc[num]);
|
document.removeEventListener('click', DateTimeShortcuts.dismissClockFunc[num]);
|
||||||
},
|
},
|
||||||
handleClockQuicklink: function(num, val) {
|
handleClockQuicklink: function(num, val) {
|
||||||
var d;
|
var d;
|
||||||
|
@ -251,14 +243,14 @@
|
||||||
var today_link = document.createElement('a');
|
var today_link = document.createElement('a');
|
||||||
today_link.setAttribute('href', '#');
|
today_link.setAttribute('href', '#');
|
||||||
today_link.appendChild(document.createTextNode(gettext('Today')));
|
today_link.appendChild(document.createTextNode(gettext('Today')));
|
||||||
addEvent(today_link, 'click', function(e) {
|
today_link.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
DateTimeShortcuts.handleCalendarQuickLink(num, 0);
|
DateTimeShortcuts.handleCalendarQuickLink(num, 0);
|
||||||
});
|
});
|
||||||
var cal_link = document.createElement('a');
|
var cal_link = document.createElement('a');
|
||||||
cal_link.setAttribute('href', '#');
|
cal_link.setAttribute('href', '#');
|
||||||
cal_link.id = DateTimeShortcuts.calendarLinkName + num;
|
cal_link.id = DateTimeShortcuts.calendarLinkName + num;
|
||||||
addEvent(cal_link, 'click', function(e) {
|
cal_link.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// avoid triggering the document click handler to dismiss the calendar
|
// avoid triggering the document click handler to dismiss the calendar
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -297,20 +289,20 @@
|
||||||
cal_box.className = 'calendarbox module';
|
cal_box.className = 'calendarbox module';
|
||||||
cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num);
|
cal_box.setAttribute('id', DateTimeShortcuts.calendarDivName1 + num);
|
||||||
document.body.appendChild(cal_box);
|
document.body.appendChild(cal_box);
|
||||||
addEvent(cal_box, 'click', cancelEventPropagation);
|
cal_box.addEventListener('click', function(e) { e.stopPropagation(); });
|
||||||
|
|
||||||
// next-prev links
|
// next-prev links
|
||||||
var cal_nav = quickElement('div', cal_box);
|
var cal_nav = quickElement('div', cal_box);
|
||||||
var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', '#');
|
var cal_nav_prev = quickElement('a', cal_nav, '<', 'href', '#');
|
||||||
cal_nav_prev.className = 'calendarnav-previous';
|
cal_nav_prev.className = 'calendarnav-previous';
|
||||||
addEvent(cal_nav_prev, 'click', function(e) {
|
cal_nav_prev.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
DateTimeShortcuts.drawPrev(num);
|
DateTimeShortcuts.drawPrev(num);
|
||||||
});
|
});
|
||||||
|
|
||||||
var cal_nav_next = quickElement('a', cal_nav, '>', 'href', '#');
|
var cal_nav_next = quickElement('a', cal_nav, '>', 'href', '#');
|
||||||
cal_nav_next.className = 'calendarnav-next';
|
cal_nav_next.className = 'calendarnav-next';
|
||||||
addEvent(cal_nav_next, 'click', function(e) {
|
cal_nav_next.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
DateTimeShortcuts.drawNext(num);
|
DateTimeShortcuts.drawNext(num);
|
||||||
});
|
});
|
||||||
|
@ -325,19 +317,19 @@
|
||||||
var shortcuts = quickElement('div', cal_box);
|
var shortcuts = quickElement('div', cal_box);
|
||||||
shortcuts.className = 'calendar-shortcuts';
|
shortcuts.className = 'calendar-shortcuts';
|
||||||
var day_link = quickElement('a', shortcuts, gettext('Yesterday'), 'href', '#');
|
var day_link = quickElement('a', shortcuts, gettext('Yesterday'), 'href', '#');
|
||||||
addEvent(day_link, 'click', function(e) {
|
day_link.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
DateTimeShortcuts.handleCalendarQuickLink(num, -1);
|
DateTimeShortcuts.handleCalendarQuickLink(num, -1);
|
||||||
});
|
});
|
||||||
shortcuts.appendChild(document.createTextNode('\u00A0|\u00A0'));
|
shortcuts.appendChild(document.createTextNode('\u00A0|\u00A0'));
|
||||||
day_link = quickElement('a', shortcuts, gettext('Today'), 'href', '#');
|
day_link = quickElement('a', shortcuts, gettext('Today'), 'href', '#');
|
||||||
addEvent(day_link, 'click', function(e) {
|
day_link.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
DateTimeShortcuts.handleCalendarQuickLink(num, 0);
|
DateTimeShortcuts.handleCalendarQuickLink(num, 0);
|
||||||
});
|
});
|
||||||
shortcuts.appendChild(document.createTextNode('\u00A0|\u00A0'));
|
shortcuts.appendChild(document.createTextNode('\u00A0|\u00A0'));
|
||||||
day_link = quickElement('a', shortcuts, gettext('Tomorrow'), 'href', '#');
|
day_link = quickElement('a', shortcuts, gettext('Tomorrow'), 'href', '#');
|
||||||
addEvent(day_link, 'click', function(e) {
|
day_link.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
DateTimeShortcuts.handleCalendarQuickLink(num, +1);
|
DateTimeShortcuts.handleCalendarQuickLink(num, +1);
|
||||||
});
|
});
|
||||||
|
@ -346,11 +338,11 @@
|
||||||
var cancel_p = quickElement('p', cal_box);
|
var cancel_p = quickElement('p', cal_box);
|
||||||
cancel_p.className = 'calendar-cancel';
|
cancel_p.className = 'calendar-cancel';
|
||||||
var cancel_link = quickElement('a', cancel_p, gettext('Cancel'), 'href', '#');
|
var cancel_link = quickElement('a', cancel_p, gettext('Cancel'), 'href', '#');
|
||||||
addEvent(cancel_link, 'click', function(e) {
|
cancel_link.addEventListener('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
DateTimeShortcuts.dismissCalendar(num);
|
DateTimeShortcuts.dismissCalendar(num);
|
||||||
});
|
});
|
||||||
django.jQuery(document).bind('keyup', function(event) {
|
document.addEventListener('keyup', function(event) {
|
||||||
if (event.which === 27) {
|
if (event.which === 27) {
|
||||||
// ESC key closes popup
|
// ESC key closes popup
|
||||||
DateTimeShortcuts.dismissCalendar(num);
|
DateTimeShortcuts.dismissCalendar(num);
|
||||||
|
@ -391,11 +383,11 @@
|
||||||
cal_box.style.top = Math.max(0, findPosY(cal_link) - 75) + 'px';
|
cal_box.style.top = Math.max(0, findPosY(cal_link) - 75) + 'px';
|
||||||
|
|
||||||
cal_box.style.display = 'block';
|
cal_box.style.display = 'block';
|
||||||
addEvent(document, 'click', DateTimeShortcuts.dismissCalendarFunc[num]);
|
document.addEventListener('click', DateTimeShortcuts.dismissCalendarFunc[num]);
|
||||||
},
|
},
|
||||||
dismissCalendar: function(num) {
|
dismissCalendar: function(num) {
|
||||||
document.getElementById(DateTimeShortcuts.calendarDivName1 + num).style.display = 'none';
|
document.getElementById(DateTimeShortcuts.calendarDivName1 + num).style.display = 'none';
|
||||||
removeEvent(document, 'click', DateTimeShortcuts.dismissCalendarFunc[num]);
|
document.removeEventListener('click', DateTimeShortcuts.dismissCalendarFunc[num]);
|
||||||
},
|
},
|
||||||
drawPrev: function(num) {
|
drawPrev: function(num) {
|
||||||
DateTimeShortcuts.calendars[num].drawPreviousMonth();
|
DateTimeShortcuts.calendars[num].drawPreviousMonth();
|
||||||
|
@ -406,11 +398,11 @@
|
||||||
handleCalendarCallback: function(num) {
|
handleCalendarCallback: function(num) {
|
||||||
var format = get_format('DATE_INPUT_FORMATS')[0];
|
var format = get_format('DATE_INPUT_FORMATS')[0];
|
||||||
// the format needs to be escaped a little
|
// the format needs to be escaped a little
|
||||||
format = format.replace('\\', '\\\\');
|
format = format.replace('\\', '\\\\')
|
||||||
format = format.replace('\r', '\\r');
|
.replace('\r', '\\r')
|
||||||
format = format.replace('\n', '\\n');
|
.replace('\n', '\\n')
|
||||||
format = format.replace('\t', '\\t');
|
.replace('\t', '\\t')
|
||||||
format = format.replace("'", "\\'");
|
.replace("'", "\\'");
|
||||||
return function(y, m, d) {
|
return function(y, m, d) {
|
||||||
DateTimeShortcuts.calendarInputs[num].value = new Date(y, m - 1, d).strftime(format);
|
DateTimeShortcuts.calendarInputs[num].value = new Date(y, m - 1, d).strftime(format);
|
||||||
DateTimeShortcuts.calendarInputs[num].focus();
|
DateTimeShortcuts.calendarInputs[num].focus();
|
||||||
|
@ -426,6 +418,6 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
addEvent(window, 'load', DateTimeShortcuts.init);
|
window.addEventListener('load', DateTimeShortcuts.init);
|
||||||
window.DateTimeShortcuts = DateTimeShortcuts;
|
window.DateTimeShortcuts = DateTimeShortcuts;
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
function updateRelatedObjectLinks(triggeringLink) {
|
function updateRelatedObjectLinks(triggeringLink) {
|
||||||
var $this = $(triggeringLink);
|
var $this = $(triggeringLink);
|
||||||
var siblings = $this.nextAll('.change-related, .delete-related');
|
var siblings = $this.nextAll('.view-related, .change-related, .delete-related');
|
||||||
if (!siblings.length) {
|
if (!siblings.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,12 @@
|
||||||
this.value = newId;
|
this.value = newId;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
selects.next().find('.select2-selection__rendered').each(function() {
|
||||||
|
// The element can have a clear button as a child.
|
||||||
|
// Use the lastChild to modify only the displayed value.
|
||||||
|
this.lastChild.textContent = newRepr;
|
||||||
|
this.title = newRepr;
|
||||||
|
});
|
||||||
win.close();
|
win.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,7 +146,7 @@
|
||||||
window.dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
|
window.dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("a[data-popup-opener]").click(function(event) {
|
$("a[data-popup-opener]").on('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
opener.dismissRelatedLookupPopup(window, $(this).data("popup-opener"));
|
opener.dismissRelatedLookupPopup(window, $(this).data("popup-opener"));
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/*global gettext, pgettext, get_format, quickElement, removeChildren, addEvent*/
|
/*global gettext, pgettext, get_format, quickElement, removeChildren*/
|
||||||
/*
|
/*
|
||||||
calendar.js - Calendar functions by Adrian Holovaty
|
calendar.js - Calendar functions by Adrian Holovaty
|
||||||
depends on core.js for utility functions like removeChildren or quickElement
|
depends on core.js for utility functions like removeChildren or quickElement
|
||||||
|
@ -103,7 +103,7 @@ depends on core.js for utility functions like removeChildren or quickElement
|
||||||
function calendarMonth(y, m) {
|
function calendarMonth(y, m) {
|
||||||
function onClick(e) {
|
function onClick(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
callback(y, m, django.jQuery(this).text());
|
callback(y, m, this.textContent);
|
||||||
}
|
}
|
||||||
return onClick;
|
return onClick;
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ depends on core.js for utility functions like removeChildren or quickElement
|
||||||
|
|
||||||
var cell = quickElement('td', tableRow, '', 'class', todayClass);
|
var cell = quickElement('td', tableRow, '', 'class', todayClass);
|
||||||
var link = quickElement('a', cell, currentDay, 'href', '#');
|
var link = quickElement('a', cell, currentDay, 'href', '#');
|
||||||
addEvent(link, 'click', calendarMonth(year, month));
|
link.addEventListener('click', calendarMonth(year, month));
|
||||||
currentDay++;
|
currentDay++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
(function($) {
|
(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
$(function() {
|
$(function() {
|
||||||
$('.cancel-link').click(function(e) {
|
$('.cancel-link').on('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
window.history.back();
|
if (window.location.search.indexOf('&_popup=1') === -1) {
|
||||||
|
window.history.back(); // Go back if not a popup.
|
||||||
|
} else {
|
||||||
|
window.close(); // Otherwise, close the popup.
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})(django.jQuery);
|
})(django.jQuery);
|
||||||
|
|
|
@ -1,26 +1,55 @@
|
||||||
/*global gettext*/
|
/*global gettext*/
|
||||||
(function($) {
|
(function() {
|
||||||
'use strict';
|
'use strict';
|
||||||
$(document).ready(function() {
|
var closestElem = function(elem, tagName) {
|
||||||
|
if (elem.nodeName === tagName.toUpperCase()) {
|
||||||
|
return elem;
|
||||||
|
}
|
||||||
|
if (elem.parentNode.nodeName === 'BODY') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return elem.parentNode && closestElem(elem.parentNode, tagName);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('load', function() {
|
||||||
// Add anchor tag for Show/Hide link
|
// Add anchor tag for Show/Hide link
|
||||||
$("fieldset.collapse").each(function(i, elem) {
|
var fieldsets = document.querySelectorAll('fieldset.collapse');
|
||||||
|
for (var i = 0; i < fieldsets.length; i++) {
|
||||||
|
var elem = fieldsets[i];
|
||||||
// Don't hide if fields in this fieldset have errors
|
// Don't hide if fields in this fieldset have errors
|
||||||
if ($(elem).find("div.errors").length === 0) {
|
if (elem.querySelectorAll('div.errors').length === 0) {
|
||||||
$(elem).addClass("collapsed").find("h2").first().append(' (<a id="fieldsetcollapser' +
|
elem.classList.add('collapsed');
|
||||||
i + '" class="collapse-toggle" href="#">' + gettext("Show") +
|
var h2 = elem.querySelector('h2');
|
||||||
'</a>)');
|
var link = document.createElement('a');
|
||||||
|
link.setAttribute('id', 'fieldsetcollapser' + i);
|
||||||
|
link.setAttribute('class', 'collapse-toggle');
|
||||||
|
link.setAttribute('href', '#');
|
||||||
|
link.textContent = gettext('Show');
|
||||||
|
h2.appendChild(document.createTextNode(' ('));
|
||||||
|
h2.appendChild(link);
|
||||||
|
h2.appendChild(document.createTextNode(')'));
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
// Add toggle to anchor tag
|
// Add toggle to hide/show anchor tag
|
||||||
$("fieldset.collapse a.collapse-toggle").click(function(ev) {
|
var toggleFunc = function(ev) {
|
||||||
if ($(this).closest("fieldset").hasClass("collapsed")) {
|
if (ev.target.matches('.collapse-toggle')) {
|
||||||
// Show
|
ev.preventDefault();
|
||||||
$(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset", [$(this).attr("id")]);
|
ev.stopPropagation();
|
||||||
} else {
|
var fieldset = closestElem(ev.target, 'fieldset');
|
||||||
// Hide
|
if (fieldset.classList.contains('collapsed')) {
|
||||||
$(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset", [$(this).attr("id")]);
|
// Show
|
||||||
|
ev.target.textContent = gettext('Hide');
|
||||||
|
fieldset.classList.remove('collapsed');
|
||||||
|
} else {
|
||||||
|
// Hide
|
||||||
|
ev.target.textContent = gettext('Show');
|
||||||
|
fieldset.classList.add('collapsed');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
};
|
||||||
});
|
var inlineDivs = document.querySelectorAll('fieldset.module');
|
||||||
|
for (i = 0; i < inlineDivs.length; i++) {
|
||||||
|
inlineDivs[i].addEventListener('click', toggleFunc);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
})(django.jQuery);
|
})();
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
(function(a){a(document).ready(function(){a("fieldset.collapse").each(function(b,c){0===a(c).find("div.errors").length&&a(c).addClass("collapsed").find("h2").first().append(' (<a id="fieldsetcollapser'+b+'" class="collapse-toggle" href="#">'+gettext("Show")+"</a>)")});a("fieldset.collapse a.collapse-toggle").click(function(b){a(this).closest("fieldset").hasClass("collapsed")?a(this).text(gettext("Hide")).closest("fieldset").removeClass("collapsed").trigger("show.fieldset",[a(this).attr("id")]):a(this).text(gettext("Show")).closest("fieldset").addClass("collapsed").trigger("hide.fieldset",
|
(function(){var e=function(b,a){return b.nodeName===a.toUpperCase()?b:"BODY"===b.parentNode.nodeName?null:b.parentNode&&e(b.parentNode,a)};window.addEventListener("load",function(){for(var b=document.querySelectorAll("fieldset.collapse"),a=0;a<b.length;a++){var c=b[a];if(0===c.querySelectorAll("div.errors").length){c.classList.add("collapsed");c=c.querySelector("h2");var d=document.createElement("a");d.setAttribute("id","fieldsetcollapser"+a);d.setAttribute("class","collapse-toggle");d.setAttribute("href",
|
||||||
[a(this).attr("id")]);return!1})})})(django.jQuery);
|
"#");d.textContent=gettext("Show");c.appendChild(document.createTextNode(" ("));c.appendChild(d);c.appendChild(document.createTextNode(")"))}}b=function(a){if(a.target.matches(".collapse-toggle")){a.preventDefault();a.stopPropagation();var b=e(a.target,"fieldset");b.classList.contains("collapsed")?(a.target.textContent=gettext("Hide"),b.classList.remove("collapsed")):(a.target.textContent=gettext("Show"),b.classList.add("collapsed"))}};c=document.querySelectorAll("fieldset.module");for(a=0;a<c.length;a++)c[a].addEventListener("click",
|
||||||
|
b)})})();
|
||||||
|
|
|
@ -4,44 +4,6 @@
|
||||||
var isOpera = (navigator.userAgent.indexOf("Opera") >= 0) && parseFloat(navigator.appVersion);
|
var isOpera = (navigator.userAgent.indexOf("Opera") >= 0) && parseFloat(navigator.appVersion);
|
||||||
var isIE = ((document.all) && (!isOpera)) && parseFloat(navigator.appVersion.split("MSIE ")[1].split(";")[0]);
|
var isIE = ((document.all) && (!isOpera)) && parseFloat(navigator.appVersion.split("MSIE ")[1].split(";")[0]);
|
||||||
|
|
||||||
// Cross-browser event handlers.
|
|
||||||
function addEvent(obj, evType, fn) {
|
|
||||||
'use strict';
|
|
||||||
if (obj.addEventListener) {
|
|
||||||
obj.addEventListener(evType, fn, false);
|
|
||||||
return true;
|
|
||||||
} else if (obj.attachEvent) {
|
|
||||||
var r = obj.attachEvent("on" + evType, fn);
|
|
||||||
return r;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeEvent(obj, evType, fn) {
|
|
||||||
'use strict';
|
|
||||||
if (obj.removeEventListener) {
|
|
||||||
obj.removeEventListener(evType, fn, false);
|
|
||||||
return true;
|
|
||||||
} else if (obj.detachEvent) {
|
|
||||||
obj.detachEvent("on" + evType, fn);
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelEventPropagation(e) {
|
|
||||||
'use strict';
|
|
||||||
if (!e) {
|
|
||||||
e = window.event;
|
|
||||||
}
|
|
||||||
e.cancelBubble = true;
|
|
||||||
if (e.stopPropagation) {
|
|
||||||
e.stopPropagation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]);
|
// quickElement(tagType, parentReference [, textInChildNode, attribute, attributeValue ...]);
|
||||||
function quickElement() {
|
function quickElement() {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -68,7 +30,7 @@ function removeChildren(a) {
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Find-position functions by PPK
|
// Find-position functions by PPK
|
||||||
// See http://www.quirksmode.org/js/findpos.html
|
// See https://www.quirksmode.org/js/findpos.html
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
function findPosX(obj) {
|
function findPosX(obj) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -191,9 +153,9 @@ function findPosY(obj) {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// String object extensions
|
// String object extensions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
String.prototype.pad_left = function(pad_length, pad_string) {
|
String.prototype.pad_left = function(pad_length, pad_string) {
|
||||||
var new_string = this;
|
var new_string = this;
|
||||||
for (var i = 0; new_string.length < pad_length; i++) {
|
for (var i = 0; new_string.length < pad_length; i++) {
|
||||||
|
@ -209,18 +171,18 @@ function findPosY(obj) {
|
||||||
var day, month, year;
|
var day, month, year;
|
||||||
while (i < split_format.length) {
|
while (i < split_format.length) {
|
||||||
switch (split_format[i]) {
|
switch (split_format[i]) {
|
||||||
case "%d":
|
case "%d":
|
||||||
day = date[i];
|
day = date[i];
|
||||||
break;
|
break;
|
||||||
case "%m":
|
case "%m":
|
||||||
month = date[i] - 1;
|
month = date[i] - 1;
|
||||||
break;
|
break;
|
||||||
case "%Y":
|
case "%Y":
|
||||||
year = date[i];
|
year = date[i];
|
||||||
break;
|
break;
|
||||||
case "%y":
|
case "%y":
|
||||||
year = date[i];
|
year = date[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
* and modified for Django by Jannis Leidel, Travis Swicegood and Julien Phalip.
|
* and modified for Django by Jannis Leidel, Travis Swicegood and Julien Phalip.
|
||||||
*
|
*
|
||||||
* Licensed under the New BSD License
|
* Licensed under the New BSD License
|
||||||
* See: http://www.opensource.org/licenses/bsd-license.php
|
* See: https://opensource.org/licenses/bsd-license.php
|
||||||
*/
|
*/
|
||||||
(function($) {
|
(function($) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -58,13 +58,13 @@
|
||||||
addButton = $this.filter(":last").next().find("a");
|
addButton = $this.filter(":last").next().find("a");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
addButton.click(function(e) {
|
addButton.on('click', function(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var template = $("#" + options.prefix + "-empty");
|
var template = $("#" + options.prefix + "-empty");
|
||||||
var row = template.clone(true);
|
var row = template.clone(true);
|
||||||
row.removeClass(options.emptyCssClass)
|
row.removeClass(options.emptyCssClass)
|
||||||
.addClass(options.formCssClass)
|
.addClass(options.formCssClass)
|
||||||
.attr("id", options.prefix + "-" + nextIndex);
|
.attr("id", options.prefix + "-" + nextIndex);
|
||||||
if (row.is("tr")) {
|
if (row.is("tr")) {
|
||||||
// If the forms are laid out in table rows, insert
|
// If the forms are laid out in table rows, insert
|
||||||
// the remove button into the last table cell:
|
// the remove button into the last table cell:
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
addButton.parent().hide();
|
addButton.parent().hide();
|
||||||
}
|
}
|
||||||
// The delete button of each row triggers a bunch of other things
|
// The delete button of each row triggers a bunch of other things
|
||||||
row.find("a." + options.deleteCssClass).click(function(e1) {
|
row.find("a." + options.deleteCssClass).on('click', function(e1) {
|
||||||
e1.preventDefault();
|
e1.preventDefault();
|
||||||
// Remove the parent form containing this button:
|
// Remove the parent form containing this button:
|
||||||
row.remove();
|
row.remove();
|
||||||
|
@ -131,26 +131,26 @@
|
||||||
|
|
||||||
/* Setup plugin defaults */
|
/* Setup plugin defaults */
|
||||||
$.fn.formset.defaults = {
|
$.fn.formset.defaults = {
|
||||||
prefix: "form", // The form prefix for your django formset
|
prefix: "form", // The form prefix for your django formset
|
||||||
addText: "add another", // Text for the add link
|
addText: "add another", // Text for the add link
|
||||||
deleteText: "remove", // Text for the delete link
|
deleteText: "remove", // Text for the delete link
|
||||||
addCssClass: "add-row", // CSS class applied to the add link
|
addCssClass: "add-row", // CSS class applied to the add link
|
||||||
deleteCssClass: "delete-row", // CSS class applied to the delete link
|
deleteCssClass: "delete-row", // CSS class applied to the delete link
|
||||||
emptyCssClass: "empty-row", // CSS class applied to the empty row
|
emptyCssClass: "empty-row", // CSS class applied to the empty row
|
||||||
formCssClass: "dynamic-form", // CSS class applied to each form in a formset
|
formCssClass: "dynamic-form", // CSS class applied to each form in a formset
|
||||||
added: null, // Function called each time a new form is added
|
added: null, // Function called each time a new form is added
|
||||||
removed: null, // Function called each time a form is deleted
|
removed: null, // Function called each time a form is deleted
|
||||||
addButton: null // Existing add button to use
|
addButton: null // Existing add button to use
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// Tabular inlines ---------------------------------------------------------
|
// Tabular inlines ---------------------------------------------------------
|
||||||
$.fn.tabularFormset = function(options) {
|
$.fn.tabularFormset = function(selector, options) {
|
||||||
var $rows = $(this);
|
var $rows = $(this);
|
||||||
var alternatingRows = function(row) {
|
var alternatingRows = function(row) {
|
||||||
$($rows.selector).not(".add-row").removeClass("row1 row2")
|
$(selector).not(".add-row").removeClass("row1 row2")
|
||||||
.filter(":even").addClass("row1").end()
|
.filter(":even").addClass("row1").end()
|
||||||
.filter(":odd").addClass("row2");
|
.filter(":odd").addClass("row2");
|
||||||
};
|
};
|
||||||
|
|
||||||
var reinitDateTimeShortCuts = function() {
|
var reinitDateTimeShortCuts = function() {
|
||||||
|
@ -212,10 +212,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
// Stacked inlines ---------------------------------------------------------
|
// Stacked inlines ---------------------------------------------------------
|
||||||
$.fn.stackedFormset = function(options) {
|
$.fn.stackedFormset = function(selector, options) {
|
||||||
var $rows = $(this);
|
var $rows = $(this);
|
||||||
var updateInlineLabel = function(row) {
|
var updateInlineLabel = function(row) {
|
||||||
$($rows.selector).find(".inline_label").each(function(i) {
|
$(selector).find(".inline_label").each(function(i) {
|
||||||
var count = i + 1;
|
var count = i + 1;
|
||||||
$(this).html($(this).html().replace(/(#\d+)/g, "#" + count));
|
$(this).html($(this).html().replace(/(#\d+)/g, "#" + count));
|
||||||
});
|
});
|
||||||
|
@ -281,13 +281,16 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$(".js-inline-admin-formset").each(function() {
|
$(".js-inline-admin-formset").each(function() {
|
||||||
var data = $(this).data(),
|
var data = $(this).data(),
|
||||||
inlineOptions = data.inlineFormset;
|
inlineOptions = data.inlineFormset,
|
||||||
|
selector;
|
||||||
switch(data.inlineType) {
|
switch(data.inlineType) {
|
||||||
case "stacked":
|
case "stacked":
|
||||||
$(inlineOptions.name + "-group .inline-related").stackedFormset(inlineOptions.options);
|
selector = inlineOptions.name + "-group .inline-related";
|
||||||
|
$(selector).stackedFormset(selector, inlineOptions.options);
|
||||||
break;
|
break;
|
||||||
case "tabular":
|
case "tabular":
|
||||||
$(inlineOptions.name + "-group .tabular.inline-related tbody tr").tabularFormset(inlineOptions.options);
|
selector = inlineOptions.name + "-group .tabular.inline-related tbody:first > tr";
|
||||||
|
$(selector).tabularFormset(selector, inlineOptions.options);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
(function(c){c.fn.formset=function(b){var a=c.extend({},c.fn.formset.defaults,b),d=c(this);b=d.parent();var k=function(a,g,l){var b=new RegExp("("+g+"-(\\d+|__prefix__))");g=g+"-"+l;c(a).prop("for")&&c(a).prop("for",c(a).prop("for").replace(b,g));a.id&&(a.id=a.id.replace(b,g));a.name&&(a.name=a.name.replace(b,g))},e=c("#id_"+a.prefix+"-TOTAL_FORMS").prop("autocomplete","off"),l=parseInt(e.val(),10),g=c("#id_"+a.prefix+"-MAX_NUM_FORMS").prop("autocomplete","off"),h=""===g.val()||0<g.val()-e.val();
|
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.findInternal=function(b,d,a){b instanceof String&&(b=String(b));for(var c=b.length,f=0;f<c;f++){var g=b[f];if(d.call(a,g,f,b))return{i:f,v:g}}return{i:-1,v:void 0}};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.defineProperty=$jscomp.ASSUME_ES5||"function"==typeof Object.defineProperties?Object.defineProperty:function(b,d,a){b!=Array.prototype&&b!=Object.prototype&&(b[d]=a.value)};
|
||||||
d.each(function(g){c(this).not("."+a.emptyCssClass).addClass(a.formCssClass)});if(d.length&&h){var m=a.addButton;null===m&&("TR"===d.prop("tagName")?(d=this.eq(-1).children().length,b.append('<tr class="'+a.addCssClass+'"><td colspan="'+d+'"><a href="#">'+a.addText+"</a></tr>"),m=b.find("tr:last a")):(d.filter(":last").after('<div class="'+a.addCssClass+'"><a href="#">'+a.addText+"</a></div>"),m=d.filter(":last").next().find("a")));m.click(function(b){b.preventDefault();b=c("#"+a.prefix+"-empty");
|
$jscomp.getGlobal=function(b){return"undefined"!=typeof window&&window===b?b:"undefined"!=typeof global&&null!=global?global:b};$jscomp.global=$jscomp.getGlobal(this);$jscomp.polyfill=function(b,d,a,c){if(d){a=$jscomp.global;b=b.split(".");for(c=0;c<b.length-1;c++){var f=b[c];f in a||(a[f]={});a=a[f]}b=b[b.length-1];c=a[b];d=d(c);d!=c&&null!=d&&$jscomp.defineProperty(a,b,{configurable:!0,writable:!0,value:d})}};
|
||||||
var f=b.clone(!0);f.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id",a.prefix+"-"+l);f.is("tr")?f.children(":last").append('<div><a class="'+a.deleteCssClass+'" href="#">'+a.deleteText+"</a></div>"):f.is("ul")||f.is("ol")?f.append('<li><a class="'+a.deleteCssClass+'" href="#">'+a.deleteText+"</a></li>"):f.children(":first").append('<span><a class="'+a.deleteCssClass+'" href="#">'+a.deleteText+"</a></span>");f.find("*").each(function(){k(this,a.prefix,e.val())});f.insertBefore(c(b));
|
$jscomp.polyfill("Array.prototype.find",function(b){return b?b:function(b,a){return $jscomp.findInternal(this,b,a).v}},"es6","es3");
|
||||||
c(e).val(parseInt(e.val(),10)+1);l+=1;""!==g.val()&&0>=g.val()-e.val()&&m.parent().hide();f.find("a."+a.deleteCssClass).click(function(b){b.preventDefault();f.remove();--l;a.removed&&a.removed(f);c(document).trigger("formset:removed",[f,a.prefix]);b=c("."+a.formCssClass);c("#id_"+a.prefix+"-TOTAL_FORMS").val(b.length);(""===g.val()||0<g.val()-b.length)&&m.parent().show();var h,d,e=function(){k(this,a.prefix,h)};h=0;for(d=b.length;h<d;h++)k(c(b).get(h),a.prefix,h),c(b.get(h)).find("*").each(e)});a.added&&
|
(function(b){b.fn.formset=function(d){var a=b.extend({},b.fn.formset.defaults,d),c=b(this);d=c.parent();var f=function(a,e,d){var c=new RegExp("("+e+"-(\\d+|__prefix__))");e=e+"-"+d;b(a).prop("for")&&b(a).prop("for",b(a).prop("for").replace(c,e));a.id&&(a.id=a.id.replace(c,e));a.name&&(a.name=a.name.replace(c,e))},g=b("#id_"+a.prefix+"-TOTAL_FORMS").prop("autocomplete","off"),h=parseInt(g.val(),10),e=b("#id_"+a.prefix+"-MAX_NUM_FORMS").prop("autocomplete","off"),m=""===e.val()||0<e.val()-g.val();
|
||||||
a.added(f);c(document).trigger("formset:added",[f,a.prefix])})}return this};c.fn.formset.defaults={prefix:"form",addText:"add another",deleteText:"remove",addCssClass:"add-row",deleteCssClass:"delete-row",emptyCssClass:"empty-row",formCssClass:"dynamic-form",added:null,removed:null,addButton:null};c.fn.tabularFormset=function(b){var a=c(this),d=function(b){c(a.selector).not(".add-row").removeClass("row1 row2").filter(":even").addClass("row1").end().filter(":odd").addClass("row2")},k=function(){"undefined"!==
|
c.each(function(e){b(this).not("."+a.emptyCssClass).addClass(a.formCssClass)});if(c.length&&m){var l=a.addButton;null===l&&("TR"===c.prop("tagName")?(c=this.eq(-1).children().length,d.append('<tr class="'+a.addCssClass+'"><td colspan="'+c+'"><a href="#">'+a.addText+"</a></tr>"),l=d.find("tr:last a")):(c.filter(":last").after('<div class="'+a.addCssClass+'"><a href="#">'+a.addText+"</a></div>"),l=c.filter(":last").next().find("a")));l.on("click",function(d){d.preventDefault();d=b("#"+a.prefix+"-empty");
|
||||||
typeof SelectFilter&&(c(".selectfilter").each(function(a,c){var b=c.name.split("-");SelectFilter.init(c.id,b[b.length-1],!1)}),c(".selectfilterstacked").each(function(a,c){var b=c.name.split("-");SelectFilter.init(c.id,b[b.length-1],!0)}))},e=function(a){a.find(".prepopulated_field").each(function(){var b=c(this).find("input, select, textarea"),h=b.data("dependency_list")||[],d=[];c.each(h,function(c,b){d.push("#"+a.find(".field-"+b).find("input, select, textarea").attr("id"))});d.length&&b.prepopulate(d,
|
var c=d.clone(!0);c.removeClass(a.emptyCssClass).addClass(a.formCssClass).attr("id",a.prefix+"-"+h);c.is("tr")?c.children(":last").append('<div><a class="'+a.deleteCssClass+'" href="#">'+a.deleteText+"</a></div>"):c.is("ul")||c.is("ol")?c.append('<li><a class="'+a.deleteCssClass+'" href="#">'+a.deleteText+"</a></li>"):c.children(":first").append('<span><a class="'+a.deleteCssClass+'" href="#">'+a.deleteText+"</a></span>");c.find("*").each(function(){f(this,a.prefix,g.val())});c.insertBefore(b(d));
|
||||||
b.attr("maxlength"))})};a.formset({prefix:b.prefix,addText:b.addText,formCssClass:"dynamic-"+b.prefix,deleteCssClass:"inline-deletelink",deleteText:b.deleteText,emptyCssClass:"empty-form",removed:d,added:function(a){e(a);"undefined"!==typeof DateTimeShortcuts&&(c(".datetimeshortcuts").remove(),DateTimeShortcuts.init());k();d(a)},addButton:b.addButton});return a};c.fn.stackedFormset=function(b){var a=c(this),d=function(b){c(a.selector).find(".inline_label").each(function(a){a+=1;c(this).html(c(this).html().replace(/(#\d+)/g,
|
b(g).val(parseInt(g.val(),10)+1);h+=1;""!==e.val()&&0>=e.val()-g.val()&&l.parent().hide();c.find("a."+a.deleteCssClass).on("click",function(d){d.preventDefault();c.remove();--h;a.removed&&a.removed(c);b(document).trigger("formset:removed",[c,a.prefix]);d=b("."+a.formCssClass);b("#id_"+a.prefix+"-TOTAL_FORMS").val(d.length);(""===e.val()||0<e.val()-d.length)&&l.parent().show();var m,g=function(){f(this,a.prefix,k)};var k=0;for(m=d.length;k<m;k++)f(b(d).get(k),a.prefix,k),b(d.get(k)).find("*").each(g)});
|
||||||
"#"+a))})},k=function(){"undefined"!==typeof SelectFilter&&(c(".selectfilter").each(function(a,c){var b=c.name.split("-");SelectFilter.init(c.id,b[b.length-1],!1)}),c(".selectfilterstacked").each(function(a,c){var b=c.name.split("-");SelectFilter.init(c.id,b[b.length-1],!0)}))},e=function(a){a.find(".prepopulated_field").each(function(){var b=c(this).find("input, select, textarea"),d=b.data("dependency_list")||[],e=[];c.each(d,function(b,c){e.push("#"+a.find(".form-row .field-"+c).find("input, select, textarea").attr("id"))});
|
a.added&&a.added(c);b(document).trigger("formset:added",[c,a.prefix])})}return this};b.fn.formset.defaults={prefix:"form",addText:"add another",deleteText:"remove",addCssClass:"add-row",deleteCssClass:"delete-row",emptyCssClass:"empty-row",formCssClass:"dynamic-form",added:null,removed:null,addButton:null};b.fn.tabularFormset=function(d,a){var c=b(this),f=function(a){b(d).not(".add-row").removeClass("row1 row2").filter(":even").addClass("row1").end().filter(":odd").addClass("row2")},g=function(){"undefined"!==
|
||||||
e.length&&b.prepopulate(e,b.attr("maxlength"))})};a.formset({prefix:b.prefix,addText:b.addText,formCssClass:"dynamic-"+b.prefix,deleteCssClass:"inline-deletelink",deleteText:b.deleteText,emptyCssClass:"empty-form",removed:d,added:function(a){e(a);"undefined"!==typeof DateTimeShortcuts&&(c(".datetimeshortcuts").remove(),DateTimeShortcuts.init());k();d(a)},addButton:b.addButton});return a};c(document).ready(function(){c(".js-inline-admin-formset").each(function(){var b=c(this).data(),a=b.inlineFormset;
|
typeof SelectFilter&&(b(".selectfilter").each(function(b,a){b=a.name.split("-");SelectFilter.init(a.id,b[b.length-1],!1)}),b(".selectfilterstacked").each(function(b,a){b=a.name.split("-");SelectFilter.init(a.id,b[b.length-1],!0)}))},h=function(a){a.find(".prepopulated_field").each(function(){var c=b(this).find("input, select, textarea"),d=c.data("dependency_list")||[],e=[];b.each(d,function(b,c){e.push("#"+a.find(".field-"+c).find("input, select, textarea").attr("id"))});e.length&&c.prepopulate(e,
|
||||||
switch(b.inlineType){case "stacked":c(a.name+"-group .inline-related").stackedFormset(a.options);break;case "tabular":c(a.name+"-group .tabular.inline-related tbody tr").tabularFormset(a.options)}})})})(django.jQuery);
|
c.attr("maxlength"))})};c.formset({prefix:a.prefix,addText:a.addText,formCssClass:"dynamic-"+a.prefix,deleteCssClass:"inline-deletelink",deleteText:a.deleteText,emptyCssClass:"empty-form",removed:f,added:function(a){h(a);"undefined"!==typeof DateTimeShortcuts&&(b(".datetimeshortcuts").remove(),DateTimeShortcuts.init());g();f(a)},addButton:a.addButton});return c};b.fn.stackedFormset=function(d,a){var c=b(this),f=function(a){b(d).find(".inline_label").each(function(a){a+=1;b(this).html(b(this).html().replace(/(#\d+)/g,
|
||||||
|
"#"+a))})},g=function(){"undefined"!==typeof SelectFilter&&(b(".selectfilter").each(function(a,b){a=b.name.split("-");SelectFilter.init(b.id,a[a.length-1],!1)}),b(".selectfilterstacked").each(function(a,b){a=b.name.split("-");SelectFilter.init(b.id,a[a.length-1],!0)}))},h=function(a){a.find(".prepopulated_field").each(function(){var c=b(this).find("input, select, textarea"),d=c.data("dependency_list")||[],e=[];b.each(d,function(b,c){e.push("#"+a.find(".form-row .field-"+c).find("input, select, textarea").attr("id"))});
|
||||||
|
e.length&&c.prepopulate(e,c.attr("maxlength"))})};c.formset({prefix:a.prefix,addText:a.addText,formCssClass:"dynamic-"+a.prefix,deleteCssClass:"inline-deletelink",deleteText:a.deleteText,emptyCssClass:"empty-form",removed:f,added:function(a){h(a);"undefined"!==typeof DateTimeShortcuts&&(b(".datetimeshortcuts").remove(),DateTimeShortcuts.init());g();f(a)},addButton:a.addButton});return c};b(document).ready(function(){b(".js-inline-admin-formset").each(function(){var d=b(this).data(),a=d.inlineFormset;
|
||||||
|
switch(d.inlineType){case "stacked":d=a.name+"-group .inline-related";b(d).stackedFormset(d,a.options);break;case "tabular":d=a.name+"-group .tabular.inline-related tbody:first > tr",b(d).tabularFormset(d,a.options)}})})})(django.jQuery);
|
||||||
|
|
|
@ -30,12 +30,12 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
prepopulatedField.data('_changed', false);
|
prepopulatedField.data('_changed', false);
|
||||||
prepopulatedField.change(function() {
|
prepopulatedField.on('change', function() {
|
||||||
prepopulatedField.data('_changed', true);
|
prepopulatedField.data('_changed', true);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!prepopulatedField.val()) {
|
if (!prepopulatedField.val()) {
|
||||||
$(dependencies.join(',')).keyup(populate).change(populate).focus(populate);
|
$(dependencies.join(',')).on('keyup change focus', populate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
(function(c){c.fn.prepopulate=function(e,f,g){return this.each(function(){var a=c(this),b=function(){if(!a.data("_changed")){var b=[];c.each(e,function(a,d){d=c(d);0<d.val().length&&b.push(d.val())});a.val(URLify(b.join(" "),f,g))}};a.data("_changed",!1);a.change(function(){a.data("_changed",!0)});a.val()||c(e.join(",")).keyup(b).change(b).focus(b)})}})(django.jQuery);
|
(function(b){b.fn.prepopulate=function(d,f,g){return this.each(function(){var a=b(this),h=function(){if(!a.data("_changed")){var e=[];b.each(d,function(a,c){c=b(c);0<c.val().length&&e.push(c.val())});a.val(URLify(e.join(" "),f,g))}};a.data("_changed",!1);a.on("change",function(){a.data("_changed",!0)});if(!a.val())b(d.join(",")).on("keyup change focus",h)})}})(django.jQuery);
|
||||||
|
|
|
@ -58,6 +58,14 @@
|
||||||
'ů': 'u', 'ž': 'z', 'Č': 'C', 'Ď': 'D', 'Ě': 'E', 'Ň': 'N', 'Ř': 'R',
|
'ů': 'u', 'ž': 'z', 'Č': 'C', 'Ď': 'D', 'Ě': 'E', 'Ň': 'N', 'Ř': 'R',
|
||||||
'Š': 'S', 'Ť': 'T', 'Ů': 'U', 'Ž': 'Z'
|
'Š': 'S', 'Ť': 'T', 'Ů': 'U', 'Ž': 'Z'
|
||||||
};
|
};
|
||||||
|
var SLOVAK_MAP = {
|
||||||
|
'á': 'a', 'ä': 'a', 'č': 'c', 'ď': 'd', 'é': 'e', 'í': 'i', 'ľ': 'l',
|
||||||
|
'ĺ': 'l', 'ň': 'n', 'ó': 'o', 'ô': 'o', 'ŕ': 'r', 'š': 's', 'ť': 't',
|
||||||
|
'ú': 'u', 'ý': 'y', 'ž': 'z',
|
||||||
|
'Á': 'a', 'Ä': 'A', 'Č': 'C', 'Ď': 'D', 'É': 'E', 'Í': 'I', 'Ľ': 'L',
|
||||||
|
'Ĺ': 'L', 'Ň': 'N', 'Ó': 'O', 'Ô': 'O', 'Ŕ': 'R', 'Š': 'S', 'Ť': 'T',
|
||||||
|
'Ú': 'U', 'Ý': 'Y', 'Ž': 'Z'
|
||||||
|
};
|
||||||
var POLISH_MAP = {
|
var POLISH_MAP = {
|
||||||
'ą': 'a', 'ć': 'c', 'ę': 'e', 'ł': 'l', 'ń': 'n', 'ó': 'o', 'ś': 's',
|
'ą': 'a', 'ć': 'c', 'ę': 'e', 'ł': 'l', 'ń': 'n', 'ó': 'o', 'ś': 's',
|
||||||
'ź': 'z', 'ż': 'z',
|
'ź': 'z', 'ż': 'z',
|
||||||
|
@ -108,6 +116,7 @@
|
||||||
RUSSIAN_MAP,
|
RUSSIAN_MAP,
|
||||||
UKRAINIAN_MAP,
|
UKRAINIAN_MAP,
|
||||||
CZECH_MAP,
|
CZECH_MAP,
|
||||||
|
SLOVAK_MAP,
|
||||||
POLISH_MAP,
|
POLISH_MAP,
|
||||||
LATVIAN_MAP,
|
LATVIAN_MAP,
|
||||||
ARABIC_MAP,
|
ARABIC_MAP,
|
||||||
|
@ -119,7 +128,7 @@
|
||||||
|
|
||||||
var Downcoder = {
|
var Downcoder = {
|
||||||
'Initialize': function() {
|
'Initialize': function() {
|
||||||
if (Downcoder.map) { // already made
|
if (Downcoder.map) { // already made
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Downcoder.map = {};
|
Downcoder.map = {};
|
||||||
|
@ -155,25 +164,32 @@
|
||||||
if (!allowUnicode) {
|
if (!allowUnicode) {
|
||||||
s = downcode(s);
|
s = downcode(s);
|
||||||
}
|
}
|
||||||
var removelist = [
|
var hasUnicodeChars = /[^\u0000-\u007f]/.test(s);
|
||||||
"a", "an", "as", "at", "before", "but", "by", "for", "from", "is",
|
// Remove English words only if the string contains ASCII (English)
|
||||||
"in", "into", "like", "of", "off", "on", "onto", "per", "since",
|
// characters.
|
||||||
"than", "the", "this", "that", "to", "up", "via", "with"
|
if (!hasUnicodeChars) {
|
||||||
];
|
var removeList = [
|
||||||
var r = new RegExp('\\b(' + removelist.join('|') + ')\\b', 'gi');
|
"a", "an", "as", "at", "before", "but", "by", "for", "from",
|
||||||
s = s.replace(r, '');
|
"is", "in", "into", "like", "of", "off", "on", "onto", "per",
|
||||||
|
"since", "than", "the", "this", "that", "to", "up", "via",
|
||||||
|
"with"
|
||||||
|
];
|
||||||
|
var r = new RegExp('\\b(' + removeList.join('|') + ')\\b', 'gi');
|
||||||
|
s = s.replace(r, '');
|
||||||
|
}
|
||||||
// if downcode doesn't hit, the char will be stripped here
|
// if downcode doesn't hit, the char will be stripped here
|
||||||
if (allowUnicode) {
|
if (allowUnicode) {
|
||||||
// Keep Unicode letters including both lowercase and uppercase
|
// Keep Unicode letters including both lowercase and uppercase
|
||||||
// characters, whitespace, and dash; remove other characters.
|
// characters, whitespace, and dash; remove other characters.
|
||||||
s = XRegExp.replace(s, XRegExp('[^-_\\p{L}\\p{N}\\s]', 'g'), '');
|
s = XRegExp.replace(s, XRegExp('[^-_\\p{L}\\p{N}\\s]', 'g'), '');
|
||||||
} else {
|
} else {
|
||||||
s = s.replace(/[^-\w\s]/g, ''); // remove unneeded chars
|
s = s.replace(/[^-\w\s]/g, ''); // remove unneeded chars
|
||||||
}
|
}
|
||||||
s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
|
s = s.replace(/^\s+|\s+$/g, ''); // trim leading/trailing spaces
|
||||||
s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens
|
s = s.replace(/[-\s]+/g, '-'); // convert spaces to hyphens
|
||||||
s = s.toLowerCase(); // convert to lowercase
|
s = s.substring(0, num_chars); // trim to first num_chars chars
|
||||||
return s.substring(0, num_chars); // trim to first num_chars chars
|
s = s.replace(/-+$/g, ''); // trim any trailing hyphens
|
||||||
|
return s.toLowerCase(); // convert to lowercase
|
||||||
}
|
}
|
||||||
window.URLify = URLify;
|
window.URLify = URLify;
|
||||||
})();
|
})();
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
|
@ -6,14 +6,14 @@
|
||||||
path="*"
|
path="*"
|
||||||
verb="*"
|
verb="*"
|
||||||
modules="FastCgiModule"
|
modules="FastCgiModule"
|
||||||
scriptProcessor="c:\python35\python.exe|c:\python35\lib\site-packages\wfastcgi.py"
|
scriptProcessor="c:\python36\python.exe|c:\python36\lib\site-packages\wfastcgi.py"
|
||||||
resourceType="Unspecified"
|
resourceType="Unspecified"
|
||||||
requireAccess="Script"/>
|
requireAccess="Script"/>
|
||||||
</handlers>
|
</handlers>
|
||||||
</system.webServer>
|
</system.webServer>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
|
<add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
|
||||||
<add key="PYTHONPATH" value="d:\caoqianming\mysite" />
|
<add key="PYTHONPATH" value="d:\safesite" />
|
||||||
<add key="DJANGO_SETTINGS_MODULE" value="mysite.settings" />
|
<add key="DJANGO_SETTINGS_MODULE" value="mysite.settings" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
|
@ -0,0 +1,5 @@
|
||||||
|
import os,datetime,time
|
||||||
|
while True:
|
||||||
|
os.system('python D:\mysite\manage.py clearsessions')
|
||||||
|
print('清除过期session成功--'+ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
||||||
|
time.sleep(60*60*24)
|
|
@ -0,0 +1,12 @@
|
||||||
|
import requests,time,json,datetime
|
||||||
|
|
||||||
|
def gettoken():
|
||||||
|
r=requests.get('https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx4d75244c1b980b5b&secret=edf7d23a457fb4df5ad47eeb9d4b7a39').text
|
||||||
|
token=json.loads(r)['access_token']
|
||||||
|
with open('D:/safesite/safesite/token.txt','w') as f:
|
||||||
|
f.write(token)
|
||||||
|
while True:
|
||||||
|
gettoken()
|
||||||
|
print('微信token读取----'+ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
||||||
|
time.sleep(600)
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
import datetime,time,os,schedule
|
||||||
|
|
||||||
|
#filepath = 'E:/safeyunbackup/'+filename
|
||||||
|
#backstr = 'C:/PostgreSQL/10/bin/pg_dump -h localhost -U postgres safedb > '+ filepath
|
||||||
|
#os.system(backstr)
|
||||||
|
#print(filename +'备份成功')
|
||||||
|
|
||||||
|
def backup():
|
||||||
|
os.system('save.bat')
|
||||||
|
filename = 'safedb_'+ datetime.datetime.now().strftime("%Y-%m-%d")
|
||||||
|
print('pg备份成功--'+ filename)
|
||||||
|
|
||||||
|
def clearsession():
|
||||||
|
os.system('python D:\mysite\manage.py clearsessions')
|
||||||
|
print('清除过期session成功--'+ datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
|
||||||
|
|
||||||
|
schedule.every().day.at("01:30").do(backup)
|
||||||
|
#schedule.every(6).hour.do(backup)
|
||||||
|
|
||||||
|
while True:
|
||||||
|
schedule.run_pending()
|
||||||
|
time.sleep(1)
|
|
@ -0,0 +1,18 @@
|
||||||
|
@ECHO OFF
|
||||||
|
@setlocal enableextensions
|
||||||
|
@cd /d "%~dp0"
|
||||||
|
|
||||||
|
set PGPASSWORD=cTc1111Qa
|
||||||
|
SET PGPATH=C:\PostgreSQL\10\bin\
|
||||||
|
SET SVPATH=E:\safeyunbackup\
|
||||||
|
SET PRJDB=safedb
|
||||||
|
SET DBUSR=postgres
|
||||||
|
FOR /F "TOKENS=1,2,3 DELIMS=/ " %%i IN ('DATE /T') DO SET d=%%i-%%j-%%k
|
||||||
|
|
||||||
|
SET DBDUMP=%PRJDB%_%d%.bak
|
||||||
|
@ECHO OFF
|
||||||
|
%PGPATH%pg_dump -h localhost -U postgres %PRJDB% > %SVPATH%%DBDUMP%
|
||||||
|
|
||||||
|
echo Backup Taken Complete %SVPATH%%DBDUMP%
|
||||||
|
|
||||||
|
forfiles /p %SVPATH% /d -5 /c "cmd /c echo deleting @file ... && del /f @path"
|
Loading…
Reference in New Issue