| 1 |
3 |
ahitrov@rambler.ru |
<%args> |
| 2 |
|
|
$id => undef |
| 3 |
|
|
$login => undef |
| 4 |
|
|
$ret => undef |
| 5 |
|
|
|
| 6 |
|
|
$delete => undef |
| 7 |
|
|
$save => undef |
| 8 |
|
|
|
| 9 |
|
|
$class => undef |
| 10 |
|
|
</%args> |
| 11 |
|
|
<%init> |
| 12 |
|
|
unless ($user->check_group(1)) { |
| 13 |
|
|
$m->clear_buffer; |
| 14 |
|
|
$m->abort(403); |
| 15 |
|
|
} |
| 16 |
|
|
|
| 17 |
|
|
my $luser; |
| 18 |
|
|
|
| 19 |
|
|
# �������� ���������� ������ - �� ������ ���� ����� ����... |
| 20 |
|
|
if ($class) |
| 21 |
|
|
{ |
| 22 |
|
|
my @correct_classes = (@{ $state->{available_users} }, 'Contenido::User'); |
| 23 |
|
|
if (! (grep { $_ eq $class } @correct_classes)) |
| 24 |
|
|
{ |
| 25 |
|
|
# ����� �����, �� �� �� ���������� |
| 26 |
|
|
$class = undef; |
| 27 |
|
|
} |
| 28 |
|
|
} |
| 29 |
|
|
|
| 30 |
|
|
if ($id && ($id>0)) { |
| 31 |
|
|
$luser = $keeper->get_user_by_id($id, class=>$class); |
| 32 |
|
|
} elsif ($login && (length $login > 0)) { |
| 33 |
|
|
$luser = $keeper->get_user_by_login($login, class=>$class); |
| 34 |
|
|
} |
| 35 |
|
|
|
| 36 |
|
|
if ($class and !ref($luser)) { |
| 37 |
|
|
$luser = $class->new($keeper); |
| 38 |
|
|
} |
| 39 |
|
|
|
| 40 |
|
|
# ��������... |
| 41 |
|
|
if (ref $luser && $delete == 1) |
| 42 |
|
|
{ |
| 43 |
|
|
$luser->delete(); |
| 44 |
|
|
|
| 45 |
|
|
$r->header_out("Location", "/contenido/?set_context=profile-admin"); |
| 46 |
|
|
$r->status(302); |
| 47 |
|
|
$r->send_http_header(); |
| 48 |
|
|
$m->abort(); |
| 49 |
|
|
} |
| 50 |
|
|
|
| 51 |
|
|
# ���������� ... |
| 52 |
|
|
elsif (ref $luser && $save == 1) |
| 53 |
|
|
{ |
| 54 |
|
|
my @groups = $luser->groups(); |
| 55 |
|
|
my $res = $m->comp('/contenido/components/set_properties.msn', object => $luser, SETS => \%ARGS); |
| 56 |
|
|
if ($res != 1) |
| 57 |
|
|
{ |
| 58 |
|
|
# ������, ���� �� ����������... |
| 59 |
|
|
warn "Contenido Debug: set_properties.msn ������ $res\n" if ($state->debug()); |
| 60 |
|
|
} |
| 61 |
|
|
$luser->groups(@groups); |
| 62 |
|
|
$luser->store(); |
| 63 |
|
|
|
| 64 |
|
|
$r->header_out("Location", "users.html?id=".$luser->id()."&class=$class"); |
| 65 |
|
|
$r->status(302); |
| 66 |
|
|
$r->send_http_header(); |
| 67 |
|
|
$m->abort(); |
| 68 |
|
|
} |
| 69 |
|
|
|
| 70 |
|
|
</%init> |
| 71 |
|
|
|
| 72 |
|
|
|
| 73 |
|
|
<& "/contenido/components/header.msn" &> |
| 74 |
|
|
<& "/contenido/components/naviline.msn" &> |
| 75 |
|
|
|
| 76 |
41 |
ahitrov@rambler.ru |
<script type="text/javascript"> |
| 77 |
|
|
<!-- |
| 78 |
|
|
function set_create_button( oSelect, sBtnID ) { |
| 79 |
|
|
if ( oSelect.value == '' ) { |
| 80 |
|
|
$('#'+sBtnID).attr('disabled','disabled'); |
| 81 |
|
|
} else { |
| 82 |
|
|
$('#'+sBtnID).removeAttr('disabled'); |
| 83 |
|
|
} |
| 84 |
|
|
} |
| 85 |
|
|
//--> |
| 86 |
|
|
</script> |
| 87 |
|
|
|
| 88 |
3 |
ahitrov@rambler.ru |
% if ((!defined $luser || !$luser->login) && (!defined $class || !$class)) |
| 89 |
|
|
% { |
| 90 |
|
|
% if (!defined $class || !$class) { |
| 91 |
|
|
<!-- ���� � ������� ������ ������������ ��� �������� --> |
| 92 |
|
|
<table width="50%" border="0"> |
| 93 |
|
|
<tr> |
| 94 |
|
|
<td> |
| 95 |
|
|
<fieldset> |
| 96 |
|
|
<legend>�������� ��� ������������ ��� ��������</legend> |
| 97 |
|
|
<& "/contenido/components/new_objects_form.msn", proto => 'users' &> |
| 98 |
|
|
</fieldset> |
| 99 |
|
|
</td> |
| 100 |
|
|
</tr> |
| 101 |
|
|
</table> |
| 102 |
|
|
% } |
| 103 |
|
|
% } elsif (ref $luser) { |
| 104 |
|
|
<& "/contenido/components/obj_list_js.msn", object => $luser &> |
| 105 |
|
|
<& "/contenido/components/object_form.msn", object => $luser, proto => 'users' &> |
| 106 |
|
|
% if ($luser->login) { |
| 107 |
|
|
<!-- ������ � ������� --> |
| 108 |
|
|
<br> |
| 109 |
|
|
<table width="100%" cellspacing="5" cellpadding="0" border="0"> |
| 110 |
|
|
<tr> |
| 111 |
|
|
<td valign=top><& "/contenido/components/user_sections.msn", luser => $luser &></td> |
| 112 |
|
|
</tr> |
| 113 |
|
|
</table> |
| 114 |
|
|
<!-- / ������ � ������� --> |
| 115 |
|
|
% } |
| 116 |
|
|
% } |
| 117 |
|
|
|
| 118 |
|
|
</body> |
| 119 |
|
|
</html> |