",
{
"Insert": function() {
var iRows = $(wym._options.rowsSelector).val();
var iCols = $(wym._options.colsSelector).val();
if(iRows > 0 && iCols > 0) {
var table = wym._doc.createElement(WYMeditor.TABLE);
var newRow = null;
var newCol = null;
var sCaption = $(wym._options.captionSelector).val();
//we create the caption
var newCaption = table.createCaption();
newCaption.innerHTML = sCaption;
//we create the rows and cells
for(x=0; x" +
"Make the selected " + item_info.plural.toLowerCase() + " accessible so that they can viewed by everyone.
"
,
{
"Insert": function()
{
// Make selected items accessible (importable) ?
var make_importable = false;
if ( $('#make-importable:checked').val() !== null )
make_importable = true;
// Insert links to history for each checked item.
var item_ids = new Array();
$('input[name=id]:checked').each(function() {
var item_id = $(this).val();
// Make item importable?
if (make_importable)
make_item_importable(item_info.controller, item_id, item_info.singular);
// Insert link(s) to item(s). This is done by getting item info and then manipulating wym.
url_template = get_name_and_link_url + item_id;
ajax_url = url_template.replace( "ITEM_CONTROLLER", item_info.controller);
$.getJSON( ajax_url, function( returned_item_info ) {
// Get link text.
wym._exec(WYMeditor.CREATE_LINK, sStamp);
var link_text = $("a[href=" + sStamp + "]", wym._doc.body).text();
// Insert link: need to do different actions depending on link text.
if (
link_text == "" // Firefox.
||
link_text == sStamp // Safari
)
{
// User selected no text; create link from scratch and use default text.
wym.insert("" + item_info.singular + " '" + returned_item_info.name + "'");
}
else
{
// Link created from selected text; add href and title.
$("a[href=" + sStamp + "]", wym._doc.body).attr(WYMeditor.HREF, returned_item_info.link).attr(WYMeditor.TITLE, item_info.singular + item_id);
}
});
});
hide_modal();
},
"Cancel": function()
{
hide_modal();
}
}
);
}
});
}
// EMBED GALAXY OBJECT DIALOGS
if ( dialogType == Galaxy.DIALOG_EMBED_HISTORY || dialogType == Galaxy.DIALOG_EMBED_DATASET || dialogType == Galaxy.DIALOG_EMBED_WORKFLOW || dialogType == Galaxy.DIALOG_EMBED_PAGE || dialogType == Galaxy.DIALOG_EMBED_VISUALIZATION ) {
// Based on item type, set useful vars.
var item_info;
switch(dialogType)
{
case(Galaxy.DIALOG_EMBED_HISTORY):
item_info = get_item_info(Galaxy.ITEM_HISTORY);
break;
case(Galaxy.DIALOG_EMBED_DATASET):
item_info = get_item_info(Galaxy.ITEM_DATASET);
break;
case(Galaxy.DIALOG_EMBED_WORKFLOW):
item_info = get_item_info(Galaxy.ITEM_WORKFLOW);
break;
case(Galaxy.DIALOG_EMBED_PAGE):
item_info = get_item_info(Galaxy.ITEM_PAGE);
break;
case(Galaxy.DIALOG_EMBED_VISUALIZATION):
item_info = get_item_info(Galaxy.ITEM_VISUALIZATION);
break;
}
$.ajax(
{
url: item_info.list_ajax_url,
data: {},
error: function() { alert( "Failed to list " + item_info.plural.toLowerCase() + " for selection"); },
success: function(list_html)
{
// Can make histories, workflows importable; cannot make datasets importable.
if (dialogType == Galaxy.DIALOG_EMBED_HISTORY || dialogType == Galaxy.DIALOG_EMBED_WORKFLOW
|| dialogType == Galaxy.DIALOG_EMBED_VISUALIZATION)
list_html = list_html + "
" +
"Make the selected " + item_info.plural.toLowerCase() + " accessible so that they can viewed by everyone.
";
show_modal(
"Embed " + item_info.plural,
list_html,
{
"Embed": function()
{
// Make selected items accessible (importable) ?
var make_importable = false;
if ( $('#make-importable:checked').val() != null )
make_importable = true;
$('input[name=id]:checked').each(function() {
// Get item ID and name.
var item_id = $(this).val();
// Use ':first' because there are many labels in table; the first one is the item name.
var item_name = $("label[for='" + item_id + "']:first").text();
if (make_importable)
make_item_importable(item_info.controller, item_id, item_info.singular);
// Embedded item HTML; item class is embedded in div container classes; this is necessary because the editor strips
// all non-standard attributes when it returns its content (e.g. it will not return an element attribute of the form
// item_class='History').
var item_elt_id = item_info.iclass + "-" + item_id;
var item_embed_html = [
"