Replaced template line loading code with the templateselect function.

This commit is contained in:
2026-02-18 14:11:52 -05:00
parent 86f1512cc0
commit 9122040863

View File

@@ -498,70 +498,15 @@ if ($submit) {
if ($delete) {
format_message(0,"<strong>Note deleted.</strong> <a href=\"lognotes.php\">Return to main page.</a>");
}
echo "
<form method=\"post\" action=\"logentry.php\">
";
if ($_SESSION['login']) {
// generate template line
echo "
<table border=\"0\" cellpadding=\"10\"><tr>
";
// list user templates
echo "
<td>
<select name=\"usertemplateid\" title=\"Select the user template you'd like to load and click the Load Template button. User template selection takes precedence.\">
";
if ($loadtemplate) $templatename=dblookup($db,"notetemplates","templateid","templatename",$usertemplateid);
$templaterow=mysqli_query($db,"select * from notetemplates where tech=\"$techid\" order by templatename asc");
if ($loadtemplate) {
printf("<option value=\"%s\">%s</option>","0","Select user template");
} else {
printf("<option value=\"%s\" selected>%s</option>","0","Select user template");
}
while ($templateitem=mysqli_fetch_assoc($templaterow)) {
if ($loadtemplate && ($templateitem["templateid"] == $usertemplateid)) {
printf("<option value=\"%s\" selected>%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
} else {
printf("<option value=\"%s\">%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
}
}
echo "
</select>&nbsp;or&nbsp;
";
// list global templates
echo "
<select name=\"globaltemplateid\" title=\"Select the global template you'd like to load and click the Load Template button. User template selection takes precedence.\">
";
if ($loadtemplate) $templatename=dblookup($db,"notetemplates","templateid","templatename",$globaltemplateid);
$templaterow=mysqli_query($db,"select * from notetemplates where tech=\"0\" order by templatename asc");
if ($loadtemplate) {
printf("<option value=\"%s\">%s</option>","0","Select global template");
} else {
printf("<option value=\"%s\" selected>%s</option>","0","Select global template");
}
while ($templateitem=mysqli_fetch_assoc($templaterow)) {
if ($loadtemplate && ($templateitem["templateid"] == $globaltemplateid)) {
printf("<option value=\"%s\" selected>%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
} else {
printf("<option value=\"%s\">%s</option>",$templateitem["templateid"],$templateitem["templatename"]);
}
}
echo "
</select>&nbsp;&nbsp;
";
// show load button
echo "
<input type=\"submit\" name=\"loadtemplate\" value=\"Load Template\">
</td>
<td>
<a href=\"templates.php\">Manage templates</a>
</td>
</tr></table>
<hr>
";
// show the template selection line
templateselect($techid,NULL);
}
// start note entry section
echo "
<form method=\"post\" action=\"logentry.php\">
<table border=\"0\" cellpadding=\"5\">
<tr>
<td align=\"center\" colspan=\"2\"><b>Date: </b>&nbsp;