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-183] Apply code styles for the files #461 #483

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
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
326 changes: 159 additions & 167 deletions config/web_portal/menu.xml
Original file line number Diff line number Diff line change
@@ -1,171 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<menus>
<main_menu>
<spacer>
<show_on_instance>all</show_on_instance>
<spacer>Browse</spacer>
</spacer>

<MySites>
<show_on_instance>all</show_on_instance>
<name>My Resources</name>
<link>index.php?Page_Type=My_Sites</link>
</MySites>

<Projects>
<show_on_instance>all</show_on_instance>
<name>Projects</name>
<link>index.php?Page_Type=Projects</link>
</Projects>

<NGI> <!-- was 'roc' -->
<show_on_instance>all</show_on_instance>
<name>NGIs</name>
<link>index.php?Page_Type=NGIs</link>
</NGI>

<Sites>
<show_on_instance>all</show_on_instance>
<name>Sites</name>
<link>index.php?Page_Type=Sites</link>
</Sites>

<ServiceGroups>
<show_on_instance>all</show_on_instance>
<name>Service Groups</name>
<link>index.php?Page_Type=Service_Groups</link>
</ServiceGroups>

<Services>
<show_on_instance>all</show_on_instance>
<name>Services</name>
<link>index.php?Page_Type=Services</link>
</Services>

<ServiceTypes>
<show_on_instance>all</show_on_instance>
<name>Service Types</name>
<link>index.php?Page_Type=Service_Types</link>
</ServiceTypes>

<Scopes>
<show_on_instance>all</show_on_instance>
<name>Scopes</name>
<link>index.php?Page_Type=Scopes</link>
</Scopes>

<RoleActionMappings>
<show_on_instance>all</show_on_instance>
<name>Role Action Map</name>
<link>index.php?Page_Type=View_Role_Action_Mappings</link>
</RoleActionMappings>

<spacer>
<spacer>Add</spacer>
<show_on_instance>write_enabled</show_on_instance>
</spacer>

<AddSite>
<show_on_instance>write_enabled</show_on_instance>
<name>Add Site</name>
<link>index.php?Page_Type=Add_Site</link>
</AddSite>

<AddServiceGroup>
<show_on_instance>write_enabled</show_on_instance>
<name>Add Service Group</name>
<link>index.php?Page_Type=Add_Service_Group</link>
</AddServiceGroup>

<AddService>
<show_on_instance>write_enabled</show_on_instance>
<name>Add Service</name>
<link>index.php?Page_Type=Add_Service</link>
</AddService>

<AddDowntime>
<show_on_instance>write_enabled</show_on_instance>
<name>Add Downtime</name>
<link>index.php?Page_Type=Add_Downtime</link>
</AddDowntime>

<spacer>
<spacer>Downtimes</spacer>
<show_on_instance>all</show_on_instance>
</spacer>


<!--<current_downtimes>
<show_on_instance>all</show_on_instance>
<name>Recent &amp; Planned</name>
<link>http://operations-portal.in2p3.fr/index.php/dashboard/do</link>
</current_downtimes>-->

<CurrentDowntimes>
<show_on_instance>all</show_on_instance>
<name>Active &amp; Imminent</name>
<link>index.php?Page_Type=Downtimes_Overview</link>
</CurrentDowntimes>

<Calendar>
<show_on_instance>all</show_on_instance>
<name>Downtime Calendar</name>
<link>index.php?Page_Type=Downtimes_Calendar</link>
</Calendar>

<spacer>
<spacer>About GOCDB5</spacer>
<show_on_instance>all</show_on_instance>
</spacer>



<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>
</HelpAndContact>

<spacer>
<spacer>GOCDB Admin</spacer>
<show_on_instance>admin</show_on_instance>
</spacer>

<AddNGI>
<show_on_instance>admin</show_on_instance>
<name>Add NGI</name>
<link>index.php?Page_Type=Admin_Add_NGI</link>
</AddNGI>

<AddProject>
<show_on_instance>admin</show_on_instance>
<name>Add Project</name>
<link>index.php?Page_Type=Admin_Add_Project</link>
</AddProject>

<AddServiceTypes>
<show_on_instance>admin</show_on_instance>
<name>Add Service Type</name>
<link>index.php?Page_Type=Admin_Add_Service_Type</link>
</AddServiceTypes>

