summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdownload.inc35
-rwxr-xr-xdwsim_flowsheet.module10
-rwxr-xr-xflowsheet_details.inc8
-rwxr-xr-xfull_download.inc16
-rwxr-xr-xrun.inc4
5 files changed, 59 insertions, 14 deletions
diff --git a/download.inc b/download.inc
index 5b54648..5dfb9ef 100755
--- a/download.inc
+++ b/download.inc
@@ -17,6 +17,41 @@ function dwsim_flowsheet_download_user_defined_compound()
ob_clean();
readfile($root_path . $dwsim_flowsheet_user_compund_data->directory_name . '/' . $dwsim_flowsheet_user_compund_data->user_defined_compound_filepath);
}
+function dwsim_flowsheet_download_abstract() {
+ $proposal_id = arg(3);
+ $root_path = dwsim_flowsheet_path();
+ //var_dump($proposal_id);die;
+ $query = db_select('dwsim_flowsheet_submitted_abstracts_file');
+ $query->fields('dwsim_flowsheet_submitted_abstracts_file');
+ $query->condition('proposal_id', $proposal_id);
+ $query->condition('filetype', A);
+ $result = $query->execute();
+ $flowsheet_project_files = $result->fetchObject();
+ //var_dump($custom_model_project_files);die;
+ $query1 = db_select('dwsim_flowsheet_proposal');
+ $query1->fields('dwsim_flowsheet_proposal');
+ $query1->condition('id', $proposal_id);
+ $result1 = $query1->execute();
+ $flowsheet = $result1->fetchObject();
+ $directory_name = $flowsheet->directory_name;
+ $samplecodename = $flowsheet_project_files->filename;
+ ob_clean();
+ header("Pragma: public");
+ header("Expires: 0");
+ header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
+ header("Cache-Control: public");
+ header("Content-Description: File Transfer");
+ header("Content-Type: application/pdf");
+ header('Content-disposition: attachment; filename="' . $samplecodename . '"');
+ header("Content-Length: " . filesize($root_path . $directory_name . $samplecodename));
+ header("Content-Transfer-Encoding: binary");
+ header("Expires: 0");
+ header("Pragma: no-cache");
+ ob_clean();
+ readfile($root_path . $directory_name . '/' . $samplecodename);
+ //ob_end_flush();
+ //ob_clean();
+}
function dwsim_flowsheet_download_solution_file()
{
$solution_file_id = arg(3);
diff --git a/dwsim_flowsheet.module b/dwsim_flowsheet.module
index 58130ce..2918b8b 100755
--- a/dwsim_flowsheet.module
+++ b/dwsim_flowsheet.module
@@ -258,6 +258,16 @@ function dwsim_flowsheet_menu()
'type' => MENU_CALLBACK,
'file' => 'download.inc'
);
+ $items['flowsheeting-project/download/project-file'] = array(
+ 'title' => 'Code Download',
+ 'description' => 'Code Download',
+ 'page callback' => 'dwsim_flowsheet_download_abstract',
+ 'access arguments' => array(
+ 'dwsim flowsheet download code'
+ ),
+ 'type' => MENU_CALLBACK,
+ 'file' => 'download.inc'
+ );
$items['flowsheeting-project/download/solution'] = array(
'title' => 'Code Download',
'description' => 'Code Download',
diff --git a/flowsheet_details.inc b/flowsheet_details.inc
index b9317f0..67192ca 100755
--- a/flowsheet_details.inc
+++ b/flowsheet_details.inc
@@ -6,7 +6,7 @@ function dwsim_flowsheet_completed_proposals_all()
$query = db_select('dwsim_flowsheet_proposal');
$query->fields('dwsim_flowsheet_proposal');
$query->condition('approval_status', 3);
- $query->orderBy('actual_completion_date', 'ASC');
+ $query->orderBy('actual_completion_date', 'DESC');
//$query->condition('is_completed', 1);
$result = $query->execute();
if ($result->rowCount() == 0)
@@ -35,8 +35,8 @@ function dwsim_flowsheet_completed_proposals_all()
'No',
'Flowsheet Project',
'Contributor Name',
- 'Institution',
- 'Year'
+ 'University / Institute',
+ 'Year of Completion'
);
$output .= theme('table', array(
'header' => $preference_header,
@@ -79,7 +79,7 @@ function dwsim_flowsheet_progress_all()
'No',
'Flowsheet Project',
'Contributor Name',
- 'Institution',
+ 'University / Institute',
'Year'
);
$page_content .= theme('table', array(
diff --git a/full_download.inc b/full_download.inc
index 491da4b..1c889b3 100755
--- a/full_download.inc
+++ b/full_download.inc
@@ -41,9 +41,9 @@ function dwsim_flowsheet_download_full_project()
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename="' . str_replace(' ', '_', $flowsheet_data->project_title) . '.zip"');
header('Content-Length: ' . filesize($zip_filename));
- ob_end_flush();
+ //ob_end_flush();
ob_clean();
- flush();
+ //flush();
readfile($zip_filename);
unlink($zip_filename);
} //$user->uid
@@ -54,9 +54,9 @@ function dwsim_flowsheet_download_full_project()
header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Pragma: no-cache');
- ob_end_flush();
+ //ob_end_flush();
ob_clean();
- flush();
+ //flush();
readfile($zip_filename);
unlink($zip_filename);
}
@@ -107,9 +107,9 @@ function dwsim_flowsheet_download_completed_project()
header('Content-Type: application/zip');
header('Content-disposition: attachment; filename="' . str_replace(' ', '_', $flowsheet_data->project_title) . '.zip"');
header('Content-Length: ' . filesize($zip_filename));
- ob_end_flush();
+ //ob_end_flush();
ob_clean();
- flush();
+ //flush();
readfile($zip_filename);
unlink($zip_filename);
} //$user->uid
@@ -120,9 +120,9 @@ function dwsim_flowsheet_download_completed_project()
header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Pragma: no-cache');
- ob_end_flush();
+ //ob_end_flush();
ob_clean();
- flush();
+ // /flush();
readfile($zip_filename);
unlink($zip_filename);
}
diff --git a/run.inc b/run.inc
index 929334e..c118edf 100755
--- a/run.inc
+++ b/run.inc
@@ -44,7 +44,7 @@ function dwsim_flowsheet_run_form($form, &$form_state)
);
$form['selected_flowsheet'] = array(
'#type' => 'item',
- '#markup' => '<div id="ajax_selected_flowsheet">' . l('Download Flowsheet', 'flowsheeting-project/full-download/project/' . $flowsheet_default_value,array('attributes' => array('title' => 'This is a zip file containing a pdf (abstract) and a dwxml/dwxmz file which is the DWSIM flow sheet which is to be viewed by right clicking on the file and opening with DWSIM.'))) . '</div>'
+ '#markup' => '<div id="ajax_selected_flowsheet">' . l('Download Abstract', 'flowsheeting-project/download/project-file/' . $flowsheet_default_value) . '<br>' . l('Download Flowsheet', 'flowsheeting-project/full-download/project/' . $flowsheet_default_value,array('attributes' => array('title' => 'This is a zip file containing a pdf (abstract) and a dwxml/dwxmz file which is the DWSIM flow sheet which is to be viewed by right clicking on the file and opening with DWSIM.'))) . '</div>'
);
}
return $form;
@@ -58,7 +58,7 @@ function dwsim_flowsheet_project_details_callback($form, $form_state)
$flowsheet_details = _flowsheet_information($flowsheet_default_value);
$provider = user_load($flowsheet_details->uid);
if ($flowsheet_details->uid > 0) {
- $commands[] = ajax_command_html('#ajax_selected_flowsheet', l('Download Flowsheet', 'flowsheeting-project/full-download/project/' . $flowsheet_default_value,array('attributes' => array('title' => 'This is a zip file containing a pdf (abstract) and a dwxml/dwxmz file which is the DWSIM flow sheet which is to be viewed by right clicking on the file and opening with DWSIM.'))));
+ $commands[] = ajax_command_html('#ajax_selected_flowsheet',l('Download Abstract', 'flowsheeting-project/download/project-file/' . $flowsheet_default_value) . '<br>' . l('Download Flowsheet', 'flowsheeting-project/full-download/project/' . $flowsheet_default_value,array('attributes' => array('title' => 'This is a zip file containing a pdf (abstract) and a dwxml/dwxmz file which is the DWSIM flow sheet which is to be viewed by right clicking on the file and opening with DWSIM.'))));
} //$flowsheet_details->uid > 0
else {
$commands[] = ajax_command_html('#ajax_selected_flowsheet', '');