Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
$('#html_upload_form')
.attr('action', '/addhtml/' + Files.currentEnsemble)
.submit()[0]
.reset();
} else if (getUploadType() === 'youtube') {
console.log('YouTube Upload');
$('#youtube_upload_form')
.attr('action', '/addyoutube/' + Files.currentEnsemble)
.submit()[0]
.reset();
} else {
console.log('File Upload');
// we need a way to pass the id_ensemble and id_folder: we do it in the URL
var folder_fragment = (Files.currentFolder === null) ? '' : '&id_folder=' + Files.currentFolder;
var newauth = ('ckey' in Conf.userinfo) ? '&ckey=' + Conf.userinfo.ckey : '';
$('#file_upload_form')
.attr('action', Conf.servers.upload + '/pdf3/upload?id_ensemble=' + Files.currentEnsemble + '&id_source=' + payload.id_source + folder_fragment + newauth)
.submit()[0]
.reset();
//$.I("File added to remote repository");
}
$('#add_file_dialog').dialog('destroy');
//SACHA TODO: Fix this when we setup connectionIds
window.setTimeout(function () {
//NOTE (important !)
$.I('NB is processing your file... You should receive an email once your file is available on NB.');
var payload_objects = { types:['files'], id: payload.id_source };
if ('id_ensemble' in Pers.params) {
if (x.status.errno) {
//just display that there was an error for now
if (errback !== undefined) {
errback(x.status, x.payload);
}
$.L(x.status.msg);
return;
}
// console.log("cb w/ x=", x);
callback(x.payload);
};
var auth_str = Conf.userinfo.guest ? 'guest=1' : 'ckey=' + Conf.userinfo.ckey;
$.post(Conf.servers.rpc + '/pdf4/rpc?' + auth_str, { cid: Pers.connection_id, f: fctname, a: JSON.stringify(dict) }, cb, 'json');
};
Pers.set_nav_user = function() {
var userinfo = Conf.userinfo = JSON.parse(unescape(Auth.get_cookie('userinfo'))) || { guest: true };
var screenname = "Guest";
var viewportGuestClass = "nb--guest";
var mainContentClass2 = "content_main--guest";
if (!Conf.userinfo.guest) {
screenname = userinfo.firstname === null ? $.E(userinfo.email) : $.E(userinfo.firstname) + ' ' + $.E(userinfo.lastname);
viewportGuestClass = "";
mainContentClass2 = "";
}
// Remove the defaults
$(".nb-viewport").removeClass("nb--guest");
$("#content_main").removeClass("main-content-class2");
// Add the appropriate name and classes
$("#login-name").text(screenname);
$(".nb-viewport").addClass(viewportGuestClass);
$("#content_main").addClass(mainContentClass2);
};
Pers.store.add('us', payload.settings.us);
// Reload the page to update Conf.userinfo if the user's name gets changed and also to
// ensure the name displayed at the top of the page is correct.
window.location.reload();
});
}
};
$('#cancel_button').click(function () {
f_cleanup(false);
window.location.href = "/";
});
$('#save_button').click(function () {f_cleanup(true);});
var u = Conf.userinfo;
$('#your_firstname').text(u.firstname);
$('#your_lastname').text(u.lastname);
$('#your_email').text(u.email);
};
Pers.set_nav_user = function() {
var userinfo = Conf.userinfo = JSON.parse(unescape(Auth.get_cookie('userinfo'))) || { guest: true };
var screenname = "Guest";
var viewportGuestClass = "nb--guest";
var mainContentClass2 = "content_main--guest";
if (!Conf.userinfo.guest) {
screenname = userinfo.firstname === null ? $.E(userinfo.email) : $.E(userinfo.firstname) + ' ' + $.E(userinfo.lastname);
viewportGuestClass = "";
mainContentClass2 = "";
}
// Remove the defaults
$(".nb-viewport").removeClass("nb--guest");
$("#content_main").removeClass("main-content-class2");
// Add the appropriate name and classes
$("#login-name").text(screenname);
Ok: function () {
var form = $('#file_update_form')[0];
var newauth = ('ckey' in Conf.userinfo) ? '&ckey=' + Conf.userinfo.ckey : '';
form.setAttribute('action', Conf.servers.upload + '/pdf3/upload/update?id_source=' + id + newauth);
form.submit();
$.I('Updating in progress...');
$(this).dialog('destroy');
},
},
window.addEventListener('message', function (e) {
console.log('reply to ', e.origin);
if (e.data === 'confkey') {
e.source.postMessage(Conf.userinfo.ckey, e.origin);
}
}, false);
successful_login: function (evt) {
Auth.set_cookie('ckey', evt.value.ckey);
Auth.set_cookie('userinfo', evt.value.userinfo);
Conf.userinfo = JSON.parse(unescape(evt.value.userinfo));
$.I('Welcome ' + Conf.userinfo.firstname + " " + Conf.userinfo.lastname);
f_prepare_sidebar();
Pers.set_nav_user();
},
}, 'globalPersObject');
get_userinfo: function (P, cb) {
return Conf.userinfo;
},