<?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.
*/
$change=get('change');
echo('<form id="form1" action="index.php#object" method="post" onsubmit="needToConfirm = false;">');
echo('<div><input name="odb_run" type="hidden" value="change"></input>');
echo('<input name="odb_search" type="hidden" value="---"></input>');
echo('<input name="odb_sys" type="hidden" value="structure"></input>');
echo('<input name="odb_group" type="hidden" value="'.$change.'"></input>');
echo('<input name="odb_id" type="hidden" value="'.$change.'"></input>');
echo('<div class="change_submit"><input name="submit" type="submit" value="Save"></input><input name="reset" type="reset" value="Cancel"></input></div>');
$variable_array=load_config($change);
if($variable_array['sysGroupBy']['value']=='')
$variable_array['sysGroupBy']['value']='changeme';
echo('<input name="odb_opt" type="hidden" value="config"></input>');
//get show_cond
$show_cond_desc_array=array();
$show_cond_desc_array[0]='';
$show_cond_desc_array[1]='Hide';
$show_cond_desc_array[2]='Edit';
$show_cond_desc_array[3]='Show and Edit';
$show_cond_desc_array[4]='Show';
$show_cond_desc_array[5]='Hide and Show';
$show_cond_desc_array[6]='Hide and Edit';
$group_name=$variable_array['sysGroupBy']['value'];
echo '<div id="'.$group_name.'" class="supergroup">';
echo '<h2>';
myecho($variable_array['sysGroupBy']['value']);
echo '</h2>';
echo '<br />';
echo '<table>';
echo '<tr>';
echo '<th>';
myecho('Name');
echo '*</th>';
echo '<td><input class="fld_ sizeL" name="odb_sysGroupBy" type="text" value="'.$variable_array['sysGroupBy']['value'].'"></input></td>';
echo '</tr>';
echo '<tr>';
echo '<th>';
myecho('Detail Title');
echo '</th>';
echo '<td><input class="fld_ sizeL" name="odb_sysDetailTitle" type="text" value="'.$variable_array['sysDetailTitle']['value'].'"></input></td>';
echo '</tr>';
/*
echo '<tr>';
echo '<td class="label">';
myecho('Detail Description');
echo '</td>';
echo '<td class="input"><textarea class="fld_ sizeL" name="odb_sysDetailDescription">'.$variable_array['sysDetailDescription']['value'].'</textarea></td>';
echo '</tr>';
*/
echo '<tr>';
echo '<th>';
myecho('List Title');
echo '</th>';
echo '<td><input class="fld_ sizeL" name="odb_sysListTitle" type="text" value="'.$variable_array['sysListTitle']['value'].'"></input></td>';
echo '</tr>';
/*
echo '<tr>';
echo '<td class="label">List Description</td>';
echo '<td class="input"><textarea class="fld_ sizeL" name="odb_sysListDescription">'.$variable_array['sysListDescription']['value'].'</textarea></td>';
echo '</tr>';
*/
//~ echo '<tr>';
//~ echo '<td class="label">';
//~ myecho('Sorting');
//~ echo '</td>';
//~ echo '<td class="input"><input class="fld_ sizeL" name="odb_sysSortBy" type="text" value="'.$variable_array['sysSortBy']['value'].'"></input></td>';
//~ echo '</tr>';
echo '</table>';
echo '<br />';
echo '<div class="">';
echo '<table>';
echo '<tr class="header">';
echo '<th>'; myecho('No.'); echo '</th>';
echo '<th>'; myecho('Important'); echo '</th>';
echo '<th>'; myecho('Name'); echo '</th>';
echo '<th>'; myecho('Tab'); echo '</th>';
//echo '<td class="label">'; myecho('Description'); echo '</td>';
//echo '<td class="label">'; myecho('Formula'); echo '</td>';
//echo '<td class="label">'; myecho('Value'); echo '</td>';
//echo '<td class="label">'; myecho('Dictionary'); echo '</td>';
echo '<th>'; myecho('Type'); echo '</th>';
echo '<th>'; myecho('Size'); echo '</th>';
echo '<th>'; myecho('Read Only'); echo '</th>';
echo '</tr>';
$tab_order_array=array();
$current_order=1;
reset($variable_array);
while(list($key,$val)=each($variable_array))
{
if(!isset($tab_order_array[$variable_array[$key]['tab']]))
$tab_order_array[$variable_array[$key]['tab']]=10000+$current_order;
$current_order++;
}
$current_order=1;
reset($variable_array);
while(list($key,$val)=each($variable_array))
{
$sorted_variable_array[$tab_order_array[$variable_array[$key]['tab']].(10000+$current_order)]=$key;
$current_order++;
}
ksort($sorted_variable_array);
//~ echo '<pre>';
//~ print_r($sorted_variable_array);
//~ echo '</pre>';
$current_order=1;
reset($sorted_variable_array);
while(list($tmp,$key)=each($sorted_variable_array))
{
$val=$variable_array[$key];
if(substr($key,0,3)!='sys')
{
//echo '<tr>';
echo '<tr class="record'.(($current_order+1)%2).'">';
echo '<td>';
echo('<input class="fld_ sizeS" name="odb_ord'.$current_order.'" type="text" value="'.$current_order.'"></input>');
echo '</td>';
echo '<td style="text-align:center;">';
$variable_name='hl';
$show_name='odb_'.$variable_name.$current_order;
if($val[$variable_name]==1)
echo('<input name="'.$show_name.'" type="checkbox" checked="checked" value="1" />');
else
echo('<input name="'.$show_name.'" type="checkbox" value="1" />');
echo '</td>';
echo '<td>';
if($val['hl']==1)
echo('<input class="fld_ sizeXXL" style="font-size:1.2em; font-weight:bold;" name="odb_key'.$current_order.'" type="text" value="'.$key.'"></input>');
else
echo('<input class="fld_ sizeXXL" name="odb_key'.$current_order.'" type="text" value="'.$key.'"></input>');
echo '</td>';
echo '<td>';
$variable_name='tab';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_" name="'.$show_name.'" type="text" value="'.$val[$variable_name].'"></input>');
echo '</td>';
/*
echo '<td class="input">';
$variable_name='description';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_ sizeL" name="'.$show_name.'" type="text" value="'.$val[$variable_name].'"></input>');
echo '</td>';
*/
//~ echo '<td class="input ">';
//~ $variable_name='formula';
//~ $show_name='odb_'.$variable_name.$current_order;
//~ echo('<input class="fld_ sizeL" name="'.$show_name.'" type="text" value="'.$val[$variable_name].'"></input>');
//~ echo '</td>';
/*
echo '<td class="input ">';
$variable_name='value';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_" name="'.$show_name.'" type="text" value="'.$val[$variable_name].'"></input>');
echo '</td>';
*/
/*
echo '<td class="input ">';
//dict
echo('<input class="fld_" name="odb_dict'.$current_order.'" type="text" value="'.$val['dict'].'"></input>');
echo '</td>';
*/
echo '<td>';
$variable_name='template';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_ sizeM" name="'.$show_name.'" type="text" onkeydown="new AutoSuggestControl(this, \'sys'.$variable_name.'\', new RemoteStateSuggestions());" value="'.$val[$variable_name].'" />');
echo '</td>';
/*
echo '<td class="input ">';
$variable_name='show_cond';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_" name="'.$show_name.'" type="text" value="'.$val[$variable_name].' '.$show_cond_desc_array[$val['show_cond']].'"></input>');
echo('<a href="odb_index.php?odb_sys=popup&odb_dict=sys'.$variable_name.'&odb_extdict='.$show_dictionary.'" onclick="var a=document.getElementsByName(\''.$show_name.'\'); window.popUpField=a[0];popup=window.open(\'odb_index.php?odb_sys=popup&odb_dict=sys'.$variable_name.'&odb_extdict='.$show_dictionary.'\',\'popup\',\'SCROLLBARS,RESIZABLE,WIDTH=330,HEIGHT=400\'); return(false);">');
echo '<img src="'.cfg_images_path.'/icon_mini_faq.gif" title="'.$show_dictionary.'" alt="?" />';
echo('</a>');
echo '</td>';
*/
if($val['template'])
{
echo '<td class="show">';
myecho('by type');
echo '</td>';
}
else
{
echo '<td class="input">';
$variable_name='size';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_ sizeS" name="'.$show_name.'" type="text" onkeydown="new AutoSuggestControl(this, \'sys'.$variable_name.'\', new RemoteStateSuggestions());" value="'.$val[$variable_name].'" />');
echo '</td>';
}
echo '<td style="text-align:center;">';
$variable_name='show_cond';
$show_name='odb_'.$variable_name.$current_order;
if($val['formula']!='')
echo('<input name="'.$show_name.'" type="checkbox" checked="checked" disabled="disabled" value="3" />');
elseif($val[$variable_name]==3)
echo('<input name="'.$show_name.'" type="checkbox" checked="checked" value="3" />');
else
echo('<input name="'.$show_name.'" type="checkbox" value="3" />');
echo '</td>';
echo '</tr>';
$current_order++;
}
}
for($ii=0;$ii<5;$ii++)
{
echo '<tr class="record'.(($current_order+1)%2).'">';
echo '<td class="input">';
echo('<input class="fld_ sizeS" name="odb_ord'.$current_order.'" type="text" value="'.$current_order.'"></input>');
echo '</td>';
echo '<td style="text-align:center;">';
$variable_name='hl';
$show_name='odb_'.$variable_name.$current_order;
echo('<input name="'.$show_name.'" type="checkbox" value="1" />');
echo '</td>';
echo '<td class="input ">';
echo('<input class="fld_ sizeXXL" name="odb_key'.$current_order.'" type="text" value=""></input>');
echo '</td>';
echo '<td class="input ">';
$variable_name='tab';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_" name="'.$show_name.'" type="text" value=""></input>');
echo '</td>';
/*
echo '<td class="input">';
$variable_name='description';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_ sizeL" name="'.$show_name.'" type="text" value=""></input>');
echo '</td>';
*/
//~ echo '<td class="input">';
//~ $variable_name='formula';
//~ $show_name='odb_'.$variable_name.$current_order;
//~ echo('<input class="fld_ sizeL" name="'.$show_name.'" type="text" value=""></input>');
//~ echo '</td>';
/*
echo '<td class="input ">';
$variable_name='variable';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_" name="'.$show_name.'" type="text" value="'.$val[$variable_name].'"></input>');
echo '</td>';
*/
/*
echo '<td class="input ">';
//dict
echo('<input class="fld_" name="odb_dict'.$current_order.'" type="text" value="'.$val['dict'].'"></input>');
echo '</td>';
*/
echo '<td class="input">';
$variable_name='template';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_ sizeM" name="'.$show_name.'" type="text" onkeydown="new AutoSuggestControl(this, \'sys'.$variable_name.'\', new RemoteStateSuggestions());" value=""></input>');
echo '</td>';
/*
echo '<td class="input ">';
$variable_name='show_cond';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_" name="'.$show_name.'" type="text" value="'.$val[$variable_name].' '.$show_cond_desc_array[$val['show_cond']].'"></input>');
echo('<a href="odb_index.php?odb_sys=popup&odb_dict=sys'.$variable_name.'&odb_extdict='.$show_dictionary.'" onclick="var a=document.getElementsByName(\''.$show_name.'\'); window.popUpField=a[0];popup=window.open(\'odb_index.php?odb_sys=popup&odb_dict=sys'.$variable_name.'&odb_extdict='.$show_dictionary.'\',\'popup\',\'SCROLLBARS,RESIZABLE,WIDTH=330,HEIGHT=400\'); return(false);">');
echo '<img src="'.cfg_images_path.'/icon_mini_faq.gif" title="'.$show_dictionary.'" alt="?" />';
echo('</a>');
echo '</td>';
*/
echo '<td class="input">';
$variable_name='size';
$show_name='odb_'.$variable_name.$current_order;
echo('<input class="fld_ sizeS" name="'.$show_name.'" type="text" onkeydown="new AutoSuggestControl(this, \'sys'.$variable_name.'\', new RemoteStateSuggestions());" value="" />');
echo '</td>';
echo '<td style="text-align:center;">';
$variable_name='show_cond';
$show_name='odb_'.$variable_name.$current_order;
echo('<input name="'.$show_name.'" type="checkbox" value="3" />');
echo '</td>';
echo '</tr>';
$current_order++;
}
echo '</table>';
echo('</div>');
echo('<div class="clearer"></div>');
echo('</div></form>');
echo('<br />');
echo('<br />');
?>