<MoveServiceEndPoint>
<show_on_instance>admin</show_on_instance>
<name>Move Service</name>
<link>index.php?Page_Type=Admin_Move_SEP</link>
</MoveServiceEndPoint>

<MoveSite>
<show_on_instance>admin</show_on_instance>
<name>Move Site</name>
<link>index.php?Page_Type=Admin_Move_Site</link>
</MoveSite>

<Users>
<show_on_instance>admin</show_on_instance>
<name>Users</name>
<link>index.php?Page_Type=Admin_Users</link>
</Users>

<main_menu>
<spacer>
<show_on_instance>all</show_on_instance>
<spacer>Browse</spacer>
</spacer>

<MySites>
<show_on_instance>all</show_on_instance>
<name>My Resources</name>
<link>index.php?Page_Type=My_Sites</link>
</MySites>

<Projects>
<show_on_instance>all</show_on_instance>
<name>Projects</name>
<link>index.php?Page_Type=Projects</link>
</Projects>

<NGI> <!-- was 'roc' -->
<show_on_instance>all</show_on_instance>
<name>NGIs</name>
<link>index.php?Page_Type=NGIs</link>
</NGI>

<Sites>
<show_on_instance>all</show_on_instance>
<name>Sites</name>
<link>index.php?Page_Type=Sites</link>
</Sites>

<ServiceGroups>
<show_on_instance>all</show_on_instance>
<name>Service Groups</name>
<link>index.php?Page_Type=Service_Groups</link>
</ServiceGroups>

<Services>
<show_on_instance>all</show_on_instance>
<name>Services</name>
<link>index.php?Page_Type=Services</link>
</Services>

<ServiceTypes>
<show_on_instance>all</show_on_instance>
<name>Service Types</name>
<link>index.php?Page_Type=Service_Types</link>
</ServiceTypes>

<Scopes>
<show_on_instance>all</show_on_instance>
<name>Scopes</name>
<link>index.php?Page_Type=Scopes</link>
</Scopes>

<RoleActionMappings>
<show_on_instance>all</show_on_instance>
<name>Role Action Map</name>
<link>index.php?Page_Type=View_Role_Action_Mappings</link>
</RoleActionMappings>

<spacer>
<spacer>Add</spacer>
<show_on_instance>write_enabled</show_on_instance>
</spacer>

<AddSite>
<show_on_instance>write_enabled</show_on_instance>
<name>Add Site</name>
<link>index.php?Page_Type=Add_Site</link>
</AddSite>

<AddServiceGroup>
<show_on_instance>write_enabled</show_on_instance>
<name>Add Service Group</name>
<link>index.php?Page_Type=Add_Service_Group</link>
</AddServiceGroup>

<AddService>
<show_on_instance>write_enabled</show_on_instance>
<name>Add Service</name>
<link>index.php?Page_Type=Add_Service</link>
</AddService>

<AddDowntime>
<show_on_instance>write_enabled</show_on_instance>
<name>Add Downtime</name>
<link>index.php?Page_Type=Add_Downtime</link>
</AddDowntime>

<spacer>
<spacer>Downtimes</spacer>
<show_on_instance>all</show_on_instance>
</spacer>

<CurrentDowntimes>
<show_on_instance>all</show_on_instance>
<name>Active &amp; Imminent</name>
<link>index.php?Page_Type=Downtimes_Overview</link>
</CurrentDowntimes>

<Calendar>
<show_on_instance>all</show_on_instance>
<name>Downtime Calendar</name>
<link>index.php?Page_Type=Downtimes_Calendar</link>
</Calendar>

<spacer>
<spacer>About GOCDB5</spacer>
<show_on_instance>all</show_on_instance>
</spacer>

<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>
</HelpAndContact>

<spacer>
<spacer>GOCDB Admin</spacer>
<show_on_instance>admin</show_on_instance>
</spacer>

<AddNGI>
<show_on_instance>admin</show_on_instance>
<name>Add NGI</name>
<link>index.php?Page_Type=Admin_Add_NGI</link>
</AddNGI>

<AddProject>
<show_on_instance>admin</show_on_instance>
<name>Add Project</name>
<link>index.php?Page_Type=Admin_Add_Project</link>
</AddProject>

<AddServiceTypes>
<show_on_instance>admin</show_on_instance>
<name>Add Service Type</name>
<link>index.php?Page_Type=Admin_Add_Service_Type</link>
</AddServiceTypes>

