diff options
author | Jayaram Pai | 2014-04-21 12:41:11 +0530 |
---|---|---|
committer | Jayaram Pai | 2014-04-21 12:41:11 +0530 |
commit | a4495e4514bd6bfcf707e1e92726798f67a07c58 (patch) | |
tree | 7434f3fbd85ab9baf5ac4e6f9bb599a0b286668f | |
parent | c4263742d4622d520361d6a0518f46981a2405d9 (diff) | |
download | scilab_lab_migration-a4495e4514bd6bfcf707e1e92726798f67a07c58.tar.gz scilab_lab_migration-a4495e4514bd6bfcf707e1e92726798f67a07c58.tar.bz2 scilab_lab_migration-a4495e4514bd6bfcf707e1e92726798f67a07c58.zip |
added remote origin, .gitignore
-rw-r--r-- | .gitignore | 41 | ||||
-rwxr-xr-x | bulk_approval.inc | 3 | ||||
-rwxr-xr-x | dependency.inc | 5 | ||||
-rwxr-xr-x | download.inc | 33 | ||||
-rwxr-xr-x | email.inc | 60 | ||||
-rwxr-xr-x | full_download.inc | 2 | ||||
-rwxr-xr-x | lab_details.inc | 31 | ||||
-rwxr-xr-x | lab_migration.module | 16 | ||||
-rwxr-xr-x | latex.inc | 26 | ||||
-rwxr-xr-x | latex.inc.backup | 217 | ||||
-rwxr-xr-x | latex/Initial_body | 1 | ||||
-rwxr-xr-x | latex/latex_test.sh | 18 | ||||
-rwxr-xr-x | manage_proposal.inc | 3 | ||||
-rwxr-xr-x | manage_solution_proposal.inc | 4 | ||||
-rwxr-xr-x | proposal.inc | 2 | ||||
-rwxr-xr-x | upload_code.inc | 3 |
16 files changed, 437 insertions, 28 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b6788e8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,41 @@ +# Ignore configuration files that may contain sensitive information. +sites/*/*settings*.php + +# Ignore paths that contain generated content. +cache/ +files/ +sites/*/files +sites/*/private + +# Ignore default text files +robots.txt +/CHANGELOG.txt +/COPYRIGHT.txt +/INSTALL*.txt +/LICENSE.txt +/MAINTAINERS.txt +/UPGRADE.txt +/README.txt +sites/all/README.txt +sites/all/modules/README.txt +sites/all/themes/README.txt + +# Ignore everything but the "sites" folder ( for non core developer ) +.htaccess +web.config +authorize.php +cron.php +index.php +install.php +update.php +xmlrpc.php +/includes +/misc +/modules +/profiles +/scripts +/themes + +# Ignore vim temp. files +*.swo +*.swp diff --git a/bulk_approval.inc b/bulk_approval.inc index ddaddeb..f5e15cd 100755 --- a/bulk_approval.inc +++ b/bulk_approval.inc @@ -464,7 +464,8 @@ Reason for dis-approval: /****** sending email when everything done ******/ if ($email_subject) { - $email_to = variable_get('lab_migration_emails', '') . ', ' . $user->mail; + /*$email_to = variable_get('lab_migration_emails', '') . ', ' . $user->mail; */ + $email_to = "contact@scilab.in" . ', ' . $user->mail; $param['standard']['subject'] = $email_subject; $param['standard']['body'] = $email_body; if (!drupal_mail('lab_migration', 'standard', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) diff --git a/dependency.inc b/dependency.inc index dadce3d..3bfbfe3 100755 --- a/dependency.inc +++ b/dependency.inc @@ -70,11 +70,12 @@ function lab_migration_upload_dependency_form_validate($form, &$form_state) global $user; /* get approved proposal details */ - $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE uid = %d ORDER BY id DESC LIMIT 1", $user->uid); + $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE uid = %d OR solution_provider_uid = %d ORDER BY id DESC LIMIT 1", $user->uid, $user->uid); + //var_dump("SELECT * FROM {lab_migration_proposal} WHERE uid = ".$user->uid." ORDER BY id DESC LIMIT 1"); die; $proposal_data = db_fetch_object($proposal_q); if (!$proposal_data) { - form_set_error('', t('Invalid')); + form_set_error('', t('Invalid1')); } if (!lab_migration_check_name($form_state['values']['depfile1_caption'])) diff --git a/download.inc b/download.inc index 2707686..1fce78e 100755 --- a/download.inc +++ b/download.inc @@ -69,6 +69,8 @@ function lab_migration_download_solution() header('Content-Type: application/zip'); header('Content-disposition: attachment; filename="CODE' . $solution_data->code_number . '.zip"'); header('Content-Length: ' . filesize($zip_filename)); + ob_clean(); + //flush(); readfile($zip_filename); unlink($zip_filename); } else { @@ -121,6 +123,8 @@ function lab_migration_download_experiment() header('Content-Type: application/zip'); header('Content-disposition: attachment; filename="EXP' . $experiment_data->number . '.zip"'); header('Content-Length: ' . filesize($zip_filename)); + ob_clean(); + //flush(); readfile($zip_filename); unlink($zip_filename); } else { @@ -131,6 +135,7 @@ function lab_migration_download_experiment() function lab_migration_download_lab() { + global $user; $lab_id = arg(3); $root_path = lab_migration_path(); @@ -174,12 +179,28 @@ function lab_migration_download_lab() if ($zip_file_count > 0) { - /* download zip file */ - header('Content-Type: application/zip'); - header('Content-disposition: attachment; filename="' . $lab_data->lab_title . '.zip"'); - header('Content-Length: ' . filesize($zip_filename)); - readfile($zip_filename); - unlink($zip_filename); + if($user->uid) { + /* download zip file */ + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename="' . $lab_data->lab_title . '.zip"'); + header('Content-Length: ' . filesize($zip_filename)); + ob_clean(); + //flush(); + readfile($zip_filename); + unlink($zip_filename); + } else { + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename="' . $lab_data->lab_title . '.zip"'); + header('Content-Length: ' . filesize($zip_filename)); + header("Content-Transfer-Encoding: binary"); + header('Expires: 0'); + header('Pragma: no-cache'); + ob_end_flush(); + ob_clean(); + flush(); + readfile($zip_filename); + unlink($zip_filename); + } } else { drupal_set_message("There are no solutions in this Lab to download", 'error'); drupal_goto('lab_migration_run'); @@ -9,6 +9,66 @@ function lab_migration_mail($key, &$message, $params) $language = $message['language']; 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']); + $proposal_data = db_fetch_object($proposal_q); + + 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); + $experiment_list = ' + '; + while ($experiment_data = db_fetch_object($experiment_q)) { + $experiment_list .= $experiment_data->number . ' ' . $experiment_data->title . ' + '; + } + + $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', '')), $language->language); + $message['body'] = t(' +Dear !user_name, + +Your following Lab migration solution proposal has been approved: + +Full Name : ' . $proposal_data->solution_provider_name_title . ' ' . $proposal_data->solution_provider_name . ' +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 . ' + +Display solution on website : ' . $solution_display . ' + +List of experiments : ' . $experiment_list . ' + + +Best Wishes, + +!site_name', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), $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', '')), $language->language); + $message['body'] = t(' +Dear !user_name, + +Your Lab migration solution proposal has been disapproved. + +Reason: ' . $params['solution_proposal_disapproved']['message'] . ' + +Best Wishes, + +!site_name', array('!site_name' => variable_get('site_name', ''), '!user_name' => $user_data->name), $language->language); + break; + case 'proposal_received': /* initializing data */ diff --git a/full_download.inc b/full_download.inc index 7dcc2c5..1ddf7a8 100755 --- a/full_download.inc +++ b/full_download.inc @@ -147,6 +147,8 @@ function lab_migration_download_full_lab() if ($zip_file_count > 0) { /* download zip file */ + ob_clean(); + //flush(); header('Content-Type: application/zip'); header('Content-disposition: attachment; filename="' . $lab_data->lab_title . '.zip"'); header('Content-Length: ' . filesize($zip_filename)); diff --git a/lab_details.inc b/lab_details.inc new file mode 100755 index 0000000..3f09e43 --- /dev/null +++ b/lab_details.inc @@ -0,0 +1,31 @@ +<?php + function lab_migration_completed_labs_all() { + $page_content = ""; + $query = "SELECT * FROM {lab_migration_proposal} WHERE approval_status = 3"; + $result = db_query($query); + + $page_content .= "<ol>"; + while($row = db_fetch_object($result)) { + $page_content .= "<li>"; + $page_content .= l($row->university." ({$row->lab_title})", "lab_migration_run/".$row->id); + $page_content .= "</li>"; + } + $page_content .= "</ol>"; + return $page_content; + } + + function lab_migration_labs_progress_all() { + $page_content = ""; + $query = "SELECT * FROM {lab_migration_proposal} WHERE approval_status = 1 and solution_status = 2"; + $result = db_query($query); + + $page_content .= "<ol>"; + while($row = db_fetch_object($result)) { + $page_content .= "<li>"; + $page_content .= $row->university . " ({$row->lab_title})"; + $page_content .= "</li>"; + } + $page_content .= "</ol>"; + return $page_content; + } +?> diff --git a/lab_migration.module b/lab_migration.module index e9db41c..a0ba425 100755 --- a/lab_migration.module +++ b/lab_migration.module @@ -308,6 +308,22 @@ function lab_migration_menu() 'file' => 'full_download.inc', ); + /* COMPLETED LAB MIGRATIONS */ + $items['lab_migration/completed_labs'] = array( + 'title' => 'Completed Labs', + 'page callback' => 'lab_migration_completed_labs_all', + 'access arguments' => array('lab migration download code'), + 'file' => 'lab_details.inc', + ); + + /* LABS IN PROGRESS */ + $items['lab_migration/labs_progress'] = array( + 'title' => 'Labs in Progress', + 'page callback' => 'lab_migration_labs_progress_all', + 'access arguments' => array('lab migration download code'), + 'file' => 'lab_details.inc', + ); + /* DOWNLOAD FOR EVERYONE */ $items['lab_migration_run'] = array( 'title' => 'Download Codes', @@ -113,18 +113,20 @@ function _latex_generate_files($lab_id, $full_lab = FALSE) $dependency_q = db_query("SELECT * FROM {lab_migration_dependency_files} WHERE id = %d LIMIT 1", $dependency_files_data->dependency_id); if ($dependency_data = db_fetch_object($dependency_q)) { - $latex_filedata .= $experiment_data->number . $sep; - $latex_filedata .= $experiment_data->title . $sep; - $latex_filedata .= $solution_data->code_number . $sep; - $latex_filedata .= $solution_data->caption . $sep; - $latex_filedata .= $dependency_data->filename . $sep; - $latex_filedata .= $dependency_data->filepath . $sep; - $latex_filedata .= 'D' . $sep; - $latex_filedata .= $dependency_data->caption . $sep; - $latex_filedata .= $dependency_data->id; - $latex_filedata .= $eol; - - $depedency_list[$dependency_data->id] = "D"; + if(substr($dependency_data->filename, -3) != "wav") { + $latex_filedata .= $experiment_data->number . $sep; + $latex_filedata .= $experiment_data->title . $sep; + $latex_filedata .= $solution_data->code_number . $sep; + $latex_filedata .= $solution_data->caption . $sep; + $latex_filedata .= $dependency_data->filename . $sep; + $latex_filedata .= $dependency_data->filepath . $sep; + $latex_filedata .= 'D' . $sep; + $latex_filedata .= $dependency_data->caption . $sep; + $latex_filedata .= $dependency_data->id; + $latex_filedata .= $eol; + + $depedency_list[$dependency_data->id] = "D"; + } } } } diff --git a/latex.inc.backup b/latex.inc.backup new file mode 100755 index 0000000..42318e5 --- /dev/null +++ b/latex.inc.backup @@ -0,0 +1,217 @@ +<?php + +function lab_migration_download_lab_pdf() +{ + $lab_id = arg(2); + _latex_copy_script_file(); + $full_lab = arg(3); + if ($full_lab == "1") + _latex_generate_files($lab_id, TRUE); + else + _latex_generate_files($lab_id, FALSE); +} + +/* full lab parameter is for gennerating the entire lab pdf including all unapproved solutions */ +function _latex_generate_files($lab_id, $full_lab = FALSE) +{ + $root_path = lab_migration_path(); + $dir_path = $root_path . "latex/"; + + $lab_filedata = ""; + $solution_provider_filedata = ""; + $latex_filedata = ""; + $latex_dep_filedata = ""; + + $depedency_list = array(); + + $eol = "\n"; + $sep = "#"; + + $proposal_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d", $lab_id); + $proposal_data = db_fetch_object($proposal_q); + if (!$proposal_data) + { + drupal_set_message('Invalid lab specified.', 'error'); + drupal_goto(''); + } + if ($proposal_data->approval_status == 0) + { + drupal_set_message('Lab proposal is still in pending review.', 'error'); + drupal_goto(''); + } + + $category_data = ''; + switch ($proposal_data->category) + { + case 0: $category_data = 'Not Selected'; break; + case 1: $category_data = 'Fluid Mechanics'; break; + case 2: $category_data = 'Control Theory & Control Systems'; break; + case 3: $category_data = 'Chemical Engineering'; break; + case 4: $category_data = 'Thermodynamics'; break; + case 5: $category_data = 'Mechanical Engineering'; break; + case 6: $category_data = 'Signal Processing'; break; + case 7: $category_data = 'Digital Communications'; break; + case 8: $category_data = 'Electrical Technology'; break; + case 9: $category_data = 'Mathematics & Pure Science'; break; + case 10: $category_data = 'Analog Electronics'; break; + case 11: $category_data = 'Digital Electronics'; break; + case 12: $category_data = 'Computer Programming'; break; + case 13: $category_data = 'Others'; break; + default: $category_data = 'Unknown'; break; + } + + $lab_filedata = $proposal_data->lab_title . $sep . $proposal_data->name_title . $sep . $proposal_data->name . $sep . $proposal_data->department . $sep . $proposal_data->university . $sep . $category_data . $eol; + + /* regenerate lab if full lab selected */ + if ($full_lab) + lab_migration_del_lab_pdf($proposal_data->id); + + /* check if lab already generated */ + if (file_exists($dir_path . "lab_" . $proposal_data->id . ".pdf")) + { + /* download zip file */ + header('Content-Type: application/pdf'); + header('Content-disposition: attachment; filename="' . $proposal_data->lab_title . '.pdf"'); + header('Content-Length: ' . filesize($dir_path . "lab_" . $proposal_data->id . ".pdf")); + readfile($dir_path . "lab_" . $proposal_data->id . ".pdf"); + return; + } + + $solution_provider_user = user_load($proposal_data->solution_provider_uid); + if (!$solution_provider_user) + { + drupal_set_message('Could not fetch solution provider information for the lab specified.', 'error'); + } + $solution_provider_filedata .= $proposal_data->solution_provider_name_title . $sep . $proposal_data->solution_provider_name . $sep . $proposal_data->solution_provider_department . $sep . $proposal_data->solution_provider_university . $eol; + + $experiment_q = db_query("SELECT * FROM {lab_migration_experiment} WHERE proposal_id = %d ORDER BY number DESC", $proposal_data->id); + while ($experiment_data = db_fetch_object($experiment_q)) + { + if ($full_lab) + $solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE experiment_id = %d ORDER BY code_number DESC", $experiment_data->id); + else + $solution_q = db_query("SELECT * FROM {lab_migration_solution} WHERE experiment_id = %d AND approval_status = 1 ORDER BY code_number DESC", $experiment_data->id); + while ($solution_data = db_fetch_object($solution_q)) + { + $solution_files_q = db_query("SELECT * FROM {lab_migration_solution_files} WHERE solution_id = %d", $solution_data->id); + while ($solution_files_data = db_fetch_object($solution_files_q)) + { + $latex_filedata .= $experiment_data->number . $sep; + $latex_filedata .= $experiment_data->title . $sep; + $latex_filedata .= $solution_data->code_number . $sep; + $latex_filedata .= $solution_data->caption . $sep; + $latex_filedata .= $solution_files_data->filename . $sep; + $latex_filedata .= $solution_files_data->filepath . $sep; + $latex_filedata .= $solution_files_data->filetype . $sep; + $latex_filedata .= $sep; + $latex_filedata .= $solution_files_data->id; + $latex_filedata .= $eol; + } + $dependency_files_q = db_query("SELECT * FROM {lab_migration_solution_dependency} WHERE solution_id = %d", $solution_data->id); + while ($dependency_files_data = db_fetch_object($dependency_files_q)) + { + $dependency_q = db_query("SELECT * FROM {lab_migration_dependency_files} WHERE id = %d LIMIT 1", $dependency_files_data->dependency_id); + if ($dependency_data = db_fetch_object($dependency_q)) + { + $latex_filedata .= $experiment_data->number . $sep; + $latex_filedata .= $experiment_data->title . $sep; + $latex_filedata .= $solution_data->code_number . $sep; + $latex_filedata .= $solution_data->caption . $sep; + $latex_filedata .= $dependency_data->filename . $sep; + $latex_filedata .= $dependency_data->filepath . $sep; + $latex_filedata .= 'D' . $sep; + $latex_filedata .= $dependency_data->caption . $sep; + $latex_filedata .= $dependency_data->id; + $latex_filedata .= $eol; + + $depedency_list[$dependency_data->id] = "D"; + } + } + } + } + + foreach ($depedency_list as $row => $data) { + $dependency_q = db_query("SELECT * FROM {lab_migration_dependency_files} WHERE id = %d LIMIT 1", $row); + if ($dependency_data = db_fetch_object($dependency_q)) + { + $latex_dep_filedata .= $dependency_data->filename . $sep; + $latex_dep_filedata .= $dependency_data->filepath . $sep; + $latex_dep_filedata .= $dependency_data->caption . $sep; + $latex_dep_filedata .= $dependency_data->id; + $latex_dep_filedata .= $eol; + } + } + + /**************************** WRITE TO FILES ********************************/ + $download_filename = $proposal_data->lab; + $lab_filename = "tmp_" . $proposal_data->id . "_lab.txt"; + $solution_provider_filename = "tmp_" . $proposal_data->id . "_solution_provider.txt"; + $latex_filename = "tmp_" . $proposal_data->id . "_data.txt"; + $latex_dep_filename = "tmp_" . $proposal_data->id . "_dep_data.txt"; + $pdf_filename = "lab_" . $proposal_data->id . ".pdf"; + + $fb = fopen($dir_path . $lab_filename, 'w'); + fwrite($fb, $lab_filedata); + fclose($fb); + + $fc = fopen($dir_path . $solution_provider_filename, 'w'); + fwrite($fc, $solution_provider_filedata); + fclose($fc); + + $fl = fopen($dir_path . $latex_filename, 'w'); + fwrite($fl, $latex_filedata); + fclose($fl); + + $fd = fopen($dir_path . $latex_dep_filename, 'w'); + fwrite($fd, $latex_dep_filedata); + fclose($fd); + + if (_latex_run_script($lab_filename, $solution_provider_filename, $latex_filename, $latex_dep_filename, $pdf_filename)) + { + /* download zip file */ + header('Content-Type: application/pdf'); + header('Content-disposition: attachment; filename="' . $proposal_data->lab_title . '_' . $proposal_data->name_title . '_' . $proposal_data->name . '.pdf"'); + header('Content-Length: ' . filesize($dir_path . $pdf_filename)); + readfile($dir_path . $pdf_filename); + } else { + drupal_set_message("Error occurred when generating the PDF version of the Book.", 'error'); + } + + /*********************** DELETING TEMPORARY FILES ***************************/ + /* regenerate lab if full lab selected */ + if ($full_lab) + lab_migration_del_lab_pdf($proposal_data->id); +} + +function _latex_copy_script_file() +{ + exec("cp ./" . drupal_get_path('module', 'lab_migration') . "/latex/* " . lab_migration_path() . "latex"); + exec("chmod u+x ./uploads/latex/*.sh"); +} + +function _latex_run_script($lab_filename, $solution_provider_filename, $latex_filename, $latex_dep_filename, $pdf_filename) +{ + $root_path = lab_migration_path(); + $ret = 0; + chdir("lab_migration_uploads"); + chdir("latex"); + + $sh_command = "./pdf_creator.sh " . $lab_filename . " " . $solution_provider_filename . " " . $latex_filename . " " . $latex_dep_filename; + exec($sh_command); + exec("mv TEX_final.pdf " . $pdf_filename); + + if ($ret == 0) + return TRUE; + else + return FALSE; +} + +function lab_migration_delete_lab_pdf() +{ + $lab_id = arg(3); + lab_migration_del_lab_pdf($lab_id); + drupal_set_message(t('Lab schedule for regeneration.'), 'status'); + drupal_goto('lab_migration/code_approval/bulk'); + return; +} + diff --git a/latex/Initial_body b/latex/Initial_body index 1230bfa..53e82b4 100755 --- a/latex/Initial_body +++ b/latex/Initial_body @@ -1,3 +1,4 @@ +\nonstopmode \documentclass[12pt]{report}
\usepackage{hyperref}
\hypersetup{colorlinks=true,linkcolor=blue}
diff --git a/latex/latex_test.sh b/latex/latex_test.sh index fd6c078..60f0886 100755 --- a/latex/latex_test.sh +++ b/latex/latex_test.sh @@ -25,7 +25,17 @@ fi IFS_old="$IFS" IFS=# read col1 col2 col3 col4 < $Contrib_details; -IFS=# read colB1 colB2 colB3 colB4 colB5 colB6 < $Bk_details +IFS=# read colB1 colB2 colB3 colB4 colB5 colB6 < $Bk_details; +col1=${col1/&/\\&}; +col2=${col2/&/\\&}; +col3=${col3/&/\\&}; +col4=${col4/&/\\&}; +colB1=${colB1/&/\\&}; +colB2=${colB2/&/\\&}; +colB3=${colB3/&/\\&}; +colB4=${colB4/&/\\&}; +colB5=${colB5/&/\\&}; +colB6=${colB6/&/\\&}; echo \\title\{Scilab Manual \for "\\\\"$colB1"\\\\"by $colB2 $colB3""\\\\$colB4""\\\\$colB5"\\footnote{Funded by a grant from the National Mission on Education through ICT, http://spoken-tutorial.org/NMEICT-Intro. This Scilab Manual and Scilab codes written in it can be downloaded from the \"Migrated Labs\" section at the website http://scilab.in}}" >>$CURDIR/TEX echo \\author\{ Solutions provided by \\\\$col1 $col2\\\\$col3\\\\$col4\\\\ }>>$CURDIR/TEX @@ -73,7 +83,10 @@ k=1; sort -t '.' -k 1,1n -k 2,2n -k 3,3n -k 4,4n $Data_all > database_sort while IFS=# read col1 col2 col3 col4 col5 col6 col7 col8 col9; do - +col2=${col2/&/\\&}; +col3=${col3/&/\\&}; +col4=${col4/&/\\&}; +col8=${col8/&/\\&}; chap_diff=$(($col1 - $j)) if [ $chap_diff -eq 1 ]; then echo \\chapter{$col2}>>$CURDIR/TEX @@ -144,6 +157,7 @@ i=1; echo \\chapter*{Appendix} >>$CURDIR/TEX while IFS=# read col1 col2 col3 col4; do +col3=${col3/&/\\&}; echo \\curlable{AP~$i} >> $CURDIR/TEX; echo \\begin{code} >> $CURDIR/TEX; echo \\label{AP:$col4} >> $CURDIR/TEX diff --git a/manage_proposal.inc b/manage_proposal.inc index 6f95f10..4a73f36 100755 --- a/manage_proposal.inc +++ b/manage_proposal.inc @@ -261,6 +261,9 @@ function lab_migration_proposal_approval_form_submit($form, &$form_state) $email_to = $user_data->mail; $param['proposal_approved']['proposal_id'] = $proposal_id; $param['proposal_approved']['user_id'] = $proposal_data->uid; + // echo "To: ".$email_to." From: ".variable_get('lab_migration_from_email', NULL)."<br>"; + // echo "<pre>"; + // var_dump($param); die; 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'); diff --git a/manage_solution_proposal.inc b/manage_solution_proposal.inc index 8dfdb59..cd9828d 100755 --- a/manage_solution_proposal.inc +++ b/manage_solution_proposal.inc @@ -195,7 +195,7 @@ function lab_migration_solution_proposal_approval_form_submit($form, &$form_stat /* sending email */ $email_to = $user_data->mail; $param['solution_proposal_approved']['proposal_id'] = $proposal_id; - $param['solution_proposal_approved']['user_id'] = $proposal_data->uid; + $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)) drupal_set_message('Error sending email message.', 'error'); @@ -212,7 +212,7 @@ function lab_migration_solution_proposal_approval_form_submit($form, &$form_stat /* sending email */ $email_to = $user_data->mail; $param['solution_proposal_disapproved']['proposal_id'] = $proposal_id; - $param['solution_proposal_disapproved']['user_id'] = $proposal_data->uid; + $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'); diff --git a/proposal.inc b/proposal.inc index 06e8c36..f2e6b42 100755 --- a/proposal.inc +++ b/proposal.inc @@ -43,7 +43,7 @@ function lab_migration_proposal_form($form_state) $form['name_title'] = array( '#type' => 'select', '#title' => t('Title'), - '#options' => array('Mr' => 'Mr', 'Ms' => 'Ms', 'Mrs' => 'Mrs', 'Dr' => 'Dr', 'Prof' => 'Prof'), + '#options' => array('Dr' => 'Dr', 'Prof' => 'Prof'), '#required' => TRUE, ); $form['name'] = array( diff --git a/upload_code.inc b/upload_code.inc index 9ac6508..158ff9f 100755 --- a/upload_code.inc +++ b/upload_code.inc @@ -312,7 +312,6 @@ function lab_migration_upload_code_form_validate($form, &$form_state) $allowed_extensions_str = variable_get('lab_migration_xcos_extensions', ''); break; } - $allowed_extensions = explode(',' , $allowed_extensions_str); $temp_extension = end(explode('.', strtolower($_FILES['files']['name'][$file_form_name]))); if (!in_array($temp_extension, $allowed_extensions)) @@ -517,7 +516,7 @@ function _list_of_dependency_files() $temp_caption = ''; if ($dependency_files_data->caption) $temp_caption .= ' (' . $dependency_files_data->caption . ')'; - $dependency_files[$dependency_files_data->id] = l($dependency_files_data->filename . $temp_caption, 'lab_migration/download/dependency/' . $dependency_files_data->id); + $dependency_files[$dependency_files_data->id] = l($dependency_files_data->filename . $temp_caption, 'lab_migration/download/dependency/' . $dependency_files_data->id, array('attributes' => array('class' => $dependency_files_data->proposal_id))); $dependency_files_class[$dependency_files_data->id] = $dependency_files_data->proposal_id; } return array($dependency_files, $dependency_files_class); |