
kerio.waw.ui.domainsAdDomainEditor = {

x_m: function(x_n) {
var
x_2w = x_n + '_',
x_1b = kerio.lib,
x_x = x_1b.x_x,
x_5c = 'x_nn' === x_n,
x_fa = kerio.waw.shared.x_az,
x_jr,
x_16, x_10,
x_no, x_np;
if (kerio.waw.status.x_p.x_q === kerio.waw.shared.x_3r.x_s.x_t) {
kerio.lib.x_nq('Dialog domainsAdDomainEditor is not available for Auditor!', 'domainsAdDomainEditor', 'init');
return null;
}

x_jr = function(x_nr, x_1o) {
switch (x_nr) {
case 'x_cx':
return {
credentials: {
userName: x_1o
}
};
case 'x_ns':
return {}; case 'credentials':
return {
x_cx: x_1o.userName,
x_ns: ''
};
case 'x_nt':
return {
specificServer: {
enabled: x_1o
}
};
case 'x_nu':
return {
specificServer: {
value: x_1o
}
};
case 'specificServer':
return {
x_nt: x_1o.enabled,
x_nu:   x_1o.value
};
} }; x_np = {
x_1j: 'x_no',
x_1e: [
{
x_1f: 'x_79',
x_23: x_x('Active Directory® Mapping', 'domainsAdDomainEditor'),
x_br: 205,
x_1e: [
{
x_1j: 'x_a6',
x_23: x_x('Active Directory® domain name:', 'domainsAdDomainEditor'),
x_1o: '',
x_93: 127,
x_ge: true,
x_b6: {
x_nv: 'x_nw',
x_b7: false
}
},{
x_1j: 'x_f8',
x_23: x_x('Description:', 'common'),
x_1o: '',
x_93: 255,
x_ge: true,
x_b6: {
x_nv: 'x_nx',
x_b7: true
}
}]
}, {
x_1j: 'x_ny',
x_1f: 'x_79',
x_23: x_x('Domain Access', 'domainsAdDomainEditor'),
x_br: 120,
x_1e: [
{
x_1f: 'x_1i',
x_1l: true,
x_1o: x_x('Account with rights to read user database:', 'domainsAdDomainEditor')
}, x_fa.x_b0('x_nz', {
x_1j: 'x_cx',
x_1u: 'auto',
x_b2: 1,
x_b6: {
x_nv: 'x_o0'
}
}),x_fa.x_b0('x_o1', {
x_1j: 'x_ns',
x_1u: 'auto',
x_b2: 1
})]
}, x_fa.x_b0('x_o2', {

x_o3: function(x_1c) {
if (!x_1c.x_o4()) {
return;
}
var
x_16 = x_1c.x_16,
x_47 = kerio.lib.x_9m(x_16.x_o5), x_7h = x_1c.x_7i(true),
x_fi = kerio.waw.shared.x_3e,
x_o6 = x_16.x_o7();
x_fi.x_3f(x_16, {
x_1n: kerio.lib.x_x('Testing connection to domain %1…', 'domainsAdDomainEditor', {x_49: [x_47.name]})
});
x_fi.x_iq(x_fi.x_jr(x_7h, x_1c.x_jm), x_47);
x_47.primary =  false; if (!x_47.credentials.passwordChanged || x_o6) {
x_fi.x_iq(
{
password: x_7h.x_ns,
passwordChanged: x_o6
},
x_47.credentials ); }
x_fi.x_4y('DomainManager',
'testConnection',
{ domain: x_47 },
x_16.x_o8,
x_16);
} }) ] }; x_no = new kerio.lib.x_1t(x_2w + 'x_no', x_np);
x_10 = {
x_1u: 655,
x_1v: 495,
x_1w: true,
x_1x: x_no,
x_o9: x_no.x_29('x_a6').x_1j,
x_1y: (x_5c)
? x_x('Edit Domain', 'domainsAdDomainEditor')
: x_x('Add New Domain', 'domainsAdDomainEditor'),

x_mc: function(x_1c) {
if (false !== x_1c.x_16.x_oa()) { x_1c.x_16.x_2r();
}
} }; x_16 = new kerio.lib.x_26(x_n, new x_fa.x_md(x_10));
x_16.x_27({
x_1c: x_no,
x_5c: x_5c,
x_ob: 'DomainManager'
});
x_no.x_27({
x_16: x_16,
x_5c: x_5c,
x_oc: x_no.x_29('x_ns'),
x_jm: kerio.waw.shared.x_3e.x_od({
x_a6:        'name',
x_f8: 'description',
x_oe:  'ldapSecure',
x_cx:  x_jr,
x_ns:  x_jr,
credentials: x_jr,
x_nt: x_jr,
x_nu:   x_jr,
specificServer:          x_jr
}, true)});
this.x_2a(x_16);
return x_16;
},
x_2a: function(x_2b) {

x_2b.x_2c = function(x_28) {
var
x_47 = x_28.x_47,
x_1c = this.x_1c;
if (!x_47 || !this.x_5c) { x_47 = new this.x_of();
}
this.x_9d = x_28.x_5d; this.x_o5 = x_47;              x_1c.x_7k(kerio.waw.shared.x_3e.x_jr(x_47, x_1c.x_jm));
x_1c.x_oc.x_og('NoPassword');
}; 
x_2b.x_oa = function() {
var
x_fi = kerio.waw.shared.x_3e,
x_1c = this.x_1c,
x_9d = this.x_9d,
x_5c = this.x_5c,
x_47 = this.x_o5,
x_7h = x_1c.x_7i(true),
x_o6 = this.x_o7(),
x_ln = kerio.waw.shared.x_3r.x_mp,
x_oh = ( x_5c ? x_ln.x_mt : x_ln.x_ms );
if (!this.x_oi(x_7h)) {
x_fi.x_3j(this);
return false; }
x_fi.x_iq(x_fi.x_jr(x_7h, x_1c.x_jm), x_47);
if (!x_47.credentials.passwordChanged || x_o6) {
x_fi.x_iq(
{
password: x_7h.x_ns,
passwordChanged: x_o6
},
x_47.credentials ); }
if (x_47.status !== x_ln.x_ms) { x_47.status = x_oh;      }
if (!x_5c)  { x_9d.x_fn(x_47, true); }
x_9d.x_dy();
x_9d.x_16.x_oj([x_47]);
}; 
x_2b.x_o7 = function() {
if (!this.x_5c) { return true;
}
return ('' === this.x_1c.x_oc.x_ok()); }; 
x_2b.x_o8 = function(x_28) {
var
x_a4,
x_x = kerio.lib.x_x;
if (x_28.x_ac.returnValue) {
x_a4 = this.x_1c.x_29('x_a6').x_2t();
kerio.lib.x_48(
x_x('Test Connection', 'domainsAdDomainEditor'),
x_x('Test of connection to domain %1 finished successfuly.', 'domainsAdDomainEditor', {x_49: [x_a4]})
);
}
kerio.waw.shared.x_3e.x_3j(this);
}; 
x_2b.x_of = function() {
return {
name: '',
status: kerio.waw.shared.x_3r.x_mp.x_ol, description: '',
specificServer: {
enabled: false,
value: ''
}, ldapSecure: false,
credentials: {
userName: '',
password: '',
passwordChanged: false
},ntAuthenticationDomain: {
enabled: false,
value: ''
}, primary: false, primaryDetails: {
enabled: false,
authenticationOnly: false,
ntAuthMode: false,
adAutoImport: false,
ntAuthenticationDomain: {
enabled: false,
value: ''
}
}
}; }; 
x_2b.x_jo = function() {
this.x_1c.x_2h();
kerio.waw.shared.x_3e.x_3j(this);
};

x_2b.x_oi = function(x_om) {
var
x_x = kerio.lib.x_x,
x_on = this.x_9d,
x_oo = x_on.x_16,
x_a4 = this.x_o5,
x_o5 = x_oo.x_o5,
x_a6 = x_om.name || x_om.x_a6; x_a6 = x_a6.toLowerCase();
if (x_a6 === x_a4.name.toLowerCase()) {
return true;
}
if (x_a6 === x_o5.x_op.name.toLowerCase()) {
kerio.lib.x_48(
x_x('Validation Warning', 'common'),
x_x('You cannot map domain %1 because it\'s your primary domain.', 'domainsAdDomainEditor', {x_49: [x_a6]})
);
return false; }
if (null !== x_on.x_iw(this.x_oq, { x_a6: x_a6 })) {
kerio.lib.x_48(
x_x('Validation Warning', 'common'),
x_x('You cannot map domain %1 because it\'s already mapped.', 'domainsAdDomainEditor', {x_49: [x_a6]})
);
return false; }
return true; };

x_2b.x_oq = function(x_47) {
return (this.x_a6 === x_47.name.toLowerCase());
};
} }; 