Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GT-124 Make references to operational tools configurable #412

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
8 changes: 8 additions & 0 deletions config/local_info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
<email_from>no-reply@localhost</email_from>
<email_to>gocdb-admins@localhost</email_to>

<!-- Operational tool references to be configured depending on the instance. -->
<helpdesk>
<link></link>
<support_unit></support_unit>
</helpdesk>
<request_tracker></request_tracker>
<community_docs></community_docs>

<!-- Specify the URL and description of the Acceptable Use Policy -->
<aup>AUP location</aup>
<aup_title>AUP title</aup_title>
Expand Down
2 changes: 1 addition & 1 deletion config/web_portal/menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<HelpAndContact>
<show_on_instance>all</show_on_instance>
<name>Doc, Help &amp; Support</name>
<link>index.php?Page_Type=Static_HTML&amp;Page=Help_And_Contact</link>
<link>index.php?Page_Type=Static_PHP&amp;Page=Help_And_Contact</link>
</HelpAndContact>

<spacer>
Expand Down
4 changes: 2 additions & 2 deletions htdocs/web_portal/controllers/service_group/search_ses.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ function search_ses() {

} catch(Exception $ex){
show_view( 'error.php', $ex->getMessage() . "<br /><br />Please contact the "
. "<a href=\"index.php?Page_Type=Static_HTML&Page=Help_And_Contact\">"
. "<a href=\"index.php?Page_Type=Static_PHP&amp;Page=Help_And_Contact\">"
. "GOCDB support team</a> if you need help with this issue.");
}
$params = array('ses' => $ses);

show_view('service_group/se_search.php', $params, null, true);
}
}
55 changes: 55 additions & 0 deletions htdocs/web_portal/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,10 @@ function Draw_Page($Page_Type) {
//rejectIfNotAuthenticated();
Draw_Static_HTML();
break;
case "Static_PHP":
//rejectIfNotAuthenticated();
Draw_Static_PHP();
break;
case "Search":
//rejectIfNotAuthenticated();
require_once __DIR__.'/controllers/search.php';
Expand Down Expand Up @@ -654,13 +658,23 @@ function Draw_Page($Page_Type) {
}
}


/* Draws a static HTML page */
function Draw_Static_HTML() {
$Page_Name = Get_Static_Page_Name();
$Page_Content = Get_Static_Page_Contents($Page_Name);
Draw_Standard_Page($Page_Content);
}


/* Draws a static PHP HTML page */
function Draw_Static_PHP() {
$PHP_Page_Name = Get_Static_PHP_Page_Name();
$PHP_Page_Content = Get_Static_PHP_Page_Contents($PHP_Page_Name);
Draw_Standard_PHP_Page($PHP_Page_Content);
}


