in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

Another Hack's SharePoint Experiences

I've been playing with SharePoint for a few years now. Every now and again I'll post something that I found interesting about SharePoint or computing in general.

April 2004 - Posts

  • Upgrading from Windows 2000 to Windows 2003 and Sharepoint

    This is actually a problem with the Windows upgrade, but nonetheless the problem manifested itself while trying to install the sharepoint central database.

    I had a development computer that was running Windows 2000 Server.  I wanted to run SharePoint and use Visual Studio.Net 2003 to create some web parts.  However, to do so, I had to upgrade to Windows 2003 Server.  Normally I don't upgrade, since problems occur.  However, I had heard some good things with the upgrade wizard. Note to self: never believe them.  The upgrade itself went smoothly, however, I started having problems once I tried installing SharePoint.

    The installation itself was smooth, but once I had to configure/create the central database, I started having problems.  I'd fill out all the information, but every time I'd click submit I would be forwarded to a generic error message screen.  I then tried creating the DB from the command line, by running: “stsadm -o setconfigdb -databaseserver [name] -databasename [db name]” Then I got a decent error: GetTextExtentPointI could not be located in msdart.dll.  I found some good information here, and it fixed my problem for now.  Basically, you need to copy over the oledb32.dll from another server that got a fresh install of Windows Server 2003 to the upgrade server.

    I hope that helps someone else out.

  • Microsoft and the CSS demons

    Like I've mentioned before, I've customized a lot of my sharepoint site by changing the style sheet and backend standard graphics.  Unfortunately, the limitation is that you have to rely on Microsoft  to properly assign stylesheet classes properly to all the elements. For reference, here's a link to a screen shot of my page, since the gallery still won't work.

    My latest issue was that a user suggested the colors in the list view nav bar change from the default blue to white.  I didn't have a problem with this one bit - I viewed the source of the list page, found the link, and saw that it belonged to class ms-toolbar (fairly intuitive, huh?).  So I opened the style sheet (Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\LAYOUTS\1033\STYLES - default location) and changed the sheet to have color: #FFFFFF;.  Problem solved.

    However, someone coding the web part had a brain fart, because any links within the web part are assigned the same class.  However, the background at this point is also white, so you get invisible text.  I didn't even realize that until I got another complaint not 5 minutes later.  Unfortunately, this wasn't a case of a higher level tag being assigned the ms-toolbar class: it was the a tag itself.  Now, will someone please explain why your class would be called ms-toolbar, and you'd have something in the main content window be assigned to the ms-toolbar class?  It didn't and still doesn't compute for me.

    So, if anyone out there has any ideas for how to work around this, I'd love to hear them.  Right now, I just changed the color of ms-toolbar to #990000 so that you can see it in both places.  It's still hard to see against my orange background, though.  Shoot me a line if you have any ideas.

  • Alright! Got the listeners to work!

    Addendum: People have been asking me why I wanted to do this. I explained it in a previous blog (I think) but here's the short version:

    I have an Issues List for internal system operations.  If a phone goes down, or a computer dies, a user could enter a ticket into the system. However, most of our users are ignorant as to who would fix each type of issue.  So I have two drop down boxes: a Category and Assigned to.  When you select a certain category, the assigned to box automatically changes to the person who handles that type of issue. The “listener“ therefore is used to listen to the onChange event for the category.

    ------------------------------------------------------------------------------

    W00t!  I got the listeners to work.  Here is the JavaScript, and then I'll explain it below:

    window.onload = startup;
    function startup()
    {
     setAssignment();
     document.forms[0].elements[getElementIndex("OWS:Category")].onchange = setAssignment;
    }

    function setAssignment()
    {
     var getCategoryTagIndex, getAssignToTagIndex, getCategoryText;
     getAssignedToTagIndex = getElementIndex("AssignedTo");
     getCategoryTagIndex = getElementIndex("OWS:Category");
     getCategoryText = getSelectedElement(document.forms[0].elements[getCategoryTagIndex]);
     setAssignedTo(document.forms[0].elements[getCategoryTagIndex], document.forms[0].elements[getAssignedToTagIndex]); 
    }

    function setAssignedTo(CategoryObj,AssignedToObj)
    {
     switch(CategoryObj.options[CategoryObj.selectedIndex].text)
     {
      case "LoopNet.com website error":
       searchAssignedTo("[User Name]", AssignedToObj);
       break;
      case "InsideLoop website error/suggestion":
       searchAssignedTo("[User Name", AssignedToObj);
       break;
      case "E-mail":
       searchAssignedTo("[User Name]", AssignedToObj);
       break;
      case "Network file access":
       searchAssignedTo("[User Name]", AssignedToObj);
       break;
      case "Phone problem":
       searchAssignedTo("[User Name]", AssignedToObj);
       break;
      case "Local workstation problem":
       searchAssignedTo("[User Name]", AssignedToObj);
       break;
      case "Other":
       searchAssignedTo("[User Name]", AssignedToObj);
       break;
      default:
       searchAssignedTo("[User Name]", AssignedToObj);
       break;
     }
    }
    function searchAssignedTo(userName, AssignedToObj)
    {
     for(i = 0; i < AssignedToObj.options.length; i++)
     {
      if (userName.toLowerCase() == AssignedToObj.optionsIdea.text.toLowerCase())
      {
       AssignedToObj.optionsIdea.selected = true;
       return;
      }
     }
    }
    function getSelectedElement(selectObj)
    {
     return selectObj.options[selectObj.selectedIndex].text;
    }
    function getElementIndex(elementName)
    {
     var e;
     e = -1;
     for (i = 1; i
     {
      var temp;
      temp = document.forms[0].elementsIdea.name;
      if(temp.indexOf(elementName)>= 0)
       {
       e = i;
       break;
       }
     }
     return e; 
    }


    //-->

    I hope this shows up, since it's javascript. Basically I put this at the end of my issues form, right after the end table tag. This is so that the page loads before the script runs, allowing time for the web part to load.  The first thing I do is set the window.onload event handler to be my startup function.  That way the values are set on every page load.  Within that I run two other commands.  First, I run the setAssignment function, to do the initial setting of the assigned task, just in case the user doesn't change it.  Then I set the onchange event for my Category to be the setAssignment again.  You'll notice a couple of things.  First of all, we aren't sure of the names of the form or the drop down list.  So instead of using the name, we use the forms[0] element and then search for the element index for the category drop down list.  So, here's a description of the functions:

    startup: is the window.onload event handler
    setAssignment: the event handler for the Category select drop down box. It calls the functions to find the indexes of the Assigned To box and the Category box, then passes those objects to the actual function that changes the assignment.
    setAssignedTo: the function that actually changes the assignment. It takes two parameters: the assigned to box object and the category box object. It reads the category, then loops through a switch. The switch reads the category, and then sets the proper assignment. If none of the options are found, then it sets the assignment to the administrator (me).
    searchAssignedTo: basically just a loop that checks the the name given to the name in the assignment box. If they are the same, it sets that selectedIndex to true. It could be included in the setAssignedTo function, but this saves having to code it a grip of times
    getSelectedElement: gets the name of the element passed to it. I had it here for debugging purposes; it can be removed.
    getElementIndex: gets the index of the element that matches the string you pass into it. Be careful here. You want ot make sure that you pass the right name in. I thought I could search for an element with the word Category in it, but you can't. You need to look for OWS:Category. So watch yourself. You can find these names by opening the form and then browsing through the source.

    So that's basically it. Let me know if you have any questions on this, and I'll be happy to explain. It took a team effort here to come up with the right script. Hopefully this will save you some time.

  • Setting up JavaScript listeners

    UPDATE: I got this to work - see the next post!

    So I'm trying to set up a listener on my Issues list.  It's not going well.  Microsoft looks to be using some kind of custom drop down box, rather than a stardard select.  It's killing me.  When I find out how to fix it, I'll post it here.  Hopefully it won't take more than a day.


Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts