-
Notifications
You must be signed in to change notification settings - Fork 12
Tutorial new structure #410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
3411036
set up manager dasboard to upload tutorial data #409
Hagellach37 64fb4f9
change datastructure for tutorials
Hagellach37 f47027e
add solid waste tutorial
Hagellach37 1aa571c
change db rules to query multiple tutorial to allow filter in the app
Hagellach37 45f787a
change db rules to query multiple tutorial to allow filter in the app
Hagellach37 84fe8f4
add image upload to tutorial creation page
Hagellach37 5cf43d7
add example images as attributes to tutorial
Hagellach37 2df97cc
add max tasks per project to project creation form
Hagellach37 9cf33ca
add max tasks per user to project creation
Hagellach37 c549009
small bugfix duplicate attribute for projectType
Hagellach37 d9f0a4e
maxTasksPerUser as integer
Hagellach37 6057749
add tutorial and add tutorial Id to project
Hagellach37 1412188
remove unused attributes from tutorial
Hagellach37 2376855
add tutorial creation workflow to run command
Hagellach37 71ce357
add script to add tutorialId to all projects
Hagellach37 4869863
work on comments
Hagellach37 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
194 changes: 194 additions & 0 deletions
194
manager_dashboard/manager_dashboard/js/forms-tutorial.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
//auto expand textarea | ||
function adjust_textarea(h) { | ||
h.style.height = "20px"; | ||
h.style.height = (h.scrollHeight)+"px"; | ||
} | ||
|
||
function initForm() { | ||
displayProjectTypeForm("build_area") | ||
} | ||
|
||
function openImageFile(event) { | ||
var input = event.target; | ||
console.log(event.target.id) | ||
element_id = event.target.id + 'File' | ||
|
||
var reader = new FileReader(); | ||
reader.onload = function(){ | ||
try { | ||
var dataURL = reader.result; | ||
var output = document.getElementById(element_id); | ||
output.src = dataURL; | ||
} | ||
catch(err) { | ||
element_id = event.target.id + 'Text' | ||
var output = document.getElementById(element_id); | ||
output.innerHTML = '<b>Error reading Image file</b><br>' + err; | ||
} | ||
}; | ||
reader.readAsDataURL(input.files[0]); | ||
}; | ||
|
||
function displayProjectTypeForm(projectType) { | ||
document.getElementById("projectType").value = projectType; | ||
switch (projectType) { | ||
case "build_area": | ||
displayTileServer("bing", "A"); | ||
document.getElementById("form_zoom_level").style.display = "block"; | ||
document.getElementById("form_tile_server_a").style.display = "block"; | ||
document.getElementById("form_tile_server_b").style.display = "None"; | ||
break; | ||
case "footprint": | ||
displayTileServer("bing", "A"); | ||
document.getElementById("form_zoom_level").style.display = "None"; | ||
document.getElementById("form_tile_server_a").style.display = "block"; | ||
document.getElementById("form_tile_server_b").style.display = "None"; | ||
break; | ||
case "change_detection": | ||
case "completeness": | ||
displayTileServer("bing", "A"); | ||
displayTileServer("bing", "B"); | ||
document.getElementById("form_zoom_level").style.display = "block"; | ||
document.getElementById("form_tile_server_a").style.display = "block"; | ||
document.getElementById("form_tile_server_b").style.display = "block"; | ||
break; | ||
} | ||
} | ||
|
||
function addTileServerCredits (tileServerName, which) { | ||
var credits = { | ||
"bing": "© 2019 Microsoft Corporation, Earthstar Geographics SIO", | ||
"maxar_premium": "© 2019 Maxar", | ||
"maxar_standard": "© 2019 Maxar", | ||
"esri": "© 2019 ESRI", | ||
"esri_beta": "© 2019 ESRI", | ||
"mapbox": "© 2019 MapBox", | ||
"sinergise": "© 2019 Sinergise", | ||
"custom": "Please add imagery credits here." | ||
} | ||
document.getElementById("tileServer"+which+"Credits").value = credits[tileServerName] | ||
} | ||
|
||
|
||
function displayTileServer (tileServerName, which) { | ||
switch (tileServerName) { | ||
case "custom": | ||
document.getElementById("tileServer"+which+"UrlField").style.display = "block"; | ||
document.getElementById("tileServer"+which+"LayerNameField").style.display = "block"; | ||
break; | ||
case "sinergise": | ||
document.getElementById("tileServer"+which+"UrlField").style.display = "None"; | ||
document.getElementById("tileServer"+which+"LayerNameField").style.display = "block"; | ||
break; | ||
default: | ||
document.getElementById("tileServer"+which+"UrlField").style.display = "None"; | ||
document.getElementById("tileServer"+which+"LayerNameField").style.display = "None"; | ||
} | ||
addTileServerCredits(tileServerName, which) | ||
} | ||
|
||
function clear_fields() { | ||
console.log('clear fields.') | ||
displayProjectTypeForm("build_area") | ||
} | ||
|
||
function displaySuccessMessage() { | ||
//document.getElementById("import-formular").style.display = "None"; | ||
alert('Your project has been uploaded. It can take up to one hour for the project to appear in the dashboard.') | ||
} | ||
|
||
function displayImportForm() { | ||
document.getElementById("import-formular").style.display = "block"; | ||
} | ||
|
||
function openJsonFile(event) { | ||
var input = event.target; | ||
|
||
// clear info field | ||
var info_output = document.getElementById("screenInfo"); | ||
info_output.innerHTML = ''; | ||
info_output.style.display = 'block' | ||
|
||
// Check file size before loading | ||
var filesize = input.files[0].size; | ||
if (filesize > 1 * 1024 * 1024) { | ||
var err='filesize is too big (max 1MB): ' + filesize/(1000*1000) | ||
info_output.innerHTML = '<b>Error reading GeoJSON file</b><br>' + err; | ||
info_output.style.display = 'block' | ||
} else { | ||
info_output.innerHTML += 'File Size is valid <br>'; | ||
info_output.style.display = 'block' | ||
|
||
var reader = new FileReader(); | ||
reader.onload = function(){ | ||
|
||
try { | ||
var text = reader.result; | ||
var screensJsonData = JSON.parse(text) | ||
// check number of screens | ||
numberOfScreens = Object.keys(screensJsonData).length | ||
console.log('number of screens: ' + numberOfScreens) | ||
|
||
info_output.innerHTML += 'Number of Screens: ' + numberOfScreens + '<br>'; | ||
info_output.style.display = 'block' | ||
screens = text | ||
|
||
} | ||
catch(err) { | ||
info_output.innerHTML = '<b>Error reading JSON file</b><br>' + err; | ||
info_output.style.display = 'block' | ||
} | ||
}; | ||
reader.readAsText(input.files[0]); | ||
} | ||
}; | ||
|
||
function openGeoJsonFile(event) { | ||
var input = event.target; | ||
|
||
// clear info field | ||
var info_output = document.getElementById("tutorialTasksInfo"); | ||
info_output.innerHTML = ''; | ||
info_output.style.display = 'block' | ||
|
||
// Check file size before loading | ||
var filesize = input.files[0].size; | ||
if (filesize > 1 * 1024 * 1024) { | ||
var err='filesize is too big (max 1MB): ' + filesize/(1000*1000) | ||
info_output.innerHTML = '<b>Error reading GeoJSON file</b><br>' + err; | ||
info_output.style.display = 'block' | ||
} else { | ||
info_output.innerHTML += 'File Size is valid <br>'; | ||
info_output.style.display = 'block' | ||
|
||
var reader = new FileReader(); | ||
reader.onload = function(){ | ||
|
||
try { | ||
var text = reader.result; | ||
var geoJsonData = JSON.parse(text) | ||
// check number of screens | ||
numberOfFeatures = Object.keys(geoJsonData["features"]).length | ||
console.log('number of features: ' + numberOfFeatures) | ||
|
||
info_output.innerHTML += 'Number of Features: ' + numberOfFeatures + '<br>'; | ||
info_output.style.display = 'block' | ||
tutorialTasks = text | ||
|
||
} | ||
catch(err) { | ||
info_output.innerHTML = '<b>Error reading GeoJSON file</b><br>' + err; | ||
info_output.style.display = 'block' | ||
} | ||
}; | ||
reader.readAsText(input.files[0]); | ||
} | ||
}; | ||
|
||
|
||
function closeModal() { | ||
var modal = document.getElementById("uploadModal"); | ||
modal.style.display = "none"; | ||
var modalSuccess = document.getElementById("modalSuccess"); | ||
modalSuccess.style.display = "none"; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.