<?php
/*
OpenDataBag - Data Web Interface
Copyright (C) 2004 Nawara
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//init
if(get('group')) //problem new user mini crack
$group_name=get('group');
$sort_variable_name='';
$column_array=array();
$tab_array=array();
$mybag_shown=0;
//looking for column names
//config
$variable_array=load_config($group_name);
reset($variable_array);
while(list($variable_name,$val)=each($variable_array))
{
if(substr($variable_name,0,3)!='sys')
{
if($variable_array[$variable_name]['show_cond']==0)
$variable_array[$variable_name]['show_cond']=2;
if($variable_array[$variable_name]['tab']=='')
$variable_array[$variable_name]['tab']=$variable_array['sysDetailTitle']['value'];
if($variable_array[$variable_name]['show_cond']>1 and $variable_array[$variable_name]['show_cond']!=5)
{
$column_array[$variable_name]=$variable_array[$variable_name]['template'];//split_label($variable_name);
}
if(!isset($record_array[0][$variable_name]))
{
$record_array[0]='$'.$variable_name.'='.$record_array[0];
}
$tab_array[$variable_array[$variable_name]['tab']]=1;
}
}
echo '<form action="index.php" method="post" onsubmit="needToConfirm = false;">
<div>
<input name="odb_run" type="hidden" value="filter" />
<input name="odb_group" type="hidden" value="'.$group_name.'" />
<input name="odb_script" type="hidden" value="" />
<input name="odb_search" type="hidden" value="" />';
echo('<div class="change_submit">');
//echo('<input class="button" name="odb_save" type="submit" value="'.myecho('Search','RETURN').'" />');
//echo('<input class="button" name="reset" type="reset" value="'.myecho('Cancel','RETURN').'" />');
echo('<p class="bbutton"><input name="odb_save" type="submit" value="'.myecho('Search','RETURN').'" /></p>');
echo('</div>');
echo '<div id="'.$group_name.'" class="detail supergroup">';
$title=$mm2;
if(!$title)
$title=$variable_array['sysDetailTitle']['value'];
echo '<h2>';
myecho($title);
echo '</h2>';
// myecho('Search for '.$variable_array['sysListTitle']['value']);
$standard_display_mode=$display_mode;
$field_cnt=1;
$tab_cnt=count($tab_array);
if(isset($tab_array['...']))
$tab_cnt--;
$filter_number=0;
$filter_number++;
reset($tab_array);
while(list($tab_name,$val)=each($tab_array))
{
if($val and $tab_name!='...')
{
$fulllabel=split_label($tab_name);
if(strlen($fulllabel)>14)
$label=substr($fulllabel,0,12).'...';
else
$label=$fulllabel;
echo '<div class="detGroup">';
echo '<table>';
if($tab_cnt>1)
{
echo '<tr>';
echo '<th colspan="3">';
myecho($fulllabel);
echo '</th>';
echo '</tr>';
}
//showing fields
$sizeof=count($record_array);
for($ii=0;$ii<$sizeof;$ii++)
{
$display_mode=$standard_display_mode;
reset($column_array);
while(list($variable_name,$val)=each($column_array))
{
if($variable_array[$variable_name]['tab']==$tab_name)
{
$template=$column_array[$variable_name];
//$formula=$variable_array[$variable_name]['formula'];
//odb_filter'.$filter_number.'_name
//$show_name='odb_'.purename($variable_name);
$show_name='odb_filter'.$filter_number.'';
$show_label='';//split_label($variable_name);
$show_tooltip=$variable_array[$variable_name]['description'];//.' '.$formula;
$show_value=get(purename($variable_name));
if($show_name=='odb_MyBag')
$mybag_shown=1;
$show_dictionary=$variable_array[$variable_name]['dict'];
echo '<tr class="record">';
echo '<th style="text-align:right; font-weight:normal; width:10px;">'.$field_cnt.'.</th>';
$field_cnt++;
if($show_tooltip)
echo '<th title="'.$show_tooltip.'">';
else
echo '<th>';
if($variable_array[$variable_name]['hl'])
{
echo '<b>';
myecho($variable_name);
//if(strlen($show_value)==0 and $variable_array[$variable_name]['show_cond']!=3 and $template!='check')
// echo '<span style="color:#f00;">*</span>';
echo '</b>';
}
else
myecho($variable_name);
echo '</th>';
$show_mode=CFG_SEARCH;
if(strpos('_moneynumberdate',$template)>0)
echo '<td style="text-align:right;">';
else
echo '<td>';
echo('<input name="odb_filter'.$filter_number.'_name" type="hidden" value="'.$variable_name.'" />');
echo('<input name="odb_filter'.$filter_number.'_type" type="hidden" value="'.$template.'" />');
if(file_exists(cfg_data_path.'/config/script/fld_'.$template.'.txt'))
{
include(cfg_data_path.'/config/script/fld_'.$template.'.txt');
}
else
{
if(!file_exists(cfg_data_path.'/script/fld_'.$template.'.txt'))
$template='';
include(cfg_data_path.'/script/fld_'.$template.'.txt');
}
$filter_number++;
echo '</td>';
echo '</tr>';
}
}
}
echo '</table>';
echo '</div>';
}
}
echo('<input class="fld_" name="odb_filter'.$filter_number.'_name" type="hidden" value="sysGroupBy" />');
echo('<input class="fld_" name="odb_filter'.$filter_number.'" type="hidden" value="'.$group_name.'" />');
if(!$mybag_shown)
echo '<input name="odb_MyBag" type="hidden" value="'.get('MyBag').'"/>';
echo('<div class="clearer"></div>');
echo('</div>');
echo'</div></form>';
?>