1 |
379 |
ahitrov |
% if ( $state->{users}->use_credentials && $object->id ) { |
2 |
|
|
<script type="text/javascript"> |
3 |
|
|
<!-- |
4 |
|
|
function check_<% $name %>_valid( nID ){ |
5 |
|
|
} |
6 |
|
|
|
7 |
|
|
$(document).ready(function(){ |
8 |
|
|
|
9 |
|
|
% foreach my $cred ( @credentials ) { |
10 |
|
|
$('#<% $name %>_name_<% $cred->id %>_text').focusout(function(){ |
11 |
|
|
var oEmail = $(this); |
12 |
|
|
$.get('/contenido/ajax/credential_email_valid.html', { 'id' : '<% $object->id %>', 'email' : $(oEmail).val() }, function(data){ |
13 |
|
|
if ( data.error ) { |
14 |
|
|
$('#<% $name %>_<% $cred->id %>_check').attr('title', data.error).html('<span style="color:red">Error</span>'); |
15 |
|
|
} else { |
16 |
|
|
$('#<% $name %>_<% $cred->id %>_check').attr('title', '').html('<span style="color:green">Ok</span>'); |
17 |
|
|
} |
18 |
|
|
}, 'json'); |
19 |
|
|
}); |
20 |
|
|
% } |
21 |
|
|
|
22 |
|
|
$('#<% $name %>_name__text').focusout(function(){ |
23 |
|
|
var oEmail = $(this); |
24 |
|
|
$.get('/contenido/ajax/credential_email_valid.html', { 'id' : '<% $object->id %>', 'email' : $(oEmail).val() }, function(data){ |
25 |
|
|
if ( data.error ) { |
26 |
|
|
$('#<% $name %>_new_check').attr('title', data.error).html('<span style="color:red">Error</span>'); |
27 |
|
|
} else if ( data.nothing ) { |
28 |
|
|
$('#<% $name %>_new_check').attr('title', '').html(''); |
29 |
|
|
} else { |
30 |
|
|
$('#<% $name %>_new_check').attr('title', '').html('<span style="color:green">Ok</span>'); |
31 |
|
|
} |
32 |
|
|
}, 'json'); |
33 |
|
|
}); |
34 |
|
|
|
35 |
|
|
}); |
36 |
|
|
//--> |
37 |
|
|
</script> |
38 |
|
|
<div style="border:1px solid gray; padding:2px; width:95%;"> |
39 |
|
|
<table width="100%" cellpadding="5" cellspacing="0"> |
40 |
|
|
<tr bgcolor="white"> |
41 |
|
|
<th>Main</th> |
42 |
|
|
<th>E-mail</th> |
43 |
|
|
<th>Активен</th> |
44 |
|
|
<th>Удалить</th> |
45 |
|
|
<th></th> |
46 |
|
|
</tr> |
47 |
|
|
% foreach my $cred ( @credentials ) { |
48 |
|
|
% my $checked = $cred->main ? ' checked' : ''; |
49 |
|
|
% my $bgcolor = $i++ % 2 ? 'white' : '#e0e0e0'; |
50 |
|
|
% my $active = $cred->status == 1 ? ' checked' : ''; |
51 |
|
|
<tr bgcolor="<% $bgcolor %>"> |
52 |
|
|
<td width="1%"><input type="radio" name="<% $name %>.main" value="<% $cred->id %>"<% $checked %>></td> |
53 |
|
|
<td width="96%"><& /contenido/components/inputs/string.msn, name => $name.'_name_'.$cred->id, prop => $prop, check => $cred->name, object => $object &></td> |
54 |
|
|
<td width="1%"><input type="checkbox" name="<% $name %>_active_<% $cred->id %>" value="1"<% $active %>></td> |
55 |
|
|
<td width="1%"><input type="checkbox" name="<% $name %>.delete" value="<% $cred->id %>"></td> |
56 |
|
|
<td width="1%" id="<% $name %>_<% $cred->id %>_check"><span style="color:green">Ok</span></td> |
57 |
|
|
</tr> |
58 |
|
|
% } |
59 |
|
|
<tr bgcolor="<% $i++ % 2 ? 'white' : '#e0e0e0' %>"> |
60 |
|
|
<td><input type="radio" name="<% $name %>.main" value=""></td> |
61 |
|
|
<td><& /contenido/components/inputs/string.msn, name => $name.'_name_', prop => $prop, check => '', object => $object &></td> |
62 |
|
|
<td><input type="checkbox" name="<% $name %>_active_" value="1"></td> |
63 |
|
|
<td></td> |
64 |
|
|
<td id="<% $name %>_new_check"></td> |
65 |
|
|
</tr> |
66 |
|
|
</table> |
67 |
|
|
</div> |
68 |
|
|
% } else { |
69 |
|
|
<& /contenido/components/inputs/string.msn, %ARGS &> |
70 |
|
|
% } |
71 |
|
|
<%args> |
72 |
|
|
|
73 |
|
|
$name => undef |
74 |
|
|
$check => undef |
75 |
|
|
$prop => {} |
76 |
|
|
$object => undef |
77 |
|
|
|
78 |
|
|
</%args> |
79 |
|
|
<%init> |
80 |
|
|
|
81 |
|
|
my @credentials; |
82 |
|
|
if ( $state->{users}->use_credentials ) { |
83 |
|
|
@credentials = $keeper->get_documents( |
84 |
|
|
class => 'users::Email', |
85 |
|
|
uid => $object->id, |
86 |
|
|
order_by => 'main desc, name', |
87 |
|
|
); |
88 |
|
|
} |
89 |
|
|
my $i = 0; |
90 |
|
|
|
91 |
|
|
</%init> |