[calc] $CGI->{no_dbmenu} = 1; $CGI->{access_menu} = 1; $CGI->{mv_data_table} = $Values->{mv_data_table} = '__UI_ACCESS_TABLE__'; $CGI->{user_id} = $Values->{user_id} if ! $CGI->{user_id}; return; [/calc] [if !cgi user_id] [bounce page="__UI_BASE__/access"] [/if] [seti page_title][L]Edit Permissions[/L]: [cgi user_id][/seti] [set ui_class]Admin[/set] [set page_perm]access=v[/set] [set help_name]access.permissions[/set] [set icon_name]icon_config.gif[/set] [set process_perm] [flag type=write table="__UI_ACCESS_TABLE__"] [tmp ui_owner][db-hash table="__UI_ACCESS_TABLE__" column="table_control" key="[cgi user_id]"][/tmp] [calc] $Scratch->{ui_owner} .= ";" if $Scratch->{ui_owner} =~ /\S/; return; [/calc] [perl] my @filters = grep /^ui_filter:/, keys %$CGI; 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); $CGI->{$key} = s/=$//; } $CGI->{yes_functions} =~ s/\0//g; $CGI->{yes_functions} =~ s/,/ /g; $CGI->{yes_functions} =~ s/\w+=(?:\s+|$)//g; $CGI->{yes_tables} =~ s/\0//g; $CGI->{yes_tables} =~ s/,/ /g; $CGI->{yes_tables} =~ s/\w+=(?:\s+|$)//g; $CGI->{yes_tables} =~ s/(\w+)=vecdix(\s+|$)/$1$2/g; $CGI->{owner_field} =~ s/\0//g; $CGI->{owner_field} =~ s/,$//; my (%of) = split /[=,]/, $CGI->{owner_field}; for(keys %of) { if($of{$_} !~ /\S/) { next unless defined $tc->{$_}; delete $tc->{$_}{owner_field}; } else { $tc->{$_}{owner_field} = $of{$_}; } } $CGI->{table_control} = $Tag->uneval( { ref => $tc } ); $CGI->{owner_field} =~ s/\w+=(?:\s+|$)//g; $CGI->{owner_field} =~ s/(\w+)=vecdix(\s+|$)/$1$2/g; $CGI->{no_tables} =~ s/\0/ /g; $CGI->{mv_todo} = 'set'; return; [/perl] [/set] @_UI_STD_HEAD_@ [output name=top_of_form] [form-session-id] [output name=""] [tabbed-display js-prefix="perm_" width=800 height=800 ] [tabbed-panel Editor Functions]

