473,804 Members | 3,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Javascript/DHTML in Sharepoint

21 New Member
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 2801
acoder
16,027 Recognized Expert Moderator MVP
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
3525
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. - Creating training material themselves in many langauges built to order. The main thing I'm thinking about for the company is maybe a sort of content
13
9660
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 assigned to a variable and output using document.write. (Note, there is no submit button or other form elements. Basically
2
2001
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 explain from the basics of javascript, to more complex things such as dhtml and dom onto things like creating javascript objects (if that is possible, but u get the idea). rather than this is how you make a drop down menu tutorial; this is how you
1
1325
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. When I put it into DHTML, it treats everything between the " " like a constant. When I remove the quotes, it gives me an error. One of the versions I have tried is: DQM_rollover_image12 = "/images/nav_hospital.gif" DQM_rollover_wh12 =...
1
1346
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 ready. Now that Sharepoint 2007 is ready (and being demo'd) I am getting questions regarding features available in the new Sharepoint that we do not currently have. I am reluctant to throw away the current Intranet and replace it with...
8
2116
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 Server2003 and also SharePoint Portal Server Product. Whenever I try to learn the details of what the SharePoint services have to offer for asp.net developers all roads lead to a video, recorded in 2003 that has to do with "asp.net" and sharepoint....
20
2759
by: Neil | last post by:
What is Sharepoint, and should I care?
1
4520
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 the timeline. Simile Timeline uses DHTML and AJAX. Any suggestions? Sample of code: <data> <event start="Jun 02 2008 09:00:00 GMT" end="Aug 02 2008 16:00:00 GMT" isDuration="true" title="Internship at LMC"...
2
4408
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 Library using UpdateListsItem method & with it being a clientside i need to pass NT Credentials to the List Please provide code as I have to get this going & have no clue. Please Assist
0
9587
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7623
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3827
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2998
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.