Skip to content

Commit

Permalink
Fix for report URL + releases building (#62) (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentcox authored Apr 2, 2018
1 parent 87fa16d commit 331c1ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ script:
# Fix the helpers issue
# sed is different on os x...
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
sed -i '' 's/from helpers./from /g' helpers/* || :;
sed -i '' 's/from helpers./from /g' helpers/*.py || :;
sed -i '' 's/from helpers./from /g' stacoan.py;
sed -i '' 's/os.path.join(parentdir, "config.ini")/"config.ini"/g' helpers/logger.py ;
else sed -i 's/from helpers./from /g' helpers/* || :;
else sed -i 's/from helpers./from /g' helpers/*.py || :;
sed -i 's/from helpers./from /g' stacoan.py;
sed -i 's/os.path.join(parentdir, "config.ini")/"config.ini"/g' helpers/logger.py ;
fi
Expand Down
13 changes: 8 additions & 5 deletions src/helpers/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,15 +530,16 @@ def list_directory(self, path):

f.write(b"""<input type="file" name="file" id="file" class="box__file" data-multiple-caption="{count} files selected" multiple accept=\"""")
for apptype in ServerWrapper.apptypes:
f.write(bytes(str(apptype)+", ", 'utf-8'))
f.write(bytes(str(apptype)+", ", 'utf-8'))

f.write(b"""\" />
<label for="file"><strong>Choose a file</strong><span class="box__dragndrop"> or drag it here</span>.</label>
f.write(b"""\" />""")
f.write(b"""
<label for="file" id="nameup"><strong>Choose a file</strong><span class="box__dragndrop"> or drag it here</span>.</label>
<button type="submit" class="box__button">Upload</button>
</div>
<div class="box__uploading">Uploading&hellip;</div>
<div class="box__success">Done! <a href="/" class="box__restart2" id="done_link" onclick="javascript:event.target.port=""")
f.write(bytearray(ServerWrapper.REPORT_SERVER_PORT))
f.write(bytearray(str(ServerWrapper.REPORT_SERVER_PORT), 'utf8'))
f.write(b"""" role="button" target="_blank">Open report!</a></div>
<div class="box__error">Error! <span></span>. <a href="/?" class="box__restart" role="button">Try again!</a></div>
</form>
Expand Down Expand Up @@ -644,6 +645,7 @@ def list_directory(self, path):
document.getElementById("done_link").setAttribute("href", file.name.replace(/\./g, "_")+"/report/start.html");
});
}
// ajax request
var ajax = new XMLHttpRequest();
Expand All @@ -662,6 +664,7 @@ def list_directory(self, path):
console.log(data)
form.classList.add( data.includes("Success:") == true ? 'is-success' : 'is-error' );
if( !data.includes("Success:") ) errorMsg.textContent = data.error;
if (data.includes("Success:") ) document.getElementById("done_link").setAttribute("href", nameup.innerHTML.replace(/\./g, "_")+"/report/start.html");
}
else alert( 'Error. Please, contact the webmaster!' );
};
Expand All @@ -675,6 +678,7 @@ def list_directory(self, path):
}
else // fallback Ajax solution upload for older browsers
{
alert(1);
var iframeName = 'uploadiframe' + new Date().getTime(),
iframe = document.createElement( 'iframe' );
Expand All @@ -685,7 +689,6 @@ def list_directory(self, path):
document.body.appendChild( iframe );
form.setAttribute( 'target', iframeName );
iframe.addEventListener( 'load', function()
{
var data = JSON.parse( iframe.contentDocument.body.innerHTML );
Expand Down

0 comments on commit 331c1ae

Please sign in to comment.