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 @@ + + + + Taryfa: + + + + + + + diff -ur lms-cvs.orig/templates/nodeeditbox.html lms-cvs/templates/nodeeditbox.html --- lms-cvs.orig/templates/nodeeditbox.html 2005-01-07 21:26:18.000000000 +0100 +++ lms-cvs/templates/nodeeditbox.html 2005-01-14 22:10:19.000000000 +0100 @@ -49,6 +49,20 @@ + + + + + + + + diff -ur lms-cvs.orig/templates/nodeinfobox.html lms-cvs/templates/nodeinfobox.html --- lms-cvs.orig/templates/nodeinfobox.html 2005-01-20 18:53:16.000000000 +0100 +++ lms-cvs/templates/nodeinfobox.html 2005-02-02 21:18:44.702467494 +0100 @@ -57,6 +57,14 @@ + + + + {if $nodeinfo.assignment}{$nodeinfo.tariff} ({$nodeinfo.assignment|string_format:"%04d"}){else}BRAK{/if} + + + + @@ -108,8 +116,8 @@ {t}All nodes{/t} - {t}Delete{/t} - {t}Edit{/t} - - + {t}Delete{/t} + {t}Edit{/t} + + diff -ur lms-cvs.orig/templates/userassignments.html lms-cvs/templates/userassignments.html --- lms-cvs.orig/templates/userassignments.html 2005-01-31 22:09:24.000000000 +0100 +++ lms-cvs/templates/userassignments.html 2005-02-01 20:52:11.000000000 +0100 @@ -27,7 +27,7 @@ {if !$a.tariffid} {t}Suspending of all liabilities{/t} {else} - {$a.name} + {$a.name} ({$a.id|string_format:"%04d"}) {$a.value|money_format} {$a.period} ({$a.at}) {$a.downrate|default:"-"} kbps