From bd61ca0bae497fef876a3b8c716e70919e651474 Mon Sep 17 00:00:00 2001
From: prashant
Date: Wed, 4 Nov 2015 18:10:42 +0530
Subject: mail function modifed and formated the code
---
code_approval.inc | 647 +++++++++++++++++---------------
download.inc | 2 +-
email.inc | 862 ++++++++++++++++++++++---------------------
general_deletion.inc | 59 ++-
lab_migration.module | 2 +-
manage_proposal.inc | 117 +++---
manage_solution_proposal.inc | 53 ++-
proposal.inc | 37 +-
run.inc | 2 +-
settings.inc | 29 +-
solution_proposal.inc | 20 +-
upload_code.inc | 19 +-
upload_code_delete.inc | 18 +-
13 files changed, 1033 insertions(+), 834 deletions(-)
diff --git a/code_approval.inc b/code_approval.inc
index 14b333e..73ffd73 100755
--- a/code_approval.inc
+++ b/code_approval.inc
@@ -1,319 +1,374 @@
fields('lab_migration_solution');
- $query->condition('approval_status', 0);
- $pending_solution_q = $query->execute();
- if (!$pending_solution_q) {
- drupal_set_message(t('There are no pending code approvals.'), 'status');
- return '';
- }
- $pending_solution_rows = array();
- while ($pending_solution_data = $pending_solution_q->fetchObject()) {
- /* get experiment data */
- //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE id = %d", $pending_solution_data->experiment_id);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('id', $pending_solution_data->experiment_id);
- $experiment_q = $query->execute();
- $experiment_data = $experiment_q->fetchObject();
- /* get proposal data */
- // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d", $experiment_data->proposal_id);
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $experiment_data->proposal_id);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
- /* get solution provider details */
- $solution_provider_user_name = '';
- $user_data = user_load($proposal_data->solution_provider_uid);
- if ($user_data) {
- $solution_provider_user_name = $user_data->name;
- } else {
- $solution_provider_user_name = '';
- }
- /* setting table row information */
- $pending_solution_rows[] = array(
- $proposal_data->lab_title,
- $experiment_data->title,
- $proposal_data->name,
- $solution_provider_user_name,
- l('Edit', 'lab-migration/code-approval/approve/' . $pending_solution_data->id)
- );
- }
- /* check if there are any pending solutions */
- if (!$pending_solution_rows) {
- drupal_set_message(t('There are no pending solutions'), 'status');
- return '';
- }
- $header = array(
- 'Title of the Lab',
- 'Experiment',
- 'Proposer',
- 'Solution Provider',
- 'Actions'
- );
- //$output = theme_table($header, $pending_solution_rows);
- $output = theme('table', array(
- 'header' => $header,
- 'rows' => $pending_solution_rows
- ));
- return $output;
-}
-function lab_migration_code_approval_form($form, $form_state)
-{
- $solution_id = (int) arg(3);
- /* get solution details */
- //$solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d", $solution_id);
- $query = db_select('lab_migration_solution');
- $query->fields('lab_migration_solution');
- $query->condition('id', $solution_id);
- $solution_q = $query->execute();
- $solution_data = $solution_q->fetchObject();
- if (!$solution_data) {
- drupal_set_message(t('Invalid solution selected.'), 'status');
- drupal_goto('lab-migration/code-approval');
- }
- if ($solution_data->approval_status == 1) {
- drupal_set_message(t('This solution has already been approved. Are you sure you want to change the approval status?'), 'error');
- }
- if ($solution_data->approval_status == 2) {
- drupal_set_message(t('This solution has already been dis-approved. Are you sure you want to change the approval status?'), 'error');
- }
- /* get experiment data */
- //xperiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE id = %d", $solution_data->experiment_id);
+ /* get a list of unapproved solutions */
+ //$pending_solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE approval_status = 0");
+ $query = db_select('lab_migration_solution');
+ $query->fields('lab_migration_solution');
+ $query->condition('approval_status', 0);
+ $pending_solution_q = $query->execute();
+ if (!$pending_solution_q)
+ {
+ drupal_set_message(t('There are no pending code approvals.'), 'status');
+ return '';
+ }
+ $pending_solution_rows = array();
+ while ($pending_solution_data = $pending_solution_q->fetchObject())
+ {
+ /* get experiment data */
+ //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE id = %d", $pending_solution_data->experiment_id);
$query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('id', $solution_data->experiment_id);
- $experiment_q = $query->execute();
+ $query->fields('lab_migration_experiment');
+ $query->condition('id', $pending_solution_data->experiment_id);
+ $experiment_q = $query->execute();
$experiment_data = $experiment_q->fetchObject();
+
/* get proposal data */
- //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d", $experiment_data->proposal_id);
+ // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d", $experiment_data->proposal_id);
$query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $experiment_data->proposal_id);
- $proposal_q = $query->execute();
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $experiment_data->proposal_id);
+ $proposal_q = $query->execute();
+
+
$proposal_data = $proposal_q->fetchObject();
+
/* get solution provider details */
$solution_provider_user_name = '';
$user_data = user_load($proposal_data->solution_provider_uid);
if ($user_data) {
- $solution_provider_user_name = $user_data->name;
+ $solution_provider_user_name = $user_data->name;
} else {
- $solution_provider_user_name = '';
- }
- $form['#tree'] = TRUE;
- $form['lab_title'] = array(
- '#type' => 'item',
- '#markup' => $proposal_data->lab_title,
- '#title' => t('Title of the Lab')
- );
- $form['name'] = array(
- '#type' => 'item',
- '#markup' => $proposal_data->name,
- '#title' => t('Contributor Name')
- );
- $form['experiment']['number'] = array(
- '#type' => 'item',
- '#markup' => $experiment_data->number,
- '#title' => t('Experiment Number')
- );
- $form['experiment']['title'] = array(
- '#type' => 'item',
- '#markup' => $experiment_data->title,
- '#title' => t('Title of the Experiment')
- );
- $form['back_to_list'] = array(
- '#type' => 'item',
- '#markup' => l('Back to Code Approval List', 'lab-migration/code-approval')
- );
- $form['code_number'] = array(
- '#type' => 'item',
- '#markup' => $solution_data->code_number,
- '#title' => t('Code No')
- );
- $form['code_caption'] = array(
- '#type' => 'item',
- '#markup' => $solution_data->caption,
- '#title' => t('Caption')
- );
- /* get solution files */
- $solution_files_html = '';
- //$solution_files_q = db_query("SELECT * FROM {lab_migration_solution_files} WHERE solution_id = %d ORDER BY id ASC", $solution_id);
- $query = db_select('lab_migration_solution_files');
- $query->fields('lab_migration_solution_files');
- $query->condition('solution_id', $solution_id);
- $query->orderBy('id', 'ASC');
- $solution_files_q = $query->execute();
- if ($solution_files_q) {
- while ($solution_files_data = $solution_files_q->fetchObject()) {
- $code_file_type = '';
- switch ($solution_files_data->filetype) {
- case 'S':
- $code_file_type = 'Source';
- break;
- case 'R':
- $code_file_type = 'Result';
- break;
- case 'X':
- $code_file_type = 'Xcox';
- break;
- case 'U':
- $code_file_type = 'Unknown';
- break;
- default:
- $code_file_type = 'Unknown';
- break;
- }
- $solution_files_html .= l($solution_files_data->filename, 'lab-migration/download/file/' . $solution_files_data->id) . ' (' . $code_file_type . ')' . '
';
- }
+ $solution_provider_user_name = '';
}
- /* get dependencies files */
- //$dependency_q = db_query("SELECT * FROM {lab_migration_solution_dependency} WHERE solution_id = %d ORDER BY id ASC", $solution_id);
- $query = db_select('lab_migration_solution_dependency');
- $query->fields('lab_migration_solution_dependency');
- $query->condition('solution_id', $solution_id);
- $query->orderBy('id', 'ASC');
- $dependency_q = $query->execute();
- while ($dependency_data = $dependency_q->fetchObject()) {
- //$dependency_files_q = db_query("SELECT * FROM {lab_migration_dependency_files} WHERE id = %d", $dependency_data->dependency_id);
- $query = db_select('lab_migration_dependency_files');
- $query->fields('lab_migration_dependency_files');
- $query->condition('id', $dependency_data->dependency_id);
- $dependency_files_q = $query->execute();
- $dependency_files_data = $dependency_files_q->fetchObject();
- $solution_file_type = 'Dependency file';
- $solution_files_html .= l($dependency_files_data->filename, 'lab-migration/download/dependency/' . $dependency_files_data->id) . ' (' . 'Dependency' . ')' . '
';
- }
- $form['solution_files'] = array(
- '#type' => 'item',
- '#markup' => $solution_files_html,
- '#title' => t('Solution')
- );
- $form['approved'] = array(
- '#type' => 'radios',
- '#options' => array(
- '0' => 'Pending',
- '1' => 'Approved',
- '2' => 'Dis-approved (Solution will be deleted)'
- ),
- '#title' => t('Approval'),
- '#default_value' => $solution_data->approval_status
- );
- $form['message'] = array(
- '#type' => 'textarea',
- '#title' => t('Reason for dis-approval'),
- '#attributes' => array(
- 'placeholder' => t('Enter reason for dis-approval'),
- 'cols' => 50,
- 'rows' => 4
- ),
- '#states' => array(
+
+ /* setting table row information */
+ $pending_solution_rows[] = array($proposal_data->lab_title, $experiment_data->title, $proposal_data->name, $solution_provider_user_name, l('Edit', 'lab-migration/code-approval/approve/' . $pending_solution_data->id));
+ }
+
+ /* check if there are any pending solutions */
+ if (!$pending_solution_rows)
+ {
+ drupal_set_message(t('There are no pending solutions'), 'status');
+ return '';
+ }
+
+ $header = array('Title of the Lab', 'Experiment', 'Proposer', 'Solution Provider', 'Actions');
+ //$output = theme_table($header, $pending_solution_rows);
+ $output =theme('table', array('header' => $header, 'rows' => $pending_solution_rows ));
+ return $output;
+}
+
+function lab_migration_code_approval_form($form_state)
+{
+ $solution_id = (int)arg(3);
+
+ /* get solution details */
+ //$solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d", $solution_id);
+ $query = db_select('lab_migration_solution');
+ $query->fields('lab_migration_solution');
+ $query->condition('id', $solution_id);
+ $solution_q = $query->execute();
+ $solution_data = $solution_q->fetchObject();
+ if (!$solution_data)
+ {
+ drupal_set_message(t('Invalid solution selected.'), 'status');
+ drupal_goto('lab-migration/code-approval');
+ }
+ if ($solution_data->approval_status == 1) {
+ drupal_set_message(t('This solution has already been approved. Are you sure you want to change the approval status?'), 'error');
+ }
+ if ($solution_data->approval_status == 2) {
+ drupal_set_message(t('This solution has already been dis-approved. Are you sure you want to change the approval status?'), 'error');
+ }
+
+ /* get experiment data */
+ //xperiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE id = %d", $solution_data->experiment_id);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('id', $solution_data->experiment_id);
+ $experiment_q = $query->execute();
+ $experiment_data = $experiment_q->fetchObject();
+
+ /* get proposal data */
+ //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d", $experiment_data->proposal_id);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $experiment_data->proposal_id);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+
+ /* get solution provider details */
+ $solution_provider_user_name = '';
+ $user_data = user_load($proposal_data->solution_provider_uid);
+ if ($user_data) {
+ $solution_provider_user_name = $user_data->name;
+ } else {
+ $solution_provider_user_name = '';
+ }
+
+ $form['#tree'] = TRUE;
+
+ $form['lab_title'] = array(
+ '#type' => 'item',
+ '#markup' => $proposal_data->lab_title,
+ '#title' => t('Title of the Lab'),
+ );
+
+ $form['name'] = array(
+ '#type' => 'item',
+ '#markup' => $proposal_data->name,
+ '#title' => t('Contributor Name'),
+ );
+
+ $form['experiment']['number'] = array(
+ '#type' => 'item',
+ '#markup' => $experiment_data->number,
+ '#title' => t('Experiment Number'),
+ );
+
+ $form['experiment']['title'] = array(
+ '#type' => 'item',
+ '#markup' => $experiment_data->title,
+ '#title' => t('Title of the Experiment'),
+ );
+
+ $form['back_to_list'] = array(
+ '#type' => 'item',
+ '#markup' => l('Back to Code Approval List', 'lab-migration/code-approval'),
+ );
+
+ $form['code_number'] = array(
+ '#type' => 'item',
+ '#markup' => $solution_data->code_number,
+ '#title' => t('Code No'),
+ );
+
+ $form['code_caption'] = array(
+ '#type' => 'item',
+ '#markup' => $solution_data->caption,
+ '#title' => t('Caption'),
+ );
+
+ /* get solution files */
+ $solution_files_html = '';
+ //$solution_files_q = db_query("SELECT * FROM {lab_migration_solution_files} WHERE solution_id = %d ORDER BY id ASC", $solution_id);
+ $query = db_select('lab_migration_solution_files');
+ $query->fields('lab_migration_solution_files');
+ $query->condition('solution_id', $solution_id);
+ $query->orderBy('id', 'ASC');
+ $solution_files_q = $query->execute();
+
+ if ($solution_files_q) {
+ while ($solution_files_data = $solution_files_q->fetchObject()) {
+ $code_file_type = '';
+ switch ($solution_files_data->filetype) {
+ case 'S': $code_file_type = 'Source'; break;
+ case 'R': $code_file_type = 'Result'; break;
+ case 'X': $code_file_type = 'Xcox'; break;
+ case 'U': $code_file_type = 'Unknown'; break;
+ default: $code_file_type = 'Unknown'; break;
+ }
+ $solution_files_html .= l($solution_files_data->filename, 'lab-migration/download/file/' . $solution_files_data->id) . ' (' . $code_file_type . ')' . '
';
+ /*if(strlen($solution_files_data->pdfpath)>=5){
+ $pdfname=substr($solution_files_data->pdfpath, strrpos($solution_files_data->pdfpath, '/') + 1);
+ $solution_files_html .=l($pdfname, 'lab-migration/download/pdf/' . $solution_files_data->id). ' (PDF File)' . '
';
+ }*/
+ }
+ }
+ /* get dependencies files */
+ //$dependency_q = db_query("SELECT * FROM {lab_migration_solution_dependency} WHERE solution_id = %d ORDER BY id ASC", $solution_id);
+ $query = db_select('lab_migration_solution_dependency');
+$query->fields('lab_migration_solution_dependency');
+$query->condition('solution_id', $solution_id);
+$query->orderBy('id', 'ASC');
+$dependency_q = $query->execute();
+ while ($dependency_data = $dependency_q->fetchObject())
+ {
+ //$dependency_files_q = db_query("SELECT * FROM {lab_migration_dependency_files} WHERE id = %d", $dependency_data->dependency_id);
+ $query = db_select('lab_migration_dependency_files');
+ $query->fields('lab_migration_dependency_files');
+ $query->condition('id', $dependency_data->dependency_id);
+ $dependency_files_q = $query->execute();
+ $dependency_files_data = $dependency_files_q->fetchObject();
+ $solution_file_type = 'Dependency file';
+ $solution_files_html .= l($dependency_files_data->filename, 'lab-migration/download/dependency/' . $dependency_files_data->id) . ' (' . 'Dependency' . ')' . '
';
+ }
+
+ $form['solution_files'] = array(
+ '#type' => 'item',
+ '#markup' => $solution_files_html,
+ '#title' => t('Solution'),
+ );
+
+ $form['approved'] = array(
+ '#type' => 'radios',
+ '#options' => array('0' => 'Pending', '1' => 'Approved', '2' => 'Dis-approved (Solution will be deleted)'),
+ '#title' => t('Approval'),
+ '#default_value' => $solution_data->approval_status,
+ );
+
+ $form['message'] = array(
+ '#type' => 'textarea',
+ '#title' => t('Reason for dis-approval'),
+ '#states' => array(
'visible' => array(
- ':input[name="approved"]' => array(
- 'value' => "2"
- )
- )
- )
- );
- $form['submit'] = array(
- '#type' => 'submit',
- '#value' => t('Submit')
- );
- $form['cancel'] = array(
- '#type' => 'markup',
- '#markup' => l(t('Cancel'), 'lab-migration/code-approval')
- );
- return $form;
+ ':input[name="approved"]' => array('value' => '2'),
+ ),
+ 'required' => array(
+ ':input[name="approved"]' => array('value' => '2')
+ ),
+ ),
+ );
+
+ $form['submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Submit')
+ );
+
+ $form['cancel'] = array(
+ '#type' => 'markup',
+ '#markup' => l(t('Cancel'), 'lab_migration/code_approval'),
+ );
+
+ return $form;
}
+
+
+
function lab_migration_code_approval_form_validate($form, &$form_state)
{
- if ($form_state['values']['approved'] == 2) {
- if ($form_state['values']['message'] == "") {
- form_set_error('message', t('Reason for dis-approval could not be empty'));
- }
- }
+ if( $form_state['values']['approved']==2){
+ if(strlen(trim($form_state['values']['message'])) <=30){
+ form_set_error('message', t('Please mention the reason for disapproval.'));
+ }
+ }
+ return;
+
}
+
function lab_migration_code_approval_form_submit($form, &$form_state)
{
- global $user;
- $solution_id = (int) arg(3);
- /* get solution details */
- //$solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d", $solution_id);
- $query = db_select('lab_migration_solution');
- $query->fields('lab_migration_solution');
- $query->condition('id', $solution_id);
- $solution_q = $query->execute();
- $solution_data = $solution_q->fetchObject();
- if (!$solution_data) {
- drupal_set_message(t('Invalid solution selected.'), 'status');
- drupal_goto('lab-migration/code-approval');
- }
- /* get experiment data */
- //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE id = %d", $solution_data->experiment_id);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('id', $solution_data->experiment_id);
- $experiment_q = $query->execute();
- $experiment_data = $experiment_q->fetchObject();
- /* get proposal data */
- //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d", $experiment_data->proposal_id);
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $experiment_data->proposal_id);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
- $user_data = user_load($proposal_data->uid);
- $solution_prove_user_data = user_load($proposal_data->solution_provider_uid);
- // **** TODO **** : del_lab_pdf($proposal_data->id);
- if ($form_state['values']['approved'] == "0") {
- $query = "UPDATE {lab_migration_solution} SET approval_status = 0, approver_uid = :approver_uid, approval_date = :approval_date WHERE id = :solution_id";
- $args = array(
- ":approver_uid" => $user->uid,
- ":approval_date" => time(),
- ":solution_id" => $solution_id
- );
- db_query($query, $args);
- /* sending email */
- $email_to = $user_data->mail . ', ' . variable_get('lab_migration_emails', '');
- $param['solution_pending']['solution_id'] = $solution_id;
- $param['solution_pending']['user_id'] = $user_data->uid;
- if (!drupal_mail('lab_migration', 'solution_pending', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
- } else if ($form_state['values']['approved'] == "1") {
- $query = "UPDATE {lab_migration_solution} SET approval_status = 1, approver_uid = :approver_uid, approval_date = :approval_date WHERE id = :solution_id";
- $args = array(
- ":approver_uid" => $user->uid,
- ":approval_date" => time(),
- ":solution_id" => $solution_id
- );
- db_query($query, $args);
- /* sending email */
- $email_to = $user_data->mail . ', ' . variable_get('lab_migration_emails', '');
- $param['solution_approved']['solution_id'] = $solution_id;
- $param['solution_approved']['user_id'] = $user_data->uid;
- if (!drupal_mail('lab_migration', 'solution_approved', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
- } else if ($form_state['values']['approved'] == "2") {
- if (lab_migration_delete_solution($solution_id)) {
- /* sending email */
- $email_to = $user_data->mail . ', ' . variable_get('lab_migration_emails', '');
- $param['solution_disapproved']['experiment_number'] = $experiment_data->number;
- $param['solution_disapproved']['experiment_title'] = $experiment_data->title;
- $param['solution_disapproved']['solution_number'] = $solution_data->code_number;
- $param['solution_disapproved']['solution_caption'] = $solution_data->caption;
- $param['solution_disapproved']['user_id'] = $user_data->uid;
- $param['solution_disapproved']['message'] = $form_state['values']['message'];
- if (!drupal_mail('lab_migration', 'solution_disapproved', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
- } else {
- drupal_set_message('Error disapproving and deleting solution. Please contact administrator.', 'error');
- }
- }
- drupal_set_message('Updated successfully.', 'status');
- drupal_goto('lab-migration/code-approval');
+ global $user;
+
+ $solution_id = (int)arg(3);
+
+ /* get solution details */
+ //$solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d", $solution_id);
+ $query = db_select('lab_migration_solution');
+ $query->fields('lab_migration_solution');
+ $query->condition('id', $solution_id);
+ $solution_q = $query->execute();
+ $solution_data = $solution_q->fetchObject();
+ if (!$solution_data)
+ {
+ drupal_set_message(t('Invalid solution selected.'), 'status');
+ drupal_goto('lab_migration/code_approval');
+ }
+
+ /* get experiment data */
+ //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE id = %d", $solution_data->experiment_id);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('id', $solution_data->experiment_id);
+ $experiment_q = $query->execute();
+ $experiment_data = $experiment_q->fetchObject();
+
+ /* get proposal data */
+ //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d", $experiment_data->proposal_id);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $experiment_data->proposal_id);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+
+ $user_data = user_load($proposal_data->uid);
+ $solution_prove_user_data = user_load($proposal_data->solution_provider_uid);
+
+ // **** TODO **** : del_lab_pdf($proposal_data->id);
+
+ if ($form_state['values']['approved'] == "0")
+ {
+ $query = "UPDATE {lab_migration_solution} SET approval_status = 0, approver_uid = :approver_uid, approval_date = :approval_date WHERE id = :solution_id";
+ $args = array(
+ ":approver_uid" => $user->uid,
+ ":approval_date" => time(),
+ ":solution_id" => $solution_id,
+ );
+ db_query($query, $args);
+ /* sending email */
+ $email_to = $user_data->mail;
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc= variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
+
+ $param['solution_pending']['solution_id'] = $solution_id;
+ $param['solution_pending']['user_id'] = $user_data->uid;
+ $param['solution_pending']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+ if (!drupal_mail('lab_migration', 'solution_pending', $email_to, language_default(), $param, $from, TRUE))
+ drupal_set_message('Error sending email message.', 'error');
+ } else if ($form_state['values']['approved'] == "1") {
+ $query = "UPDATE {lab_migration_solution} SET approval_status = 1, approver_uid = :approver_uid, approval_date = :approval_date WHERE id = :solution_id";
+ $args = array(
+ ":approver_uid" => $user->uid,
+ ":approval_date" => time(),
+ ":solution_id" => $solution_id,
+ );
+ db_query($query, $args);
+
+ /* sending email */
+ $email_to = $user_data->mail;
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc= variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
+ $param['solution_approved']['solution_id'] = $solution_id;
+ $param['solution_approved']['user_id'] = $user_data->uid;
+ $param['solution_approved']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+ if (!drupal_mail('lab_migration', 'solution_approved', $email_to, language_default(), $param, $from, TRUE))
+ drupal_set_message('Error sending email message.', 'error');
+ } else if ($form_state['values']['approved'] == "2") {
+ if (lab_migration_delete_solution($solution_id))
+ {
+ /* sending email */
+ $email_to = $user_data->mail;
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc= variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
+ $param['solution_disapproved']['experiment_number'] = $experiment_data->number;
+ $param['solution_disapproved']['experiment_title'] = $experiment_data->title;
+ $param['solution_disapproved']['solution_number'] = $solution_data->code_number;
+ $param['solution_disapproved']['solution_caption'] = $solution_data->caption;
+ $param['solution_disapproved']['user_id'] = $user_data->uid;
+ $param['solution_disapproved']['message'] = $form_state['values']['message'];
+ $param['solution_disapproved']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+ if (!drupal_mail('lab_migration', 'solution_disapproved', $email_to, language_default(), $param, $from, TRUE))
+ drupal_set_message('Error sending email message.', 'error');
+ } else {
+ drupal_set_message('Error disapproving and deleting solution. Please contact administrator.', 'error');
+ }
+ }
+
+ drupal_set_message('Updated successfully.', 'status');
+ drupal_goto('lab-migration/code-approval');
}
+
diff --git a/download.inc b/download.inc
index 224c44b..d22a702 100755
--- a/download.inc
+++ b/download.inc
@@ -292,7 +292,7 @@ function lab_migration_download_lab()
}
} else {
drupal_set_message("There are no solutions in this Lab to download", 'error');
- drupal_goto('lab_migration_run');
+ drupal_goto('lab-migration/lab-migration-run');
}
}
diff --git a/email.inc b/email.inc
index 081c2e7..0f7f650 100755
--- a/email.inc
+++ b/email.inc
@@ -1,46 +1,52 @@
fields('lab_migration_proposal');
- $query->condition('id', $params['solution_proposal_approved']['proposal_id']);
- $query->range(0, 1);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
- // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['solution_proposal_approved']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('proposal_id', $params['solution_proposal_approved']['proposal_id']);
- $query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
- $experiment_list = '
- ';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= '' . $experiment_data->number . ') ' . $experiment_data->title . ' ' . $experiment_data->description . ' ';
- }
- $user_data = user_load($params['solution_proposal_approved']['user_id']);
- $message['subject'] = t('[!site_name] Lab Migration Solution Proposal Approval', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 0 => t('
+{
+
+ global $user;
+ $language = $message['language'];
+ //$language = user_preferred_language($user);
+ switch ($key)
+ {
+ case 'solution_proposal_approved':
+
+ /* initializing data */
+ //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['solution_proposal_approved']['proposal_id']);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $params['solution_proposal_approved']['proposal_id']);
+ $query->range(0, 1);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+
+ if ($proposal_data->solution_display == 1) {
+ $solution_display = 'Yes';
+ } else {
+ $solution_display = 'No';
+ }
+
+ // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['solution_proposal_approved']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $params['solution_proposal_approved']['proposal_id']);
+ $query->orderBy('number', 'ASC');
+ $experiment_q = $query->execute();
+ $experiment_list = '
+ ';
+ while ($experiment_data = $experiment_q->fetchObject()) {
+ $experiment_list .='
'. $experiment_data->number . ') ' . $experiment_data->title . '
Description : '.$experiment_data->description.'
';
+ $experiment_list .=' ';
+ $experiment_list .='
';
+ }
+
+ $user_data = user_load($params['solution_proposal_approved']['user_id']);
+
+ $message['headers'] = $params['solution_proposal_approved']['headers'];
+ $message['subject'] = t('[!site_name] Lab Migration Solution Proposal Approval', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['body'] = array(0 => t('
Dear !user_name,
Your following Lab migration solution proposal has been approved:
@@ -50,33 +56,26 @@ Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->solution_provider_contact_ph . '
Department/Branch : ' . $proposal_data->solution_provider_department . '
University/Institute : ' . $proposal_data->solution_provider_university . '
+City : '.$proposal_data->city.'
+State : '.$proposal_data->state.'
-Display solution on website : ' . $solution_display . '
+List of experiments : ' . $experiment_list . '
-List of experiments : ' . $experiment_list . '' . '
-
-Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/lab-migration-project/lab-migration-guidelines
Best Wishes,
!site_name Team,
-FOSSEE, IIT Bombay', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'solution_proposal_disapproved':
- $user_data = user_load($params['solution_proposal_disapproved']['user_id']);
- $message['subject'] = t('[!site_name] Lab Migration Solution Disapproval', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 'body' => t('
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'solution_proposal_disapproved':
+ $user_data = user_load($params['solution_proposal_disapproved']['user_id']);
+
+ $message['headers'] = $params['solution_proposal_disapproved']['headers'];
+ $message['subject'] = t('[!site_name] Lab Migration Solution Disapproval', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['body'] = array('body' => t('
Dear !user_name,
Your Lab migration solution proposal has been disapproved.
@@ -85,127 +84,149 @@ Reason: ' . $params['solution_proposal_disapproved']['message'] . '
Best Wishes,
-!site_name', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'proposal_received':
- /* initializing data */
- // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_received']['proposal_id']);
- // $proposal_data = $proposal_q->fetchObject();
- $query = db_select('lab_migration_proposal');
+!site_name Team,
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'proposal_received':
+
+ /* initializing data */
+ // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_received']['proposal_id']);
+ // $proposal_data = $proposal_q->fetchObject();
+
+ $query = db_select('lab_migration_proposal');
$query->fields('lab_migration_proposal');
$query->condition('id', $params['proposal_received']['proposal_id']);
$query->range(0, 1);
$proposal_data = $query->execute()->fetchObject();
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
- if ($proposal_data->solution_provider_uid == 0) {
- $solution_provider_user = 'Open';
- } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
- $solution_provider_user = 'Proposer';
- } else {
- $solution_provider_user = 'Unknown';
- }
- // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number",
- // $params['proposal_received']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
+
+ $samplecodefilename="";
+ if(strlen($proposal_data->samplefilepath)>=5){
+ $samplecodefilename=substr($proposal_data->samplefilepath, strrpos($proposal_data->samplefilepath, '/') + 1);
+ }else{
+ $samplecodefilename="Not provided";
+ }
+
+ if ($proposal_data->solution_display == 1) {
+ $solution_display = 'Yes';
+ } else {
+ $solution_display = 'No';
+ }
+
+ if ($proposal_data->solution_provider_uid == 0) {
+ $solution_provider_user = 'Open';
+ } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
+ $solution_provider_user = 'Proposer';
+ } else {
+ $solution_provider_user = 'Unknown';
+ }
+
+ // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number",
+ // $params['proposal_received']['proposal_id'], 1);
+
+ $query = db_select('lab_migration_experiment');
$query->fields('lab_migration_experiment');
$query->condition('proposal_id', $params['proposal_received']['proposal_id']);
$query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
- $experiment_list = '
+ $experiment_q = $query->execute();
+
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= '' . $experiment_data->number . ') ' . $experiment_data->title . ' ' . $experiment_data->description . ' ';
- }
- $user_data = user_load($params['proposal_received']['user_id']);
- $message['subject'] = t('[!site_name] Your Lab migration proposal has been received', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 'body' => t('
+ while ($experiment_data = $experiment_q->fetchObject()) {
+ $experiment_list .=''. $experiment_data->number . ') ' . $experiment_data->title . '
Description : '.$experiment_data->description.'
';
+ $experiment_list .=' ';
+ $experiment_list .='
';
+ }
+
+ $user_data = user_load($params['proposal_received']['user_id']);
+ $message['headers'] = $params['proposal_received']['headers'];
+ $message['subject'] = t('[!site_name] Your Lab migration proposal has been received', array('!site_name' => variable_get('site_name', '')),array('language' => $language->language));
+
+ $message['body'] = array('body' => t('
Dear !user_name,
-We have received your following Lab migration proposal:
+We have received your Lab migration proposal with the following details:
Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->name . '
Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
+City : '.$proposal_data->city.'
+State : '.$proposal_data->state.'
+
Solution Provided By : ' . $solution_provider_user . '
-List of experiments : ' . $experiment_list . '' . '
+List of experiments : ' . $experiment_list . '
-Your proposal is under review and you will soon receive an email from us regarding the same.
+Uploaded Sample Code : '.$samplecodefilename.'
-Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
+Your proposal is under review. You will soon receive an email when same has been approved/disapproved.
Best Wishes,
!site_name Team,
-FOSSEE, IIT Bombay', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'proposal_disapproved':
- /* initializing data */
- // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_disapproved']['proposal_id']);
- //$proposal_data = $proposal_q->fetchObject();
- $query = db_select('lab_migration_proposal');
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+
+
+ break;
+
+ case 'proposal_disapproved':
+
+ /* initializing data */
+ // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_disapproved']['proposal_id']);
+ //$proposal_data = $proposal_q->fetchObject();
+ $query = db_select('lab_migration_proposal');
$query->fields('lab_migration_proposal');
$query->condition('id', $params['proposal_disapproved']['proposal_id']);
$query->range(0, 1);
$proposal_data = $query->execute()->fetchObject();
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
- if ($proposal_data->solution_provider_uid == 0) {
- $solution_provider_user = 'Open';
- } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
- $solution_provider_user = 'Proposer';
- } else {
- $solution_provider_user = 'Unknown';
- }
- // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_disapproved']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('proposal_id', $params['proposal_disapproved']['proposal_id']);
- $query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
- $experiment_list = '
+
+ $samplecodefilename="";
+ if(strlen($proposal_data->samplefilepath)>=5){
+ $samplecodefilename=substr($proposal_data->samplefilepath, strrpos($proposal_data->samplefilepath, '/') + 1);
+ }else{
+ $samplecodefilename="Not provided";
+ }
+
+ if ($proposal_data->solution_display == 1) {
+ $solution_display = 'Yes';
+ } else {
+ $solution_display = 'No';
+ }
+
+ if ($proposal_data->solution_provider_uid == 0) {
+ $solution_provider_user = 'Open';
+ } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
+ $solution_provider_user = 'Proposer';
+ } else {
+ $solution_provider_user = 'Unknown';
+ }
+
+ // $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_disapproved']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $params['proposal_disapproved']['proposal_id']);
+ $query->orderBy('number', 'ASC');
+ $experiment_q = $query->execute();
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= '' . $experiment_data->number . ') ' . $experiment_data->title . ' ' . $experiment_data->description . ' ';
- }
- $user_data = user_load($params['proposal_disapproved']['user_id']);
- $message['subject'] = t('[!site_name] Your Lab migration proposal has been disapproved', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 'body' => t('
+ while ($experiment_data = $experiment_q->fetchObject()) {
+ $experiment_list .=''. $experiment_data->number . ') ' . $experiment_data->title . '
Description : '.$experiment_data->description.'
';
+ $experiment_list .=' ';
+ $experiment_list .='
';
+ }
+
+ $user_data = user_load($params['proposal_disapproved']['user_id']);
+ $message['headers'] = $params['proposal_disapproved']['headers'];
+ $message['subject'] = t('[!site_name] Your Lab migration proposal has been disapproved', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['body'] = array('body' => t('
Dear !user_name,
-Your following Lab migration proposal has been disapproved:
+We regret to inform you that all the Experiments of your Lab with following details have been dis-approved.
Reason for disapproval: ' . $proposal_data->message . '
@@ -214,133 +235,149 @@ Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
+City : '.$proposal_data->city.'
+State : '.$proposal_data->state.'
Solution Provided By : ' . $solution_provider_user . '
-List of experiments : ' . $experiment_list . '' . '
+List of experiments : ' . $experiment_list . '
+
+Uploaded Sample Code : '.$samplecodefilename.'
-Please ensure that ALL the codes follow guidelines at http://www.dsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
-!site_name', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'proposal_approved':
- /* initializing data */
- // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_approved']['proposal_id']);
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $params['proposal_approved']['proposal_id']);
- $query->range(0, 1);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
- if ($proposal_data->solution_provider_uid == 0) {
- $solution_provider_user = 'Open';
- } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
- $solution_provider_user = 'Proposer';
- } else {
- $solution_provider_user = 'Unknown';
- }
- //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_approved']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('proposal_id', $params['proposal_approved']['proposal_id']);
- $query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
- $experiment_list = '
+!site_name Team,
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'proposal_approved':
+
+ /* initializing data */
+ // $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_approved']['proposal_id']);
+
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $params['proposal_approved']['proposal_id']);
+ $query->range(0, 1);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+ $samplecodefilename="";
+ if(strlen($proposal_data->samplefilepath)>=5){
+ $samplecodefilename=substr($proposal_data->samplefilepath, strrpos($proposal_data->samplefilepath, '/') + 1);
+ }else{
+ $samplecodefilename="Not provided";
+ }
+ if ($proposal_data->solution_display == 1) {
+ $solution_display = 'Yes';
+ } else {
+ $solution_display = 'No';
+ }
+
+ if ($proposal_data->solution_provider_uid == 0) {
+ $solution_provider_user = 'Open';
+ } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
+ $solution_provider_user = 'Proposer';
+ } else {
+ $solution_provider_user = 'Unknown';
+ }
+
+ //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_approved']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $params['proposal_approved']['proposal_id']);
+ $query->orderBy('number', 'ASC');
+ $experiment_q = $query->execute();
+
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= '' . $experiment_data->number . ') ' . $experiment_data->title . ' ' . $experiment_data->description . ' ';
- }
- $user_data = user_load($params['proposal_approved']['user_id']);
- $message['subject'] = t('[!site_name] Your Lab migration proposal has been approved', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 0 => t('
+ while ($experiment_data = $experiment_q->fetchObject()) {
+ $experiment_list .=''. $experiment_data->number . ') ' . $experiment_data->title . '
Description : '.$experiment_data->description.'
';
+ $experiment_list .=' ';
+ $experiment_list .='
';
+ }
+
+ $user_data = user_load($params['proposal_approved']['user_id']);
+ $message['headers'] = $params['proposal_approved']['headers'];
+ $message['subject'] = t('[!site_name] Your Lab migration proposal has been approved',
+ array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['body'] = array(0 => t('
Dear !user_name,
-Your following Lab migration proposal has been approved:
+Congratulations! Your Lab migration proposal with the below details has been approved:
Full Name : ' . $proposal_data->name_title . ' ' . $proposal_data->name . '
Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
+City : '.$proposal_data->city.'
+State : '.$proposal_data->state.'
+
Solution Provided By : ' . $solution_provider_user . '
-List of experiments : ' . $experiment_list . '' . '
+List of experiments : ' . $experiment_list . '
-Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
+Uploaded Sample Code : '.$samplecodefilename.'
+
+Please ensure that ALL the guidelines for coding are strictly followed:
+http://dwsim.fossee.in/lab-migration-project/lab-migration-guidelines
Best Wishes,
!site_name Team,
-FOSSEE, IIT Bombay', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'proposal_completed':
- /* initializing data */
- //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_completed']['proposal_id']);
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $params['proposal_completed']['proposal_id']);
- $query->range(0, 1);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
- if ($proposal_data->solution_provider_uid == 0) {
- $solution_provider_user = 'Open';
- } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
- $solution_provider_user = 'Proposer';
- } else {
- $user_data = user_load($proposal_data->solution_provider_uid);
- if (!$user_data) {
- $solution_provider_user = 'Unknown';
- }
- }
- //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_completed']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('proposal_id', $params['proposal_completed']['proposal_id']);
- $query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
- $experiment_list = '
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'proposal_completed':
+
+ /* initializing data */
+ //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['proposal_completed']['proposal_id']);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $params['proposal_completed']['proposal_id']);
+ $query->range(0, 1);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+
+ if ($proposal_data->solution_display == 1) {
+ $solution_display = 'Yes';
+ } else {
+ $solution_display = 'No';
+ }
+
+ if ($proposal_data->solution_provider_uid == 0) {
+ $solution_provider_user = 'Open';
+ } else if ($proposal_data->solution_provider_uid == $proposal_data->uid) {
+ $solution_provider_user = 'Proposer';
+ } else {
+ $user_data = user_load($proposal_data->solution_provider_uid);
+ if (!$user_data) {
+ $solution_provider_user = 'Unknown';
+ }
+ }
+
+ //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['proposal_completed']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $params['proposal_completed']['proposal_id']);
+ $query->orderBy('number', 'ASC');
+ $experiment_q = $query->execute();
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= '
' . $experiment_data->number . ' ' . $experiment_data->title . '
' . 'Description:' . $experiment_data->description . '
';
- }
- $user_data = user_load($params['proposal_completed']['user_id']);
- $message['subject'] = t('[!site_name] Congratulations for completion of the Lab migration', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 'body' => t('
+ while ($experiment_data = $experiment_q->fetchObject()) {
+ $experiment_list .=''. $experiment_data->number . ') ' . $experiment_data->title . '
Description : '.$experiment_data->description.'
';
+ $experiment_list .=' ';
+ $experiment_list .='
';
+ }
+
+ $user_data = user_load($params['proposal_completed']['user_id']);
+ $message['headers'] = $params['proposal_completed']['headers'];
+ $message['subject'] = t('[!site_name] Congratulations for completion of the Lab migration', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['body'] = array('body' => t('
Dear !user_name,
Following Lab migration has been completed sucessfully :
@@ -350,63 +387,64 @@ Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
+City : '.$proposal_data->city.'
+State : '.$proposal_data->state.'
+
Solution Provided By : ' . $solution_provider_user . '
-List of experiments : ' . $experiment_list . '' . '
+List of experiments : ' . $experiment_list . '
Your Lab solution is now available at following link to download.
-http://dwsim.fossee.in/lab_migration_run/' . $proposal_data->id . '
+http://dwsim.fossee.in/lab-migration/lab-migration-run/' . $proposal_data->id . '
-Now you should be able to propose a new Lab migration...
+Now you should be able to propose a new Lab migration.
-Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/lab-migration-project/lab-migration-guidelines
Best Wishes,
!site_name Team,
-FOSSEE, IIT Bombay', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'solution_proposal_received':
- /* initializing data */
- //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['solution_proposal_received']['proposal_id']);
- $query = db_select('lab_migration_proposal');
- $query->fields('lab_migration_proposal');
- $query->condition('id', $params['solution_proposal_received']['proposal_id']);
- $query->range(0, 1);
- $proposal_q = $query->execute();
- $proposal_data = $proposal_q->fetchObject();
- if ($proposal_data->solution_display == 1) {
- $solution_display = 'Yes';
- } else {
- $solution_display = 'No';
- }
- //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['solution_proposal_received']['proposal_id'], 1);
- $query = db_select('lab_migration_experiment');
- $query->fields('lab_migration_experiment');
- $query->condition('proposal_id', $params['solution_proposal_received']['proposal_id']);
- $query->orderBy('number', 'ASC');
- $experiment_q = $query->execute();
- $experiment_list = '
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'solution_proposal_received':
+
+ /* initializing data */
+ //$proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d LIMIT 1", $params['solution_proposal_received']['proposal_id']);
+ $query = db_select('lab_migration_proposal');
+ $query->fields('lab_migration_proposal');
+ $query->condition('id', $params['solution_proposal_received']['proposal_id']);
+ $query->range(0, 1);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+
+ if ($proposal_data->solution_display == 1) {
+ $solution_display = 'Yes';
+ } else {
+ $solution_display = 'No';
+ }
+
+ //$experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number", $params['solution_proposal_received']['proposal_id'], 1);
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('proposal_id', $params['solution_proposal_received']['proposal_id']);
+ $query->orderBy('number', 'ASC');
+ $experiment_q = $query->execute();
+ $experiment_list = '
';
- while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= '' . $experiment_data->number . ') ' . $experiment_data->title . ' Description: ' . $experiment_data->description . ' ';
- }
- $user_data = user_load($params['solution_proposal_received']['user_id']);
- $message['subject'] = t('[!site_name] Your Lab migration solution proposal has been received', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 'body' => t('
+ while ($experiment_data = $experiment_q->fetchObject()) {
+ $experiment_list .=''. $experiment_data->number . ') ' . $experiment_data->title . '
Description : '.$experiment_data->description.'
';
+ $experiment_list .=' ';
+ $experiment_list .='
';
+ }
+
+ $user_data = user_load($params['solution_proposal_received']['user_id']);
+ $message['headers'] = $params['solution_proposal_received']['headers'];
+ $message['subject'] = t('[!site_name] Your Lab migration solution proposal has been received', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['body'] = array('body' => t('
Dear !user_name,
We have received your proposal for solution for following Lab migration :
@@ -416,118 +454,107 @@ Email : ' . $user_data->mail . '
Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
+City : '.$proposal_data->city.'
+State : '.$proposal_data->state.'
-Display solution on website : ' . $solution_display . '
-Solution Provided By : ' . $solution_provider_user . '
+Solution Provided By : ' . $proposal_data->name_title .'
-List of experiments : ' . $experiment_list . '' . '
+List of experiments : ' . $experiment_list . '
Your proposal is under review and you will soon receive an email from us regarding the same.
-Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/lab-migration-project/lab-migration-guidelines
Best Wishes,
!site_name Team,
-FOSSEE, IIT Bombay', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'solution_uploaded':
- // $solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d LIMIT 1", $params['solution_uploaded']['solution_id']);
- /*$query = db_select('lab_migration_solution');
- $query->fields('lab_migration_solution');
- $query->condition('id', $params['solution_uploaded']['solution_id']);
- $query->range(0, 1);
- $solution_q = $query->execute();
- $solution_data = $solution_q->fetchObject();*/
- $query = "SELECT lms.* , lmp.lab_title FROM lab_migration_solution lms
- INNER JOIN lab_migration_experiment lme ON lme.id = lms.experiment_id
- JOIN lab_migration_proposal lmp ON lme.proposal_id = lmp.id
- WHERE lms.id = :id";
- $solution_q = db_query($query, array(
- ":id" => $params['solution_uploaded']['solution_id']
- ));
- $solution_data = $solution_q->fetchObject();
- $user_data = user_load($params['solution_uploaded']['user_id']);
- $message['subject'] = t('[!site_name] You have uploaded solution', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 'body' => t('
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'solution_uploaded':
+ // $solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d LIMIT 1", $params['solution_uploaded']['solution_id']);
+ $query = db_select('lab_migration_solution');
+ $query->fields('lab_migration_solution');
+ $query->condition('id', $params['solution_uploaded']['solution_id']);
+ $query->range(0, 1);
+ $solution_q = $query->execute();
+ $solution_data = $solution_q->fetchObject();
+
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('id', $solution_data->experiment_id);
+ $query->range(0, 1);
+ $experiment_q = $query->execute();
+ $experiment_data = $experiment_q->fetchObject();
+
+ $user_data = user_load($params['solution_uploaded']['user_id']);
+
+ $message['subject'] = t('[!site_name] You have uploaded Lab migration solution', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['headers'] = $params['solution_uploaded']['headers'];
+ $message['body'] = array('body' => t('
Dear !user_name,
-You have uploaded the following solution:
+You have uploaded the following solution:
+
+Experiment Title : ' . $experiment_data->title . '
-Lab title: ' . $solution_data->lab_title . '
Solution number : ' . $solution_data->code_number . '
-Caption : ' . $solution_data->caption . '
+Caption : ' . $solution_data->caption . '
The solution is under review. You will be notified when it has been approved.
Best Wishes,
!site_name Team,
-FOSSEE, IIT Bombay', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'solution_approved':
- //$solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d LIMIT 1", $params['solution_approved']['solution_id']);
- $query = db_select('lab_migration_solution');
- $query->fields('lab_migration_solution');
- $query->condition('id', $params['solution_approved']['solution_id']);
- $query->range(0, 1);
- $solution_q = $query->execute();
- $solution_data = $solution_q->fetchObject();
- $user_data = user_load($params['solution_approved']['user_id']);
- $message['subject'] = t('[!site_name] Your uploaded solution has been approved', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 'body' => t('
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'solution_approved':
+ //$solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE id = %d LIMIT 1", $params['solution_approved']['solution_id']);
+ $query = db_select('lab_migration_solution');
+ $query->fields('lab_migration_solution');
+ $query->condition('id', $params['solution_approved']['solution_id']);
+ $query->range(0, 1);
+ $solution_q = $query->execute();
+ $solution_data = $solution_q->fetchObject();
+
+ $query = db_select('lab_migration_experiment');
+ $query->fields('lab_migration_experiment');
+ $query->condition('id', $solution_data->experiment_id);
+ $query->range(0, 1);
+ $experiment_q = $query->execute();
+ $experiment_data = $experiment_q->fetchObject();
+
+ $user_data = user_load($params['solution_approved']['user_id']);
+ $message['headers'] = $params['solution_approved']['headers'];
+ $message['subject'] = t('[!site_name] Your uploaded Lab migration solution has been approved', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['body'] = array('body' => t('
Dear !user_name,
Your following solution has been approved:
+Experiment Title : ' . $experiment_data->title . '
+
Solution number : ' . $solution_data->code_number . '
-Caption : ' . $solution_data->caption . '
+Caption : ' . $solution_data->caption . '
-Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/lab-migration-project/lab-migration-guidelines
Best Wishes,
!site_name Team,
-FOSSEE, IIT Bombay', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'solution_disapproved':
- $user_data = user_load($params['solution_disapproved']['user_id']);
- $message['subject'] = t('[!site_name] Your uploaded solution has been disapproved', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 'body' => t('
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'solution_disapproved':
+ $user_data = user_load($params['solution_disapproved']['user_id']);
+ $message['headers'] = $params['solution_disapproved']['headers'];
+ $message['subject'] = t('[!site_name] Your uploaded Lab migration solution has been disapproved', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['body'] = array('body' => t('
Dear !user_name,
Your following solution has been disapproved:
@@ -537,81 +564,62 @@ Caption : ' . $params['solution_disapproved']['solution_caption'] . '
Reason for dis-approval : ' . $params['solution_disapproved']['message'] . '
-Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
!site_name Team,
-FOSSEE, IIT Bombay', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'solution_deleted_user':
- $user_data = user_load($params['example_deleted_user']['user_id']);
- $message['subject'] = t('[!site_name] User has deleted pending solution', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 'body' => t('
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'solution_deleted_user':
+ $user_data = user_load($params['solution_deleted_user']['user_id']);
+ $message['headers'] = $params['solution_deleted_user']['headers'];
+ $message['subject'] = t('[!site_name] User has deleted pending Lab migration solution', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['body'] = array('body' => t('
Dear !user_name,
Your following pending solution has been deleted :
Title of the Lab : ' . $params['solution_deleted_user']['lab_title'] . '
Title of the Experiment : ' . $params['solution_deleted_user']['experiment_title'] . '
+
Solution number : ' . $params['solution_deleted_user']['solution_number'] . '
Caption : ' . $params['solution_deleted_user']['solution_caption'] . '
-Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
!site_name Team,
-FOSSEE, IIT Bombay', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'dependency_uploaded':
- $user_data = user_load($params['dependency_uploaded']['user_id']);
- $dependency_files = implode(',', $params['dependency_uploaded']['dependency_names']);
- $message['subject'] = t('[!site_name] You have uploaded dependency file', array(
- '!site_name' => variable_get('site_name', '')
- ), array(
- 'language' => $language->language
- ));
- $message['body'] = array(
- 'body' => t('
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'dependency_uploaded':
+ $user_data = user_load($params['dependency_uploaded']['user_id']);
+ $dependency_files = implode(',', $params['dependency_uploaded']['dependency_names']);
+ $message['headers'] = $params['dependency_uploaded']['headers'];
+ $message['subject'] = t('[!site_name] You have uploaded dependency file', array('!site_name' => variable_get('site_name', '')), array('language' => $language->language));
+ $message['body'] = array('body' => t('
Dear !user_name,
You have uploaded following dependency files :
' . $dependency_files . '
-Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://dwsim.fossee.in/lab-migration-project/lab-migration-guidelines
Best Wishes,
!site_name Team,
-FOSSEE, IIT Bombay', array(
- '!site_name' => variable_get('site_name', ''),
- '!user_name' => $user_data->name
- ), array(
- 'language' => $language->language
- ))
- );
- break;
- case 'standard':
- $message['subject'] = $params['standard']['subject'];
- $message['body'] = $params['standard']['body'];
- break;
- }
+FOSSEE,IIT Bombay', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), array('language' => $language->language)));
+
+ break;
+
+ case 'standard':
+ $message['subject'] = $params['standard']['subject'];
+ $message['body'] = $params['standard']['body'];
+ $message['headers'] = $params['standard']['headers'];
+ break;
+ }
}
+
diff --git a/general_deletion.inc b/general_deletion.inc
index b6622b2..dbc9b8e 100755
--- a/general_deletion.inc
+++ b/general_deletion.inc
@@ -55,17 +55,28 @@ function lab_migration_delete_solution($solution_id)
$status = FALSE;
drupal_set_message(t('Error deleting !file', array('!file' => $solution_files_data->filepath)), 'error');
- /* sending email to admins */
+ /* sending email to admins */
$email_to = variable_get('lab_migration_emails', '');
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc="";
+ $cc=variable_get('lab_migration_cc_emails', '');
+
$param['standard']['subject'] = "[ERROR] Error deleting example file";
$param['standard']['body'] = "Error deleting solution files by " . $user->uid . " at " . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . " :
solution id : " . $solution_id . "
file id : " . $solution_files_data->id . "
- file path : " . $solution_files_data->filepath;
- if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
+ file path : " . $solution_files_data->filepath."
+ PDF path : " . $PdfStatus;
+ $param['standard']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+ if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, $from, TRUE))
drupal_set_message('Error sending email message.', 'error');
} else {
- /* deleting example files database entries */
+ /* deleting example files database entries */
db_delete('lab_migration_solution_files')
->condition('id', $solution_files_data->id)
@@ -87,9 +98,20 @@ function lab_migration_delete_solution($solution_id)
/* sending email to admins */
$email_to = variable_get('lab_migration_emails', '');
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc="";
+ $cc=variable_get('lab_migration_cc_emails', '');
+
+
$param['standard']['subject'] = "[ERROR] Error deleting folder";
$param['standard']['body'] = "Error deleting folder " . $dir_path . " by " . $user->uid . " at " . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
- if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
+ $param['standard']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+
+ if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, $from, TRUE))
drupal_set_message('Error sending email message.', 'error');
return FALSE;
}
@@ -145,7 +167,7 @@ function lab_migration_delete_experiment($experiment_id)
if ($status)
{
- $dir_path = $root_path . $experiment_data->proposal_id . '/EXP' . $experiment_data->number;
+ $dir_path = $root_path . $experiment_data->directory_name . '/EXP' . $experiment_data->number;
if (is_dir($dir_path))
{
@@ -154,11 +176,21 @@ function lab_migration_delete_experiment($experiment_id)
{
drupal_set_message(t('Error deleting experiment folder !folder', array('!folder' => $dir_path)), 'error');
- /* sending email to admins */
+ /* sending email to admins */
$email_to = variable_get('lab_migration_emails', '');
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc="";
+ $cc=variable_get('lab_migration_cc_emails', '');
+
+
$param['standard']['subject'] = "[ERROR] Error deleting experiment folder";
$param['standard']['body'] = "Error deleting folder " . $dir_path;
- if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
+ $param['standard']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+ if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param,$from, TRUE))
drupal_set_message('Error sending email message.', 'error');
return FALSE;
} else {
@@ -249,12 +281,21 @@ function lab_migration_delete_dependency($dependency_id)
/* sending email to admins */
$email_to = variable_get('lab_migration_emails', '');
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc="";
+ $cc=variable_get('lab_migration_cc_emails', '');
+
$param['standard']['subject'] = "[ERROR] Error deleting dependency file";
$param['standard']['body'] = "Error deleting dependency files by " . $user->uid . " at " . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . " :
dependency id : " . $dependency_id . "
file id : " . $dependency_files_data->id . "
file path : " . $dependency_files_data->filepath;
- if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
+ $param['standard']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+ if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param,$from, TRUE))
drupal_set_message('Error sending email message.', 'error');
} else {
/* deleting dependency files database entries */
diff --git a/lab_migration.module b/lab_migration.module
index a08b099..7de16e2 100755
--- a/lab_migration.module
+++ b/lab_migration.module
@@ -338,7 +338,7 @@ function lab_migration_menu()
);
/* DOWNLOAD FOR EVERYONE */
- $items['lab-migration-run'] = array(
+ $items['lab-migration/lab-migration-run'] = array(
'title' => 'Download Codes',
'page callback' => 'drupal_get_form',
'page arguments' => array('lab_migration_run_form'),
diff --git a/manage_proposal.inc b/manage_proposal.inc
index 7b741b4..90ab732 100755
--- a/manage_proposal.inc
+++ b/manage_proposal.inc
@@ -356,17 +356,24 @@ function lab_migration_proposal_approval_form_submit($form, &$form_state)
":proposal_id" => $proposal_id
);
db_query($query, $args);
- /* sending email */
- $user_data = user_load($proposal_data->uid);
- $email_to = $user_data->mail;
- $param['proposal_approved']['proposal_id'] = $proposal_id;
- $param['proposal_approved']['user_id'] = $proposal_data->uid;
+ /* sending email */
+ $user_data = user_load($proposal_data->uid);
+ $email_to = $user_data->mail;
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc= $user->mail . ', ' .variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
+ $param['proposal_approved']['proposal_id'] = $proposal_id;
+ $param['proposal_approved']['user_id'] = $proposal_data->uid;
+ $param['proposal_approved']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+ if(!drupal_mail('lab_migration', 'proposal_approved', $email_to, language_default(), $param, $from, TRUE))
+ drupal_set_message('Error sending email message.', 'error');
- if (!drupal_mail('lab_migration', 'proposal_approved', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
- $email_to = $user->mail . ', ' . variable_get('lab_migration_emails', '');
- if (!drupal_mail('lab_migration', 'proposal_approved', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
drupal_set_message('Lab migration proposal No. ' . $proposal_id . ' approved. User has been notified of the approval.', 'status');
drupal_goto('lab-migration/manage-proposal');
return;
@@ -379,17 +386,24 @@ function lab_migration_proposal_approval_form_submit($form, &$form_state)
":proposal_id" => $proposal_id
);
$result = db_query($query, $args);
- /* sending email */
- $user_data = user_load($proposal_data->uid);
- $email_to = $user_data->mail;
- $param['proposal_disapproved']['proposal_id'] = $proposal_id;
- $param['proposal_disapproved']['user_id'] = $proposal_data->uid;
- if (!drupal_mail('lab_migration', 'proposal_disapproved', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
- $email_to = $user_data->mail . ', ' . variable_get('lab_migration_emails', '');
- ;
- if (!drupal_mail('lab_migration', 'proposal_disapproved', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
+ /* sending email */
+ $user_data = user_load($proposal_data->uid);
+ $email_to = $user_data->mail;
+
+ $from=variable_get('lab_migration_from_email', '');
+ $bcc=$user->mail . ', ' .variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
+ $param['proposal_disapproved']['proposal_id'] = $proposal_id;
+ $param['proposal_disapproved']['user_id'] = $proposal_data->uid;
+ $param['proposal_disapproved']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+ if (!drupal_mail('lab_migration', 'proposal_disapproved', $email_to , language_default(), $param,$from, TRUE))
+ drupal_set_message('Error sending email message.', 'error');
+
drupal_set_message('Lab migration proposal No. ' . $proposal_id . ' dis-approved. User has been notified of the dis-approval.', 'error');
drupal_goto('lab-migration/manage-proposal');
return;
@@ -580,23 +594,32 @@ function lab_migration_proposal_status_form_submit($form, &$form_state)
drupal_set_message('Error in update status', 'error');
return;
}
- /* sending email */
- $user_data = user_load($proposal_data->uid);
- $email_to = $user_data->mail;
- $param['proposal_completed']['proposal_id'] = $proposal_id;
- $param['proposal_completed']['user_id'] = $proposal_data->uid;
- if (!drupal_mail('lab_migration', 'proposal_completed', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) {
- drupal_set_message('Error sending email message.', 'error');
- }
- $email_to = $user->mail . ', ' . variable_get('lab_migration_emails', '');
- ;
- if (!drupal_mail('lab_migration', 'proposal_completed', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) {
- drupal_set_message('Error sending email message.', 'error');
- }
- drupal_set_message('Congratulations! Lab Migration proposal has been marked as completed. User has been notified of the completion.', 'status');
- }
- drupal_goto('lab-migration/manage-proposal');
- return;
+ /* sending email */
+ $user_data = user_load($proposal_data->uid);
+ $email_to = $user_data->mail;
+
+ $from=variable_get('lab_migration_from_email', '');
+ $bcc=$user->mail . ', ' .variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
+ $param['proposal_completed']['proposal_id'] = $proposal_id;
+ $param['proposal_completed']['user_id'] = $proposal_data->uid;
+ $param['proposal_completed']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+ if (!drupal_mail('lab_migration', 'proposal_completed', $email_to , language_default(), $param, $from, TRUE))
+ drupal_set_message('Error sending email message.', 'error');
+
+ /*$email_to = $user->mail . ', ' . variable_get('lab_migration_emails', '');;
+ if (!drupal_mail('lab_migration', 'proposal_completed', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
+ drupal_set_message('Error sending email message.', 'error');*/
+
+ drupal_set_message('Congratulations! Lab Migration proposal has been marked as completed. User has been notified of the completion.', 'status');
+ }
+ drupal_goto('lab-migration/manage-proposal');
+ return;
}
/******************************************************************************/
/**************************** PROPOSAL EDIT FORM ******************************/
@@ -662,7 +685,7 @@ function lab_migration_proposal_edit_form($form, $form_state)
$form['department'] = array(
'#type' => 'select',
'#title' => t('Department/Branch'),
- '#options' => _list_of_departments(),
+ '#options' => _lm_list_of_departments(),
'#required' => TRUE,
'#default_value' => $proposal_data->department
);
@@ -737,7 +760,7 @@ function lab_migration_proposal_edit_form($form, $form_state)
$form['all_state'] = array(
'#type' => 'select',
'#title' => t('State'),
- '#options' => _list_of_states(),
+ '#options' => _lm_list_of_states(),
'#default_value' => $proposal_data->state,
'#validated' => TRUE,
'#states' => array(
@@ -751,7 +774,7 @@ function lab_migration_proposal_edit_form($form, $form_state)
$form['city'] = array(
'#type' => 'select',
'#title' => t('City'),
- '#options' => _list_of_cities(),
+ '#options' => _lm_list_of_cities(),
'#default_value' => $proposal_data->city,
'#states' => array(
'visible' => array(
@@ -1193,7 +1216,7 @@ function lab_migration_category_edit_form($form, $form_state)
$form['category'] = array(
'#type' => 'select',
'#title' => t('Category'),
- '#options' => _list_of_departments(),
+ '#options' => _lm_list_of_departments(),
'#required' => TRUE,
'#default_value' => $proposal_data->category
);
@@ -1238,7 +1261,7 @@ function lab_migration_category_edit_form_submit($form, &$form_state)
drupal_set_message(t('Proposal Category Updated'), 'status');
drupal_goto('lab-migration/manage-proposal/category');
}
-function _list_of_departments()
+function _lm_list_of_departments()
{
$department = array(
0 => '-Select-'
@@ -1252,7 +1275,7 @@ function _list_of_departments()
}
return $department;
}
-function _list_of_states()
+function _lm_list_of_states()
{
$states = array(
0 => '-Select-'
@@ -1266,7 +1289,7 @@ function _list_of_states()
}
return $states;
}
-function _list_of_cities()
+function _lm_list_of_cities()
{
$city = array();
$query = db_select('list_cities_of_india');
@@ -1294,12 +1317,14 @@ function CreateReadmeFileLabMigration($proposal_id)
$txt .= "Proposar Name: " . $proposal_data->name_title . " " . $proposal_data->name . "\n";
$txt .= "Department: " . $proposal_data->department . "\n";
$txt .= "University: " . $proposal_data->university . "\n";
- $txt .= "Categoery: " . $proposal_data->department . "\n\n";
+ $txt .= "Category: " . $proposal_data->department . "\n\n";
$txt .= "\n" . "\n";
$txt .= "Solution provider";
$txt .= "\n" . "\n";
$txt .= "Solution Provider Name: " . $proposal_data->solution_provider_name_title . " " . $proposal_data->solution_provider_name . "\n";
$txt .= "Solution Provider University: " . $proposal_data->solution_provider_university . "\n";
+ $txt .= "\n" . "\n";
+ $txt .= "Lab Migration Project By FOSSEE, IIT Bombay" . "\n";
fwrite($readme_file, $txt);
fclose($readme_file);
return $txt;
diff --git a/manage_solution_proposal.inc b/manage_solution_proposal.inc
index 2bace0c..95a34e7 100755
--- a/manage_solution_proposal.inc
+++ b/manage_solution_proposal.inc
@@ -14,7 +14,7 @@ function lab_migration_solution_proposal_pending()
$pending_q = $query->execute();
while ($pending_data = $pending_q->fetchObject())
{
- $pending_rows[$pending_data->id] = array(l($pending_data->name, 'user/' . $pending_data->uid), $pending_data->lab_title, l('Approve', 'lab_migration/manage_proposal/solution_proposal_approve/' . $pending_data->id));
+ $pending_rows[$pending_data->id] = array(l($pending_data->name, 'user/' . $pending_data->uid), $pending_data->lab_title, l('Approve', 'lab-migration/manage-proposal/solution-proposal-approve/' . $pending_data->id));
}
/* check if there are any pending proposals */
@@ -51,12 +51,12 @@ function lab_migration_solution_proposal_approval_form($form_state)
/* everything ok */
} else {
drupal_set_message(t('Invalid proposal selected. Please try again.'), 'error');
- drupal_goto('lab_migration/manage_proposal/pending_solution_proposal');
+ drupal_goto('lab-migration/manage-proposal/pending-solution-proposal');
return;
}
} else {
drupal_set_message(t('Invalid proposal selected. Please try again.'), 'error');
- drupal_goto('lab_migration/manage_proposal/pending_solution_proposal');
+ drupal_goto('lab-migration/manage-proposal/pending-solution-proposal');
return;
}
@@ -159,7 +159,7 @@ function lab_migration_solution_proposal_approval_form($form_state)
$form['cancel'] = array(
'#type' => 'markup',
- '#value' => l(t('Cancel'), 'lab_migration/manage_proposal/pending_solution_proposal'),
+ '#value' => l(t('Cancel'), 'lab-migration/manage-proposal/pending-solution-proposal'),
);
return $form;
@@ -208,12 +208,12 @@ function lab_migration_solution_proposal_approval_form_submit($form, &$form_stat
/* everything ok */
} else {
drupal_set_message(t('Invalid proposal selected. Please try again.'), 'error');
- drupal_goto('lab_migration/manage_proposal/pending_solution_proposal');
+ drupal_goto('lab-migration/manage-proposal/pending-solution-proposal');
return;
}
} else {
drupal_set_message(t('Invalid proposal selected. Please try again.'), 'error');
- drupal_goto('lab_migration/manage_proposal/pending_solution_proposal');
+ drupal_goto('lab-migration/manage-proposal/pending-solution-proposal');
return;
}
@@ -228,42 +228,59 @@ function lab_migration_solution_proposal_approval_form_submit($form, &$form_stat
/* sending email */
$email_to = $user_data->mail;
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc= $user->mail . ', ' .variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
$param['solution_proposal_approved']['proposal_id'] = $proposal_id;
$param['solution_proposal_approved']['user_id'] = $proposal_data->solution_provider_uid;
- if (!drupal_mail('lab_migration', 'solution_proposal_approved', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
+ $param['solution_proposal_approved']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+
+ if (!drupal_mail('lab_migration', 'solution_proposal_approved', $email_to , language_default(), $param, $from, TRUE))
drupal_set_message('Error sending email message.', 'error');
- $email_to = $user->mail . ', ' . variable_get('lab_migration_emails', '');
+ /*$email_to = $user->mail . ', ' . variable_get('lab_migration_emails', '');
if (!drupal_mail('lab_migration', 'solution_proposal_approved', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
+ drupal_set_message('Error sending email message.', 'error');*/
drupal_set_message('Lab migration solution proposal approved. User has been notified of the approval.', 'status');
- drupal_goto('lab_migration/manage_proposal/pending_solution_proposal');
+ drupal_goto('lab-migration/manage-proposal/pending-solution_proposal');
return;
} else if ($form_state['values']['approval'] == 2) {
$query = "UPDATE {lab_migration_proposal} SET solution_provider_uid = :solution_provider_uid, solution_status = :solution_status, solution_provider_name_title = '', solution_provider_name = '', solution_provider_contact_ph = '', solution_provider_department = '', solution_provider_university = '' WHERE id = :proposal_id";
$args = array(
":solution_provider_uid" => 0,
- ":solution_status" => 0,
+ ":solution_status" => 0,
":proposal_id" => $proposal_id
);
db_query($query, $args);
- /* sending email */
+ /* sending email */
$email_to = $user_data->mail;
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc= $user->mail . ', ' .variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
$param['solution_proposal_disapproved']['proposal_id'] = $proposal_id;
$param['solution_proposal_disapproved']['user_id'] = $proposal_data->solution_provider_uid;
$param['solution_proposal_disapproved']['message'] = $form_state['values']['message'];
- if (!drupal_mail('lab_migration', 'solution_proposal_disapproved', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
+ $param['solution_proposal_disapproved']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
- $email_to = $user->mail . ', ' . variable_get('lab_migration_emails', '');;
- if (!drupal_mail('lab_migration', 'solution_proposal_disapproved', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
+ if (!drupal_mail('lab_migration', 'solution_proposal_disapproved', $email_to , language_default(), $param, $from, TRUE))
+ drupal_set_message('Error sending email message.', 'error');
drupal_set_message('Lab migration solution proposal dis-approved. User has been notified of the dis-approval.', 'status');
- drupal_goto('lab_migration/manage_proposal/pending_solution_proposal');
+ drupal_goto('lab-migration/manage-proposal/pending-solution-proposal');
return;
}
}
diff --git a/proposal.inc b/proposal.inc
index be05951..48d60af 100755
--- a/proposal.inc
+++ b/proposal.inc
@@ -78,7 +78,7 @@ function lab_migration_proposal_form($form,$form_state)
$form['department'] = array(
'#type' => 'select',
'#title' => t('Department/Branch'),
- '#options' => _list_of_departments(),
+ '#options' => _lm_list_of_departments(),
'#required' => TRUE,
);
@@ -138,7 +138,7 @@ function lab_migration_proposal_form($form,$form_state)
$form['all_state'] = array(
'#type' => 'select',
'#title' => t('State'),
- '#options' => _list_of_states(),
+ '#options' => _lm_list_of_states(),
'#validated' => TRUE,
'#states' => array(
'visible' => array(
@@ -149,7 +149,7 @@ function lab_migration_proposal_form($form,$form_state)
$form['city'] = array(
'#type' => 'select',
'#title' => t('City'),
- '#options' => _list_of_cities(),
+ '#options' => _lm_list_of_cities(),
'#states' => array(
'visible' => array(
':input[name="country"]' => array('value' => 'India'),
@@ -172,7 +172,7 @@ function lab_migration_proposal_form($form,$form_state)
$form['version'] = array(
'#type' => 'select',
'#title' => t('Version'),
- '#options' => _list_of_software_version(),
+ '#options' => _lm_list_of_software_version(),
'#required' => TRUE,
);
$form['older'] = array(
@@ -438,22 +438,26 @@ if($form_state['values']['version'] == 'olderversion'){
/* sending email */
$email_to = $user->mail;
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc= variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
$param['proposal_received']['proposal_id'] = $proposal_id;
$param['proposal_received']['user_id'] = $user->uid;
- var_dump($param);
- if (!drupal_mail('lab_migration', 'proposal_received', $email_to , user_preferred_language($user), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
+ $param['proposal_received']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
- /* sending email */
- $email_to = variable_get('lab_migration_emails', '');
- if (!drupal_mail('lab_migration', 'proposal_received', $email_to , user_preferred_language($user), $param, variable_get('lab_migration_from_email', NULL), TRUE))
+ if (!drupal_mail('lab_migration', 'proposal_received', $email_to , user_preferred_language($user), $param, $from, TRUE))
drupal_set_message('Error sending email message.', 'error');
drupal_set_message(t('We have received you Lab migration proposal. We will get back to you soon.'), 'status');
drupal_goto('');
}
-/*
-function _list_of_states(){
+
+function _lm_list_of_states(){
$states = array();
$query = db_select('list_states_of_india');
$query->fields('list_states_of_india');
@@ -467,7 +471,7 @@ function _list_of_states(){
return $states;
}
-function _list_of_cities(){
+function _lm_list_of_cities(){
$city = array();
$query = db_select('list_cities_of_india');
$query->fields('list_cities_of_india');
@@ -480,7 +484,7 @@ function _list_of_cities(){
return $city;
}
-function _list_of_departments(){
+function _lm_list_of_departments(){
$department = array();
$query = db_select('list_of_departments');
$query->fields('list_of_departments');
@@ -492,16 +496,15 @@ function _list_of_departments(){
}
return $department;
}
-function _list_of_software_version(){
+function _lm_list_of_software_version(){
$software_version = array();
$query = db_select('dwsim_software_version');
$query->fields('dwsim_software_version');
$query->orderBy('id', 'DESC');
- $department_list = $query->execute();
+ $software_version_list = $query->execute();
while ($software_version_list_data = $software_version_list->fetchObject())
{
$software_version[$software_version_list_data->dwsim_version] = $software_version_list_data->dwsim_version;
}
return $software_version;
}
-*/
diff --git a/run.inc b/run.inc
index 71a0176..35bf0ef 100755
--- a/run.inc
+++ b/run.inc
@@ -7,7 +7,7 @@
$select_two = isset($form_state['values']['lab_experiment_list']) ? $form_state['values']['lab_experiment_list'] :
key($options_two);
- $url_lab_id = (int)arg(1);
+ $url_lab_id = (int)arg(2);
if(!$url_lab_id){
$selected = isset($form_state['values']['lab']) ? $form_state['values']['lab'] : key($options_first);
}elseif($url_lab_id == ''){
diff --git a/settings.inc b/settings.inc
index 2b71660..07bd9b6 100755
--- a/settings.inc
+++ b/settings.inc
@@ -1,18 +1,28 @@
'textfield',
- '#title' => t('Notification emails'),
- '#description' => t('A comma separated list of email addresses to receive notifications emails'),
+ '#title' => t('(Bcc) Notification emails'),
+ '#description' => t('Specify emails id for Bcc option of mail system with comma separated'),
'#size' => 50,
'#maxlength' => 255,
'#required' => TRUE,
'#default_value' => variable_get('lab_migration_emails', ''),
);
-
+
+ $form['cc_emails'] = array(
+ '#type' => 'textfield',
+ '#title' => t('(Cc) Notification emails'),
+ '#description' => t('Specify emails id for Cc option of mail system with comma separated'),
+ '#size' => 50,
+ '#maxlength' => 255,
+ '#required' => TRUE,
+ '#default_value' => variable_get('lab_migration_cc_emails', ''),
+ );
+
$form['from_email'] = array(
'#type' => 'textfield',
'#title' => t('Outgoing from email address'),
@@ -59,6 +69,15 @@ function lab_migration_settings_form($form, $form_state)
'#required' => TRUE,
'#default_value' => variable_get('lab_migration_xcos_extensions', ''),
);
+ $form['extensions']['pdf'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Allowed pdf file extensions'),
+ '#description' => t('A comma separated list WITHOUT SPACE of pdf file extensions that are permitted to be uploaded on the server'),
+ '#size' => 50,
+ '#maxlength' => 255,
+ '#required' => TRUE,
+ '#default_value' => variable_get('lab_migration_pdf_extensions', ''),
+ );
$form['submit'] = array(
'#type' => 'submit',
@@ -75,11 +94,13 @@ function lab_migration_settings_form_validate($form, &$form_state)
function lab_migration_settings_form_submit($form, &$form_state)
{
variable_set('lab_migration_emails', $form_state['values']['emails']);
+ variable_set('lab_migration_cc_emails', $form_state['values']['cc_emails']);
variable_set('lab_migration_from_email', $form_state['values']['from_email']);
variable_set('lab_migration_source_extensions', $form_state['values']['source']);
variable_set('lab_migration_dependency_extensions', $form_state['values']['dependency']);
variable_set('lab_migration_result_extensions', $form_state['values']['result']);
variable_set('lab_migration_xcos_extensions', $form_state['values']['xcos']);
+ variable_set('lab_migration_pdf_extensions', $form_state['values']['pdf']);
drupal_set_message(t('Settings updated'), 'status');
}
diff --git a/solution_proposal.inc b/solution_proposal.inc
index 75e8bdd..f2d1047 100755
--- a/solution_proposal.inc
+++ b/solution_proposal.inc
@@ -183,7 +183,7 @@ function lab_migration_solution_proposal_form_submit($form, &$form_state)
$query = "UPDATE {lab_migration_proposal} set solution_provider_uid = :uid, solution_status = 1, version = :version, solution_provider_name_title = :solution_provider_name_title, solution_provider_name = :solution_provider_contact_name, solution_provider_contact_ph = :solution_provider_contact_ph, solution_provider_department = :solution_provider_department, solution_provider_university = :solution_provider_university WHERE id = :proposal_id";
$args = array(
":uid" => $user->uid,
- ":version" => $form_state['values']['version'],
+ ":version" => $form_state['values']['version'],
":solution_provider_name_title" => $form_state['values']['solution_provider_name_title'],
":solution_provider_contact_name" => $form_state['values']['solution_provider_name'],
":solution_provider_contact_ph" => $form_state['values']['solution_provider_contact_ph'],
@@ -194,17 +194,27 @@ function lab_migration_solution_proposal_form_submit($form, &$form_state)
$result = db_query($query, $args);
drupal_set_message("We have received your application. We will get back to you soon.", 'status');
- /* sending email */
+ /* sending email */
$email_to = $user->mail;
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc= variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
$param['solution_proposal_received']['proposal_id'] = $proposal_id;
$param['solution_proposal_received']['user_id'] = $user->uid;
- if (!drupal_mail('lab_migration', 'solution_proposal_received', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
+ $param['solution_proposal_received']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+ if (!drupal_mail('lab_migration', 'solution_proposal_received', $email_to , language_default(), $param, $from, TRUE))
drupal_set_message('Error sending email message.', 'error');
/* sending email */
- $email_to = variable_get('lab_migration_emails', '');
+ /* $email_to = variable_get('lab_migration_emails', '');
if (!drupal_mail('lab_migration', 'solution_proposal_received', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
- drupal_set_message('Error sending email message.', 'error');
+ drupal_set_message('Error sending email message.', 'error');*/
drupal_goto('lab-migration/open-proposal');
}
diff --git a/upload_code.inc b/upload_code.inc
index 568d1c2..c387270 100755
--- a/upload_code.inc
+++ b/upload_code.inc
@@ -350,8 +350,8 @@ function lab_migration_upload_code_form_validate($form, &$form_state)
if (isset($_FILES['files']))
{
/* check if atleast one source or result file is uploaded */
- if ( ! ($_FILES['files']['name']['sourcefile1'] || $_FILES['files']['name']['xcos1']))
- form_set_error('sourcefile1', t('Please upload atleast one main or source file or xcos file.'));
+ if ( ! ($_FILES['files']['name']['sourcefile1'] ))
+ form_set_error('sourcefile1', t('Please upload atleast one main or source file.'));
/* check for valid filename extensions */
foreach ($_FILES['files']['name'] as $file_form_name => $file_name)
@@ -580,11 +580,20 @@ function lab_migration_upload_code_form_submit($form, &$form_state) {
}
drupal_set_message('Solution uploaded successfully.', 'status');
- /* sending email */
- $email_to = $user->mail . ', ' . variable_get('lab_migration_emails', '');
+ /* sending email */
+ $email_to = $user->mail;
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc= variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
$param['solution_uploaded']['solution_id'] = $solution_id;
$param['solution_uploaded']['user_id'] = $user->uid;
- if (!drupal_mail('lab_migration', 'solution_uploaded', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
+ $param['solution_uploaded']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
+
+ if (!drupal_mail('lab_migration', 'solution_uploaded', $email_to, language_default(), $param, $from, TRUE))
drupal_set_message('Error sending email message.', 'error');
drupal_goto('lab-migration/code');
diff --git a/upload_code_delete.inc b/upload_code_delete.inc
index 204ac4a..25059eb 100755
--- a/upload_code_delete.inc
+++ b/upload_code_delete.inc
@@ -68,21 +68,31 @@ function lab_migration_upload_code_delete()
drupal_set_message('Solution deleted.', 'status');
/* sending email */
- $email_to = $user->mail . ', ' . variable_get('lab_migration_emails', '');
+ $email_to = $user->mail;
+
+ $from = variable_get('lab_migration_from_email', '');
+ $bcc= variable_get('lab_migration_emails', '');
+ $cc=variable_get('lab_migration_cc_emails', '');
+
$param['solution_deleted_user']['lab_title'] = $proposal_data->lab_title;
$param['solution_deleted_user']['experiment_title'] = $experiment_data->title;
$param['solution_deleted_user']['solution_number'] = $solution_data->code_number;
$param['solution_deleted_user']['solution_caption'] = $solution_data->caption;
- $param['example_deleted_user']['user_id'] = $user->uid;
+ $param['solution_deleted_user']['user_id'] = $user->uid;
+ $param['solution_deleted_user']['headers']=array('From'=>$from,'MIME-Version'=> '1.0',
+ 'Content-Type'=> 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer'=> 'Drupal','Cc' => $cc, 'Bcc' => $bcc);
- if (!drupal_mail('lab_migration', 'solution_deleted_user', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
+ if (!drupal_mail('lab_migration', 'solution_deleted_user', $email_to, language_default(), $param , $from , TRUE))
drupal_set_message('Error sending email message.', 'error');
} else {
drupal_set_message('Error deleting example.', 'status');
}
- drupal_goto('lab-migration/code');
+ drupal_goto('lab_migration/code');
return;
}
+
?>
--
cgit