15 |
|
|
16 |
<%session scope="global"> |
<%session scope="global"> |
17 |
std::string userName; |
std::string userName; |
|
bool isAdmin; |
|
18 |
</%session> |
</%session> |
19 |
|
|
20 |
<%args> |
<%args> |
45 |
|
|
46 |
reply.out() << "<a href='adm_installation_list?customerid=" << customerid<< "&name=" << name << "'>"; |
reply.out() << "<a href='adm_installation_list?customerid=" << customerid<< "&name=" << name << "'>"; |
47 |
reply.sout() << "<< back to installation list"; |
reply.sout() << "<< back to installation list"; |
48 |
reply.out() << "</a><br>"; |
reply.out() << "</a><br><br>"; |
49 |
|
|
50 |
tntdb::Connection conn = tntdb::connect(dburl); |
tntdb::Connection conn = tntdb::connect(dburl); |
51 |
|
|
124 |
{ |
{ |
125 |
}> |
}> |
126 |
|
|
127 |
<form method="post" action="adm_installation_edit"> |
|
128 |
|
<script type="text/javascript" language="JavaScript" src="/md5.js"></script> |
129 |
|
<script type="text/javascript" language="JavaScript" src="/trim.js"></script> |
130 |
|
<script type="text/javascript"> |
131 |
|
|
132 |
|
function validateInstallationForm() |
133 |
|
{ |
134 |
|
var form = document.installationform; |
135 |
|
form.description.value = trim(form.description.value); |
136 |
|
form.phonenr.value = trim(form.phonenr.value); |
137 |
|
form.imei.value = trim(form.imei.value); |
138 |
|
form.updaterate.value = trim(form.updaterate.value); |
139 |
|
|
140 |
|
if (form.description.value.length < 3) |
141 |
|
{ |
142 |
|
alert("Description must be at least 3 characters."); |
143 |
|
return false; |
144 |
|
} |
145 |
|
|
146 |
|
if (isNaN(form.phonenr.value)) |
147 |
|
{ |
148 |
|
alert("Phonenr may only contain digits"); |
149 |
|
return false; |
150 |
|
} |
151 |
|
|
152 |
|
if (form.phonenr.value.length < 8) |
153 |
|
{ |
154 |
|
if (!confirm("Phonenr seems rather short, are you sure this is correct")) |
155 |
|
{ |
156 |
|
return false; |
157 |
|
} |
158 |
|
} |
159 |
|
|
160 |
|
if (isNaN(form.imei.value)) |
161 |
|
{ |
162 |
|
alert("IMEI may only contain digits"); |
163 |
|
return false; |
164 |
|
} |
165 |
|
|
166 |
|
if (form.imei.value.length != 15) |
167 |
|
{ |
168 |
|
alert("IMEI must be exactly 15 digits"); |
169 |
|
return false; |
170 |
|
} |
171 |
|
|
172 |
|
if (isNaN(form.updaterate.value)) |
173 |
|
{ |
174 |
|
alert("Update rate may only contain digits"); |
175 |
|
return false; |
176 |
|
} |
177 |
|
|
178 |
|
var updaterate = parseInt(form.updaterate.value); |
179 |
|
|
180 |
|
if (form.updaterate.value == "" || updaterate <5 || updaterate > 250) |
181 |
|
{ |
182 |
|
alert("Update rate must be between 5 and 250\\n(Both inclusive)"); |
183 |
|
return false; |
184 |
|
} |
185 |
|
|
186 |
|
|
187 |
|
return true; |
188 |
|
} |
189 |
|
|
190 |
|
</script> |
191 |
|
|
192 |
|
<form method="post" action="adm_installation_edit" name="installationform" onsubmit="return validateInstallationForm();"> |
193 |
<table border="0"> |
<table border="0"> |
194 |
<tr> |
<tr> |
195 |
<td>Description:</td> |
<td>Description:</td> |
212 |
<td><input type="text" name="imei" size="40" maxlength="16" value="<$imei$>"></td> |
<td><input type="text" name="imei" size="40" maxlength="16" value="<$imei$>"></td> |
213 |
</tr> |
</tr> |
214 |
<tr> |
<tr> |
215 |
<td>Update rate</td> |
<td>Update rate*</td> |
216 |
<td><input type="text" name="updaterate" size="40" value="<$updaterate$>"></td> |
<td><input type="text" name="updaterate" size="40" value="<$updaterate$>"></td> |
217 |
</tr> |
</tr> |
218 |
<tr> |
<tr> |
226 |
<input type="hidden" name="submit" value="1"> |
<input type="hidden" name="submit" value="1"> |
227 |
</form> |
</form> |
228 |
|
|
229 |
<br> |
<p>*: Update rate is in minutes.</p> |
|
<form method="post" action="adm_installation_delete"> |
|
|
<input type="hidden" name="id" value="<$id$>"> |
|
|
<input type="hidden" name="customerid" value="<$customerid$>"> |
|
|
<input type="hidden" name="name" value="<$name$>"> |
|
|
<input type="submit" value="Delete"> |
|
|
</form> |
|
230 |
|
|
231 |
<{ |
<{ |
232 |
} |
if (id != -1) |
233 |
|
{ |
234 |
|
}> |
235 |
|
<br> |
236 |
|
<form method="post" action="adm_installation_delete" onsubmit="return confirm('Are you sure ?\\nThis will delete all loggings related to this installation','Delete installation');"> |
237 |
|
<input type="hidden" name="id" value="<$id$>"> |
238 |
|
<input type="hidden" name="customerid" value="<$customerid$>"> |
239 |
|
<input type="hidden" name="name" value="<$name$>"> |
240 |
|
<input type="submit" value="Delete this installation"> |
241 |
|
</form> |
242 |
|
|
243 |
|
|
244 |
|
<{ |
245 |
|
} //fi (id != -1) |
246 |
|
} //fi (showForm) |
247 |
}> |
}> |
248 |
|
|
249 |
<&footer> |
<&footer> |