diff -r 345307762220 -r f05601490415 www-thermferm/js/maintenance_panel.js
--- a/www-thermferm/js/maintenance_panel.js Thu Jul 24 23:14:20 2014 +0200
+++ b/www-thermferm/js/maintenance_panel.js Fri Jul 25 23:27:08 2014 +0200
@@ -62,7 +62,40 @@
{ name: 'Name', type: 'string' },
{ name: 'Steps', type: 'int' }
],
+ id: 'UUID',
url: 'getprofiles.php',
+ insertrow: function (rowid, commit) {
+ var data = "insert=true&" + $.param({Name: rowid});
+ $.ajax({
+ dataType: 'json',
+ url: 'getprofiles.php',
+ data: data,
+ cache: false,
+ success: function (data, status, xhr) {
+ // insert command is executed.
+ commit(true);
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ commit(false);
+ }
+ });
+ },
+ deleterow: function (rowid, commit) {
+ var data = "delete=true&" + $.param({UUID: rowid});
+ $.ajax({
+ dataType: 'json',
+ url: 'getprofiles.php',
+ data: data,
+ cache: false,
+ success: function (data, status, xhr) {
+ // insert command is executed.
+ commit(true);
+ },
+ error: function(jqXHR, textStatus, errorThrown) {
+ commit(false);
+ }
+ });
+ },
updaterow: function (rowid, rowdata, commit) {
// synchronize with the server - send update command
var data = "update=true&UUID=" + rowdata.UUID + "&Name=" + rowdata.Name;
@@ -89,12 +122,67 @@
theme: theme,
columnsresize: true,
editable: true,
+ showstatusbar: true,
+ renderstatusbar: function (statusbar) {
+ // appends buttons to the status bar.
+ var container = $("
");
+ var addButton = $("Add ");
+ var deleteButton = $("Delete ");
+ var reloadButton = $("Reload ");
+ container.append(addButton);
+ container.append(deleteButton);
+ container.append(reloadButton);
+ statusbar.append(container);
+ addButton.jqxButton({ width: 60, height: 20 });
+ deleteButton.jqxButton({ width: 65, height: 20 });
+ reloadButton.jqxButton({ width: 65, height: 20 });
+ // add new row.
+ addButton.click(function (event) {
+ /*
+ * Ask a new profile name using a popup window.
+ * Send "ADD PROFILE name" to the server using the getprofiles.php script.
+ * Refresh the data
+ */
+ $("#jqxwindow_addprofile").jqxWindow('open');
+ $("#jqxgrid_profiles").jqxGrid({ source: dataAdapter_profiles });
+ });
+ // delete selected row.
+ deleteButton.click(function (event) {
+ var selectedrowindex = $("#jqxgrid_profiles").jqxGrid('getselectedrowindex');
+ var rowscount = $("#jqxgrid_profiles").jqxGrid('getdatainformation').rowscount;
+ var id = $("#jqxgrid_profiles").jqxGrid('getrowid', selectedrowindex);
+ $("#jqxgrid_profiles").jqxGrid('deleterow', id);
+ });
+ // reload grid data.
+ reloadButton.click(function (event) {
+ $("#jqxgrid_profiles").jqxGrid({ source: dataAdapter_profiles });
+ });
+ },
columns: [
{ text: 'UUID', editable: false, datafield: 'UUID', width: 280 },
{ text: 'Name', datafield: 'Name', minwidth: 120 },
{ text: 'Steps', editable: false, datafield: 'Steps', width: 50 }
]
});
+ $("#jqxwindow_addprofile").jqxWindow({
+ theme: theme,
+ resizable: false,
+ isModal: true,
+ modalOpacity: 0.5,
+ autoOpen: false,
+ width: 210,
+ height: 180,
+ cancelButton: $("#profile_cancelButton"),
+ initContent: function () {
+ $("#profile_addButton").jqxButton({ width: 70, height: 25, theme: theme });
+ $("#profile_cancelButton").jqxButton({ width: 70, height: 25, theme: theme });
+ $("#profile_addButton").click(function () {
+ var id = $("#profile_inputField").val();
+ $("#jqxgrid_profiles").jqxGrid('insertrow', id);
+ $("#jqxwindow_addprofile").jqxWindow('hide');
+ });
+ }
+ });
/*
* Units