diff -ur lms-cvs.orig/lib/LMS.class.php lms-cvs/lib/LMS.class.php --- lms-cvs.orig/lib/LMS.class.php 2005-02-02 21:09:04.226695078 +0100 +++ lms-cvs/lib/LMS.class.php 2005-02-02 21:08:30.677015322 +0100 @@ -1221,6 +1221,12 @@ return $this->DB->GetOne('SELECT ownerid FROM nodes WHERE id=?', array($id)); } + function NodeAssignmentUpdate($nodedata) + { + $this->SetTS('nodesassignments'); + return $this->DB->Execute('UPDATE nodesassignments SET assignmentid=? WHERE nodeid=?',array($nodedata['assignment'],$nodedata['id'])); + } + function NodeUpdate($nodedata) { $this->SetTS('nodes'); @@ -1272,7 +1278,17 @@ { return $this->DB->GetOne('SELECT name FROM nodes WHERE ipaddr=inet_aton(?)', array($ipaddr)); } + + function GetNodeAssignment($id) + { + return $this->DB->GetOne('SELECT assignmentid FROM nodesassignments WHERE nodeid=?',array($id)); + } + function GetNodeTariff($id) + { + return $this->DB->GetOne('SELECT name FROM tariffs LEFT JOIN assignments ON (tariffs.id=assignments.tariffid) WHERE assignments.id=?',array($id)); + } + function GetNode($id) { if($result = $this->DB->GetRow('SELECT id, name, ownerid, ipaddr, inet_ntoa(ipaddr) AS ip, mac, access, warning, creationdate, moddate, creatorid, modid, netdev, lastonline, info FROM nodes WHERE id=?', array($id))) @@ -1296,6 +1312,8 @@ $result['netname'] = $this->GetNetworkName($result['netid']); $result['producer'] = get_producer($result['mac']); $result['devicename'] = $this->GetNetDevName($result['netdevid']); + $result['assignment'] = $this->GetNodeAssignment($id); + $result['tariff'] = $this->GetNodeTariff($result['assignment']); return $result; }else return FALSE; @@ -1488,6 +1506,12 @@ return $this->DB->Execute('UPDATE nodes SET access=0 WHERE netdev=? AND ownerid=0', array($netdev)); } + function NodeAssignmentAdd($nodedata) + { + $this->SetTS('nodesassignments'); + return $this->DB->Execute('INSERT INTO nodesassignments (nodeid,assignmentid) VALUES (?,?)',array($nodedata['id'], $nodedata['assignment'])); + } + function NodeAdd($nodedata) { $this->SetTS('nodes'); diff -ur lms-cvs.orig/modules/nodeadd.php lms-cvs/modules/nodeadd.php --- lms-cvs.orig/modules/nodeadd.php 2005-02-02 21:11:40.954932764 +0100 +++ lms-cvs/modules/nodeadd.php 2005-02-01 20:51:45.000000000 +0100 @@ -81,7 +81,8 @@ if(!$error) { - $nodeid = $LMS->NodeAdd($nodedata); + $nodeid=$LMS->NodeAdd($nodedata); + $LMS->NodeAssignmentAdd($nodedata); if($nodedata['reuse']=='') { header('Location: ?m=nodeinfo&id='.$nodeid); diff -ur lms-cvs.orig/modules/nodeedit.php lms-cvs/modules/nodeedit.php --- lms-cvs.orig/modules/nodeedit.php 2005-02-02 21:11:41.036919912 +0100 +++ lms-cvs/modules/nodeedit.php 2005-02-01 20:51:45.000000000 +0100 @@ -130,6 +130,8 @@ if(!$error) { + if ($nodeinfo['assignment']) $LMS->NodeAssignmentUpdate($nodeedit); + else $LMS->NodeAssignmentAdd($nodeedit); $LMS->NodeUpdate($nodeedit); header('Location: ?m=nodeinfo&id='.$nodeedit['id']); } diff -ur lms-cvs.orig/templates/nodeaddbox.html lms-cvs/templates/nodeaddbox.html --- lms-cvs.orig/templates/nodeaddbox.html 2005-01-31 22:09:20.000000000 +0100 +++ lms-cvs/templates/nodeaddbox.html 2005-02-01 20:52:10.000000000 +0100 @@ -35,6 +35,22 @@