<?php
  /**************************************************************************\
  * phpGroupWare - MediaDB Publisher Admin                                   *
  * http://www.phpgroupware.org                                              *
  * This file written by Sam Wynn <neotexan@wynnsite.com>                    *
  * --------------------------------------------                             *
  *  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, or (at your  *
  *  option) any later version.                                              *
  \**************************************************************************/

    /* $Id: publisher.php,v 1.4 2000/11/17 21:26:00 neotexan Exp $ */
{
    
    $phpgw_info["flags"] = array("currentapp" => "admin",
                                 "enable_nextmatchs_class" => True);

    include("../header.inc.php");
    include("inc/publisher.inc.php");

    printf("<center><h2>%s</h2></center>\n<p>\n", lang("Publishers"));

    switch($act)
    {
      case "edit":
        if ($submit)
        {
            $phpgw->db->lock("media_publisher");
            $phpgw->db->query("update media_publisher set "
                              ."publisher_name='".$publisher_name."' "
                              ."where publisher_id='".$publisher_id."'");
            $phpgw->db->unlock();

            list_publisher($order, $sort, $filter, $start, $query);
            add_publisher_entry($order, $sort, $filter, $start, $query);
        }
        else
        {
            list_publisher($order, $sort, $filter, $start, $query);
            add_publisher_entry($order, $sort, $filter, $start, $query);
            modify_publisher_entry($con, $act, $order, $sort, $filter, $start, $query);
        }
        break;
      case "delete":
        if ($submit)
        {
            $phpgw->db->lock("media_publisher");
            $phpgw->db->query("delete from media_publisher where publisher_id='"
                              .$publisher_id."'");
            $phpgw->db->unlock();

            list_publisher($order, $sort, $filter, $start, $query);
            add_publisher_entry($order, $sort, $filter, $start, $query);
        }
        else
        {
            list_publisher($order, $sort, $filter, $start, $query);
            add_publisher_entry($order, $sort, $filter, $start, $query);
            modify_publisher_entry($con, $act, $order, $sort, $filter, $start, $query);
        }
        break;
      case "add":
        if ($submit)
        {
            $phpgw->db->lock("media_publisher");
            $phpgw->db->query("insert into media_publisher (publisher_name)"
                              ."values ('"
                              .$publisher_name."')");
            $phpgw->db->unlock();
        }
        list_publisher($order, $sort, $filter, $start, $query);
        add_publisher_entry($order, $sort, $filter, $start, $query);
        break;
      default:
        list_publisher($order, $sort, $filter, $start, $query);
        add_publisher_entry($order, $sort, $filter, $start, $query);
        break;
    }

    $phpgw->common->phpgw_footer();
}

?>
