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
This commit is contained in:
Petr Vobornik
2012-11-12 18:05:13 +01:00
parent e3ce3e4f39
commit 5e90c98849
38 changed files with 351 additions and 187 deletions

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
* Endi S. Dewata <edewata@redhat.com> * Endi S. Dewata <edewata@redhat.com>
@@ -21,7 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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 = {}; IPA.aci = {};
@@ -895,3 +894,6 @@ IPA.register('privilege', IPA.aci.privilege_entity);
IPA.register('role', IPA.aci.role_entity); IPA.register('role', IPA.aci.role_entity);
IPA.register('selfservice', IPA.aci.selfservice_entity); IPA.register('selfservice', IPA.aci.selfservice_entity);
IPA.register('delegation', IPA.aci.delegation_entity); IPA.register('delegation', IPA.aci.delegation_entity);
return IPA.aci;
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
@@ -21,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js */ define(['./ipa', './jquery', './field', './widget', './dialog'], function(IPA, $) {
IPA.entity_adder_dialog = function(spec) { IPA.entity_adder_dialog = function(spec) {
@@ -205,3 +203,6 @@ IPA.entity_adder_dialog = function(spec) {
return that; return that;
}; };
return IPA.entity_adder_dialog;
});

View File

@@ -0,0 +1,126 @@
/* Authors:
* Petr Vobornik <pvoborni@redhat.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
//
// 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('<p>Error: '+error_thrown.name+'</p>');
container.append('<p>'+error_thrown.message+'</p>');
}
return {
run: function() {
IPA.init({
on_success: init_on_success,
on_error: init_on_error
});
}
};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
* Petr Vobornik <pvoborni@redhat.com> * Petr Vobornik <pvoborni@redhat.com>
@@ -21,10 +19,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js */
/* CURRENTLY ALSO REQUIRES search.js, because it reuses it's code to create /* CURRENTLY ALSO REQUIRES search.js, because it reuses it's code to create
* the AssociationList elements; IT NEEDS IT'S OWN CODE! */ * the AssociationList elements; IT NEEDS IT'S OWN CODE! */
define(['./ipa', './jquery', './search', './dialog'], function(IPA, $) {
IPA.associator = function (spec) { IPA.associator = function (spec) {
spec = spec || {}; spec = spec || {};
@@ -1386,4 +1385,7 @@ IPA.attr_read_only_evaluator = function(spec) {
}; };
return that; return that;
}; };
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Petr Vobornik <pvoborni@redhat.com> * Petr Vobornik <pvoborni@redhat.com>
* *
@@ -20,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.automember = {}; IPA.automember = {};
@@ -676,4 +675,7 @@ IPA.automember.default_group_widget = function(spec) {
}; };
IPA.register('automember', IPA.automember.entity); IPA.register('automember', IPA.automember.entity);
return {};
});

View File

@@ -1,6 +1,3 @@
/*jsl:import ipa.js */
/*jsl:import search.js */
/* Authors: /* Authors:
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
* *
@@ -21,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.automount = {}; IPA.automount = {};
@@ -352,3 +350,6 @@ IPA.automount.key_search_facet = function(spec) {
IPA.register('automountlocation', IPA.automount.location_entity); IPA.register('automountlocation', IPA.automount.location_entity);
IPA.register('automountmap', IPA.automount.map_entity); IPA.register('automountmap', IPA.automount.map_entity);
IPA.register('automountkey', IPA.automount.key_entity); IPA.register('automountkey', IPA.automount.key_entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
* Petr Vobornik <pvoborni@redhat.com> * Petr Vobornik <pvoborni@redhat.com>
@@ -21,6 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery', './dialog'], function(IPA, $) {
IPA.cert = {}; IPA.cert = {};
IPA.cert.BEGIN_CERTIFICATE = '-----BEGIN CERTIFICATE-----'; 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.widget_factories['certificate_status'] = IPA.cert.status_widget;
IPA.field_factories['certificate_status'] = IPA.cert.status_field; IPA.field_factories['certificate_status'] = IPA.cert.status_field;
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
@@ -25,7 +23,7 @@
/* IPA Object Details - populating definiton lists from entry data */ /* 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.expanded_icon = 'expanded-icon';
IPA.collapsed_icon = 'collapsed-icon'; IPA.collapsed_icon = 'collapsed-icon';
@@ -1237,3 +1235,6 @@ IPA.disabled_summary_cond = function() {
state: ['disabled'] state: ['disabled']
}; };
}; };
return {};
});

View File

@@ -20,7 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: widget.js, details.js */ define(['./ipa', './jquery', './field', './widget'], function(IPA, $) {
IPA.opened_dialogs = { IPA.opened_dialogs = {
@@ -847,3 +847,6 @@ IPA.confirm_mixin = function() {
} }
}; };
}; };
return {};
});

