From e048829e19b5a2886a17657f88d8b3edf3b4ec1f Mon Sep 17 00:00:00 2001 From: Mehmood Asghar Date: Mon, 3 Jun 2019 14:19:50 -0400 Subject: [PATCH 1/8] Fix citations tab display --- application/views/catalog_search/study_collection_tabs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/views/catalog_search/study_collection_tabs.php b/application/views/catalog_search/study_collection_tabs.php index 72a428b49..e30d05a91 100644 --- a/application/views/catalog_search/study_collection_tabs.php +++ b/application/views/catalog_search/study_collection_tabs.php @@ -68,7 +68,7 @@ -
+
From 66316e8333adb967552a2b883e50ed36ebec03e7 Mon Sep 17 00:00:00 2001 From: Mehmood Asghar Date: Wed, 17 Jul 2019 10:20:43 -0400 Subject: [PATCH 2/8] Serve pages under SSL if SSL is enabled --- application/config/hooks.php | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/application/config/hooks.php b/application/config/hooks.php index 92991e4a8..094becbac 100644 --- a/application/config/hooks.php +++ b/application/config/hooks.php @@ -86,15 +86,6 @@ function pre_system_url_check() $proxy_ssl_header=$config["proxy_ssl_header"]; $proxy_ssl_header_value=$config["proxy_ssl_header_value"]; - /* - $test_port='80, 80'; - if($_SERVER['HTTPS']=="on") - { - $test_port=$proxy_ssl_header_value; - } - $_SERVER[$proxy_ssl_header]=$test_port;//$proxy_ssl_header_value; - */ - if (!$enable_ssl && !$proxy_ssl) { return FALSE; @@ -152,30 +143,10 @@ function pre_system_url_check() if($is_https===FALSE) { //if url first segment has AUTH redirect to HTTPS - if (current($segments)=='auth') - { + //if (current($segments)=='auth'){ //redirect to SSL page header("Location:$redirect"); - } - } - //if non-ssl pages are viewed using HTTPS, force them to use http instead - else if($is_https===TRUE) - { - if (current($segments)!='auth') - { - if ($http_port!=80) - { - $http_port=':'.$http_port; - } - else if($http_port==80) - { - $http_port=''; - } - - //redirect to NON-SSL page - $redirect= "http://".$_SERVER['HTTP_HOST'].$http_port._request_uri(); - header("Location:$redirect"); - } + //} } } From 39339a46c2b992b91423619bcf1b1f146eb5d458 Mon Sep 17 00:00:00 2001 From: Mehmood Asghar Date: Wed, 17 Jul 2019 11:59:08 -0400 Subject: [PATCH 3/8] Fix for replace ddi on catalog edit page --- application/controllers/admin/Catalog.php | 31 ++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/application/controllers/admin/Catalog.php b/application/controllers/admin/Catalog.php index 068c483f9..13064c25c 100644 --- a/application/controllers/admin/Catalog.php +++ b/application/controllers/admin/Catalog.php @@ -1140,7 +1140,7 @@ function replace_ddi($sid=NULL) try { //upload the ddi - $upload_result=$this->__upload_file($key='userfile',$destination=$tmp_path); + $upload_result=$this->upload_ddi_file($key='userfile',$destination=$tmp_path); if(!$upload_result){ $error = $this->upload->display_errors(); @@ -1967,6 +1967,35 @@ function attach_data_file_resources_post($sid,$file_id) } + /** + * + * Upload ddi file for ddi replace + * + * @return array + */ + private function upload_ddi_file($key,$destination) + { + if ($_FILES[$key]['size']==0) + { + return false; + } + $config['encrypt_name'] = TRUE; + $config['upload_path'] = $destination; + $config['allowed_types'] = 'xml'; + $config['overwrite'] = true; + $this->load->library('upload', $config); + if ( ! $this->upload->do_upload($key)) + { + throw new Exception( $this->upload->display_errors() ); + } + else + { + $data = $this->upload->data(); + return $data; + } + } + + } /* End of file catalog.php */ /* Location: ./controllers/admin/catalog.php */ From 6d248496ccf7d3fb217f8633881ff57a2dcedf84 Mon Sep 17 00:00:00 2001 From: Mehmood Asghar Date: Fri, 19 Jul 2019 22:20:36 -0400 Subject: [PATCH 4/8] Update reload_ddi endpoint to keep study date created, changed and repo info intact --- application/controllers/api/Datasets.php | 33 +++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/application/controllers/api/Datasets.php b/application/controllers/api/Datasets.php index fb10019ce..4d0ca49e0 100644 --- a/application/controllers/api/Datasets.php +++ b/application/controllers/api/Datasets.php @@ -1136,10 +1136,37 @@ function reload_ddi_put($id=NULL,$partial=false) throw new Exception("ID_MISSING"); } + $this->load->model("Data_file_model"); + $this->load->library('DDI2_import'); - $this->load->library('DDI_Utils'); - $user_id=$this->get_api_user_id(); - $result=$this->ddi_utils->reload_ddi($id, $user_id, $partial); + //get survey ddi file path by id + $ddi_file=$this->Catalog_model->get_survey_ddi_path($id); + + if ($ddi_file===FALSE){ + throw new Exception("DDI_FILE_NOT_FOUND"); + } + + $dataset=$this->dataset_manager->get_row($id); + + $params=array( + 'file_type'=>'survey', + 'file_path'=>$ddi_file, + 'user_id'=>$this->get_api_user_id(), + 'repositoryid'=>$dataset['repositoryid'], + 'overwrite'=>'yes', + 'partial'=>$partial + ); + + $result=$this->ddi2_import->import($params,$id); + + //reset changed and created dates + $update_options=array( + 'changed'=>$dataset['changed'], + 'created'=>$dataset['created'], + 'repositoryid'=>$dataset['repositoryid'] + ); + + $this->dataset_manager->update_options($id,$update_options); $output=array( 'status'=>'success', From f18e8a0bc8b7bad7f69223004af154f3fba2bcb7 Mon Sep 17 00:00:00 2001 From: Mehmood Asghar Date: Mon, 22 Jul 2019 11:27:21 -0400 Subject: [PATCH 5/8] Update formatting for vocabularies page --- application/views/vocabularies/edit.php | 2 +- application/views/vocabularies/index.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/views/vocabularies/edit.php b/application/views/vocabularies/edit.php index 2cc4472d4..ef7049fc9 100644 --- a/application/views/vocabularies/edit.php +++ b/application/views/vocabularies/edit.php @@ -3,7 +3,7 @@ width:500px; } -
+
diff --git a/application/views/vocabularies/index.php b/application/views/vocabularies/index.php index 1c329b63f..befb1ec4b 100644 --- a/application/views/vocabularies/index.php +++ b/application/views/vocabularies/index.php @@ -1,4 +1,4 @@ -
+