#!/usr/bin/perl
# sess_filter.cgi
# filter Sessions to Services with Tarantella
# STTA Rev. 1.3 Copyright (c) 2001-2002 Jesús Pérez Lorenzo  --- license GNU GPL 

require './stta-lib.pl';
if ($access{'sessions'} ne 1 ) { &redirect("index.cgi"); } 
&ReadParse();

$postform=$in{form};
$filter = "*";
if ( "$postform" eq "winldapusers" ) {
#     &headerstta($text{'index_winldapusers'}, "", $postform ,undef,1,1,$text{headpage_rigth} );
      &headerstta("", "", $postform,,undef,1,1,$text{headpage_rigth} );
 } else {
       &headerstta($text{'index_filter'}, "", "filter" ,undef,1,1,$text{headpage_rigth} );
};

 print "<hr><p>\n"; 
 print "<SCRIPT SRC=\"global.js\">\n"; 
 print "</SCRIPT>\n"; 
 print "<SCRIPT LANGUAGE=\"JavaScript\">\n"; 
 print "<!--\n"; 
 print "/*  Strings for locales  */\n"; 
 print "var msg0=\"".$text{'msg_0'},"\";\n"; 
 print "var msg1=\"".$text{'msg_1'},"\";\n"; 
 print "var msg2=\"".$text{'msg_2'},"\";\n"; 
 print "var msg3=\"".$text{'msg_3'},"\";\n"; 
 print "var msg4=\"".$text{'msg_4'},"\";\n"; 
 print "var msg5=\"".$text{'msg_5'},"\";\n"; 
 print "var msg6=\"".$text{'msg_6'},"\";\n"; 
 print "var msg7=\"".$text{'msg_7'},"\";\n"; 
 print "/******************************************************************\n"; 
 print "   Chek_fields(obj)\n"; 
 print "*******************************************************************/\n"; 
 print "function Chek_fields(obj) {\n"; 
 print "    ObjValue=get_value(\"select\",obj.sort_on);\n";
 print "    if ( ObjValue != \"none\" ) {\n";
 print "          return true;\n"; 
 print "    } else {     \n"; 
 print "         alert(obj.sort_on.name+\":\"+msg1);\n";
 print "         obj.sort_on.focus();\n";
 print "         return false;\n"; 
 print "    }         \n"; 
 print "}\n"; 
 print "//-->\n"; 
 print "</SCRIPT>\n"; 
 print "<p>\n"; 
 print "<table width=100% border>\n";
 print "<tr $tb> <td><b>$text{'titidx_sessfilter'}  </b></td> </tr>\n";
 print "<tr $cb> <td><table width=100%>\n";
 print "<form METHOD=POST name=tta_filter ACTION=\"tta_sess.cgi\" onSubmit=\"return Chek_fields(this)\">\n"; 

 print "	</select></td></tr>\n"; 
 print "   <tr><td valign=top>",&hlink("<b>$text{'f_orderby'}</b>","forderby"),"&nbsp;</td><td valign=top><select NAME=\"sort_on\">\n"; 
 print " 		<option VALUE=\"none\">",&hlink("<b>$text{'f_selecord'}</b>","fselecou"),"\n"; 

@l_orderby = split(/,/,$text{'sess_orderby'}, -1);
@l_tit_orderby = split(/,/,$text{'sess_tit_orderby'}, -1);
$nItems=0;
foreach $item (
@l_orderby) {
     print "  	     <option VALUE=\"$item\" ";
     print ">$l_tit_orderby[$nItems]</b>\n";
     $nItems++;
}
 print "	</select></td></tr>\n"; 
 if ( $config{has_cronsess} eq "true" && $config{'countsessout_file'} ne "" ) {  
      print "<tr> <td valign=top>",&hlink("<b>$text{'f_sessreload'}</b>","fsessreload"),"&nbsp;</td>\n"; 
      print "<td nowrap>\n";
      print "<input type=radio name=\"reload\" value=0 checked>$text{no}&nbsp;\n";
      print "<input type=radio name=\"reload\" value=1 >$text{yes}&nbsp;\n";
} else {
      print "        <input TYPE=\"hidden\" NAME=\"reload\" VALUE=\"1\">\n";
      print "</td></tr>\n";
}
 print "        <tr><td valign=top><input TYPE=\"submit\" NAME=\"",$text{'f_sendreq'},"\" VALUE=\"",$text{'f_sendreq'},"\">\n";
 print "        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>\n";
 print "        <td valign=top><input TYPE=\"reset\" NAME=\"",$text{'f_cancelreq'},"\" VALUE=\"",$text{'f_cancelreq'},"\"></td></tr>\n";
 print "	</form></td></tr>\n"; 
 print "<tr><tr></table></table><hr><p>\n";
 &footer($config{'back_return'},$text{'index'}); 
 print "<p><p><p>\n";
 do "footer.pl";
 exit;


