Advertisement
Guest User

xymonbodyfooter.cfg

a guest
Mar 26th, 2012
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.92 KB | None | 0 0
  1.  
  2. <!--
  3. -- Adds hotlinks to connect to the server. To use:
  4. -- Copy this into the file xymonbodyfooter.cfg alongside xymonserver.cfg.
  5. -- In xymonserver.cfg, set: XYMONBODYFOOTER="file:$XYMONHOME/etc/xymonbodyfooter.cfg"
  6. -- Create COMMENT or DESCR strings in the form "...(connect: ssh, rdp, telnet)..."
  7. -->
  8.  
  9. <!-- we pull in jquery and use it to manipulate the hostname to add links -->
  10. <script src="http://code.jquery.com/jquery-latest.js"></script>
  11. <script type="text/javascript">
  12. var replaceConnect=1; // replace (connect:...) string, zero to disable
  13. jQuery('.line span').replaceWith(function() {
  14. var title=jQuery(this).attr("title");
  15. if (title == null) { return; }; // no title? nothing to do
  16.  
  17. var url = jQuery.trim(jQuery(this).text());
  18. var servertext = jQuery.trim(jQuery(this).text());
  19.  
  20. var svclist=[];
  21. var titlematch=title.match(/^(.*)\s*\(connect:\s*(.*)\)\s*(.*)/);
  22. if (titlematch != null) {
  23. svclist=titlematch[2].split(/\s*,\s*/);
  24. if (replaceConnect == 1) { title=titlematch[1]+titlematch[3]; };
  25. };
  26.  
  27. var returnstr = "";
  28. for (var i=0; i < svclist.length; i++) {
  29. svc=svclist[i];
  30. // webby URLs open in new window
  31. returnstr += '<span title="connect with '+svc+'">';
  32. returnstr += ' <a href="' + svc + '://' + url + '"';
  33. if (svc == 'http' || svc == 'https') { returnstr += '" target="_blank"'; };
  34. returnstr += '>' + svc + '</a>';
  35. returnstr += '</span>';
  36. };
  37. return '<span title="'+title+'">' + servertext + '</span>' + '<font size="-2">' + returnstr + '</font>';
  38. });
  39. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement