none
Solutions for displaying "Task Hierarchy" on timesheet view RRS feed

  • General discussion

  • Hello,  I've run into a fairly serious delemma concerning users being able to identifiy the appropriate child/parent task relationships in order to fill in hours for the correct tasks as they appear on their timesheets.  In Project Server 2010, they have solved this issue by creating a "Task Hierarchy" field.  We are using Project Server 2007.

    I've started this thread to help get ideas for solving this problem.  Is it best to just upgrade in this case?  I'd like to avoid that for now if possible as we are in the middle of reaching full implementation of this technology, and I don't want to throw more hurtles out there.

    I've started a solution by using a custom web part that queries the database to find the task/parent relationship for each timesheet line, and updates the 'comment' field for each record, displaying the parent of the task. The query happens on the 'onPreRender' method of the web part.  It works as it is supposed to, but sadly there is still a timing issue.  I cannot seem to make the record updates BEFORE the timesheet is rendered on the page.  I'm messing around with using some javascript to force a client-side refresh after the page initially loads, but that is sloppy and causes the page to be refreshed a couple of times during a 'save' operation; causing the user to have to resend the data as it's in the middle of a GET/POST request.  Not going to work...

    Does anyone have any better ideas?  Should I be going about this a different way?  I tried attaching my code to a timesheet event handler "onCreated", but that executes too early, and the timesheet lines aren't even created by the time the code executes, so there are no values to query.

    Help!


    -Inquisit1
    Wednesday, November 17, 2010 4:50 PM

All replies

  • I've thought about using a timer job to run every so many seconds/minutes, but that seems like it would create far too much overhead and bog the server down....
    -Inquisit1
    Wednesday, November 17, 2010 4:54 PM
  • Well, I may have solved my own problem...  I'm using the javascript location.reload(true) function as I mentioned in my first post, but I'm wrapping the ClientScriptManager code that loads the script onto the page within an if statement that checks the 'Page.IsPostBack" property...

    if (!Page.IsPostBack) {

         ClientScriptManager clientscript = Page.ClientScript;

         string scriptURL = clientscript.GetWebResourceUrl(this.GetType(), "timesheet.tasks.page_refresh.js");

         clientscript.RegisterClientScriptInclude(this.GetType(), "refresh", scriptURL);

    }

    The 'page_refresh.js' file contains the following code:

     function refresh_page() {

         if (!readCookie("refresh")) {     // If cookie "refresh" cannot be found create the cookie and refresh the page

               createCookie("refresh","1");

               window.location.reload(true);

         }

         else createCookie("refresh","","-1");   // If the cookie is found, the page was already refreshed. Delete the cookie.

    }

    refresh_page();

     

    This solution seems to be working, and does not cause the page to be refreshed during post back events... I'll probably go with this unless anyone has a more elegant solution they wish to share.


    -Inquisit1
    Wednesday, November 17, 2010 8:39 PM