[set page_title]Layout Editor[/set] [set ui_class]Design[/set] [set page_banner]Layout Editor: Organize your site into categories[/set] [set page_perm]layout=e[/set] [set help_name]layout.edit[/set] [set icon_name]icon_pages.gif[/set] [set ui_body_extra][/set] @_UI_STD_HEAD_@

[flag type=write table=area] [flag type=write table=cat] [if cgi newarea] [elsif cgi newcat] [/elsif] [elsif cgi setarea] [/elsif] [elsif cgi setcat] [/elsif] [/if] [set [L]Delete section[/L]] [/set]
[form-session-id] Area -- section: [perl tables=area] my $db = $Db{area} || return; foreach ( @{ $Scratch->{area_sort} } ) { $db->set_field( $_->[0], 'sort', $_->[1] ); } delete $Scratch->{start_sort}; return; [/perl] [button text="[L]Section properties[/L]" hspace=2 vspace=5 src="icon_pages.gif" hidetext=1] [/button] [button text="[L]Sort section higher[/L]" src="up.gif" hidetext=1] [flag type=write table=area] [perl tables=area] my $db = $Db{area} || return; my $arr = delete $Scratch->{area_sort}; my $sort; foreach (reverse @$arr) { # Swap sort with previous one if ($sort) { $db->set_field($CGI->{area}, 'sort', $_->[1]); $db->set_field($_->[0], 'sort', $sort); last; } # Current: swap with next if ( $CGI->{area} eq $_->[0] ) { $sort = $_->[1]; } } return; [/perl] [/button] [button text="[L]Sort section lower[/L]" src="down.gif" hidetext=1] [flag type=write table=area] [perl tables=area] my $db = $Db{area} || return; my $arr = delete $Scratch->{area_sort}; my $sort; foreach (@$arr) { # Swap sort with previous one if ($sort) { $db->set_field($CGI->{area}, 'sort', $_->[1]); $db->set_field($_->[0], 'sort', $sort); last; } # Current: swap with next if ( $CGI->{area} eq $_->[0] ) { $sort = $_->[1]; } } return; [/perl] [/button] [button text="[L]Create section[/L]" src="plus.gif" hidetext=1] mv_todo=back newarea=NEW [/button] [button text="[L]Delete section[/L]" src="delete.gif" confirm="[L]Are you sure you want to delete this section?[/L]" hidetext=1] [tag flag write]area[/tag] [if-mm advanced sitedesign=d] [perl tables="area"] my ($item) = $CGI->{area}; my $out; unless ($Db{area}) { Log("no site design table 'area'"); return undef; } my $name = $Db{area}->field($item, 'name'); if ($Db{area}->delete_record($item)) { $out .= "Deleted $name from area table "; } else { $out .= "Item $item not in $_ table (or delete failed) "; } $Scratch->{ui_message} = $out; return; [/perl] [else] [set ui_message]Not authorized to delete layout items.[/set] [/else] [/if-mm] [/button] [if cgi area] [then] | Contains: [perl tables=cat] my $db = $Db{cat} || return; foreach ( @{ $Scratch->{cat_sort} } ) { $db->set_field( $_->[0], 'sort', $_->[1] ); } delete $Scratch->{start_sort}; return; [/perl] [button text="Category properties" hspace=2 vspace=5 hidetext=1 src="icon_pages.gif"][/button] [button text="Sort category higher" hidetext=1 src="up.gif"] [flag type=write table=cat] [perl tables=cat] my $db = $Db{cat} || return; my $arr = delete $Scratch->{cat_sort}; my $sort; foreach (reverse @$arr) { # Swap sort with previous one if ($sort) { $db->set_field($CGI->{cat}, 'sort', $_->[1]); $db->set_field($_->[0], 'sort', $sort); last; } # Current: swap with next if ( $CGI->{cat} eq $_->[0] ) { $sort = $_->[1]; } } return; [/perl] [/button] [button text="Sort category lower" hidetext=1 src="down.gif"] [flag type=write table=cat] [perl tables=cat] my $db = $Db{cat} || return; my $arr = delete $Scratch->{cat_sort}; my $sort; foreach (@$arr) { # Swap sort with previous one if ($sort) { $db->set_field($CGI->{cat}, 'sort', $_->[1]); $db->set_field($_->[0], 'sort', $sort); last; } # Current: swap with next if ( $CGI->{cat} eq $_->[0] ) { $sort = $_->[1]; } } return; [/perl] [/button] [button text="Create category" hidetext=1 src="plus.gif"] mv_todo=back newcat=NEW [/button] [button text="Delete category" hidetext=1 src="delete.gif" confirm="Are you sure you want to delete this category?" ] [tag flag write]cat[/tag] mv_nextpage=@@MV_PAGE@@ [if-mm advanced sitedesign=d] [perl tables="cat"] my ($item) = $CGI->{cat}; my $out; unless ($Db{cat}) { Log("no site design table 'cat'"); return undef; } my $name = $Db{cat}->field($item, 'name'); if ($Db{cat}->delete_record($item)) { $out .= "Deleted $name from cat table "; } else { $out .= "Item $item not in $_ table (or delete failed) "; } $Scratch->{ui_message} = $out; return; [/perl] [else] [set ui_message]Not authorized to delete items.[/set] [/else] [/if-mm] [/button] |
[set name="<--"] [/set] [button text="Move category left" hidetext=1 src="left.gif"] [if-mm advanced layout=e] [flag type=write table=cat] [perl tables=cat] my $db = $Db{cat}; if (! $db) { Log ("No category database."); return; } my $area = $CGI->{area}; @codes = split /\0/, $CGI->{add_cat}; for(@codes) { my $curr = $db->field($_, 'sel'); if($curr) { $curr =~ s/\s+$//; $curr .= " $area"; } else { $curr = $area; } $db->set_field($_, 'sel', $curr); } return; [/perl] [/if-mm] [/button] [button text="Move category right" hidetext=1 src="right.gif"] [if-mm advanced layout=e] [flag type=write table=cat] [perl tables=cat] my $db = $Db{cat}; if (! $db) { Log ("No category database."); return; } my $area = $CGI->{area}; @codes = split /\0/, $CGI->{cat}; my @there; foreach my $one (@codes) { my %seen; my $curr = $db->field($one, 'sel'); Log("current = $curr"); @there = grep $_ ne $area, split /[\0\s]+/, $curr; Log("now = @there"); @there = grep !$seen{$_}++, @there; $curr = join " ", @there; Log("now current = $curr"); $db->set_field($one, 'sel', join " ", @there); } return; [/perl] [/if-mm] [/button] | Available categories:

[value name=mv_data_table set="area" hide=1] [perl tables="[value mv_data_table]"] my $table = $Values->{mv_data_table}; $Values->{ui_data_key_name} = $Db{$table}->config('KEY'); if ($table ne $Values->{mv_data_table}) { $Values->{mv_data_table} = $table; } $Values->{ui_data_fields} = $CGI->{ui_data_fields} || $CGI->{mv_data_fields} || $Values->{"$table:ui_data_fields"} || '' ; $Values->{ui_data_fields} =~ s/\0+/ /g; return; [/perl] [set process_ui_area] setarea=[cgi selector] [perl] my @filters = grep /^ui_filter:/, keys %$CGI; return unless @filters; foreach my $key (@filters) { my $val = delete $CGI->{$key}; $key =~ s/ui_filter://; next unless $val; next unless defined $CGI->{$key}; $CGI->{$key} = $Tag->filter($val, $CGI->{$key}, $key); } return; [/perl] [/set] [loop list="[value area]" prefix=table] [form-session-id]
Section Properties
Name |
Page class |
Page area |
[set ui_area_type][table-data area link_type][/set]
Link type | [display table=area column=link_type key="[value area]" js=|onChange="this.form.submit()"|]
[if scratch ui_area_type eq external]
External |
[elsif scratch ui_area_type eq internal]
Interchange page |
Parameters |
[/elsif] [elsif scratch ui_area_type eq simple] [calc] $Values->{tab} = q{[table-data area tab]} || $Config->{ProductFiles}[0]; return; [/calc]
Table |
field=column pairs | [table-data area selector]
Results page |
[/elsif] [elsif scratch ui_area_type eq complex]
[set Create] mv_todo=back mv_nextpage=__UI_BASE__/search_wizard [/set] Complex search link | [calc] my $n = 4; if($Scratch->{search_page}) { $stuff = delete $Scratch->{search_page}; $stuff =~ s/.*?(['\|])(.*)\1.*/$2/s; $stuff =~ s/^\s+//mg; $stuff =~ s/\s+$//mg; } else { $stuff = q{[table-data area search]}; } if($stuff =~ /\S/) { $n = 2 + ($stuff =~ s/[\r\n]+/\n/g); } else { $stuff = '' }; return "$stuff"; [/calc]
[/elsif] [/if]
[set ui_area_display][table-data area display_type][/set]
Display type | [display table=area column=display_type key="[value area]" js=|onChange="this.form.submit()"|]
[if scratch ui_area_display =~ /icon|image/]
Image | [display table=area column=image key="[value area]" js=|onChange="this.form.submit()"|]
Image properties |
[/if]
Link template | [display table=area column=link_template key="[value area]"]
[button text="Change area"][/button] [/loop] | [value name=mv_data_table set="cat" hide=1] [perl tables="[value mv_data_table]"] my $table = $Values->{mv_data_table}; $Values->{ui_data_key_name} = $Db{$table}->config('KEY'); if ($table ne $Values->{mv_data_table}) { $Values->{mv_data_table} = $table; } $Values->{ui_data_fields} = $CGI->{ui_data_fields} || $CGI->{mv_data_fields} || $Values->{"$table:ui_data_fields"} || '' ; $Values->{ui_data_fields} =~ s/\0+/ /g; return; [/perl] [set process_ui_cat] setcat=[cgi selector] [perl] my @filters = grep /^ui_filter:/, keys %$CGI; return unless @filters; foreach my $key (@filters) { my $val = delete $CGI->{$key}; $key =~ s/ui_filter://; next unless $val; next unless defined $CGI->{$key}; $CGI->{$key} = $Tag->filter($val, $CGI->{$key}, $key); } return; [/perl] [/set] [loop list="[either][value cat][or]NEW[/either]" prefix=table] [form-session-id]
Category properties
Name |
[set ui_cat_type][table-data cat link_type][/set]
Link type | [display table=cat column=link_type key="[value cat]" js=|onChange="this.form.submit()"|]
[set needs_banner_info][/set] [if scratch ui_cat_type eq external]
External |
[elsif scratch ui_cat_type eq internal]
Interchange page |
Parameters |
[/elsif] [elsif scratch ui_cat_type eq explode]
Explode file | Parameters:
[/elsif] [elsif scratch ui_cat_type eq simple] [set needs_banner_info]1[/set] [calc] $Values->{tab} = q{[table-data cat tab]} || $Config->{ProductFiles}[0]; return; [/calc]
Table |
field=column pairs | [table-data cat selector]
Results page |
[/elsif] [elsif scratch ui_cat_type eq complex] [set needs_banner_info]1[/set]
[set Create] mv_todo=back mv_nextpage=__UI_BASE__/search_wizard [/set] Complex search link | [calc] my $n = 4; if($Scratch->{search_page}) { $stuff = delete $Scratch->{search_page}; $stuff =~ s/.*?(['\|])(.*)\1.*/$2/s; $stuff =~ s/^[\s=0]+$//mg; $stuff =~ s/^\s+//mg; $stuff =~ s/\s+$//mg; } else { $stuff = q{[table-data cat search]}; } if($stuff =~ /\S/) { $n = 2 + ($stuff =~ s/[\r\n]+/\n/g); } else { $stuff = '' }; return "$stuff"; [/calc]
[/elsif] [/if] [if scratch needs_banner_info]
Banner Text |
Banner Image |
[/if]
[set ui_cat_display][table-data cat display_type][/set]
Display type | [display table=cat column=display_type key="[value cat]" js=|onChange="this.form.submit()"|]
[if scratch ui_cat_display =~ /icon|image/]
Image | [display table=cat column=image key="[value cat]" js=|onChange="this.form.submit()"|]
Image properties |
[/if]
Link template | [display table=cat column=link_template key="[value cat]"]
[button text="Change category"] [/button] [/loop]
[/then] [else] [/else] [/if]

@_UI_STD_FOOTER_@