OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
html
/
oldindex
/
inc
Server IP: 10.0.0.4
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/15/2024 04:06:09 PM
rwxr-xr-x
📄
common.js
28.71 KB
03/15/2024 04:06:09 PM
rw-r--r--
📁
fontawesome
-
03/15/2024 04:06:09 PM
rwxr-xr-x
📄
jquery-3.4.1.min.js
86.08 KB
03/15/2024 04:06:09 PM
rw-r--r--
📄
moment.min.js
52.07 KB
03/15/2024 04:06:09 PM
rw-r--r--
📄
style.css
3.69 KB
03/15/2024 04:06:09 PM
rw-r--r--
Editing: common.js
Close
/***************************************************** * Common Javascript functions *****************************************************/ var apiURL = 'https://opal.accsindia.org/api/v1/resources/'; var gUser = {}; gUser.type = ''; gUser.session = ''; gUser.login = ''; gUser.firstName = ''; gUser.lastName = ''; gUser.loginAction = ''; function np() { return void(0); } function initHome() { var user = sessionStorage.getItem('user'); if (user == null) { } else { var resData = JSON.parse(user); gUser.type = resData.type; gUser.session = resData.session; gUser.login = resData.login; gUser.firstName = resData.firstName; gUser.lastName = resData.lastName; $('.txtLoginName').html('Welcome, ' + gUser.firstName + ' ' + gUser.lastName); $('#panelTopDefault').hide(); $('#panelTopLogged_' + gUser.type).show(); } } function initDashboard() { var user = sessionStorage.getItem('user'); if (user == null) { window.location.replace('index.htm'); } else { var resData = JSON.parse(user); gUser.type = resData.type; gUser.session = resData.session; gUser.login = resData.login; gUser.firstName = resData.firstName; gUser.lastName = resData.lastName; $('.txtLoginName').html('Welcome, ' + gUser.firstName + ' ' + gUser.lastName); $('#panelTopDefault').hide(); $('#panelTopLogged_' + gUser.type).show(); } } function initVerify() { var params = window.location.search; if (params == '') { $('.txtTagSearch').html('There was an error activating your account!'); return false; } else { params = params.replace('?', ''); $.ajax({ url: apiURL + 'verify', data: {data: params}, dataType: 'json', error: function (error) { alert('ERROR: There was an error activating your account!'); } }) .done(function(res) { if (res.status == 200) { $('.txtTagSearch').html('Your account has been activated!'); } }); } } function goHome() { $('.contentBox').hide(); $('#contentHome').show(); } function goUploadPaper() { $('#contentUpload #panelAuthors').html(''); $('#contentUpload #numAuthors').val('1'); $('.contentBox').hide(); $('#contentUpload').show(); } function goEditPaper(wchPaperId) { $('#contentEdit #panelAuthors').html(''); $('#contentEdit #numAuthors').val('1'); $('.contentBox').hide(); $('#contentLoader').show(); $.ajax({ url: apiURL + 'article?id=' + wchPaperId, dataType: 'json' }) .done(function(res) { $('#contentLoader').hide(); if (res.status == 200) { var resData = res.data; $('#contentEdit #uploadPaperId').val(resData.id); $('#contentEdit #uploadCategory').val(resData.category); $('#contentEdit #uploadYear').val(resData.year_published); $('#contentEdit #uploadTitle').val(resData.title); $('#contentEdit #uploadDOI').val(resData.doi); $('#contentEdit #uploadSummary').val(resData.summary); $('#contentEdit #uploadAuthorSalutation1').val(resData.author[0].salutation); $('#contentEdit #uploadAuthorFirstName1').val(resData.author[0].first_name); $('#contentEdit #uploadAuthorLastName1').val(resData.author[0].last_name); var htmlAuthor = ''; var numAuthors = resData.author.length; if (numAuthors > 1) { for (var i = 2; i <= numAuthors; i++) { var author_salutation = resData.author[i-1].salutation; var author_first_name = resData.author[i-1].first_name; var author_last_name = resData.author[i-1].last_name; htmlAuthor += ' <div class="form-row">'; htmlAuthor += ' <div class="col-md-2 mt-0 pt-0 mt-md-4 pt-md-1">'; htmlAuthor += ' <span class="txtMed badge badge-primary p-2">Author ' + i + '</span>'; htmlAuthor += ' </div>'; htmlAuthor += ' <div class="col-md-2 mb-3">'; htmlAuthor += ' <label for="uploadAuthorSalutation' + i + '">Salutation</label>'; htmlAuthor += ' <select id="uploadAuthorSalutation' + i + '" name="uploadAuthorSalutation' + i + '" class="form-control">'; htmlAuthor += ' <option>Mr.'; if (author_salutation == 'Ms.') { htmlAuthor += ' <option SELECTED>Ms.'; } else { htmlAuthor += ' <option>Ms.'; } if (author_salutation == 'Dr.') { htmlAuthor += ' <option SELECTED>Dr.'; } else { htmlAuthor += ' <option>Dr.'; } if (author_salutation == 'Prof.') { htmlAuthor += ' <option SELECTED>Prof.'; } else { htmlAuthor += ' <option>Prof.'; } htmlAuthor += ' </select>'; htmlAuthor += ' </div>'; htmlAuthor += ' <div class="col-md-4 mb-3">'; htmlAuthor += ' <label for="uploadAuthorFirstName' + i + '">First name</label>'; htmlAuthor += ' <input type="text" class="form-control" id="uploadAuthorFirstName' + i + '" name="uploadAuthorFirstName' + i + '" value="' + author_first_name + '" maxlength="100" />'; htmlAuthor += ' </div>'; htmlAuthor += ' <div class="col-md-4 mb-3">'; htmlAuthor += ' <label for="uploadAuthorLastName' + i + '">Last name</label>'; htmlAuthor += ' <input type="text" class="form-control" id="uploadAuthorLastName' + i + '" name="uploadAuthorLastName' + i + '" value="' + author_last_name + '" maxlength="100" />'; htmlAuthor += ' </div>'; htmlAuthor += ' </div>'; } $('#contentEdit #panelAuthors').append(htmlAuthor); } $('#contentEdit #numAuthors').val(numAuthors); $('#contentEdit').show(); } else { $('.contentBox').hide(); $('#contentDashboard').show(); alert('ERROR: ' + res.message); } }); } function goCreateAccount() { $('#panelSplash').show(); $('#panelCreateAccount').show(); } function goLogin() { $('#linkHeaderLogin').click(); } function goLogout() { $('.txtLoginName').html(''); $('.panelTopLogged').hide(); $('#panelTopDefault').show(); sessionStorage.removeItem('user'); $.ajax({ url: apiURL + 'logout?session=' + gUser.session, dataType: 'json', error: function (error) { alert('ERROR: There was an error processing your request!'); } }) .done(function(res) { alert('You have successfully logged out from OPAL'); window.location.replace('index.htm'); }); } function cancelDashboard() { $('.contentBox').hide(); $('#contentDashboard').show(); } function closeSplash() { $('#panelSplash').hide(); $('.panelAlert').hide(); } function chkLogin() { var loginRole = $('#loginRole').val(); var loginEmail = $('#loginEmail').val(); var loginPwd = $('#loginPwd').val(); if (loginRole == '' || loginEmail == '' || loginPwd == '') { alert('Role, Login and Password are required!'); return false; } $.ajax({ url: apiURL + 'userauth', data: {utype: loginRole, email: loginEmail, password: loginPwd}, dataType: 'json', error: function (error) { alert('ERROR: User or Password is incorrect!'); } }) .done(function(res) { if (res.status == 200) { var resData = res.data; gUser.type = resData.type; gUser.session = resData.session; gUser.login = loginEmail; gUser.firstName = resData.fname; gUser.lastName = resData.lname; sessionStorage.setItem('user', JSON.stringify(gUser)); $('.txtLoginName').html('Welcome, ' + gUser.firstName + ' ' + gUser.lastName); $('#panelTopDefault').hide(); $('#panelTopLogged_' + gUser.type).show(); // closeSplash(); $('#modalLogin').modal('hide'); if (gUser.loginAction != '') { getDownloadFile(gUser.loginAction); gUser.loginAction = ''; } } else { alert('ERROR: ' + res.message); } }); } function getDownloadFile(fileId) { $.ajax({ url: apiURL + 'article?id=' + fileId + '&session=' + gUser.session, dataType: 'json' }) .done(function(res) { if (res.status == 200) { window.open('https://deeplitresearch.in/pdf/' + res.data.fileurl); } }); } function chkCreateAccount() { var accountSalutation = $('#accountSalutation').val(); var accountFirstName = $('#accountFirstName').val(); var accountLastName = $('#accountLastName').val(); var accountAffiliation = $('#accountAffiliation').val(); var accountCity = $('#accountCity').val(); var accountCountry = $('#accountCountry').val(); var accountEmail = $('#accountEmail').val(); var accountPwd = $('#accountPwd').val(); var accountPwdRetype = $('#accountPwdRetype').val(); if (accountFirstName == '' || accountLastName == '' || accountAffiliation == '' || accountCity == '' || accountCountry == '' || accountEmail == '' || accountPwd == '') { alert('All fields are compulsory to create your account!'); return false; } if (accountPwd != accountPwdRetype) { alert('Passwords do not match. Please try again!'); return false; } $.ajax({ url: apiURL + 'userregistration', data: {type: 'user', fname: accountFirstName, lname: accountLastName, salutation: accountSalutation, email: accountEmail, password: accountPwd, affiliation: accountAffiliation, city: accountCity, country: accountCountry}, dataType: 'json', error: function (error) { alert('ERROR: Could not create account!'); } }) .done(function(res) { if (res.status == 200) { $('#panelCreateAccoutForm').hide(); $('#panelCreateAccoutButton').hide(); $('#panelCreateAccoutMessage').show(); } else { alert('ERROR: ' + res.message); } }); } function chkCreateAccountEditor() { var accountSalutation = $('#accountSalutation').val(); var accountFirstName = $('#accountFirstName').val(); var accountLastName = $('#accountLastName').val(); var accountAffiliation = $('#accountAffiliation').val(); var accountCity = $('#accountCity').val(); var accountCountry = $('#accountCountry').val(); var accountEmail = $('#accountEmail').val(); var accountPwd = $('#accountPwd').val(); var accountPwdRetype = $('#accountPwdRetype').val(); if (accountFirstName == '' || accountLastName == '' || accountAffiliation == '' || accountCity == '' || accountCountry == '' || accountEmail == '' || accountPwd == '') { alert('All fields are compulsory to create your account!'); return false; } if (accountPwd != accountPwdRetype) { alert('Passwords do not match. Please try again!'); return false; } $.ajax({ url: apiURL + 'userregistration', data: {type: 'editor', fname: accountFirstName, lname: accountLastName, salutation: accountSalutation, email: accountEmail, password: accountPwd, affiliation: accountAffiliation, city: accountCity, country: accountCountry}, dataType: 'json', error: function (error) { alert('ERROR: Could not create account!'); } }) .done(function(res) { if (res.status == 200) { $('#panelCreateAccoutForm').hide(); $('#panelCreateAccoutMessage').show(); } else { alert('ERROR: ' + res.message); } }); } function chkSearch() { var apiSearch = ''; var keyword = $('#srchKeyword').val(); var srchType = $('#srchType').val(); if (keyword == '') { alert('No keyword entered!'); return false; } if (srchType == 'title') apiSearch = apiURL + 'articlesbytitle?session=' + gUser.session + '&title='; if (srchType == 'author') apiSearch = apiURL + 'articlesbyauthor?session=' + gUser.session + '&author='; if (srchType == 'category') apiSearch = apiURL + 'articlesbycategory?session=' + gUser.session + '&category='; $('.contentBox').hide(); $('#contentLoader').show(); $.ajax({ url: apiSearch + keyword, dataType: 'json', error: function (error) { $('#bodySearchResults').html('<div style="margin-bottom:20px">No Results found!</div>'); $('.contentBox').hide(); $('#contentSearchResults').show(); } }) .done(function(res) { if (res.status == 200) { if (res.data.length == 0) { $('#contentLoader').hide(); $('#contentHome').show(); alert('No Search Results found!'); } else { processSearchResults(res.data); } } else { $('.contentBox').show(); $('#contentLoader').hide(); alert('ERROR: ' + res.message); } }); } function getFeaturedArticles() { var htmlArticle = ''; $('#bodyFeaturedArticles').html($('#contentLoader').html()); $.ajax({ url: apiURL + 'articles/featured', dataType: 'json', error: function (error) { htmlArticle = '<div class="col mt-2">Could not get Featured Articles!</div>'; $('#bodyFeaturedArticles').html(htmlArticle); } }) .done(function(res) { if (res.status == 200) { if (res.data.length == 0) { htmlArticle = '<div class="col mt-2">Could not get Featured Articles!</div>'; } else { $.each(res.data, function(key, value) { if (key < 3) { var itemArticle = value; var itemImg = itemArticle.imgurl; htmlArticle += ' <div class="col-lg-4 mt-3 mt-lg-0">'; htmlArticle += ' <div class="boxArticle">'; if (itemImg == '') { htmlArticle += ' <div class="backCover cursorH" onclick="getArticleDetails(' + itemArticle.id + ')" style="height:200px;background-image:url(grfx/article0' + (key+1) + '.jpg)"></div>'; } else { itemImg = 'https://deeplitresearch.in/img/' + itemImg; htmlArticle += ' <div class="backCover cursorH" onclick="getArticleDetails(' + itemArticle.id + ')" style="height:200px;background-image:url(' + itemImg + ')"></div>'; } htmlArticle += ' <div class="padding15">'; htmlArticle += ' <h1><a href="javascript:np()" onclick="getArticleDetails(' + itemArticle.id + ')">' + itemArticle.title + '</a></h1>'; htmlArticle += itemArticle.summary.substring(0,150) + '...'; htmlArticle += ' </div>'; htmlArticle += ' </div>'; htmlArticle += ' </div>'; } }); } } else { htmlArticle = '<div class="col mt-2">Could not get Featured Articles!</div>'; } $('#bodyFeaturedArticles').html(htmlArticle); }); } function getUploads() { $('.contentBox').hide(); $('#contentDashboard').show(); $('#bodyUploads').html($('#contentLoader').html()); $.ajax({ url: apiURL + 'articlesbyuser?session=' + gUser.session, dataType: 'json' }) .done(function(res) { var htmlArticle = ''; if (res.status == 200) { if (res.data.length == 0) { $('#txtUploadCount').html('You have not uploaded any papers.'); } else { htmlArticle += ' <table class="table table-striped">'; htmlArticle += ' <thead>'; htmlArticle += ' <tr>'; htmlArticle += ' <th scope="col">#</th>'; htmlArticle += ' <th scope="col">Title</th>'; htmlArticle += ' <th scope="col">Author(s)</th>'; htmlArticle += ' <th scope="col"></th>'; htmlArticle += ' <th scope="col"></th>'; htmlArticle += ' </tr>'; htmlArticle += ' </thead>'; htmlArticle += ' <tbody>'; $.each(res.data, function(key, value) { var itemArticle = value; var author = itemArticle.author; var fullAuthor = ''; for (var i = 0; i < author.length; i++) { fullAuthor += author[i].salutation + ' ' + author[i].first_name + ' ' + author[i].last_name + ', '; } fullAuthor = fullAuthor.slice(0, -2); htmlArticle += ' <tr>'; htmlArticle += ' <td>' + (key+1) + '.</td>'; htmlArticle += ' <td>' + itemArticle.title + '</td>'; htmlArticle += ' <td>' + fullAuthor + '</td>'; if (itemArticle.published == 1) { htmlArticle += ' <td><div class="alert alert-success p-2 text-center">Published</div></td>'; } else { htmlArticle += ' <td><div class="alert alert-warning p-2 text-center">Draft</div></td>'; } htmlArticle += ' <td align="right">'; htmlArticle += ' <input type="button" class="btn btn-sm btn-secondary" onclick="downloadArticle(this)" data-file="' + itemArticle.fileurl + '" value="View" />'; htmlArticle += ' <input type="button" class="btn btn-sm btn-secondary" onclick="goEditPaper(' + itemArticle.id + ')" value="Edit" />'; if (itemArticle.published == 1) { htmlArticle += ' <input type="button" class="btn btn-sm btn-secondary" onclick="setPaper(' + itemArticle.id + ',0)" value="Move to Draft" />'; } else { htmlArticle += ' <input type="button" class="btn btn-sm btn-secondary" onclick="setPaper(' + itemArticle.id + ',1)" value="Publish" />'; } htmlArticle += ' </td>'; htmlArticle += ' </tr>'; }); htmlArticle += ' </tbody>'; htmlArticle += ' </table>'; } } else { htmlArticle = '<div class="col">Could not get your uploaded papers!</div>'; } $('#bodyUploads').html(htmlArticle); }); } function getArticleDetails(wchArticle) { $('.contentBox').hide(); $('#contentLoader').show(); $.ajax({ url: apiURL + 'article?id=' + wchArticle, dataType: 'json' }) .done(function(res) { $('#contentLoader').hide(); if (res.status == 200) { var resData = res.data; var author = resData.author; var fullAuthor = ''; for (var i = 0; i < author.length; i++) { fullAuthor += author[i].salutation + ' ' + author[i].first_name + ' ' + author[i].last_name + ', '; } fullAuthor = fullAuthor.slice(0, -2); $('#txtArticleDetail_title').html(resData.title); $('#txtArticleDetail_author').html(fullAuthor); $('#txtArticleDetail_published').html(resData.year_published); $('#txtArticleDetail_doi').html(resData.doi); $('#txtArticleDetail_summary').html(resData.summary); $('#txtDownloadFile').data('id', resData.id); $('#txtDownloadFile').data('file', resData.fileurl); $('#contentArticleDetails').show(); } else { $('.contentBox').hide(); $('#contentHome').show(); alert('ERROR: ' + res.message); } }); } function downloadArticle(elm) { var downloadId = $(elm).data('id'); if (gUser.session == '') { gUser.loginAction = downloadId; goLogin(); } else { var downloadFile = $(elm).data('file'); if (downloadFile == '') { getDownloadFile(downloadId); } else { window.open('https://deeplitresearch.in/pdf/' + downloadFile); } } } function processSearchResults(res) { var htmlSearch = ''; $.each(res, function(key, value) { var itemSearch = value; htmlSearch += '<div style="margin-bottom:40px">'; htmlSearch += ' <div class="fl" style="width:30px;margin-top:5px;">' + (key+1) + '.</div>'; htmlSearch += ' <div class="fl" style="width:calc(100% - 30px)">'; htmlSearch += ' <div class="txtMedium txtGrey">' + itemSearch.title + '</div>'; htmlSearch += ' <div style="border-bottom:2px #fdb813 solid;margin-bottom:10px;padding-bottom:10px;">'; htmlSearch += ' <div class="txtSmall txtGrey">'; var author = itemSearch.author; var fullAuthor = ''; for (var i = 0; i < author.length; i++) { fullAuthor += author[i].salutation + ' ' + author[i].first_name + ' ' + author[i].last_name + ', '; } fullAuthor = fullAuthor.slice(0, -2); htmlSearch += ' <b>Author:</b> ' + fullAuthor + ' | '; htmlSearch += ' <b>Published:</b> ' + itemSearch.year_published + ' | '; htmlSearch += ' <b>DOI:</b> ' + itemSearch.doi; htmlSearch += ' </div>'; htmlSearch += ' </div>'; htmlSearch += ' <div style="width:calc(100% - 30px)" class="fl boxAbstract">' + itemSearch.summary + '</div>'; htmlSearch += ' <div class="fr">'; if (gUser.session == '') { htmlSearch += ' <a href="javascript:np()" id="txtDownloadFile" data-id="' + itemSearch.id + '" data-file="" onclick="downloadArticle(this)" title="Download PDF"><i class="far fa-file-pdf fa-lg"></i></a>'; } else { htmlSearch += ' <a href="javascript:np()" id="txtDownloadFile" data-id="" data-file="' + itemSearch.fileurl + '" onclick="downloadArticle(this)" title="Download PDF"><i class="far fa-file-pdf fa-lg"></i></a>'; } htmlSearch += ' </div>'; htmlSearch += ' </div>'; htmlSearch += ' <div class="cleaner"></div>'; htmlSearch += '</div>'; }); $('.contentBox').hide(); $('#bodySearchResults').html(htmlSearch); $('#contentSearchResults').show(); } function chkUploadPaper() { var uploadCategory = $('#contentUpload #uploadCategory').val(); var uploadYear = $('#contentUpload #uploadYear').val(); var uploadTitle = $('#contentUpload #uploadTitle').val(); var uploadDOI = $('#contentUpload #uploadDOI').val(); var uploadSummary = $('#contentUpload #uploadSummary').val(); var uploadPdf = $('#contentUpload #uploadPdf').val(); var uploadAuthorFirstName = $('#contentUpload #uploadAuthorFirstName1').val(); var uploadAuthorLastName = $('#contentUpload #uploadAuthorLastName2').val(); if (uploadCategory == '') { alert('No Category entered!'); return false; } if (uploadTitle == '') { alert('No Paper Title entered!'); return false; } if (uploadSummary == '') { alert('No Paper Summary entered!'); return false; } if (uploadPdf == '') { alert('No PDF selected to upload!'); return false; } if (uploadAuthorFirstName == '') { alert('No Author First name entered!'); return false; } if (uploadAuthorLastName == '') { alert('No Author Last name entered!'); return false; } var combined_author = []; var numAuthors = parseInt($('#contentUpload #numAuthors').val()); for (var i = 1; i <= numAuthors; i++) { var author_salutation = $('#contentUpload #uploadAuthorSalutation' + i).val(); var author_first_name = $('#contentUpload #uploadAuthorFirstName' + i).val(); var author_last_name = $('#contentUpload #uploadAuthorLastName' + i).val(); if (author_first_name != '' && author_last_name != '') { var author = {}; author.salutation = author_salutation; author.first_name = author_first_name; author.last_name = author_last_name; combined_author.push(author); } } var formData = new FormData(); formData.append('session', gUser.session); formData.append('category', uploadCategory); formData.append('year_published', uploadYear); formData.append('author', JSON.stringify(combined_author)); formData.append('title', uploadTitle); formData.append('doi', uploadDOI); formData.append('summary', uploadSummary); formData.append('file_img', $('#contentUpload #uploadImg')[0].files[0]); formData.append('file_pdf', $('#contentUpload #uploadPdf')[0].files[0]); $.ajax({ method: 'POST', url: apiURL + 'cms/upload', data: formData, processData: false, contentType: false, enctype: 'multipart/form-data', error: function (error) { alert('ERROR: There was an error processing your request!'); } }) .done(function(res) { if (res.status == 200) { getUploads(); alert('Paper has been uploaded!'); } else { alert('ERROR: ' + res.message); } }); } function chkEditPaper() { var uploadPaperId = $('#contentEdit #uploadPaperId').val(); var uploadCategory = $('#contentEdit #uploadCategory').val(); var uploadYear = $('#contentEdit #uploadYear').val(); var uploadTitle = $('#contentEdit #uploadTitle').val(); var uploadDOI = $('#contentEdit #uploadDOI').val(); var uploadSummary = $('#contentEdit #uploadSummary').val(); var uploadAuthorFirstName = $('#contentEdit #uploadAuthorFirstName1').val(); var uploadAuthorLastName = $('#contentEdit #uploadAuthorLastName1').val(); if (uploadCategory == '') { alert('No Category entered!'); return false; } if (uploadTitle == '') { alert('No Paper Title entered!'); return false; } if (uploadSummary == '') { alert('No Paper Summary entered!'); return false; } if (uploadAuthorFirstName == '') { alert('No Author First name entered!'); return false; } if (uploadAuthorLastName == '') { alert('No Author Last name entered!'); return false; } var combined_author = []; var numAuthors = parseInt($('#contentEdit #numAuthors').val()); for (var i = 1; i <= numAuthors; i++) { var author_salutation = $('#contentEdit #uploadAuthorSalutation' + i).val(); var author_first_name = $('#contentEdit #uploadAuthorFirstName' + i).val(); var author_last_name = $('#contentEdit #uploadAuthorLastName' + i).val(); if (author_first_name != '' && author_last_name != '') { var author = {}; author.salutation = author_salutation; author.first_name = author_first_name; author.last_name = author_last_name; combined_author.push(author); } } var formData = new FormData(); formData.append('id', uploadPaperId); formData.append('session', gUser.session); formData.append('category', uploadCategory); formData.append('year_published', uploadYear); formData.append('author', JSON.stringify(combined_author)); formData.append('title', uploadTitle); formData.append('doi', uploadDOI); formData.append('summary', uploadSummary); formData.append('file_img', $('#contentEdit #uploadImg')[0].files[0]); $.ajax({ method: 'POST', url: apiURL + 'cms/updatepaper', data: formData, processData: false, contentType: false, enctype: 'multipart/form-data', error: function (error) { alert('ERROR: There was an error processing your request!'); } }) .done(function(res) { if (res.status == 200) { getUploads(); alert('Paper has been edited!'); } else { alert('ERROR: ' + res.message); } }); } function setPaper(wchPaperId, isPublished) { $.ajax({ url: apiURL + 'paperstatus?id=' + wchPaperId + '&session=' + gUser.session + '&status=' + isPublished, dataType: 'json', error: function (error) { alert('ERROR: There was an error processing your request!'); } }) .done(function(res) { if (res.status == 200) { getUploads(); } else { alert('ERROR: ' + res.message); } }); } function addMoreAuthorsUpload() { var numAuthors = parseInt($('#contentUpload #numAuthors').val()) + 1; $('#contentUpload #numAuthors').val(numAuthors); var htmlAuthor = ''; htmlAuthor += '<div class="form-row">'; htmlAuthor += ' <div class="col-md-2 mt-0 pt-0 mt-md-4 pt-md-1">'; htmlAuthor += ' <span class="txtMed badge badge-primary p-2">Author ' + numAuthors + '</span>'; htmlAuthor += ' </div>'; htmlAuthor += ' <div class="col-md-2 mb-3">'; htmlAuthor += ' <label for="uploadAuthorSalutation' + numAuthors + '">Salutation</label>'; htmlAuthor += ' <select id="uploadAuthorSalutation' + numAuthors + '" name="uploadAuthorSalutation' + numAuthors + '" class="form-control">'; htmlAuthor += ' <option>Mr.'; htmlAuthor += ' <option>Ms.'; htmlAuthor += ' <option>Dr.'; htmlAuthor += ' <option>Prof.'; htmlAuthor += ' </select>'; htmlAuthor += ' </div>'; htmlAuthor += ' <div class="col-md-4 mb-3">'; htmlAuthor += ' <label for="uploadAuthorFirstName' + numAuthors + '">First name</label>'; htmlAuthor += ' <input type="text" class="form-control" id="uploadAuthorFirstName' + numAuthors + '" name="uploadAuthorFirstName' + numAuthors + '" placeholder="First name" maxlength="100" />'; htmlAuthor += ' </div>'; htmlAuthor += ' <div class="col-md-4 mb-3">'; htmlAuthor += ' <label for="uploadAuthorLastName' + numAuthors + '">Last name</label>'; htmlAuthor += ' <input type="text" class="form-control" id="uploadAuthorLastName' + numAuthors + '" name="uploadAuthorLastName' + numAuthors + '" placeholder="Last name" maxlength="100" />'; htmlAuthor += ' </div>'; htmlAuthor += '</div>'; $('#contentUpload #panelAuthors').append(htmlAuthor); } function addMoreAuthorsEdit() { var numAuthors = parseInt($('#contentEdit #numAuthors').val()) + 1; $('#contentEdit #numAuthors').val(numAuthors); var htmlAuthor = ''; htmlAuthor += '<div class="form-row">'; htmlAuthor += ' <div class="col-md-2 mt-0 pt-0 mt-md-4 pt-md-1">'; htmlAuthor += ' <span class="txtMed badge badge-primary p-2">Author ' + numAuthors + '</span>'; htmlAuthor += ' </div>'; htmlAuthor += ' <div class="col-md-2 mb-3">'; htmlAuthor += ' <label for="uploadAuthorSalutation' + numAuthors + '">Salutation</label>'; htmlAuthor += ' <select id="uploadAuthorSalutation' + numAuthors + '" name="uploadAuthorSalutation' + numAuthors + '" class="form-control">'; htmlAuthor += ' <option>Mr.'; htmlAuthor += ' <option>Ms.'; htmlAuthor += ' <option>Dr.'; htmlAuthor += ' <option>Prof.'; htmlAuthor += ' </select>'; htmlAuthor += ' </div>'; htmlAuthor += ' <div class="col-md-4 mb-3">'; htmlAuthor += ' <label for="uploadAuthorFirstName' + numAuthors + '">First name</label>'; htmlAuthor += ' <input type="text" class="form-control" id="uploadAuthorFirstName' + numAuthors + '" name="uploadAuthorFirstName' + numAuthors + '" placeholder="First name" maxlength="100" />'; htmlAuthor += ' </div>'; htmlAuthor += ' <div class="col-md-4 mb-3">'; htmlAuthor += ' <label for="uploadAuthorLastName' + numAuthors + '">Last name</label>'; htmlAuthor += ' <input type="text" class="form-control" id="uploadAuthorLastName' + numAuthors + '" name="uploadAuthorLastName' + numAuthors + '" placeholder="Last name" maxlength="100" />'; htmlAuthor += ' </div>'; htmlAuthor += '</div>'; $('#contentEdit #panelAuthors').append(htmlAuthor); }