From 591041d54d22703153ff2d7793d2a45a634152ff Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Mon, 12 Nov 2012 18:05:13 +0100 Subject: Change Web UI sources to simple AMD modules Web UI sources were wrapped by AMD definition. Listed dependencies were changed accordingly. https://fedorahosted.org/freeipa/ticket/112 --- install/ui/src/freeipa/aci.js | 8 ++- install/ui/src/freeipa/add.js | 7 +- install/ui/src/freeipa/app.js | 126 +++++++++++++++++++++++++++++++++ install/ui/src/freeipa/association.js | 10 +-- install/ui/src/freeipa/automember.js | 10 +-- install/ui/src/freeipa/automount.js | 9 +-- install/ui/src/freeipa/certificate.js | 9 ++- install/ui/src/freeipa/details.js | 7 +- install/ui/src/freeipa/dialog.js | 5 +- install/ui/src/freeipa/dns.js | 12 ++-- install/ui/src/freeipa/entitle.js | 9 +-- install/ui/src/freeipa/entity.js | 11 ++- install/ui/src/freeipa/facet.js | 9 +-- install/ui/src/freeipa/field.js | 8 ++- install/ui/src/freeipa/group.js | 8 ++- install/ui/src/freeipa/hbac.js | 8 ++- install/ui/src/freeipa/hbactest.js | 8 ++- install/ui/src/freeipa/host.js | 9 +-- install/ui/src/freeipa/hostgroup.js | 8 ++- install/ui/src/freeipa/idrange.js | 8 ++- install/ui/src/freeipa/ipa.js | 7 +- install/ui/src/freeipa/jquery.js | 26 +++++++ install/ui/src/freeipa/json2.js | 27 +++++++ install/ui/src/freeipa/navigation.js | 5 ++ install/ui/src/freeipa/net.js | 7 +- install/ui/src/freeipa/netgroup.js | 8 ++- install/ui/src/freeipa/policy.js | 9 +-- install/ui/src/freeipa/rule.js | 8 ++- install/ui/src/freeipa/search.js | 9 +-- install/ui/src/freeipa/selinux.js | 10 +-- install/ui/src/freeipa/serverconfig.js | 8 ++- install/ui/src/freeipa/service.js | 9 +-- install/ui/src/freeipa/sudo.js | 8 ++- install/ui/src/freeipa/trust.js | 8 ++- install/ui/src/freeipa/user.js | 10 +-- install/ui/src/freeipa/webui.js | 81 +-------------------- install/ui/src/freeipa/widget.js | 7 +- install/ui/src/libs/browser.js | 2 +- 38 files changed, 351 insertions(+), 187 deletions(-) create mode 100644 install/ui/src/freeipa/app.js create mode 100644 install/ui/src/freeipa/jquery.js create mode 100644 install/ui/src/freeipa/json2.js (limited to 'install') diff --git a/install/ui/src/freeipa/aci.js b/install/ui/src/freeipa/aci.js index bd7de19a..383848ec 100644 --- a/install/ui/src/freeipa/aci.js +++ b/install/ui/src/freeipa/aci.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Adam Young * Endi S. Dewata @@ -21,7 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.aci = {}; @@ -895,3 +894,6 @@ IPA.register('privilege', IPA.aci.privilege_entity); IPA.register('role', IPA.aci.role_entity); IPA.register('selfservice', IPA.aci.selfservice_entity); IPA.register('delegation', IPA.aci.delegation_entity); + +return IPA.aci; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/add.js b/install/ui/src/freeipa/add.js index 6d3f454b..1b4a1ae5 100644 --- a/install/ui/src/freeipa/add.js +++ b/install/ui/src/freeipa/add.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Pavel Zuna * Endi Sukma Dewata @@ -21,7 +19,7 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js */ +define(['./ipa', './jquery', './field', './widget', './dialog'], function(IPA, $) { IPA.entity_adder_dialog = function(spec) { @@ -205,3 +203,6 @@ IPA.entity_adder_dialog = function(spec) { return that; }; + +return IPA.entity_adder_dialog; +}); diff --git a/install/ui/src/freeipa/app.js b/install/ui/src/freeipa/app.js new file mode 100644 index 00000000..9d89c1ae --- /dev/null +++ b/install/ui/src/freeipa/app.js @@ -0,0 +1,126 @@ +/* Authors: + * Petr Vobornik + * + * Copyright (C) 2012 Red Hat + * see file 'COPYING'./for use and warranty information + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +// +// AMD Wrapper for json2 library +// + +define([ + //core + './ipa', + './jquery', + './navigation', + './webui', + //only entities + './aci', + './automember', + './automount', + './dns', + './group', + './hbac', + './hbactest', + './hostgroup', + './host', + './idrange', + './netgroup', + './policy', + './rule', + './selinux', + './serverconfig', + './service', + './sudo', + './trust', + './user', + 'dojo/domReady!' +],function(IPA, $) { + + /* main loop (hashchange event handler) */ + function window_hashchange(evt){ + IPA.nav.update(); + } + + function create_navigation() { + var whoami = IPA.whoami; + var factory; + + + if (whoami.hasOwnProperty('memberof_group') && + whoami.memberof_group.indexOf('admins') !== -1) { + factory = IPA.admin_navigation; + } else if (whoami.hasOwnProperty('memberofindirect_group')&& + whoami.memberofindirect_group.indexOf('admins') !== -1) { + factory = IPA.admin_navigation; + } else if (whoami.hasOwnProperty('memberof_role') && + whoami.memberof_role.length > 0) { + factory = IPA.admin_navigation; + } else if (whoami.hasOwnProperty('memberofindirect_role') && + whoami.memberofindirect_role.length > 0) { + factory = IPA.admin_navigation; + } else { + factory = IPA.self_serv_navigation; + } + + return factory({ + container: $('#navigation'), + content: $('#content') + }); + } + + + function init_on_success(data, text_status, xhr) { + $(window).bind('hashchange', window_hashchange); + + var whoami = IPA.whoami; + IPA.whoami_pkey = whoami.uid[0]; + $('#loggedinas .login').text(whoami.cn[0]); + $('#loggedinas a').fragment( + {'user-facet': 'details', 'user-pkey': IPA.whoami_pkey}, 2); + + $('#logout').click(function() { + IPA.logout(); + return false; + }).text(IPA.messages.login.logout); + + $('.header-loggedinas').css('visibility','visible'); + IPA.update_password_expiration(); + + IPA.nav = create_navigation(); + IPA.nav.create(); + IPA.nav.update(); + + $('#login_header').html(IPA.messages.login.header); + } + + + function init_on_error(xhr, text_status, error_thrown) { + var container = $('#content').empty(); + container.append('

