wizard.js 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /**
  2. * Copyright (c) 2015, Arthur Schiwon <blizzz@owncloud.com>
  3. * This file is licensed under the Affero General Public License version 3 or later.
  4. * See the COPYING-README file.
  5. */
  6. OCA = OCA || {};
  7. /**
  8. * initializes the wizard and related components and kicks it off.
  9. */
  10. (function() {
  11. var Wizard = function() {
  12. var detectorQueue = new OCA.LDAP.Wizard.WizardDetectorQueue();
  13. detectorQueue.init();
  14. var detectors = [];
  15. detectors.push(new OCA.LDAP.Wizard.WizardDetectorPort());
  16. detectors.push(new OCA.LDAP.Wizard.WizardDetectorBaseDN());
  17. detectors.push(new OCA.LDAP.Wizard.WizardDetectorEmailAttribute());
  18. detectors.push(new OCA.LDAP.Wizard.WizardDetectorUserDisplayNameAttribute());
  19. detectors.push(new OCA.LDAP.Wizard.WizardDetectorUserGroupAssociation());
  20. detectors.push(new OCA.LDAP.Wizard.WizardDetectorUserObjectClasses());
  21. detectors.push(new OCA.LDAP.Wizard.WizardDetectorGroupObjectClasses());
  22. detectors.push(new OCA.LDAP.Wizard.WizardDetectorGroupsForUsers());
  23. detectors.push(new OCA.LDAP.Wizard.WizardDetectorGroupsForGroups());
  24. detectors.push(new OCA.LDAP.Wizard.WizardDetectorFilterUser());
  25. detectors.push(new OCA.LDAP.Wizard.WizardDetectorFilterLogin());
  26. detectors.push(new OCA.LDAP.Wizard.WizardDetectorFilterGroup());
  27. detectors.push(new OCA.LDAP.Wizard.WizardDetectorUserCount());
  28. detectors.push(new OCA.LDAP.Wizard.WizardDetectorGroupCount());
  29. detectors.push(new OCA.LDAP.Wizard.WizardDetectorAvailableAttributes());
  30. detectors.push(new OCA.LDAP.Wizard.WizardDetectorTestLoginName());
  31. detectors.push(new OCA.LDAP.Wizard.WizardDetectorTestBaseDN());
  32. detectors.push(new OCA.LDAP.Wizard.WizardDetectorTestConfiguration());
  33. detectors.push(new OCA.LDAP.Wizard.WizardDetectorClearUserMappings());
  34. detectors.push(new OCA.LDAP.Wizard.WizardDetectorClearGroupMappings());
  35. var model = new OCA.LDAP.Wizard.ConfigModel();
  36. model.init(detectorQueue);
  37. // NOTE: order of detectors may play a role
  38. // for example, BaseDN detector needs the port. The port is typically found
  39. // by the Port Detector. If BaseDN detector was run first, it will not have
  40. // all necessary information. Only after Port Detector was executed…
  41. for (var i = 0; i < detectors.length; i++) {
  42. model.registerDetector(detectors[i]);
  43. }
  44. var filterOnTypeFactory = new OCA.LDAP.Wizard.FilterOnTypeFactory();
  45. var tabs = [];
  46. tabs.push(new OCA.LDAP.Wizard.WizardTabUserFilter(filterOnTypeFactory, 1));
  47. tabs.push(new OCA.LDAP.Wizard.WizardTabLoginFilter(2));
  48. tabs.push(new OCA.LDAP.Wizard.WizardTabGroupFilter(filterOnTypeFactory, 3));
  49. tabs.push(new OCA.LDAP.Wizard.WizardTabAdvanced());
  50. tabs.push(new OCA.LDAP.Wizard.WizardTabExpert());
  51. var view = new OCA.LDAP.Wizard.WizardView(model);
  52. view.init();
  53. view.setModel(model);
  54. for (var j = 0; j < tabs.length; j++) {
  55. view.registerTab(tabs[j], '#ldapWizard' + (j + 2));
  56. }
  57. var controller = new OCA.LDAP.Wizard.Controller();
  58. controller.init();
  59. controller.setView(view);
  60. controller.setModel(model);
  61. controller.run();
  62. };
  63. OCA.LDAP.Wizard.Wizard = Wizard;
  64. })();
  65. window.addEventListener('DOMContentLoaded', function() {
  66. new OCA.LDAP.Wizard.Wizard();
  67. });