Index: modules/settings/init.php
===================================================================
--- modules/settings/init.php	(Revision 10599)
+++ modules/settings/init.php	(Arbeitskopie)
@@ -21,6 +21,7 @@
                                  'links'       => array('session'   => t('MythWeb session settings'),
                                                         'mythweb'   => t('MythTV global defaults'),
                                                         'channels'  => t('MythTV channel info'),
+							'chanlist'  => t('Sort Channels'),
                                                         'keys'      => t('MythTV key bindings'),
                                                         'settings'  => t('MythTV settings table'),
                                                        ),
Index: modules/settings/chanlist.php
===================================================================
--- modules/settings/chanlist.php	(Revision 0)
+++ modules/settings/chanlist.php	(Revision 0)
@@ -0,0 +1,79 @@
+<?php
+/**
+ * Configure MythTV Channels
+ *
+ * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/settings/channels.php $
+ * @date        $Date: 2006-06-24 21:03:10 +0200 (Sa, 24 Jun 2006) $
+ * @version     $Revision: 10290 $
+ * @author      $Author: xris $
+ * @license     GPL
+ *
+ * @package     MythWeb
+ * @subpackage  Settings
+ *
+/**/
+
+// Save?
+    if ($_POST['listhiddenchannels']) {
+    // Parse the post variables and save each group of channel info
+        $arrvis = explode("|",$_POST['listvisiblechannels']);
+        $arrhid = explode("|",$_POST['listhiddenchannels']);
+	
+	$cnt = 0;
+	for ($i=0;$i<sizeof($arrvis)-1;$i++)
+	{
+	  $cnt++;
+	  $chanid = trim($arrvis[$i]);
+ 
+            // Not deleting so grab values that can be empty
+                $query = 'UPDATE channel SET channum       = ?,
+                                             visible       = ?';
+                $query_params[] = $cnt;
+                $query_params[] = '1';
+        // Submit the query
+            $db->query($query.' WHERE chanid=?',
+                       $query_params,
+                       $chanid
+                      );
+	    unset($query_params);
+	    //echo "chid: $chanid  &nbsp;&nbsp;&nbsp; nr: $cnt <br>";
+	}
+	
+	for ($i=0;$i<sizeof($arrhid)-1;$i++)
+	{
+	  $chanid = trim($arrhid[$i]);
+            // Not deleting so grab values that can be empty
+                $query = 'UPDATE channel SET visible = ?';
+                $query_params[] = '0';
+        // Submit the query
+            $db->query($query.' WHERE chanid=?',
+                       $query_params,
+                       $chanid
+                      );
+	    unset($query_params);
+
+
+        }
+    }
+
+// Load all of the channel data from the database
+    $Channels = array();
+    $sh = $db->query('SELECT * FROM channel WHERE visible = \'1\' ORDER BY CAST(channum AS SIGNED);');
+    while ($row = $sh->fetch_assoc()) {
+        $Channels[] = $row;
+    }
+    $sh->finish();
+
+    $ChannelsHidden = array();
+    $sh = $db->query('SELECT * FROM channel WHERE visible = \'0\' ORDER BY CAST(channum AS SIGNED);');
+    while ($row = $sh->fetch_assoc()) {
+        $ChannelsHidden[] = $row;
+    }
+    $sh->finish();
+
+// Load the class for this page
+    require_once tmpl_dir.'chanlist.php';
+
+// Exit
+    exit;
+
Index: modules/settings/tmpl/default/chanlist.php
===================================================================
--- modules/settings/tmpl/default/chanlist.php	(Revision 0)
+++ modules/settings/tmpl/default/chanlist.php	(Revision 0)
@@ -0,0 +1,210 @@
+<?php
+/**
+ * Configure MythTV Channel info
+ *
+ * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/settings/tmpl/default/channels.php $
+ * @date        $Date: 2006-06-24 21:03:10 +0200 (Sa, 24 Jun 2006) $
+ * @version     $Revision: 10290 $
+ * @author      $Author: xris $
+ * @license     GPL
+ *
+ * @package     MythWeb
+ * @subpackage  Settings
+ *
+/**/
+
+// Set the desired page title
+    $page_title = 'MythWeb - '.t('Configure Channels');
+
+// Print the page header
+    require 'modules/_shared/tmpl/'.tmpl.'/header.php';
+
+    echo t('Please be warned that by altering this table without knowing what you are doing, you could seriously disrupt mythtv functionality.');
+?>
+
+<script>
+function showidx()
+{
+  var selvis = document.getElementById("visiblechannels");
+  var myidx = document.getElementById("myindex");
+  var idx = selvis.selectedIndex;
+  
+  myidx.innerHTML = idx + 1;
+
+}
+
+function showchan()
+{
+  var selvis = document.getElementById("visiblechannels");
+  var selhid = document.getElementById("hiddenchannels");
+  var idx = selhid.selectedIndex;
+  
+  while (idx >= 0)
+  {
+   var newEintrag = document.createElement("option");
+   newEintrag.text = selhid[idx].text;
+   newEintrag.value = selhid[idx].value;
+   selvis.add(newEintrag, null);
+   selhid.remove(idx);
+   idx = selhid.selectedIndex;
+  }
+  showidx();
+}
+
+function hidechan()
+{
+  var selvis = document.getElementById("visiblechannels");
+  var selhid = document.getElementById("hiddenchannels");
+  var idx = selvis.selectedIndex;
+  
+  while (idx >= 0)
+  {
+   var newEintrag = document.createElement("option");
+   newEintrag.text = selvis[idx].text;
+   newEintrag.value = selvis[idx].value;
+   selhid.add(newEintrag, null);
+   selvis.remove(idx);
+   idx = selvis.selectedIndex;
+  }
+
+  showidx();
+}
+
+function moveup()
+{
+  var selvis = document.getElementById("visiblechannels");
+  var idx = selvis.selectedIndex;
+  
+  if (idx > 0)
+  {
+   var tmp 
+   tmp = selvis[idx].text;
+   selvis[idx].text = selvis[idx-1].text;
+   selvis[idx-1].text = tmp;
+   
+   tmp = selvis[idx].value
+   selvis[idx].value = selvis[idx-1].value;
+   selvis[idx-1].value = tmp;
+   
+   selvis.selectedIndex = idx - 1;
+  }
+  showidx();
+}
+
+function movedown()
+{
+  var selvis = document.getElementById("visiblechannels");
+  var idx = selvis.selectedIndex;
+  var max = selvis.length;
+  
+  if (idx >= 0 && idx < max - 1)
+  {
+   var tmp 
+   tmp = selvis[idx].text;
+   selvis[idx].text = selvis[idx+1].text;
+   selvis[idx+1].text = tmp;
+   
+   tmp = selvis[idx].value
+   selvis[idx].value = selvis[idx+1].value;
+   selvis[idx+1].value = tmp;
+   
+   selvis.selectedIndex = idx + 1;
+  }
+  showidx();
+}
+
+function saveit()
+{
+  var selvis = document.getElementById("visiblechannels");
+  var selhid = document.getElementById("hiddenchannels");
+  var cntvis = selvis.length;
+  var cnthid = selhid.length;
+  var listvis = document.getElementById("listvisiblechannels");
+  var listhid = document.getElementById("listhiddenchannels");
+  var myform = document.getElementById("myform");
+  var wrt = 0, lst = "";
+  
+  for(i=0;i<cntvis;i++)
+  {
+    wrt = selvis[i].value;
+    lst = lst + wrt + "|"; 
+  }  
+  listvis.value = lst;
+  lst = "";
+  wrt = 0;
+  
+  for(i=0;i<cnthid;i++)
+  {
+    wrt = selhid[i].value;
+    lst = lst + wrt + "|"; 
+  }  
+  listhid.value = lst;
+  
+  myform.submit();
+}
+
+
+
+</script>
+
+
+<form class="form" method="post" id="myform" action="<?php echo root ?>settings/chanlist">
+<center>
+
+<table>
+<tr>
+<td>Visible Channels</td>
+<td></td>
+<td>Hidden Channels</td>
+</tr>
+
+<tr>
+<td>
+<select multiple id=visiblechannels name=visiblechannels size=30 onclick="javascript:showidx()">
+<?php
+foreach ($Channels as $channel) {
+?>
+<option value="<?php echo $channel['chanid']; ?> "><?php echo $channel['name']; ?></option>
+<?php
+}
+?>
+</select>
+</td>
+<td>
+<div id=myindex>0</div>
+<br><br>
+
+<input type=button onclick="javascript:hidechan()" value="--&gt; hide channel"><br>
+<input type=button onclick="javascript:showchan()" value="&lt;-- show channel"><br>
+<br><br>
+<input type=button onclick="javascript:moveup()" value="move up"><br>
+<input type=button onclick="javascript:movedown()" value="move down"><br>
+</td>
+<td>
+<select multiple id=hiddenchannels name=hiddenchannels size=30>
+<?php
+foreach ($ChannelsHidden as $channel) {
+?>
+<option value="<?php echo $channel['chanid']; ?> "><?php echo $channel['name']; ?></option>
+<?php
+}
+?>
+</select>
+</td>
+</tr>
+</table>
+
+
+<p align="center">
+<input type="hidden" name="listvisiblechannels" id="listvisiblechannels" value="">
+<input type="hidden" name="listhiddenchannels" id="listhiddenchannels" value="">
+
+<input type="button" onclick="javascript:saveit()" name="save" value="<?php echo t('Save') ?>">
+</p>
+
+</form>
+<?php
+
+// Print the page footer
+    require 'modules/_shared/tmpl/'.tmpl.'/footer.php';
+
