psdi-data-conversion 0.0.35__py3-none-any.whl → 0.0.36__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. psdi_data_conversion/app.py +23 -3
  2. psdi_data_conversion/constants.py +2 -0
  3. psdi_data_conversion/converter.py +16 -6
  4. psdi_data_conversion/converters/atomsk.py +3 -1
  5. psdi_data_conversion/converters/base.py +99 -39
  6. psdi_data_conversion/converters/c2x.py +3 -1
  7. psdi_data_conversion/converters/openbabel.py +40 -1
  8. psdi_data_conversion/database.py +5 -0
  9. psdi_data_conversion/main.py +18 -10
  10. psdi_data_conversion/static/content/accessibility.htm +5 -5
  11. psdi_data_conversion/static/content/convert.htm +18 -13
  12. psdi_data_conversion/static/content/convertato.htm +40 -33
  13. psdi_data_conversion/static/content/convertc2x.htm +40 -33
  14. psdi_data_conversion/static/content/documentation.htm +4 -4
  15. psdi_data_conversion/static/content/download.htm +4 -1
  16. psdi_data_conversion/static/content/feedback.htm +4 -4
  17. psdi_data_conversion/static/content/index-versions/psdi-common-header.html +1 -1
  18. psdi_data_conversion/static/content/psdi-common-header.html +1 -1
  19. psdi_data_conversion/static/content/report.htm +9 -7
  20. psdi_data_conversion/static/javascript/common.js +20 -0
  21. psdi_data_conversion/static/javascript/convert.js +1 -2
  22. psdi_data_conversion/static/javascript/convert_common.js +80 -7
  23. psdi_data_conversion/static/javascript/convertato.js +1 -2
  24. psdi_data_conversion/static/javascript/convertc2x.js +1 -2
  25. psdi_data_conversion/static/javascript/format.js +12 -0
  26. psdi_data_conversion/static/javascript/report.js +6 -0
  27. psdi_data_conversion/static/styles/format.css +0 -6
  28. psdi_data_conversion/static/styles/psdi-common.css +5 -2
  29. psdi_data_conversion/templates/index.htm +4 -1
  30. psdi_data_conversion/testing/conversion_test_specs.py +240 -149
  31. psdi_data_conversion/testing/utils.py +22 -7
  32. {psdi_data_conversion-0.0.35.dist-info → psdi_data_conversion-0.0.36.dist-info}/METADATA +29 -6
  33. {psdi_data_conversion-0.0.35.dist-info → psdi_data_conversion-0.0.36.dist-info}/RECORD +36 -36
  34. {psdi_data_conversion-0.0.35.dist-info → psdi_data_conversion-0.0.36.dist-info}/WHEEL +0 -0
  35. {psdi_data_conversion-0.0.35.dist-info → psdi_data_conversion-0.0.36.dist-info}/entry_points.txt +0 -0
  36. {psdi_data_conversion-0.0.35.dist-info → psdi_data_conversion-0.0.36.dist-info}/licenses/LICENSE +0 -0
@@ -15,16 +15,18 @@
15
15
  <link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:700" rel="stylesheet" type="text/css">
16
16
 
17
17
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
18
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.slim.min.js"></script>
18
+
19
+ <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
20
+ crossorigin="anonymous"></script>
19
21
  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
20
22
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
21
-
22
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
23
+ <script src="https://cdn.jsdelivr.net/jquery.dirtyforms/2.0.0/jquery.dirtyforms.min.js"></script>
23
24
 
24
25
  <link rel="stylesheet" href="../styles/format.css">
25
26
  <script src="../javascript/load_accessibility.js"></script>
26
27
  <script src="../javascript/common.js" type="module"></script>
27
28
  <script src="../javascript/psdi-common.js" type="module"></script>
29
+ <script src="../javascript/convert.js" type="module" language="JavaScript"></script>
28
30
  </head>
29
31
 
30
32
  <body marginwidth="0">
@@ -40,8 +42,13 @@
40
42
  </div>
41
43
  </div>
42
44
 
43
- <form name="gui">
45
+ <form name="gui" class="gui">
44
46
  <div class="max-width-box">
