def submit_paper_enhanced(tjyear): error = "" displayStrings = paperSubUtils.display_strings() submitSuccess = True thisPaperInfo = {} thisPaperInfoWithReview = {} if request.method == 'POST': #Select the function area where the papers belong to in this TJ thisPaperInfo['tjSection'] = request.form['tjSection'] #Select the function area where the papers belong to in this TJ thisPaperId = paperSubUtils.get_this_paper_id_for_submission(tjyear) thisPaperInfo['submissionSequence'] = thisPaperId thisPaperInfo['publishSequence'] = 0 thisPaperInfoWithReview['paperInfo'] = thisPaperInfo #submit ZIP document fileForReview = request.files['zip2Bsubmitted'] uploadResult = paperSubUtilsFile.upload_file("ZIP", True, False, False, thisPaperInfo, fileForReview, tjyear, thisPaperId) error += uploadResult['error'] thisPaperInfo['zipURL'] = uploadResult['filesUrl'] if submitSuccess: submitSuccess = uploadResult['needsToUpdate'] #submit ZIP document #submit PDF document fileForReview = request.files['pdf2Bsubmitted'] uploadResult = paperSubUtilsFile.upload_file("PDF", True, False, False, thisPaperInfo, fileForReview, tjyear, thisPaperId) error += uploadResult['error'] thisPaperInfo['pdfURL'] = uploadResult['filesUrl'] if submitSuccess: submitSuccess = uploadResult['needsToUpdate'] #submit PDF document #Input Paper Title, Authors's email, manager's email, and department information if submitSuccess: thisPaperInfoWithReview = paperSubUtilsFile.unzip_uploaded_file_and_parse_info( tjyear, thisPaperInfoWithReview, True) #Write paper information Into Database paperSubUtils.database_operation_update_paper( thisPaperInfoWithReview, tjyear, thisPaperId, True) #Write paper information Into Database paperSubUtilsAttach.generate_review_form_spreadsheet( thisPaperInfoWithReview, tjyear, True, True) paperSubUtilsAttach.generate_review_form_spreadsheet( thisPaperInfoWithReview, tjyear, False, True) flash('Thank you for your submission!') return render_template('blank.html') else: error += "Please submit again~" return render_template('submitPaperEnhanced.html', error=error, tjyear=tjyear, displayStrings=displayStrings)
def review_paper_info_enhanced(tjyear, paperId): error = "" if not (session.get('logged_in') or session.get('verified')): return redirect( url_for('verify_email', tjyear=tjyear, paperId=paperId, role='Author')) needsToUpdate = False displayStrings = paperSubUtils.display_strings() thisPaperInfoWithReview = paperSubUtils.get_paper_info_with_review( tjyear, paperId) thisPaperInfo = thisPaperInfoWithReview['paperInfo'] managerReviewInfo = thisPaperInfoWithReview['managerReviewInfo'] expertReviewInfo = thisPaperInfoWithReview['expertReviewInfo'] tempThisPaperInfoWithReview = copy.deepcopy(thisPaperInfoWithReview) tempThisPaperInfo = tempThisPaperInfoWithReview['paperInfo'] if request.method == 'POST': #Update the function area where the papers belong to in this TJ tempThisPaperInfo['tjSection'] = int(request.form['tjSection']) if (paperSubUtils.information_updated(thisPaperInfo['tjSection'], tempThisPaperInfo['tjSection'])): flash('function area updated') needsToUpdate = True #Update the function area where the papers belong to in this TJ #The parameters represent fileType, isFirstSub, isReviewer, isManager #submit ZIP document fileForReview = request.files['zip2Bsubmitted'] uploadResult = paperSubUtilsFile.upload_file("ZIP", False, False, False, thisPaperInfo, fileForReview, tjyear, paperId) error += uploadResult['error'] tempThisPaperInfo['zipURL'] = uploadResult['filesUrl'] if not needsToUpdate: needsToUpdate = uploadResult['needsToUpdate'] #submit ZIP document #submit PDF document fileForReview = request.files['pdf2Bsubmitted'] uploadResult = paperSubUtilsFile.upload_file("PDF", False, False, False, thisPaperInfo, fileForReview, tjyear, paperId) error += uploadResult['error'] tempThisPaperInfo['pdfURL'] = uploadResult['filesUrl'] if not needsToUpdate: needsToUpdate = uploadResult['needsToUpdate'] #submit PDF document if needsToUpdate: #Keep values for rows not required for review tempThisPaperInfo['approvedStatus'] = thisPaperInfo[ 'approvedStatus'] tempThisPaperInfo['publishSequence'] = thisPaperInfo[ 'publishSequence'] #Update file names paperSubUtilsFile.update_file_name(tjyear, paperId, thisPaperInfo, tempThisPaperInfo) #update database info thisPaperInfoWithReview = copy.deepcopy( tempThisPaperInfoWithReview) thisPaperInfoWithReview = paperSubUtilsFile.unzip_uploaded_file_and_parse_info( tjyear, thisPaperInfoWithReview, True) paperSubUtils.database_operation_update_paper( thisPaperInfoWithReview, tjyear, paperId, False) flash('The information of this paper is updated!') return render_template('blank.html') else: flash('The information of this paper is not updated!') return render_template('blank.html') return render_template('reviewPaperInfoEnhanced.html', error=error,tjyear=tjyear,paperId=paperId,\ thisPaperInfo=thisPaperInfoWithReview,managerReviewInfo=managerReviewInfo, \ expertReviewInfo=expertReviewInfo, displayStrings = displayStrings)
def submit_paper(tjyear): error = "" displayStrings = paperSubUtils.display_strings() submitSuccess = True thisPaperInfo={} thisPaperInfoWithReview = {} thisPaperInfo['publishSequence'] = 0 authorList = [] authorInfo = {} managerInfo = {} expertInfo = {} noOfAuthors = 0 if request.method == 'POST': #Input Paper Title, Authors's email, manager's email, and department information thisPaperInfo['paperTitle'] = request.form['paperTitle'] if ( not thisPaperInfo['paperTitle']): thisPaperInfo['paperTitle'] = 'No PaperTitle' error+='Invalid paper title - ' submitSuccess = False for i in range(5): authorEmail = 'authorEmail'+str(i+1) tempEmail = request.form[authorEmail] if (paperSubUtils.validate_email(tempEmail) == False): flash('Invalid format: author email - '+str(i+1)) else: noOfAuthors = noOfAuthors + 1 authorInfo = {} authorInfo['email'] = tempEmail authorInfo['name'] = paperSubUtils.parse_email_name(authorInfo['email']).capitalize() authorInfo['authorOrder'] = noOfAuthors authorList.append(authorInfo) managerInfo['email'] = request.form['managerEmail'] if (paperSubUtils.validate_email(managerInfo['email']) == False): managerInfo['email'] = app.config['DEFAULT_INFO']['email'] error+='Invalid format: manager email - ' submitSuccess = False else: managerInfo['name'] = paperSubUtils.parse_email_name(managerInfo['email']).capitalize() thisPaperInfo['department'] = request.form['department'] #Input Paper Title, Authors's email, manager's email, and department information #Select the function area where the papers belong to in this TJ thisPaperInfo['tjSection'] = request.form['tjSection'] #Select the function area where the papers belong to in this TJ thisPaperId = paperSubUtils.get_this_paper_id_for_submission(tjyear); thisPaperInfo['submissionSequence'] = thisPaperId #submit ZIP document fileForReview = request.files['zip2Bsubmitted'] uploadResult = paperSubUtilsFile.upload_file("ZIP", True, False, False, thisPaperInfo,fileForReview,tjyear,thisPaperId) error += uploadResult['error'] thisPaperInfo['zipURL'] = uploadResult['filesUrl'] if submitSuccess: submitSuccess = uploadResult['needsToUpdate'] #submit ZIP document #submit PDF document fileForReview = request.files['pdf2Bsubmitted'] uploadResult = paperSubUtilsFile.upload_file("PDF", True, False, False, thisPaperInfo,fileForReview,tjyear,thisPaperId) error += uploadResult['error'] thisPaperInfo['pdfURL'] = uploadResult['filesUrl'] if submitSuccess: submitSuccess = uploadResult['needsToUpdate'] #submit PDF document if submitSuccess: #Assign values for rows not required for submission expertInfo['email'] = app.config['DEFAULT_INFO']['email'] expertInfo['name'] = app.config['DEFAULT_INFO']['name'] thisPaperInfo['approvedStatus'] = False #Assign values for rows not required for submission #people info thisPaperInfoWithReview['authorList'] = authorList thisPaperInfoWithReview['managerInfo'] = managerInfo thisPaperInfoWithReview['expertInfo'] = expertInfo thisPaperInfoWithReview['noOfAuthors'] = noOfAuthors thisPaperInfoWithReview['paperInfo'] = thisPaperInfo #people Info #Write paper information Into Database paperSubUtils.database_operation_update_paper(thisPaperInfoWithReview,tjyear,thisPaperId,True) #Write paper information Into Database paperSubUtilsAttach.generate_review_form_spreadsheet(thisPaperInfoWithReview, tjyear, True, True) paperSubUtilsAttach.generate_review_form_spreadsheet(thisPaperInfoWithReview, tjyear, False, True) flash('Thank you for your submission!') return render_template('blank.html') else: error += "Please submit again~" return render_template('submitPaper.html', error=error,tjyear=tjyear, displayStrings = displayStrings)
def submit_review_comments(tjyear,paperId,isManagerReview): error = "" displayStrings = paperSubUtils.display_strings() thisPaperInfoWithReview = paperSubUtils.get_paper_info_with_review(tjyear,paperId) thisPaperInfo = thisPaperInfoWithReview['paperInfo'] lastUpdatedReviewInfo = paperSubUtils.get_review_info(isManagerReview,paperId,tjyear) reviewInfo = copy.deepcopy(lastUpdatedReviewInfo) if(isManagerReview): reviewerInfo = "manager_review" reviewerEmail = thisPaperInfoWithReview['managerInfo']['email'] role = 'Manager' else: reviewerInfo = "expert_review" reviewerEmail = thisPaperInfoWithReview['expertInfo']['email'] role = 'Expert' if not session.get('logged_in') and not session.get('verified'): return redirect(url_for('verify_email',tjyear=tjyear,paperId=paperId,role=role)) submitSuccess = True if request.method != 'POST': flash("Please help complete the "+reviewerInfo+" for - "+thisPaperInfo['paperTitle']) if request.method == 'POST': #Construct Reviewer Items index = 0 for eachReviewItem in reviewInfo['itemList']: eachReviewItem['reviewItemGrade'] = int(request.form.getlist('reviewItemName')[index]) index = index + 1 #Construct Reviewer Items #Read the review result from reviewer reviewInfo['Overall'] = request.form['Overall'] #Read the review result from reviewer #Construct Reviewer Comments index = 0 for eachReviewQuestion in reviewInfo['questionList']: eachReviewQuestion['answer'] = request.form.getlist('answer')[index] index = index + 1 #Construct Reviewer Comments #Upload file with comments file = request.files['xlsx2Bsubmitted'] if app.config['USINGOPTION'] == "attach": uploadResult = paperSubUtilsFile.upload_file("XLSX", False, True, isManagerReview, thisPaperInfo,\ file,tjyear,paperId, reviewInfo) if uploadResult['needsToUpdate'] == True: reviewInfo = paperSubUtilsAttach.extract_info_from_review_spreadsheet(thisPaperInfoWithReview, tjyear, isManagerReview, reviewInfo) reviewInfo['excelURL'] = uploadResult['filesUrl'] file = request.files['pdf2Bsubmitted'] uploadResult = paperSubUtilsFile.upload_file("PDF", False, True, isManagerReview, thisPaperInfo,\ file,tjyear,paperId, reviewInfo) reviewInfo['commentedVersionURL'] = uploadResult['filesUrl'] #Upload file with comments reviewInfo['reviewSubmitted'] = True paperSubUtils.database_operation_update_paper_review_info(reviewInfo,paperId,tjyear,\ isManagerReview) flash('Thanks for your support to '+app.config['EDITORIAL_COMMITEE_INFO']['journal']+' '+str(tjyear)) return render_template('blank.html') return render_template('submitReviewComments.html', error=error,tjyear=tjyear,\ paperId=paperId,isManagerReview=isManagerReview,thisPaperInfo=thisPaperInfoWithReview,\ reviewerEmail=reviewerEmail,displayStrings=displayStrings, lastUpdatedReviewInfo\ =lastUpdatedReviewInfo)
def review_paper_info(tjyear, paperId): error = "" if not (session.get('logged_in') or session.get('verified')): return redirect( url_for('verify_email', tjyear=tjyear, paperId=paperId, role='Author')) needsToUpdate = False displayStrings = paperSubUtils.display_strings() flash("Review paper info") thisPaperInfoWithReview = paperSubUtils.get_paper_info_with_review( tjyear, paperId) flash(thisPaperInfoWithReview) thisPaperInfo = thisPaperInfoWithReview['paperInfo'] managerReviewInfo = thisPaperInfoWithReview['managerReviewInfo'] expertReviewInfo = thisPaperInfoWithReview['expertReviewInfo'] tempThisPaperInfoWithReview = copy.deepcopy(thisPaperInfoWithReview) tempThisPaperInfo = tempThisPaperInfoWithReview['paperInfo'] if request.method == 'POST': #Update Paper Title, Authors' email, managers' email, and department information tempThisPaperInfo['paperTitle'] = request.form['paperTitle'] if (not tempThisPaperInfo['paperTitle']): flash('Please update again: invalid paper title') elif (paperSubUtils.information_updated( thisPaperInfo['paperTitle'], tempThisPaperInfo['paperTitle'])): flash('Paper title updated') needsToUpdate = True for i in range(thisPaperInfoWithReview['noOfAuthors']): authorEmail = 'authorEmail' + str(i + 1) tempEmail = request.form[authorEmail] if (paperSubUtils.validate_email(tempEmail) == False): flash('Invalid format: author email - ' + str(i + 1)) elif (paperSubUtils.information_updated( tempEmail, thisPaperInfoWithReview['authorList'][i]['email'])): authorInfo = {} authorInfo['email'] = tempEmail authorInfo['name'] = paperSubUtils.parse_email_name( authorInfo['email']).capitalize() authorInfo['authorOrder'] = i + 1 needsToUpdate = True tempThisPaperInfoWithReview['authorList'][i] = authorInfo i = i + 1 #Update the function area where the papers belong to in this TJ tempThisPaperInfo['tjSection'] = int(request.form['tjSection']) if (paperSubUtils.information_updated(thisPaperInfo['tjSection'], tempThisPaperInfo['tjSection'])): flash('function area updated') needsToUpdate = True #Update the function area where the papers belong to in this TJ #submit latex document #The parameters represent fileType, isFirstSub, isReviewer, isManager #submit ZIP document fileForReview = request.files['zip2Bsubmitted'] uploadResult = paperSubUtilsFile.upload_file("ZIP", False, False, False, thisPaperInfo, fileForReview, tjyear, paperId) error += uploadResult['error'] tempThisPaperInfo['zipURL'] = uploadResult['filesUrl'] if not needsToUpdate: needsToUpdate = uploadResult['needsToUpdate'] #submit ZIP document #submit PDF document fileForReview = request.files['pdf2Bsubmitted'] uploadResult = paperSubUtilsFile.upload_file("PDF", False, False, False, thisPaperInfo, fileForReview, tjyear, paperId) error += uploadResult['error'] tempThisPaperInfo['pdfURL'] = uploadResult['filesUrl'] if not needsToUpdate: needsToUpdate = uploadResult['needsToUpdate'] #submit PDF document if needsToUpdate: #Keep values for rows not required for review tempThisPaperInfo['approvedStatus'] = thisPaperInfo[ 'approvedStatus'] tempThisPaperInfo['publishSequence'] = thisPaperInfo[ 'publishSequence'] #Update file names paperSubUtilsFile.update_file_name(tjyear, paperId, thisPaperInfo, tempThisPaperInfo) thisPaperInfoWithReview = copy.deepcopy( tempThisPaperInfoWithReview) paperSubUtils.database_operation_update_paper( tempThisPaperInfoWithReview, tjyear, paperId, False) flash('The information of this paper is updated!') return render_template('blank.html') else: flash('The information of this paper is not updated!') return render_template('blank.html') return render_template('reviewPaperInfo.html', error=error,tjyear=tjyear,paperId=paperId,\ thisPaperInfo=thisPaperInfoWithReview,managerReviewInfo=managerReviewInfo, \ expertReviewInfo=expertReviewInfo, displayStrings = displayStrings)