Advertisement
sweenig

Page Group Default

Jan 14th, 2014
793
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.29 KB | None | 0 0
  1. This widget overrides the page context of this page whenever a group hasn't been manually specified.<div id="help"></div>
  2. <script>
  3. var passedgroupnumber = 0;var parentgroupnumber = 0;var ispageexplicit=false;
  4. var helpdiv = document.getElementById("help");
  5. var iframeurl=location.search;
  6. iframeurl=iframeurl.replace('?','');
  7. var iframeargsarray=iframeurl.split('&');
  8. var iframeargsmatrix = new Array(iframeargsarray.length);
  9. for (var i = 0; i < iframeargsarray.length; i++){
  10.        iframeargsmatrix[i] = new Array(2);iframeargsmatrix[i] = iframeargsarray[i].split('=');}
  11. for (var j=0; j < iframeargsmatrix.length; j++){
  12.        if(iframeargsmatrix[j][0] == 'groupnumber'){passedgroupnumber = iframeargsmatrix[j][1];break;}}
  13. var parenturl=parent.document.location.search;
  14. parenturl=parenturl.replace('?','');
  15. var argsarray=parenturl.split('&');
  16. var argsmatrix = new Array(argsarray.length);
  17. for (var i = 0; i < argsarray.length; i++){
  18.        argsmatrix[i] = new Array(2);argsmatrix[i] = argsarray[i].split('=');}
  19. for (var j = 0; j < argsmatrix.length; j++){
  20.        if (argsmatrix[j][0] == 'pg'){ispageexplicit=true;}
  21.        if (argsmatrix[j][0] == 'GroupID'){parentgroupnumber = argsmatrix[j][1];}}
  22. if(ispageexplicit){
  23. if(passedgroupnumber != 0){
  24.        helpdiv.innerHTML = 'You have specified the GroupID ' + 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 path to the default group.';
  25.         if (parentgroupnumber == 0){parent.document.location=parent.document.location.href + '&GroupID=' + passedgroupnumber;}}
  26. else {
  27.         var helptext = 'You have not specified a group number within the browser view\'s target URL.'
  28.         if (parentgroupnumber == 0){helptext = helptext + ' If you don\'t know what GroupID to use, click the \'[change]\' link at the top of this page and select a group. When the page refreshes, you will see updated instructions.';helpdiv.innerHTML = helptext;}
  29.         else {helptext += ' If you would like to set the currently selected group as the default page context for this page, change the browser view\'s target URL by adding the following:<br />' + '?groupnumber=' + parentgroupnumber ;helpdiv.innerHTML = helptext;}
  30. }}
  31. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement