-
Notifications
You must be signed in to change notification settings - Fork 8
/
editCat.php
98 lines (98 loc) · 3.86 KB
/
editCat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<?php
require_once 'editCat.inc.php';
require_once 'header.inc.php';
log_array('$catlist');
?>
<?php if ($thiscat || !$id) {
?><form action="processCat.php" method="post" onsubmit="return GTD.validate(this);">
<div class='formrow'><span class="error" id='errorMessage'></span></div>
<div>
<input type='hidden' name='field' value='<?php echo $field; ?>' />
<?php if ($thiscat['id']!==false) { ?>
<input type='hidden' name='id' value=<?php echo "'{$thiscat['id']}'"; ?> />
<?php } ?>
</div>
<table class='datatable sortable' id='list' summary='<?php echo $field; ?> table'>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<?php if ($showTypes) { ?>
<th><label>Type:</label></th>
<?php
}
if ($canDelete) { ?>
<th>Delete?</th>
<?php } ?>
</tr>
<?php
if ($thiscat['id']!==false) { ?>
<tr>
<td><input type="text" name="name" value="<?php echo $thiscat['name']; ?>" />
<input type='hidden' name='next' value="<?php echo $nextcat; ?>" />
<input type='hidden' name='required' value='name:notnull:Name cannot be blank' />
<input type='hidden' name='dateformat' value='ccyy-mm-dd' />
</td>
<td><textarea rows="2" cols="50" name="description"><?php echo $thiscat['description']; ?></textarea></td>
<?php
if ($showTypes) {
echo "<td>\n";
$cls='first';
$alltypes=getTypes();
foreach (array('v','o','g','p','a') as $key) {
$val=$alltypes[$key];
echo "<input type='radio' name='type' id='$val' value='$key'";
if ($thiscat['type']===$key) echo " checked='checked'";
echo " class='$cls' /><label for='$val' class='$cls'>$val</label> ";
$cls='notfirst';
}
echo "</td>\n";
}
if ($canDelete) echo "<td><input type='checkbox' name='delete' value='y' /></td>\n";
?>
</tr>
<tr>
<td><input type="submit" class="button" value="Update" name="submit" /></td>
<td><input type="reset" class="button" value="Reset" /></td>
<?php if ($showTypes) { ?><td> </td><?php } ?>
<?php if ($canDelete) { ?><td>and replace with</td><?php } ?>
</tr>
<?php } ?>
</thead>
<tbody>
<?php foreach ($catlist as $row) { ?>
<tr>
<td><a href=<?php
echo "'$pagename.php?field=$field&id={$row['id']}' title='Edit {$row['name']} {$field}'>{$row['name']}";
?></a></td>
<td><?php echo $row['description']; ?></td>
<?php if ($showTypes) { ?><td><?php echo getTypes($row['type']); ?></td><?php } ?>
<?php if ($canDelete) { ?>
<td><?php if (!$showTypes || $row['type']===$thiscat['type']) { ?>
<input type='radio' name='replacewith' value='<?php echo $row['id']; ?>' />
<?php } else echo ' ' ?>
</td>
<?php } ?>
</tr>
<?php } ?>
</tbody>
<tbody>
<?php if ($canDelete) { ?>
<tr>
<td>None</td>
<td> </td>
<?php if ($showTypes) { ?><td> </td><?php } ?>
<td><input type="radio" name="replacewith" value="0" checked="checked" /></td>
</tr>
<?php } ?>
<tr>
<td><a href='editCat.php?field=<?php echo $field; ?>&id=0'>Create new <?php echo $field; ?></a></td>
<td> </td>
<?php if ($showTypes) { ?><td> </td><?php } ?>
<?php if ($canDelete) echo '<td> </td>'; ?>
</tr>
</tbody>
</table>
</form><?php
}
include_once 'footer.inc.php'; ?>