<?php

// dbman_filter_pop.php - PHProjekt Version 5.0
// copyright  ©  2000-2005 Albrecht Guenther  ag@phprojekt.com
// www.phprojekt.com
// Author: Johannes Schlueter
// $Id: dbman_filter_pop.php,v 1.18 2005/06/01 21:57:44 johann Exp $

// FIXME: this file is not xhtml conform!

$path_pre = '../';
$include_path = $path_pre.'lib/lib.inc.php';
include_once $include_path;

include $path_pre.'lib/dbman_list.inc.php';
if (empty($_REQUEST['module'])) {
    die('Wrong call');
}

$module = $_REQUEST['module'];
if($module=='contacts')$actionstring='action=contacts';
else $actionstring='module='.$module;

$caption = 'o_'.$module;
$caption = $$caption;

$js_close = "<script language='JavaScript' type='text/javascript'><!--\n".
            "window.opener.location.href = '../$opener/$opener.php?$actionstring&amp;mode=$mode&ID=$ID&';window.close();</script>";
$js_reload = "<script language='JavaScript' type='text/javascript'><!--\n".
            "window.location.href = '../$module/$module.php?$actionstring</script>";


#echo set_page_header();


if($nav==$module){
	 $flist[$module] = load_filter($use, $module);
   header('Location: ../'.$module.'/'.$module.'.php?'.$actionstring.'&amp;'.$add);
	
}
else{
echo '
<html>
<head>
<style type="text/css" media="screen">@import "../layout/default/default_css.php";</style>
<style type="text/css">
body{
    background-image:none;
}
</style>
</head><body>
<div class="topline"></div>
<div class="inner_content">
<h3>'.__('Filter configuration').__(':').' '.$caption.'</h3>';

#echo '<h3>'.__('Filter configuration').": $caption</h3>\n";
if ($use) {
    $flist[$module] = load_filter($use, $module);
    echo $js_close;
} else if ($dele) {
    delete_filter($dele, $module);
    echo $js_close;
} else if ($aufheben) {
    $flist[$module] = array();
    echo $js_close;
} else if ($speichern) {
    save_filter($module, $speichern);
    echo $js_close;
} else {
    $filter = get_filters($module);

    $hiddenfields = "<input type='hidden' name='module' value='$module'>".
                    "<input type='hidden' name='opener' value='$opener'>".
                    "<input type='hidden' name='mode' value='$mode'>".
                    "<input type='hidden' name='ID' value='$ID'>";


echo '
    <div style="width:40%;float:left"></div>
    <div style="width:60%;float:right"><a href="dbman_filter_pop.php?aufheben=1&module='.$module.'&opener='.$opener.'&mode='.$mode.'&'.$actionstring.'&amp;ID='.$ID.'">'.__('Disable set filters').'</a></div>
    <br style="clear:both"/>

    <form action="dbman_filter_pop.php">
    <div style="width:40%;float:left">'.__('Save currently set filters').'</div>
    <div style="width:60%;float:right"><input name="speichern"> '.get_buttons(array(array('type' => 'submit', 'active' => false, 'name' => '', 'value' => __('Save')))).'</div>
    '.$hiddenfields.'
    </form>
    <br style="clear:both"/>

    <form action="dbman_filter_pop.php">
    <div style="width:40%;float:left">'.__('Load filter').'</div>
    <div style="width:60%;float:right">
    <select name="use">
    <option value=""></option>
';
foreach ($filter as $id =>$value) {
    echo '<option value="'.$id.'">'.$value.'</option>';
}
echo '
    </select> '.get_buttons(array(array('type' => 'submit', 'active' => false, 'name' => '', 'value' => __('use')))).'</div>
    '.$hiddenfields.'
    </form>
    <br style="clear:both"/>

    <form action="dbman_filter_pop.php">
    <div style="width:40%;float:left">'.__('Delete saved filter').'</div>
    <div style="width:60%;float:right">
    <select name="dele">
    <option value=""></option>
';
foreach ($filter as $id =>$value) {
    echo '<option value="'.$id.'">'.$value.'</option>';
}
echo '
    </select> '.get_buttons(array(array('type' => 'submit', 'active' => false, 'name' => '', 'value' => __('Delete'), 'onclick' => 'return window.confirm(\''.__('Are you sure?').'\');'))).'</div>
    '.$hiddenfields.'
    </form>
    <br style="clear:both"/>
';

echo '</div>';
}

$_SESSION['flist'] =& $flist;
}



?>