473,408 Members | 2,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Using Javascript/DHTML in Sharepoint

I have a html file with javascript and am loading information into it with a xml file stored within sharepoint. I am having problems getting the dates to appear correctly, specifically, start date and due dates.
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  3. <title>Timeline-WorkPrint</title>
  4. <html>
  5.   <head>
  6.     <script src="https://sharepoint.global.lmco.com/sites/BSAGroup/BSATestSite/Shared%20Documents/Timeline%20Documents/timeline/api/timeline-api.js" type="text/javascript"></script>
  7.     <script  src="date.js" type="text/javascript"></script>
  8.     <script>
  9. var tl;
  10. var eventSource = new Timeline.DefaultEventSource();
  11.  
  12. function openXMLfile(file)
  13. {
  14.     if (document.implementation && document.implementation.createDocument)
  15.     {
  16.         xmlDoc = document.implementation.createDocument("", "", null);
  17.     }
  18.     else if (window.ActiveXObject)
  19.     {
  20.         xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
  21.         xmlDoc.async="false";
  22.      }
  23.     else
  24.     {
  25.         alert('Your browser can\'t handle this script');
  26.         return;
  27.     }
  28.     xmlDoc.load(file);
  29.     return(xmlDoc);
  30. }
  31.  
  32. function takeEventOut(url)
  33. {
  34.     xmlDoc = openXMLfile(url);
  35.     var rows = xmlDoc.getElementsByTagName('z:row');
  36.  
  37.     for (j=0;j<rows.length;j++)
  38.     {
  39.         //document.write(rows.item(j).getAttribute('ows_DueDate'));
  40.         // taking the event info from the xml
  41.         var dateEvent = Date.parseExact(rows.item(j).getAttribute('ows_DueDate'), "yyyy-dd-mm hh:mm:ss");
  42.  
  43.         var title = rows.item(j).getAttribute('ows_LinkTitle');
  44.         var status = rows.item(j).getAttribute('ows_Status');
  45.  
  46.         /*id,
  47.         start, end, latestStart, earliestEnd, instant, 
  48.         text, description, image, link,
  49.         icon, color, textColor */
  50.         var color;
  51.         switch (status)
  52.         {
  53.             case "In Progress":
  54.                 color = "yellow";
  55.                 break
  56.             case "Not Started":
  57.                 color = "red";
  58.                 break
  59.                 case "Completed":
  60.                 color = "green";
  61.                 break
  62.             default:
  63.                 color = "black";
  64.                 break
  65.         }
  66.         var evt = new Timeline.DefaultEventSource.Event( 
  67.                  dateEvent , //start
  68.                  new Date(dateEvent).addDays(+2), //end
  69.                  dateEvent ,//dateEvent.addMonths(1), //latestStart
  70.                  new Date(dateEvent).addDays(+2) ,//dateEvent.addWeeks(1), //earliestEnd
  71.                  true, //instant
  72.                  title, //text
  73.                 status, 0,0 ,0 ,color  //description
  74.                   );
  75.         // adding it to the source
  76.         //document.write(evt.getStart.toString);
  77.          eventSource.add(evt);
  78.  
  79.     }    
  80.  
  81.  
  82. }
  83.  
  84. function onLoad()
  85. {
  86.         takeEventOut("https://sharepoint.global.lmco.com/sites/BSAGroup/BSATestSite/_vti_bin/owssvr.dll?XMLDATA=1&List={C9DA434F-216F-4C7C-9D5E-A5AC72DBA45B}&View={8315210C-1A47-47B4-8BE3-B6271BC97E8B}&RowLimit=0&RootFolder"); 
Jul 9 '08 #1
1 2781
acoder
16,027 Expert Mod 8TB
I have a html file with javascript and am loading information into it with a xml file stored within sharepoint. I am having problems getting the dates to appear correctly, specifically, start date and due dates.
What problems? Do you get errors? It seems as if you've added methods to the Date object. It might help if you post the code in date.js
Jul 10 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Simon Harvey | last post by:
Whato chaps, I work (or am hoping to work! :) for a company that specialises in the following: - Localisation of media - including software, manuals, literature and training material. -...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
2
by: mr_burns | last post by:
hi there, i would like a book that will explain concepts of javascript and dhtml instead of, for example, ten tutorials on how to do specific things in js or dhtml. ideally a book thats can...
1
by: sdonohue | last post by:
I am not very good at DHTML, but I have a set of links that use DHTML and they work :) But now the customer wants to have one of my DHTML links call a javascript function when it is clicked on. ...
1
by: AGH | last post by:
I have an Intranet based on ASP.NET 2.0 using Webparts to give a similar experience to Sharepoint. This development was made as Sharepoint 2003 did not suit our needs and Sharepoint 2007 was not...
8
by: GaryDean | last post by:
I was advised by a Microsoft speaker at a local .Net conference that "SharePoint" had a lot to offer for asp.net developers. I've spent a few hours hunting down links on Sharepoint Services in...
20
by: Neil | last post by:
What is Sharepoint, and should I care?
1
by: doublestack | last post by:
Hi everyone, I have a xml file that Simile Timeline uses to call events...Some of the events have links in them and I need to have those links open a new window. As it stands now the links replace...
2
by: ismailc | last post by:
Good day, I need help. I would like to Update a Sharepoint List (Document Library) Folders using Web Services with Javascript. I have searched on Goggle but nothing that updates a document...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.