Improved cable functions

master
Thomas Hooge 2 years ago
parent 6e4c4236aa
commit 6a5c483c42
  1. 9
      cable.php
  2. 2
      lang/de.php
  3. 14
      tpl/cable.tpl
  4. 10
      tpl/cableedit.tpl
  5. 12
      tpl/cableview.tpl
  6. 2
      tpl/vlan.tpl

@ -34,14 +34,16 @@ switch ($submit = form_get_action()) {
case 'insert':
$description = sanitize($_POST['description']);
$color = sanitize($_POST['color']);
$type = sanitize($_POST['cable_type']);
$info = sanitize($_POST['info']);
$sql = "INSERT INTO cable
(cable_description, cable_color, cable_info)
(cable_description, cable_color, cable_type, cable_info)
VALUES
(:description, :color, :info)";
(:description, :color, :type, :info)";
$sth = $dbh->prepare($sql);
$sth->bindValue(':description', $description, PDO::PARAM_STR);
$sth->bindValue(':color', $color, PDO::PARAM_STR);
$sth->bindValue(':type', $type, PDO::PARAM_STR);
$sth->bindValue(':info', $info, PDO::PARAM_STR);
$sth->execute();
$id = $dbh->lastInsertId();
@ -53,12 +55,14 @@ switch ($submit = form_get_action()) {
$color = sanitize($_POST['color']);
$length = sanitize($_POST['length']);
$type = sanitize($_POST['cable_type']);
$links = sanitize($_POST['links']);
$info = sanitize($_POST['info']);
$sql = "UPDATE cable
SET cable_description=:desc,
cable_color=:color,
cable_length=:length,
cable_type=:type,
cable_links=:links,
cable_info=:info
WHERE cable_id=:id";
$sth = $dbh->prepare($sql);
@ -67,6 +71,7 @@ switch ($submit = form_get_action()) {
$sth->bindValue(':length', $length, PDO::PARAM_INT);
$sth->bindValue(':color', $color, PDO::PARAM_STR);
$sth->bindValue(':type', $type, PDO::PARAM_STR);
$sth->bindValue(':links', $links, PDO::PARAM_INT);
$sth->bindValue(':info', $info, PDO::PARAM_STR);
$sth->execute();
$action = ACT_VIEW;

@ -46,7 +46,7 @@ $lang = array(
'lang_submit' => 'Absenden',
'lang_unassigned' => 'Nicht zugeordnet',
'lang_warning' => 'Warnung',
'lang_description' => 'Beschreibung',
'lang_description' => 'Bezeichnung',
'lang_empty' => 'leer',
'lang_source' => 'Quelle',
'lang_target' => 'Ziel',

@ -23,29 +23,35 @@
<td class="header">
{$lang_cable_type}
</td>
<td class="header">
# Links
</td>
<td class="header">
{$lang_cable_info}
</td>
</tr>
{foreach item=cable from=$cables}
<tr>
<td class="label">
<td class="label" style="width:20%">
<img src="image.php?color={$cable.cable_color}" alt="#{$cable.cable_color}">
<a href="cable.php?f=view&id={$cable.id}">{$cable.description}</a>
</td>
<td class="label">
<td class="label" style="width:10%">
{$cable.cable_length} m
</td>
<td class="label">
<td class="label" style="width:10%">
{$cable.cable_type}
</td>
<td class="label" style="width:10%">
{$cable.cable_links}
</td>
<td class="label">
{$cable.info}
</td>
</tr>
{foreachelse}
<tr>
<td>
<td colspan="4">
{$lang_cable_none}
</td>
</tr>

@ -55,6 +55,14 @@
{html_options name=cable_type options=$type_options selected=$cable->cable_type}
</td>
</tr>
<tr>
<td class="label">
# Links
</td>
<td class="value">
<input type="text" size="4" name="links" maxlength="4" value="{$cable->cable_links}">
</td>
</tr>
<tr>
<td class="label">
{$lang_color}
@ -65,7 +73,7 @@
</tr>
<tr>
<td class="label">
{$lang_info}
{$lang_cable_info}
</td>
<td class="value">
<textarea name="info" cols="30" rows="10">{$cable->info}</textarea>

@ -28,6 +28,14 @@
{$cable->description}
</td>
</tr>
<tr>
<td class="label">
{$lang_length}
</td>
<td class="value">
{$cable->cable_length} m
</td>
</tr>
<tr>
<td class="label">
{$lang_cable_type}
@ -38,10 +46,10 @@
</tr>
<tr>
<td class="label">
{$lang_length}
# Links
</td>
<td class="value">
{$cable->cable_length} m
{$cable->cable_links}
</td>
</tr>
<tr>

@ -26,7 +26,7 @@
</tr>
{foreach item=vlan from=$vlans}
<tr>
<td class="label">
<td class="label" style="width:10%">
{$vlan.number}
</td>
<td class="value">