Skip to content

Commit

Permalink
adding file extension checker on drag and drop #730
Browse files Browse the repository at this point in the history
  • Loading branch information
umut-er committed Jul 10, 2024
1 parent 8993bf0 commit 9516a40
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
Binary file modified app/.DS_Store
Binary file not shown.
29 changes: 19 additions & 10 deletions app/js/app-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,7 @@ module.exports = function() {
var cy = appUtilities.getActiveCy();

if ($(this).val() != "" || fileObject) {
// var file = this.files[0] || fileObject;
var file = fileObject;
var file = this.files[0] || fileObject;

var params, caller;
var fileExtension = file.name.split('.').pop();
Expand Down Expand Up @@ -425,19 +424,29 @@ module.exports = function() {
params = [success, error, layoutBy];
}
else if(fileExtension == 'xml'){
appUtilities.setFileContent(file.name);
caller = chiseInstance.loadCellDesigner;
appUtilities.setFileContent(file.name);
var success = function(data){
chiseInstance.loadSBGNMLText(data, true, file.name, cy);
}
};
var error = function(data){
promptFileConversionErrorView.render();
document.getElementById("file-conversion-error-message").innerText = "Conversion service is not available!";
document.getElementById("file-conversion-error-message").innerText = "Conversion service is not available!";
};
caller = chiseInstance.loadCellDesigner;
params = [success, error];
}
else if(fileExtension == 'gpml'){
// TODO
appUtilities.setFileContent(file.name);
var success = function(data){
chiseInstance.loadSBGNMLText(data.message, false, file.name, cy);
};
var error = function(data){
promptFileConversionErrorView.render();
document.getElementById("file-conversion-error-message").innerText = "Conversion service is not available!";

};
caller = chiseInstance.loadGpml;
params = [success, error];
}
else{
var loadCallbackSBGNMLValidity = function (text) {
Expand Down Expand Up @@ -469,7 +478,8 @@ module.exports = function() {
if ($(this).val() != "") {
var file = this.files[0];
appUtilities.setFileContent(file.name);
chiseInstance.loadCellDesigner(file, success = function(data){
chiseInstance.loadCellDesigner(file,
success = function(data){
if (cy.elements().length !== 0) {
promptConfirmationView.render(function () {
chiseInstance.loadSBGNMLText(data, true, file.name, cy);
Expand All @@ -481,8 +491,7 @@ module.exports = function() {
},
error = function(data){
promptFileConversionErrorView.render();
document.getElementById("file-conversion-error-message").innerText = "Conversion service is not available!";

document.getElementById("file-conversion-error-message").innerText = "Conversion service is not available!";
});

$(this).val("");
Expand Down

0 comments on commit 9516a40

Please sign in to comment.