Skip to content

Commit

Permalink
Fix issues reported by Warren Welch in redcap forums
Browse files Browse the repository at this point in the history
  • Loading branch information
dconlan committed Nov 13, 2020
1 parent 1aedaff commit 0274f09
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions PedigreeEditorExternalModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,22 @@ class PedigreeEditorExternalModule extends AbstractExternalModule {

public function validateSettings($settings){
$errors='';

$systemOntologyServer = $settings['system_ontology_server'];
if ($systemOntologyServer){
$metadata = http_get($systemOntologyServer . 'metadata');
if ($metadata == false){
$errors .= "Failed to get metadata for fhir server at '" . $systemOntologyServer . "'metadata\n";
if (function_exists('curl_init')){
// if curl isn't installed the check can fail even though the url is correct.
// better to just not check.
$systemOntologyServer = $settings['system_ontology_server'];
if ($systemOntologyServer){
$metadata = http_get($systemOntologyServer . 'metadata');
if ($metadata == false){
$errors .= "Failed to get metadata for fhir server at '" . $systemOntologyServer . "'metadata\n";
}
}
}
$projectOntologyServer = $settings['project_ontology_server'];
if ($projectOntologyServer){
$metadata = http_get($projectOntologyServer . 'metadata', null, $info);
if ($metadata == false){
$errors .= "Failed to get metadata for fhir server at '" . $projectOntologyServer . "'metadata\n" . json_encode($info);
$projectOntologyServer = $settings['project_ontology_server'];
if ($projectOntologyServer){
$metadata = http_get($projectOntologyServer . 'metadata', null, $info);
if ($metadata == false){
$errors .= "Failed to get metadata for fhir server at '" . $projectOntologyServer . "'metadata\n" . json_encode($info);
}
}
}
return $errors;
Expand Down Expand Up @@ -238,9 +241,8 @@ function add_pedigree_to_form ($project_id, $instrument) {
* The relative path to the js file.
*/
protected function includeJs($path) {
// For shib installations, it is necessary to use the API endpoint for resources
global $auth_meth;
$ext_path = $auth_meth == 'shibboleth' ? $this->getUrl($path, true, true) : $this->getUrl($path);
// the API endpoint seems to break things, so we won't use it even for shib installations.
$ext_path = $this->getUrl($path);
echo '<script src="' . $ext_path . '"></script>';
}

Expand All @@ -250,10 +252,8 @@ protected function includeJs($path) {
* The relative path to the js file.
*/
protected function getLocalUrl($path) {
// For shib installations, it is necessary to use the API endpoint for resources
global $auth_meth;
return ($auth_meth == 'shibboleth') ? $this->getUrl($path, true, true) : $this->getUrl($path);

// the API endpoint seems to break things, so we won't use it even for shib installations.
return $this->getUrl($path);
}


Expand Down

0 comments on commit 0274f09

Please sign in to comment.