diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index 8cd31301f2..0b8f141dfa 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -34,8 +34,16 @@ $(document).ready(function() { 'Keep settings?', function(keep) { if(!keep) { - $('#ldap').find('input[type=text], input[type=password], textarea, select').val(''); - $('#ldap').find('input[type=checkbox]').removeAttr('checked'); + $('#ldap').find('input[type=text], input[type=number], input[type=password], textarea, select').each(function() { + $(this).val($(this).attr('data-default')); + }); + $('#ldap').find('input[type=checkbox]').each(function() { + if($(this).attr('data-default') == 1) { + $(this).attr('checked', 'checked'); + } else { + $(this).removeAttr('checked'); + } + }); } } ); diff --git a/apps/user_ldap/settings.php b/apps/user_ldap/settings.php index 73e4f0b6f4..f3f0826739 100644 --- a/apps/user_ldap/settings.php +++ b/apps/user_ldap/settings.php @@ -64,7 +64,7 @@ if($_POST) { } } if($clearCache) { - $ldap = new \OCA\user_ldap\lib\Connection('user_ldap'); + $ldap = new \OCA\user_ldap\lib\Connection(); $ldap->clearCache(); } } @@ -88,4 +88,15 @@ $hfnr = ($hfnr == 'opt:username') ? '' : substr($hfnr, strlen('attr:')); $tmpl->assign('home_folder_naming_rule', $hfnr, ''); $tmpl->assign('serverConfigurationOptions', '', false); +// assign default values +if(!isset($ldap)) { + $ldap = new \OCA\user_ldap\lib\Connection(); +} +$defaults = $ldap->getDefaults(); +foreach($defaults as $key => $default) { + $tmpl->assign($key.'_default', $default); +} + +// $tmpl->assign(); + return $tmpl->fetchPage(); diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index c3ec20fc84..90a46a1733 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -17,32 +17,32 @@

-

-

-

-

-


t('use %%uid placeholder, e.g. "uid=%%uid"');?>

-


t('without any placeholder, e.g. "objectClass=person".');?>

-


t('without any placeholder, e.g. "objectClass=posixGroup".');?>

+

+

+

+

+


t('use %%uid placeholder, e.g. "uid=%%uid"');?>

+


t('without any placeholder, e.g. "objectClass=person".');?>

+


t('without any placeholder, e.g. "objectClass=posixGroup".');?>

-

-

-

-

title="t('When switched on, ownCloud will only connect to the replica server.');?>" />

-

-

-

-

title="t('Do not use it for SSL connections, it will fail.');?>" />

-

>

-

>
t('Not recommended, use for testing only.');?>

-

-

-

-

-

-

-

+

+

+

+

data-default="" title="t('When switched on, ownCloud will only connect to the replica server.');?>" />

+

+

+

+

data-default="" title="t('Do not use it for SSL connections, it will fail.');?>" />

+

>

+

>
t('Not recommended, use for testing only.');?>

+

+

+

+

+

+

+

t('Help');?>