Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/nbproject/private/

/config_local.ini
.vscode/
2 changes: 1 addition & 1 deletion config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
searchflow_path = "//localhost/project-website/search-flow/"
; Full path to the headstart distribution
; in a server environment: headstart_path = "//subdomain.domain.tld/pathto/headstart/"
headstart_path = "localhost/headstart/"
headstart_path = "localhost/headstart"
; Enable or disable debug output
debug = false
; Enable/disable GET requests
Expand Down
37 changes: 34 additions & 3 deletions inc/visualization/visualization.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,45 @@
$("#visualization").css("min-height", div_height + "px")
<?php endif ?>
</script>
<script type="text/javascript" src="<?php echo $headstart_path ?>dist/headstart.js"></script>
<?php
// This script is loading the headstart.php script from the Headstart. It is
// contains imports of bundles that are necessary for the application.

// Getting parsed url with parts such as host or path that can be used later
$hs_url = parse_url($headstart_path);

// Relative path to the headstart.php
$rel_path = rtrim($hs_url['path'], '/') . '/dist/headstart.php';

// Getting absolute path to the current file
$current_path = dirname(__FILE__);

// Defining amount of levels in the headstart path
$path_parts = explode('/', trim($hs_url['path'], '/'));
$extra_levels = max(count($path_parts) - 1, 0); // <- minus one, because headstart is the root

// Defining relative root with basic level up ('/../../../') and
// defined amount of levels in the headstart path
$relative_root = $current_path . str_repeat('/..', 3 + $extra_levels);

// Defining project root
$project_root = realpath($relative_root);

// Preparing the full path to the headstart.php file
$result_path = $project_root . $rel_path;

// Check that headstart.php exists or showing understandable error in the logs
if (!file_exists($result_path)) {
error_log("ERROR: headstart.php not found at $result_path");
} else {
include $result_path;
}
?>
<script type="text/javascript">
$(document).ready(function () {
headstart.start();
})
</script>

<link rel="stylesheet" href="<?php echo $headstart_path ?>dist/headstart.css">
<script>
if("options_<?php echo $service ?>" in search_flow_config.search_options.filter_options) {
data_config.options = search_flow_config.search_options.filter_options.options_<?php echo $service ?>.dropdowns;
Expand Down