[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]Edit Permissions: [cgi user_id][/seti] [set ui_class]Admin[/set] [set page_perm]access=v[/set] [set help_name]access.permissions[/set] [set icon_name]admin/icon_config.gif[/set] [set process_perm] [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->{no_tables} =~ s/\0/ /g; $CGI->{mv_todo} = 'set'; $CGI->{mv_nextpage} = '@@MV_PAGE@@';# unless $CGI->{mv_nextpage}; return; [/perl] [/set] @_UI_STD_HEAD_@ [if scratch ui_message]

[scratch ui_message][set ui_message][/set]

  [/if] [if scratch ui_failure] Failed: [scratch ui_failure][set ui_failure][/set]
[/if]

[seti tables][list-databases][/seti] [perl tables="__UI_META_TABLE__ __UI_ACCESS_TABLE__"] my @permissions = ( item => 'Item editor', page => 'Page editor', cat => 'Category editor', tax => 'Tax editor', shipping => 'Shipping editor', payment => 'Payment editor', affiliate => 'Affiliates editor', itemtype => 'Item type editor', pagetype => 'Page type editor', grouptype => 'Group type editor', matrix => 'Matrix editor', knar => 'Knar editor', access => 'Administrator Permissions', group => 'Access Group editor', perm => 'Permission editor', layout => 'Layout editor', ); 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 e c 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 .= < # #EOF my $perm; my $title; while( $perm = shift @permissions) { $title = shift @permissions; my $ref = $permref->{$perm} || {}; $out .= < EOF for(@some) { $out .= < {$_}> EOF } $out =~ s!(<.td>\s*)$!$1!; } my $ref = $permref->{order}; $out .= <
  View list View detail Create Edit Delete
#$string # $title

EOF return $out; [/perl]
Order manager:
  • {l}> View list
  • {v}> View single
  • {d}> Delete
  • {e}> Edit
  • {c}> Input new
  • {a}> Archive
  • {u}> Un-archive

  • EOF @permissions = ( orderstats => 'Order statistics utility', trafficstats => 'Traffic statistics utility', env_vars => 'Environment variables utility', stats => 'Stats menu', techadmin => 'Techncal Admin menu', sitedesign => 'Site Design menu', config => 'Apply changes', dbupload => 'Database importer', dbdownload => 'Database exporter', layupload => 'Layout importer', laydownload => 'Layout exporter', gensql => 'Direct SQL utility', ); while($perm = shift @permissions ) { $title = shift @permissions; my $on = defined $permref->{$perm} ? ' CHECKED' : ''; $out .= < $title EOF } $ref = $permref->{userdb}; $out .= <
    Administrator Permissions:
  • {l}> View list
  • {v}> View single
  • {d}> Delete
  • {e}> Edit
  • {c}> Input new
  • {p}> Mail password

  • [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; while( $perm = shift @permissions) { $title = shift @permissions; my $ref = $permref->{$perm} || {}; $out .= < EOF for(@all) { $out .= < {$_}> EOF } $out =~ s!(<.td>\s*)$!$1!; } #$Scratch->{string} = $string; return $out; [/perl]
    Table Permissions
      HIDE View Edit Create Delete Import Export
    $title
    [button text="Cancel"] mv_todo=back mv_nextpage=[either][value-extended name=ui_return_to index=0][or]__UI_BASE__/access[/either] mv_data_table=[cgi mv_data_table] [/button]

    @_UI_STD_FOOTER_@