summaryrefslogtreecommitdiffstats
path: root/panes/mediumEncryptionPasswords.html
blob: 692874679a40419944298916763784ed473610ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<!--

    Store medium encryption passwords in memory
    
    Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
    
    $Id: mediumEncryptionPasswords.html 596 2015-04-19 11:50:53Z imoore76 $
    
-->
<div id='vboxMediumEncryptionPasswords'>
<div class='vboxBordered'>
    <table class='vboxTable vboxHorizontal'>
        <thead>
            <tr>
                <th class='translate' style='width:1%; text-align:center'>Status</th>
                <th class='translate' style='width:30%; text-align:center'>ID</th>
                <th class='translate'>Password</th>
            </tr>
        </thead>
        <tbody id='vboxMediumEncryptionPasswordList'>
        </tbody>
    </table>
</div>
</div>
<script type='text/javascript'>
$('#vboxMediumEncryptionPasswords').find(".translate").html(function(i,h){return trans(h,'password table field');});
function vboxMediumEncryptionPasswordAdd(eid, valid) {
    var status = (valid ? 'check' : 'error');
    $('<tr />')
        .data({'vboxEncryptionId':eid, 'vboxAlreadySupplied': valid})
        .append($('<td />').css({'text-align':'center'})
                .append($('<img />').attr('src','images/vbox/status_%s_16px.png'.replace('%s', status)).addClass('vboxImage'))
        )
        .append($('<td />').css({'text-align':'center'})
                .append($('<span />').text(eid))
        )
        .append($('<td />')
                .append(
                        valid ? '*****' : 
                        $('<input />').attr({'type':'password','style':'width:95%'}).addClass('vboxText')
                        )
        )
        .appendTo($('#vboxMediumEncryptionPasswordList'))
}

function vboxMediumEncryptionPasswordsGet() {
    
    if(!vboxMediumEncryptionPasswordsValidateInput())
        return false;
    
    var encryptionPWs = [];
    var rowlist = $('#vboxMediumEncryptionPasswordList').children();
    for(var i = 0; i < rowlist.length; i++) {
        if($(rowlist[i]).data('vboxAlreadySupplied'))
            continue;
        encryptionPWs.push({
            'id': $(rowlist[i]).data('vboxEncryptionId'),
            'password': $(rowlist[i]).find('input').first().val()
        });
        
    }
    return encryptionPWs;
}

function vboxMediumEncryptionPasswordsValidateInput() {
    var valid = true;
    $('#vboxMediumEncryptionPasswordList').children().each(function(i, elm) {
       var pwinput =  $(elm).find('input').first();
       if($(pwinput).val()) {
           $(pwinput).removeClass('vboxRequired');
       } else {
           $(pwinput).addClass('vboxRequired');
           valid = false;
       }
    });
    return valid;
}
</script>