From 8af1493bd51de5590268226f3a73d4e81dc04e4a Mon Sep 17 00:00:00 2001 From: Sashi20 Date: Tue, 23 Apr 2019 12:09:11 +0530 Subject: Modify email templates and remove unnecessary fields from settings --- abstract_bulk_approval.inc | 93 +++++++++++++++++++++++++++++++--------------- email.inc | 75 ++++++++++++++++--------------------- settings.inc | 30 --------------- 3 files changed, 94 insertions(+), 104 deletions(-) diff --git a/abstract_bulk_approval.inc b/abstract_bulk_approval.inc index 2bcfbff..85b0722 100755 --- a/abstract_bulk_approval.inc +++ b/abstract_bulk_approval.inc @@ -31,21 +31,29 @@ function om_flowsheet_abstract_bulk_approval_form($form, &$form_state) ) ) ); - $form['message'] = array( + $form['disapprove_message'] = array( '#type' => 'textarea', - '#title' => t('If Dis-Approved please specify reason for Dis-Approval'), + '#title' => t('Enter the reason for disapproving the proposal*'), '#prefix' => '
', '#states' => array( 'visible' => array( array( ':input[name="flowsheet_actions"]' => array( - 'value' => 3 + 'value' => 2 ) - ), - 'or', + ) + ) + ) + ); + $form['deletion_message'] = array( + '#type' => 'textarea', + '#title' => t('Enter the reason for deleting the proposal'), + '#prefix' => '
', + '#states' => array( + 'visible' => array( array( ':input[name="flowsheet_actions"]' => array( - 'value' => 2 + 'value' => 3 ) ) ) @@ -87,6 +95,7 @@ function ajax_bulk_flowsheet_abstract_details_callback($form, $form_state) '#commands' => $commands ); } + /************************************************************/ function om_flowsheet_abstract_bulk_approval_form_submit($form, &$form_state) { @@ -126,30 +135,29 @@ function om_flowsheet_abstract_bulk_approval_form_submit($form, &$form_state) } //$abstract_data = $abstracts_q->fetchObject() drupal_set_message(t('Approved Flowsheeting project.'), 'status'); // email - $email_subject = t('[!site_name][Flowsheeting Project] Your uploaded flowsheeting project have been approved', array( + $email_subject = t('[!site_name][Flowsheeting Project] Your uploaded OpenModelica Flowsheeting Project has been approved', array( '!site_name' => variable_get('site_name', '') )); $email_body = array( 0 => t(' -Dear !user_name, +Dear ' . $user_info->contributor_name . ', Congratulations! -Your om flowsheet and abstract with the following details have been approved. +Your OpenModelica flowsheet and abstract with the following details have been approved. Full Name: ' . $user_info->name_title . ' ' . $user_info->contributor_name . ' Project Title: ' . $user_info->project_title . ' Name of compound for which process development is carried out : ' . $user_info->process_development_compound_name . ' -Kindly send us the internship forms as early as possible for processing your honorarium on time. In case you have already sent these forms, please share the the consignment number or tracking id with us. - -Note: It will take upto 30 days from the time we receive your forms, to process your honorarium. +Kindly send us the internship forms available at https://om.fossee.in/flowsheeting-project/internship/forms as early as possible for processing your honorarium on time. In case you have already sent these forms, please share the the consignment number or tracking id with us. +Note: It will take upto 45 days from the time we receive your forms, to process your honorarium. Best Wishes, !site_name Team, -FOSSEE,IIT Bombay', array( +FOSSEE, IIT Bombay', array( '!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name )) @@ -178,6 +186,18 @@ FOSSEE,IIT Bombay', array( elseif ($form_state['values']['flowsheet_actions'] == 2) { //pending review entire project + if(strlen(trim($form_state['values']['disapprove_message'])) == 0) + { + form_set_error('disapprove_message', t('')); + $msg = drupal_set_message("Please mention the reason for disapproval.", 'error'); + return $msg; + } + else if (strlen(trim($form_state['values']['disapprove_message'])) <= 30) + { + form_set_error('disapprove_message', t('')); + $msg = drupal_set_message("Please mention the reason for disapproval. Minimum 30 character required", 'error'); + return $msg; + } $query = db_select('om_flowsheet_submitted_abstracts'); $query->fields('om_flowsheet_submitted_abstracts'); $query->condition('proposal_id', $form_state['values']['flowsheet_project']); @@ -194,24 +214,29 @@ FOSSEE,IIT Bombay', array( ':submitted_abstract_id' => $abstract_data->id )); } //$abstract_data = $abstracts_q->fetchObject() - drupal_set_message(t('Resubmit the project files.'), 'status'); + drupal_set_message(t('Disapproved the submission.'), 'status'); // email - $email_subject = t('[!site_name][Flowsheeting Project] Your uploaded flowsheeting project have been marked as pending', array( + $email_subject = t('[!site_name][Flowsheeting Project] Your uploaded OpenModelica Flowsheeting Project has been marked as disapproved', array( '!site_name' => variable_get('site_name', '') )); $email_body = array( 0 => t(' -Dear !user_name, +Dear ' . $user_info->contributor_name . ', + +We regret to inform you that your OpenModelica flowsheet and abstract with the following details have been disapproved: -Your all the uploaded flowsheeting project with Title : ' . $user_info->project_title . ' have been marked as pending to be reviewed. +Full Name: ' . $user_info->name_title . ' ' . $user_info->contributor_name . ' +Project Title: ' . $user_info->project_title . ' +Name of compound for which process development is carried out : ' . $user_info->process_development_compound_name . ' +Reason for Disapproval / Feedback: ' . $form_state['values']['disapprove_message'] . ' -You will be able to see the flowsheeting project after approved by one of our reviewers. +You are requested to visit the Abstract and Flowsheet submission page at https://om.fossee.in/flowsheeting-project/abstract-code and re-upload the flowsheet and abstract. Best Wishes, !site_name Team, -FOSSEE,IIT Bombay', array( +FOSSEE, IIT Bombay', array( '!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name )) @@ -239,10 +264,16 @@ FOSSEE,IIT Bombay', array( } //$form_state['values']['flowsheet_actions'] == 2 elseif ($form_state['values']['flowsheet_actions'] == 3) //disapprove and delete entire flowsheeting project { - if (strlen(trim($form_state['values']['message'])) <= 30) + if(strlen(trim($form_state['values']['deletion_message'])) == 0) + { + form_set_error('deletion_message', t('')); + $msg = drupal_set_message("Please mention the reason for deletion.", 'error'); + return $msg; + } + else if (strlen(trim($form_state['values']['deletion_message'])) <= 30) { form_set_error('message', t('')); - $msg = drupal_set_message("Please mention the reason for disapproval. Minimum 30 character required", 'error'); + $msg = drupal_set_message("Please mention the reason for deletion. Minimum 30 character required", 'error'); return $msg; } //strlen(trim($form_state['values']['message'])) <= 30 if (!user_access('om flowsheet bulk delete code')) @@ -253,30 +284,32 @@ FOSSEE,IIT Bombay', array( if (om_flowsheet_abstract_delete_project($form_state['values']['flowsheet_project'])) ////// { drupal_set_message(t('Dis-Approved and Deleted Entire Flowsheeting project.'), 'status'); - $email_subject = t('[!site_name][Flowsheeting Project] Your uploaded flowsheeting project have been marked as dis-approved', array( + $email_subject = t('[!site_name][Flowsheeting Project] Your uploaded OpenModelica Flowsheeting Project has been deleted with the proposal form', array( '!site_name' => variable_get('site_name', '') )); $email_body = array( 0 => t(' -Dear !user_name, +Dear ' . $user_info->contributor_name . ', -We regret to inform you that your om flowsheet and abstract with the following details have been disapproved: +We regret to inform you that your OpenModelica flowsheet and abstract along with the proposal form with the following details have been deleted: Full Name: ' . $user_info->name_title . ' ' . $user_info->contributor_name . ' Project Title: ' . $user_info->project_title . ' Name of compound for which process development is carried out : ' . $user_info->process_development_compound_name . ' -Reason for dis-approval: ' . $form_state['values']['message'] . ' +Reason for dis-approval: ' . $form_state['values']['deletion_message'] . ' + +Now, you can propose a new flowsheet. Best Wishes, !site_name Team, -FOSSEE,IIT Bombay', array( +FOSSEE, IIT Bombay', array( '!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name )) ); - $email_to = $user_data->mail; + $email_to = $user_data->mail; $from = variable_get('om_flowsheet_from_email', ''); $bcc = variable_get('om_flowsheet_emails', ''); $cc = variable_get('om_flowsheet_cc_emails', ''); @@ -329,9 +362,9 @@ function _bulk_list_flowsheet_actions() $flowsheet_actions = array( 0 => 'Please select...' ); - $flowsheet_actions[1] = 'Approve Entire Flowsheeting Project'; - $flowsheet_actions[2] = 'Pending Review Entire Flowsheeting Project'; - $flowsheet_actions[3] = 'Dis-Approve Entire Flowsheeting Project (This will delete Flowsheeting Project)'; + $flowsheet_actions[1] = 'Approve entire flowsheeting project(This action will approve the uploaded flowsheet and abstract)'; + $flowsheet_actions[2] = 'Disapprove entire flowsheeting project(Enables the submission interface for the user(Files will not be deleted but replaced if user re-uploads)'; + $flowsheet_actions[3] = 'Delete entire flowsheeting project including proposal(This action will delete the entire project files including the proposal.)'; //$flowsheet_actions[4] = 'Delete Entire Flowsheeting Project Including Proposal'; return $flowsheet_actions; } diff --git a/email.inc b/email.inc index 80a5d82..d51ec7a 100755 --- a/email.inc +++ b/email.inc @@ -36,16 +36,16 @@ function om_flowsheet_mail($key, &$message, $params) } $message['headers'] = $params['om_flowsheet_proposal_received']['headers']; - $message['subject'] = t('[!site_name][Flowsheeting Project] Your om Flowsheeting Project proposal has been received', array( + $message['subject'] = t('[!site_name][Flowsheeting Project] Your OpenModelica Flowsheeting Project proposal has been received', array( '!site_name' => variable_get('site_name', '') ), array( 'language' => $language->language )); $message['body'] = array( 'body' => t(' -Dear !user_name, +Dear ' . $proposal_data->contributor_name .', -Thank you for submitting proposal for the om Flowsheeting Project. The details of your proposal are as below. +Thank you for submitting proposal for the OpenModelica Flowsheeting Project. The details of your proposal are as below. Full Name: ' . $proposal_data->name_title . ' ' . $proposal_data->contributor_name . ' Email: ' . $user_data->mail . ' @@ -60,7 +60,7 @@ Your proposal is under review. You will be notified via email about the approval Best Wishes, !site_name Team, -FOSSEE,IIT Bombay', array( +FOSSEE, IIT Bombay', array( '!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name ), array( @@ -94,16 +94,16 @@ FOSSEE,IIT Bombay', array( $project_guide_email_id = $proposal_data->project_guide_email_id; } $message['headers'] = $params['om_flowsheet_proposal_disapproved']['headers']; - $message['subject'] = t('[!site_name][Flowsheeting Project] Your om Flowsheeting Project proposal has been disapproved', array( + $message['subject'] = t('[!site_name][Flowsheeting Project] Your OpenModelica Flowsheeting Project proposal has been disapproved', array( '!site_name' => variable_get('site_name', '') ), array( 'language' => $language->language )); $message['body'] = array( 'body' => t(' -Dear !user_name, +Dear ' . $proposal_data->contributor_name . ', -We regret to inform you that your om Flowsheeting Project proposal with following details have been disapproved. +We regret to inform you that your OpenModelica Flowsheeting Project proposal with following details have been disapproved. Full Name: ' . $proposal_data->name_title . ' ' . $proposal_data->contributor_name . ' Project Title: ' . $proposal_data->project_title . ' @@ -112,13 +112,12 @@ Reason(s) / Feedback: ' . $proposal_data->dissapproval_reason . ' Please note that any files that were uploaded along with the proposal form will be deleted from all our database(s). -Thank you for participating in the om Flowsheeting Project. You are welcome to submit a new proposal. - +Thank you for participating in the OpenModelica Flowsheeting Project. You are welcome to submit a new proposal. Best Wishes, !site_name Team, -FOSSEE,IIT Bombay', array( +FOSSEE, IIT Bombay', array( '!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name ), array( @@ -134,7 +133,7 @@ FOSSEE,IIT Bombay', array( $query->range(0, 1); $proposal_data = $query->execute()->fetchObject(); $user_data = user_load($params['om_flowsheet_proposal_approved']['user_id']); - $url = 'https://om.fossee.in/flowsheeting-project/coding-guidelines-flowsheeting'; + $url = 'https://om.fossee.in/flowsheeting-project/coding-guidelines'; if ($proposal_data->project_guide_name == "NULL" || $proposal_data->project_guide_name == "") { $project_guide_name = "Not Entered"; @@ -152,29 +151,29 @@ FOSSEE,IIT Bombay', array( $project_guide_email_id = $proposal_data->project_guide_email_id; } $message['headers'] = $params['om_flowsheet_proposal_approved']['headers']; - $message['subject'] = t('[!site_name][Flowsheeting Project] Your om Flowsheeting Project proposal has been approved', array( + $message['subject'] = t('[!site_name][Flowsheeting Project] Your OpenModelica Flowsheeting Project proposal has been approved', array( '!site_name' => variable_get('site_name', '') ), array( 'language' => $language->language )); $message['body'] = array( 'body' => t(' -Dear !user_name, +Dear ' . $proposal_data->contributor_name . ', -Congratulations! Your proposal for om Flowsheeting Project with the following details is approved. +Congratulations! Your proposal for OpenModelica Flowsheeting Project with the following details is approved. Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->contributor_name . ' Project Title : ' . $proposal_data->project_title . ' Name of compound for which process development is carried out : ' . $proposal_data->process_development_compound_name . ' -Please ensure that ALL the guidelines for coding at https://om.fossee.in/flowsheeting-project/coding-guidelines-flowsheeting are strictly followed. Refer https://om.fossee.in/flowsheeting-project/flowsheeting-internship for the further procedure for submission of the project. Kindly ensure that the flowsheet and abstract are submitted within 1 month. +Please ensure that ALL the guidelines for coding at https://om.fossee.in/flowsheeting-project/coding-guidelines are strictly followed. Refer https://om.fossee.in/flowsheeting-project/internship for the further procedure for submission of the project. Kindly ensure that the flowsheet and abstract are submitted within 1 month. -You can upload your abstract using abstract submission interface. +You can upload your abstract using abstract and flowsheet submission interface' . l('here', 'https://om.fossee.in/flowsheeting-project/abstract-code') . ' Best Wishes, !site_name Team, -FOSSEE,IIT Bombay', array( +FOSSEE, IIT Bombay', array( '!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name ), array( @@ -207,16 +206,16 @@ FOSSEE,IIT Bombay', array( $project_guide_email_id = $proposal_data->project_guide_email_id; } $message['headers'] = $params['om_flowsheet_proposal_completed']['headers']; - $message['subject'] = t('[!site_name][Flowsheeting Project] Your om Flowsheeting Project proposal has been completed', array( + $message['subject'] = t('[!site_name][Flowsheeting Project] Your OpenModelica Flowsheeting Project has been completed', array( '!site_name' => variable_get('site_name', '') ), array( 'language' => $language->language )); $message['body'] = array( 'body' => t(' -Dear !user_name, +Dear ' . $proposal_data->contributor_name . ', -Your om flowsheet and abstract on the following process have been published successfully. +Your OpenModelica flowsheet and abstract on the following process have been published successfully. Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->contributor_name . ' Project Title : ' . $proposal_data->project_title . ' @@ -226,13 +225,12 @@ https://om.fossee.in/flowsheeting-project/completed-flowsheet You can now download your e-certificate after logging into the om website: om.fossee.in. On the left-hand side panel, go to User Dashboard > Flowsheet Certificates > Download. In case of any difficulties, kindly let us know. -Thank you for participating in the om Flowsheeting Project. You are welcome to propose a new flowsheet. - +Thank you for participating in the OpenModelica Flowsheeting Project. You are welcome to propose a new flowsheet. Best Wishes, !site_name Team, -FOSSEE,IIT Bombay', array( +FOSSEE, IIT Bombay', array( '!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name ), array( @@ -266,36 +264,24 @@ FOSSEE,IIT Bombay', array( $project_guide_email_id = $proposal_data->project_guide_email_id; } $message['headers'] = $params['om_flowsheet_proposal_deleted']['headers']; - $message['subject'] = t('[!site_name][Flowsheeting Project] Your om Flowsheeting Project proposal has been deleted', array( + $message['subject'] = t('[!site_name][Flowsheeting Project] Your OpenModelica Flowsheeting Project proposal has been deleted', array( '!site_name' => variable_get('site_name', '') ), array( 'language' => $language->language )); $message['body'] = array( 'body' => t(' -Dear !user_name, +Dear ' . $proposal_data->contributor_name . ', -Your om Flowsheeting Project proposal with the following details has been deleted : +Your OpenModelica Flowsheeting Project proposal with the following details has been deleted : Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->contributor_name . ' Email : ' . $user_data->mail . ' -Month and Year of Award of Degree : ' . $proposal_data->month_year_of_degree . ' University/Institute : ' . $proposal_data->university . ' -City : ' . $proposal_data->city . ' -State : ' . $proposal_data->state . ' -Country : ' . $proposal_data->country . ' - -Project Guide : ' . $project_guide_name . ' -Project Guide Email : ' . $project_guide_email_id . ' - -om Version : ' . $proposal_data->version . ' - +OpenModelica Version : ' . $proposal_data->version . ' Project Title : ' . $proposal_data->project_title . ' - Name of compound for which process development is carried out : ' . $proposal_data->process_development_compound_name . ' - - You can propose a new flowsheet project. Best Wishes, @@ -319,7 +305,8 @@ FOSSEE,IIT Bombay', array( $proposal_data = $query->execute()->fetchObject(); $user_data = user_load($params['abstract_uploaded']['user_id']); - $message['subject'] = t('[!site_name][Flowsheeting Project] You have uploaded om flowsheet abstract', array( + $message['subject'] = t('[!site_name][Flowsheeting Project] You have uploaded OpenModelica flowsheet and abstract +', array( '!site_name' => variable_get('site_name', '') ), array( 'language' => $language->language @@ -327,20 +314,20 @@ FOSSEE,IIT Bombay', array( $message['headers'] = $params['abstract_uploaded']['headers']; $message['body'] = array( 'body' => t(' -Dear !user_name, +Dear ' . $proposal_data->contributor_name . ', -You have successfully uploaded your om flowsheet and abstract with the following details. +You have successfully uploaded your OpenModelica flowsheet and abstract with the following details. Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->contributor_name . ' Project Title : ' . $proposal_data->project_title . ' Name of compound for which process development is carried out : ' . $proposal_data->process_development_compound_name . ' -You shall be notified via email after the flowsheet and abstract are reviewed and approved / disapproved. This may take upto 30 working days. +You shall be notified via email after the flowsheet and abstract are reviewed and approved / disapproved. This may take upto 45 working days. Best Wishes, !site_name Team, -FOSSEE,IIT Bombay', array( +FOSSEE, IIT Bombay', array( '!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name ), array( diff --git a/settings.inc b/settings.inc index 9542dbd..cda4bc2 100755 --- a/settings.inc +++ b/settings.inc @@ -29,33 +29,6 @@ function om_flowsheet_settings_form($form, $form_state) '#required' => TRUE, '#default_value' => variable_get('om_flowsheet_from_email', '') ); - $form['extensions']['user_defind_compound_source'] = array( - '#type' => 'textfield', - '#title' => t('Allowed source file extensions for user defind compound'), - '#description' => t('A comma separated list WITHOUT SPACE of source file extensions that are permitted to be uploaded on the server'), - '#size' => 50, - '#maxlength' => 255, - '#required' => TRUE, - '#default_value' => variable_get('om_flowsheet_user_defind_compound_source_extensions', '') - ); - $form['extensions']['dependency'] = array( - '#type' => 'textfield', - '#title' => t('Allowed dependency file extensions'), - '#description' => t('A comma separated list WITHOUT SPACE of dependency file extensions that are permitted to be uploaded on the server'), - '#size' => 50, - '#maxlength' => 255, - '#required' => TRUE, - '#default_value' => variable_get('om_flowsheet_dependency_extensions', '') - ); - $form['extensions']['result'] = array( - '#type' => 'textfield', - '#title' => t('Allowed result file extensions'), - '#description' => t('A comma separated list WITHOUT SPACE of result file extensions that are permitted to be uploaded on the server'), - '#size' => 50, - '#maxlength' => 255, - '#required' => TRUE, - '#default_value' => variable_get('om_flowsheet_result_extensions', '') - ); $form['extensions']['abstract_upload'] = array( '#type' => 'textfield', '#title' => t('Allowed abstract file extensions'), @@ -89,9 +62,6 @@ function om_flowsheet_settings_form_submit($form, &$form_state) variable_set('om_flowsheet_emails', $form_state['values']['emails']); variable_set('om_flowsheet_cc_emails', $form_state['values']['cc_emails']); variable_set('om_flowsheet_from_email', $form_state['values']['from_email']); - variable_set('om_flowsheet_user_defind_compound_source_extensions', $form_state['values']['user_defind_compound_source']); - variable_set('om_flowsheet_dependency_extensions', $form_state['values']['dependency']); - variable_set('om_flowsheet_result_extensions', $form_state['values']['result']); variable_set('om_flowsheet_abstract_upload_extensions', $form_state['values']['abstract_upload']); variable_set('om_flowsheet_flowsheet_developed_process_source_extensions', $form_state['values']['flowsheet_upload']); drupal_set_message(t('Settings updated'), 'status'); -- cgit