SharePoint 2010 Hide Left Navigation

If you Google search the title of this blog post you will find numerous sites that tell you how to easily accomplish this via a simple CSS style change. Use a hidden content editor web part, just like my last post (except you don’t need jQuery), and add the following code:

<style>
BODY #s4-leftpanel { DISPLAY: none }
.s4-ca {MARGIN-LEFT: 0px }
</style>

Done. Simple. However, what if you want the ability to show and hide that on demand? Then you will need this handy JavaScript script code. Just like before, add a content editor web part to the page but this time don’t hide it. Add the following code and you will be able to show and hide the left navigation on demand:

<script language=”javascript”>
function toggle() {
var ele = document.getElementById(“s4-leftpanel”);
var s4 = document.getElementById(“MSO_ContentTable”);
var text = document.getElementById(“displayText”);
if(ele.style.display == “block”) {
ele.style.display = “none”;
s4.style.marginLeft = “0px”;
text.innerHTML = “show”;
}
else {
ele.style.display = “block”;
s4.style.marginLeft = “155px”;
text.innerHTML = “hide”;
}
}
</script>
<a id=”displayText” href=”javascript:toggle();”>Show</a> <== Click Here

Now you have two easy options for temporarily or permanently hiding the left navigation in SharePoint 2010.

There are a number of enhancements to this code that can be made to make it even more useful. The first is the bug that requires 2 clicks to get it working and the second would be setting the user’s selected preference in a cookie so that it always remembers the state that it was in the last time the user logged in. I may work on these in the future but feel free to post that code in the comments section or contact me directly and I will post an update or link to your blog!

Tim Ferro

SharePoint 2010 Access Denied Web Part Error

After upgrading to SharePoint 2010 some web part pages are showing an Error Web Part Error: Access denied. You do not have permission to perform this action or access this resource.“.  For sites without anonymous access, this can be mitigated with audience targeting of the web part. However, if that does not work or you need to have the page be anonymously accessible, but also have web parts on that page that have limited permissions, then you will need a different solution. This is not the perfect solution you are looking for, I am still waiting on Microsoft for that as well, but this is a simple jQuery trick that will hide that awful error and make the page render as you would expect (MOSS 2007 functionality). Just follow the following steps:

  1. Download the latest version of jQuery from their site: http://jquery.com/ and upload it to your server.
  2. At the bottom of the page add a content editor web part and make it hidden.
  3. Add the following code:

<script src=”your-server/jquery-1.6.1.min.js”></script>
<script language=”javascript”>
$(“span:contains(‘Error’)”).hide();
$(“div:contains(‘Access denied’):not(:has(div))”).hide();
</script>

The first line is a reference to the latest version of jQuery on your server. Please remove “your-server” and replace with the correct folder (don’t use absolute references). Make sure this reference works. (It is also possible to link to a Google hosted version of this file however I always use a local copy.) The second line is the beginning tag for writing JavaScript. The 3rd line finds all the “span” elements on the page that contain the word “Error” and then hides them. This might work too well so you need to make sure nothing else on the page is hidden as well that you don’t want hidden. The fourth line finds all the “div” elements that contain “Access denied”, but do not contain any other “div” elements, and hides them. This is crucial as I was unable to hide a “span” and had to use a “div” find and hide. However, since “div” tags are nested throughout this page without the caveat that makes sure the “div” tag doesn’t contain any nested “div” tags, this would have hidden most of the items on the page. The fifth line closes the script tag.

Tim Ferro

Don’t Bother Reading Linchpin

I made it through 108 pages of this worthless, psychobabble garbage before giving up and returning the book to the library. Let me save you the time and summarize the book for you: “Working hard isn’t enough, create emotional relationships, the world has changed, linchpins are what’s needed, your lizard brain will tell you otherwise, rinse, repeat”.  After reading this, I now wonder how Seth Godin is held in such high esteem. The entire book could (should) have been a Gen-Y centric blog post but instead it is drawn out over a few hundred pages of bullshit rhetoric. Here’s my advice: don’t read the book, do more than what is asked of you at work, be personable, be important but not indispensable. Counter to what Mr. Godin says, linchpins don’t get promoted because they are too important where they are at and no boss wants to lose that.

