Hi,
I started to migrate our custom extensions to iTop 3.
In iTop 2.x I used a lot of message banners (like the success banner when creating an object).
In iTop 3 I now want to use the functions that are already implemented but I only get the banner appended to the site (as seen in the screenshot).
I use this class and function to place the banner:
How can I place to banner to the top or the header of the page?
I already tried to use "iPageUIBlockExtension" but with that I cannot get any dependencies to my own functions I think.
Thanks,
Nico
Hi Jeffrey,
this code snippet is just for testing. Using it the banner appears on any object that is shown.
Just imagine for an example a banner should appear on every UserRequest or Incident, like this:
$sClass=get_class($oObject);$sClasses=array('Incident','UserRequest');if(in_array($sClass,$sClasses)){$oFailAlertBlock=AlertUIBlockFactory::MakeForDanger('Ticket-Type','Request or Incident');$oPage->AddUiBlock($oFailAlertBlock);}
This really makes no sense but I just want to figure out how to place the banner to the top of the page/top of object details.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That's a good hint, I just checked it. They're using the interface "iPageUIBlockExtension".
That is okay for the communications because the queries are made directly in the function "GetHeaderBlock". Defining a static banner like that is working for me too.
But I want to have dependencies with different functions I defined, e.g., in "public function OnDisplayProperties".
I dont know how to combine those classes.
Maybe I should just code the banner directly in HTML or just move it from the bottom to the top using Javascript...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually I think this is a missing API; we have the same issue internally when we want to display a message on top of an object when it matches some conditions (eg; when a Bug object needs to be retrofitted in a support branch).
I don't think this can be addressed nicely yet 😕
The workaround I can see, is to:
* Use the \AbstractPageUIBlockExtension::GetHeaderBlock() API
* Read the request (URL) params to see if you are displaying an object
* Retrieve the object data if necessary to see if it matches conditions
* Display the AlertBlock if necessary
Hi,
I started to migrate our custom extensions to iTop 3.
In iTop 2.x I used a lot of message banners (like the success banner when creating an object).
In iTop 3 I now want to use the functions that are already implemented but I only get the banner appended to the site (as seen in the screenshot).
I use this class and function to place the banner:
How can I place to banner to the top or the header of the page?
I already tried to use "iPageUIBlockExtension" but with that I cannot get any dependencies to my own functions I think.
Thanks,
Nico
When exactly do you show this banner?
Now, you're appending it to the HTML of the page at a seemingly random point.
Hi Jeffrey,
this code snippet is just for testing. Using it the banner appears on any object that is shown.
Just imagine for an example a banner should appear on every UserRequest or Incident, like this:
This really makes no sense but I just want to figure out how to place the banner to the top of the page/top of object details.
I haven't tested it, but I'd check out how Combodo does it for their "Communications to customers" extension.
See https://github.com/Combodo/itop-communications/blob/master/src/Hook/CommunicationPageUIBlockExtension.php ( the header block )
That's a good hint, I just checked it. They're using the interface "iPageUIBlockExtension".
That is okay for the communications because the queries are made directly in the function "GetHeaderBlock". Defining a static banner like that is working for me too.
But I want to have dependencies with different functions I defined, e.g., in "public function OnDisplayProperties".
I dont know how to combine those classes.
Maybe I should just code the banner directly in HTML or just move it from the bottom to the top using Javascript...
Like this:
Hello Nico,
Actually I think this is a missing API; we have the same issue internally when we want to display a message on top of an object when it matches some conditions (eg; when a Bug object needs to be retrofitted in a support branch).
I don't think this can be addressed nicely yet 😕
The workaround I can see, is to:
* Use the
\AbstractPageUIBlockExtension::GetHeaderBlock()API* Read the request (URL) params to see if you are displaying an object
* Retrieve the object data if necessary to see if it matches conditions
* Display the AlertBlock if necessary
Example (not tested, code might not be correct):
I think I'll try this on our iTop to workaround the same issue! 😁
Hope it helps,
Guillaume