[if cgi fieldmeta] [cgi name=item_id set="[cgi fieldmeta]"] [/if] [if !cgi item_id] [bounce page="__UI_BASE__/gentable"] [/if] [calc] my $location = $CGI->{item_id}; my @parts = split /::/, $location; if($Config->{Database}{$parts[0]}) { ($m_table, $m_col, $m_key) = @parts; } else { ($m_view, $m_table, $m_col, $m_key) = @parts; } my @frags; push(@frags,errmsg('Meta field edit') . ':'); push(@frags,errmsg('view=%s', $m_view)) if $m_view; push(@frags,errmsg('table=%s column=%s', $m_table, $m_col)); push(@frags,errmsg('key=%s', $m_key)) if $m_key; $Scratch->{page_title} = join(' ',@frags); my $string = <Meta information edit

EOF $string .= < view: | $m_view EOF $string .= < | table: | $m_table
column: | $m_col

EOF $Scratch->{page_banner} = $string; if(! $CGI->{mv_data_table}) { $CGI->{mv_data_table} = '__UI_META_TABLE__'; } if(! $CGI->{ui_data_fields}) { $CGI->{ui_data_fields} = 'code label help help_url type width height options filter lookup field db lookup_exclude outboard pre_filter prepend append'; } if(! $CGI->{ui_break_before}) { $CGI->{ui_break_before} = 'help type lookup outboard prepend'; $CGI->{ui_break_before_label} = 'type=Display control, help=Help information, lookup=Database lookup, outboard=Advanced'; } return; [/calc] [set ui_class]Tables[/set] [set help_name]meta.edit[/set] [set icon_name]icon_config.gif[/set] @_UI_STD_HEAD_@ [flag type=write table="[cgi mv_data_table]"] [perl table="[cgi mv_data_table]"] my $sneak_type = $Tag->data($CGI->{mv_data_table}, 'type', $CGI->{item_id}); my $extra_meta; if($sneak_type) { $extra_meta = $Tag->widget_meta($sneak_type); } %me_opt = ( ui_data_fields => qq{ =Typical code label type filter width height options extended.blank_default =Help and Check help help_url extended.check extended.js_check extended.maxlength =Database lookup lookup field db extended.lookup_query extended.lookup_merge lookup_exclude =Select page behavior extended.ui_more_alpha extended.ui_sort_option extended.fs_no_group extended.fs_display_filter extended.fs_link_page extended.fs_link_anchor extended.fs_link_parm extended.fs_link_parm_extra extended.fs_data_calc extended.fs_data_tables extended.header_row_class extended.data_row_class_odd extended.data_row_class_even extended.header_cell_class extended.header_cell_style extended.header_link_class extended.data_cell_class extended.data_cell_style =Advanced outboard pre_filter display_filter prepend append extended.restrict_allow __UI_META_ADDITIONAL__ }, options => { 'extended.ui_sort_option' => qq{=--default--,f=Case insensitive, fr=Case insensitive/Reverse, n=Numeric, nr=Reverse Numeric}, 'field' => qq{columns::$m_table}, 'extended.js_check' => qq{codedef::JavascriptCheck}, 'filter' => 'codedef:filter:empty', 'type' => 'codedef:widget', }, filter => { 'extended.maxlength' => 'digits', 'extended.width' => 'digits', 'extended.height' => 'digits', }, label => { 'extended.ui_more_alpha' => 'Alphabetic more links', 'extended.ui_sort_option' => 'Sort option', 'extended.fs_no_group' => 'No group link', 'extended.fs_display_filter' => 'Filter(s) for select display', 'extended.fs_link_page' => 'Page to link to', 'extended.fs_link_anchor' => 'Anchor for link', 'extended.fs_link_parm' => 'Parameters to send as', 'extended.fs_link_parm_extra' => 'Additional parms to send (from CGI)', 'extended.fs_data_calc' => 'Embedded perl code to run on data', 'extended.fs_data_tables' => 'Tables to have open for perl code', 'extended.fs_display_calc' => 'Embedded perl code to run on header', 'extended.header_link_class' => 'Header row link CSS class', 'extended.header_cell_class' => 'Header cell CSS class', 'extended.header_cell_style' => 'Header cell CSS style', 'extended.header_row_class' => 'Header row CSS class', 'extended.header_row_style' => 'Header row CSS style', 'extended.data_row_class_odd' => 'Data row CSS class, odd numbers', 'extended.data_row_class_even' => 'Data row CSS class, even numbers', 'extended.data_cell_class' => 'Data cell CSS class', 'extended.data_cell_style' => 'Data cell CSS style', 'extended.lookup_query' => 'SQL for options', 'extended.lookup_merge' => 'SQL for options merge', 'extended.maxlength' => 'Maxlength', 'extended.check' => 'Profile check', 'extended.js_check' => 'JavascriptCheck', 'extended.blank_default' => 'Default value', 'extended.restrict_allow' => 'Allow these ITL tags', 'display_filter' => 'Display filter', }, help => { 'extended.fs_data_calc' => 'Current record passed as $item', 'extended.fs_data_tables' => 'To have open for Safe module', 'extended.maxlength' => 'For text widget (HTML maxlength=NN)', 'extended.blank_default' => 'Applies only when empty', 'extended.check' => 'Standard IC mv_profile checks -- required, postcode, etc.', 'extended.js_check' => 'Javascript immediate checks -- required, etc.', 'extended.restrict_allow' => 'in append/prepend/lookup_query', 'display_filter' => 'Only used for hidden_text type', }, width => { type => 30, }, widget => { type => 'movecombo_replace', extended => 'textarea_5_50', 'extended.ui_more_alpha' => 'yesno', 'extended.ui_sort_option' => 'select', 'extended.fs_no_group' => 'yesno', 'extended.fs_display_filter' => 'text_50', 'extended.fs_data_calc' => 'textarea_4_70', 'extended.maxlength' => 'text_4', 'extended.check' => 'textarea_2_50', 'extended.js_check' => 'checkbox_nbsp', }, ); if($Variable->{UI_WIDGET_TYPES}) { #Debug("Found UI_WIDGET_TYPES"); $me_opt{options}{type} = $Variable->{UI_WIDGET_TYPES}; #Debug("me_opt{options}=" . uneval($me_opt{options})); } if($extra_meta) { #Debug("Found extra_meta=" . uneval($extra_meta)); my $extra_fields = ''; my @keys; if(! $extra_meta->{_order}) { @keys = grep $_ !~ /^_/, sort keys %$extra_meta; } elsif(ref($extra_meta->{_order})) { @keys = @{$extra_meta->{_order}}; } else { @keys = grep /\S/ && $_ !~ /^_/, split /[\s,\0]+/, $extra_meta->{_order}; } foreach my $k (@keys) { my $v = $extra_meta->{$k}; #Debug("extra_meta key=$k v=$v"); next unless ref($v) eq 'HASH'; $extra_fields .= "extended.$k\n"; while(my ($key, $val) = each %$v) { $me_opt{$key}{"extended.$k"} = $val; } } if($extra_fields) { $me_opt{ui_data_fields} =~ s/\s*$/\n\n=Special for $sneak_type widget\n\n$extra_fields/; } } #Debug(uneval(\%me_opt)); ### If there is a view, set defaults from non-view record ### for this item # Always want this removed first, don't proceed if no view $Tag->tmp('tmp_defaults'); #Debug("meta_view=$CGI->{ui_meta_view}, item_id=$CGI->{item_id}"); return unless $m_view; my $db = $Db{$CGI->{mv_data_table}}; # Don't bother if already exists return if $db->record_exists($CGI->{item_id}); my $id = $CGI->{item_id}; $id =~ s/^[^:]+:+//; #Debug("checking id=$id"); my $rec = $db->row_hash($id) || $Session->{meta_defaults}{$id} or return; delete $rec->{code}; $Scratch->{tmp_defaults} = $rec; return; [/perl] [table-editor item_id="[cgi item_id]" table="[cgi mv_data_table]" no-table-meta=1 no-meta=1 start-at="[cgi start_at]" default=`$Scratch->{tmp_defaults}` ui_data_fields=`$me_opt{ui_data_fields}` options=`$me_opt{options}` filter=`$me_opt{filter}` label=`$me_opt{label}` height=`$me_opt{height}` width=`$me_opt{width}` help=`$me_opt{help}` widget=`$me_opt{widget}` ui_style=1 output_map=1 tabbed=1 ][/table-editor] @_UI_STD_FOOTER_@