[mythtv] [PATCH] Mythweb Delete Recordings
Brad Zawacki
zawackib at umich.edu
Thu Mar 31 02:10:24 UTC 2005
Hello,
Long time user, first time patcher...big fan of everybody's work.
I was bothered by a little issue with deleting recordings in mythweb where it
always returned to the top of the page after a delete. Personally, I
wanted it to return to the spot on the page where I'd just deleted the
show, so I went ahead and implemented it.
It's worth noting that this is my first crack at PHP, although I think
the changes should be fairly harmless and hopefully helpful.
I'll also note that I only made the change to the 'Default' theme,
although I suppose it would be trivial for the others, as well. The
only change specific to the theme was adding a 'name=<row #>' attribute
to the row anchor tag.
Do with it what you will,
-BZ
-------------- next part --------------
? delete.diff
Index: recorded_programs.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/recorded_programs.php,v
retrieving revision 1.29
diff -u -d -r1.29 recorded_programs.php
--- recorded_programs.php 27 Feb 2005 22:55:49 -0000 1.29
+++ recorded_programs.php 31 Mar 2005 01:41:33 -0000
@@ -18,7 +18,11 @@
$_GET['file'] or $_GET['file'] = $_POST['file'];
if ($_GET['delete'] && preg_match('/\\d+_\\d+/', $_GET['file'])) {
// We need to scan through the available recordings to get at the additional information required by the DELETE_RECORDING query
+ $prev_row=-2; // keep a previous row counter to return to after deleting
foreach (get_backend_rows('QUERY_RECORDINGS Delete') as $row) {
+ // increment if row has the same title as the show we're deleting or if viewing 'all recordings'
+ if (($_SESSION['recorded_title'] == $row[0]) || ($_SESSION['recorded_title'] == ''))
+ $prev_row += 1;
// This row isn't the one we're looking for
if ($row[8] != $_GET['file'])
continue;
@@ -38,7 +42,7 @@
echo "\n"; // need at least 1 byte in body
exit;
}
- header('Location: recorded_programs.php');
+ header('Location: recorded_programs.php#'.$prev_row); // return to the row just prior to the one deleted
exit;
}
Index: themes/Default/recorded_programs.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/themes/Default/recorded_programs.php,v
retrieving revision 1.45
diff -u -d -r1.45 recorded_programs.php
--- themes/Default/recorded_programs.php 10 Feb 2005 03:34:51 -0000 1.45
+++ themes/Default/recorded_programs.php 31 Mar 2005 01:41:33 -0000
@@ -142,7 +142,7 @@
if (show_recorded_pixmaps) {
echo "\t<td rowspan=\"".($_SESSION['recorded_descunder'] ? 3 : 2).'">';
if (file_exists(image_cache.'/'.basename($show->filename).'.png')) {
- echo '<a href="'.video_url().'/'.basename($show->filename).'">'
+ echo '<a href="'.video_url().'/'.basename($show->filename).'" name="'.$row.'">'
.'<img id="'.$show->filename."\" src=\"".image_cache.'/'.basename($show->filename).'.png" width="'.pixmap_width.'" height="'.pixmap_height.'" border="0">'
.'</a>';
}
More information about the mythtv-dev
mailing list