YAPS again about RS 2008 R2 Branding

Oh, all right.

I was not at all surprised when Octoni wrote back to say “but can’t we just hide the right-side link to Home with CSS”?

Apparently s/he just noticed it. I did try to say.

Well, I don’t think you can do this with CSS, because it’s in a table cell with a bunch of other content.  But below a quick and dirty sketch to show you how you can put a little javascript in the affected ASPX pages (look under ReportManager/Pages) to do what Octoni wants.

I still say this isn’t going to work too well — because users can still get to the Home page just by looking at the current URL in the Report Manager, wherever they happen to be, and slicing off the end of it.

I had to borrow some code to add load-time functionality into the Report Manager ASPX pages, which I got from here — because you need this code to run only after everything else is finished in the internal ASP.NET Report Manager code.  If you don’t delay this activity, there aren’t any tables available for your javascript to see and adjust.

This quick and dirty example worked for me in the Folder.aspx page.

<script type=”text/javascript”id=”LSNClientSideSSRSReportManagerCode”>

addLoadListener(HideRightSideHomeLink);

function HideRightSideHomeLink() {

   var bcTable = document.getElementsByTagName(“table” )[1];
   // you may not be able to depend on this explicit index,
   //you may need to iterate through and look for

   // the one with className = “msrs-topBreadcrumb”

   // might be different for each ASPX page for all I know… 
   var td = bcTable.rows[0].cells[1];
  
 td.innerHTML = td.innerHTML.replace( ‘Home’ , );
 }

// the following function from
// http://www.sitepoint.com/forums/showthread.php?
645490-Run-Javascript-Only-After-Page-Finishes-Loading

function addLoadListener(fn) {
   //mozilla and friends
   if (typeof window.addEventListener != ‘undefined’ ) {
       window.addEventListener( ‘load’ , fn, false );
   }
   //opera
   elseif (typeof document.addEventListener != ‘undefined’ ) {
       document.addEventListener( ‘load’ , fn, false );
   }
   //innernetz exploder
   elseif (typeof window.attachEvent != ‘undefined’ ) {
       window.attachEvent(‘onload’ , fn);
   }
   //the rest is pretty much for browsers that I doubt your
  
//CSS or anything else still supports like IE/Mac
   else {
       var oldfn = window.onload;
      if (typeof window.onload != ‘function’ ) {
          window.onload = fn;
      }
      else {
          window.onload =function () {
             oldfn();
             fn();
             };
         }
       }
    }
</script>

I imagine the *.aspx pages for Report Manager would all work similarly. And there’s probably a better way to do this by subclassing the Report Manager UI classes, but I’m not going to go there, because I think the whole thing is a really bad idea.

Repeat after me:

I will not fight with the Report Manager UI.  I will turn my back on it, and build a better one for my users.

Only when you start talking about the Report Manager does the idea of mediocrity become inextricably associated with SQL Server Reporting Services.

Funny. I used to say something very similar about FoxPro for Windows, in a universe long ago and far away.  Or, maybe not so funny.

I’m getting too old for this type of nonsense.