47
+ <a href="../../">
48
+ <input type="button" class="button" value=" ← Return to Format Selection " name="returnHome" id="returnHome">
49
+ </a>
50
+ <br>
51
+ <br>
45
52
  <p>Zero to two option flag select boxes and zero to two sets of option flag check boxes may be displayed,
46
53
  depending on the conversion and the degree of completion of the database. Further information may be displayed
47
54
  underneath the select boxes if available. One or more input or output flags may be selected if required (command
@@ -54,7 +61,7 @@
54
61
  <div id="inFlagList">
55
62
  <p>
56
63
  <label for="inFlags" id="in_label">Read (input) option flags
57
- (select all required):</label>
64
+ (hold CTRL to select multiple, or CTRL+click a selected option to unselect):</label>
58
65
  <div id="in_flag_break"></div>
59
66
  <select id="inFlags" class="large-width" size="4" multiple="multiple"></select>
60
67
  <div id=inFlagInfo></div>
@@ -63,7 +70,7 @@
63
70
  <div id="outFlagList">
64
71
  <p>
65
72
  <label for="outFlags" id="out_label">Write (output) option flags
66
- (select all required):</label>
73
+ (hold CTRL to select multiple, or CTRL+click a selected option to unselect):</label>
67
74
  <div id="out_flag_break"></div>
68
75
  <select id="outFlags" class="large-width" size="4" multiple="multiple"></select>
69
76
  <div id=outFlagInfo></div>
@@ -104,14 +111,15 @@
104
111
  <input type="radio" name="coordOptions" id="coordOptions" value="better" disabled=true> better
105
112
  <input type="radio" name="coordOptions" id="coordOptions" value="best" disabled=true> best
106
113
  </p>
107
- <p id="fileChecking">
108
- </p>
109
114
  <p id="convertFile">
110
115
  <input type="checkbox" checked id="extCheck"> Enforce file naming checking to ensure uploaded files (and files
111
116
  contained in archives) all have the correct extension<br>
112
117
  <input type="checkbox" id="requestLog"> Also download log file for the conversion<br>
113
- Select file to convert:
114
- <br><input type="file" name="fileToUpload" id="fileToUpload"><br>
118
+ Select file to convert<span class="max-file-size"></span>:
119
+ <br>
120
+ <input type="file" name="fileToUpload" id="fileToUpload">
121
+ <input type="button" class="button" value=" Clear Uploaded File " name="clearUpload" id="clearUpload">
122
+ <br>
115
123
  If you have sensitive data you might prefer to use
116
124
  <a href="download.htm">one of our downloadable tools or Python library</a> rather than uploading your data to
117
125
  our service.<br>
@@ -125,9 +133,6 @@
125
133
  </div>
126
134
  </form>
127
135
 
128
- <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
129
- crossorigin="anonymous"></script>
130
- <script src="../javascript/convert.js" type="module" language="JavaScript"></script>
131
136
 
132
137
  <footer class="footer" id="psdi-footer"></footer>
133
138
 
@@ -15,16 +15,18 @@
15
15
  <link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:700" rel="stylesheet" type="text/css">
16
16
 
17
17
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
18
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.slim.min.js"></script>
18
+
19
+ <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
20
+ crossorigin="anonymous"></script>
19
21
  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
20
22
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
21
-
22
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
23
+ <script src="https://cdn.jsdelivr.net/jquery.dirtyforms/2.0.0/jquery.dirtyforms.min.js"></script>
23
24
 
24
25
  <link rel="stylesheet" href="../styles/format.css">
25
26
  <script src="../javascript/load_accessibility.js"></script>
26
27
  <script src="../javascript/common.js" type="module"></script>
27
28
  <script src="../javascript/psdi-common.js" type="module"></script>
29
+ <script src="../javascript/convertato.js" type="module" language="JavaScript"></script>
28
30
  </head>
29
31
 
30
32
  <body marginwidth="0">
@@ -40,39 +42,44 @@
40
42
  </div>
41
43
  </div>
42
44
 
43
- <form name="gui">
44
- <div>
45
- <p>
46
- Click on 'Choose file' and then select an input file of the correct format (and extension). Clicking on
47
- 'Convert'
48
- uploads and converts the file. The output file is automatically downloaded, along with a log file. If any issues
49
- are
50
- encountered (e.g., the output file does not download), please click on 'Provide Feedback' in the navigation bar.
51
- </p>
52
- <h6 id="heading"></h6>
53
- <p id="convertFile">
54
- <input type="checkbox" checked id="extCheck"> Enforce file naming checking to ensure uploaded files (and files
55
- contained in archives) all have the correct extension<br>
56
- <input type="checkbox" id="requestLog"> Also download log file for the conversion<br>
57
- Select file to convert:
58
- <br><input type="file" name="fileToUpload" id="fileToUpload"><br>
59
- If you have sensitive data you might prefer to use
60
- <a href="download.htm">one of our downloadable tools or Python library</a> rather than uploading your data to
61
- our service.<br>
62
- <span class="convert-button-and-spinner">
63
- <input type="button" class="button init-disabled" value=" Convert " name="uploadButton" id="uploadButton"
64
- disabled=true>
65
- <span class="loading-spinner spinner-border"></span>
66
- </span>
67
- </p>
45
+ <form name="gui" class="gui">
46
+ <div class="max-width-box">
47
+ <div>
48
+ <a href="../../">
49
+ <input type="button" class="button" value=" ← Return to Format Selection " name="returnHome" id="returnHome">
50
+ </a>
51
+ <br>
52
+ <br>
53
+ <p>
54
+ Click on 'Choose file' and then select an input file of the correct format (and extension). Clicking on
55
+ 'Convert' uploads and converts the file. The output file is automatically downloaded, along with a log file.
56
+ If any issues are encountered (e.g., the output file does not download), please click on 'Provide Feedback' in
57
+ the navigation bar.
58
+ </p>
59
+ <h6 id="heading"></h6>
60
+ <p id="convertFile">
61
+ <input type="checkbox" checked id="extCheck"> Enforce file naming checking to ensure uploaded files (and files
62
+ contained in archives) all have the correct extension<br>
63
+ <input type="checkbox" id="requestLog"> Also download log file for the conversion<br>
64
+ Select file to convert<span class="max-file-size"></span>:
65
+ <br>
66
+ <input type="file" name="fileToUpload" id="fileToUpload">
67
+ <input type="button" class="button" value=" Clear Uploaded File " name="clearUpload" id="clearUpload">
68
+ <br>
69
+ If you have sensitive data you might prefer to use
70
+ <a href="download.htm">one of our downloadable tools or Python library</a> rather than uploading your data to
71
+ our service.<br>
72
+ <span class="convert-button-and-spinner">
73
+ <input type="button" class="button init-disabled" value=" Convert " name="uploadButton" id="uploadButton"
74
+ disabled=true>
75
+ <span class="loading-spinner spinner-border"></span>
76
+ </span>
77
+ </p>
78
+ </div>
79
+ <div class="largeGap"></div>
68
80
  </div>
69
- <div class="largeGap"></div>
70
81
  </form>
71
82
 
72
- <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
73
- crossorigin="anonymous"></script>
74
- <script src="../javascript/convertato.js" type="module" language="JavaScript"></script>
75
-
76
83
  <footer class="footer" id="psdi-footer"></footer>
77
84
 
78
85
  </body>
@@ -16,16 +16,18 @@
16
16
  <link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:700" rel="stylesheet" type="text/css">
17
17
 
18
18
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
19
- <script src="https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.slim.min.js"></script>
19
+
20
+ <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
21
+ crossorigin="anonymous"></script>
20
22
  <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
21
23
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js"></script>
22
-
23
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
24
+ <script src="https://cdn.jsdelivr.net/jquery.dirtyforms/2.0.0/jquery.dirtyforms.min.js"></script>
24
25
 
25
26
  <link rel="stylesheet" href="../styles/format.css">
26
27
  <script src="../javascript/load_accessibility.js"></script>
27
28
  <script src="../javascript/common.js" type="module"></script>
28
29
  <script src="../javascript/psdi-common.js" type="module"></script>
30
+ <script src="../javascript/convertc2x.js" type="module" language="JavaScript"></script>
29
31
  </head>
30
32
 
31
33
  <body marginwidth="0">
@@ -41,39 +43,44 @@
41
43
  </div>
42
44
  </div>
43
45
 
44
- <form name="gui">
45
- <div>
46
- <p>
47
- Click on 'Choose file' and then select an input file of the correct format (and extension). Clicking on
48
- 'Convert'
49
- uploads and converts the file. The output file is automatically downloaded, along with a log file. If any issues
50
- are
51
- encountered (e.g., the output file does not download), please click on 'Provide Feedback' in the navigation bar.
52
- </p>
53
- <h6 id="heading"></h6>
54
- <p id="convertFile">
55
- <input type="checkbox" checked id="extCheck"> Enforce file naming checking to ensure uploaded files (and files
56
- contained in archives) all have the correct extension<br>
57
- <input type="checkbox" id="requestLog"> Also download log file for the conversion<br>
58
- Select file to convert:
59
- <br><input type="file" name="fileToUpload" id="fileToUpload"><br>
60
- If you have sensitive data you might prefer to use
61
- <a href="download.htm">one of our downloadable tools or Python library</a> rather than uploading your data to
62
- our service.<br>
63
- <span class="convert-button-and-spinner">
64
- <input type="button" class="button init-disabled" value=" Convert " name="uploadButton" id="uploadButton"
65
- disabled=true>
66
- <span class="loading-spinner spinner-border"></span>
67
- </span>
68
- </p>
46
+ <form name="gui" class="gui">
47
+ <div class="max-width-box">
48
+ <div>
49
+ <a href="../../">
50
+ <input type="button" class="button" value=" ← Return to Format Selection " name="returnHome" id="returnHome">
51
+ </a>
52
+ <br>
53
+ <br>
54
+ <p>
55
+ Click on 'Choose file' and then select an input file of the correct format (and extension). Clicking on
56
+ 'Convert' uploads and converts the file. The output file is automatically downloaded, along with a log file.
57
+ If any issues are encountered (e.g., the output file does not download), please click on 'Provide Feedback' in
58
+ the navigation bar.
59
+ </p>
60
+ <h6 id="heading"></h6>
61
+ <p id="convertFile">
62
+ <input type="checkbox" checked id="extCheck"> Enforce file naming checking to ensure uploaded files (and files
63
+ contained in archives) all have the correct extension<br>
64
+ <input type="checkbox" id="requestLog"> Also download log file for the conversion<br>
65
+ Select file to convert<span class="max-file-size"></span>:
66
+ <br>
67
+ <input type="file" name="fileToUpload" id="fileToUpload">
68
+ <input type="button" class="button" value=" Clear Uploaded File " name="clearUpload" id="clearUpload">
69
+ <br>
70
+ If you have sensitive data you might prefer to use
71
+ <a href="download.htm">one of our downloadable tools or Python library</a> rather than uploading your data to
72
+ our service.<br>
73
+ <span class="convert-button-and-spinner">
74
+ <input type="button" class="button init-disabled" value=" Convert " name="uploadButton" id="uploadButton"
75
+ disabled=true>
76
+ <span class="loading-spinner spinner-border"></span>
77
+ </span>
78
+ </p>
79
+ </div>
80
+ <div class="largeGap"></div>
69
81
  </div>
70
- <div class="largeGap"></div>
71
82
  </form>
72
83
 
73
- <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
74
- crossorigin="anonymous"></script>
75
- <script src="../javascript/convertc2x.js" type="module" language="JavaScript"></script>
76
-
77
84
  <footer class="footer" id="psdi-footer"></footer>
78
85
 
79
86
  </body>
@@ -13,8 +13,11 @@
13
13
  <link href="https://fonts.googleapis.com/css?family=Lato:400" rel="stylesheet" type="text/css">
14
14
  <link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:700" rel="stylesheet" type="text/css">
15
15
  <link rel="stylesheet" href="../styles/format.css">
16
+
17
+ <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
18
+ crossorigin="anonymous"></script>
19
+
16
20
  <script src="../javascript/load_accessibility.js"></script>
17
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
18
21
  <script src="../javascript/common.js" type="module"></script>
19
22
  <script src="../javascript/psdi-common.js" type="module"></script>
20
23
  </head>
@@ -85,9 +88,6 @@
85
88
  </div>
86
89
  </form>
87
90
 
88
- <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
89
- crossorigin="anonymous"></script>
90
-
91
91
  <footer class="footer" id="psdi-footer"></footer>
92
92
 
93
93
  </body>
@@ -13,8 +13,11 @@
13
13
  <link href="https://fonts.googleapis.com/css?family=Lato:400" rel="stylesheet" type="text/css">
14
14
  <link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:700" rel="stylesheet" type="text/css">
15
15
  <link rel="stylesheet" href="../styles/format.css">
16
+
17
+ <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
18
+ crossorigin="anonymous"></script>
19
+
16
20
  <script src="../javascript/load_accessibility.js"></script>
17
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
18
21
  <script src="../javascript/common.js" type="module"></script>
19
22
  <script src="../javascript/psdi-common.js" type="module"></script>
20
23
  </head>
@@ -13,8 +13,11 @@
13
13
  <link href="https://fonts.googleapis.com/css?family=Lato:400" rel="stylesheet" type="text/css">
14
14
  <link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:700" rel="stylesheet" type="text/css">
15
15
  <link rel="stylesheet" href="../styles/format.css">
16
+
17
+ <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
18
+ crossorigin="anonymous"></script>
19
+
16
20
  <script src="../javascript/load_accessibility.js"></script>
17
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
18
21
  <script src="../javascript/common.js" type="module"></script>
19
22
  <script src="../javascript/psdi-common.js" type="module"></script>
20
23
  </head>
@@ -44,9 +47,6 @@
44
47
  </div>
45
48
  </form>
46
49
 
47
- <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
48
- crossorigin="anonymous"></script>
49
-
50
50
  <footer class="footer" id="psdi-footer"></footer>
51
51
 
52
52
  </body>
@@ -16,7 +16,7 @@
16
16
  </div>
17
17
  </div>
18
18
  <div class="navbar__items navbar__items--right">
19
- <!-- This file contains the links that will appear in the top-right of the header bar for .html files in the index.htm page. --> <a href="./" class="navbar__item navbar__link">Home</a> <a href="static/content/report.htm" class="navbar__item navbar__link">Report Missing Format/Conversion</a> <a href="static/content/feedback.htm" class="navbar__item navbar__link">Provide Feedback</a> <a href="static/content/documentation.htm" class="navbar__item navbar__link">Documentation</a> <a href="static/content/accessibility.htm" class="navbar__item navbar__link">Accessibility</a> <a href="mailto: psdi@soton.ac.uk" class="navbar__item navbar__link" id="mail">Contact</a>
19
+ <!-- This file contains the links that will appear in the top-right of the header bar for .html files in the index.htm page. --> <a href="./" class="navbar__item navbar__link">Home</a> <a href="static/content/report.htm" class="navbar__item navbar__link">Report Missing Format/Conversion</a> <a href="static/content/feedback.htm" class="navbar__item navbar__link">Provide Feedback</a> <a href="static/content/documentation.htm" class="navbar__item navbar__link">Documentation</a> <a href="static/content/download.htm" class="navbar__item navbar__link service-only">Download</a> <a href="static/content/accessibility.htm" class="navbar__item navbar__link">Accessibility</a> <a href="mailto: psdi@soton.ac.uk" class="navbar__item navbar__link" id="mail">Contact</a>
20
20
  <button class="clean-btn color-mode-toggle" title="Switch between dark and light mode"
21
21
  aria-label="Lightmode/darkmode toggle button">
22
22
  <img src="static/img/colormode-toggle-lm.svg" alt="Lightmode toggle icon"
@@ -16,7 +16,7 @@
16
16
  </div>
17
17
  </div>
18
18
  <div class="navbar__items navbar__items--right">
19
- <!-- This file contains the links that will appear in the top-right of the header bar for .html files in this directory. --> <a href="../../" class="navbar__item navbar__link">Home</a> <a href="report.htm" class="navbar__item navbar__link">Report Missing Format/Conversion</a> <a href="feedback.htm" class="navbar__item navbar__link">Provide Feedback</a> <a href="documentation.htm" class="navbar__item navbar__link">Documentation</a> <a href="accessibility.htm" class="navbar__item navbar__link">Accessibility</a> <a href="mailto:support@psdi.ac.uk" class="navbar__item navbar__link" id="mail">Contact Us</a>
19
+ <!-- This file contains the links that will appear in the top-right of the header bar for .html files in this directory. --> <a href="../../" class="navbar__item navbar__link">Home</a> <a href="report.htm" class="navbar__item navbar__link">Report Missing Format/Conversion</a> <a href="feedback.htm" class="navbar__item navbar__link">Provide Feedback</a> <a href="documentation.htm" class="navbar__item navbar__link">Documentation</a> <a href="download.htm" class="navbar__item navbar__link service-only">Download</a> <a href="accessibility.htm" class="navbar__item navbar__link">Accessibility</a> <a href="mailto:support@psdi.ac.uk" class="navbar__item navbar__link" id="mail">Contact Us</a>
20
20
  <button class="clean-btn color-mode-toggle" title="Switch between dark and light mode"
21
21
  aria-label="Lightmode/darkmode toggle button">
22
22
  <img src="../img/colormode-toggle-lm.svg" alt="Lightmode toggle icon"
@@ -13,10 +13,16 @@
13
13
  <link href="https://fonts.googleapis.com/css?family=Lato:400" rel="stylesheet" type="text/css">
14
14
  <link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:700" rel="stylesheet" type="text/css">
15
15
  <link rel="stylesheet" href="../styles/format.css">
16
+
17
+ <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
18
+ crossorigin="anonymous"></script>
19
+ <script src="https://cdn.jsdelivr.net/jquery.dirtyforms/2.0.0/jquery.dirtyforms.min.js"></script>
20
+
16
21
  <script src="../javascript/load_accessibility.js"></script>
17
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
18
22
  <script src="../javascript/common.js" type="module"></script>
19
23
  <script src="../javascript/psdi-common.js" type="module"></script>
24
+ <script src="../javascript/report.js" type="module" language="JavaScript"></script>
25
+
20
26
  </head>
21
27
 
22
28
  <body marginwidth="0">
@@ -32,7 +38,7 @@
32
38
  </div>
33
39
  </div>
34
40
 
35
- <form name="gui" class="service-only">
41
+ <form name="gui" class="gui service-only">
36
42
  <div class="max-width-box">
37
43
  <p>Select the type of report (missing file format or conversion) and then follow the instructions that appear.
38
44
  <p><b>Finally:</b> click on 'Report.'</p><br>
@@ -81,7 +87,7 @@
81
87
  </div>
82
88
  </form>
83
89
 
84
- <form name="gui" class="local-only">
90
+ <form name="gui" class="gui local-only">
85
91
  <div class="max-width-box">
86
92
  <div class="smallGap"></div>
87
93
  <p>
@@ -93,10 +99,6 @@
93
99
  </div>
94
100
  </form>
95
101
 
96
- <script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4="
97
- crossorigin="anonymous"></script>
98
- <script src="../javascript/report.js" type="module" language="JavaScript"></script>
99
-
100
102
  <footer class="footer" id="psdi-footer"></footer>
101
103
 
102
104
  </body>
@@ -4,6 +4,26 @@
4
4
  * @author Bryan Gillis
5
5
  */
6
6
 
7
+ export function initDirtyForms() {
8
+ $("form.gui").dirtyForms();
9
+ }
10
+
11
+ export function cleanDirtyForms() {
12
+ $('form.gui').dirtyForms('setClean');
13
+ }
14
+
15
+ export function dirtyDirtyForms() {
16
+ $('form.gui').dirtyForms('setDirty');
17
+ }
18
+
19
+ export function enableDirtyForms() {
20
+ $('form.gui').removeClass($.DirtyForms.ignoreClass);
21
+ }
22
+
23
+ export function disableDirtyForms() {
24
+ $('form.gui').addClass($.DirtyForms.ignoreClass);
25
+ }
26
+
7
27
 
8
28
  /**
9
29
  * Gets whether or not the app is operating in "Service mode"
@@ -10,14 +10,13 @@ import { getInputFlags, getOutputFlags, getInputArgFlags, getOutputArgFlags } fr
10
10
  import { commonConvertReady, convertFile, getExtCheck, splitArchiveExt, isArchiveExt } from "./convert_common.js"
11
11
 
12
12
  var token = "",
13
- max_file_size = 0,
14
13
  in_ext = "",
15
14
  out_ext = "",
16
15
  in_str = "",
17
16
  out_str = "";
18
17
 
19
18
  $(document).ready(function () {
20
- [token, max_file_size, in_str, in_ext, out_str, out_ext] = commonConvertReady("Open Babel");
19
+ [token, in_str, in_ext, out_str, out_ext] = commonConvertReady("Open Babel");
21
20
 
22
21
  $('input[name="coordinates"]').change(coordOptionAvailability);
23
22
  $("#uploadButton").click(submitFile);
@@ -3,6 +3,8 @@
3
3
  Version 1.0, 17th December 2024
4
4
  */
5
5
 
6
+ import { disableDirtyForms, enableDirtyForms, initDirtyForms } from "./common.js";
7
+
6
8
  const SECOND = 1000; // Milliseconds
7
9
  const CONVERT_TIMEOUT = 60 * SECOND;
8
10
  const MEGABYTE = 1024 * 1024;
@@ -31,7 +33,18 @@ var token = "",
31
33
 
32
34
  export function commonConvertReady(converter) {
33
35
  token = sessionStorage.getItem("token");
34
- max_file_size = sessionStorage.getItem("max_file_size");
36
+
37
+ // Open Babel uniquely has its own maximum file size
38
+ if (converter == "Open Babel") {
39
+ max_file_size = sessionStorage.getItem("max_file_size_ob");
40
+ } else {
41
+ max_file_size = sessionStorage.getItem("max_file_size");
42
+ }
43
+
44
+ // Set the text for displaying the maximum size
45
+ if (max_file_size > 0) {
46
+ $(".max-file-size").text(" (max size " + (max_file_size / MEGABYTE).toFixed(2) + " MB)");
47
+ }
35
48
 
36
49
  in_str = sessionStorage.getItem("in_str");
37
50
  out_str = sessionStorage.getItem("out_str");
@@ -48,17 +61,25 @@ export function commonConvertReady(converter) {
48
61
  $("#heading").html("Convert from \'" + in_ext + "\' (" + in_note + ") to \'" + out_ext + "\' (" + out_note +
49
62
  ") using " + converter);
50
63
 
64
+ // Connect the buttons to events
51
65
  $("#extCheck").click(setExtCheck);
52
66
  $("#requestLog").click(setRequestLog);
67
+ $("#clearUpload").click(clearUploadedFile);
68
+
69
+ // Connect the file upload to event and limit the types it can accept
53
70
  $("#fileToUpload").change(checkFile);
71
+ limitFileType();
72
+
73
+ initDirtyForms();
54
74
 
55
- return [token, max_file_size, in_str, in_ext, out_str, out_ext];
75
+ return [token, in_str, in_ext, out_str, out_ext];
56
76
  }
57
77
 
58
78
  // Converts user-supplied file to another format and downloads the resulting file
59
79
  export function convertFile(form_data, download_fname, fname) {
60
80
 
61
81
  showSpinner();
82
+ disableConvertButton();
62
83
 
63
84
  let convertTimedOut = false;
64
85
 
@@ -70,7 +91,12 @@ export function convertFile(form_data, download_fname, fname) {
70
91
  contentType: false,
71
92
  timeout: CONVERT_TIMEOUT,
72
93
  success: async function () {
94
+
73
95
  hideSpinner();
96
+ enableConvertButton();
97
+ clearUploadedFile();
98
+ disableDirtyForms();
99
+
74
100
  if (!convertTimedOut) {
75
101
  await downloadFile(`../downloads/${download_fname}`, download_fname)
76
102
 
@@ -109,6 +135,7 @@ export function convertFile(form_data, download_fname, fname) {
109
135
  },
110
136
  error: function (xmlhttprequest, textstatus, message) {
111
137
  hideSpinner();
138
+ enableConvertButton();
112
139
  if (textstatus === "timeout") {
113
140
  convertTimedOut = true;
114
141
  alert("ERROR: Conversion attempt timed out. This may be because the conversion is too complicated, " +
@@ -149,6 +176,13 @@ export function convertFile(form_data, download_fname, fname) {
149
176
 
150
177
  function setExtCheck(event) {
151
178
  extCheck = this.checked;
179
+
180
+ // Toggle whether or not the file upload limits uploaded type based on whether or not this box is ticked
181
+ if (extCheck) {
182
+ limitFileType();
183
+ } else {
184
+ unlimitFileType();
185
+ }
152
186
  }
153
187
 
154
188
  export function getExtCheck() {
@@ -195,6 +229,9 @@ export function isArchiveExt(ext) {
195
229
  // Check that the file meets requirements for upload
196
230
  function checkFile(event) {
197
231
 
232
+ // Enable dirty form checking whenever a file is uploaded
233
+ enableDirtyForms();
234
+
198
235
  let allGood = true;
199
236
  let file = this.files[0];
200
237
  let message = "";
@@ -226,15 +263,52 @@ function checkFile(event) {
226
263
  }
227
264
 
228
265
  if (allGood) {
229
- $("#uploadButton").css({ "background-color": "var(--ifm-color-primary)", "color": "var(--ifm-hero-text-color)" });
230
- $("#uploadButton").prop({ disabled: false });
266
+ enableConvertButton();
231
267
  } else {
232
- $("#uploadButton").css({ "background-color": "var(--psdi-bg-color-secondary)", "color": "gray" });
233
- $("#uploadButton").prop({ disabled: true });
268
+ disableConvertButton();
234
269
  alert(message);
235
270
  }
236
271
  }
237
272
 
273
+ /**
274
+ * Allow the file upload to only accept the expected type of file
275
+ */
276
+ function limitFileType() {
277
+ $("#fileToUpload")[0].accept = "." + in_ext;
278
+ }
279
+
280
+ /**
281
+ * Allow the file upload to accept any type of file
282
+ */
283
+ function unlimitFileType() {
284
+ $("#fileToUpload")[0].accept = "*";
285
+ }
286
+
287
+ /**
288
+ * Clear any uploaded file
289
+ */
290
+ function clearUploadedFile() {
291
+ $("#fileToUpload").val('');
292
+ disableConvertButton();
293
+ }
294
+
295
+ /**
296
+ * Enable the "Convert" button
297
+ */
298
+ function enableConvertButton() {
299
+ $("#uploadButton").css({ "background-color": "var(--ifm-color-primary)", "color": "var(--ifm-hero-text-color)" });
300
+ $("#uploadButton").prop({ disabled: false });
301
+ }
302
+
303
+
304
+ /**
305
+ * Disable the "Convert" button
306
+ */
307
+ function disableConvertButton() {
308
+ $("#uploadButton").css({ "background-color": "var(--psdi-bg-color-secondary)", "color": "gray" });
309
+ $("#uploadButton").prop({ disabled: true });
310
+ }
311
+
238
312
  /**
239
313
  * Start a download of a file
240
314
  *
@@ -256,7 +330,6 @@ async function downloadFile(path, filename) {
256
330
  });
257
331
  }
258
332
 
259
-
260
333
  /**
261
334
  * Show the loading spinner
262
335
  */
@@ -8,14 +8,13 @@
8
8
  import { commonConvertReady, convertFile, getExtCheck, splitArchiveExt, isArchiveExt } from "./convert_common.js"
9
9
 
10
10
  var token = "",
11
- max_file_size = 0,
12
11
  in_ext = "",
13
12
  out_ext = "",
14
13
  in_str = "",
15
14
  out_str = "";
16
15
 
17
16
  $(document).ready(function () {
18
- [token, max_file_size, in_str, in_ext, out_str, out_ext] = commonConvertReady("Atomsk");
17
+ [token, in_str, in_ext, out_str, out_ext] = commonConvertReady("Atomsk");
19
18
  $("#uploadButton").click(submitFile);
20
19
  });
21
20