2011-01-28 15:46:19 -06:00
|
|
|
/*jsl:import ipa.js */
|
|
|
|
/* Authors:
|
|
|
|
* Endi Sukma Dewata <edewata@redhat.com>
|
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* REQUIRES: widget.js */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is a base class for dialog boxes.
|
|
|
|
*/
|
|
|
|
IPA.dialog = function(spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = {};
|
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
that.entity = spec.entity;
|
2011-01-28 15:46:19 -06:00
|
|
|
that.name = spec.name;
|
2011-08-05 10:12:21 -05:00
|
|
|
that.id = spec.id;
|
2011-01-28 15:46:19 -06:00
|
|
|
that.title = spec.title;
|
2011-07-15 12:18:59 -05:00
|
|
|
that.width = spec.width || 400;
|
2011-03-07 12:35:11 -06:00
|
|
|
that.height = spec.height;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
that.buttons = {};
|
|
|
|
|
2011-05-16 22:23:20 -05:00
|
|
|
that.fields = $.ordered_map();
|
2011-05-27 12:04:20 -05:00
|
|
|
that.sections = $.ordered_map();
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-05-27 10:32:17 -05:00
|
|
|
that.conditional_fields = [];
|
|
|
|
|
|
|
|
that.enable_conditional_fields = function(){
|
|
|
|
for (var i =0; i < that.conditional_fields.length; i+=1) {
|
|
|
|
$('label[id='+
|
|
|
|
that.conditional_fields[i] +'-label]',
|
|
|
|
that.container).css('visibility','visible');
|
|
|
|
$('input[name='+
|
|
|
|
that.conditional_fields[i] +
|
|
|
|
']',that.container).css('visibility','visible');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
that.disable_conditional_fields = function(){
|
|
|
|
for (var i =0; i < that.conditional_fields.length; i+=1) {
|
|
|
|
$('label[id='+
|
|
|
|
that.conditional_fields[i] +'-label]',
|
|
|
|
that.container).css('visibility','hidden');
|
|
|
|
|
|
|
|
$('input[name='+
|
|
|
|
that.conditional_fields[i] +
|
|
|
|
']',that.container).css('visibility','hidden');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.add_button = function(name, handler) {
|
|
|
|
that.buttons[name] = handler;
|
|
|
|
};
|
|
|
|
|
|
|
|
that.get_field = function(name) {
|
2011-05-16 22:23:20 -05:00
|
|
|
return that.fields.get(name);
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.add_field = function(field) {
|
2011-05-27 10:32:17 -05:00
|
|
|
field.dialog = that;
|
2011-05-16 22:23:20 -05:00
|
|
|
that.fields.put(field.name, field);
|
2011-05-27 10:32:17 -05:00
|
|
|
if (field.conditional){
|
|
|
|
that.conditional_fields.push(field.name);
|
|
|
|
}
|
2011-07-09 03:01:46 -05:00
|
|
|
return field;
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
2011-04-26 16:21:25 -05:00
|
|
|
that.field = function(field) {
|
2011-01-28 15:46:19 -06:00
|
|
|
that.add_field(field);
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
2011-04-26 16:21:25 -05:00
|
|
|
that.is_valid = function() {
|
2011-05-16 22:23:20 -05:00
|
|
|
var fields = that.fields.values;
|
|
|
|
for (var i=0; i<fields.length; i++) {
|
|
|
|
var field = fields[i];
|
2011-04-26 16:21:25 -05:00
|
|
|
if (!field.valid) return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
2011-03-18 15:43:54 -05:00
|
|
|
that.text = function(name){
|
|
|
|
that.field(IPA.text_widget({
|
|
|
|
name: name,
|
|
|
|
undo: false,
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
entity : that.entity
|
2011-03-18 15:43:54 -05:00
|
|
|
}));
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.add_section = function(section) {
|
2011-05-27 12:04:20 -05:00
|
|
|
that.sections.put(section.name, section);
|
2011-01-28 15:46:19 -06:00
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
|
|
|
that.section = function(section) {
|
|
|
|
that.add_section(section);
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
|
|
|
that.create_section = function(spec) {
|
|
|
|
var section = IPA.details_section(spec);
|
|
|
|
that.add_section(section);
|
|
|
|
return section;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create content layout
|
|
|
|
*/
|
|
|
|
that.create = function() {
|
|
|
|
|
|
|
|
var table = $('<table/>').appendTo(that.container);
|
|
|
|
|
2011-05-16 22:23:20 -05:00
|
|
|
var fields = that.fields.values;
|
|
|
|
for (var i=0; i<fields.length; i++) {
|
|
|
|
var field = fields[i];
|
2011-02-09 10:56:25 -06:00
|
|
|
if (field.hidden) continue;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
var tr = $('<tr/>').appendTo(table);
|
|
|
|
|
|
|
|
var td = $('<td/>', {
|
|
|
|
style: 'vertical-align: top;',
|
|
|
|
title: field.label
|
|
|
|
}).appendTo(tr);
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
var label_text = field.label;
|
|
|
|
if (label_text !== null){
|
|
|
|
label_text += ': ';
|
|
|
|
}else{
|
|
|
|
label_text = '';
|
|
|
|
}
|
2011-05-27 10:32:17 -05:00
|
|
|
td.append($('<label />',{id: field.name+'-label',
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
text: label_text}));
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
td = $('<td/>', {
|
|
|
|
style: 'vertical-align: top;'
|
|
|
|
}).appendTo(tr);
|
|
|
|
|
|
|
|
var span = $('<span/>', { 'name': field.name }).appendTo(td);
|
|
|
|
field.create(span);
|
2011-06-20 20:20:13 -05:00
|
|
|
field.field_span = span;
|
|
|
|
|
|
|
|
if (field.optional){
|
|
|
|
span.css('display','none');
|
|
|
|
td.append(
|
|
|
|
$('<a/>',{
|
|
|
|
text: IPA.messages.widget.optional,
|
|
|
|
href:'',
|
|
|
|
click: function(){
|
|
|
|
var span = $(this).prev();
|
|
|
|
span.css('display','inline');
|
|
|
|
$(this).css('display','none');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
}
|
|
|
|
|
2011-05-27 12:04:20 -05:00
|
|
|
var sections = that.sections.values;
|
|
|
|
for (var j=0; j<sections.length; j++) {
|
|
|
|
var section = sections[j];
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
var div = $('<div/>', {
|
2011-02-10 16:10:53 -06:00
|
|
|
name: section.name,
|
2011-01-28 15:46:19 -06:00
|
|
|
'class': 'details-section'
|
|
|
|
}).appendTo(that.container);
|
|
|
|
|
|
|
|
section.create(div);
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
/**
|
|
|
|
* Open dialog
|
|
|
|
*/
|
|
|
|
that.open = function(container) {
|
|
|
|
|
2011-08-05 10:12:21 -05:00
|
|
|
that.container = $('<div/>', { id : that.id });
|
2011-03-07 12:35:11 -06:00
|
|
|
if (container) {
|
|
|
|
container.append(that.container);
|
|
|
|
}
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-07-21 02:54:07 -05:00
|
|
|
that.create();
|
|
|
|
|
|
|
|
that.container.dialog({
|
2011-08-02 16:48:08 -05:00
|
|
|
title: that.title,
|
|
|
|
modal: true,
|
|
|
|
width: that.width,
|
|
|
|
minWidth: that.width,
|
|
|
|
height: that.height,
|
|
|
|
minHeight: that.height,
|
|
|
|
buttons: that.buttons,
|
2011-07-21 02:54:07 -05:00
|
|
|
close: function(event, ui) {
|
|
|
|
that.close();
|
|
|
|
}
|
|
|
|
});
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.option = function(name, value) {
|
|
|
|
that.container.dialog('option', name, value);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.save = function(record) {
|
2011-05-16 22:23:20 -05:00
|
|
|
var fields = that.fields.values;
|
|
|
|
for (var i=0; i<fields.length; i++) {
|
|
|
|
var field = fields[i];
|
2011-01-28 15:46:19 -06:00
|
|
|
var values = field.save();
|
|
|
|
record[field.name] = values.join(',');
|
|
|
|
}
|
|
|
|
|
2011-05-27 12:04:20 -05:00
|
|
|
var sections = that.sections.values;
|
|
|
|
for (var j=0; j<sections.length; j++) {
|
|
|
|
var section = sections[j];
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
if (section.save) {
|
|
|
|
section.save(record);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
that.close = function() {
|
|
|
|
that.container.dialog('destroy');
|
|
|
|
that.container.remove();
|
|
|
|
};
|
|
|
|
|
|
|
|
that.reset = function() {
|
2011-05-16 22:23:20 -05:00
|
|
|
var fields = that.fields.values;
|
|
|
|
for (var i=0; i<fields.length; i++) {
|
|
|
|
var field = fields[i];
|
2011-01-28 15:46:19 -06:00
|
|
|
field.reset();
|
|
|
|
}
|
2011-05-27 12:04:20 -05:00
|
|
|
|
|
|
|
var sections = that.sections.values;
|
|
|
|
for (var j=0; j<sections.length; j++) {
|
|
|
|
sections[j].reset();
|
2011-02-07 22:02:43 -06:00
|
|
|
}
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.dialog_create = that.create;
|
|
|
|
that.dialog_open = that.open;
|
2011-08-05 10:12:21 -05:00
|
|
|
that.dialog_close = that.close;
|
2011-08-08 17:24:05 -05:00
|
|
|
that.dialog_save = that.save;
|
2011-08-23 20:45:06 -05:00
|
|
|
that.dialog_reset = that.reset;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-04-07 16:14:58 -05:00
|
|
|
var fields = spec.fields || [];
|
|
|
|
for (var i=0; i<fields.length; i++) {
|
|
|
|
var field_spec = fields[i];
|
|
|
|
var field;
|
|
|
|
|
|
|
|
if (field_spec instanceof Object) {
|
2011-04-14 15:43:57 -05:00
|
|
|
var factory = field_spec.factory || IPA.text_widget;
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
field_spec.entity = that.entity;
|
2011-04-14 15:43:57 -05:00
|
|
|
field = factory(field_spec);
|
2011-04-18 10:59:50 -05:00
|
|
|
|
|
|
|
/* This is a bit of a hack, and is here to support ACI
|
|
|
|
permissions. The target section is a group of several
|
|
|
|
widgets together. It makes more sense to do them as a
|
|
|
|
section than as a widget. However, since they can be mixed
|
|
|
|
into the flow with the other widgets, the section needs to
|
|
|
|
be defined here with the fields to get the order correct.*/
|
|
|
|
if (field.section) {
|
|
|
|
that.add_section(field);
|
|
|
|
} else {
|
|
|
|
that.add_field(field);
|
|
|
|
}
|
|
|
|
|
2011-04-07 16:14:58 -05:00
|
|
|
} else {
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
field = IPA.text_widget({
|
|
|
|
name: field_spec,
|
|
|
|
entity:that.entity,
|
|
|
|
undo: false });
|
2011-04-18 10:59:50 -05:00
|
|
|
that.add_field(field);
|
2011-04-07 16:14:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This dialog provides an interface for searching and selecting
|
|
|
|
* values from the available results.
|
|
|
|
*/
|
|
|
|
IPA.adder_dialog = function (spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = IPA.dialog(spec);
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
that.external = spec.external;
|
2011-07-15 12:18:59 -05:00
|
|
|
that.width = spec.width || 600;
|
|
|
|
that.height = spec.height || 360;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
if (!that.entity){
|
|
|
|
var except = {
|
|
|
|
expected: false,
|
|
|
|
message:'Adder dialog created without entity.'
|
|
|
|
};
|
|
|
|
throw except;
|
|
|
|
}
|
|
|
|
|
2011-05-16 22:23:20 -05:00
|
|
|
that.columns = $.ordered_map();
|
2011-01-28 15:46:19 -06:00
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.get_column = function(name) {
|
2011-05-16 22:23:20 -05:00
|
|
|
return that.columns.get(name);
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.add_column = function(column) {
|
2011-05-16 22:23:20 -05:00
|
|
|
that.columns.put(column.name, column);
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.set_columns = function(columns) {
|
|
|
|
that.clear_columns();
|
|
|
|
for (var i=0; i<columns.length; i++) {
|
|
|
|
that.add_column(columns[i]);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
that.clear_columns = function() {
|
2011-05-16 22:23:20 -05:00
|
|
|
that.columns.empty();
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.create_column = function(spec) {
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
spec.entity = that.entity;
|
2011-01-28 15:46:19 -06:00
|
|
|
var column = IPA.column(spec);
|
|
|
|
that.add_column(column);
|
|
|
|
return column;
|
|
|
|
};
|
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
function initialize_table(){
|
2011-01-28 15:46:19 -06:00
|
|
|
that.available_table = IPA.table_widget({
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
entity: that.entity,
|
2011-01-28 15:46:19 -06:00
|
|
|
name: 'available',
|
2011-08-02 16:48:08 -05:00
|
|
|
scrollable: true
|
2011-01-28 15:46:19 -06:00
|
|
|
});
|
|
|
|
|
2011-05-16 22:23:20 -05:00
|
|
|
var columns = that.columns.values;
|
|
|
|
that.available_table.set_columns(columns);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
that.selected_table = IPA.table_widget({
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
entity: that.entity,
|
2011-01-28 15:46:19 -06:00
|
|
|
name: 'selected',
|
2011-08-02 16:48:08 -05:00
|
|
|
scrollable: true
|
2011-01-28 15:46:19 -06:00
|
|
|
});
|
|
|
|
|
2011-05-16 22:23:20 -05:00
|
|
|
that.selected_table.set_columns(columns);
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
}
|
2011-01-28 15:46:19 -06:00
|
|
|
that.create = function() {
|
|
|
|
|
2011-07-28 21:25:26 -05:00
|
|
|
/*TODO: move this earlier
|
|
|
|
The table initialization should be done earlier. However,
|
|
|
|
the adder columns are not added until after initialization is over,
|
|
|
|
and thus we have to dleay the creation of the table.*/
|
|
|
|
initialize_table();
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
// do not call that.dialog_create();
|
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
var container = $('<div/>', {
|
|
|
|
'class': 'adder-dialog'
|
2011-01-28 15:46:19 -06:00
|
|
|
}).appendTo(that.container);
|
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
var top_panel = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-top'
|
|
|
|
}).appendTo(container);
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
$('<input/>', {
|
|
|
|
type: 'text',
|
2011-08-02 16:48:08 -05:00
|
|
|
name: 'filter'
|
|
|
|
}).appendTo(top_panel);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
top_panel.append(' ');
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
$('<input/>', {
|
|
|
|
type: 'button',
|
|
|
|
name: 'find',
|
2011-07-27 16:35:16 -05:00
|
|
|
value: IPA.messages.buttons.find
|
2011-08-02 16:48:08 -05:00
|
|
|
}).appendTo(top_panel);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
top_panel.append(IPA.create_network_spinner());
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
var left_panel = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-left'
|
|
|
|
}).appendTo(container);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
var available_panel = $('<div/>', {
|
|
|
|
name: 'available',
|
|
|
|
'class': 'adder-dialog-available'
|
2011-08-02 16:48:08 -05:00
|
|
|
}).appendTo(left_panel);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
$('<div/>', {
|
2011-02-16 12:46:59 -06:00
|
|
|
html: IPA.messages.dialogs.available,
|
2011-08-02 16:48:08 -05:00
|
|
|
'class': 'adder-dialog-header ui-widget-header'
|
2011-01-28 15:46:19 -06:00
|
|
|
}).appendTo(available_panel);
|
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
var available_content = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-content'
|
|
|
|
}).appendTo(available_panel);
|
|
|
|
|
|
|
|
that.available_table.create(available_content);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
var right_panel = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-right'
|
|
|
|
}).appendTo(container);
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
var selected_panel = $('<div/>', {
|
|
|
|
name: 'selected',
|
|
|
|
'class': 'adder-dialog-selected'
|
2011-08-02 16:48:08 -05:00
|
|
|
}).appendTo(right_panel);
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
$('<div/>', {
|
2011-02-16 12:46:59 -06:00
|
|
|
html: IPA.messages.dialogs.prospective,
|
2011-08-02 16:48:08 -05:00
|
|
|
'class': 'adder-dialog-header ui-widget-header'
|
|
|
|
}).appendTo(selected_panel);
|
|
|
|
|
|
|
|
var selected_content = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-content'
|
2011-01-28 15:46:19 -06:00
|
|
|
}).appendTo(selected_panel);
|
|
|
|
|
2011-08-02 16:48:08 -05:00
|
|
|
that.selected_table.create(selected_content);
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
|
2011-08-15 09:13:13 -05:00
|
|
|
var buttons_panel = $('<div/>', {
|
|
|
|
name: 'buttons',
|
|
|
|
'class': 'adder-dialog-buttons'
|
|
|
|
}).appendTo(container);
|
|
|
|
|
|
|
|
var p = $('<p/>').appendTo(buttons_panel);
|
|
|
|
$('<input />', {
|
|
|
|
type: 'button',
|
|
|
|
name: 'remove',
|
|
|
|
value: '<<'
|
|
|
|
}).appendTo(p);
|
|
|
|
|
|
|
|
p = $('<p/>').appendTo(buttons_panel);
|
|
|
|
$('<input />', {
|
|
|
|
type: 'button',
|
|
|
|
name: 'add',
|
|
|
|
value: '>>'
|
|
|
|
}).appendTo(p);
|
|
|
|
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.filter_field = $('input[name=filter]', that.container);
|
|
|
|
|
|
|
|
var button = $('input[name=find]', that.container);
|
|
|
|
that.find_button = IPA.button({
|
2011-06-21 15:05:44 -05:00
|
|
|
name: 'find',
|
2011-01-28 15:46:19 -06:00
|
|
|
'label': button.val(),
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
'click': function() {
|
|
|
|
that.search();
|
|
|
|
return false;
|
|
|
|
}
|
2011-01-28 15:46:19 -06:00
|
|
|
});
|
|
|
|
button.replaceWith(that.find_button);
|
|
|
|
|
|
|
|
button = $('input[name=remove]', that.container);
|
|
|
|
that.remove_button = IPA.button({
|
2011-06-21 15:05:44 -05:00
|
|
|
name: 'remove',
|
2011-01-28 15:46:19 -06:00
|
|
|
'label': button.val(),
|
|
|
|
'click': function() {
|
|
|
|
that.remove();
|
2011-06-13 23:18:57 -05:00
|
|
|
return false;
|
2011-01-28 15:46:19 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
button.replaceWith(that.remove_button);
|
|
|
|
|
|
|
|
button = $('input[name=add]', that.container);
|
|
|
|
that.add_button = IPA.button({
|
2011-06-21 15:05:44 -05:00
|
|
|
name: 'add',
|
2011-01-28 15:46:19 -06:00
|
|
|
'label': button.val(),
|
|
|
|
'click': function() {
|
|
|
|
that.add();
|
2011-06-13 23:18:57 -05:00
|
|
|
return false;
|
2011-01-28 15:46:19 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
button.replaceWith(that.add_button);
|
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
if (that.external) {
|
2011-08-02 16:48:08 -05:00
|
|
|
container.addClass('adder-dialog-with-external');
|
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
var external_panel = $('<div/>', {
|
|
|
|
name: 'external',
|
|
|
|
'class': 'adder-dialog-external'
|
2011-08-02 16:48:08 -05:00
|
|
|
}).appendTo(left_panel);
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
|
|
|
$('<div/>', {
|
|
|
|
html: IPA.messages.objects.sudorule.external,
|
2011-08-02 16:48:08 -05:00
|
|
|
'class': 'adder-dialog-header ui-widget-header'
|
|
|
|
}).appendTo(external_panel);
|
|
|
|
|
|
|
|
var external_content = $('<div/>', {
|
|
|
|
'class': 'adder-dialog-content'
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
}).appendTo(external_panel);
|
|
|
|
|
|
|
|
that.external_field = $('<input/>', {
|
|
|
|
type: 'text',
|
2011-08-02 16:48:08 -05:00
|
|
|
name: 'external'
|
|
|
|
}).appendTo(external_content);
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.search();
|
|
|
|
};
|
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.open = function(container) {
|
2011-02-21 18:36:42 -06:00
|
|
|
|
|
|
|
that.buttons[IPA.messages.buttons.enroll] = that.execute;
|
|
|
|
that.buttons[IPA.messages.buttons.cancel] = that.close;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
that.dialog_open(container);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.add = function() {
|
|
|
|
var rows = that.available_table.remove_selected_rows();
|
|
|
|
that.selected_table.add_rows(rows);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.remove = function() {
|
|
|
|
var rows = that.selected_table.remove_selected_rows();
|
|
|
|
that.available_table.add_rows(rows);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.get_filter = function() {
|
|
|
|
return that.filter_field.val();
|
|
|
|
};
|
|
|
|
|
|
|
|
that.get_hide_checkbox = function() {
|
|
|
|
return that.hide_checkbox.checked;
|
|
|
|
};
|
|
|
|
|
|
|
|
that.clear_available_values = function() {
|
|
|
|
that.available_table.empty();
|
|
|
|
};
|
|
|
|
|
|
|
|
that.clear_selected_values = function() {
|
|
|
|
that.selected_table.empty();
|
|
|
|
};
|
|
|
|
|
|
|
|
that.add_available_value = function(record) {
|
|
|
|
that.available_table.add_record(record);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.get_selected_values = function() {
|
|
|
|
return that.selected_table.save();
|
|
|
|
};
|
|
|
|
|
removing setters setup and init
change widget and widget unit tests to hold on to entity, not entity name.
Replacing entity_name with entity.name in most places.
The one exception is columns for table_widget.
Widgets that refer to other entities have to have late resolution of the entity object, due to circular dependencies.
cleanup entity assignment.
removed template and layout,
merged setup into create
adder dialogs adjust height for external
removed init from widget, isection, association, facet, host and service
Make unit tests use factory.
fix functional tests to click find link correctly.
tweak to activation test, but still broken.
moved initialization code to the end
use --all for hbacrule find, so the type shows up now
fixed dns exception code and exception handling for get_entity
replace metadata look up with value from entity.
fixed author lines
removed duplicate columns in managed by facets.
tweak to nav fix in order to initialize tab.
more defensive code
update metadata for true false
one line init for entity_name in widget
move init code to end of constructor functions
moved constants to start of function for adder_dialog
external fields for dialogs initialized at dialog creation
sudo sections: move add fields and columns to widget definition.
The parameter validation in IPA.column ...This is precondition checking. Note that it merely throws an exception if the entity_name is not set. I want this stuff at the top of the function so that it is obvious to people looking to use them what is required. I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.
decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables
return false at the end of click handler
removed blank labels in sudo command section
fix radio buttons for sudo category
fixed table side for adder dialogs with external fields
comments for future direction with add_columns
https://fedorahosted.org/freeipa/ticket/1451
https://fedorahosted.org/freeipa/ticket/1462
https://fedorahosted.org/freeipa/ticket/1493
https://fedorahosted.org/freeipa/ticket/1497
https://fedorahosted.org/freeipa/ticket/1532
https://fedorahosted.org/freeipa/ticket/1534
2011-07-25 11:15:14 -05:00
|
|
|
/*dialog initialization */
|
|
|
|
if (spec.columns){
|
|
|
|
for (var i =0; i < spec.columns.length; i +=1){
|
|
|
|
that.create_column(spec.columns[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
that.adder_dialog_create = that.create;
|
|
|
|
|
|
|
|
return that;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This dialog displays the values to be deleted.
|
|
|
|
*/
|
|
|
|
IPA.deleter_dialog = function (spec) {
|
|
|
|
|
|
|
|
spec = spec || {};
|
|
|
|
|
|
|
|
var that = IPA.dialog(spec);
|
|
|
|
|
2011-02-16 12:46:59 -06:00
|
|
|
that.title = spec.title || IPA.messages.buttons.remove;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
that.values = spec.values || [];
|
|
|
|
|
|
|
|
that.add_value = function(value) {
|
|
|
|
that.values.push(value);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.set_values = function(values) {
|
2011-07-19 13:46:09 -05:00
|
|
|
that.values = values;
|
2011-01-28 15:46:19 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
that.create = function() {
|
|
|
|
|
|
|
|
$('<p/>', {
|
|
|
|
'text': IPA.messages.search.delete_confirm
|
|
|
|
}).appendTo(that.container);
|
|
|
|
|
|
|
|
var div = $('<div/>', {
|
|
|
|
style: 'overflow:auto; max-height: 100px'
|
|
|
|
}).appendTo(that.container);
|
|
|
|
|
|
|
|
var ul = $('<ul/>');
|
|
|
|
ul.appendTo(div);
|
|
|
|
|
|
|
|
for (var i=0; i<that.values.length; i++) {
|
2011-05-27 10:32:17 -05:00
|
|
|
var value = that.values[i];
|
|
|
|
if (value instanceof Object){
|
|
|
|
var first = true;
|
|
|
|
var str_value = "";
|
|
|
|
for (var key in value){
|
|
|
|
if (value.hasOwnProperty(key)){
|
|
|
|
if (!first){
|
|
|
|
str_value += ',';
|
|
|
|
}
|
|
|
|
str_value += (key + ':' +value[key]);
|
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
value = str_value;
|
|
|
|
}
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
$('<li/>',{
|
2011-05-27 10:32:17 -05:00
|
|
|
'text': value
|
2011-01-28 15:46:19 -06:00
|
|
|
}).appendTo(ul);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
that.open = function(container) {
|
2011-02-21 18:36:42 -06:00
|
|
|
|
|
|
|
that.buttons[IPA.messages.buttons.remove] = that.execute;
|
|
|
|
that.buttons[IPA.messages.buttons.cancel] = that.close;
|
2011-01-28 15:46:19 -06:00
|
|
|
|
|
|
|
that.dialog_open(container);
|
|
|
|
};
|
|
|
|
|
2011-07-19 13:46:09 -05:00
|
|
|
that.deleter_dialog_create = that.create;
|
|
|
|
|
2011-01-28 15:46:19 -06:00
|
|
|
return that;
|
|
|
|
};
|
2011-08-05 10:12:21 -05:00
|
|
|
|
|
|
|
IPA.message_dialog = function(spec) {
|
|
|
|
|
|
|
|
var that = IPA.dialog(spec);
|
|
|
|
|
|
|
|
var init = function() {
|
|
|
|
spec = spec || {};
|
|
|
|
that.message = spec.message || '';
|
|
|
|
that.on_ok = spec.on_ok;
|
|
|
|
};
|
|
|
|
|
|
|
|
that.create = function() {
|
|
|
|
$('<p/>', {
|
|
|
|
'text': that.message
|
|
|
|
}).appendTo(that.container);
|
|
|
|
};
|
|
|
|
|
|
|
|
that.add_button(IPA.messages.buttons.ok, function() {
|
|
|
|
that.close();
|
|
|
|
if(that.on_ok) {
|
|
|
|
that.on_ok();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
init();
|
|
|
|
|
|
|
|
return that;
|
|
|
|
};
|