Skip to content

Commit f58b6df

Browse files
committed
Started work on data script upload support, added MIT License
1 parent 1078669 commit f58b6df

File tree

7 files changed

+71
-3
lines changed

7 files changed

+71
-3
lines changed

api/controllers/AnalyticController.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ var UPLOAD_PATH = sails.config.paths.UPLOAD_PATH,
3838
STORED_SCAFFOLDS_PATH = sails.config.paths.STORED_SCAFFOLDS_PATH,
3939
ANALYTICS_ASSETS_PATH = sails.config.paths.ANALYTICS_ASSETS_PATH,
4040
ANALYTICS_REWRITE_PATH = sails.config.paths.ANALYTICS_REWRITE_PATH,
41+
ANALYTICS_DATA_SCRIPTS_PATH = sails.config.paths.ANALYTICS_SCRIPT_PATH,
4142
MAIN_FILE = 'main.html',
4243
ARCHIVE_TYPES = ['zip'];
4344

@@ -149,6 +150,8 @@ function linkAssets(html, type, userID, analyticID) {
149150
}
150151
}
151152
}
153+
154+
// TODO: Parse and remove common classes, such as "container" or "wrapper" or "banner"
152155
return $.html();
153156
}
154157

@@ -248,6 +251,11 @@ function scaffoldAnalytics(pathToFile, type, fileName, userID, analyticID, next)
248251
}
249252
}
250253

254+
// TODO
255+
function moveDataScripts(pathToExtractedFile, moveToFolder) {
256+
// Move the "preprocessing" folder to "moveToFolder"
257+
}
258+
251259
module.exports = {
252260

253261
/**
@@ -256,7 +264,7 @@ module.exports = {
256264
*/
257265
_config: {},
258266

259-
// Approve a analytic
267+
// Approve an analytic module
260268
approve: function(req, res) {
261269
Analytic.findOne(req.param('id')).populate('owner').exec(function (err, analytic) {
262270
if (err) {
@@ -283,6 +291,10 @@ module.exports = {
283291
}
284292

285293
var pathToExtractedFile = path.join(EXTRACT_PATH, type, userID, noExtFileName);
294+
295+
// TODO: Move data scripts to run, include a README for data scripts
296+
//moveDataScripts(pathToExtractedFile, ANALYTICS_DATA_SCRIPTS_PATH)
297+
286298
scaffoldAnalytics(pathToExtractedFile, type, MAIN_FILE, userID, analytic.id, function (err, success) {
287299
if (success) {
288300
sails.log('Success during scaffold');

api/controllers/HomeController.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ module.exports = {
5555
})
5656
},
5757

58+
license: function(req, res) {
59+
res.view({
60+
title: 'MIT License'
61+
})
62+
},
63+
5864
contact: function(req, res) {
5965
res.view({
6066
title: 'Contact'

bin/setup/setup.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ echo ""
1212
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1313

1414
DATASET_FOLDERS=( "encrypted" "extracted" "available" "available/non_pii" "available/pii" )
15-
ANALYTIC_FOLDERS=(tmp archives)
15+
ANALYTIC_FOLDERS=("tmp" "archives")
1616
LOG_FILES=(production.log development.log)
17+
DATA_SCRIPTS=( "analytics" )
1718

1819
DATABASE_SETUP=db_setup.sql
1920

2021
ERRORS=0
2122

2223
for folder in "${DATASET_FOLDERS[@]}"; do CREATE="$SCRIPT_PATH/../../../datasets/${folder}"; echo "[x] Creating $CREATE"; mkdir -p "$CREATE"; done
2324
for folder in "${ANALYTIC_FOLDERS[@]}"; do CREATE="$SCRIPT_PATH/../../../analytics/${folder}"; echo "[x] Creating $CREATE"; mkdir -p "$CREATE"; done
25+
for folder in "${DATA_SCRIPTS[@]}"; do CREATE="$SCRIPT_PATH/../../../data_scripts/${folder}"; echo "[x] Creating $CREATE"; mkdir -p "$CREATE"; done
26+
2427

2528
mkdir -p "$SCRIPT_PATH/../../logs"
2629

config/paths.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ module.exports.paths = {
77
EXTRACT_PATH: path.resolve('..', 'analytics', 'tmp'),
88
PUBLIC_SHARE_PATH: path.resolve('views', 'analyticdisplay', 'share'),
99

10+
// Data scripts
11+
ANALYTICS_SCRIPTS_PATH: path.resolve('..', 'data_scripts', 'analytics'),
12+
1013
// Stored Scaffolds Folder
1114
STORED_SCAFFOLDS_PATH: path.resolve('assets', 'scaffolds'),
1215

config/routes.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ module.exports.routes = {
5252
action: 'privacy'
5353
},
5454

55+
'/license': {
56+
controller: 'home',
57+
action: 'license'
58+
},
59+
5560
'/contact': {
5661
controller: 'home',
5762
action: 'contact'

views/home/license.ejs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<div class="mini-banner auto">
2+
<div class="container">
3+
<h2>License</h2>
4+
</div>
5+
</div>
6+
<div class="sub-banner">
7+
<div class="container">
8+
<h2>MIT License</h2>
9+
</div>
10+
</div>
11+
<div class="container wrapper">
12+
<p>
13+
The MIT License (MIT)
14+
</p>
15+
<p>
16+
Copyright (c) 2014-2015 moocRP.
17+
</p>
18+
<p>
19+
Permission is hereby granted, free of charge, to any person obtaining a copy
20+
of this software and associated documentation files (the "Software"), to deal
21+
in the Software without restriction, including without limitation the rights
22+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23+
copies of the Software, and to permit persons to whom the Software is
24+
furnished to do so, subject to the following conditions:
25+
</p>
26+
<p>
27+
The above copyright notice and this permission notice shall be included in
28+
all copies or substantial portions of the Software.
29+
</p>
30+
<p>
31+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
37+
THE SOFTWARE.
38+
</p>
39+
</div>

views/layout.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
<p>Find a bug? Report it <a href="/contact">here</a>!</p>
124124
</div>
125125
<div class="pull-right">
126-
<div>MIT License - <a href="/tos">Terms of Use</a> - <a href="/privacy">Privacy Policy</a> - <a href="/contact">Contact</a></div>
126+
<div><a href="/license">MIT License</a> - <a href="/tos">Terms of Use</a> - <a href="/privacy">Privacy Policy</a> - <a href="/contact">Contact</a></div>
127127
</div>
128128
<br>
129129
<div class="pull-right">

0 commit comments

Comments
 (0)