-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathedit_glider_content.php
146 lines (123 loc) · 5.63 KB
/
edit_glider_content.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<? /* Copyright (C) 1995-2020 John Murtari
This file is part of FLY flight management software
FLY 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.
FLY is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FLY. If not, see <https://www.gnu.org/licenses/>. */ ?>
<?php
$title = "Edit Aircraft Info";
$warning = "";
if ($super) {
if ($action == 'new') { # inserting a new glider
$GliderID = 0;
$action = 'insert';
$title = "New Aircraft Info";
// we could be back after a missing field, make sure we have values
// for some fields
$detailArray = Array('type');
foreach($detailArray as $t) {
if (!isset($$t) || stristr($$t, 'none')) {
$$t = 'None';
}
}
}
} // end if- superuser
if (getPhoto($GliderID, $photoURL, $path, 'Glider')) {
$photo = PHOTO_DIR."/glider_0.jpg";
} else {
$photo = $photoURL;
}
?>
<div class="clsContent-mid5">
<form id ="inputform" method="POST" action="edit_glider.php">
<table style="border-collapse: collapse" border="0" bordercolor="#111111" cellpadding="5" cellspacing="0" width="100%">
<tr>
<td>
<a border=2 href="edit_photo.php?table=Glider&GliderID=<?=$GliderID?>"><img align='left' border='2' alt=" Glider photo " width="250" src="<?=$photo?>" class="img-right"></a></p>
</td>
<td>
<h3><span style="font-size: 24px;"><?=$title?></span></h3>
<p>You may edit aircraft info below. <b>Be careful!</b> Any changes made take effect immediately. Fields with (*) are required.<br><-- Click on photo to
upload/edit.
</p>
</td>
</tr>
<?
$rowCount = 0;
$rowIndent = ' ';
foreach ($GliderLayout as $label => $params) {
// define some shortcut values
$dbType = $params['dbType'];
if ($dbType == 'text') {
$size = "size = '" . $params['width'] . "',";
} else {
$size = '';
}
if ($params['req']) {
$required = "<font color='red'><b>*</b></font>";
} else {
$required = '';
}
$editPerm = 0; // can the user edit this field or read only
if ($params['access'] == 'MEMBER') {
$editPerm = 1;
} else if ($super) {
$editPerm = 1;
}
if ($params['newRow']) {
if ($rowCount++) { // had previous row
echo "\n$rowIndent </td>\n$rowIndent </tr>\n";
}
echo "\n$rowIndent <tr>\n";
echo "$rowIndent <td align='right'><b>$required $label:</b></td>\n$rowIndent <td align='left'>";
} else {
echo " <b>$required $label:</b> ";
}
// setup the correct input field
$valVar = $params['dbCol']; // the name of the current value variable
$value = $$valVar;
if ($valVar == 'mentorID') { // SPECIAL
memberSelect('mentorID', $mentorID, 'CFIG');
} else if ($dbType == 'textarea') {
echo "<textarea name=" . $params['dbCol'] . " ROWS='8' COLS='" . $params['width'] . "'>";
echo "$value\n</textarea>\n";
} else if ($dbType == 'text') {
echo "<input name=" . $params['dbCol']. " $size value='$value'>";
} else { // limited input values
$selVar = $params['select']; // the name of the select options variable
$selValue = $$selVar;
if ($editPerm) {
displayInput($valVar, $dbType == 'enum' ? 'MENU' : 'CHECK', $$selVar, $value);
} else {
echo "$value";
}
} // end if-else field name/type
} // end for all display items
echo "\n$rowIndent </td>\n$rowIndent </tr>\n"; // finish the last row.
?>
<tr>
<td align="right" width="140"></td>
<td align="left" width="800" colspan="2">
<INPUT TYPE='hidden' name='GliderID' value='<?=$GliderID?>'>
<INPUT TYPE='submit' name="action" onClick="return checkSubmit('<?=$action?>','')" value='<?=$action?>'>
<? if ($action == 'update') { ?>
<INPUT TYPE='submit' name="action" onClick="return checkSubmit('delete','')" value='delete'>
<? } ?>
</td>
</tr>
</table>
<p> </p>
</form>
<script id="source" language="javascript" type="text/javascript">
$(function() {
$("#annualExpire").datepicker({ dateFormat: 'yy-mm-dd'});
$("#regExpire").datepicker({ dateFormat: 'yy-mm-dd'});
});
</script>
</div>