[mythtv] mythweb: video edit patch

Mitch White nothingx at gmail.com
Sat Feb 19 15:44:48 UTC 2005


Hello.

This is my first, but hopefully not last, contribution to myth.  I was
updating my shows in mythvideo via the web interface and found it odd
that I couldn't set the category.  So, I coded up this patch that
allows you to change the category of the video via the edit video
page.  I also tweaked the newWindow javascript function to allow space
for the new field.

Although very small, I hope you find this to be useful.

-Mitch
-------------- next part --------------
Index: video_edit.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/video_edit.php,v
retrieving revision 1.2
diff -u -r1.2 video_edit.php
--- video_edit.php	24 Jan 2005 03:35:54 -0000	1.2
+++ video_edit.php	19 Feb 2005 15:33:44 -0000
@@ -32,15 +32,16 @@
 if (isset($_POST['submit'])) {
 
       //insert data into database
-      mysql_query("UPDATE videometadata SET title='{$_POST['title']}',director='{$_POST['director']}',plot='{$_POST['plot']}',rating='{$_POST['rating']}',inetref='{$_POST['inetref']}',year='{$_POST['year']}',userrating='{$_POST['userrating']}',length='{$_POST['length']}' WHERE intid='{$_POST['intid']}'");
+      mysql_query("UPDATE videometadata SET
+      title='{$_POST['title']}',director='{$_POST['director']}',plot='{$_POST['plot']}',category='{$_POST['category']}',rating='{$_POST['rating']}',inetref='{$_POST['inetref']}',year='{$_POST['year']}',userrating='{$_POST['userrating']}',length='{$_POST['length']}' WHERE intid='{$_POST['intid']}'");
       //close window and refresh parent
       ?><body onLoad="refreshParent()"</body><?php
 }
 
 //get data to prefill form if we're editing an existing entry
-   $edit_result = mysql_query("SELECT intid,title,director,plot,rating,inetref,year,userrating,length FROM videometadata WHERE intid=' {$_REQUEST['intid']}'")
+   $edit_result = mysql_query("SELECT intid,title,director,plot,category,rating,inetref,year,userrating,length FROM videometadata WHERE intid=' {$_REQUEST['intid']}'")
           or trigger_error('SQL Error: '.mysql_error(), FATAL);
-     list($intid,$title,$director,$plot,$rating,$inetref,$year,$userrating,$length)=mysql_fetch_array($edit_result);
+     list($intid,$title,$director,$plot,$category,$rating,$inetref,$year,$userrating,$length)=mysql_fetch_array($edit_result);
 //output html form
 ?>
 
@@ -79,6 +80,19 @@
     <td>Plot:</td>
     <td><textarea name="plot" rows="5" cols="30" wrap="VIRTUAL"><?if (isset($plot)) print $plot; ?></textarea></td>
 </tr><tr>
+    <td>Category:</td>
+    <td><select name="category">
+    	<option <?if (!(isset($category)) || ($category == 0)) print "selected"; ?> value="0">Uncategorized</option>
+    	<?php
+	    $result = mysql_query('SELECT * FROM videocategory')
+            or trigger_error('SQL Error: '.mysql_error(), FATAL);
+    	    while( $cat_data = mysql_fetch_assoc($result) )  {
+	        $num_cat++;
+	        $cat_str = $cat_data["category"]; ?>
+		<option <?if ($category == $num_cat) print "selected"; ?> value="<?print $num_cat; ?>"><?print $cat_str; ?></option>
+	    <?}
+	?></td>
+</tr><tr>
     <td>Rating:</td>
     <td><input name="rating" type="text" value="<?if (isset($rating)) print $rating; ?>"></td>
 </tr><tr>
Index: themes/Default/video.php
===================================================================
RCS file: /var/lib/mythcvs/mythweb/themes/Default/video.php,v
retrieving revision 1.7
diff -u -r1.7 video.php
--- themes/Default/video.php	22 Jan 2005 04:07:09 -0000	1.7
+++ themes/Default/video.php	19 Feb 2005 15:33:44 -0000
@@ -24,7 +24,7 @@
 
 function newWindow(newContent)
  {
-  winContent = window.open(newContent, 'nextWin', 'right=0, top=20,width=350,height=410, toolbar=no,scrollbars=no, resizable=yes')
+  winContent = window.open(newContent, 'nextWin', 'right=0, top=20,width=350,height=440, toolbar=no,scrollbars=no, resizable=yes')
  }
 
  //Stop hiding script from old browsers -->


More information about the mythtv-dev mailing list