/*jsl:import ipa.js */ /* Authors: * Pavel Zuna * Adam Young * Endi S. Dewata * * Copyright (C) 2010 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 . */ /* IPA Object Details - populating definiton lists from entry data */ /* REQUIRES: ipa.js */ IPA.expanded_icon = 'expanded-icon'; IPA.collapsed_icon = 'collapsed-icon'; IPA.details_section = function(spec) { spec = spec || {}; var that = {}; that.name = spec.name || ''; that.label = spec.label || ''; that.entity = spec.entity; that.fields = $.ordered_map(); that.dirty = false; that.dirty_changed = IPA.observer(); that.get_field = function(name) { return that.fields.get(name); }; that.add_field = function(field) { field.entity = that.entity; that.fields.put(field.name, field); field.dirty_changed.attach(that.field_dirty_changed); return field; }; that.field = function(field) { that.add_field(field); return that; }; that.text = function(spec) { spec.entity = that.entity; var field = IPA.text_widget(spec); that.add_field(field); return that; }; that.multivalued_text = function(spec) { spec.entity = that.entity; var field = IPA.multivalued_text_widget(spec); that.add_field(field); return that; }; that.textarea = function(spec) { spec.entity = that.entity; var field = IPA.textarea_widget(spec); that.add_field(field); return that; }; that.radio = function(spec) { spec.entity = that.entity; var field = IPA.radio_widget(spec); that.add_field(field); return that; }; that.create = function(container) { that.container = container; var fields = that.fields.values; for (var i=0; i', { name: field.name, title: field.label, 'class': 'field' }).appendTo(container); field.create(field_container); } }; that.load = function(record) { that.record = record; var fields = that.fields.values; for (var j=0; j', { 'class': 'section-table' }).appendTo(that.container); var fields = that.fields.values; for (var i=0; i').appendTo(table); var td = $('', { 'class': 'section-cell-label' }).appendTo(tr); $('