diff --git a/html/includes/forms/update-port-notes.inc.php b/html/includes/forms/update-port-notes.inc.php new file mode 100644 index 0000000000..8100cedb69 --- /dev/null +++ b/html/includes/forms/update-port-notes.inc.php @@ -0,0 +1,32 @@ + + * 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. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ + +$status = 'error'; +$message = 'unknown error'; + +$port_id = mres($_POST['port_id']); +$notes = mres($_POST['notes']); + +if (isset($notes) && (dbUpdate(array('notes' => $notes), 'ports', 'port_id = ?', array($port_id)))) { + $status = 'ok'; + $message = 'Updated'; +} +else { + $status = 'error'; + $message = 'ERROR: Could not update'; +} +die(json_encode(array( + 'status' => $status, + 'message' => $message, + 'notes' => $notes, + 'port_id' => $port_id +))); diff --git a/html/pages/device/port.inc.php b/html/pages/device/port.inc.php index bdaacd1271..b00b36855e 100644 --- a/html/pages/device/port.inc.php +++ b/html/pages/device/port.inc.php @@ -73,6 +73,7 @@ $menu_options['realtime'] = 'Real time'; // FIXME CONDITIONAL $menu_options['arp'] = 'ARP Table'; $menu_options['events'] = 'Eventlog'; +$menu_options['notes'] = 'Notes'; if (dbFetchCell("SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = '".$port['port_id']."'")) { $menu_options['adsl'] = 'ADSL'; diff --git a/html/pages/device/port/notes.inc.php b/html/pages/device/port/notes.inc.php new file mode 100644 index 0000000000..87a637f7fd --- /dev/null +++ b/html/pages/device/port/notes.inc.php @@ -0,0 +1,56 @@ + + * 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. Please see LICENSE.txt at the top level of + * the source code distribution for details. + */ +$pagetitle[] = 'Notes'; +$data = dbFetchRow("SELECT `notes` FROM `ports` WHERE port_id = ?", array( + $port['port_id'] +)); +?> + +
+ diff --git a/sql-schema/085.sql b/sql-schema/085.sql new file mode 100644 index 0000000000..181ad4c521 --- /dev/null +++ b/sql-schema/085.sql @@ -0,0 +1 @@ +ALTER TABLE `ports` ADD COLUMN `notes` text;