diff options
author | Sashi20 | 2017-08-22 15:44:20 +0530 |
---|---|---|
committer | Sashi20 | 2017-08-22 15:44:20 +0530 |
commit | 8e33072c9789a860abcd5af52bc57977622bf654 (patch) | |
tree | 5782672e1f82928989cf963456920e3d5dee00e8 | |
parent | f28f70b5727b17dec4986f01ccb1f871373028b1 (diff) | |
download | dwsim_flowsheet-8e33072c9789a860abcd5af52bc57977622bf654.tar.gz dwsim_flowsheet-8e33072c9789a860abcd5af52bc57977622bf654.tar.bz2 dwsim_flowsheet-8e33072c9789a860abcd5af52bc57977622bf654.zip |
Minor changes to the edit interface
-rwxr-xr-x | dwsim_flowsheet.module | 28 | ||||
-rwxr-xr-x | flowsheet_details.inc | 2 | ||||
-rwxr-xr-x | manage_proposal.inc | 78 | ||||
-rwxr-xr-x | proposal.inc | 32 | ||||
-rwxr-xr-x | run.inc | 8 |
5 files changed, 72 insertions, 76 deletions
diff --git a/dwsim_flowsheet.module b/dwsim_flowsheet.module index a5aa8d9..a122f17 100755 --- a/dwsim_flowsheet.module +++ b/dwsim_flowsheet.module @@ -465,12 +465,9 @@ function dwsim_flowsheet_menu() ), 'file' => 'pdf/cert_new.inc' ); - $items['flowsheeting-project/certificates/verify'] = array( + $items["flowsheeting-project/certificates/verify"] = array( "title" => "Certificate Verification", "page callback" => "verify_certificates", -'page arguments' => array( - 'verify_certificates' - ), "access arguments" => array( "verify certificates" ), @@ -539,18 +536,7 @@ function dwsim_flowsheet_permission() 'dwsim flowsheet generate abstract' => array( 'title' => t('dwsim flowsheet generate abstract'), 'restrict access' => TRUE - ), - "list flowsheet certificates" => array( - "title" => t("list the certificates"), - "description" => t("list the certificates"), - 'restrict access' => TRUE - ), - "verify certificates" => array( - "title" => t("verify the certificates"), - "description" => t("verify the certificates"), - 'restrict access' => TRUE ) - ); // return array('dwsim flowsheet create proposal', 'dwsim flowsheet manage proposal', 'dwsim flowsheet edit proposal', 'dwsim flowsheet approve proposal', 'dwsim flowsheet propose solution', 'dwsim flowsheet approve code', 'dwsim flowsheet bulk manage abstract', 'dwsim flowsheet bulk delete code', 'dwsim flowsheet upload code', 'dwsim flowsheet download code', 'administer dwsim flowsheet', 'dwsim flowsheet generate lab'); } @@ -715,7 +701,7 @@ function _df_list_of_dwsim_compound() $dwsim_compound = array(); $query = db_select('dwsim_flowsheet_compounds_from_dwsim'); $query->fields('dwsim_flowsheet_compounds_from_dwsim'); - $query->orderBy('compound', 'ASC'); + $query->orderBy('id', 'ASC'); $dwsim_compound_list = $query->execute(); while ($dwsim_compound_list_data = $dwsim_compound_list->fetchObject()) { @@ -741,7 +727,7 @@ function _df_list_of_thermodynamic_packages() $dwsim_thermodynamic_packages = array(); $query = db_select('dwsim_flowsheet_thermodynamic_packages'); $query->fields('dwsim_flowsheet_thermodynamic_packages'); - $query->orderBy('id', 'ASC'); + $query->orderBy('thermodynamic_packages', 'ASC'); $dwsim_thermodynamic_packages_list = $query->execute(); while ($dwsim_thermodynamic_packages_list_data = $dwsim_thermodynamic_packages_list->fetchObject()) { @@ -825,7 +811,7 @@ function _df_list_of_software_version() $software_version = array(); $query = db_select('dwsim_software_version'); $query->fields('dwsim_software_version'); - $query->orderBy('dwsim_version', 'ASC'); + $query->orderBy('id', 'ASC'); $software_version_list = $query->execute(); while ($software_version_list_data = $software_version_list->fetchObject()) { @@ -838,7 +824,7 @@ function _df_dir_name($project, $proposar_name) $project_title = ucname($project); $proposar_name = ucname($proposar_name); $dir_name = $project_title . ' By ' . $proposar_name; - $directory_name = str_replace("__", "_", str_replace(" ", "_", str_replace("/","_", trim($dir_name)))); + $directory_name = str_replace("__", "_", str_replace(" ", "_", $dir_name)); return $directory_name; } function dwsim_flowsheet_document_path() @@ -901,7 +887,7 @@ function CreateReadmeFileDWSIMFlowsheetingProject($proposal_id) $root_path = dwsim_flowsheet_path(); $readme_file = fopen($root_path . $proposal_data->directory_name . "/README.txt", "w") or die("Unable to open file!"); $txt = ""; - $txt .= "About the lab"; + $txt .= "About the flowsheet"; $txt .= "\n" . "\n"; $txt .= "Title Of The Flowsheet Project: " . $proposal_data->project_title . "\n"; $txt .= "Proposar Name: " . $proposal_data->name_title . " " . $proposal_data->contributor_name . "\n"; @@ -1005,4 +991,4 @@ function _dwsim_flowsheet_list_of_user_defined_compound($proposal_id) $data .= "Not entered"; } return $data; -}
\ No newline at end of file +} diff --git a/flowsheet_details.inc b/flowsheet_details.inc index 802afb5..909886d 100755 --- a/flowsheet_details.inc +++ b/flowsheet_details.inc @@ -32,7 +32,7 @@ function dwsim_flowsheet_completed_proposals_all() $preference_header = array( 'No', 'Flowsheet Project', - 'Institute', + 'Institution', 'Year' ); $output .= theme('table', array( diff --git a/manage_proposal.inc b/manage_proposal.inc index 903221c..ad13081 100755 --- a/manage_proposal.inc +++ b/manage_proposal.inc @@ -38,7 +38,47 @@ function dwsim_flowsheet_proposal_pending() )); return $output; } - +function dwsim_flowsheet_proposal_pending_solution() +{ + /* get pending proposals to be approved */ + $pending_rows = array(); + //$pending_q = db_query("SELECT * FROM {dwsim_flowsheet_proposal} WHERE approval_status = 1 ORDER BY id DESC"); + $query = db_select('dwsim_flowsheet_proposal'); + $query->fields('dwsim_flowsheet_proposal'); + $query->condition('approval_status', 1); + $query->orderBy('id', 'DESC'); + $pending_q = $query->execute(); + while ($pending_data = $pending_q->fetchObject()) + { + $pending_rows[$pending_data->id] = array( + date('d-m-Y', $pending_data->creation_date), + date('d-m-Y', $pending_data->approval_date), + l($pending_data->name, 'user/' . $pending_data->uid), + $pending_data->project_title, + $pending_data->department, + l('Status', 'flowsheeting-project/manage-proposal/status/' . $pending_data->id) + ); + } //$pending_data = $pending_q->fetchObject() + /* check if there are any pending proposals */ + if (!$pending_rows) + { + drupal_set_message(t('There are no proposals pending for solutions.'), 'status'); + return ''; + } //!$pending_rows + $pending_header = array( + 'Date of Submission', + 'Date of Approval', + 'Student name', + 'Title of the Flowsheet Project', + 'Department', + 'Action' + ); + $output = theme('table', array( + 'header' => $pending_header, + 'rows' => $pending_rows + )); + return $output; +} function dwsim_flowsheet_proposal_all() { /* get pending proposals to be approved */ @@ -95,7 +135,7 @@ function dwsim_flowsheet_proposal_all() $proposal_header = array( 'Date of Submission', 'Student Name', - 'Title of the flowsheeting project', + 'Title of the Lab', 'Date of Completion', 'Status', 'Action' @@ -523,15 +563,6 @@ function dwsim_flowsheet_proposal_status_form($form, &$form_state) '#markup' => $proposal_data->project_title, '#title' => t('Title of the Flowsheet Project') ); - /************************** reference link filter *******************/ - $url = '~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i'; - $reference = preg_replace($url, '<a href="$0" target="_blank" title="$0">$0</a>', $proposal_data->reference); - /******************************/ - $form['reference'] = array( - '#type' => 'item', - '#markup' => $reference, - '#title' => t('References') - ); $form['process_development_compound_name'] = array( '#type' => 'item', '#title' => t('Name of compound for which process development is carried out'), @@ -760,6 +791,13 @@ function dwsim_flowsheet_proposal_edit_form($form, &$form_state) '#required' => TRUE, '#default_value' => $proposal_data->contributor_name ); + $form['version'] = array( + '#type' => 'select', + '#title' => t('Version'), + '#required' => TRUE, + '#default_value' => $proposal_data->version, + '#options' => _df_list_of_software_version() + ); $form['student_email_id'] = array( '#type' => 'item', '#title' => t('Email'), @@ -782,8 +820,8 @@ function dwsim_flowsheet_proposal_edit_form($form, &$form_state) $form['university'] = array( '#type' => 'textfield', '#title' => t('University/Institute'), - '#size' => 200, - '#maxlength' => 200, + '#size' => 30, + '#maxlength' => 50, '#required' => TRUE, '#default_value' => $proposal_data->university ); @@ -892,16 +930,6 @@ function dwsim_flowsheet_proposal_edit_form($form, &$form_state) '#required' => TRUE, '#default_value' => $proposal_data->project_title ); - $form['reference'] = array( - '#type' => 'textarea', - '#title' => t('Reference'), - '#required' => TRUE, - '#size' => 10000, - '#attributes' => array( - 'placeholder' => 'Links of must be provided....' - ), - '#default_value' => $proposal_data->reference - ); $form['delete_proposal'] = array( '#type' => 'checkbox', '#title' => t('Delete Proposal') @@ -1026,23 +1054,23 @@ function dwsim_flowsheet_proposal_edit_form_submit($form, &$form_state) $query = "UPDATE dwsim_flowsheet_proposal SET name_title=:name_title, contributor_name=:contributor_name, + version = :version, university=:university, city=:city, pincode=:pincode, state=:state, project_title=:project_title, - reference=:reference, directory_name=:directory_name WHERE id=:proposal_id"; $args = array( ':name_title' => $v['name_title'], ':contributor_name' => $v['contributor_name'], + ':version' => $v['version'], ':university' => $v['university'], ':city' => $v['city'], ':pincode' => $v['pincode'], ':state' => $v['all_state'], ':project_title' => $project_title, - ':reference' => $v['reference'], ':directory_name' => $directory_name, ':proposal_id' => $proposal_id ); diff --git a/proposal.inc b/proposal.inc index c7ee4f1..846238e 100755 --- a/proposal.inc +++ b/proposal.inc @@ -103,9 +103,9 @@ function dwsim_flowsheet_proposal_form($form, &$form_state, $no_js_use = FALSE) '#default_value' => '', '#date_format' => 'M-Y', '#date_increment' => 0, - '#date_year_range' => '1960:2100', + '#date_year_range' => '1960:+0', '#datepicker_options' => array( - 'maxDate' => 3000 + 'maxDate' => 0 ), '#required' => TRUE ); @@ -133,7 +133,7 @@ function dwsim_flowsheet_proposal_form($form, &$form_state, $no_js_use = FALSE) $form['university'] = array( '#type' => 'textfield', '#title' => t('University/ Institute'), - '#size' => 200, + '#size' => 80, '#maxlength' => 200, '#required' => TRUE, '#attributes' => array( @@ -168,7 +168,7 @@ function dwsim_flowsheet_proposal_form($form, &$form_state, $no_js_use = FALSE) ); $form['other_state'] = array( '#type' => 'textfield', - '#title' => t('State other than India '. '<span class="form-required">*</span>'), + '#title' => t('State other than India'), '#size' => 100, '#attributes' => array( 'placeholder' => t('Enter your state/region name') @@ -183,7 +183,7 @@ function dwsim_flowsheet_proposal_form($form, &$form_state, $no_js_use = FALSE) ); $form['other_city'] = array( '#type' => 'textfield', - '#title' => t('City other than India '. '<span class="form-required">*</span>'), + '#title' => t('City other than India'), '#size' => 100, '#attributes' => array( 'placeholder' => t('Enter your city name') @@ -198,7 +198,7 @@ function dwsim_flowsheet_proposal_form($form, &$form_state, $no_js_use = FALSE) ); $form['all_state'] = array( '#type' => 'select', - '#title' => t('State '. '<span class="form-required">*</span>'), + '#title' => t('State'), '#options' => _df_list_of_states(), '#validated' => TRUE, '#states' => array( @@ -211,7 +211,7 @@ function dwsim_flowsheet_proposal_form($form, &$form_state, $no_js_use = FALSE) ); $form['city'] = array( '#type' => 'select', - '#title' => t('City '.'<span class="form-required">*</span>'), + '#title' => t('City'), '#options' => _df_list_of_cities(), '#states' => array( 'visible' => array( @@ -244,15 +244,6 @@ function dwsim_flowsheet_proposal_form($form, &$form_state, $no_js_use = FALSE) '#description' => t('Maximum character limit is 250'), '#required' => TRUE ); - $form['reference'] = array( - '#type' => 'textarea', - '#title' => t('Reference'), - '#required' => TRUE, - '#size' => 10000, - '#attributes' => array( - 'placeholder' => 'Links of must be provided....' - ) - ); $form['version'] = array( '#type' => 'select', '#title' => t('Version'), @@ -647,8 +638,7 @@ function dwsim_flowsheet_proposal_form_submit($form, &$form_state) creation_date, approval_date, directory_name, - user_defined_compound_filepath, - reference + user_defined_compound_filepath ) VALUES ( :uid, @@ -676,8 +666,7 @@ function dwsim_flowsheet_proposal_form_submit($form, &$form_state) :creation_date, :approval_date, :directory_name, - :user_defined_compound_filepath, - :reference + :user_defined_compound_filepath )"; $args = array( ":uid" => $user->uid, @@ -705,8 +694,7 @@ function dwsim_flowsheet_proposal_form_submit($form, &$form_state) ":creation_date" => time(), ":approval_date" => 0, ":directory_name" => $directory_name, - ":user_defined_compound_filepath" => "NULL", - ":reference" => $v['reference'] + ":user_defined_compound_filepath" => "NULL" ); //var_dump($args);die; $proposal_id = db_query($result, $args, array( @@ -137,13 +137,7 @@ function _flowsheet_details($flowsheet_default_value) { $flowsheet_details = _flowsheet_information($flowsheet_default_value); if ($flowsheet_default_value != 0) { - if($flowsheet_details->reference != NULL){ - $url = '~(?:(https?)://([^\s<]+)|(www\.[^\s<]+?\.[^\s<]+))(?<![\.,:])~i'; - $reference = preg_replace($url, '<a href="$0" target="_blank" title="$0">$0</a>', $flowsheet_details->reference); - }else{ - $reference = 'Not provided'; - } - $form['flowsheet_details']['#markup'] = '<span style="color: rgb(128, 0, 0);"><strong>About the Flowsheet</strong></span></td><td style="width: 35%;"><br />' . '<ul>' . '<li><strong>Proposer Name:</strong> ' . $flowsheet_details->name_title . ' ' . $flowsheet_details->contributor_name . '</li>' . '<li><strong>Title of the Flowhseet:</strong> ' . l($flowsheet_details->project_title,'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.'))) . '</li>' . '<li><strong>University:</strong> ' . $flowsheet_details->university . '</li>' . '<li>'.'<strong>Reference:</strong> ' . $reference .'</li>'.'</ul>'; + $form['flowsheet_details']['#markup'] = '<span style="color: rgb(128, 0, 0);"><strong>About the Flowsheet</strong></span></td><td style="width: 35%;"><br />' . '<ul>' . '<li><strong>Proposer Name:</strong> ' . $flowsheet_details->name_title . ' ' . $flowsheet_details->contributor_name . '</li>' . '<li><strong>Title of the Flowhseet:</strong> ' . l($flowsheet_details->project_title,'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.'))) . '</li>' . '<li><strong>Institution:</strong> ' . $flowsheet_details->university . '</li>' . '<li><strong>Version:</strong> ' . $flowsheet_details->version . '</li>' . '</ul>'; $details = $form['flowsheet_details']['#markup']; return $details; } //$flowsheet_default_value != 0 |