<MoveServiceEndPoint>
<show_on_instance>admin</show_on_instance>
<name>Move Service</name>
<link>index.php?Page_Type=Admin_Move_SEP</link>
</MoveServiceEndPoint>

<MoveSite>
<show_on_instance>admin</show_on_instance>
<name>Move Site</name>
<link>index.php?Page_Type=Admin_Move_Site</link>
</MoveSite>

<Users>
<show_on_instance>admin</show_on_instance>
<name>Users</name>
<link>index.php?Page_Type=Admin_Users</link>
</Users>
</main_menu>
</menus>
Original file line number Diff line number Diff line change
@@ -4,7 +4,8 @@
*======================================================
* File: view_service_type.php
* Author: George Ryall, David Meredith
* Description: Controller for displaying a service type and associated services
* Description: Controller for displaying a service type
* and associated services
*
* License information
*
@@ -20,12 +21,14 @@
* limitations under the License.
/*======================================================*/
require_once __DIR__ . '/../utils.php';
require_once __DIR__ . '/../../../web_portal/components/Get_User_Principle.php';
require_once __DIR__
. '/../../../web_portal/components/Get_User_Principle.php';
Comment on lines +24 to +25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use parentheses around __DIR__ . '/../../../web_portal/components/Get_User_Principle.php' to make it clear this is the same argument to require_once.

