[mythtv] Patch: Mythweb grouping list screens by sort order

Ed Wildgoose edward.wildgoose at frmhedge.com
Sun Dec 14 17:57:45 EST 2003


Attached is a patch to changed the recorded programs screen and also the
upcoming recordings program so that they give a slight visual break when
the date changes.  I find this easier to read so that I'm not looking at
a big long list, but can easily see the stuff recorded on Saturday
(say).  It also works if you change the sort order to something else.

I still need to change the search page in the same way actually, but out
of time tonight.

Also, I'm toying with the idea of moving some of the columns around.  At
least in the UK, the time of a program is a good clue as to whether it's
decent or not.  Prime time viewing is when all the real films are on,
and stuff at 3am or mid-day on a weekday are usually much less
interesting, so I would prefer to have date and title over on the left
of the screen so it's easy to scan down the list.  Any comments?  The
other idea was just to use the breaks created by the patch above in
order to put in a kind of caption row, which would be quite good
anyway?  Thoughts?

By the way Chris, I sent you another tentative patch offlist, but I'm
never sure if you are getting my emails sent direct... Can you let me
know if you did/didn't get it?

Thanks

Ed W

-------------- next part --------------
Index: scheduled_recordings.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/themes/Default/scheduled_recordings.php,v
retrieving revision 1.16
diff -u -r1.16 scheduled_recordings.php
--- scheduled_recordings.php	4 Dec 2003 07:43:01 -0000	1.16
+++ scheduled_recordings.php	14 Dec 2003 21:00:33 -0000
@@ -20,11 +20,24 @@
 <script language="JavaScript" type="text/javascript">
 <!--
 	function changevisible() {
+		var prev_visible_class = "blank_row";
+		
 		for (var i=1; i < document.getElementById("listings").rows.length; i++) {
- 			if (document.getElementById(document.getElementById("listings").rows[i].className).checked)
-				document.getElementById("listings").rows[i].style.display = "";
- 			else
-				document.getElementById("listings").rows[i].style.display = "none";
+			if (document.getElementById("listings").rows[i].className == "blank_row") {
+				if (prev_visible_class == "blank_row") {
+					document.getElementById("listings").rows[i].style.display = "none";
+				} else {
+					document.getElementById("listings").rows[i].style.display = "";				
+				}
+				prev_visible_class = "blank_row";
+			} else {
+	 			if (document.getElementById(document.getElementById("listings").rows[i].className).checked) {
+					document.getElementById("listings").rows[i].style.display = "";
+					prev_visible_class = document.getElementById("listings").rows[i].className;
+	 			} else {
+					document.getElementById("listings").rows[i].style.display = "none";
+				}
+			}
       	}
 	}
 // -->
@@ -52,6 +65,15 @@
 	<td><a href="scheduled_recordings.php?sortby=length">length</a></td>
 </tr><?
 	$row = 0;
+	$group_field = $_GET['sortby'];
+	if ($group_field == "") {
+	    $group_field = "airdate";
+	} elseif ( ! (($group_field == "title") || ($group_field == "channum") || ($group_field == "airdate")) ) {
+		$group_field = "";
+	}
+	$prev_group="";
+	$cur_group="";
+	
 	foreach ($All_Shows as $show) {
 	// Reset the command variable to a default URL
 		$commands = array();
@@ -148,6 +170,24 @@
 </table>
 </div>";
 		}
+		
+	// Print a dividing row if grouping changes
+	if ($group_field == "airdate") {
+	    $cur_group = date("d m Y", $show->starttime);
+	} elseif ($group_field == "channum") {
+		$cur_group = $show->channel->name;
+	} elseif ($group_field == "title") {
+		$cur_group = $show->title;
+	}
+	
+	if ( ($row>0) && ($cur_group <> $prev_group) && ($group_field <> "") ) { ?>
+    <tr class="blank_row">
+	<td colspan="6">
+		&nbsp;
+		</td>
+	</tr><?
+	}
+	
 	// Print the content
 	?><tr class="<?=$class?>">
 	<td class="<?=$show->class?>"><?php
@@ -167,6 +207,7 @@
 	<td nowrap width="5%" class="command command_border_l command_border_t command_border_b command_border_r" align="center"><?=$command?></td>
 <?	} ?>
 </tr><?
+		$prev_group = $cur_group;
 		$row++;
 	}
 ?>
Index: recorded_programs.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/themes/Default/recorded_programs.php,v
retrieving revision 1.14
diff -u -r1.14 recorded_programs.php
--- recorded_programs.php	19 Nov 2003 06:57:47 -0000	1.14
+++ recorded_programs.php	14 Dec 2003 21:00:33 -0000
@@ -80,7 +80,36 @@
 	<td><a href="recorded_programs.php?sortby=filesize">file&nbsp;size</a></td>
 </tr><?php
 	$row = 0;
+
+	// Setup for grouping by various sort orders
+	$group_field = $_GET['sortby'];
+	if ($group_field == "") {
+	    $group_field = "airdate";
+	} elseif ( ! (($group_field == "title") || ($group_field == "channum") || ($group_field == "airdate")) ) {
+		$group_field = "";
+	}
+	$prev_group="";
+	$cur_group="";
+
 	foreach ($All_Shows as $show) {
+
+	// Print a dividing row if grouping changes
+	if ($group_field == "airdate") {
+	    $cur_group = date("d m Y", $show->starttime);
+	} elseif ($group_field == "channum") {
+		$cur_group = $show->channel->name;
+	} elseif ($group_field == "title") {
+		$cur_group = $show->title;
+	}
+	
+	if ( ($row>0) && ($cur_group <> $prev_group) && ($group_field <> "") ) { ?>
+	<tr class="blank_row">
+	<td colspan="9">
+		&nbsp;
+		</td>
+	</tr><?
+	}
+	
 	?><tr class="recorded">
 	<td><?php
 		if (show_recorded_pixmaps) {
@@ -105,6 +134,7 @@
 		<a id="delete_<?php echo $row?>" href="recorded_programs.php?delete=yes&file=<?php echo urlencode($show->filename)?>">Delete</a></td>
 <?php	} ?>
 </tr><?
+		$prev_group = $cur_group;
 		$row++;
 	}
 ?>



More information about the mythtv-dev mailing list