Backport of #8164

Added improved version of patch by @blizzz in https://github.com/owncloud/core/issues/6651#issuecomment-32261257 to stop filter settings from being reset under a race condition.

Moved LdapFilter into a separate js file in user_ldap.

Changed conditions in user_ldap's ldapFilter.js to use ===, fixed indentation.

fix comparison in determineMode, fixes problems with restoring the filter mode (assisted or manually) on page refresh

Give hint when composing filter failed

fixing some JSHint warnings