Skip to content

Commit

Permalink
Issue 365: Opening modules in the same or a new window is configurable.
Browse files Browse the repository at this point in the history
In common/configuration.ini:

[settings]
open_new_windows = Y/N

By default, the links are opened in a new window/tab.
  • Loading branch information
veggiematts committed Jan 15, 2020
1 parent 6de85e2 commit 13f957d
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 27 deletions.
4 changes: 4 additions & 0 deletions common/common_directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,11 @@ function create_date_from_js_format($input) {
$datepicker_format = return_datepicker_date_format();
$php_format = create_php_date_format_from_js_format($datepicker_format);
return date_create_from_format($php_format, $input);
}

function getTarget() {
$config = new Configuration();
return ($config->settings->open_new_windows == "N") ? "" : "target='_blank'";
}

function debug($value) {
Expand Down
1 change: 1 addition & 0 deletions common/configuration_sample.ini
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,4 @@ date_format = "%m/%d/%Y"
datepicker_date_format = "mm/dd/yyyy";
#number_locale = "en_US"
#number_decimals = 2
#open_new_windows = Y
12 changes: 7 additions & 5 deletions licensing/templates/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
//get CORAL URL for 'Change Module' and logout link
$coralURL = $util->getCORALURL();

$target = getTarget();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Expand Down Expand Up @@ -348,27 +350,27 @@
--> <li id="change-mod-menu"><span><?php echo _("Change Module");?></span><i class="fa fa-chevron-down"></i>
<ul class="coraldropdown">
<?php if (file_exists($util->getCORALPath() . "index.php")) {?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>" target='_blank'><img src='images/change/icon-mod-main.png'><span><?php echo _("Main Menu");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . '"' . $target; ?> title="<?php echo _("Main Menu"); ?>"><img src='images/change/icon-mod-main.png'><span><?php echo _("Main Menu");?></span></a></li>
<?php
}
if ($config->settings->resourcesModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>resources/" target='_blank'><img src='images/change/icon-mod-resources.png'><span><?php echo _("Resources");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'resources/"' . $target; ?> title="<?php echo _("Resources module"); ?>"><img src='images/change/icon-mod-resources.png'><span><?php echo _("Resources"); ?></span></a></li>
<?php
}
if ($config->settings->organizationsModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>organizations/" target='_blank'><img src='images/change/icon-mod-organizations.png'><span><?php echo _("Organizations");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'organizations/"' . $target; ?> title="<?php echo _("Organizations module"); ?>"><img src='images/change/icon-mod-organizations.png'><span><?php echo _("Organizations");?></span></a></li>
<?php
}
if ($config->settings->usageModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>usage/" target='_blank'><img src='images/change/icon-mod-usage.png'><span><?php echo _("Usage Statistics");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'usage/"' . $target; ?> title="<?php echo _("Usage Statistics module"); ?>"><img src='images/change/icon-mod-usage.png'><span><?php echo _("Usage Statistics");?></span></a></li>
<?php
}
if ($config->settings->managementModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>management/" target='_blank'><img src='images/change/icon-mod-management.png'><span><?php echo _("Management");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'management/"' . $target; ?> title="<?php echo _("Management module"); ?>"><img src='images/change/icon-mod-management.png'><span><?php echo _("Management");?></span></a></li>
<?php } ?>
</ul>
</li>
Expand Down
12 changes: 7 additions & 5 deletions management/templates/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
//get CORAL URL for 'Change Module' and logout link
$coralURL = $util->getCORALURL();

$target = getTarget();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Expand Down Expand Up @@ -280,27 +282,27 @@
<li id="change-mod-menu"><span><?php echo _("Change Module");?></span><i class="fa fa-chevron-down"></i>
<ul class="coraldropdown">
<?php if (file_exists($util->getCORALPath() . "index.php")) {?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>" target='_blank'><img src='images/change/icon-mod-main.png'><span><?php echo _("Main Menu");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . '"' . $target; ?> title="<?php echo _("Main Menu"); ?>"><img src='images/change/icon-mod-main.png'><span><?php echo _("Main Menu");?></span></a></li>
<?php
}
if ($config->settings->resourcesModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>resources/" target='_blank'><img src='images/change/icon-mod-resources.png'><span><?php echo _("Resources");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'resources/"' . $target; ?> title="<?php echo _("Resources module"); ?>"><img src='images/change/icon-mod-resources.png'><span><?php echo _("Resources"); ?></span></a></li>
<?php
}
if ($config->settings->organizationsModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>organizations/" target='_blank'><img src='images/change/icon-mod-organizations.png'><span><?php echo _("Organizations");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'organizations/"' . $target; ?> title="<?php echo _("Organizations module"); ?>"><img src='images/change/icon-mod-organizations.png'><span><?php echo _("Organizations");?></span></a></li>
<?php
}
if ($config->settings->licensingModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>licensing/" target='_blank'><img src='images/change/icon-mod-licensing.png'><span><?php echo _("Licensing");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'licensing/"' . $target; ?> title="<?php echo _("Licensing module"); ?>"><img src='images/change/icon-mod-licensing.png'><span><?php echo _("Licensing");?></span></a></li>
<?php
}
if ($config->settings->usageModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>usage/" target='_blank'><img src='images/change/icon-mod-usage.png'><span><?php echo _("Usage Statistics");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'usage/"' . $target; ?> title="<?php echo _("Usage Statistics module"); ?>"><img src='images/change/icon-mod-usage.png'><span><?php echo _("Usage Statistics");?></span></a></li>
<?php } ?>
</ul>
</li>
Expand Down
13 changes: 7 additions & 6 deletions organizations/templates/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
//get CORAL URL for 'Change Module' and logout link
$coralURL = $util->getCORALURL();

$target = getTarget();
?>


Expand Down Expand Up @@ -249,32 +250,32 @@
<li id="change-mod-menu"><span><?php echo _("Change Module"); ?></span><i class="fa fa-chevron-down"></i>
<ul class="coraldropdown">
<?php if (file_exists($util->getCORALPath() . "index.php")) {?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>" target='_blank'><img src='images/change/icon-mod-main.png'><span><?php echo _("Main Menu"); ?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . '"' . $target; ?>><img src='images/change/icon-mod-main.png'><span><?php echo _("Main Menu"); ?></span></a></li>
<?php
}
if ($config->settings->licensingModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>licensing/" target='_blank'><img src='images/change/icon-mod-licensing.png'><span><?php echo _("Licensing"); ?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'licensing/"' . $target; ?>><img src='images/change/icon-mod-licensing.png'><span><?php echo _("Licensing"); ?></span></a></li>
<?php
}
if ($config->settings->resourcesModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>resources/" target='_blank'><img src='images/change/icon-mod-resources.png'><span><?php echo _("Resources"); ?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'resources/"' . $target; ?>><img src='images/change/icon-mod-resources.png'><span><?php echo _("Resources"); ?></span></a></li>
<?php
}
if ($config->settings->cancellationModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>cancellation/" target='_blank'><img src='images/change/icon-mod-cancellation.png'></a><span><?php echo _("Cancel"); ?></span></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'cancellation/"' . $target; ?>><img src='images/change/icon-mod-cancellation.png'></a><span><?php echo _("Cancel"); ?></span></li>
<?php
}
if ($config->settings->usageModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>usage/" target='_blank'><img src='images/change/icon-mod-usage.png'><span><?php echo _("Usage Statistics"); ?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'usage/"' . $target; ?>><img src='images/change/icon-mod-usage.png'><span><?php echo _("Usage Statistics"); ?></span></a></li>
<?php
}
if ($config->settings->managementModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>management/" target='_blank'><img src='images/change/icon-mod-management.png'><span><?php echo _("Management"); ?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'management/"' . $target; ?>><img src='images/change/icon-mod-management.png'><span><?php echo _("Management"); ?></span></a></li>
<?php } ?>
</ul>
</li>
Expand Down
14 changes: 8 additions & 6 deletions resources/templates/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

//get CORAL URL for 'Change Module' and logout link.
$coralURL = $util->getCORALURL();

$target = getTarget();
?>


Expand Down Expand Up @@ -123,7 +125,7 @@
?>
</span><br />

<?php if($config->settings->authModule == 'Y'){ echo "<a href='" . $coralURL . "auth/?logout' id='logout' title='" . _("logout") . "'>" . _("logout") . "</a><span id='divider'> | </span><a href='http://docs.coral-erm.org/' id='help' target='_blank'>" . _("Help") . "</a><span id='divider'> | </span>"; } ?>
<?php if($config->settings->authModule == 'Y'){ echo "<a href='" . $coralURL . "auth/?logout' id='logout' title='" . _("logout") . "'>" . _("logout") . "</a><span id='divider'> | </span><a href='http://docs.coral-erm.org/' id='help' $target>" . _("Help") . "</a><span id='divider'> | </span>"; } ?>

<span id="setLanguage">
<select name="lang" id="lang" class="dropDownLang">
Expand Down Expand Up @@ -248,27 +250,27 @@
<li id="change-mod-menu"><span><?php echo _("Change Module");?></span><i class="fa fa-chevron-down"></i>
<ul class="coraldropdown">
<?php if (file_exists($util->getCORALPath() . "index.php")) {?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>" target='_blank' title="<?php echo _("Main Menu"); ?>"><img src='images/change/icon-mod-main.png'><span><?php echo _("Main Menu");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . '"' . $target; ?> title="<?php echo _("Main Menu"); ?>"><img src='images/change/icon-mod-main.png'><span><?php echo _("Main Menu");?></span></a></li>
<?php
}
if ($config->settings->organizationsModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>organizations/" target='_blank' title="<?php echo _("Organizations module"); ?>"><img src='images/change/icon-mod-organizations.png'><span><?php echo _("Organizations");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'organizations/"' . $target; ?> title="<?php echo _("Organizations module"); ?>"><img src='images/change/icon-mod-organizations.png'><span><?php echo _("Organizations");?></span></a></li>
<?php
}
if ($config->settings->licensingModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>licensing/" target='_blank' title="<?php echo _("Licensing module"); ?>"><img src='images/change/icon-mod-licensing.png'><span><?php echo _("Licensing");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'licensing/"' . $target; ?> title="<?php echo _("Licensing module"); ?>"><img src='images/change/icon-mod-licensing.png'><span><?php echo _("Licensing");?></span></a></li>
<?php
}
if ($config->settings->usageModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>usage/" target='_blank' title="<?php echo _("Usage Statistics module"); ?>"><img src='images/change/icon-mod-usage.png'><span><?php echo _("Usage Statistics");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'usage/"' . $target; ?> title="<?php echo _("Usage Statistics module"); ?>"><img src='images/change/icon-mod-usage.png'><span><?php echo _("Usage Statistics");?></span></a></li>
<?php
}
if ($config->settings->managementModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>management/" target='_blank' title="<?php echo _("Management module"); ?>"><img src='images/change/icon-mod-management.png'><span><?php echo _("Management");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'management/"' . $target; ?> title="<?php echo _("Management module"); ?>"><img src='images/change/icon-mod-management.png'><span><?php echo _("Management");?></span></a></li>
<?php } ?>
</ul>
</li>
Expand Down
12 changes: 7 additions & 5 deletions usage/templates/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
//get CORAL URL for 'Change Module' and logout link
$coralURL = $util->getCORALURL();

$target = getTarget();

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Expand Down Expand Up @@ -267,27 +269,27 @@
<li id="change-mod-menu"><span><?php echo _("Change Module");?></span><i class="fa fa-chevron-down"></i>
<ul class="coraldropdown">
<?php if (file_exists($util->getCORALPath() . "index.php")) {?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>" target='_blank'><img src='images/change/icon-mod-main.png'><span><?php echo _("Main Menu");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . '"' . $target; ?> title="<?php echo _("Main Menu"); ?>"><img src='images/change/icon-mod-main.png'><span><?php echo _("Main Menu");?></span></a></li>
<?php
}
if ($config->settings->resourcesModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>resources/" target='_blank'><img src='images/change/icon-mod-resources.png'><span><?php echo _("Resources");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'resources/"' . $target; ?> title="<?php echo _("Resources module"); ?>"><img src='images/change/icon-mod-resources.png'><span><?php echo _("Resources"); ?></span></a></li>
<?php
}
if ($config->settings->organizationsModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>organizations/" target='_blank'><img src='images/change/icon-mod-organizations.png'><span><?php echo _("Organizations");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'organizations/"' . $target; ?> title="<?php echo _("Organizations module"); ?>"><img src='images/change/icon-mod-organizations.png'><span><?php echo _("Organizations");?></span></a></li>
<?php
}
if ($config->settings->licensingModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>licensing/" target='_blank'><img src='images/change/icon-mod-licensing.png'><span><?php echo _("Licensing");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'licensing/"' . $target; ?> title="<?php echo _("Licensing module"); ?>"><img src='images/change/icon-mod-licensing.png'><span><?php echo _("Licensing");?></span></a></li>
<?php
}
if ($config->settings->managementModule == 'Y') {
?>
<li class="change-mod-item"><a href="<?php echo $coralURL; ?>management/" target='_blank'><img src='images/change/icon-mod-management.png'><span><?php echo _("Management");?></span></a></li>
<li class="change-mod-item"><a href="<?php echo $coralURL . 'management/"' . $target; ?> title="<?php echo _("Management module"); ?>"><img src='images/change/icon-mod-management.png'><span><?php echo _("Management");?></span></a></li>
<?php } ?>
</ul>
</li>
Expand Down

0 comments on commit 13f957d

Please sign in to comment.