summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbulk_approval.inc17
-rwxr-xr-xcode_approval.inc34
-rwxr-xr-xdownload.inc4
-rwxr-xr-xemail.inc62
-rwxr-xr-xfull_download.inc9
-rwxr-xr-xgeneral_deletion.inc2
-rwxr-xr-xlab_details.inc9
-rwxr-xr-xlab_migration.module21
-rwxr-xr-xmanage_proposal.inc287
-rwxr-xr-xproposal.inc21
-rwxr-xr-xrun.inc22
-rwxr-xr-xsolution_proposal.inc10
-rwxr-xr-xupload_code.inc66
-rwxr-xr-xupload_code_delete.inc10
14 files changed, 341 insertions, 233 deletions
diff --git a/bulk_approval.inc b/bulk_approval.inc
index 668f39c..625960f 100755
--- a/bulk_approval.inc
+++ b/bulk_approval.inc
@@ -131,11 +131,9 @@ $select_two = isset($form_state['values']['lab_experiment_list']) ? $form_state[
- $commands[] = ajax_command_html('#ajax_selected_lab', l('Download', 'lab_migration/full_download/lab/' . $lab_default_value) . ' ' .
- t('(Download all the approved and unapproved solutions of the entire lab)') );
+ $commands[] = ajax_command_html('#ajax_selected_lab', l('Download', 'lab-migration/full-download/lab/' . $lab_default_value) . ' ' . t('(Download all the approved and unapproved solutions of the entire lab)') );
- /*$commands[] = ajax_command_html('#ajax_selected_lab_pdf', l('Download PDF', 'lab_migration/generate_lab/' . $lab_default_value . '/1') .
- ' ' . t('(Download PDF of all the approved and unapproved solution of the entire lab)')); */
+ /*$commands[] = ajax_command_html('#ajax_selected_lab_pdf', l('Download PDF', 'lab-migration/generate-lab/' .$lab_default_value . '/1') . ' ' . t('(Download PDF of all the approved and unapproved solution of the entire lab)')); */
$form['lab_actions']['#options'] = _bulk_list_lab_actions();
$form['lab_experiment_list']['#options'] = _ajax_bulk_get_experiment_list($lab_default_value);
@@ -180,7 +178,7 @@ $select_two = isset($form_state['values']['lab_experiment_list']) ? $form_state[
$form['lab_experiment_actions']['#options'] =_bulk_list_experiment_actions();
$form['lab_solution_list']['#options'] = _ajax_bulk_get_solution_list($experiment_list_default_value);
- $commands[] = ajax_command_html('#ajax_download_experiment', l('Download Experiment', 'lab_migration/download/experiment/' . $experiment_list_default_value));
+ $commands[] = ajax_command_html('#ajax_download_experiment', l('Download Experiment', 'lab-migration/download/experiment/' . $experiment_list_default_value));
$commands[] = ajax_command_data('#ajax_selected_experiment', 'form_state_value_select', $form_state['values']['lab_experiment_list']);
@@ -238,7 +236,7 @@ function ajax_bulk_solution_files_callback($form, $form_state) {
case 'X' : $solution_file_type = 'xcos file'; break;
default : $solution_file_type = 'Unknown'; break;
}
- $solution_files_rows[] = array(l($solution_list_data->filename, 'lab_migration/download/file/' . $solution_list_data->id), $solution_file_type);
+ $solution_files_rows[] = array(l($solution_list_data->filename, 'lab-migration/download/file/' . $solution_list_data->id), $solution_file_type);
}
/* dependency files */
@@ -256,7 +254,7 @@ function ajax_bulk_solution_files_callback($form, $form_state) {
$dependency_files_q = $query->execute();
$dependency_files_data = $dependency_files_q->fetchObject();
$solution_file_type = 'Dependency file';
- $solution_files_rows[] = array(l($dependency_files_data->filename, 'lab_migration/download/dependency/' . $dependency_files_data->dependency_id), $solution_file_type);
+ $solution_files_rows[] = array(l($dependency_files_data->filename, 'lab-migration/download/dependency/' . $dependency_files_data->dependency_id), $solution_file_type);
}
/* creating list of files table */
@@ -266,8 +264,8 @@ function ajax_bulk_solution_files_callback($form, $form_state) {
}
$form['solution_files']['#title'] = 'List of solution files';
$form['solution_files']['#markup'] = $solution_files;
- $commands[] = ajax_command_html('#ajax_download_experiment_solution', l('Download Solution', 'lab_migration/download/solution/' . $solution_list_default_value));
- $commands[] = ajax_command_html('#ajax_edit_experiment_solution', l('Edit Solution', 'code_approval/editcode/' . $solution_list_default_value));
+ $commands[] = ajax_command_html('#ajax_download_experiment_solution', l('Download Solution', 'lab-migration/download/solution/' . $solution_list_default_value));
+ $commands[] = ajax_command_html('#ajax_edit_experiment_solution', l('Edit Solution', 'code-approval/editcode/' . $solution_list_default_value));
// $commands[] = ajax_command_html('#ajax_solution_files', $solution_files);
$commands[] = ajax_command_html('#ajax_solution_files',drupal_render($form['solution_files']));
@@ -535,6 +533,7 @@ function _bulk_list_of_labs()
//$lab_titles_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE solution_display = 1 ORDER BY lab_title ASC");
$query = db_select('lab_migration_proposal');
$query->fields('lab_migration_proposal');
+ $query->condition('approval_status', 2, '<>');
$query->condition('solution_display', 1);
$query->orderBy('lab_title', 'ASC');
$lab_titles_q = $query->execute();
diff --git a/code_approval.inc b/code_approval.inc
index 7868935..2ec1fbe 100755
--- a/code_approval.inc
+++ b/code_approval.inc
@@ -45,7 +45,7 @@ function lab_migration_code_approval()
}
/* 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));
+ $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 */
@@ -61,7 +61,7 @@ function lab_migration_code_approval()
return $output;
}
-function lab_migration_code_approval_form($form_state)
+function lab_migration_code_approval_form($form,$form_state)
{
$solution_id = (int)arg(3);
@@ -75,7 +75,7 @@ function lab_migration_code_approval_form($form_state)
if (!$solution_data)
{
drupal_set_message(t('Invalid solution selected.'), 'status');
- drupal_goto('lab_migration/code_approval');
+ 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');
@@ -137,7 +137,7 @@ function lab_migration_code_approval_form($form_state)
$form['back_to_list'] = array(
'#type' => 'item',
- '#markup' => l('Back to Code Approval List', 'lab_migration/code_approval'),
+ '#markup' => l('Back to Code Approval List', 'lab-migration/code-approval'),
);
$form['code_number'] = array(
@@ -171,7 +171,7 @@ function lab_migration_code_approval_form($form_state)
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 . ')' . '<br/>';
+ $solution_files_html .= l($solution_files_data->filename, 'lab-migration/download/file/' . $solution_files_data->id) . ' (' . $code_file_type . ')' . '<br/>';
}
}
/* get dependencies files */
@@ -190,7 +190,7 @@ $dependency_q = $query->execute();
$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' . ')' . '<br/>';
+ $solution_files_html .= l($dependency_files_data->filename, 'lab-migration/download/dependency/' . $dependency_files_data->id) . ' (' . 'Dependency' . ')' . '<br/>';
}
$form['solution_files'] = array(
@@ -209,7 +209,13 @@ $dependency_q = $query->execute();
$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(
+ 'visible' => array(
+ ':input[name="approved"]' => array('value' => "2"),
+ ),
+ ),
+ );
$form['submit'] = array(
'#type' => 'submit',
@@ -218,12 +224,20 @@ $dependency_q = $query->execute();
$form['cancel'] = array(
'#type' => 'markup',
- '#markup' => l(t('Cancel'), 'lab_migration/code_approval'),
+ '#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'));
+ }
+ }
+}
function lab_migration_code_approval_form_submit($form, &$form_state)
{
global $user;
@@ -240,7 +254,7 @@ function lab_migration_code_approval_form_submit($form, &$form_state)
if (!$solution_data)
{
drupal_set_message(t('Invalid solution selected.'), 'status');
- drupal_goto('lab_migration/code_approval');
+ drupal_goto('lab-migration/code-approval');
}
/* get experiment data */
@@ -313,6 +327,6 @@ function lab_migration_code_approval_form_submit($form, &$form_state)
}
drupal_set_message('Updated successfully.', 'status');
- drupal_goto('lab_migration/code_approval');
+ drupal_goto('lab-migration/code-approval');
}
diff --git a/download.inc b/download.inc
index f84694b..224c44b 100755
--- a/download.inc
+++ b/download.inc
@@ -244,7 +244,7 @@ function lab_migration_download_lab()
$solution_dependency_files_q = $query->execute();
while ($solution_files_row = $solution_files_q->fetchObject())
{
- $zip->addFile($root_path . $solution_files_row->filepath, $LAB_PATH . $EXP_PATH . $CODE_PATH . str_replace(' ','_',($solution_files_row->filename)));
+ $zip->addFile($root_path . $solution_files_row->filepath, $EXP_PATH . $CODE_PATH . str_replace(' ','_',($solution_files_row->filename)));
//var_dump($zip->numFiles);
}
@@ -259,7 +259,7 @@ function lab_migration_download_lab()
$query->range(0, 1);
$dependency_file_data = $query->execute()->fetchObject();
if ($dependency_file_data)
- $zip->addFile($root_path . $dependency_file_data->filepath, $LAB_PATH . $EXP_PATH . $CODE_PATH . 'DEPENDENCIES/' . str_replace(' ','_',($dependency_file_data->filename)));
+ $zip->addFile($root_path . $dependency_file_data->filepath, $EXP_PATH . $CODE_PATH . 'DEPENDENCIES/' . str_replace(' ','_',($dependency_file_data->filename)));
}
}
}
diff --git a/email.inc b/email.inc
index 440346e..78a15ee 100755
--- a/email.inc
+++ b/email.inc
@@ -34,9 +34,9 @@ function lab_migration_mail($key, &$message, $params)
$query->orderBy('number', 'ASC');
$experiment_q = $query->execute();
$experiment_list = '
- ';
+ ';
while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= $experiment_data->number . ' ' . $experiment_data->title . '<br/> '.$experiment_data->description.' ';
+ $experiment_list .= '<br>' . $experiment_data->number . ' ' . $experiment_data->title . '<br> '.$experiment_data->description.' <br>';
}
$user_data = user_load($params['solution_proposal_approved']['user_id']);
@@ -57,7 +57,7 @@ Display solution on website : ' . $solution_display . '
List of experiments : ' . $experiment_list . '
-Please ensure that ALL the codes follow guidelines at http://www.esim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
@@ -118,7 +118,7 @@ Best Wishes,
$experiment_list = '
';
while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= $experiment_data->number . ' ' . $experiment_data->title . '<br/> '.$experiment_data->description.' ';
+ $experiment_list .= '<br>' . $experiment_data->number . ' ' . $experiment_data->title . '<br> '.$experiment_data->description.' <br>';
}
$user_data = user_load($params['proposal_received']['user_id']);
@@ -136,15 +136,13 @@ Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
-Display solution on website : ' . $solution_display . '
-
Solution Provided By : ' . $solution_provider_user . '
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.esim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
@@ -187,7 +185,7 @@ Best Wishes,
$experiment_list = '
';
while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= $experiment_data->number . ' ' . $experiment_data->title . '<br/> '.$experiment_data->description.' ';
+ $experiment_list .= '<br>' . $experiment_data->number . ' ' . $experiment_data->title . '<br> '.$experiment_data->description.' <br>';
}
$user_data = user_load($params['proposal_disapproved']['user_id']);
@@ -206,13 +204,11 @@ Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
-Display solution on website : ' . $solution_display . '
-
Solution Provided By : ' . $solution_provider_user . '
List of experiments : ' . $experiment_list . '
-Please ensure that ALL the codes follow guidelines at http://www.esim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://www.dsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
@@ -255,7 +251,7 @@ Best Wishes,
$experiment_list = '
';
while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= $experiment_data->number . ' ' . $experiment_data->title . '<br/> '.$experiment_data->description.' ';
+ $experiment_list .= '<br>' . $experiment_data->number . ' ' . $experiment_data->title . '<br> '.$experiment_data->description.' <br>';
}
$user_data = user_load($params['proposal_approved']['user_id']);
@@ -272,13 +268,11 @@ Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
-Display solution on website : ' . $solution_display . '
-
Solution Provided By : ' . $solution_provider_user . '
List of experiments : ' . $experiment_list . '
-Please ensure that ALL the codes follow guidelines at http://www.esim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
@@ -322,7 +316,7 @@ Best Wishes,
$experiment_list = '
';
while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= $experiment_data->number . ' ' . $experiment_data->title . '<br/> '.$experiment_data->description.' ';
+ $experiment_list .= '<br/><br/><span style="font-weight: bold;">'. $experiment_data->number . ' ' . $experiment_data->title . '</span><br/><br/> '.'Description:'. $experiment_data->description.'<br/><br/>';
}
$user_data = user_load($params['proposal_completed']['user_id']);
@@ -339,19 +333,17 @@ Contact No. : ' . $proposal_data->contact_ph . '
Department/Branch : ' . $proposal_data->department . '
University/Institute : ' . $proposal_data->university . '
-Display solution on website : ' . $solution_display . '
-
Solution Provided By : ' . $solution_provider_user . '
List of experiments : ' . $experiment_list . '
Your Lab solution is now available at following link to download.
-http://esim.fossee.in/lab_migration_run/' . $proposal_data->id . '
+http://dwsim.fossee.in/lab_migration_run/' . $proposal_data->id . '
Now you should be able to propose a new Lab migration...
-Please ensure that ALL the codes follow guidelines at http://www.esim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
@@ -384,7 +376,7 @@ Best Wishes,
$experiment_list = '
';
while ($experiment_data = $experiment_q->fetchObject()) {
- $experiment_list .= $experiment_data->number . ' ' . $experiment_data->title . '<br/> Description: '.$experiment_data->description.'<br/><br/> ';
+ $experiment_list .= '<br/><b>' . $experiment_data->number . ' ' . $experiment_data->title . '</b><br/> Description: '.$experiment_data->description.'<br/><br/><br/> ';
}
$user_data = user_load($params['solution_proposal_received']['user_id']);
@@ -409,7 +401,7 @@ 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.esim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
@@ -418,20 +410,30 @@ Best Wishes,
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 = 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('
Dear !user_name,
-You have uploaded the following solution:
+You have uploaded the following solution:
+Lab title: ' . $solution_data->lab_title . '
Example number : ' . $solution_data->code_number . '
Caption : ' . $solution_data->caption . '
@@ -462,7 +464,7 @@ Your following solution has been approved:
Solution number : ' . $solution_data->code_number . '
Caption : ' . $solution_data->caption . '
-Please ensure that ALL the codes follow guidelines at http://www.esim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
@@ -483,7 +485,7 @@ 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.esim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
@@ -491,8 +493,7 @@ Best Wishes,
break;
case 'solution_deleted_user':
- $user_data = user_load($params['solution_deleted_user']['user_id']);
-
+ $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('
Dear !user_name,
@@ -504,7 +505,7 @@ 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.esim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
@@ -513,6 +514,7 @@ Best Wishes,
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));
@@ -522,7 +524,7 @@ Dear !user_name,
You have uploaded following dependency files :
' . $dependency_files . '
-Please ensure that ALL the codes follow guidelines at http://www.esim.fossee.in/coding-guidelines-lab-migration
+Please ensure that ALL the codes follow guidelines at http://www.dwsim.fossee.in/coding-guidelines-lab-migration
Best Wishes,
diff --git a/full_download.inc b/full_download.inc
index 31527ca..9b8a617 100755
--- a/full_download.inc
+++ b/full_download.inc
@@ -134,10 +134,11 @@ function lab_migration_download_full_lab()
//$lab_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE id = %d", $lab_id);
$query = db_select('lab_migration_proposal');
$query->fields('lab_migration_proposal');
+
$query->condition('id', $lab_id);
$lab_q = $query->execute();
$lab_data = $lab_q->fetchObject();
- $LAB_PATH = $lab_data->lab . '/';
+ $LAB_PATH = $lab_data->lab_title . '/';
/* zip filename */
$zip_filename = $root_path . 'zip-' . time() . '-' . rand(0, 999999) . '.zip';
@@ -176,7 +177,7 @@ function lab_migration_download_full_lab()
$solution_dependency_files_q = $query->execute();
while ($solution_files_row = $solution_files_q->fetchObject())
{
- $zip->addFile($root_path . $solution_files_row->filepath, $LAB_PATH . $APPROVE_PATH . $EXP_PATH . $CODE_PATH . $solution_files_row->filename);
+ $zip->addFile($root_path . $solution_files_row->filepath, $APPROVE_PATH . $EXP_PATH . $CODE_PATH . $solution_files_row->filename);
}
/* dependency files */
while ($solution_dependency_files_row = $solution_dependency_files_q->fetchObject())
@@ -188,7 +189,7 @@ function lab_migration_download_full_lab()
$query->range(0, 1);
$dependency_file_data = $query->execute()->fetchObject();
if ($dependency_file_data)
- $zip->addFile($root_path . $dependency_file_data->filepath, $LAB_PATH . $APPROVE_PATH . $EXP_PATH . $CODE_PATH . 'DEPENDENCIES/' . $dependency_file_data->filename);
+ $zip->addFile($root_path . $dependency_file_data->filepath, $APPROVE_PATH . $EXP_PATH . $CODE_PATH . 'DEPENDENCIES/' . $dependency_file_data->filename);
}
}
@@ -246,7 +247,7 @@ function lab_migration_download_full_lab()
unlink($zip_filename);
} else {
drupal_set_message("There are no solutions in this lab to download", 'error');
- drupal_goto('lab_migration/code_approval/bulk');
+ drupal_goto('lab-migration/code-approval/bulk');
}
}
diff --git a/general_deletion.inc b/general_deletion.inc
index b39fc4d..b6622b2 100755
--- a/general_deletion.inc
+++ b/general_deletion.inc
@@ -77,7 +77,7 @@ function lab_migration_delete_solution($solution_id)
return FALSE;
/* removing code folder */
- $ex_path = $experiment_data->proposal_id . '/EXP' . $experiment_data->number . '/CODE' . $solution_data->code_number;
+ $ex_path = $experiment_data->directory_name . '/EXP' . $experiment_data->number . '/CODE' . $solution_data->code_number;
$dir_path = $root_path . $ex_path;
if (is_dir($dir_path))
{
diff --git a/lab_details.inc b/lab_details.inc
index 59898da..217c4b6 100755
--- a/lab_details.inc
+++ b/lab_details.inc
@@ -7,11 +7,11 @@
$query->condition('approval_status', 3);
$result = $query->execute();
//$result = db_query($query);
- $proposal_rows = array();
+ $preference_rows = array();
$i=1;
while($row = $result->fetchObject()) {
- $approval_date=date("Y", $row->approval_date);
- $preference_rows[] = array($i, $row->university , l($row->lab_title,"lab_migration_run/".$row->id),$approval_date);
+ $approval_date = date("Y", $row->approval_date);
+ $preference_rows[] = array($i, $row->university , l($row->lab_title,"lab-migration-run/".$row->id),$approval_date);
$i++;
}
$preference_header = array('No','Institute', 'Lab', 'Year');
@@ -37,4 +37,7 @@
$page_content .= "</ol>";
return $page_content;
}
+
+
+
?>
diff --git a/lab_migration.module b/lab_migration.module
index c1b2072..a08b099 100755
--- a/lab_migration.module
+++ b/lab_migration.module
@@ -560,7 +560,7 @@ function lab_migration_check_code_number($number = '') {
}
function lab_migration_path() {
- return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'lab_migration_uploads/';
+ return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'dwsim_uploads/lab_migration_uploads/';
}
/************************* USER VERIFICATION FUNCTIONS ************************/
@@ -580,7 +580,7 @@ function lab_migration_get_proposal() {
$proposal_data = $proposal_q->fetchObject();
if (!$proposal_data)
{
- drupal_set_message("You do not have any approved Lab migraion solution proposal. Please check the " . l('available', 'lab_migration/open_proposal') . " Lab migration proposal.", 'error');
+ drupal_set_message("You do not have any approved Lab migraion solution proposal. Please check the " . l('available', 'lab-migration/open-proposal') . " Lab migration proposal.", 'error');
drupal_goto('');
}
switch ($proposal_data->approval_status)
@@ -634,3 +634,20 @@ function lab_migration_get_category_name($category_id) {
drupal_add_js(drupal_get_path('module', 'lab_migration') . '/js/lab_migration_ajax.js', array ('scope' => 'footer'));
}*/
+
+ /*************************************************************************/
+ /***** Function To convert only first charater of string in uppercase ****/
+ /*************************************************************************/
+ function ucname($string) {
+ $string =ucwords(strtolower($string));
+
+ foreach (array('-', '\'') as $delimiter) {
+ if (strpos($string, $delimiter)!==false) {
+ $string =implode($delimiter, array_map('ucfirst', explode($delimiter, $string)));
+ }
+ }
+ return $string;
+}
+
+
+
diff --git a/manage_proposal.inc b/manage_proposal.inc
index 3687d3e..52bfd05 100755
--- a/manage_proposal.inc
+++ b/manage_proposal.inc
@@ -104,25 +104,8 @@ function lab_migration_category_all()
$proposal_q = $query->execute();
while ($proposal_data = $proposal_q->fetchObject())
{
- 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;
- }
- $proposal_rows[] = array(date('d-m-Y', $proposal_data->creation_date), l($proposal_data->name, 'user/' . $proposal_data->uid), $proposal_data->lab_title, $proposal_data->department, $category_data, l('Edit Category', 'lab-migration/manage-proposal/category/edit/' . $proposal_data->id));
+
+ $proposal_rows[] = array(date('d-m-Y', $proposal_data->creation_date), l($proposal_data->name, 'user/' . $proposal_data->uid), $proposal_data->lab_title, $proposal_data->department, $proposal_data->category, l('Edit Category', 'lab-migration/manage-proposal/category/edit/' . $proposal_data->id));
}
$proposal_header = array('Date of Submission', 'Name', 'Title of the Lab', 'Department', 'Category', 'Action');
@@ -268,6 +251,11 @@ function lab_migration_proposal_approval_form($form, $form_state)
'#type' => 'textarea',
'#title' => t('Reason for disapproval'),
'#attributes' =>array('placeholder' => t('Enter reason for disapproval in minimum 30 characters '), 'cols' => 50, 'rows' => 4),
+ '#states' => array(
+ 'visible' => array(
+ ':input[name="approval"]' => array('value' => '2'),
+ ),
+ ),
);
$form['submit'] = array(
@@ -283,6 +271,14 @@ function lab_migration_proposal_approval_form($form, $form_state)
return $form;
}
+function lab_migration_proposal_approval_form_validate($form, &$form_state)
+{
+if($form_state['values']['approval'] == 2){
+ if($form_state['values']['message'] == ''){
+ form_set_error('message', t('Reason for disapproval could not be empty'));
+ }
+}
+}
function lab_migration_proposal_approval_form_submit($form, &$form_state)
{
global $user;
@@ -312,7 +308,7 @@ function lab_migration_proposal_approval_form_submit($form, &$form_state)
}
if ($form_state['values']['approval'] == 1) {
- $query = "UPDATE {lab_migration_proposal} SET approver_uid = :uid, approval_date = :date, approval_status = 1 WHERE id = :proposal_id";
+ $query = "UPDATE {lab_migration_proposal} SET approver_uid = :uid, approval_date = :date, approval_status = 1, solution_status = 2 WHERE id = :proposal_id";
$args = array(
":uid" => $user->uid,
":date" =>time(),
@@ -520,7 +516,7 @@ function lab_migration_proposal_status_form($form,$form_state)
);
$form['cancel'] = array(
- '#type' => 'item',
+ '#type' => 'markup',
'#markup' => l(t('Cancel'), 'lab-migration/manage-proposal/all'),
);
@@ -555,30 +551,37 @@ function lab_migration_proposal_status_form_submit($form, &$form_state)
}
/* set the book status to completed */
- if ($form_state['values']['completed'] == 1)
+ if ($form_state['values']['completed'] == 1)
{
- $query = "UPDATE {lab_migration_proposal} SET approval_status = 3 and expected_completion_date= :date WHERE id = :proposal_id";
+ $up_query = "UPDATE lab_migration_proposal SET approval_status = :approval_status , expected_completion_date = :expected_completion_date WHERE id = :proposal_id";
$args = array(
+ ":approval_status" => '3',
":proposal_id" => $proposal_id,
- ":date" => time(),
+ ":expected_completion_date" => time(),
);
- $result = db_query($query, $args);
+
+ $result = db_query($up_query,$args);
+ CreateReadmeFileLabMigration($proposal_id);
+ if(!$result){
+ 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))
+ 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))
+ 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');
+ drupal_goto('lab-migration/manage-proposal');
return;
}
@@ -647,17 +650,7 @@ function lab_migration_proposal_edit_form($form, $form_state)
$form['department'] = array(
'#type' => 'select',
'#title' => t('Department/Branch'),
- '#options' => array('' => 'Please select...',
- 'Computer Engineering' => 'Computer Engineering',
- 'Electrical Engineering' => 'Electrical Engineering',
- 'Electronics Engineering' => 'Electronics Engineering',
- 'Chemical Engineering' => 'Chemical Engineering',
- 'Instrumentation Engineering' => 'Instrumentation Engineering',
- 'Mechanical Engineering' => 'Mechanical Engineering',
- 'Civil Engineering' => 'Civil Engineering',
- 'Physics' => 'Physics',
- 'Mathematics' => 'Mathematics',
- 'Others' => 'Others'),
+ '#options' => _list_of_departments(),
'#required' => TRUE,
'#default_value' => $proposal_data->department,
);
@@ -665,79 +658,89 @@ function lab_migration_proposal_edit_form($form, $form_state)
'#type' => 'textfield',
'#title' => t('University/Institute'),
'#size' => 30,
- '#maxlength' => 50,
+ '#maxlength' => 50,
'#required' => TRUE,
'#default_value' => $proposal_data->university,
);
-$form['city'] = array(
+ $form['country'] = array(
+ '#type' => 'select',
+ '#title' => t('Country'),
+ '#options' => array(
+ 'India' => 'India',
+ 'Others' => 'Others',
+ ),
+ '#default_value' => $proposal_data->country,
+ '#required' => TRUE,
+ '#tree' => TRUE,
+ '#validated' => TRUE,
+ );
+ $form['other_country'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Other than India'),
+ '#size' => 100,
+ '#default_value' => $proposal_data->country,
+ '#attributes' =>array('placeholder' => t('Enter your country name')),
+ '#states' => array(
+ 'visible' => array(
+ ':input[name="country"]' => array('value' => 'Others'),
+ ),
+ ),
+ );
+ $form['other_state'] = array(
'#type' => 'textfield',
- '#title' => t('City/ Village'),
- '#size' => 80,
- '#maxlength' => 150,
+ '#title' => t('State other than India'),
+ '#size' => 100,
+ '#attributes' =>array('placeholder' => t('Enter your state/region name')),
+ '#default_value' => $proposal_data->state,
+ '#states' => array(
+ 'visible' => array(
+ ':input[name="country"]' => array('value' => 'Others'),
+ ),
+ ),
+ );
+ $form['other_city'] = array(
+ '#type' => 'textfield',
+ '#title' => t('City other than India'),
+ '#size' => 100,
+ '#attributes' =>array('placeholder' => t('Enter your city name')),
'#default_value' => $proposal_data->city,
- '#required' => TRUE,
- '#attributes' =>array('placeholder' =>'Insert location of your institute/ university....'),
- );
+ '#states' => array(
+ 'visible' => array(
+ ':input[name="country"]' => array('value' => 'Others'),
+ ),
+ ),
+ );
+ $form['all_state'] = array(
+ '#type' => 'select',
+ '#title' => t('State'),
+ '#options' => _list_of_states(),
+ '#default_value' => $proposal_data->state,
+ '#validated' => TRUE,
+ '#states' => array(
+ 'visible' => array(
+ ':input[name="country"]' => array('value' => 'India'),
+ ),
+ ),
+ );
+ $form['city'] = array(
+ '#type' => 'select',
+ '#title' => t('City'),
+ '#options' => _list_of_cities(),
+ '#default_value' => $proposal_data->city,
+ '#states' => array(
+ 'visible' => array(
+ ':input[name="country"]' => array('value' => 'India'),
+ ),
+ ),
+ );
$form['pincode'] = array(
'#type' => 'textfield',
'#title' => t('Pincode'),
'#size' => 30,
- '#maxlength' => 6,
- '#required' => TRUE,
+ '#maxlength' => 6,
'#default_value' => $proposal_data->pincode,
'#attributes' =>array('placeholder' =>'Insert pincode of your city/ village....'),
);
-$form['all_state'] = array(
- '#type' => 'select',
- '#title' => t('State'),
- '#options' => array(
- '0' => 'Please select...',
- 'Andhra Pradesh' => t('Andhra Pradesh'),
- 'Arunachal Pradesh' => 'Arunachal Pradesh',
- 'Assam' => 'Assam',
- 'Bihar' => 'Bihar',
- 'Chhattisgarh' => 'Chhattisgarh',
- 'Goa' => 'Goa',
- 'Gujarat' => 'Gujarat',
- 'Haryana' => 'Haryana',
- 'Himachal Pradesh' => 'Himachal Pradesh',
- 'Jammu & Kashmir' => 'Jammu & Kashmir',
- 'Jharkhand' => 'Jharkhand',
- 'Karnataka' => 'Karnataka',
- 'Kerala' => 'Kerala',
- 'Madhya Pradesh' => 'Madhya Pradesh',
- 'Maharashtra' => 'Maharashtra',
- 'Manipur' => 'Manipur',
- 'Meghalaya' => 'Meghalaya',
- 'Mizoram' => 'Mizoram',
- 'Nagaland' => 'Nagaland',
- 'Odisha' => 'Odisha',
- 'Punjab' => 'Punjab',
- 'Rajasthan' => 'Rajasthan',
- 'Sikkim' => 'Sikkim',
- 'Tamil Nadu' => 'Tamil Nadu',
- 'Telangana' => 'Telangana',
- 'Tripura' => 'Tripura',
- 'Uttarakhand' => 'Uttarakhand',
- 'Uttar Pradesh'=> 'Uttar Pradesh',
- 'West Bengal' => 'West Bengal',
- 'Andaman & Nicobar' => 'Andaman & Nicobar',
- 'Chandigarh' => 'Chandigarh',
- 'Dadra and Nagar Haveli' => 'Dadra and Nagar Haveli',
- 'Daman & Diu' => 'Daman & Diu',
- 'Delhi' => 'Delhi',
- 'Lakshadweep' => 'Lakshadweep',
- 'Puducherry' => 'Puducherry',
- 'Others' => 'Others',
- ),
- '#required' => TRUE,
- '#tree' => TRUE,
- '#validated' => TRUE,
- '#default_value' => $proposal_data->state,
- );
-
-
-
$form['lab_title'] = array(
'#type' => 'textfield',
'#title' => t('Title of the Lab'),
@@ -1212,20 +1215,7 @@ function lab_migration_category_edit_form($form,$form_state)
$form['category'] = array(
'#type' => 'select',
'#title' => t('Category'),
- '#options' => array(0 => 'Please select',
- 1 => 'Fluid Mechanics',
- 2 => 'Control Theory & Control Systems',
- 3 => 'Chemical Engineering',
- 4 => 'Thermodynamics',
- 5 => 'Mechanical Engineering',
- 6 => 'Signal Processing',
- 7 => 'Digital Communications',
- 8 => 'Electrical Technology',
- 9 => 'Mathematics & Pure Science',
- 10 => 'Analog Electronics',
- 11 => 'Digital Electronics',
- 12 => 'Computer Programming',
- 13 => 'Others'),
+ '#options' => _list_of_departments(),
'#required' => TRUE,
'#default_value' => $proposal_data->category,
);
@@ -1266,7 +1256,7 @@ function lab_migration_category_edit_form_submit($form, &$form_state)
return;
}
- $query = "UPDATE {lab_migration_proposal} SET category = category WHERE id = :proposal_id";
+ $query = "UPDATE {lab_migration_proposal} SET category = :category WHERE id = :proposal_id";
$args = array(
":category" => $form_state['values']['category'],
":proposal_id" => $proposal_data->id
@@ -1277,3 +1267,66 @@ function lab_migration_category_edit_form_submit($form, &$form_state)
drupal_goto('lab-migration/manage-proposal/category');
}
+
+function _list_of_departments(){
+ $department = array(0 => '-Select-');
+ $query = db_select('list_of_departments');
+ $query->fields('list_of_departments');
+ $query->orderBy('id', 'DESC');
+ $department_list = $query->execute();
+ while ($department_list_data = $department_list->fetchObject())
+ {
+ $department[$department_list_data->department] = $department_list_data->department;
+ }
+ return $department;
+}
+function _list_of_states(){
+ $states = array(0 => '-Select-');
+ $query = db_select('list_states_of_india');
+ $query->fields('list_states_of_india');
+
+ //$query->orderBy('', '');
+ $states_list = $query->execute();
+ while ($states_list_data = $states_list->fetchObject())
+ {
+ $states[$states_list_data->state] = $states_list_data->state;
+ }
+ return $states;
+}
+
+
+function _list_of_cities(){
+ $city = array();
+ $query = db_select('list_cities_of_india');
+ $query->fields('list_cities_of_india');
+ $query->orderBy('city', 'ASC');
+ $city_list = $query->execute();
+ while ($city_list_data = $city_list->fetchObject())
+ {
+ $city[$city_list_data->city] = $city_list_data->city;
+ }
+ return $city;
+}
+
+function CreateReadmeFileLabMigration($proposal_id){
+
+ $result = db_query("
+ SELECT * from lab_migration_proposal WHERE id = :proposal_id",
+ array(":proposal_id" => $proposal_id)
+ );
+ $proposal_data = $result->fetchObject();
+ $root_path = lab_migration_path();
+ $readme_file = fopen($root_path . $proposal_data->directory_name."/README.txt", "w") or die("Unable to open file!");
+ $txt = "";
+ $txt .= "Title Of The Lab: ".$proposal_data->lab_title."\n";
+ $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 .= "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";
+ fwrite($readme_file, $txt);
+ fclose($readme_file);
+ return $txt;
+
+}
diff --git a/proposal.inc b/proposal.inc
index a7d0376..e2eabc4 100755
--- a/proposal.inc
+++ b/proposal.inc
@@ -210,7 +210,7 @@ function lab_migration_proposal_form($form,$form_state)
$form['lab_experiment_description-' . $counter] = array(
'#type' => 'textarea',
'#required' => FALSE,
- '#attributes' =>array('placeholder' => t('Enter Description for your experiment '.$counter)),
+ '#attributes' =>array('placeholder' => t('Enter Description for your experiment '.$counter),'cols' => 50, 'rows' => 4),
'#title' => t('Description for Experiment ') . $counter,
'#states' => array(
'invisible' => array(
@@ -340,9 +340,16 @@ function lab_migration_proposal_form_submit($form, &$form_state)
/* inserting the user proposal */
$v = $form_state["values"];
+ $lab_title = ucname($v['lab_title']);
+ $university = ucname($v['university']);
+ $dir_name = $lab_title." ". $university;
+ $directory_name = str_replace("__","_",str_replace(" ","_",$dir_name));
$result = "INSERT INTO {lab_migration_proposal}
- (uid, approver_uid, name_title, name, contact_ph, department, university, city, pincode, state, country, lab_title, approval_status, solution_status, solution_provider_uid, solution_display, creation_date, approval_date, solution_date, solution_provider_name_title, solution_provider_name, solution_provider_contact_ph, solution_provider_department, solution_provider_university) VALUES
- (:uid, :approver_uid, :name_title, :name, :contact_ph, :department, :university, :city, :pincode, :state, :country, :lab_title, :approval_status, :solution_status, :solution_provider_uid, :solution_display, :creation_date, :approval_date, :solution_date, :solution_provider_name_title, :solution_provider_name, :solution_provider_contact_ph, :solution_provider_department, :solution_provider_university)";
+ (uid, approver_uid, name_title, name, contact_ph, department, university, city, pincode, state, country, lab_title, approval_status, solution_status, solution_provider_uid, solution_display, creation_date, approval_date, solution_date, solution_provider_name_title, solution_provider_name, solution_provider_contact_ph, solution_provider_department, solution_provider_university, directory_name) VALUES
+ (:uid, :approver_uid, :name_title, :name, :contact_ph, :department, :university, :city, :pincode, :state, :country,
+ :lab_title, :approval_status, :solution_status, :solution_provider_uid, :solution_display, :creation_date,
+ :approval_date, :solution_date, :solution_provider_name_title, :solution_provider_name,
+ :solution_provider_contact_ph, :solution_provider_department, :solution_provider_university, :directory_name)";
$args= array(
":uid" => $user->uid,
":approver_uid" => 0,
@@ -367,7 +374,8 @@ function lab_migration_proposal_form_submit($form, &$form_state)
":solution_provider_name" => $solution_provider_name,
":solution_provider_contact_ph" => $solution_provider_contact_ph,
":solution_provider_department" => $solution_provider_department,
- ":solution_provider_university" => $solution_provider_university
+ ":solution_provider_university" => $solution_provider_university,
+ ":directory_name" => $directory_name
);
$proposal_id = db_query($result, $args, array('return' => Database::RETURN_INSERT_ID));
if (!$proposal_id)
@@ -384,9 +392,10 @@ function lab_migration_proposal_form_submit($form, &$form_state)
$experiment_field_name = 'lab_experiment-' . $counter;
$experiment_description='lab_experiment_description-' . $counter;
if (strlen(trim($form_state['values'][$experiment_field_name])) >= 1) {
- $query = "INSERT INTO {lab_migration_experiment} (proposal_id, number, title,description) VALUES (:proposal_id, :number, :experiment_field_name,:description)";
+ $query = "INSERT INTO {lab_migration_experiment} (proposal_id, directory_name, number, title,description) VALUES (:proposal_id, :directory_name, :number, :experiment_field_name,:description)";
$args= array(
- ":proposal_id" => $proposal_id,
+ ":proposal_id" => $proposal_id,
+ ":directory_name" => $directory_name,
":number" => $number,
":experiment_field_name"=> trim($form_state['values'][$experiment_field_name]),
":description"=>trim($form_state['values'][$experiment_description])
diff --git a/run.inc b/run.inc
index c7d87b9..96887fa 100755
--- a/run.inc
+++ b/run.inc
@@ -90,19 +90,19 @@
$lab_default_value = $url_lab_id;
$form['selected_lab'] = array(
'#type' => 'item',
- '#markup' => '<div id="ajax_selected_lab">'.l('Download Lab Solutions', 'lab_migration/download/lab/' . $lab_default_value).'</div>',
+ '#markup' => '<div id="ajax_selected_lab">'.l('Download Lab Solutions', 'lab-migration/download/lab/' . $lab_default_value).'</div>',
);
$form['selected_lab_pdf'] = array(
'#type' => 'item',
- '#markup' => '<div id="ajax_selected_lab_pdf">'. l('Download PDF of Lab Solutions', 'lab_migration/generate_lab/' . $lab_default_value . '/1') .'</div>',
+ '#markup' => '<div id="ajax_selected_lab_pdf">'. l('Download PDF of Lab Solutions', 'lab-migration/generate-lab/' . $lab_default_value . '/1') .'</div>',
);
if($lab_default_value=='2'){
$form['selected_lab_freeeda'] = array(
'#type' => 'item',
- '#markup' => '<div id="ajax_selected_lab_freeeda">'.l('Download Lab Solutions (FreeEDA Version)', 'lab_migration_uploads/Open_Source_EDA_Lab_FreeEDA_Version.zip').'</div>',
+ '#markup' => '<div id="ajax_selected_lab_freeeda">'.l('Download Lab Solutions (FreeEDA Version)', 'lab-migration-uploads/Open_Source_EDA_Lab_FreeEDA_Version.zip').'</div>',
);
}
@@ -183,10 +183,10 @@ function ajax_experiment_list_callback($form, $form_state) {
$user_solution_provider = user_load($lab_details->solution_provider_uid);
//var_dump($lab_details->solution_provider_uid);
if ($lab_details->solution_provider_uid > 0) {
- $commands[] = ajax_command_html('#ajax_selected_lab', l('Download Lab Solutions', 'lab_migration/download/lab/' . $lab_default_value));
+ $commands[] = ajax_command_html('#ajax_selected_lab', l('Download Lab Solutions', 'lab-migration/download/lab/' . $lab_default_value));
if($lab_default_value=='2'){
- $commands[] = ajax_command_html('#ajax_selected_lab_freeeda', l('Download Lab Solutions (FreeEDA Version)', 'lab_migration_uploads/Open_Source_EDA_Lab_FreeEDA_Version.zip'));}
- $commands[] = ajax_command_html('#ajax_selected_lab_pdf', l('Download PDF of Lab Solutions', 'lab_migration/generate_lab/' . $lab_default_value . '/1'));
+ $commands[] = ajax_command_html('#ajax_selected_lab_freeeda', l('Download Lab Solutions (FreeEDA Version)', 'lab-migration_uploads/Open_Source_EDA_Lab_FreeEDA_Version.zip'));}
+ $commands[] = ajax_command_html('#ajax_selected_lab_pdf', l('Download PDF of Lab Solutions', 'lab-migration/generate-lab/' . $lab_default_value . '/1'));
}else{
$commands[] = ajax_command_html('#ajax_selected_lab', '');
@@ -233,7 +233,7 @@ function ajax_solution_list_callback($form, $form_state){
$form['lab_solution_list']['#options'] = _ajax_get_solution_list($experiment_list_default_value);
- $commands[] = ajax_command_html('#ajax_download_experiments', l('Download Experiment', 'lab_migration/download/experiment/' . $experiment_list_default_value));
+ $commands[] = ajax_command_html('#ajax_download_experiments', l('Download Experiment', 'lab-migration/download/experiment/' . $experiment_list_default_value));
$commands[] = ajax_command_html('#ajax_selected_experiment',drupal_render($form['lab_experiment_list']));
@@ -285,7 +285,7 @@ function ajax_solution_list_callback($form, $form_state){
case 'X' : $solution_file_type = 'xcos file'; break;
default : $solution_file_type = 'Unknown'; break;
}
- $solution_files_rows[] = array(l($solution_list_data->filename, 'lab_migration/download/file/' . $solution_list_data->id), $solution_file_type);
+ $solution_files_rows[] = array(l($solution_list_data->filename, 'lab-migration/download/file/' . $solution_list_data->id), $solution_file_type);
}
/* dependency files */
@@ -303,7 +303,7 @@ function ajax_solution_list_callback($form, $form_state){
$dependency_files_q = $query->execute();
$dependency_files_data = $dependency_files_q->fetchObject();
$solution_file_type = 'Dependency file';
- $solution_files_rows[] = array(l($dependency_files_data->filename, 'lab_migration/download/dependency/' . $dependency_files_data->id), $solution_file_type);
+ $solution_files_rows[] = array(l($dependency_files_data->filename, 'lab-migration/download/dependency/' . $dependency_files_data->id), $solution_file_type);
}
/* creating list of files table */
@@ -313,7 +313,7 @@ function ajax_solution_list_callback($form, $form_state){
}
$form['solution_files']['#title'] = 'List of solution files';
$form['solution_files']['#markup'] = $solution_files;
- $commands[] = ajax_command_html('#ajax_download_experiment_solution', l('Download Solution', 'lab_migration/download/solution/' . $solution_list_default_value));
+ $commands[] = ajax_command_html('#ajax_download_experiment_solution', l('Download Solution', 'lab-migration/download/solution/' . $solution_list_default_value));
// $commands[] = ajax_command_html('#ajax_edit_experiment_solution', l('Edit Solution', 'code_approval/editcode/' . $solution_list_default_value));
// $commands[] = ajax_command_html('#ajax_solution_files', $solution_files);
$commands[] = ajax_command_html('#ajax_solution_files',drupal_render($form['solution_files']));
@@ -450,7 +450,7 @@ $form['lab_details']['#markup']= '<span style="color: rgb(128, 0, 0);"><strong>A
'<li><strong>Title of the Lab:</strong> ' . $lab_details->lab_title . '</li>' .
'<li><strong>Department:</strong> ' . $lab_details->department . '</li>' .
'<li><strong>University:</strong> ' . $lab_details->university . '</li>' .
- '<li><strong>Category:</strong> ' . $category_data . '</li>' .
+ '<li><strong>Category:</strong> ' . $lab_details->category . '</li>' .
'</ul>' .
$solution_provider;
diff --git a/solution_proposal.inc b/solution_proposal.inc
index 14c388e..5d5c910 100755
--- a/solution_proposal.inc
+++ b/solution_proposal.inc
@@ -15,7 +15,7 @@ function lab_migration_proposal_open()
$proposal_q = $query->execute();
while ($proposal_data = $proposal_q->fetchObject())
{
- $proposal_rows[] = array(l($proposal_data->lab_title, 'lab_migration/show_proposal/' . $proposal_data->id), l('Apply', 'lab_migration/show_proposal/' . $proposal_data->id));
+ $proposal_rows[] = array(l($proposal_data->lab_title, 'lab-migration/show-proposal/' . $proposal_data->id), l('Apply', 'lab-migration/show-proposal/' . $proposal_data->id));
}
$proposal_header = array('Title of the Lab', 'Actions');
@@ -139,7 +139,7 @@ function lab_migration_solution_proposal_form_validate($form_state, &$form_state
$solution_provider_q = $query->execute();
if ($solution_provider_q->fetchObject()) {
form_set_error('', t("You have already applied for a solution. Please compelete that before applying for another solution."));
- drupal_goto('lab_migration/open_proposal');
+ drupal_goto('lab-migration/open-proposal');
}
}
@@ -158,11 +158,11 @@ function lab_migration_solution_proposal_form_submit($form_state, &$form_state)
if (!$proposal_data)
{
drupal_set_message("Invalid proposal.", 'error');
- drupal_goto('lab_migration/open_proposal');
+ drupal_goto('lab-migration/open-proposal');
}
if ($proposal_data->solution_provider_uid != 0) {
drupal_set_message("Someone has already applied for solving this Lab.", 'error');
- drupal_goto('lab_migration/open_proposal');
+ drupal_goto('lab-migration/open-proposal');
}
$query = "UPDATE {lab_migration_proposal} set solution_provider_uid = :uid, solution_status = 1, 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";
@@ -190,6 +190,6 @@ function lab_migration_solution_proposal_form_submit($form_state, &$form_state)
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_goto('lab_migration/open_proposal');
+ drupal_goto('lab-migration/open-proposal');
}
diff --git a/upload_code.inc b/upload_code.inc
index b591991..568d1c2 100755
--- a/upload_code.inc
+++ b/upload_code.inc
@@ -13,7 +13,7 @@ function lab_migration_list_experiments()
$return_html = '<strong>Title of the Lab:</strong><br />' . $proposal_data->lab_title . '<br /><br />';
$return_html .= '<strong>Proposer Name:</strong><br />' . $proposal_data->name_title . ' ' . $proposal_data->name . '<br /><br />';
- $return_html .= l('Upload Solution', 'lab_migration/code/upload') . '<br />';
+ $return_html .= l('Upload Solution', 'lab-migration/code/upload') . '<br />';
/* get experiment list */
$experiment_rows = array();
@@ -48,7 +48,7 @@ function lab_migration_list_experiments()
default: $solution_status = "Unknown"; break;
}
if ($solution_data->approval_status == 0) {
- $experiment_rows[] = array("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $solution_data->code_number . " " . $solution_data->caption, '', $solution_status, l('Delete', 'lab_migration/code/delete/' . $solution_data->id));
+ $experiment_rows[] = array("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $solution_data->code_number . " " . $solution_data->caption, '', $solution_status, l('Delete', 'lab-migration/code/delete/' . $solution_data->id));
} else {
$experiment_rows[] = array("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $solution_data->code_number . " " . $solution_data->caption, '', $solution_status, '');
}
@@ -70,7 +70,7 @@ function lab_migration_list_experiments()
case 'U': $code_file_type = 'Unknown'; break;
default: $code_file_type = 'Unknown'; break;
}
- $experiment_rows[] = array("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . l($solution_files_data->filename, 'lab_migration/download/file/' . $solution_files_data->id), $code_file_type, '', '');
+ $experiment_rows[] = array("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . l($solution_files_data->filename, 'lab-migration/download/file/' . $solution_files_data->id), $code_file_type, '', '');
}
}
/* get dependencies files */
@@ -88,7 +88,7 @@ function lab_migration_list_experiments()
$query->condition('id', $dependency_data->dependency_id);
$dependency_files_q = $query->execute();
$dependency_files_data = $dependency_files_q->fetchObject();
- $experiment_rows[] = array("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . l($dependency_files_data->filename, 'lab_migration/download/dependency/' . $dependency_files_data->id), 'Dependency', '', '');
+ $experiment_rows[] = array("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . l($dependency_files_data->filename, 'lab-migration/download/dependency/' . $dependency_files_data->id), 'Dependency', '', '');
}
}
}
@@ -101,7 +101,7 @@ function lab_migration_list_experiments()
return $return_html;
}
-function lab_migration_upload_code_form($form_state)
+function lab_migration_upload_code_form($form,$form_state)
{
global $user;
@@ -195,21 +195,16 @@ function lab_migration_upload_code_form($form_state)
'#type' => 'select',
'#title' => t('Operating System used'),
'#options' => array(
- 0 => '--- Please select ---',
'Linux' => 'Linux',
'Windows' => 'Windows',
'Mac' => 'Mac'
),
'#required' => TRUE,
);
- $form['esim_version'] = array(
+ $form['dwsim_version'] = array(
'#type' => 'select',
- '#title' => t('esim version used'),
- '#options' => array(
- 0 => '--- Please select ---',
- '1.0.0' => '1.0.0',
- 'Older' => 'Older Version'
- ),
+ '#title' => t('DWSIM version used'),
+ '#options' => list_dwsim_software_version(),
'#required' => TRUE,
);
$form['toolbox_used'] = array(
@@ -219,7 +214,7 @@ function lab_migration_upload_code_form($form_state)
);
$form['code_warning'] = array(
'#type' => 'item',
- '#title' => t('Upload all the eSim project files in .zip format'),
+ '#title' => t('Upload all the dwsim project files in .zip format'),
'#prefix' => '<div style="color:red">',
'#suffix' => '</div>',
);
@@ -280,7 +275,7 @@ function lab_migration_upload_code_form($form_state)
$form['existing_depfile']['dep_upload'] = array(
'#type' => 'item',
- '#markup' => l('Upload New Depedency Files', 'lab_migration/code/upload_dep'),
+ '#markup' => l('Upload New Depedency Files', 'lab-migration/code/upload_dep'),
);
/************ END OF EXISTING DEPENDENCIES **************/
@@ -333,7 +328,7 @@ function lab_migration_upload_code_form($form_state)
$form['cancel'] = array(
'#type' => 'markup',
- '#value' => l(t('Cancel'), 'lab_migration/code'),
+ '#value' => l(t('Cancel'), 'lab-migration/code'),
);
return $form;
}
@@ -349,8 +344,8 @@ function lab_migration_upload_code_form_validate($form, &$form_state)
if(!$form_state['values']['os_used'])
form_set_error('os_used', t('Please select the operating system used.'));
- if(!$form_state['values']['esim_version'])
- form_set_error('esim_version', t('Please select the esim version used.'));
+ if(!$form_state['values']['dwsim_version'])
+ form_set_error('dwsim_version', t('Please select the dwsim version used.'));
if (isset($_FILES['files']))
{
@@ -387,7 +382,8 @@ function lab_migration_upload_code_form_validate($form, &$form_state)
break;
}
$allowed_extensions = explode(',' , $allowed_extensions_str);
- $temp_extension = end(explode('.', strtolower($_FILES['files']['name'][$file_form_name])));
+ $tmp_ext = explode('.', strtolower($_FILES['files']['name'][$file_form_name]));
+ $temp_extension = end($tmp_ext);
if (!in_array($temp_extension, $allowed_extensions))
form_set_error($file_form_name, t('Only file with ' . $allowed_extensions_str . ' extensions can be uploaded.'));
if ($_FILES['files']['size'][$file_form_name] <= 0)
@@ -445,6 +441,7 @@ function lab_migration_upload_code_form_submit($form, &$form_state) {
}
$proposal_id = $proposal_data->id;
+ $proposal_drectory = $proposal_data->directory_name;
/************************ check experiment details ************************/
$experiment_id = (int)$form_state['values']['experiment'];
@@ -459,11 +456,11 @@ function lab_migration_upload_code_form_submit($form, &$form_state) {
if (!$experiment_data)
{
drupal_set_message("Invalid experiment seleted", 'error');
- drupal_goto('lab_migration/code');
+ drupal_goto('lab-migration/code');
}
/* create proposal folder if not present */
- $dest_path = $proposal_id . '/';
+ $dest_path = $proposal_drectory . '/';
if (!is_dir($root_path . $dest_path))
mkdir($root_path . $dest_path);
@@ -481,15 +478,15 @@ function lab_migration_upload_code_form_submit($form, &$form_state) {
if ($cur_solution_d->approval_status == 1)
{
drupal_set_message(t("Solution already approved. Cannot overwrite it."), 'error');
- drupal_goto('lab_migration/code');
+ drupal_goto('lab-migration/code');
return;
} else if ($cur_solution_d->approval_status == 0) {
drupal_set_message(t("Solution is under pending review. Delete the solution and reupload it."), 'error');
- drupal_goto('lab_migration/code');
+ drupal_goto('lab-migration/code');
return;
} else {
drupal_set_message(t("Error uploading solution. Please contact administrator."), 'error');
- drupal_goto('lab_migration/code');
+ drupal_goto('lab-migration/code');
return;
}
}
@@ -505,7 +502,7 @@ function lab_migration_upload_code_form_submit($form, &$form_state) {
mkdir($root_path . $dest_path);
/* creating solution database entry */
- $query = "INSERT INTO {lab_migration_solution} (experiment_id, approver_uid, code_number, caption, approval_date, approval_status, timestamp, os_used, esim_version, toolbox_used) VALUES (:experiment_id, :approver_uid, :code_number, :caption, :approval_date, :approval_status, :timestamp, :os_used, :esim_version, :toolbox_used)";
+ $query = "INSERT INTO {lab_migration_solution} (experiment_id, approver_uid, code_number, caption, approval_date, approval_status, timestamp, os_used, dwsim_version, toolbox_used) VALUES (:experiment_id, :approver_uid, :code_number, :caption, :approval_date, :approval_status, :timestamp, :os_used, :dwsim_version, :toolbox_used)";
$args = array(
":experiment_id" => $experiment_id,
":approver_uid" => 0,
@@ -515,7 +512,7 @@ function lab_migration_upload_code_form_submit($form, &$form_state) {
":approval_status" => 0,
":timestamp" => time(),
":os_used" => $form_state['values']['os_used'],
- ":esim_version" => $form_state['values']['esim_version'],
+ ":dwsim_version" => $form_state['values']['dwsim_version'],
":toolbox_used" => $form_state['values']['toolbox_used']
);
$solution_id = db_query($query, $args, array('return' => Database::RETURN_INSERT_ID));
@@ -590,7 +587,7 @@ function lab_migration_upload_code_form_submit($form, &$form_state) {
if (!drupal_mail('lab_migration', 'solution_uploaded', $email_to, language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE))
drupal_set_message('Error sending email message.', 'error');
- drupal_goto('lab_migration/code');
+ drupal_goto('lab-migration/code');
}
/******************************************************************************/
@@ -636,10 +633,23 @@ 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, array('attributes' => array('class' => $dependency_files_data->proposal_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;
$dependency_files_value[$dependency_files_data->id] = $dependency_files_data->proposal_id;
}
return array($dependency_files, $dependency_files_class, $dependency_files_value);
}
+function list_dwsim_software_version(){
+ $dwsim_version = array(0 => '-Select-');
+ $query = db_select('dwsim_software_version');
+ $query->fields('dwsim_software_version');
+ //$query->orderBy('city', 'ASC');
+ $dwsim_version_list = $query->execute();
+ while ($dwsim_version_list_data = $dwsim_version_list->fetchObject())
+ {
+ $dwsim_version[$dwsim_version_list_data->dwsim_version] = $dwsim_version_list_data->dwsim_version;
+ }
+ return $dwsim_version;
+}
+
diff --git a/upload_code_delete.inc b/upload_code_delete.inc
index 21ae4c3..204ac4a 100755
--- a/upload_code_delete.inc
+++ b/upload_code_delete.inc
@@ -22,13 +22,13 @@ function lab_migration_upload_code_delete()
if (!$solution_data)
{
drupal_set_message('Invalid solution.', 'error');
- drupal_goto('lab_migration/code');
+ drupal_goto('lab-migration/code');
return;
}
if ($solution_data->approval_status != 0)
{
drupal_set_message('You cannnot delete a solution after it has been approved. Please contact site administrator if you want to delete this solution.', 'error');
- drupal_goto('lab_migration/code');
+ drupal_goto('lab-migration/code');
return;
}
@@ -43,7 +43,7 @@ function lab_migration_upload_code_delete()
if (!$experiment_data)
{
drupal_set_message('You do not have permission to delete this solution.', 'error');
- drupal_goto('lab_migration/code');
+ drupal_goto('lab-migration/code');
return;
}
@@ -58,7 +58,7 @@ function lab_migration_upload_code_delete()
if (!$proposal_data)
{
drupal_set_message('You do not have permission to delete this solution.', 'error');
- drupal_goto('lab_migration/code');
+ drupal_goto('lab-migration/code');
return;
}
@@ -81,7 +81,7 @@ function lab_migration_upload_code_delete()
drupal_set_message('Error deleting example.', 'status');
}
- drupal_goto('lab_migration/code');
+ drupal_goto('lab-migration/code');
return;
}