Advertisement
sweenig

Page IPSLA Type Default

Jan 14th, 2014
753
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.51 KB | None | 0 0
  1. This widget overrides the rtt type of this page whenever a group hasn't been manually specified.<div id="help"></div>
  2. <script>
  3. var passedgroupnumber = 0;
  4. var parentgroupnumber = 0;
  5. var ispageexplicit=false;
  6. var helpdiv = document.getElementById("help");
  7.  
  8. //get the iframe url RttTypes value and store in RttTypes (if passed)
  9. var iframeurl=location.search;
  10. iframeurl=iframeurl.replace('?','');
  11. var iframeargsarray=iframeurl.split('&');
  12. var iframeargsmatrix = new Array(iframeargsarray.length);
  13. for (var i = 0; i < iframeargsarray.length; i++){
  14.     iframeargsmatrix[i] = new Array(2);iframeargsmatrix[i] = iframeargsarray[i].split('=');}
  15. for (var j=0; j < iframeargsmatrix.length; j++){
  16.     if(iframeargsmatrix[j][0] == 'RttTypes'){passedgroupnumber = iframeargsmatrix[j][1];break;}}
  17. //passedgroupnumber contains the iframe's group.  If 0, no RttTypes was passed.
  18. //get the parent url parameters
  19. var parenturl=parent.document.location.search;
  20. parenturl=parenturl.replace('?','');
  21. var argsarray=parenturl.split('&');
  22. var argsmatrix = new Array(argsarray.length);
  23. for (var i = 0; i < argsarray.length; i++){argsmatrix[i] = new Array(2);argsmatrix[i] = argsarray[i].split('=');}
  24. for (var j = 0; j < argsmatrix.length; j++){
  25.     if (argsmatrix[j][0] == 'pg'){ispageexplicit=true;}
  26.     if (argsmatrix[j][0] == 'RttTypes'){parentgroupnumber = argsmatrix[j][1];}}
  27. //parentgroupnumber contains the parent url's group.  If 0, no group was specified.
  28.  
  29. if(ispageexplicit){
  30. if(passedgroupnumber != 0){
  31.     helpdiv.innerHTML = 'You have specified the RttTypes ' + passedgroupnumber + '. <br />Now edit this view and set the height to 0 to maximize available screen real estate. You should probably change the title of the browser view so that it indicates the default RttTypes.';
  32.     if (parentgroupnumber == 0){parent.document.location=parent.document.location.href + '&RttTypes=' + passedgroupnumber;}}
  33. else {
  34.     var helptext = 'You have not specified a RttTypes within the browser view\'s target URL.'
  35.     if (parentgroupnumber == 0){helptext = helptext + ' If you don\'t know what RttTypes to use, click the IP SLA Operations Types dropdown box at the top of this page and select a type. When the page refreshes, you will see updated instructions.';helpdiv.innerHTML = helptext;}
  36.     else {helptext += ' If you would like to set the currently selected RttTypes as the default RttTypes for this page, change the browser view\'s target URL to the following:<br />' + '../content/defaultgroup.html?RttTypes=' + parentgroupnumber ;helpdiv.innerHTML = helptext;}
  37. }}
  38. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement