2010-06-16 18:21:58 +00:00
|
|
|
/**
|
|
|
|
* Tab constructor
|
|
|
|
*
|
|
|
|
* @param tabId
|
|
|
|
* Tab ID
|
|
|
|
* @param tabName
|
|
|
|
* Tab name
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
var Tab = function(tabId) {
|
|
|
|
this.tabId = tabId;
|
|
|
|
this.tabName = null;
|
|
|
|
this.tab = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the tab
|
|
|
|
*
|
|
|
|
* @param tabName
|
|
|
|
* Tab name to initialize
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
Tab.prototype.init = function() {
|
|
|
|
// Create a division containing the tab
|
|
|
|
this.tab = $('<div class="tab" id="' + this.tabId + '"></div>');
|
|
|
|
var tabList = $('<ul></ul>');
|
|
|
|
var tabItem = $('<li><a href="#">Dummy tab item</a></li>');
|
|
|
|
tabList.append(tabItem);
|
|
|
|
this.tab.append(tabList);
|
|
|
|
|
2010-07-15 22:57:48 +00:00
|
|
|
// Create a template with close button
|
2010-08-03 14:58:08 +00:00
|
|
|
var tabs = this.tab.tabs();
|
2010-06-16 18:21:58 +00:00
|
|
|
|
|
|
|
// Remove dummy tab
|
|
|
|
this.tab.tabs("remove", 0);
|
|
|
|
|
|
|
|
// Hide tab
|
|
|
|
this.tab.hide();
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the tab object
|
|
|
|
*
|
|
|
|
* @param Nothing
|
|
|
|
* @return Object representing the tab
|
|
|
|
*/
|
|
|
|
Tab.prototype.object = function() {
|
|
|
|
return this.tab;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a new tab
|
|
|
|
*
|
|
|
|
* @param newTabId
|
|
|
|
* New tab ID
|
|
|
|
* @param newTabName
|
|
|
|
* New tab name
|
|
|
|
* @param newTabCont
|
|
|
|
* New tab content
|
2010-08-03 14:58:08 +00:00
|
|
|
* @param closeable
|
|
|
|
* New tab close button
|
2010-06-16 18:21:58 +00:00
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-08-03 14:58:08 +00:00
|
|
|
Tab.prototype.add = function(newTabId, newTabName, newTabCont, closeable) {
|
2010-06-16 18:21:58 +00:00
|
|
|
// Show tab
|
|
|
|
if (this.tab.css("display") == "none") {
|
|
|
|
this.tab.show();
|
|
|
|
}
|
|
|
|
|
|
|
|
var newTab = $('<div class="tab" id="' + newTabId + '"></div>');
|
|
|
|
newTab.append(newTabCont);
|
|
|
|
this.tab.append(newTab);
|
|
|
|
this.tab.tabs("add", "#" + newTabId, newTabName);
|
2010-08-03 14:58:08 +00:00
|
|
|
|
|
|
|
// Append close button
|
|
|
|
if (closeable) {
|
|
|
|
var header = this.tab.find('ul.ui-tabs-nav a[href="#' + newTabId +'"]').parent();
|
|
|
|
header.append('<span class=\"tab-close ui-icon ui-icon-close\"></span>');
|
2010-10-11 20:35:04 +00:00
|
|
|
|
|
|
|
// Get this tab
|
|
|
|
var tabs = this.tab;
|
|
|
|
var tabLink = 'a[href="\#' + newTabId + '"]';
|
|
|
|
var thisTab = $(tabLink, tabs).parent();
|
|
|
|
|
|
|
|
// Close tab when close button is clicked
|
|
|
|
thisTab.find('span.tab-close').bind('click', function(event) {
|
|
|
|
var tabIndex = ($('li', tabs).index(thisTab));
|
|
|
|
|
|
|
|
// Do not remove first tab
|
|
|
|
if (tabIndex != 0) {
|
|
|
|
tabs.tabs('remove', tabIndex);
|
|
|
|
}
|
|
|
|
});
|
2010-08-03 14:58:08 +00:00
|
|
|
}
|
2010-06-16 18:21:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Select a tab
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* Tab ID to select
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
Tab.prototype.select = function(id) {
|
|
|
|
this.tab.tabs("select", "#" + id);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a tab
|
|
|
|
*
|
|
|
|
* @param id
|
|
|
|
* Tab ID to remove
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
Tab.prototype.remove = function(id) {
|
2010-07-25 07:41:49 +00:00
|
|
|
var selectorStr = 'a[href="\#' + id + '"]';
|
|
|
|
var selectTab = $(selectorStr, this.tab).parent();
|
|
|
|
var index = ($('li', this.tab).index(selectTab));
|
|
|
|
this.tab.tabs("remove", index);
|
2010-06-16 18:21:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Table constructor
|
|
|
|
*
|
|
|
|
* @param tabId
|
|
|
|
* Tab ID
|
|
|
|
* @param tabName
|
|
|
|
* Tab name
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
var Table = function(tableId) {
|
|
|
|
if ($('#' + tableId).length) {
|
|
|
|
this.tableId = tableId;
|
|
|
|
this.table = $('#' + tableId);
|
|
|
|
} else {
|
|
|
|
this.tableId = tableId;
|
|
|
|
this.table = null;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the table
|
|
|
|
*
|
|
|
|
* @param Headers
|
|
|
|
* Array of table headers
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
Table.prototype.init = function(headers) {
|
|
|
|
// Create a table
|
|
|
|
this.table = $('<table id="' + this.tableId + '"></table>');
|
|
|
|
var thead = $('<thead></thead>');
|
|
|
|
var headRow = $('<tr></tr>');
|
|
|
|
|
|
|
|
// Append headers
|
|
|
|
for ( var i in headers) {
|
|
|
|
headRow.append('<th>' + headers[i] + '</th>');
|
|
|
|
}
|
|
|
|
|
|
|
|
thead.append(headRow);
|
|
|
|
this.table.append(thead);
|
|
|
|
|
|
|
|
// Append table body
|
|
|
|
var tableBody = $('<tbody></tbody>');
|
|
|
|
this.table.append(tableBody);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the table object
|
|
|
|
*
|
|
|
|
* @param Nothing
|
|
|
|
* @return Object representing the table
|
|
|
|
*/
|
|
|
|
Table.prototype.object = function() {
|
|
|
|
return this.table;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a row to the table
|
|
|
|
*
|
|
|
|
* @param rowCont
|
|
|
|
* Array of table row contents
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
Table.prototype.add = function(rowCont) {
|
|
|
|
// Create table row
|
|
|
|
var tableRow = $('<tr></tr>');
|
|
|
|
|
|
|
|
// Create a column for each content
|
|
|
|
var tableCol;
|
|
|
|
for ( var i in rowCont) {
|
|
|
|
tableCol = $('<td></td>');
|
|
|
|
tableCol.append(rowCont[i]);
|
|
|
|
tableRow.append(tableCol);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Append table row to table
|
|
|
|
this.table.find('tbody').append(tableRow);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a footer to the table
|
|
|
|
*
|
|
|
|
* @param rowCont
|
|
|
|
* Array of table row contents
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
Table.prototype.addFooter = function(rowCont) {
|
|
|
|
// Create table row
|
|
|
|
var tableFoot = $('<tfoot></tfoot>');
|
|
|
|
tableFoot.append(rowCont);
|
|
|
|
|
|
|
|
// Append table row to table
|
|
|
|
this.table.append(tableFoot);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a row from the table
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
Table.prototype.remove = function(id) {
|
|
|
|
// To be continued
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Datatable class constructor
|
|
|
|
*
|
|
|
|
* @param tabId
|
|
|
|
* Tab ID
|
|
|
|
* @param tabName
|
|
|
|
* Tab name
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
var DataTable = function(tableId) {
|
|
|
|
this.dataTableId = tableId;
|
|
|
|
this.dataTable = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the datatable
|
|
|
|
*
|
|
|
|
* @param Headers
|
|
|
|
* Array of table headers
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
DataTable.prototype.init = function(headers) {
|
|
|
|
// Create a table
|
|
|
|
this.dataTable = $('<table class="datatable" id="' + this.dataTableId + '"></table>');
|
|
|
|
var thead = $('<thead></thead>');
|
|
|
|
var headRow = $('<tr></tr>');
|
|
|
|
|
|
|
|
// Append headers
|
|
|
|
for ( var i in headers) {
|
|
|
|
headRow.append('<th>' + headers[i] + '</th>');
|
|
|
|
}
|
|
|
|
|
|
|
|
thead.append(headRow);
|
|
|
|
this.dataTable.append(thead);
|
|
|
|
|
|
|
|
// Append table body
|
|
|
|
var tableBody = $('<tbody></tbody>');
|
|
|
|
this.dataTable.append(tableBody);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the datatable object
|
|
|
|
*
|
|
|
|
* @param Nothing
|
|
|
|
* @return Object representing the table
|
|
|
|
*/
|
|
|
|
DataTable.prototype.object = function() {
|
|
|
|
return this.dataTable;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a row to the datatable
|
|
|
|
*
|
|
|
|
* @param rowCont
|
|
|
|
* Array of table row contents
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
DataTable.prototype.add = function(rowCont) {
|
|
|
|
// Create table row
|
|
|
|
var tableRow = $('<tr></tr>');
|
|
|
|
|
|
|
|
// Create a column for each content
|
|
|
|
var tableCol;
|
|
|
|
for ( var i in rowCont) {
|
|
|
|
tableCol = $('<td></td>');
|
|
|
|
tableCol.append(rowCont[i]);
|
|
|
|
tableRow.append(tableCol);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Append table row to table
|
|
|
|
this.dataTable.find('tbody').append(tableRow);
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a row from the datatable
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
NodesTable.prototype.remove = function(id) {
|
|
|
|
// To be continued
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create status bar
|
|
|
|
*
|
|
|
|
* @param barId
|
|
|
|
* Status bar ID
|
|
|
|
* @return Status bar
|
|
|
|
*/
|
|
|
|
function createStatusBar(barId) {
|
|
|
|
var statusBar = $('<div class="statusBar" id="' + barId + '"><div>');
|
|
|
|
return statusBar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create info bar
|
|
|
|
*
|
|
|
|
* @param msg
|
|
|
|
* Info message
|
|
|
|
* @return Info bar
|
|
|
|
*/
|
|
|
|
function createInfoBar(msg) {
|
2010-09-24 12:27:54 +00:00
|
|
|
var infoBar = $('<div class="ui-state-highlight ui-corner-all"></div>');
|
2010-09-23 20:43:10 +00:00
|
|
|
var msg = $('<p><span class="ui-icon ui-icon-info"></span>' + msg + '</p>');
|
2010-06-16 18:21:58 +00:00
|
|
|
infoBar.append(msg);
|
|
|
|
|
|
|
|
return infoBar;
|
|
|
|
}
|
|
|
|
|
2010-09-23 20:43:10 +00:00
|
|
|
/**
|
|
|
|
* Create warning bar
|
|
|
|
*
|
|
|
|
* @param msg
|
|
|
|
* Warning message
|
|
|
|
* @return Warning bar
|
|
|
|
*/
|
|
|
|
function createWarnBar(msg) {
|
2010-09-24 12:27:54 +00:00
|
|
|
var warnBar = $('<div class="ui-state-error ui-corner-all"></div>');
|
2010-09-23 20:43:10 +00:00
|
|
|
var msg = $('<p><span class="ui-icon ui-icon-alert"></span>' + msg + '</p>');
|
|
|
|
warnBar.append(msg);
|
|
|
|
|
|
|
|
return warnBar;
|
|
|
|
}
|
|
|
|
|
2010-06-16 18:21:58 +00:00
|
|
|
/**
|
|
|
|
* Create a loader
|
|
|
|
*
|
|
|
|
* @param loaderId
|
|
|
|
* Loader ID
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function createLoader(loaderId) {
|
|
|
|
var loader = $('<img id="' + loaderId + '" src="images/loader.gif"></img>');
|
|
|
|
return loader;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a button
|
|
|
|
*
|
|
|
|
* @param name
|
|
|
|
* Name of the button
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function createButton(name) {
|
|
|
|
var button = $('<button aria-disabled="false" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="button"><span class="ui-button-text">' + name + '</span></button>');
|
|
|
|
return button;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a menu
|
|
|
|
*
|
|
|
|
* @param items
|
|
|
|
* An array of items to go into the menu
|
|
|
|
* @return A division containing the menu
|
|
|
|
*/
|
|
|
|
function createMenu(items) {
|
|
|
|
var menu = $('<ul class="sf-menu"></ul>');
|
|
|
|
|
|
|
|
// Loop through each item
|
|
|
|
for ( var i in items) {
|
|
|
|
// Append item to menu
|
|
|
|
var item = $('<li></li>');
|
|
|
|
|
|
|
|
// If it is a sub menu
|
|
|
|
if (items[i] instanceof Array) {
|
|
|
|
// 1st index = Sub menu title
|
|
|
|
item.append(items[i][0]);
|
|
|
|
// 2nd index = Sub menu
|
|
|
|
item.append(items[i][1]);
|
|
|
|
} else {
|
|
|
|
item.append(items[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do not add border for 1st item
|
|
|
|
if (i > 0) {
|
|
|
|
item.css( {
|
|
|
|
'border-left' : '1px solid #BDBDBD'
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
menu.append(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
return menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize the page
|
|
|
|
*
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function initPage() {
|
2010-11-01 14:06:53 +00:00
|
|
|
// JQuery plugins
|
2010-07-14 20:11:07 +00:00
|
|
|
includeJs("js/jquery/jquery.dataTables.min.js");
|
|
|
|
includeJs("js/jquery/jquery.form.js");
|
|
|
|
includeJs("js/jquery/jquery.jeditable.js");
|
|
|
|
includeJs("js/jquery/jquery.autocomplete.js");
|
|
|
|
includeJs("js/jquery/jquery.contextmenu.js");
|
|
|
|
includeJs("js/jquery/jquery.cookie.js");
|
|
|
|
includeJs("js/jquery/superfish.js");
|
|
|
|
includeJs("js/jquery/hoverIntent.js");
|
2010-11-04 19:30:39 +00:00
|
|
|
includeJs("js/jquery/jquery.jstree.js");
|
2010-08-26 05:27:11 +00:00
|
|
|
includeJs("js/jquery/jquery.flot.js");
|
2010-11-01 14:06:53 +00:00
|
|
|
includeJs("js/jquery/tooltip.min.js");
|
2010-12-01 01:54:05 +00:00
|
|
|
includeJs("js/jquery/jquery.serverBrowser.js");
|
2010-12-02 21:28:24 +00:00
|
|
|
includeJs("js/jquery/jquery.topzindex.min.js");
|
2010-11-01 14:06:53 +00:00
|
|
|
|
|
|
|
// Page plugins
|
2010-08-04 15:47:41 +00:00
|
|
|
includeJs("js/configure/configure.js");
|
2010-07-14 20:11:07 +00:00
|
|
|
includeJs("js/monitor/monitor.js");
|
|
|
|
includeJs("js/nodes/nodes.js");
|
|
|
|
includeJs("js/provision/provision.js");
|
2010-07-22 19:56:09 +00:00
|
|
|
|
|
|
|
// Custom plugins
|
|
|
|
includeJs("js/custom/blade.js");
|
|
|
|
includeJs("js/custom/fsp.js");
|
|
|
|
includeJs("js/custom/hmc.js");
|
|
|
|
includeJs("js/custom/ipmi.js");
|
|
|
|
includeJs("js/custom/ivm.js");
|
|
|
|
includeJs("js/custom/zvm.js");
|
2010-07-28 20:24:29 +00:00
|
|
|
includeJs("js/custom/customUtils.js");
|
2010-07-14 20:11:07 +00:00
|
|
|
|
2010-06-16 18:21:58 +00:00
|
|
|
// Get the page being loaded
|
|
|
|
var url = window.location.pathname;
|
|
|
|
var page = url.replace('/xcat/', '');
|
|
|
|
|
|
|
|
var headers = $('#header ul li a');
|
|
|
|
|
|
|
|
// Show the page
|
2010-07-14 20:11:07 +00:00
|
|
|
$("#content").children().remove();
|
2010-06-16 18:21:58 +00:00
|
|
|
if (page == 'index.php') {
|
2010-07-29 17:32:24 +00:00
|
|
|
includeJs("js/nodes/nodeset.js");
|
|
|
|
includeJs("js/nodes/rnetboot.js");
|
|
|
|
includeJs("js/nodes/updatenode.js");
|
2010-11-04 07:07:53 +00:00
|
|
|
includeJs("js/nodes/physical.js");
|
2010-11-04 07:37:03 +00:00
|
|
|
includeJs("js/nodes/mtm.js");
|
2010-06-16 18:21:58 +00:00
|
|
|
headers.eq(0).css('background-color', '#A9D0F5');
|
|
|
|
loadNodesPage();
|
|
|
|
} else if (page == 'configure.php') {
|
2010-08-04 15:47:41 +00:00
|
|
|
includeJs("js/configure/update.js");
|
2010-06-16 18:21:58 +00:00
|
|
|
headers.eq(1).css('background-color', '#A9D0F5');
|
|
|
|
loadConfigPage();
|
|
|
|
} else if (page == 'provision.php') {
|
2010-12-01 01:54:05 +00:00
|
|
|
includeJs("js/provision/images.js");
|
2010-06-16 18:21:58 +00:00
|
|
|
headers.eq(2).css('background-color', '#A9D0F5');
|
|
|
|
loadProvisionPage();
|
|
|
|
} else if (page == 'monitor.php') {
|
2010-08-04 15:47:41 +00:00
|
|
|
includeJs("js/monitor/xcatmon.js");
|
|
|
|
includeJs("js/monitor/rmcmon.js");
|
2010-09-17 08:39:17 +00:00
|
|
|
includeJs("js/monitor/gangliamon.js");
|
2010-06-16 18:21:58 +00:00
|
|
|
headers.eq(3).css('background-color', '#A9D0F5');
|
|
|
|
loadMonitorPage();
|
2010-11-24 06:10:07 +00:00
|
|
|
} else if (page == 'discover.php'){
|
|
|
|
includeJs("js/discover/discover.js");
|
|
|
|
headers.eq(4).css('background-color', '#A9D0F5');
|
|
|
|
loadDiscoverPage();
|
2010-06-16 18:21:58 +00:00
|
|
|
} else {
|
|
|
|
headers.eq(0).css('background-color', '#A9D0F5');
|
|
|
|
loadNodesPage();
|
|
|
|
}
|
2010-07-14 20:11:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-07-15 13:41:29 +00:00
|
|
|
* Include javascript file in <head>
|
2010-07-14 20:11:07 +00:00
|
|
|
*
|
|
|
|
* @param file
|
|
|
|
* File to include
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
|
|
|
function includeJs(file) {
|
2010-07-15 13:41:29 +00:00
|
|
|
var script = $("head script[src='" + file + "']");
|
2010-07-15 22:57:48 +00:00
|
|
|
|
|
|
|
// If <head> does not contain the javascript
|
2010-07-15 13:41:29 +00:00
|
|
|
if (!script.length) {
|
2010-07-15 22:57:48 +00:00
|
|
|
// Append the javascript to <head>
|
2010-07-15 13:41:29 +00:00
|
|
|
var script = $('<script></script>');
|
|
|
|
script.attr( {
|
|
|
|
type : 'text/javascript',
|
|
|
|
src : file
|
2010-07-22 19:56:09 +00:00
|
|
|
});
|
2010-07-15 13:41:29 +00:00
|
|
|
|
|
|
|
$('head').append(script);
|
|
|
|
}
|
2010-07-27 19:50:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Write ajax response to a paragraph
|
|
|
|
*
|
|
|
|
* @param rsp
|
|
|
|
* Ajax response
|
2010-07-27 22:56:42 +00:00
|
|
|
* @param pattern
|
2010-07-29 17:32:24 +00:00
|
|
|
* Pattern to replace with a break
|
2010-07-27 19:50:01 +00:00
|
|
|
* @return Paragraph containing ajax response
|
|
|
|
*/
|
2010-07-27 22:56:42 +00:00
|
|
|
function writeRsp(rsp, pattern) {
|
2010-07-27 19:50:01 +00:00
|
|
|
// Create paragraph to hold ajax response
|
|
|
|
var prg = $('<p></p>');
|
|
|
|
for ( var i in rsp) {
|
2010-07-27 22:56:42 +00:00
|
|
|
if (rsp[i]) {
|
2010-07-29 17:32:24 +00:00
|
|
|
// Create regular expression for given pattern
|
|
|
|
// Replace pattern with break
|
2010-07-27 22:56:42 +00:00
|
|
|
if (pattern) {
|
|
|
|
rsp[i] = rsp[i].replace(new RegExp(pattern, 'g'), '<br>');
|
|
|
|
}
|
|
|
|
|
2010-07-27 19:50:01 +00:00
|
|
|
prg.append(rsp[i]);
|
|
|
|
prg.append('<br>');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return prg;
|
2010-09-23 20:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a dialog and show given message
|
|
|
|
*
|
2010-09-24 12:27:54 +00:00
|
|
|
* @param type
|
|
|
|
* Type of dialog, i.e. warn or info
|
2010-09-23 20:43:10 +00:00
|
|
|
* @param msg
|
|
|
|
* Message to show
|
|
|
|
* @return Nothing
|
|
|
|
*/
|
2010-09-24 12:27:54 +00:00
|
|
|
function openDialog(type, msg) {
|
|
|
|
var msgDialog;
|
|
|
|
if (type == "warn") {
|
|
|
|
// Create warning message
|
|
|
|
msgDialog = $('<div class="ui-state-error ui-corner-all">'
|
|
|
|
+ '<p><span class="ui-icon ui-icon-alert"></span>' + msg + '</p>'
|
|
|
|
+ '</div>');
|
|
|
|
} else {
|
|
|
|
// Create info message
|
|
|
|
msgDialog = $('<div class="ui-state-highlight ui-corner-all">'
|
|
|
|
+ '<p><span class="ui-icon ui-icon-info"></span>' + msg + '</p>'
|
|
|
|
+'</div>');
|
|
|
|
}
|
|
|
|
|
2010-09-24 02:27:04 +00:00
|
|
|
// Open dialog
|
2010-09-24 12:27:54 +00:00
|
|
|
msgDialog.dialog({
|
2010-09-23 20:43:10 +00:00
|
|
|
modal: true,
|
2010-12-02 21:28:24 +00:00
|
|
|
width: 500,
|
2010-09-23 20:43:10 +00:00
|
|
|
buttons: {
|
|
|
|
"Ok": function(){
|
|
|
|
$(this).dialog("close");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|