- Tim Ferro

The Girl Who Played With Fire…

is the amazing sequel to The Girl With The Dragon Tattoo! After a year or so break, our favorite protagonists are back at it with a mystery from Lisbeth’s dark past. It twists and turns and exposes more about her than she would want you to know. The climax at the end of the book leaves you hanging as to our heroines fate, but luckily the third book (of the Millennium Series) picks up immediately after this one ends. Another 10 out of 10 for Stieg Larsson.

- Tim Ferro

Review of Starbucked by Taylor Clark

“A Double Tall Tale of Caffeine, Commerce, and Culture” just about sums up this book. Starbucked is a short read that is pretty entertaining if you like coffee or business or culture and just want the 30,000 foot view with some interesting and entertaining stories. The history and astounding growth of Starbucks is quite interesting, as are the stories about the history of coffee and the culture surrounding all of them. I recommend this as a quick read but not as highly as some of the previous books I have just reviewed.

Tim Ferro

Skinny Bastard, the Bro Version of Skinny Bitch

After reading, and reviewing, Skinny Bitch, I decided to read the “Bro Version” called Skinny Bastard. I liked this book better because it was tailored to males which was more pertinent to me, but also because it was longer and contained more information. If you have read either of these books, there is no real need to read the other, but if you haven’t, pick up the gender appropriate one and read away! Check out my review of Skinny Bitch for more information about both books!

Tim Ferro

The Girl with the Dragon Tattoo was Gripping

Once I started reading, I could not put this book down. This book is riveting, dark, and deep. There are a number of incredibly interesting story arcs in this book that all interact seamlessly. At first there are separate stories of Lisbeth and Mikael and how they came to meet. Then there are their own personal issues. And finally there is the main mystery of the book; but then there is another story to wrap up at the end. Larsson blends murder mystery with interesting technology and character depth rarely seen. This first book of the Millennium Trilogy is a 10 out of 10.

Tim Ferro

God Hates Us All

Relax people, this is about the book featured on my favorite show: Californication. I would describe it as similar to Catcher in the Rye but over a longer period of time. If you are a fan of the show, it will help explain season 1 where this book is turned into a movie and Hank hates it. Though it was contrived completely as a tie-in to the show, it is a decent and short read. As fiction goes, it’s right up my alley as I also like The Cosmic Burrito and want to read Chronic City. This is a bit of a scatter brained review but I liked the book and would recommend it if you liked any of the other 3 books I have referenced or if you watch the show. If you don’t, start watching and read the book!

Tim Ferro

My Unexpected Review of Skinny Bitch

So I was out of town with only a couple of books and I ended up reading a ton and finished them rather quick, so I picked up the nearest book that looked interesting. My sister had read the book previously and I read an excerpt while visiting her, so I thought ‘what the heck’, and began reading.

It’s not long and though it’s heavy on the Veganism, it’s still an entertaining and interesting read. I could not believe all of the things it reported about the meat, dairy, and sugar substitute industries. It was eye opening. No, I am not turning into a Vegan but I am glad I know all the information. Even if you don’t change a thing, it’s still good to know all the facts. This was interesting enough that I am reading the book for males called Skinny Bastard.

Tim Ferro

Jim Cramer’s Getting Back to Even is a Must Read!

As a prerequisite to reading this book, first read Jim Cramer’s Stay Mad for Life. Once you have gotten a solid hold on your finances and retirement, then you are ready for this book.

Yes the market tanked. Yes we got screwed by others’ mistakes. Yes the market is less reliable than it ever has been. No, you should not take your money elsewhere. Now is the time to be in the market, and this is the book that will tell and show you how. Jim Cramer’s Getting Back to Even is the must read financial book of 2010 for every investor.

Jim lays out his financial advice in easy to follow steps and tells the real deal about the market. I have incorporated his advice into my own portfolio and have already seen gains. My advice is to read the whole book and latch on to certain investing strategies that can help short and long term. For the advanced investor, the chapter on options is a MUST READ. Once explained, it is both simple and genius. Long term, Jim’s advice on high dividend stocks and China are crucial to your strategy.

This book will help you make more money than any other book you read this year so move it to the top of your reading list!

Tim Ferro