Hi,
I hope you can help.
I have created an application the reads an xml file into a aspx page. The page has javascript to enable the data to be placed on a graphical timeline (this is a widget called timeline - http://www.simile-widgets.org/timeline/). A new xml file will be provisioned on a user click event.
The problem is that the reading of a new xml file will not work in internet explorer, although it will works fine in firefox. I have tried clearing cache but this makes no difference.
Below is 1. the source code and 2. the code behind.
The application in question can be found at www.realtimegovernance.com
Can you advise of a course of action.
Regards
Source Code
--------------------
<%@ Page Language="C#" MasterPageFile="~/MasterPages/GMP.master" AutoEventWireup="true" CodeFile="Controls.aspx.cs" Inherits="Controls" Title="Untitled Page" %>
<asp:Content ID="Content2" ContentPlaceHolderID="cphHeader" Runat="Server">
<script src="timeline_2.3.0/src/webapp/api/timeline-api.js" type="text/javascript"></script>
<script type="text/javascript">
var tl;
function onLoad() {
var eventSource = new Timeline.DefaultEventSource();
var zones = [
{ start: "Fri Nov 22 1963 00:00:00 GMT-0600",
end: "Mon Nov 25 1963 00:00:00 GMT-0600",
magnify: 10,
unit: Timeline.DateTime.DAY
},
{ start: "Fri Nov 22 1963 09:00:00 GMT-0600",
end: "Sun Nov 24 1963 00:00:00 GMT-0600",
magnify: 5,
unit: Timeline.DateTime.HOUR
},
{ start: "Fri Nov 22 1963 11:00:00 GMT-0600",
end: "Sat Nov 23 1963 00:00:00 GMT-0600",
magnify: 5,
unit: Timeline.DateTime.MINUTE,
multiple: 10
},
{ start: "Fri Nov 22 1963 12:00:00 GMT-0600",
end: "Fri Nov 22 1963 14:00:00 GMT-0600",
magnify: 3,
unit: Timeline.DateTime.MINUTE,
multiple: 5
}
];
var zones2 = [
{ start: "Fri Nov 22 1963 00:00:00 GMT-0600",
end: "Mon Nov 25 1963 00:00:00 GMT-0600",
magnify: 10,
unit: Timeline.DateTime.WEEK
},
{ start: "Fri Nov 22 1963 09:00:00 GMT-0600",
end: "Sun Nov 24 1963 00:00:00 GMT-0600",
magnify: 5,
unit: Timeline.DateTime.DAY
},
{ start: "Fri Nov 22 1963 11:00:00 GMT-0600",
end: "Sat Nov 23 1963 00:00:00 GMT-0600",
magnify: 5,
unit: Timeline.DateTime.MINUTE,
multiple: 60
},
{ start: "Fri Nov 22 1963 12:00:00 GMT-0600",
end: "Fri Nov 22 1963 14:00:00 GMT-0600",
magnify: 3,
unit: Timeline.DateTime.MINUTE,
multiple: 15
}
];
var theme = Timeline.ClassicTheme.create();
Timeline.ThemeName = 'dark-theme'
theme.event.bubble.width = 250;
var date = '<%=CurrentDateTime%>';
var bandInfos = [
Timeline.createHotZoneBandInfo({
width: "30%",
intervalUnit: Timeline.DateTime.DAY,
intervalPixels: 200,
zones: zones,
eventSource: eventSource,
date: date,
timeZone: -6
// theme: theme
}),
Timeline.createHotZoneBandInfo({
width: "60%",
intervalUnit: Timeline.DateTime.WEEK,
intervalPixels: 200,
zones: zones,
eventSource: eventSource,
date: date,
timeZone: -6
// theme: theme
}),
Timeline.createHotZoneBandInfo({
width: "10%",
intervalUnit: Timeline.DateTime.MONTH,
intervalPixels: 200,
zones: zones2,
eventSource: eventSource,
date: date,
timeZone: -6,
overview: true
// theme: theme
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
for (var i = 0; i < bandInfos.length; i++) {
bandInfos
.decorators = [
new Timeline.SpanHighlightDecorator({
startDate: "Fri Nov 22 1963 12:30:00 GMT-0600",
endDate: "Fri Nov 22 1963 13:00:00 GMT-0600",
color: "#FFC080",
opacity: 50,
startLabel: "shot",
endLabel: "t.o.d.",
// theme: theme,
cssClass: 't-highlight1'
}),
new Timeline.PointHighlightDecorator({
date: "Fri Nov 22 1963 14:38:00 GMT-0600",
color: "#FFC080",
opacity: 50,
//theme: theme,
cssClass: 'p-highlight1'
}),
new Timeline.PointHighlightDecorator({
date: "Sun Nov 24 1963 13:00:00 GMT-0600",
color: "#FFC080",
opacity: 50
//theme: theme
})
];
}
tl = Timeline.create(document.getElementById("tl"), bandInfos, Timeline.HORIZONTAL);
tl.loadXML("Xml/mySchema.xml", function(xml, url) { eventSource.loadXML(xml, url); });
}
var resizeTimerID = null;
function onResize() {
if (resizeTimerID == null) {
resizeTimerID = window.setTimeout(function() {
resizeTimerID = null;
tl.layout();
}, 500);
}
}
function themeSwitch(){
var timeline = document.getElementById('tl');
timeline.className = (timeline.className.indexOf('dark-theme') != -1) ? timeline.className.replace('dark-theme', '') : timeline.className += ' dark-theme';
}
</script>
<style type="text/css">
.timeline-event-bubble-title{font-size:14px;color:Black};
</style>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" Runat="Server">
<div class="tab-inner" style="margin-bottom:0; padding-bottom:0">
<table style="width: 1227px" class="default" cellpadding="5">
<tr>
<td>
<h2>Plans</h2></td>
<td style="width: 271px">
<asp:DropDownList ID="ddlPlans" AutoPostBack="true" EnableViewState="true" runat="server"
onselectedindexchanged="ddlPlans_SelectedIndexChanged">
</asp:DropDownList>
</td>
<td style="width: 60px">
</td>
<td style="width: 263px">
<asp:DropDownList ID="ddlRespUser" runat="server" Visible="False">
</asp:DropDownList></td>
<td style="width: 60px">
</td>
<td style="width: 340px">
<asp:DropDownList ID="ddlProjectType" runat="server" Visible="False">
</asp:DropDownList></td>
<td style="width: 340px">
<asp:Button ID="btnFilterSelect" runat="server" Text="Select" Visible="False" /></td>
</tr>
</table>
</div>
<div id="tl" style="height: 360px; margin: 2em; font-size:12px">
</div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</asp:Content>
Code Behind
--------------------
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Xml;
using System.IO;
public partial class Controls : System.Web.UI.Page
{
protected string CurrentDateTime
{
get
{
return DateTime.Now.ToString("ddd, dd MMM yyyy HH':'mm':'ss 'GMT'");
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Remove caching from page to prevent 'back button' issues
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-2d);
Response.Expires = -1500;
Response.CacheControl = "no-cache";
Response.Cache.SetNoStore();
int PlanID;
if (!string.IsNullOrEmpty(Convert.ToString(Request.QueryString["PlanID"])))
{
PlanID = int.Parse(Request.QueryString["PlanID"]);
}
else
{
PlanID = Convert.ToInt16(Session["PlanID"]);
}
XmlDataWriter.GetXmlFile(PlanID, -1, "-1");
GetDropDownList();
HtmlGenericControl bodyRTG = (HtmlGenericControl)this.Page.Master.FindControl("bodyRTG");
bodyRTG.Attributes.Add("onload", "onLoad();");
bodyRTG.Attributes.Add("onresize", "onResize();");
}
}
private static DataTable GetPlansForProcessOrProject(int planId, int UserID)
{
using (SqlConnection cn = new SqlConnection(AppConfig.connectionString))
{
SqlDataAdapter adapter = new SqlDataAdapter("usp_PlanNodeListPlusCPtDef", cn);
adapter.SelectCommand.CommandType = CommandType.StoredProcedure;
adapter.SelectCommand.Parameters.AddWithValue("planid", planId);
adapter.SelectCommand.Parameters.AddWithValue("UserID", UserID);
adapter.SelectCommand.Parameters.AddWithValue("CPtFlag", 0);
DataTable dt = new DataTable();
cn.Open();
adapter.Fill(dt);
return dt;
}
}
private void GetDropDownList()
{
this.ddlPlans.DataSource = GetPlansForProcessOrProject(Convert.ToInt16(Session["PlanID"]),Convert.ToInt16(Session["UserID"]));
this.ddlPlans.DataTextField = "Name";
this.ddlPlans.DataValueField = "ID";
this.ddlPlans.DataBind();
if (!string.IsNullOrEmpty(Convert.ToString(Request.QueryString["PlanID"])))
{
foreach (ListItem item in ddlPlans.Items)
{
if (item.Value == Convert.ToString(Request.QueryString["PlanID"]))
item.Selected = true;
else
item.Selected = false;
}
}
}
protected void ddlPlans_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Redirect(ResolveUrl("~/Controls.aspx?PlanID=" + int.Parse(ddlPlans.SelectedValue)));
}
}