iTop Newsroom implementation - painfully merged manually...

This commit is contained in:
Denis Flaven
2018-11-21 19:36:51 +01:00
parent a659de9c9b
commit 5ccfa24b27
20 changed files with 1118 additions and 95 deletions

View File

@@ -1,46 +1,3 @@
#hub_popup_menu li span {
display: block;
padding: 5px 12px;
text-decoration: none;
nowidth: 70px;
white-space: nowrap;
}
#hub_popup_menu li li p {
text-align: left;
margin: 2px;
margin-left: 5px;
margin-right: 5px;
cursor: pointer;
background-color: transparent;
color: #000;
}
#hub_popup_menu > ul > li > ul {
margin-top: 8px;
}
#hub_popup_menu > ul > li > ul > li {
display: block;
border-bottom: 1px #ddd solid;
padding-top: 10px;
padding-bottom: 10px;
}
#hub_popup_menu > ul > li > ul > li:hover {
color: #fff;
background-color: #E87C1E;
}
#hub_popup_menu li li:last-of-type {
border-bottom: 0;
}
#hub_popup_menu li {
list-style: none;
cursor: pointer;
}
#hub_popup_menu li ul {
width: 340px;
}
#top-left-hub-cell {
padding-right: 8px !important;
}
#hub_launch_container {
padding:10px;
overflow: visible;
@@ -209,7 +166,7 @@
#hub_launch_content {
width: 100%;
}
button {
#hub_launch_content button {
cursor: pointer;
font-weight: bold;
box-shadow: 0px 0px 0px 1px transparent inset, 0px 0em 0px 0px rgba(34, 36, 38, 0.15) inset;
@@ -219,27 +176,27 @@ button {
vertical-align: middle;
padding: 0;
}
button.positive {
#hub_launch_content button.positive {
background-color: rgb(234, 125, 30);
color: #FFFFFF;
}
button:disabled, button[disabled] {
#hub_launch_content button:disabled, button[disabled] {
background-color: #828487!important;
cursor: progress !important;
}
button > span {
#hub_launch_content button > span {
display: inline-block;
padding: 0.8em;
padding-left: 1.3em;
padding-right: 1.3em;
}
button:hover {
#hub_launch_content button:hover {
background-color: #D0D0D0;
}
button.positive:hover {
#hub_launch_content button.positive:hover {
background-color: rgb(221, 113, 27);
}
button > img {
#hub_launch_content button > img {
width: 16px;
height: 16px;
vertical-align: middle;
@@ -249,4 +206,4 @@ button > img {
.horiz-spacer {
display: inline-block;
width: 1.5em;
}
}

View File

@@ -17,7 +17,9 @@
<url>https://www.itophub.io</url>
<route_landing>/my-instances/landing-from-remote</route_landing>
<route_landing_stateless>/stateless-remote-itop/landing-from-remote-stateless</route_landing_stateless>
<route_notifications>/api/notifications</route_notifications>
<route_fetch_unread_messages>/api/notifications</route_fetch_unread_messages>
<route_mark_all_messages_as_read>/api/notifications/mark_all_as_read</route_mark_all_messages_as_read>
<route_view_all_messages>/api/notifications/view_all_messages</route_view_all_messages>
<setup_url>../pages/exec.php?exec_module=itop-hub-connector&amp;exec_page=launch.php&amp;target=inform_after_setup</setup_url>
</parameters>
</module_parameters>

View File

@@ -0,0 +1,74 @@
<?php
require_once(APPROOT.'application/newsroomprovider.class.inc.php');
class HubNewsroomProvider extends NewsroomProviderBase
{
/**
* {@inheritDoc}
* @see NewsroomProviderBase::GetTTL()
*/
public function GetTTL()
{
// TODO Auto-generated method stub
return 15*60; // Update every 15 minutes
}
/**
* {@inheritDoc}
* @see NewsroomProviderBase::IsApplicable()
*/
public function IsApplicable(User $oUser = null)
{
if ($oUser !== null)
{
return UserRights::IsAdministrator($oUser);
}
else
{
return false;
}
}
/**
* {@inheritDoc}
* @see NewsroomProviderBase::GetLabel()
*/
public function GetLabel()
{
return 'iTop Hub'; // No need to translate...
}
public function GetMarkAllAsReadURL()
{
return $this->MakeURL('route_mark_all_messages_as_read');
}
public function GetFetchURL()
{
return $this->MakeURL('route_fetch_unread_messages');
}
public function GetViewAllURL()
{
return $this->MakeURL('route_view_all_messages');
}
/**
* {@inheritDoc}
* @see NewsroomProviderBase::GetPreferencesUrl()
*/
public function GetPreferencesUrl()
{
return null;
}
private function MakeURL($sRouteCode)
{
$sBaseUrl = $this->oConfig->GetModuleSetting('itop-hub-connector', 'url').MetaModel::GetModuleSetting('itop-hub-connector', $sRouteCode);
$sParameters = 'uuid[bdd]='.urlencode((string) trim(DBProperty::GetProperty('database_uuid', ''), '{}'));
$sParameters .= '&uuid[file]='.urlencode((string) trim(@file_get_contents(APPROOT."data/instance.txt"), "{} \n"));
$sParameters .= '&uuid[user]='.urlencode(UserRights::GetUserId());
return $sBaseUrl.'?'.$sParameters;
}
}

View File

@@ -24,7 +24,8 @@ SetupWebPage::AddModule(
//
'datamodel' => array(
'menus.php',
'model.itop-hub-connector.php'
'hubnewsroomprovider.class.inc.php',
'model.itop-hub-connector.php'
),
'webservice' => array(