(Note, I am not a PHP expert! I don't know if that is a good idea or not!)


use Exception;

function view_service_type()
{
$params = [];

$identifier = Get_User_Principle();
$user = \Factory::getUserService()->getUserByPrinciple($identifier);

@@ -45,7 +48,8 @@ function view_service_type()
$params['Name'] = $serviceType->getName();
$params['Description'] = $serviceType->getDescription();
$params['ID'] = $serviceType->getId();
$params['AllowMonitoringException'] = $serviceType->getAllowMonitoringException();
$params['AllowMonitoringException'] = $serviceType
->getAllowMonitoringException();
$params['Services'] = $serv->getServices($params['ID']);

show_view("service_type/view_service_type.php", $params, $params['Name']);
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*______________________________________________________
*======================================================
* File: view_service_types.php
@@ -20,12 +21,15 @@
*
/*====================================================== */
require_once __DIR__ . '/../utils.php';
require_once __DIR__ . '/../../../web_portal/components/Get_User_Principle.php';
require_once __DIR__
. '/../../../web_portal/components/Get_User_Principle.php';

function show_all(){
function show_all()
{
$params = [];

$serviceTypes = \Factory::getServiceTypeService()->getServiceTypes();
$params['ServiceTypes']= $serviceTypes;
$params['ServiceTypes'] = $serviceTypes;

show_view('service_type/view_service_types.php', $params, 'Service Types');
}
601 changes: 375 additions & 226 deletions htdocs/web_portal/controllers/utils.php

Large diffs are not rendered by default.

523 changes: 300 additions & 223 deletions htdocs/web_portal/index.php

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions htdocs/web_portal/views/admin/added_service_type.php
Original file line number Diff line number Diff line change
@@ -5,7 +5,5 @@
<?php require_once __DIR__ . '/../fragments/serviceTypeInfo.php'; ?>

<a href="index.php?Page_Type=Service_Type&amp;id=<?= $params['ID']; ?>">
Click here</a> to view the <?php xecho($params['Name'])?> service type.


Click here</a> to view the <?php xecho($params['Name']); ?> service type.
</div>
15 changes: 8 additions & 7 deletions htdocs/web_portal/views/admin/delete_service_type_denied.php
Original file line number Diff line number Diff line change
@@ -7,16 +7,17 @@
$serviceTypeRelPath = "index.php?Page_Type=Service_Type";
?>
<a href="<?= $serviceTypeRelPath; ?>&amp;id=<?= $serviceType->getId(); ?>">
<?php xecho($serviceType->getName());?>
<?php xecho($serviceType->getName()); ?>
</a>'
can not be deleted as the following services are still of this type:
<?php
foreach($params['Services'] as $sep){
echo "<br />"
. "<a href=\"index.php?Page_Type=Service&amp;id=" . $sep->getId() ."\">"
. xssafe($sep->getHostName())
. "</a> ";
}
foreach ($params['Services'] as $sep) {
echo "<br />"
. "<a href=\"index.php?Page_Type=Service&amp;id="
. $sep->getId() . "\">"
. xssafe($sep->getHostName())
. "</a> ";
}
?>
<br>
<br>
11 changes: 8 additions & 3 deletions htdocs/web_portal/views/admin/edited_service_type.php
Original file line number Diff line number Diff line change
@@ -9,8 +9,13 @@
<?php require_once __DIR__ . '/../fragments/serviceTypeInfo.php'; ?>

<p>
<a href="index.php?Page_Type=Admin_Edit_Service_Type&amp;id=<?php echo $params['ID']?>">
Click here</a> to edit the <?php xecho($params['Name'])?> service type again.

<a
href="index.php?Page_Type=Admin_Edit_Service_Type&amp;id=<?php
echo $params['ID'];
?>"
>
Click here</a>to edit the <?php
xecho($params['Name']);
?> service type again.
Comment on lines +12 to +19
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a bit too broken up and harder to understand.

</p>
</div>
189 changes: 131 additions & 58 deletions htdocs/web_portal/views/service_type/view_service_type.php
Original file line number Diff line number Diff line change
@@ -8,14 +8,18 @@
$isUserAdmin = $params['isUserAdmin'];
?>


<div class="rightPageContainer">

<!--Headings-->
<div style="float: left; width: 50em;">
<h1 style="float: left; margin-left: 0em;">Service Type: <?php echo $name?></h1>
<h1 style="float: left; margin-left: 0em;">
Service Type: <?php echo $name; ?>
</h1>

<span style="clear: both; float: left; padding-bottom: 0.4em;">
<br /><?php require_once __DIR__ . '/../fragments/serviceTypeInfo.php'; ?>
<br />
<?php
require_once __DIR__ . '/../fragments/serviceTypeInfo.php';
?>
</span>
</div>

@@ -25,22 +29,41 @@
<?php if ($isUserAdmin) :?>
<div style="float: right;">
<div style="float: right; margin-left: 2em;">
<a href="index.php?Page_Type=Admin_Edit_Service_Type&amp;id=<?php echo $id ?>">
<img src="<?php echo \GocContextPath::getPath()?>img/pencil.png" class="pencil" />
<a
href="index.php?Page_Type=Admin_Edit_Service_Type<?php
echo "&amp;id=", $id;
?>"
>
<img
src="<?= \GocContextPath::getPath(); ?>img/pencil.png"
class="pencil"
/>
<br />
<br />
<span>Edit</span>
</a>
</div>

<div style="float: right;">
<script type="text/javascript"
src="<?php echo \GocContextPath::getPath()?>javascript/confirm.js">
<script
type="text/javascript"
src="<?php
echo \GocContextPath::getPath();
?>javascript/confirm.js"
>
</script>
<a onclick="return confirmSubmit()"
href="index.php?Page_Type=Admin_Delete_Service_Type<?php if ($SEsCount != 0) {

<a
onclick="return confirmSubmit()"
href="index.php?Page_Type=Admin_Delete_Service_Type<?php
if ($SEsCount != 0) {
echo'_Denied';
} ?>&id=<?php echo $id?>">
<img src="<?php echo \GocContextPath::getPath()?>img/trash.png" class="trash" />
}?>&id=<?php echo $id; ?>"
>
<img
src="<?= \GocContextPath::getPath(); ?>img/trash.png"
class="trash"
/>
<br />
<br />
<span>Delete</span>
@@ -49,10 +72,18 @@
</div>
<?php endif; ?>


<!-- Services -->
<div class="listContainer" style="width: 99.5%; float: left; margin-top: 3em; margin-right: 10px;">
<span class="header" style="vertical-align:middle; float: left; padding-top: 0.9em; padding-left: 1em;">
<div
class="listContainer"
style="width: 99.5%; float: left; margin-top: 3em; margin-right: 10px;"
>
<span
class="header"
style="vertical-align: middle;
float: left;
padding-top: 0.9em;
padding-left: 1em;"
>
There <?php if ($SEsCount == 0) {
echo 'are no services';
} elseif ($SEsCount == 1) {
@@ -66,75 +97,119 @@
echo ':';
}?>
</span>
<img src="<?php echo \GocContextPath::getPath()?>img/service.png" class="decoration" />

<img
src="<?php echo \GocContextPath::getPath(); ?>img/service.png"
class="decoration"
/>

<?php if ($SEsCount != 0) : ?>
<table style="clear: both; width: 100%;">
<tr class="site_table_row_1">
<th class="site_table">Hostname</th>
<th class="site_table">Production</th>
<th class="site_table">Monitored</th>
<th class="site_table"><a href="index.php?Page_Type=Scopes">Scope(s)</a></th>
<th class="site_table">
<a href="index.php?Page_Type=Scopes">Scope(s)</a>
</th>
</tr>


<?php $num = 2;
<?php
$num = 2;

foreach ($services as $se) {
?>

<tr class="site_table_row_<?php echo $num ?>">
<td class="site_table">
<div style="background-color: inherit;">
<img src="<?php echo \GocContextPath::getPath()?>img/server.png" class="decoration" />
<img
src="<?php
echo \GocContextPath::getPath();
?>img/server.png"
class="decoration"
/>

<span style="vertical-align: middle;">
<a href="index.php?Page_Type=Service&amp;id=<?php echo $se->getId() ?>">
<?php xecho($se->getHostname());?>
(<?php xecho($se->getServiceType()->getName());?>)
<a
href="<?php
echo "index.php"
. "?Page_Type=Service&amp;id="
. $se->getId();
?>"
>
<?php xecho($se->getHostname()); ?>
(
<?php
xecho(
$se->getServiceType()
->getName()
);
?>
)
</a>
</span>
</div>
</td>

<td class="site_table">
<?php
switch ($se->getProduction()) {
case true:
?>
<img src="<?php echo \GocContextPath::getPath()?>img/tick.png"
height="22px" style="vertical-align: middle;" />
<?php
break;
case false:
?>
<img src="<?php echo \GocContextPath::getPath()?>img/cross.png"
height="22px" style="vertical-align: middle;" />
<?php
break;
}
?>
<?php
switch ($se->getProduction()) {
case true:
?>
<img
src="<?php
echo \GocContextPath::getPath();
?>img/tick.png"
height="22px"
style="vertical-align: middle;" />
<?php
break;
case false:
?>
<img
src="<?php
echo \GocContextPath::getPath();
?>img/cross.png"
height="22px"
style="vertical-align: middle;" />
<?php
break;
}
?>
</td>

<td class="site_table">
<?php
switch ($se->getMonitored()) {
case true:
?>
<img src="<?php echo \GocContextPath::getPath()?>img/tick.png"
height="22px" style="vertical-align: middle;" />
<?php
break;
case false:
?>
<img src="<?php echo \GocContextPath::getPath()?>img/cross.png"
height="22px" style="vertical-align: middle;" />
<?php
break;
}
?>
<?php
switch ($se->getMonitored()) {
case true:
?>
<img
src="<?php
echo \GocContextPath::getPath();
?>img/tick.png"
height="22px"
style="vertical-align: middle;" />
<?php
break;
case false:
?>
<img
src="<?php
echo \GocContextPath::getPath();
?>img/cross.png";
height="22px"
style="vertical-align: middle;" />
<?php
break;
}
?>
</td>

<td class="site_table">
<?php xecho($se->getScopeNamesAsString()); ?>
<?php
xecho($se->getScopeNamesAsString());
?>
</td>
</tr>
<?php
@@ -147,8 +222,6 @@
?>

</table>

<?php endif;?>
</div>

</div>
7 changes: 5 additions & 2 deletions htdocs/web_portal/views/service_type/view_service_types.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div class="rightPageContainer">

<div style="float: left;">
<h1 style="float: left; margin-left: 0em;">
Service Types
</h1>

<span style="clear: both; float: left; padding-bottom: 0.4em;">
All Service Types in GOCDB.
</span>
@@ -12,16 +12,19 @@
<?php $numberOfServiceTypes = sizeof($params['ServiceTypes'])?>
<div class="listContainer">
<span class="header listHeader">
<?php echo $numberOfServiceTypes ?> Service Type<?php if ($numberOfServiceTypes) {
<?= $numberOfServiceTypes; ?> Service Type<?php
if ($numberOfServiceTypes) {
echo "s";
}?>
</span>

<table class="vSiteResults" id="selectedSETable">
<tr class="site_table_row_1">
<th class="site_table">Name</th>
<th class="site_table">Services</th>
<th class="site_table">Description</th>
</tr>

<?php
$num = 2;