Blog Archives

GLPI 9.1.2 fix inline images KB

First make the stored images visible in the GLPI output

In %glpiroot%/lib/htmlawed/htmlawed.php add ‘; src: data’ in line 47

output

If there where any previous inline images stored, these should now be visible in the KB. If you have images stored, but they still do not turn up, you might need to replace the ‘denied’ string stored in the glpi database. Use the SQL below to achieve this.

update glpi_knowbaseitems set answer = REPLACE(answer, 'denied:', '');
Second make inserting inline HTML images possible (within the WYSIWYG)
In %glpiroot%/inc/html.class.php file on rule 3917 add the paste plugin by adding the paste plugin and adding the paste option to the editor. Review and alter your code to reflect the snippet below:
$js = "tinyMCE.init({
language: '$language',
browser_spellcheck: true,
mode: 'exact',
elements: '$name',
relative_urls: false,
remove_script_host: false,
entity_encoding: 'raw',
menubar: false,
statusbar: false,
skin: 'light',
plugins: [
'table directionality searchreplace paste',
'tabfocus autoresize link image',
'code fullscreen textcolor colorpicker',
'paste'
],
toolbar: 'styleselect | bold italic | forecolor backcolor | bullist numlist outdent indent | table link image | code fullscreen | paste',
paste_data_images: true,
});
";
After this you should again be able to past inline HTML images into GLPI KB articles.
TIP: Use the open source Greenshot screenshot tool that supports pasting inline HTML natively.
Advertisements

Centreon add audioble alert to tacktical overview.


make sure you backup de original files when you dont know or understand the scripts used below.

browse to your centreon install location web dir default;

~>cd /usr/local/centreon/www/

browse to the tacticalOverview dir.

~>cd /include/home/tackticalOverview

Open the file tacticalOverview.php

~>vi /tacticalOverview.php

Add the following code in the bottom of the file.

                        /*
                        * Audiable allert on Warning, Critical, Unknown states.
                        * Values are recalculated because we dont accept NULL as an answer
                        */
                        if(!isset($_SESSION['amis_alert'])){
                                $_SESSION['amis_alert'] = false;
                        }
                        foreach($SvcStat as $key => $val){
                                if(($key == 1) || ($key == 2) || ($key == 3)){
                                        $sum = $val - $svcAck[$key];
                                        if($sum >= 1){

                                                /*This section will open a pop-up that contains the audio alert */
                                                if(!$_SESSION['amis_alert']){
                                                        print('<script>window.open(\'./include/home/tacticalOverview/alert.ihtml\', \'alert\',\'width=180,height=20,scrollbars=no,toolbar=no,location=no\');</script>');
                                                        $_SESSION['amis_alert'] = true;
                                                        break;
                                                }
                                                break;
                                        }else{
                                                /* This section will close the popup when the alert is solved / acked */
                                                print('<script>window.open(\'./include/home/tacticalOverview/closeme.ihtml\', \'alert\',\'width=180,height=20,scrollbars=no,toolbar=no,location=no\');</script>');
                                                $_SESSION['amis_alert'] = false;
                                        }

                                }
                        }

If you want this tidy add additional template entries. I was to lazy for that 😉

Save the file and add the alert.ihtml

~>vim ./alert.ihtml

Add the following code

<html>
<head></head>
<body>
<div>
<object type="application/x-shockwave-flash" data="../../../mp3player.swf" height="20" width="180"><param name="FlashVars" value="mp3=../../../error.mp3&autoplay=1&loop=1&showslider=0"/></object></div>
</body>
</html>

Save the file and add the closeme.ihtml

~>vim closeme.ihtml

Add the following code

<html>
<head></head>
<body>
<script>window.close();</script>
</body>
</html>

Go back to the www dir

~>cd /usr/local/centreon/www

download the a nice error.mp3 (yeah you need to rename it 😉

wget http://www.freeinfosociety.com/media/sounds/142.mp3
~>cp ./142.mp3 ./error.mp3

Download the flash player (yeah i renamed this one too 🙂

~>wget http://flash-mp3-player.net/medias/player_mp3_maxi.swf
cp ./player_mp3_maxi.swf ./mp3player.swf

This should be all

Please do make a backup of the original files. Also when you find this script is not working for you, then please let me know, and why. Then maybe i can come up with an alternative solution.