Error: '+error_thrown.name+'

'); + container.append('

'+error_thrown.message+'

'); + } + + return { + run: function() { + IPA.init({ + on_success: init_on_success, + on_error: init_on_error + }); + } + }; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js index 70b8e9f1..c6b9e5a4 100644 --- a/install/ui/src/freeipa/association.js +++ b/install/ui/src/freeipa/association.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Adam Young * Petr Vobornik @@ -21,10 +19,11 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js */ /* CURRENTLY ALSO REQUIRES search.js, because it reuses it's code to create * the AssociationList elements; IT NEEDS IT'S OWN CODE! */ +define(['./ipa', './jquery', './search', './dialog'], function(IPA, $) { + IPA.associator = function (spec) { spec = spec || {}; @@ -1386,4 +1385,7 @@ IPA.attr_read_only_evaluator = function(spec) { }; return that; -}; \ No newline at end of file +}; + +return {}; +}); diff --git a/install/ui/src/freeipa/automember.js b/install/ui/src/freeipa/automember.js index 6f8eba95..2d61f7eb 100644 --- a/install/ui/src/freeipa/automember.js +++ b/install/ui/src/freeipa/automember.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Petr Vobornik * @@ -20,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.automember = {}; @@ -676,4 +675,7 @@ IPA.automember.default_group_widget = function(spec) { }; -IPA.register('automember', IPA.automember.entity); \ No newline at end of file +IPA.register('automember', IPA.automember.entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/automount.js b/install/ui/src/freeipa/automount.js index 3a4491d8..6e8547c7 100644 --- a/install/ui/src/freeipa/automount.js +++ b/install/ui/src/freeipa/automount.js @@ -1,6 +1,3 @@ -/*jsl:import ipa.js */ -/*jsl:import search.js */ - /* Authors: * Adam Young * @@ -21,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.automount = {}; @@ -352,3 +350,6 @@ IPA.automount.key_search_facet = function(spec) { IPA.register('automountlocation', IPA.automount.location_entity); IPA.register('automountmap', IPA.automount.map_entity); IPA.register('automountkey', IPA.automount.key_entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js index 782033db..f7bc8435 100755 --- a/install/ui/src/freeipa/certificate.js +++ b/install/ui/src/freeipa/certificate.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Endi Sukma Dewata * Petr Vobornik @@ -21,6 +19,8 @@ * along with this program. If not, see . */ +define(['./ipa', './jquery', './dialog'], function(IPA, $) { + IPA.cert = {}; IPA.cert.BEGIN_CERTIFICATE = '-----BEGIN CERTIFICATE-----'; @@ -921,4 +921,7 @@ IPA.cert.status_field = function(spec) { }; IPA.widget_factories['certificate_status'] = IPA.cert.status_widget; -IPA.field_factories['certificate_status'] = IPA.cert.status_field; \ No newline at end of file +IPA.field_factories['certificate_status'] = IPA.cert.status_field; + +return {}; +}); diff --git a/install/ui/src/freeipa/details.js b/install/ui/src/freeipa/details.js index c3e84e43..e8f1e86d 100644 --- a/install/ui/src/freeipa/details.js +++ b/install/ui/src/freeipa/details.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Pavel Zuna * Adam Young @@ -25,7 +23,7 @@ /* IPA Object Details - populating definiton lists from entry data */ -/* REQUIRES: ipa.js */ +define(['./ipa', './jquery', './facet', './add'], function(IPA, $) { IPA.expanded_icon = 'expanded-icon'; IPA.collapsed_icon = 'collapsed-icon'; @@ -1237,3 +1235,6 @@ IPA.disabled_summary_cond = function() { state: ['disabled'] }; }; + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/dialog.js b/install/ui/src/freeipa/dialog.js index 4e603155..f2326b32 100644 --- a/install/ui/src/freeipa/dialog.js +++ b/install/ui/src/freeipa/dialog.js @@ -20,7 +20,7 @@ * along with this program. If not, see . */ -/* REQUIRES: widget.js, details.js */ +define(['./ipa', './jquery', './field', './widget'], function(IPA, $) { IPA.opened_dialogs = { @@ -847,3 +847,6 @@ IPA.confirm_mixin = function() { } }; }; + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/dns.js b/install/ui/src/freeipa/dns.js index d08f4140..920bbd00 100644 --- a/install/ui/src/freeipa/dns.js +++ b/install/ui/src/freeipa/dns.js @@ -1,7 +1,3 @@ -/*jsl:import ipa.js */ -/*jsl:import search.js */ -/*jsl:import net.js */ - /* Authors: * Adam Young * Petr Vobornik @@ -23,8 +19,9 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js, - * net.js, widget.js */ + +define(['./ipa', './jquery', './net', './details', './search', './association', + './entity'], function(IPA, $, NET) { IPA.dns = { zone_permission_name: 'Manage DNS zone ${dnszone}' @@ -2550,3 +2547,6 @@ IPA.network_validator = function(spec) { IPA.register('dnsconfig', IPA.dns.config_entity); IPA.register('dnszone', IPA.dns.zone_entity); IPA.register('dnsrecord', IPA.dns.record_entity); + +return {}; +}); diff --git a/install/ui/src/freeipa/entitle.js b/install/ui/src/freeipa/entitle.js index ccf82173..04857703 100644 --- a/install/ui/src/freeipa/entitle.js +++ b/install/ui/src/freeipa/entitle.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Endi S. Dewata * @@ -20,8 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ - +define(['./ipa', './jquery', './details', './search', './add', + './facet', './entity', './field', './widget'], function(IPA, $) { IPA.entitle = {}; @@ -743,3 +741,6 @@ IPA.entitle.download_widget = function(spec) { }; IPA.register('entitle', IPA.entitle.entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/entity.js b/install/ui/src/freeipa/entity.js index d474ad95..08ba7e57 100644 --- a/install/ui/src/freeipa/entity.js +++ b/install/ui/src/freeipa/entity.js @@ -1,7 +1,3 @@ -/*jsl:import ipa.js */ -/*jsl:import facet.js */ -/*jsl:import navigation.js */ - /* Authors: * Pavel Zuna * Endi Sukma Dewata @@ -25,7 +21,7 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, facet.js, details.js, search.js, add.js */ +define(['./ipa', './jquery', './facet'], function(IPA, $) { IPA.entity = function(spec) { @@ -728,4 +724,7 @@ IPA.details_facet_update_policy = function(spec) { spec.dest_facet = 'search'; return IPA.facet_update_policy(spec); -}; \ No newline at end of file +}; + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js index 25d48bf6..77e05cab 100644 --- a/install/ui/src/freeipa/facet.js +++ b/install/ui/src/freeipa/facet.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Pavel Zuna * Endi Sukma Dewata @@ -23,7 +21,7 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js */ +define(['./ipa', './jquery', './dialog', './field', './widget'], function(IPA, $) { IPA.facet = function(spec, no_init) { @@ -2041,4 +2039,7 @@ IPA.action_list_widget = function(spec) { }; return that; -}; \ No newline at end of file +}; + +return {}; +}); diff --git a/install/ui/src/freeipa/field.js b/install/ui/src/freeipa/field.js index ff807dcf..f6906d7d 100644 --- a/install/ui/src/freeipa/field.js +++ b/install/ui/src/freeipa/field.js @@ -1,4 +1,3 @@ -/*jsl:import ipa.js */ /* Authors: * Endi Sukma Dewata * Adam Young @@ -22,7 +21,7 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, widget.js */ +define(['./ipa', './jquery'], function(IPA, $) { IPA.field = function(spec) { spec = spec || {}; @@ -948,4 +947,7 @@ IPA.field_factories['select'] = IPA.select_field; IPA.field_factories['sshkeys'] = IPA.sshkeys_field; IPA.field_factories['textarea'] = IPA.field; IPA.field_factories['text'] = IPA.field; -IPA.field_factories['value_map'] = IPA.field; \ No newline at end of file +IPA.field_factories['value_map'] = IPA.field; + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/group.js b/install/ui/src/freeipa/group.js index 8317d679..b7749a99 100644 --- a/install/ui/src/freeipa/group.js +++ b/install/ui/src/freeipa/group.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Pavel Zuna * Endi Dewata @@ -22,7 +20,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.group = {}; @@ -257,3 +256,6 @@ IPA.group.make_external_action = function(spec) { }; IPA.register('group', IPA.group.entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/hbac.js b/install/ui/src/freeipa/hbac.js index 63c928aa..5bf84446 100644 --- a/install/ui/src/freeipa/hbac.js +++ b/install/ui/src/freeipa/hbac.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Endi Sukma Dewata * Adam Young @@ -21,7 +19,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.hbac = { //priority of commands in details facet @@ -551,3 +550,6 @@ IPA.hbacrule_details_facet = function(spec) { IPA.register('hbacrule', IPA.hbac.rule_entity); IPA.register('hbacsvc', IPA.hbac.service_entity); IPA.register('hbacsvcgroup', IPA.hbac.service_group_entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/hbactest.js b/install/ui/src/freeipa/hbactest.js index 93d17c71..1fa88fca 100644 --- a/install/ui/src/freeipa/hbactest.js +++ b/install/ui/src/freeipa/hbactest.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Endi Sukma Dewata * @@ -20,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js,hbac.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity', './hbac'], function(IPA, $) { IPA.hbac.test_entity = function(spec) { @@ -840,3 +839,6 @@ IPA.hbac.validation_dialog = function(spec) { }; IPA.register('hbactest', IPA.hbac.test_entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js index 30086b41..133c38ff 100644 --- a/install/ui/src/freeipa/host.js +++ b/install/ui/src/freeipa/host.js @@ -1,6 +1,3 @@ -/*jsl:import ipa.js */ -/*jsl:import certificate.js */ - /* Authors: * Pavel Zuna * Endi S. Dewata @@ -22,7 +19,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity', './certificate'], function(IPA, $) { IPA.host = {}; @@ -945,3 +943,6 @@ IPA.host.certificate_policy = function(spec) { }; IPA.register('host', IPA.host.entity); + +return {}; +}); diff --git a/install/ui/src/freeipa/hostgroup.js b/install/ui/src/freeipa/hostgroup.js index 20e7179f..54531924 100644 --- a/install/ui/src/freeipa/hostgroup.js +++ b/install/ui/src/freeipa/hostgroup.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Pavel Zuna * @@ -20,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.hostgroup = {}; @@ -88,3 +87,6 @@ IPA.hostgroup.entity = function(spec) { }; IPA.register('hostgroup', IPA.hostgroup.entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/idrange.js b/install/ui/src/freeipa/idrange.js index b2ce3169..847bc98a 100644 --- a/install/ui/src/freeipa/idrange.js +++ b/install/ui/src/freeipa/idrange.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Petr Vobornik * @@ -20,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.idrange = {}; @@ -160,3 +159,6 @@ IPA.idrange.entity = function(spec) { }; IPA.register('idrange', IPA.idrange.entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js index c646d8c4..1619cad5 100644 --- a/install/ui/src/freeipa/ipa.js +++ b/install/ui/src/freeipa/ipa.js @@ -22,9 +22,7 @@ * along with this program. If not, see . */ - -/* REQUIRES: jquery.ordered-map.js */ -/*global $:true, location:true */ +define(['./jquery', './json2'], function($, JSON) { var IPA = function() { @@ -2119,3 +2117,6 @@ IPA.config = { message_fadeout_time: 800, // [ms] message_fadein_time: 400 // [ms] }; + +return IPA; +}); diff --git a/install/ui/src/freeipa/jquery.js b/install/ui/src/freeipa/jquery.js new file mode 100644 index 00000000..da86e95d --- /dev/null +++ b/install/ui/src/freeipa/jquery.js @@ -0,0 +1,26 @@ +/* Authors: + * Petr Vobornik + * + * Copyright (C) 2012 Red Hat + * see file 'COPYING' for use and warranty information + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +// +// AMD Wrapper for jquery library +// +define(function() { + return jQuery; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/json2.js b/install/ui/src/freeipa/json2.js new file mode 100644 index 00000000..dfc4773e --- /dev/null +++ b/install/ui/src/freeipa/json2.js @@ -0,0 +1,27 @@ +/* Authors: + * Petr Vobornik + * + * Copyright (C) 2012 Red Hat + * see file 'COPYING' for use and warranty information + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . +*/ + +// +// AMD Wrapper for json2 library +// + +define(function() { + return JSON; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/navigation.js b/install/ui/src/freeipa/navigation.js index deef37dd..910fb79e 100644 --- a/install/ui/src/freeipa/navigation.js +++ b/install/ui/src/freeipa/navigation.js @@ -21,6 +21,8 @@ * along with this program. If not, see . */ +define(['./ipa', './jquery'], function(IPA, $) { + IPA.navigation = function(spec) { spec = spec || {}; @@ -453,3 +455,6 @@ IPA.navigation = function(spec) { return that; }; + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/net.js b/install/ui/src/freeipa/net.js index b8674919..11a245c0 100644 --- a/install/ui/src/freeipa/net.js +++ b/install/ui/src/freeipa/net.js @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +define(['./ipa', './jquery'], function(IPA, $) { + var NET = {}; NET.ip_address = function(spec) { @@ -391,4 +393,7 @@ NET.ip_address = function(spec) { that.parse(); return that; -}; \ No newline at end of file +}; + +return NET; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/netgroup.js b/install/ui/src/freeipa/netgroup.js index 73deec10..05995e7b 100644 --- a/install/ui/src/freeipa/netgroup.js +++ b/install/ui/src/freeipa/netgroup.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Pavel Zuna * @@ -20,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.netgroup = { remove_method_priority: IPA.config.default_priority - 1, @@ -304,3 +303,6 @@ IPA.netgroup.details_facet = function(spec) { }; IPA.register('netgroup', IPA.netgroup.entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/policy.js b/install/ui/src/freeipa/policy.js index c109163e..5161a454 100644 --- a/install/ui/src/freeipa/policy.js +++ b/install/ui/src/freeipa/policy.js @@ -1,6 +1,3 @@ -/*jsl:import ipa.js */ -/*jsl:import search.js */ - /* Authors: * Adam Young * @@ -21,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.pwpolicy = {}; @@ -120,3 +118,6 @@ IPA.krbtpolicy.entity = function(spec) { IPA.register('pwpolicy', IPA.pwpolicy.entity); IPA.register('krbtpolicy', IPA.krbtpolicy.entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/rule.js b/install/ui/src/freeipa/rule.js index dfe710b9..888fd450 100644 --- a/install/ui/src/freeipa/rule.js +++ b/install/ui/src/freeipa/rule.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Endi Sukma Dewata * @@ -20,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.rule_details_widget = function(spec) { @@ -252,3 +251,6 @@ IPA.rule_association_adder_dialog = function(spec) { return that; }; + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/search.js b/install/ui/src/freeipa/search.js index b54c375f..a3f35b5e 100644 --- a/install/ui/src/freeipa/search.js +++ b/install/ui/src/freeipa/search.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Pavel Zuna * Adam Young @@ -23,7 +21,7 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js */ +define(['./ipa', './jquery', './facet'], function(IPA, $) { IPA.search_facet = function(spec, no_init) { @@ -488,4 +486,7 @@ IPA.batch_enable_action = function(spec) { spec.confirm_msg = spec.confirm_msg || IPA.messages.search.enable_confirm; return IPA.batch_items_action(spec); -}; \ No newline at end of file +}; + +return {}; +}); diff --git a/install/ui/src/freeipa/selinux.js b/install/ui/src/freeipa/selinux.js index ca470060..d8e0d3ea 100644 --- a/install/ui/src/freeipa/selinux.js +++ b/install/ui/src/freeipa/selinux.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Petr Vobornik * @@ -20,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.selinux = { remove_method_priority: IPA.config.default_priority - 1 @@ -312,4 +311,7 @@ IPA.selinux_details_facet = function(spec) { return that; }; -IPA.register('selinuxusermap', IPA.selinux.selinuxusermap_entity); \ No newline at end of file +IPA.register('selinuxusermap', IPA.selinux.selinuxusermap_entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/serverconfig.js b/install/ui/src/freeipa/serverconfig.js index 517aa780..347c46c1 100644 --- a/install/ui/src/freeipa/serverconfig.js +++ b/install/ui/src/freeipa/serverconfig.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Endi Sukma Dewata * Adam Young @@ -21,7 +19,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.serverconfig = {}; @@ -116,3 +115,6 @@ IPA.serverconfig.entity = function(spec) { }; IPA.register('config', IPA.serverconfig.entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/service.js b/install/ui/src/freeipa/service.js index 04e294bf..ecb8ce9b 100644 --- a/install/ui/src/freeipa/service.js +++ b/install/ui/src/freeipa/service.js @@ -1,6 +1,3 @@ -/*jsl:import ipa.js */ -/*jsl:import certificate.js */ - /* Authors: * Endi Sukma Dewata * @@ -21,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.service = {}; @@ -465,3 +463,6 @@ IPA.service.certificate_policy = function(spec) { }; IPA.register('service', IPA.service.entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/sudo.js b/install/ui/src/freeipa/sudo.js index fddcda0b..b13b7ac7 100644 --- a/install/ui/src/freeipa/sudo.js +++ b/install/ui/src/freeipa/sudo.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Endi Sukma Dewata * @@ -20,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.sudo = { //priority of commands in details facet @@ -928,3 +927,6 @@ IPA.sudo.options_section = function(spec) { IPA.register('sudorule', IPA.sudo.rule_entity); IPA.register('sudocmd', IPA.sudo.command_entity); IPA.register('sudocmdgroup', IPA.sudo.command_group_entity); + +return {}; +}); diff --git a/install/ui/src/freeipa/trust.js b/install/ui/src/freeipa/trust.js index 939bb59a..22880bfe 100644 --- a/install/ui/src/freeipa/trust.js +++ b/install/ui/src/freeipa/trust.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Petr Vobornik * @@ -20,7 +18,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity'], function(IPA, $) { IPA.trust = {}; @@ -181,3 +180,6 @@ IPA.trust.adder_dialog = function(spec) { }; IPA.register('trust', IPA.trust.entity); + +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/user.js b/install/ui/src/freeipa/user.js index ac51db2b..a7beca18 100644 --- a/install/ui/src/freeipa/user.js +++ b/install/ui/src/freeipa/user.js @@ -1,5 +1,3 @@ -/*jsl:import ipa.js */ - /* Authors: * Pavel Zuna * Adam Young @@ -23,7 +21,8 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ +define(['./ipa', './jquery', './details', './search', './association', + './entity', './certificate'], function(IPA, $) { IPA.user = {}; @@ -660,4 +659,7 @@ IPA.user.reset_password_acl_evaluator = function(spec) { return that; }; -IPA.register('user', IPA.user.entity); \ No newline at end of file +IPA.register('user', IPA.user.entity); + +return {}; +}); diff --git a/install/ui/src/freeipa/webui.js b/install/ui/src/freeipa/webui.js index f381ab0b..f6c3339e 100644 --- a/install/ui/src/freeipa/webui.js +++ b/install/ui/src/freeipa/webui.js @@ -1,6 +1,3 @@ -/*jsl:import ipa.js */ -/*jsl:import navigation.js */ - /* Authors: * Pavel Zuna * Endi S. Dewata @@ -22,7 +19,7 @@ * along with this program. If not, see . */ -/* REQUIRES: everything, this file puts it all togheter */ +define(['./ipa'], function(IPA) { /* tabs definition for IPA webUI */ @@ -128,77 +125,5 @@ IPA.self_serv_navigation = function(spec) { return that; }; -/* main (document onready event handler) */ -$(function() { - - - - /* main loop (hashchange event handler) */ - function window_hashchange(evt){ - IPA.nav.update(); - } - - function create_navigation() { - var whoami = IPA.whoami; - var factory; - - - if (whoami.hasOwnProperty('memberof_group') && - whoami.memberof_group.indexOf('admins') !== -1) { - factory = IPA.admin_navigation; - } else if (whoami.hasOwnProperty('memberofindirect_group')&& - whoami.memberofindirect_group.indexOf('admins') !== -1) { - factory = IPA.admin_navigation; - } else if (whoami.hasOwnProperty('memberof_role') && - whoami.memberof_role.length > 0) { - factory = IPA.admin_navigation; - } else if (whoami.hasOwnProperty('memberofindirect_role') && - whoami.memberofindirect_role.length > 0) { - factory = IPA.admin_navigation; - } else { - factory = IPA.self_serv_navigation; - } - - return factory({ - container: $('#navigation'), - content: $('#content') - }); - } - - - function init_on_success(data, text_status, xhr) { - $(window).bind('hashchange', window_hashchange); - - var whoami = IPA.whoami; - IPA.whoami_pkey = whoami.uid[0]; - $('#loggedinas .login').text(whoami.cn[0]); - $('#loggedinas a').fragment( - {'user-facet': 'details', 'user-pkey': IPA.whoami_pkey}, 2); - - $('#logout').click(function() { - IPA.logout(); - return false; - }).text(IPA.messages.login.logout); - - $('.header-loggedinas').css('visibility','visible'); - IPA.update_password_expiration(); - - IPA.nav = create_navigation(); - IPA.nav.create(); - IPA.nav.update(); - - $('#login_header').html(IPA.messages.login.header); - } - - - function init_on_error(xhr, text_status, error_thrown) { - var container = $('#content').empty(); - container.append('

Error: '+error_thrown.name+'

'); - container.append('

'+error_thrown.message+'

'); - } - - IPA.init({ - on_success: init_on_success, - on_error: init_on_error - }); -}); +return {}; +}); \ No newline at end of file diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 8d2239d8..dc39c7ec 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -21,7 +21,7 @@ * along with this program. If not, see . */ -/* REQUIRES: ipa.js */ +define(['./ipa', './jquery'], function(IPA, $) { IPA.checkbox_column_width = 22; IPA.required_indicator = '*'; @@ -3556,4 +3556,7 @@ IPA.widget_factories['select'] = IPA.select_widget; IPA.widget_factories['sshkeys'] = IPA.sshkeys_widget; IPA.widget_factories['textarea'] = IPA.textarea_widget; IPA.widget_factories['text'] = IPA.text_widget; -IPA.widget_factories['value_map'] = IPA.value_map_widget; \ No newline at end of file +IPA.widget_factories['value_map'] = IPA.value_map_widget; + +return {}; +}); diff --git a/install/ui/src/libs/browser.js b/install/ui/src/libs/browser.js index 8bfb2de1..78d7de8e 100644 --- a/install/ui/src/libs/browser.js +++ b/install/ui/src/libs/browser.js @@ -60,4 +60,4 @@ if (!Array.prototype.indexOf) { } return -1; }; -} +} \ No newline at end of file -- cgit