diff --git a/application/templates/notifications_menu.html b/application/templates/notifications_menu.html deleted file mode 100644 index 44b18483c..000000000 --- a/application/templates/notifications_menu.html +++ /dev/null @@ -1,20 +0,0 @@ - - -
- -UI:NotificationsMenu:HelpContent -
-
-

 

- - -

UI:NotificationsMenu:AvailableTriggers

- SELECT Trigger -
- -

UI:NotificationsMenu:AvailableActions

- SELECT Action -
-
diff --git a/datamodels/1.x/itop-welcome-itil/main.itop-welcome-itil.php b/datamodels/1.x/itop-welcome-itil/main.itop-welcome-itil.php index 945b19e4b..bdc7ddc8d 100644 --- a/datamodels/1.x/itop-welcome-itil/main.itop-welcome-itil.php +++ b/datamodels/1.x/itop-welcome-itil/main.itop-welcome-itil.php @@ -53,7 +53,7 @@ class ItopWelcome extends ModuleHandlerAPI $oAdminMenu = new MenuGroup('AdminTools', 80 /* fRank */); new OQLMenuNode('UserAccountsMenu', 'SELECT User', $oAdminMenu->GetIndex(), 1 /* fRank */); new OQLMenuNode('ProfilesMenu', 'SELECT URP_Profiles', $oAdminMenu->GetIndex(), 2 /* fRank */); - new TemplateMenuNode('NotificationsMenu', APPROOT.'application/templates/notifications_menu.html', $oAdminMenu->GetIndex(), 3 /* fRank */); + new WebPageMenuNode('NotificationsMenu', utils::GetAbsoluteUrlAppRoot().'pages/notifications.php', $oAdminMenu->GetIndex(), 3 /* fRank */); new OQLMenuNode('AuditCategories', 'SELECT AuditCategory', $oAdminMenu->GetIndex(), 4 /* fRank */); new WebPageMenuNode('RunQueriesMenu', utils::GetAbsoluteUrlAppRoot().'pages/run_query.php', $oAdminMenu->GetIndex(), 8 /* fRank */); new OQLMenuNode('QueryMenu', 'SELECT Query', $oAdminMenu->GetIndex(), 8.5 /* fRank */); diff --git a/datamodels/2.x/itop-welcome-itil/main.itop-welcome-itil.php b/datamodels/2.x/itop-welcome-itil/main.itop-welcome-itil.php index 1879d420a..fe10b00e6 100755 --- a/datamodels/2.x/itop-welcome-itil/main.itop-welcome-itil.php +++ b/datamodels/2.x/itop-welcome-itil/main.itop-welcome-itil.php @@ -56,7 +56,7 @@ class ItopWelcome extends ModuleHandlerAPI $oAdminMenu = new MenuGroup('AdminTools', 80 /* fRank */); new OQLMenuNode('UserAccountsMenu', 'SELECT User', $oAdminMenu->GetIndex(), 1 /* fRank */,true); new OQLMenuNode('ProfilesMenu', 'SELECT URP_Profiles', $oAdminMenu->GetIndex(), 2 /* fRank */); - new TemplateMenuNode('NotificationsMenu', APPROOT.'application/templates/notifications_menu.html', $oAdminMenu->GetIndex(), 3 /* fRank */); + new WebPageMenuNode('NotificationsMenu', utils::GetAbsoluteUrlAppRoot().'pages/notifications.php', $oAdminMenu->GetIndex(), 3 /* fRank */); new OQLMenuNode('AuditCategories', 'SELECT AuditCategory', $oAdminMenu->GetIndex(), 4 /* fRank */); new WebPageMenuNode('RunQueriesMenu', utils::GetAbsoluteUrlAppRoot().'pages/run_query.php', $oAdminMenu->GetIndex(), 8 /* fRank */); new OQLMenuNode('QueryMenu', 'SELECT Query', $oAdminMenu->GetIndex(), 8.5 /* fRank */); diff --git a/pages/notifications.php b/pages/notifications.php new file mode 100644 index 000000000..a40ce506d --- /dev/null +++ b/pages/notifications.php @@ -0,0 +1,104 @@ + + + +/** + * Page to configuration the notifications (triggers and actions) + * + * @copyright Copyright (C) 2013 Combodo SARL + * @license http://opensource.org/licenses/AGPL-3.0 + */ + +require_once('../approot.inc.php'); +require_once(APPROOT.'/application/application.inc.php'); +require_once(APPROOT.'/application/itopwebpage.class.inc.php'); + +require_once(APPROOT.'/application/startup.inc.php'); + +require_once(APPROOT.'/application/loginwebpage.class.inc.php'); +LoginWebPage::DoLogin(true); // Check user rights and prompt if needed (must be admin) + + + +// Main program +// +$oP = new iTopWebPage(Dict::S('Menu:NotificationsMenu+')); + +$oP->add(''); + +$oP->StartCollapsibleSection(Dict::S('UI:NotificationsMenu:Help'), true); +$oP->add('
'); +$oP->add(''); +$oP->add(Dict::S('UI:NotificationsMenu:HelpContent')); +$oP->add('
'); +$oP->add(''); +$oP->add(''); +$oP->EndCollapsibleSection(); + +$oP->add('

 

'); + + +$oP->AddTabContainer('Tabs_0'); +$oP->SetCurrentTabContainer('Tabs_0'); + +$oP->SetCurrentTab(Dict::S('UI:NotificationsMenu:Triggers')); +$oP->add('

'.Dict::S('UI:NotificationsMenu:AvailableTriggers').'

'); +$oFilter = new DBObjectSearch('Trigger'); +$aParams = array(); +$oBlock = new DisplayBlock($oFilter, 'list', false, $aParams); +$oBlock->Display($oP, 'block_0', $aParams); + + +$aActionClasses = array(); +foreach(MetaModel::EnumChildClasses('Action', ENUM_CHILD_CLASSES_EXCLUDETOP) as $sActionClass) +{ + if (!MetaModel::IsAbstract($sActionClass)) + { + $aActionClasses[] = $sActionClass; + } +} + +$oP->SetCurrentTab(Dict::S('UI:NotificationsMenu:Actions')); + +if (count($aActionClasses) == 1) +{ + // Preserve old style + $oP->add('

'.Dict::S('UI:NotificationsMenu:AvailableActions').'

'); +} + +$iBlock = 0; +foreach($aActionClasses as $sActionClass) +{ + if (count($aActionClasses) > 1) + { + // New style + $oP->add('

'.MetaModel::GetName($sActionClass).'

'); + } + $oFilter = new DBObjectSearch($sActionClass); + $aParams = array(); + $oBlock = new DisplayBlock($oFilter, 'list', false, $aParams); + $oBlock->Display($oP, 'block_'.$iBlock, $aParams); + $iBlock++; +} + +$oP->SetCurrentTab(''); +$oP->SetCurrentTabContainer(''); + +$oP->output(); \ No newline at end of file