Boby07
12th August 2008, 17:59
Bonjour les gens,
pour ceux que ça interresse, voici comment rajouter un menu sur la droite de statusmap ... Le code est loin d'être optimisé, mais c'est un test. On peut faire ça avec des feuilles de style ...
Le code fonctionne sous IE toute version ou bien sur Mozilla (Version 3 testé et ça fonctionne)
configuration:Oreon 1.4 - Nagios 2.0 - StatusMap 1.1 - SUSE 10.1
Voici ci-dessous un aperçu:
http://florian.muller2.free.fr/nagios/test.jpg
Alors quand vous cliquez sur un lien (il s'agit ici de liens qui pointent vers l'extérieur), une nouvelle page de votre navigateur s'ouvre. Si vous passez la souris sur les liens, le fond de la cellule pointée change de couleur grace à OnMouseover (ici par défaut j'ai mis du rouge, mais vous pouvez changer comme vous le voulez) et pour terminer la police du lien change de taille là encore avec OnMouseOver (un zoom en gros, que la aussi vous pouvez changer à votre guise).
Si vous copiez/coller le code ci-dessous, dans le fichier qui va bien, alors vous optiendrez exatcement ce que vous avez en capture d'écran (pas la carte, faut pas déconner ^^).
Voici le code ... à placer dans le répertoire /usr/local/oreon/www/modules/statusmap
il s'agit de la page statusmap.ihtml
<script type="text/javascript" src="modules/statusmap/javascript/common.js"></script>
<script type="text/javascript" src="modules/statusmap/javascript/overlib_mini.js"><!-- overLIB (c) Erik Bosrup --></script>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<form {$form.attributes}>
<table id="ListTable">
<tr class="ListHeader"><td class="ListColHeaderCenter" colspan="2" >{$STATUSMAP_TITLE} du <font color="white"> Conseil General de l'Ardeche</font><span id='oreonstatusmap_timestamp'></span></td></tr>
<tr >
<td><map id='statusmap' name='statusmap'></map>
<div align=center><img id='oreonstatusmapimg' usemap="#statusmap" src='{$STATUSMAP_URL}'></div></td>
<td>
<div style="color:blue">
<p onmouseover="this.style.color='red'"
onmouseout="this.style.color='blue'">
<font size="2"><img src="./img/enabled.gif"> Manipulations sur carte:</font></div>
<br>
<br>
<table>
<tr class="ListColLvl1_name">
<td class="FormRowField">{$form.layout_method.label}</td>
<td class="FormRowValue">{$form.layout_method.html}</td>
</tr>
<tr class="ListColLvl2_name">
<td class="FormRowField">{$form.layermode.label}</td>
<td class="FormRowValue">{$form.layermode.html}</td>
</tr>
<tr class="ListColLvl1_name">
<td class="FormRowField">{$form.layer.label}</td>
<td class="FormRowValue">{$form.layer.html}</td>
</tr>
<!--<tr class="ListColLvl2_name">
<td class="FormRowField">{$form.scaling_factor.label}</td>
<td class="FormRowValue">{$form.scaling_factor.html}</td>
</tr> -->
<tr class="ListColLvl2_name">
<td class="FormRowField">{$form.popup.label}</td>
<td class="FormRowValue">{$form.popup.html}</td>
</tr>
<tr class="ListColLvl1_name" align="center">
<td class="FormRowField" colspan="2"><p class="oreonbutton">{$form.update.html}</p></td>
</tr>
</table>
<br>
<br>
<div style="color:blue">
<p onmouseover="this.style.color='red'"
onmouseout="this.style.color='blue'">
<font size="2"><img src="./img/enabled.gif"> Acces direct aux Onduleurs:</font>
</div>
<br>
<br>
<div align="center">
<table border="2" width="190px">
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> GTSE Le Teil.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"> <img src="./img/status2.gif"> UTSE Le Teil.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>0" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> GTN Annonay.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"> <img src="./img/status2.gif"> UTN Annonay.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> Pole Astier Froment.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> GTC St Peray.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> UTSO Aubenas.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> UTSO2 Aubenas.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> GTSO Aubenas.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> CMS Tournon.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> BDP Veyras.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> UTC Guilherand.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> TRAM Subdi Privas.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> Vanel.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> Hotel du departement.</td>
</tr>
</table>
</div>
<br>
<br>
<div style="color:blue">
<p onmouseover="this.style.color='red'"
onmouseout="this.style.color='blue'">
<font size="2"><img src="./img/enabled.gif"> Prise de main a distance:</font>
</div>
<br>
<br>
<div align="center">
<table border="2" width="200">
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src=./img/command.png> KVM-IP Hotel Dept.</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
{$form.hidden}
</form>
{$initJS}
Voila un maigre contribution , a++
PS: Dans le code, s'est pas target="Accès à l'onduleur !" , s'est title="Accès à l'onduleur !" , je corigerai de mon coté ;)
pour ceux que ça interresse, voici comment rajouter un menu sur la droite de statusmap ... Le code est loin d'être optimisé, mais c'est un test. On peut faire ça avec des feuilles de style ...
Le code fonctionne sous IE toute version ou bien sur Mozilla (Version 3 testé et ça fonctionne)
configuration:Oreon 1.4 - Nagios 2.0 - StatusMap 1.1 - SUSE 10.1
Voici ci-dessous un aperçu:
http://florian.muller2.free.fr/nagios/test.jpg
Alors quand vous cliquez sur un lien (il s'agit ici de liens qui pointent vers l'extérieur), une nouvelle page de votre navigateur s'ouvre. Si vous passez la souris sur les liens, le fond de la cellule pointée change de couleur grace à OnMouseover (ici par défaut j'ai mis du rouge, mais vous pouvez changer comme vous le voulez) et pour terminer la police du lien change de taille là encore avec OnMouseOver (un zoom en gros, que la aussi vous pouvez changer à votre guise).
Si vous copiez/coller le code ci-dessous, dans le fichier qui va bien, alors vous optiendrez exatcement ce que vous avez en capture d'écran (pas la carte, faut pas déconner ^^).
Voici le code ... à placer dans le répertoire /usr/local/oreon/www/modules/statusmap
il s'agit de la page statusmap.ihtml
<script type="text/javascript" src="modules/statusmap/javascript/common.js"></script>
<script type="text/javascript" src="modules/statusmap/javascript/overlib_mini.js"><!-- overLIB (c) Erik Bosrup --></script>
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<form {$form.attributes}>
<table id="ListTable">
<tr class="ListHeader"><td class="ListColHeaderCenter" colspan="2" >{$STATUSMAP_TITLE} du <font color="white"> Conseil General de l'Ardeche</font><span id='oreonstatusmap_timestamp'></span></td></tr>
<tr >
<td><map id='statusmap' name='statusmap'></map>
<div align=center><img id='oreonstatusmapimg' usemap="#statusmap" src='{$STATUSMAP_URL}'></div></td>
<td>
<div style="color:blue">
<p onmouseover="this.style.color='red'"
onmouseout="this.style.color='blue'">
<font size="2"><img src="./img/enabled.gif"> Manipulations sur carte:</font></div>
<br>
<br>
<table>
<tr class="ListColLvl1_name">
<td class="FormRowField">{$form.layout_method.label}</td>
<td class="FormRowValue">{$form.layout_method.html}</td>
</tr>
<tr class="ListColLvl2_name">
<td class="FormRowField">{$form.layermode.label}</td>
<td class="FormRowValue">{$form.layermode.html}</td>
</tr>
<tr class="ListColLvl1_name">
<td class="FormRowField">{$form.layer.label}</td>
<td class="FormRowValue">{$form.layer.html}</td>
</tr>
<!--<tr class="ListColLvl2_name">
<td class="FormRowField">{$form.scaling_factor.label}</td>
<td class="FormRowValue">{$form.scaling_factor.html}</td>
</tr> -->
<tr class="ListColLvl2_name">
<td class="FormRowField">{$form.popup.label}</td>
<td class="FormRowValue">{$form.popup.html}</td>
</tr>
<tr class="ListColLvl1_name" align="center">
<td class="FormRowField" colspan="2"><p class="oreonbutton">{$form.update.html}</p></td>
</tr>
</table>
<br>
<br>
<div style="color:blue">
<p onmouseover="this.style.color='red'"
onmouseout="this.style.color='blue'">
<font size="2"><img src="./img/enabled.gif"> Acces direct aux Onduleurs:</font>
</div>
<br>
<br>
<div align="center">
<table border="2" width="190px">
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> GTSE Le Teil.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"> <img src="./img/status2.gif"> UTSE Le Teil.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>0" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> GTN Annonay.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"> <img src="./img/status2.gif"> UTN Annonay.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> Pole Astier Froment.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> GTC St Peray.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> UTSO Aubenas.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> UTSO2 Aubenas.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> GTSO Aubenas.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> CMS Tournon.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> BDP Veyras.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> UTC Guilherand.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> TRAM Subdi Privas.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> Vanel.</td>
</tr>
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src="./img/status2.gif"> Hotel du departement.</td>
</tr>
</table>
</div>
<br>
<br>
<div style="color:blue">
<p onmouseover="this.style.color='red'"
onmouseout="this.style.color='blue'">
<font size="2"><img src="./img/enabled.gif"> Prise de main a distance:</font>
</div>
<br>
<br>
<div align="center">
<table border="2" width="200">
<tr>
<td height="20px" onmouseover="this.style.fontSize='13px'; this.style.backgroundColor='red'";" onmouseout="this.style.fontSize='10px'; this.style.backgroundColor='transparent';"><a href="<adresse_à_pointer>" target="Accès à l'onduleur !" target="blanck" style="color:black"><img src=./img/command.png> KVM-IP Hotel Dept.</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
{$form.hidden}
</form>
{$initJS}
Voila un maigre contribution , a++
PS: Dans le code, s'est pas target="Accès à l'onduleur !" , s'est title="Accès à l'onduleur !" , je corigerai de mon coté ;)