View File

@@ -1,7 +1,3 @@
/*jsl:import ipa.js */
/*jsl:import search.js */
/*jsl:import net.js */
/* Authors: /* Authors:
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
* Petr Vobornik <pvoborni@redhat.com> * Petr Vobornik <pvoborni@redhat.com>
@@ -23,8 +19,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* 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 = { IPA.dns = {
zone_permission_name: 'Manage DNS zone ${dnszone}' 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('dnsconfig', IPA.dns.config_entity);
IPA.register('dnszone', IPA.dns.zone_entity); IPA.register('dnszone', IPA.dns.zone_entity);
IPA.register('dnsrecord', IPA.dns.record_entity); IPA.register('dnsrecord', IPA.dns.record_entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Endi S. Dewata <edewata@redhat.com> * Endi S. Dewata <edewata@redhat.com>
* *
@@ -20,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* 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 = {}; IPA.entitle = {};
@@ -743,3 +741,6 @@ IPA.entitle.download_widget = function(spec) {
}; };
IPA.register('entitle', IPA.entitle.entity); IPA.register('entitle', IPA.entitle.entity);
return {};
});

View File

@@ -1,7 +1,3 @@
/*jsl:import ipa.js */
/*jsl:import facet.js */
/*jsl:import navigation.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
@@ -25,7 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, facet.js, details.js, search.js, add.js */ define(['./ipa', './jquery', './facet'], function(IPA, $) {
IPA.entity = function(spec) { IPA.entity = function(spec) {
@@ -728,4 +724,7 @@ IPA.details_facet_update_policy = function(spec) {
spec.dest_facet = 'search'; spec.dest_facet = 'search';
return IPA.facet_update_policy(spec); return IPA.facet_update_policy(spec);
}; };
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
@@ -23,7 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js */ define(['./ipa', './jquery', './dialog', './field', './widget'], function(IPA, $) {
IPA.facet = function(spec, no_init) { IPA.facet = function(spec, no_init) {
@@ -2041,4 +2039,7 @@ IPA.action_list_widget = function(spec) {
}; };
return that; return that;
}; };
return {};
});

View File

@@ -1,4 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
@@ -22,7 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, widget.js */ define(['./ipa', './jquery'], function(IPA, $) {
IPA.field = function(spec) { IPA.field = function(spec) {
spec = spec || {}; spec = spec || {};
@@ -948,4 +947,7 @@ IPA.field_factories['select'] = IPA.select_field;
IPA.field_factories['sshkeys'] = IPA.sshkeys_field; IPA.field_factories['sshkeys'] = IPA.sshkeys_field;
IPA.field_factories['textarea'] = IPA.field; IPA.field_factories['textarea'] = IPA.field;
IPA.field_factories['text'] = IPA.field; IPA.field_factories['text'] = IPA.field;
IPA.field_factories['value_map'] = IPA.field; IPA.field_factories['value_map'] = IPA.field;
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* Endi Dewata <edewata@redhat.com> * Endi Dewata <edewata@redhat.com>
@@ -22,7 +20,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.group = {}; IPA.group = {};
@@ -257,3 +256,6 @@ IPA.group.make_external_action = function(spec) {
}; };
IPA.register('group', IPA.group.entity); IPA.register('group', IPA.group.entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
@@ -21,7 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.hbac = { IPA.hbac = {
//priority of commands in details facet //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('hbacrule', IPA.hbac.rule_entity);
IPA.register('hbacsvc', IPA.hbac.service_entity); IPA.register('hbacsvc', IPA.hbac.service_entity);
IPA.register('hbacsvcgroup', IPA.hbac.service_group_entity); IPA.register('hbacsvcgroup', IPA.hbac.service_group_entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
* *
@@ -20,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* 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) { IPA.hbac.test_entity = function(spec) {
@@ -840,3 +839,6 @@ IPA.hbac.validation_dialog = function(spec) {
}; };
IPA.register('hbactest', IPA.hbac.test_entity); IPA.register('hbactest', IPA.hbac.test_entity);
return {};
});

View File

@@ -1,6 +1,3 @@
/*jsl:import ipa.js */
/*jsl:import certificate.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* Endi S. Dewata <edewata@redhat.com> * Endi S. Dewata <edewata@redhat.com>
@@ -22,7 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* 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 = {}; IPA.host = {};
@@ -945,3 +943,6 @@ IPA.host.certificate_policy = function(spec) {
}; };
IPA.register('host', IPA.host.entity); IPA.register('host', IPA.host.entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* *
@@ -20,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.hostgroup = {}; IPA.hostgroup = {};
@@ -88,3 +87,6 @@ IPA.hostgroup.entity = function(spec) {
}; };
IPA.register('hostgroup', IPA.hostgroup.entity); IPA.register('hostgroup', IPA.hostgroup.entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Petr Vobornik <pvoborni@redhat.com> * Petr Vobornik <pvoborni@redhat.com>
* *
@@ -20,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.idrange = {}; IPA.idrange = {};
@@ -160,3 +159,6 @@ IPA.idrange.entity = function(spec) {
}; };
IPA.register('idrange', IPA.idrange.entity); IPA.register('idrange', IPA.idrange.entity);
return {};
});

View File

@@ -22,9 +22,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./jquery', './json2'], function($, JSON) {
/* REQUIRES: jquery.ordered-map.js */
/*global $:true, location:true */
var IPA = function() { var IPA = function() {
@@ -2119,3 +2117,6 @@ IPA.config = {
message_fadeout_time: 800, // [ms] message_fadeout_time: 800, // [ms]
message_fadein_time: 400 // [ms] message_fadein_time: 400 // [ms]
}; };
return IPA;
});

26
install/ui/src/freeipa/jquery.js vendored Normal file
View File

@@ -0,0 +1,26 @@
/* Authors:
* Petr Vobornik <pvoborni@redhat.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
//
// AMD Wrapper for jquery library
//
define(function() {
return jQuery;
});

View File

@@ -0,0 +1,27 @@
/* Authors:
* Petr Vobornik <pvoborni@redhat.com>
*
* 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 <http://www.gnu.org/licenses/>.
*/
//
// AMD Wrapper for json2 library
//
define(function() {
return JSON;
});

View File

@@ -21,6 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery'], function(IPA, $) {
IPA.navigation = function(spec) { IPA.navigation = function(spec) {
spec = spec || {}; spec = spec || {};
@@ -453,3 +455,6 @@ IPA.navigation = function(spec) {
return that; return that;
}; };
return {};
});

View File

@@ -18,6 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
define(['./ipa', './jquery'], function(IPA, $) {
var NET = {}; var NET = {};
NET.ip_address = function(spec) { NET.ip_address = function(spec) {
@@ -391,4 +393,7 @@ NET.ip_address = function(spec) {
that.parse(); that.parse();
return that; return that;
}; };
return NET;
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* *
@@ -20,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.netgroup = { IPA.netgroup = {
remove_method_priority: IPA.config.default_priority - 1, remove_method_priority: IPA.config.default_priority - 1,
@@ -304,3 +303,6 @@ IPA.netgroup.details_facet = function(spec) {
}; };
IPA.register('netgroup', IPA.netgroup.entity); IPA.register('netgroup', IPA.netgroup.entity);
return {};
});

View File

@@ -1,6 +1,3 @@
/*jsl:import ipa.js */
/*jsl:import search.js */
/* Authors: /* Authors:
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
* *
@@ -21,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.pwpolicy = {}; IPA.pwpolicy = {};
@@ -120,3 +118,6 @@ IPA.krbtpolicy.entity = function(spec) {
IPA.register('pwpolicy', IPA.pwpolicy.entity); IPA.register('pwpolicy', IPA.pwpolicy.entity);
IPA.register('krbtpolicy', IPA.krbtpolicy.entity); IPA.register('krbtpolicy', IPA.krbtpolicy.entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
* *
@@ -20,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* 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) { IPA.rule_details_widget = function(spec) {
@@ -252,3 +251,6 @@ IPA.rule_association_adder_dialog = function(spec) {
return that; return that;
}; };
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
@@ -23,7 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js */ define(['./ipa', './jquery', './facet'], function(IPA, $) {
IPA.search_facet = function(spec, no_init) { 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; spec.confirm_msg = spec.confirm_msg || IPA.messages.search.enable_confirm;
return IPA.batch_items_action(spec); return IPA.batch_items_action(spec);
}; };
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Petr Vobornik <pvoborni@redhat.com> * Petr Vobornik <pvoborni@redhat.com>
* *
@@ -20,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.selinux = { IPA.selinux = {
remove_method_priority: IPA.config.default_priority - 1 remove_method_priority: IPA.config.default_priority - 1
@@ -312,4 +311,7 @@ IPA.selinux_details_facet = function(spec) {
return that; return that;
}; };
IPA.register('selinuxusermap', IPA.selinux.selinuxusermap_entity); IPA.register('selinuxusermap', IPA.selinux.selinuxusermap_entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
@@ -21,7 +19,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.serverconfig = {}; IPA.serverconfig = {};
@@ -116,3 +115,6 @@ IPA.serverconfig.entity = function(spec) {
}; };
IPA.register('config', IPA.serverconfig.entity); IPA.register('config', IPA.serverconfig.entity);
return {};
});

View File

@@ -1,6 +1,3 @@
/*jsl:import ipa.js */
/*jsl:import certificate.js */
/* Authors: /* Authors:
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
* *
@@ -21,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.service = {}; IPA.service = {};
@@ -465,3 +463,6 @@ IPA.service.certificate_policy = function(spec) {
}; };
IPA.register('service', IPA.service.entity); IPA.register('service', IPA.service.entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Endi Sukma Dewata <edewata@redhat.com> * Endi Sukma Dewata <edewata@redhat.com>
* *
@@ -20,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.sudo = { IPA.sudo = {
//priority of commands in details facet //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('sudorule', IPA.sudo.rule_entity);
IPA.register('sudocmd', IPA.sudo.command_entity); IPA.register('sudocmd', IPA.sudo.command_entity);
IPA.register('sudocmdgroup', IPA.sudo.command_group_entity); IPA.register('sudocmdgroup', IPA.sudo.command_group_entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Petr Vobornik <pvoborni@redhat.com> * Petr Vobornik <pvoborni@redhat.com>
* *
@@ -20,7 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js, details.js, search.js, add.js, facet.js, entity.js */ define(['./ipa', './jquery', './details', './search', './association',
'./entity'], function(IPA, $) {
IPA.trust = {}; IPA.trust = {};
@@ -181,3 +180,6 @@ IPA.trust.adder_dialog = function(spec) {
}; };
IPA.register('trust', IPA.trust.entity); IPA.register('trust', IPA.trust.entity);
return {};
});

View File

@@ -1,5 +1,3 @@
/*jsl:import ipa.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* Adam Young <ayoung@redhat.com> * Adam Young <ayoung@redhat.com>
@@ -23,7 +21,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* 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 = {}; IPA.user = {};
@@ -660,4 +659,7 @@ IPA.user.reset_password_acl_evaluator = function(spec) {
return that; return that;
}; };
IPA.register('user', IPA.user.entity); IPA.register('user', IPA.user.entity);
return {};
});

View File

@@ -1,6 +1,3 @@
/*jsl:import ipa.js */
/*jsl:import navigation.js */
/* Authors: /* Authors:
* Pavel Zuna <pzuna@redhat.com> * Pavel Zuna <pzuna@redhat.com>
* Endi S. Dewata <edewata@redhat.com> * Endi S. Dewata <edewata@redhat.com>
@@ -22,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: everything, this file puts it all togheter */ define(['./ipa'], function(IPA) {
/* tabs definition for IPA webUI */ /* tabs definition for IPA webUI */
@@ -128,77 +125,5 @@ IPA.self_serv_navigation = function(spec) {
return that; return that;
}; };
/* main (document onready event handler) */ return {};
$(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('<p>Error: '+error_thrown.name+'</p>');
container.append('<p>'+error_thrown.message+'</p>');
}
IPA.init({
on_success: init_on_success,
on_error: init_on_error
});
});

View File

@@ -21,7 +21,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* REQUIRES: ipa.js */ define(['./ipa', './jquery'], function(IPA, $) {
IPA.checkbox_column_width = 22; IPA.checkbox_column_width = 22;
IPA.required_indicator = '*'; IPA.required_indicator = '*';
@@ -3556,4 +3556,7 @@ IPA.widget_factories['select'] = IPA.select_widget;
IPA.widget_factories['sshkeys'] = IPA.sshkeys_widget; IPA.widget_factories['sshkeys'] = IPA.sshkeys_widget;
IPA.widget_factories['textarea'] = IPA.textarea_widget; IPA.widget_factories['textarea'] = IPA.textarea_widget;
IPA.widget_factories['text'] = IPA.text_widget; IPA.widget_factories['text'] = IPA.text_widget;
IPA.widget_factories['value_map'] = IPA.value_map_widget; IPA.widget_factories['value_map'] = IPA.value_map_widget;
return {};
});

View File

@@ -60,4 +60,4 @@ if (!Array.prototype.indexOf) {
} }
return -1; return -1;
}; };
} }