' + ' ' + ' ' + ' | ' + ' ' + ' ' + ' | ' + ' ' + $('').text(db + '.' + table).html() + ' | ' + '
');
$('#id_scroll_tab table').first().append($newTableLine);
$($newTableLine).find('.scroll_tab_struct').on('click', function () {
DesignerMove.startTabUpd(db, table);
});
$($newTableLine).on('click', '.designer_Tabs2,.designer_Tabs', function () {
DesignerMove.selectTab($(this).attr('designer_url_table_name'));
});
$($newTableLine).find('.scroll_tab_checkbox').on('click', function () {
$(this).attr('title', function (i, currentvalue) {
return currentvalue === Messages.strHide ? Messages.strShow : Messages.strHide;
});
DesignerMove.visibleTab(this, $(this).val());
});
var $tablesCounter = $('#tables_counter');
$tablesCounter.text(parseInt($tablesCounter.text(), 10) + 1);
};
DesignerMove.addOtherDbTables = function () {
var buttonOptions = {};
buttonOptions[Messages.strGo] = function () {
var db = $('#add_table_from').val();
var table = $('#add_table').val(); // Check if table already imported or not.
var $table = $('[id="' + encodeURIComponent(db) + '.' + encodeURIComponent(table) + '"]');
if ($table.length !== 0) {
Functions.ajaxShowMessage(Functions.sprintf(Messages.strTableAlreadyExists, db + '.' + table), undefined, 'error');
return;
}
$.post('index.php?route=/database/designer', {
'ajax_request': true,
'dialog': 'add_table',
'db': db,
'table': table,
'server': CommonParams.get('server')
}, function (data) {
var $newTableDom = $(data.message);
$newTableDom.find('a').first().remove();
var dbEncoded = $($newTableDom).find('.small_tab_pref').attr('db_url');
var tableEncoded = $($newTableDom).find('.small_tab_pref').attr('table_name_url');
if (typeof dbEncoded === 'string' && typeof tableEncoded === 'string') {
// Do not try to add if attr not found !
$('#container-form').append($newTableDom);
DesignerMove.enableTableEvents(null, $newTableDom);
DesignerMove.addTableToTablesList(null, $newTableDom);
jTabs[dbEncoded + '.' + tableEncoded] = 1;
DesignerMove.markUnsaved();
}
});
$(this).dialog('close');
};
buttonOptions[Messages.strCancel] = function () {
$(this).dialog('close');
};
var $selectDb = $('