/* Finds out if a static page has been requested. If it has, return
* the page name, otherwise return a blank string. */
function Get_Static_Page_Name() {
Expand All @@ -672,6 +686,17 @@ function Get_Static_Page_Name() {
}


/* Finds out if a static php page has been requested. If it has, return
* the page name, otherwise return a blank string. */
function Get_Static_PHP_Page_Name() {
if(!isset($_REQUEST['Page'])) {
return "";
} else {
return $_REQUEST['Page'].'.php';
}
}


/* Get the contents of the static HTML page specified in $Page_Name
* if the page name isn't specified then return a blank string */
function Get_Static_Page_Contents($Page_Name) {
Expand All @@ -686,6 +711,24 @@ function Get_Static_Page_Contents($Page_Name) {
}


/* Get the executed contents of the static PHP page specified in $PHP_Page_Name
* if the page name isn't specified then return a blank string */
function Get_Static_PHP_Page_Contents($PHP_Page_Name) {
require_once __DIR__.'/components/Draw_Components/draw_page_components.php';
$phpDir = __DIR__."/static_php";
$Available_Static_Pages = Get_Directory_Contents($phpDir);
if(!isset($Available_Static_Pages[$PHP_Page_Name])) {
return "";
}
// below returns the executed php file, not just the contents of the file
ob_start();
include $phpDir."/".$PHP_Page_Name;
$PHP = ob_get_contents();
ob_end_clean();
return $PHP;
}


/* Returns the contents of a specified directory name */
function Get_Directory_Contents($Directory_Name) {
if ($File_Handle = opendir($Directory_Name))
Expand All @@ -711,6 +754,18 @@ function Draw_Standard_Page($Page_Content, $title=null) {
}


/* Draws a standard GOCDB layout with the string $PHP_Page_Content in the
* right frame */
function Draw_Standard_PHP_Page($PHP_Page_Content, $title=null) {
require_once __DIR__.'/components/Draw_Components/draw_page_components.php';
$PHP = "";
$PHP .= Get_Standard_Top_Section_HTML($title);
$PHP .= $PHP_Page_Content;
$PHP .= Get_Standard_Bottom_Section_HTML();
echo $PHP;
}



/* Given the name of a file in the view directory, include it
* as the body of a standard GOCDB page */
Expand Down
57 changes: 0 additions & 57 deletions htdocs/web_portal/static_html/Help_And_Contact.html

This file was deleted.

70 changes: 70 additions & 0 deletions htdocs/web_portal/static_php/Help_And_Contact.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<html>
<?php
include __DIR__.'/operationalLinks.php';
?>
<div class="rightPageContainer">
<h1>Documentation, Help and Support</h1>
<br />
<div class="Help_And_Documentation">

<h2>GOCDB</h2>
<p><a href="index.php">What is GOCDB?</a></p>
<p>
See <a href="https://github.com/GOCDB/gocdb/releases">Release notes</a>
<br/>
<a href="https://github.com/GOCDB/gocdb/blob/dev/INSTALL.md">Download, Install</a>
</p>

<h2>Need information?</h2>
<p>
Please browse your
<a href="<?php echo $communityDocs ?>">
community documentation</a>.
<br/><br/>
</p>

<h2>Found a bug?</h2>
<p>
First, check our
<a href="https://github.com/GOCDB/gocdb/issues?q=is%3Aissue+is%3Aopen+label%3Abug" target="_blank">
known bugs</a> to see if this has not already been reported.<br/>
If not, please open a request in your
<a href="<?php echo $helpdeskLink ?>">
community support desk</a>
or our
<a href="https://github.com/GOCDB/gocdb/issues" target="_blank">
GitHub issues</a>
page, if the former is not appropriate.
<br/><br/>
</p>

<h2>Want to suggest something?</h2>
<p>
Before you make any request, check this is not already integrated to our development plans, see
<a href="https://github.com/GOCDB/gocdb/milestones" target="_blank">GOCDB Development Plans.</a><br/>
Any suggestion, new feature or improvement request should
be submitted to your
<a href="<?php echo $requestTracker ?>">
community request tracker</a>
or our
<a href="https://github.com/GOCDB/gocdb/issues" target="_blank">
GitHub issues</a>
page, if the former is not appropriate.<br/>
Suggestions will be discussed by the GOCDB developers and
any relevant project body before inclusion into development plans.
These bodies reserve the right to decline unsuitable requests.
<br/><br/>
</p>

<h2>Need some support?</h2>

<p>
For all other enquiries including general questions, temporary
problem reports or support requests please open a
request in your
<a href="<?php echo $helpdeskLink ?>">
community support desk</a>.
</p>
</div>
</div>
</html>
13 changes: 13 additions & 0 deletions htdocs/web_portal/static_php/operationalLinks.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

/*
* Declares varibales to be used in Help_And_Contact.php
*/

require_once __DIR__.'/../../../lib/Gocdb_Services/Factory.php';

$configService = \Factory::getConfigService();

$communityDocs = $configService->getCommunityDocs();
$helpdeskLink = $configService->getHelpdeskLink();
$requestTracker = $configService->getRequestTracker();
28 changes: 28 additions & 0 deletions lib/Gocdb_Services/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -556,4 +556,32 @@ public function getEmailTo()

return $emailTo;
}

public function getHelpdeskLink()
{
$link = $this->GetLocalInfoXML()->helpdesk->link;

return $link;
}

public function getHelpdeskSupportUnit()
{
$supportUnit = $this->GetLocalInfoXML()->helpdesk->support_unit;

return $supportUnit;
}

public function getRequestTracker()
{
$requestTracker = $this->GetLocalInfoXML()->request_tracker;

return $requestTracker;
}

public function getCommunityDocs()
{
$communityDocs = $this->GetLocalInfoXML()->community_docs;

return $communityDocs;
}
}