-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
383 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). | ||
|
||
## [Unreleased] | ||
|
||
## [1.5.0] - 2019-07-22 | ||
### Added | ||
- Include "Molkobain's newsroom provider" module to keep administrators informed on new extensions and updates (can be disabled in the conf. file) (iTop 2.6+ only) | ||
|
||
## [1.4.1] - 2019-07-02 | ||
### Changed | ||
- Show explicit help cursor on tooltips | ||
- Fix elements displaying under the slot when height greater than 1U | ||
|
||
## [1.4.0] - 2019-06-24 | ||
### Added | ||
- Add support for PDU in racks and enclosures | ||
|
||
### Changed | ||
- Improve rack proportions to be more realistic and fit a 42U in a Full HD screen | ||
- Fix UI glitches on small screens | ||
|
||
## [1.3.1] - 2019-06-19 | ||
### Changed | ||
- Change compatibility to iTop 2.4+ | ||
- Fix glitch in elements' tooltip header when name is too long | ||
- Fix minor UI glitches | ||
|
||
## [1.3.0] - 2019-05-26 | ||
### Added | ||
- Complete dutch translations thanks to @jbostoen | ||
- Add collapse / expand toggler on unmounted element panels | ||
|
||
### Changed | ||
- Fix default background color on devices | ||
- Fix legend sorted by class names | ||
- Fix HTML attributes in element's tooltip | ||
|
||
## [1.2.0] - 2019-03-28 | ||
### Added | ||
- Move object's rack_units attribute with position attributes in both properties and list display | ||
- Improve UI when no element attached to rack/enclosure | ||
- Improve extensibility | ||
|
||
## [1.1.1] - 2019-03-05 | ||
### Changed | ||
- Fix obsolete devices displayed even with option disabled #3 | ||
|
||
## [1.1.0] - 2019-02-03 | ||
### Added | ||
- Add option to toggle obsolete devices | ||
|
||
### Changed | ||
- Fix devices positioned off host's limits | ||
|
||
## [1.0.0] - 2019-01-07 | ||
### Added | ||
- Initial release | ||
|
||
[Unreleased]: https://github.com/Molkobain/itop-datacenter-view/compare/v1.5.0...HEAD | ||
[1.5.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.5.0 | ||
[1.4.1]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.4.1 | ||
[1.4.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.4.0 | ||
[1.3.1]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.3.1 | ||
[1.3.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.3.0 | ||
[1.2.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.2.0 | ||
[1.1.1]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.1.1 | ||
[1.1.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.1.0 | ||
[1.0.0]: https://github.com/Molkobain/itop-datacenter-view/releases/tag/v1.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
dist/molkobain-datacenter-view/molkobain-newsroom-provider/common/confighelper.class.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
/** | ||
* Copyright (c) 2015 - 2019 Molkobain. | ||
* | ||
* This file is part of licensed extension. | ||
* | ||
* Use of this extension is bound by the license you purchased. A license grants you a non-exclusive and non-transferable right to use and incorporate the item in your personal or commercial projects. There are several licenses available (see https://www.molkobain.com/usage-licenses/ for more informations) | ||
*/ | ||
|
||
namespace Molkobain\iTop\Extension\NewsroomProvider\Common\Helper; | ||
|
||
use Molkobain\iTop\Extension\HandyFramework\Common\Helper\ConfigHelper as BaseConfigHelper; | ||
use UserRights; | ||
|
||
/** | ||
* Class ConfigHelper | ||
* | ||
* @package Molkobain\iTop\Extension\NewsroomProvider\Common\Helper | ||
* @since v1.0.0 | ||
*/ | ||
class ConfigHelper extends BaseConfigHelper | ||
{ | ||
const MODULE_NAME = 'molkobain-datacenter-view'; | ||
const API_VERSION = '1.0'; | ||
|
||
const SETTING_CONST_FQCN = 'Molkobain\\iTop\\Extension\\NewsroomProvider\\Common\\Helper\\ConfigHelper'; | ||
|
||
// Note: Mind to update defaults values in the module file when changing those default values. | ||
const DEFAULT_SETTING_DEBUG = false; | ||
const DEFAULT_SETTING_ENDPOINT = 'https://www.molkobain.com/support/pages/exec.php?exec_module=molkobain-newsroom-editor&exec_page=index.php'; | ||
|
||
/** | ||
* Returns true if the debug option is enabled | ||
* | ||
* @return boolean | ||
*/ | ||
public static function IsDebugEnabled() | ||
{ | ||
return static::GetSetting('debug'); | ||
} | ||
|
||
/** | ||
* Returns the version of the API called on the remote server | ||
* | ||
* @return string | ||
*/ | ||
public static function GetVersion() | ||
{ | ||
return static::API_VERSION; | ||
} | ||
|
||
/** | ||
* Returns an hash to identify the current user | ||
* | ||
* Note: User ID is sent as a non-reversible hash to ensure user's privacy | ||
* | ||
* @return string | ||
*/ | ||
public static function GetUserHash() | ||
{ | ||
$sUserId = UserRights::GetUserId(); | ||
|
||
// Prepare a unique hash to identify users across all iTops in order to be able for them to tell which news they have already read. | ||
return hash('fnv1a64', $sUserId); | ||
} | ||
|
||
/** | ||
* Returns an hash to identify the current iTop instance | ||
* | ||
* Note: iTop UUID is sent as a non-reversible hash to ensure user's privacy | ||
* | ||
* @return string | ||
*/ | ||
public static function GetInstanceHash() | ||
{ | ||
$sITopUUID = (string) trim(@file_get_contents(APPROOT . 'data/instance.txt'), "{} \n"); | ||
|
||
// Note: We don't retrieve DB UUID for now as it is not of any use for now. | ||
return hash('fnv1a64', $sITopUUID); | ||
} | ||
} |
152 changes: 152 additions & 0 deletions
152
...molkobain-datacenter-view/molkobain-newsroom-provider/core/newsroomprovider.class.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,152 @@ | ||
<?php | ||
/** | ||
* Copyright (c) 2015 - 2019 Molkobain. | ||
* | ||
* This file is part of licensed extension. | ||
* | ||
* Use of this extension is bound by the license you purchased. A license grants you a non-exclusive and non-transferable right to use and incorporate the item in your personal or commercial projects. There are several licenses available (see https://www.molkobain.com/usage-licenses/ for more informations) | ||
*/ | ||
|
||
namespace Molkobain\iTop\Extension\NewsroomProvider\Core; | ||
|
||
use Molkobain\iTop\Extension\NewsroomProvider\Common\Helper\ConfigHelper; | ||
use NewsroomProviderBase; | ||
use User; | ||
use UserRights; | ||
|
||
// Protection for iTop older than 2.6.0 when the extension is packaged with another. | ||
if(class_exists('NewsroomProviderBase')) | ||
{ | ||
/** | ||
* Class MolkobainNewsroomProvider | ||
* | ||
* Note: This is greatly inspired by the itop-hub-connector module. | ||
* | ||
* @package Molkobain\iTop\Extension\NewsroomProvider\Core | ||
* @since v1.0.0 | ||
*/ | ||
class MolkobainNewsroomProvider extends NewsroomProviderBase | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function GetTTL() | ||
{ | ||
// Update every hour | ||
return 60 * 60; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function IsApplicable(User $oUser = null) | ||
{ | ||
if(!ConfigHelper::IsEnabled()) | ||
{ | ||
return false; | ||
} | ||
elseif($oUser !== null) | ||
{ | ||
return UserRights::IsAdministrator($oUser); | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
|
||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function GetLabel() | ||
{ | ||
return 'Molkobain I/O'; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function GetMarkAllAsReadURL() | ||
{ | ||
return $this->MakeUrl('mark_all_as_read'); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function GetFetchURL() | ||
{ | ||
return $this->MakeUrl('fetch'); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function GetViewAllURL() | ||
{ | ||
return $this->MakeUrl('view_all'); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
* | ||
* Note: Placeholders are only used in the news' URL | ||
*/ | ||
public function GetPlaceholders() | ||
{ | ||
$aPlaceholders = array(); | ||
|
||
$oUser = UserRights::GetUserObject(); | ||
if($oUser !== null) | ||
{ | ||
$aPlaceholders['%user_login%'] = $oUser->Get('login'); | ||
$aPlaceholders['%user_hash%'] = ConfigHelper::GetUserHash(); | ||
} | ||
|
||
$oContact = UserRights::GetContactObject(); | ||
if($oContact !== null) | ||
{ | ||
$aPlaceholders['%contact_firstname%'] = $oContact->Get('first_name'); | ||
$aPlaceholders['%contact_lastname%'] = $oContact->Get('name'); | ||
$aPlaceholders['%contact_email%'] = $oContact->Get('email'); | ||
$aPlaceholders['%contact_organization%'] = $oContact->Get('org_id_friendlyname'); | ||
$aPlaceholders['%contact_location%'] = $oContact->Get('location_id_friendlyname'); | ||
} | ||
else | ||
{ | ||
$aPlaceholders['%contact_firstname%'] = ''; | ||
$aPlaceholders['%contact_lastname%'] = ''; | ||
$aPlaceholders['%contact_email%'] = ''; | ||
$aPlaceholders['%contact_organization%'] = ''; | ||
$aPlaceholders['%contact_location%'] = ''; | ||
} | ||
|
||
return $aPlaceholders; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function GetPreferencesUrl() | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* Returns an URL to the news editor for the $sOperation and current user | ||
* | ||
* @param string $sOperation | ||
* | ||
* @return string | ||
*/ | ||
private function MakeUrl($sOperation) | ||
{ | ||
return ConfigHelper::GetSetting('endpoint') | ||
. '&operation=' . $sOperation | ||
. '&version=' . ConfigHelper::GetVersion() | ||
. '&user=' . urlencode(ConfigHelper::GetUserHash()) | ||
. '&instance=' . urlencode(ConfigHelper::GetInstanceHash()); | ||
} | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
...obain-datacenter-view/molkobain-newsroom-provider/en.dict.molkobain-newsroom-provider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
/** | ||
* Copyright (c) 2015 - 2019 Molkobain. | ||
* | ||
* This file is part of licensed extension. | ||
* | ||
* Use of this extension is bound by the license you purchased. A license grants you a non-exclusive and non-transferable right to use and incorporate the item in your personal or commercial projects. There are several licenses available (see https://www.molkobain.com/usage-licenses/ for more informations) | ||
*/ | ||
|
||
Dict::Add('EN US', 'English', 'English', array()); |
Oops, something went wrong.