<?

/************************************************************************/
/* 4nAlbum Version 0.9                                                  */
/* ==================================================================== */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

function editmediatypes() {
  global $prefix, $adminurl, $font;

        galleryHeader();
          navigationAdmin("<a class=\"".$font['title']."\" href=\"$adminurl\">"._GALCONFIG."</a><font class=\"".$font['title']."\"> &gt; "._GALEDITMEDIATYPE."</font>");
        print '<br>';
        OpenTable();

  echo "<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\">
        <tr><td>";
/////
print '<br>
      <p align="center">
      <font class="'.$font['normal'].'">
      '._GALMEDIATYPEDESC.'
      </font>
      </p>
      </td></tr></table>';
      CloseTable();
      print '<br>';

      print OpenTable().'<table border="0" cellpadding="10" cellspacing="0" width="100%"><tr><td align="center">';
      print '
      <p><font class="'.$font['normal'].'">'._GALMEDIAADDTYPE.'</font></p>
          <table border="0" cellpadding="10" cellspacing="0" width="100%">
          <form method="POST" action="'.$adminurl.'">
          <input type="hidden" name="do" value="editmediatypes">
          <input type="hidden" name="type" value="new">
          <tr>
                <td valign="top">
                <font class="title">'._GALMEDIACLASSTYPE.'</font><br>
                <select name="class">';
                $res = mysql_query("SELECT * FROM $prefix"._4nalbum_media_class."");
                while (list($id, $class) = mysql_fetch_row($res)) {
                        print "<option value=\"$id\">$class</option>";
                }
                print '</select>
                    </td>

                  <td valign="top"><font class="title">
                  '._GALMEDIADESCTYPE.'</font><br>
                  <input type="text" name="description" size="15" value="">
                </td>
                  <td valign="top" >
                  <font class="title">'._GALMEDIAEXTENSION.'</font><br>
                  <input type="text" name="extension" size="5" value="">
                </td>
                  <td valign="top" >
                  <font class="title">'._GALMEDIATHUMB.'</font><br>
                  <input type="text" name="thumbnail" size="15" value="">
                </td>

        </tr>
        <tr>
                  <td colspan="4" align="center" valign="top">
                    <font class="title">'._GALMEDIATAG.'</font><br>
                    <textarea  name="code" rows="10" cols="60"></textarea>
                  </td>
        </tr>
        <tr>
                  <td Align="center" colspan="4">
                  <input type="submit" value="'._NEW.'" name="create">
                  </td>
        </tr>
        </form>
      </table>';
      print '</td><tr></table>'.CloseTable().'<br>';


$sql = "SELECT * FROM $prefix"._4nalbum_media_types." ORDER BY filetype, description";
$result = mysql_query($sql);

      print OpenTable().'<table border="0" cellpadding="10" cellspacing="0" width="100%"><tr><td align="center">';
      print '
       <p><font class="title">'._GALEDITMEDIATYPES.'</font></p>

      <table border="0" cellpadding="5" cellspacing="0" width="100%">';
        while ($row = mysql_fetch_array($result)) {
                $info = str_replace("<", "&lt;", $row[displaytag]);
                $info = str_replace(">", "&gt;", $info);
                $info = str_replace("\"", "&quot;", $info);
                $info = str_replace("\'", "&apos;", $info);
                print '
                          <form method="POST" action="'.$adminurl.'">
                          <input type="hidden" name="do" value="editmediatypes">
                          <input type="hidden" name="type" value="edit">
                          <input type="hidden" name="oldext" value="'.$row[extension].'">

                        <tr>
                                <td valign="top">
                                <font class="title">'._GALMEDIACLASSTYPE.'</font><br>
                                <select name="class">';
                                $res = mysql_query("SELECT * FROM $prefix"._4nalbum_media_class."");
                                $sel_filetype[$row[filetype]] = ' selected';
                                while (list($id, $class) = mysql_fetch_row($res)) {
                                        print "<option value=\"$id\"$sel_filetype[$id]>$class</option>";
                                }
                                print '</select>
                                    </td>

                                  <td valign="top"><font face="Verdana,Arial">
                                  <font class="title">'._GALMEDIADESCTYPE.'</font><br>
                                  <input type="text" name="description" size="15" value="'.$row[description].'">
                                </td>
                                  <td valign="top" >
                                  <font class="title">'._GALMEDIAEXTENSION.'</font><br>
                                  <input type="text" name="extension" size="5" value="'.$row[extension].'">
                                </td>
                                  <td valign="top" >
                                  <font class="title">'._GALMEDIATHUMB.'</font><br>
                                  <input type="text" name="thumbnail" size="15" value="'.$row[thumbnail].'">
                                </td>

                        </tr>
                        <tr>
                                  <td colspan="4" align="center" valign="top">
                                    <font class="title">'._GALMEDIATAG.'</font><br>
                                    <textarea  name="code" rows="10" cols="60">'.$info.'</textarea>
                                  </td>
                        </tr>
                        <tr>
                                  <td Align="center" colspan="4">
                                  <input type="submit" value="'._SAVE.'" name="save">&nbsp;&nbsp;
                                  <input type="submit" value="'._DELETE.'" name="delete">
                                  <br><hr><br>
                                  </td>
                        </tr>
                        </form>';
        }

        print '</table>';
       print '</td><tr></table>'.CloseTable().'<br>';
        print '<br>';
        adminFooter();
}
?>