| [L]View list[/L] | [L]View detail[/L] | [L]Create[/L] | [L]Edit[/L] | [L]Delete[/L]
[seti tables][list-databases][/seti] [perl tables="__UI_META_TABLE__ __UI_ACCESS_TABLE__"] my @permissions = ( item => '[L]Item editor[/L]', page => '[L]Page editor[/L]', cat => '[L]Category editor[/L]', tax => '[L]Tax editor[/L]', shipping => '[L]Shipping editor[/L]', payment => '[L]Payment editor[/L]', affiliate => '[L]Affiliates editor[/L]', itemtype => '[L]Item type editor[/L]', pagetype => '[L]Page type editor[/L]', grouptype => '[L]Group type editor[/L]', matrix => '[L]Matrix editor[/L]', knar => '[L]Knar editor[/L]', access => '[L]Administrator Permissions[/L]', group => '[L]Access Group editor[/L]', perm => '[L]Permission editor[/L]', layout => '[L]Layout editor[/L]', ); my %extra = qw/userdb 1 order 1/; my $current = tag_data('__UI_ACCESS_TABLE__', 'yes_functions', $CGI->{user_id}); my $out = ''; my @ary = grep /\S/, split /[\s,\0]+/, $current; my @some = qw/l v c e d/; my @more = qw/a u p/; my @all = (@some, @more); my %all; @all{@some, @more} = (@some, @more); $permref = {}; foreach $one (@ary) { $one =~ s/=(.*)//; my $sub = $1 || undef; my $ref = $permref->{$one} = {}; my @set; if ($sub) { @set = grep $all{$_}, split //, $sub; } else { @set = $extra{$one} ? @all : @some; } for(@set) { $ref->{$_} = ' CHECKED'; } } my $string = $Tag->uneval( {ref=>$permref} ); #DEBUG # $out .= < # | #$string # #EOF my $perm; my $title; my $inc = 0; while( $perm = shift @permissions) { $title = shift @permissions; my $ref = $permref->{$perm} || {}; my $class = $inc++ % 2 ? 'rownorm' : 'rowalt'; $out .= < | $title EOF for(@some) { $out .= < {$_}> EOF } $out =~ s!(<.td>\s*)$!$1!; } my $ref = $permref->{order}; $out .= < [/tabbed-panel] [tabbed-panel Other Functions]

[L]Order manager[/L]: {l}> [L]View list[/L] {v}> [L]View single[/L] {d}> [L]Delete[/L] {e}> [L]Edit[/L] {c}> [L]Input new[/L] {a}> [L]Archive[/L] {u}> [L]Un-archive[/L] | EOF @permissions = ( orderstats => 'Order statistics utility', trafficstats => 'Traffic statistics utility', env_vars => 'Environment variables utility', stats => 'Stats menu', techadmin => 'Technical Admin menu', sitedesign => 'Site Design menu', reconfig => 'Apply changes', delete_files => 'Delete owned files', dbupload => 'Database importer', dbdownload => 'Database exporter', layupload => 'Layout importer', laydownload => 'Layout exporter', gentable => 'List tables', gensql => 'Direct SQL utility', dbconfig => 'Database configuration', files => 'Modify Files', mailing => 'Customer Mailing' ); while($perm = shift @permissions ) { $title = errmsg(shift @permissions); my $on = defined $permref->{$perm} ? ' CHECKED' : ''; $out .= < $title EOF } $ref = $permref->{userdb}; $out .= <
[L]Customer Edit Permissions[/L]: {l}> [L]View list[/L] {v}> [L]View single[/L] {d}> [L]Delete[/L] {e}> [L]Edit[/L] {c}> [L]Input new[/L] {p}> [L]Mail password[/L]
EOF return $out; [/perl]

[/tabbed-panel] [tabbed-panel Table Permissions]

[L]Table Permissions[/L]
| [L]HIDE[/L] | [L]View[/L] | [L]Edit[/L] | [L]Create[/L] | [L]Delete[/L] | [L]Import[/L] | [L]Export[/L] | [L]Owner field[/L]
[perl] my $current = tag_data('__UI_ACCESS_TABLE__', 'yes_tables', $CGI->{user_id}) || $Scratch->{tables}; $current =~ s/\s+/ /g; my $no = tag_data('__UI_ACCESS_TABLE__', 'no_tables', $CGI->{user_id}); $no =~ s/\s+/ /g; #Log("no = $no"); my (@no) = split /\s+/, $no; my %no; for(@no) { $no{$_} = ' CHECKED' } my $out = ''; my @ary = split /[\s,\0]+/, $current; #Log("ary = " . join ",", @ary); #Log("no = " . join ",", @no); my (@all) = qw/v e c d i x/; my %all; @all{@all} = @all; my $permref = {}; my $one; foreach $one (@ary) { $one =~ s/=(.*)//; my $sub = $1 || undef; next if $no{$one}; my $ref = $permref->{$one} = {}; my @set; if ($sub) { @set = grep $all{$_}, split //, $sub; } else { @set = (@all); } for(@set) { $ref->{$_} = ' CHECKED'; } } #my $string = "all=@all ". $Tag->uneval( { ref=> $permref } ); my @tables = split /\s+/, $Scratch->{tables}; for(@tables) { push @permissions, $_, tag_data('__UI_META_TABLE__', 'label', $_) || $_; } my $perm; my $title; my $inc = 0; while( $perm = shift @permissions) { $title = shift @permissions; my $class = $inc++ % 2 ? 'rownorm' : 'rowalt'; my $ref = $permref->{$perm} || {}; $out .= < | $title | EOF for(@all) { $out .= < {$_}> EOF } my $of = ''; if($tc->{$perm}) { $of = $tc->{$perm}{owner_field}; } $out .= < EOF $out =~ s!(<.td>\s*)$!$1!; } #$Scratch->{string} = $string; return $out; [/perl]

[/tabbed-panel] [/tabbed-display] [output name=top_buttons] [output name=bottom_buttons] [output name=bottom_of_form]

[output name=""] @_UI_STD_FOOTER_@