<?php
  /**************************************************************************\
  * phpGroupWare - Inventory                                                 *
  * http://www.phpgroupware.org                                              *
  * This file written by Bettina Gille [aeb@hansenet.de]                     *
  * --------------------------------------------                             *
  *  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: deletestatus.php,v 1.8 2001/05/10 22:08:56 bettina Exp $ */

  if ($confirm) {                                                                                                                                                                              
     $phpgw_info["flags"] = array("noheader" => True,                                                                                                                                          
                                  "nonavbar" => True);                                                                                                                                         
  }                                                                                                                                                                                            
                                                                                                                                                                                               
  $phpgw_info["flags"]["currentapp"] = "inv";                                                                                                                                                  
  include("../header.inc.php");                                                                                                                                                                
                                                                                                                                                                                               
  if (! $status_id) {                                                                                                                                                                                
     Header("Location: " . $phpgw->link('/inv/liststatus.php'));                                                                                                    
        }                                                                                                                                                                                            
                                                                                                                                                                                               
  if ($confirm) {                                                                                                                                                                              
     $phpgw->db->query("delete from phpgw_inv_statuslist where status_id='$status_id'");                                                                                                                          
    Header("Location: " . $phpgw->link('/inv/liststatus.php'));                                                                                                     
      }                                                                                                                                                                                          
    else {                                                                                                                                                                                     
        $hidden_vars =                                                                                                                                                                         
          "<input type=\"hidden\" name=\"status_id\" value=\"$status_id\">\n";                                                                                                                             
                                                                                                                                                                                               
    $t = new Template(PHPGW_APP_TPL);
     $t->set_file(array( "status_delete" => "delete.tpl"));                                                                                                                                  
                                                                                                                                                                                               
     $t->set_var("deleteheader",lang("Are you sure you want to delete this status ?"));                                                                                                           
                                                                                                                                                                                               
     $nolinkf = $phpgw->link("/inv/liststatus.php","status_id=$status_id");                                                                                                     
     $nolink = "<a href=\"$nolinkf\">" . lang("No") ."</a>";                                                                                                                                   
     $t->set_var("nolink",$nolink);                                                                                                                                                            
                                                                                                                                                                                               
     $yeslinkf = $phpgw->link("/inv/deletestatus.php","status_id=$status_id&confirm=True");                                                                                                         
                                                                                                                                                                                               
     $yeslinkf = "<FORM method=\"POST\" name=yesbutton action=\"".$phpgw->link("/inv/deletestatus.php")."\">"                                                                                     
                 . $hidden_vars                                                                                                                                                                
                 . "<input type=hidden name=status_id value=$status_id>"                                                                                                                                   
                 . "<input type=hidden name=confirm value=True>"                                                                                                                               
                 . "<input type=submit name=yesbutton value=Yes>"                                                                                                                              
                 . "</FORM><SCRIPT>document.yesbutton.yesbutton.focus()</SCRIPT>";                                                                                                             
                                                                                                                                                                                               
     $yeslink = "<a href=\"$yeslinkf\">" . lang("Yes") ."</a>";                                                                                                                                
     $yeslink = $yeslinkf;                                                                                                                                                                     
                                                                                                                                                                                               
     $t->set_var("yeslink",$yeslink);
     $t->pparse("out", "status_delete");                                                                                                                                                     
                                                                                                                                                                                               
  }                                                                                                                                                                                            
  $phpgw->common->phpgw_footer();
?>
