|
From: <mas...@us...> - 2007-07-17 17:25:14
|
Revision: 47
http://svn.sourceforge.net/mp-webinterface/?rev=47&view=rev
Author: maschine
Date: 2007-07-17 10:25:09 -0700 (Tue, 17 Jul 2007)
Log Message:
-----------
Guide changes.
Modified Paths:
--------------
trunk/Version2/Web App/MPW/Default.aspx.cs
trunk/Version2/Web App/MPW/css/mpw_style.css
Modified: trunk/Version2/Web App/MPW/Default.aspx.cs
===================================================================
--- trunk/Version2/Web App/MPW/Default.aspx.cs 2007-04-25 20:34:27 UTC (rev 46)
+++ trunk/Version2/Web App/MPW/Default.aspx.cs 2007-07-17 17:25:09 UTC (rev 47)
@@ -14,111 +14,149 @@
public partial class _Default : System.Web.UI.Page
{
- private DateTime guideStart = DateTime.Now;
+ private DateTime guideStart;
private DateTime guideEnd;
protected void Page_Load(object sender, EventArgs e)
{
- guideEnd = guideStart.AddHours(3);
+ int mins = DateTime.Now.Minute;
+ guideStart = DateTime.Now.Subtract(new TimeSpan(0, mins, 0));
+ if (mins >= 30)
+ {
+ guideStart = guideStart.AddMinutes(30);
+ }
- //Establish the connection to the TV Server and the DB.
- MPWUtils.SetupConnection();
+ guideEnd = guideStart.AddHours(3);
- // Get a list of all tv-channels
- IList channels = Channel.ListAll();
+ //Establish the connection to the TV Server and the DB.
+ MPWUtils.SetupConnection();
- // List all groups
- IList groups = ChannelGroup.ListAll();
+ // Get a list of all tv-channels
+ IList channels = Channel.ListAll();
- // Remove non-TV channels
- foreach (Channel channel in channels)
- {
- if (!channel.IsTv)
- channels.Remove(channel);
- }
+ // List all groups
+ IList groups = ChannelGroup.ListAll();
- //The Time
- TableRow timerow = new TableRow();
- TableCell spacer = new TableCell();
- timerow.Cells.Add(spacer);
+ // Remove non-TV channels
+ foreach (Channel channel in channels)
+ {
+ if (!channel.IsTv)
+ channels.Remove(channel);
+ }
- for (int i = 0; i < 3; i++)
- {
- TableCell cell = new TableCell();
- cell.Text = "| " + guideStart.AddHours(i).ToShortTimeString();
- cell.Width = 180;
- timerow.Cells.Add(cell);
- }
- Guide.Rows.Add(timerow);
+ //The Time
+ TableRow timerow = new TableRow();
+ TableCell spacer = new TableCell();
+ timerow.Cells.Add(spacer);
- //Iterate through all the channels
- foreach (Channel channel in channels)
- {
- TableRow r = new TableRow();
- TableCell cell_channel = new TableCell();
- TableCell cell_program = new TableCell();
- cell_program.ColumnSpan = 3;
+ for (int i = 0; i < 3; i++)
+ {
+ TableCell cell = new TableCell();
+ cell.Text = "| " + guideStart.AddHours(i).ToShortTimeString();
+ cell.Width = Unit.Percentage(30);
+ timerow.Cells.Add(cell);
+ }
+ Guide.Rows.Add(timerow);
- Label lbl_channel = new Label();
- lbl_channel.Text = "<strong>" + channel.Name + "</strong>";
+ //Iterate through all the channels
+ foreach (Channel channel in channels)
+ {
+ TableRow r = new TableRow();
+ TableCell cell_channel = new TableCell();
+ TableCell cell_program = new TableCell();
+ cell_program.ColumnSpan = 3;
- cell_channel.Controls.Add(lbl_channel);
- cell_channel.CssClass = "guideChannel";
+ cell_channel.CssClass = "logocell";
- try
- {
- Program current = channel.GetProgramAt(guideStart);
+ Image channelLogo = new Image();
+ channelLogo.CssClass = "channellogo";
+ channelLogo.ImageUrl = MPWUtils.getChannelLogoPath(this.Server.MapPath("~/TVLogos/"), channel.Name);
- Table programsTable = new Table();
- TableRow programsRow = new TableRow();
+ if (channelLogo.ImageUrl != "")
+ {
+ cell_channel.Controls.Add(channelLogo);
+ Label br = new Label();
+ br.Text = "<br />";
+ cell_channel.Controls.Add(br);
+ }
- TableCell firstcell = new TableCell();
- firstcell.CssClass = "guidecell";
+ Label lbl_channel = new Label();
+ lbl_channel.Text = "<strong>" + channel.Name + "</strong>";
- TimeSpan widthTime = current.EndTime - guideStart;
- Unit widthPixel = new Unit(widthTime.Minutes.ToString());
- firstcell.Width = widthPixel;
- firstcell.Text = current.Title;
- programsRow.Cells.Add(firstcell);
+ cell_channel.Controls.Add(lbl_channel);
+ cell_channel.CssClass = "guideChannel";
- bool more = true;
-
- while (more == true)
- {
- Program next = channel.GetProgramAt(current.EndTime.AddMinutes(1));
- if (next.EndTime <= guideEnd)
+ try
{
- TableCell nextcell = new TableCell();
- nextcell.CssClass = "guidecell";
+ Program current = channel.GetProgramAt(guideStart);
- widthTime = next.EndTime - next.StartTime;
- widthPixel = new Unit(widthTime.Minutes.ToString());
- nextcell.Width = widthPixel;
- nextcell.Text = next.Title;
- programsRow.Cells.Add(nextcell);
- current = next;
+ Table programsTable = new Table();
+ programsTable.CssClass = "guidetable";
+ programsTable.Width = Unit.Percentage(100);
+ TableRow programsRow = new TableRow();
+
+ TableCell firstcell = new TableCell();
+ firstcell.CssClass = "guidecell";
+
+ TimeSpan widthTime = current.EndTime - guideStart;
+ int width = Int32.Parse(widthTime.Hours.ToString()) * 60;
+ width += Int32.Parse(widthTime.Minutes.ToString());
+ firstcell.ColumnSpan = width / 2;
+ firstcell.Text = current.Title + " " + width.ToString();
+ programsRow.Cells.Add(firstcell);
+
+ bool more = true;
+
+ while (more == true)
+ {
+ Program next = channel.GetProgramAt(current.EndTime.AddMinutes(1));
+ if (next.EndTime <= guideEnd)
+ {
+ TableCell nextcell = new TableCell();
+ nextcell.CssClass = "guidecell";
+
+ widthTime = next.EndTime - next.StartTime;
+ width = Int32.Parse(widthTime.Hours.ToString()) * 60;
+ width += Int32.Parse(widthTime.Minutes.ToString());
+ nextcell.ColumnSpan = width / 2;
+ nextcell.Text = next.Title + " " + width.ToString();
+ programsRow.Cells.Add(nextcell);
+ current = next;
+ if (next.EndTime == guideEnd)
+ {
+ more = false;
+ }
+ }
+ else
+ {
+ TableCell nextcell = new TableCell();
+ nextcell.CssClass = "guidecell";
+
+ widthTime = guideEnd - next.StartTime;
+ width = Int32.Parse(widthTime.Hours.ToString()) * 60;
+ width += Int32.Parse(widthTime.Minutes.ToString());
+ nextcell.ColumnSpan = width / 2;
+ nextcell.Text = next.Title + " " + width.ToString();
+ programsRow.Cells.Add(nextcell);
+ more = false;
+ }
+ }
+
+ programsTable.Rows.Add(programsRow);
+ cell_program.Controls.Add(programsTable);
+
}
- else
+ catch
{
- more = false;
+ Label noEPG = new Label();
+ noEPG.Text = Resources.Resource.NoEPGInfo;
+ cell_program.Controls.Add(noEPG);
}
- }
- programsTable.Rows.Add(programsRow);
- cell_program.Controls.Add(programsTable);
+ r.Cells.Add(cell_channel);
+ r.Cells.Add(cell_program);
+ Guide.Rows.Add(r);
}
- catch
- {
- Label noEPG = new Label();
- noEPG.Text = Resources.Resource.NoEPGInfo;
- cell_program.Controls.Add(noEPG);
- }
-
- r.Cells.Add(cell_channel);
- r.Cells.Add(cell_program);
-
- Guide.Rows.Add(r);
- }
}
- }
+}
Modified: trunk/Version2/Web App/MPW/css/mpw_style.css
===================================================================
--- trunk/Version2/Web App/MPW/css/mpw_style.css 2007-04-25 20:34:27 UTC (rev 46)
+++ trunk/Version2/Web App/MPW/css/mpw_style.css 2007-07-17 17:25:09 UTC (rev 47)
@@ -67,6 +67,7 @@
table.content
{
+ width: 95%;
}
td.leftcontent
@@ -116,6 +117,12 @@
background-repeat: no-repeat;
}
+table.guidetable
+{
+ table-layout:fixed;
+ overflow:hidden
+}
+
td.seperatorcell
{
height: 35px;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|