flag fixes in work
This commit is contained in:
@@ -34,7 +34,7 @@ $srchpname=$_REQUEST['srchpname'] ?? NULL;
|
|||||||
$srchploc=$_REQUEST['srchploc'] ?? NULL;
|
$srchploc=$_REQUEST['srchploc'] ?? NULL;
|
||||||
$srchnha=$_REQUEST['srchnha'] ?? NULL;
|
$srchnha=$_REQUEST['srchnha'] ?? NULL;
|
||||||
$srchrepord=$_REQUEST['srchrepord'] ?? NULL;
|
$srchrepord=$_REQUEST['srchrepord'] ?? NULL;
|
||||||
$srchflags=$_REQUEST['srchflags'] ?? NULL;
|
$srchflags=$_POST['srchflags'] ?? [];
|
||||||
$target=$_REQUEST['target'] ?? NULL;
|
$target=$_REQUEST['target'] ?? NULL;
|
||||||
|
|
||||||
$doparts=PARTS_FUNCTIONS;
|
$doparts=PARTS_FUNCTIONS;
|
||||||
@@ -57,6 +57,15 @@ framework("begin","$logname Search","Search",$print);
|
|||||||
//var_dump($_REQUEST);
|
//var_dump($_REQUEST);
|
||||||
|
|
||||||
// ******** begin database manipulation ********
|
// ******** begin database manipulation ********
|
||||||
|
|
||||||
|
// define the arrays
|
||||||
|
$logfromtables=[];
|
||||||
|
$mffromtables=[];
|
||||||
|
$pfromtables=[];
|
||||||
|
$logconstraints=[];
|
||||||
|
$mfconstraints=[];
|
||||||
|
$pconstraints=[];
|
||||||
|
|
||||||
// get the date range of lognotes
|
// get the date range of lognotes
|
||||||
$logdateqry=mysqli_query($db,"select min(date), max(date) from lognotes");
|
$logdateqry=mysqli_query($db,"select min(date), max(date) from lognotes");
|
||||||
$logdateresults=mysqli_fetch_row($logdateqry);
|
$logdateresults=mysqli_fetch_row($logdateqry);
|
||||||
@@ -75,8 +84,6 @@ if ($mfmaxdate == "") $mfmaxdate = $today;
|
|||||||
$mindate=min($logmindate, $mfmindate);
|
$mindate=min($logmindate, $mfmindate);
|
||||||
$maxdate=max($logmaxdate, $mfmaxdate);
|
$maxdate=max($logmaxdate, $mfmaxdate);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($search) {
|
if ($search) {
|
||||||
// strip whitespace from beginning and end of text fields
|
// strip whitespace from beginning and end of text fields
|
||||||
$srchtext=trim($srchtext);
|
$srchtext=trim($srchtext);
|
||||||
@@ -122,8 +129,9 @@ if ($search) {
|
|||||||
$logfromtables[]="lognotes";
|
$logfromtables[]="lognotes";
|
||||||
$logconstraints[]="lognotes.lognote like \"%$srchtext%\"";
|
$logconstraints[]="lognotes.lognote like \"%$srchtext%\"";
|
||||||
}
|
}
|
||||||
|
// fixme
|
||||||
// flags
|
// flags
|
||||||
if ($srchflags != NULL) {
|
if (!empty($srchflags)) {
|
||||||
foreach ($srchflags as $flagtblnum) {
|
foreach ($srchflags as $flagtblnum) {
|
||||||
$flagtblname="flag_{$flagtblnum}";
|
$flagtblname="flag_{$flagtblnum}";
|
||||||
$logfromtables[]="lognotes";
|
$logfromtables[]="lognotes";
|
||||||
@@ -231,6 +239,7 @@ if ($search) {
|
|||||||
$mffromtables[]="maintactions";
|
$mffromtables[]="maintactions";
|
||||||
$mfconstraints[]="maintforms.mfmalfunction like \"%$srchtext%\" or (maintactions.action like \"%$srchtext%\" and maintforms.maintformid=maintactions.maintformnum)";
|
$mfconstraints[]="maintforms.mfmalfunction like \"%$srchtext%\" or (maintactions.action like \"%$srchtext%\" and maintforms.maintformid=maintactions.maintformnum)";
|
||||||
}
|
}
|
||||||
|
// fixme
|
||||||
// flags
|
// flags
|
||||||
foreach ($srchflags as $flagtblnum) {
|
foreach ($srchflags as $flagtblnum) {
|
||||||
$flagtblname="flag_{$flagtblnum}";
|
$flagtblname="flag_{$flagtblnum}";
|
||||||
@@ -463,27 +472,37 @@ if (!$print) {
|
|||||||
<br><br>
|
<br><br>
|
||||||
<b>Flags:</b>
|
<b>Flags:</b>
|
||||||
";
|
";
|
||||||
$flagslist=mysqli_query($db,"select * from flags");
|
$flagslist = mysqli_query($db, "select * from flags");
|
||||||
$flagsperline=8;
|
$flagsperline = 8;
|
||||||
$flagcount=1;
|
$flagcount = 1;
|
||||||
while ($flagcheckbox=mysqli_fetch_assoc($flagslist)) {
|
while ($flagcheckbox = mysqli_fetch_assoc($flagslist)) {
|
||||||
if ($srchflags[0]=="") $srchflags=[];
|
if ($srchflags[0] == "") $srchflags = [];
|
||||||
if (in_array($flagcheckbox["flagid"],$srchflags)) {
|
if (in_array($flagcheckbox["flagid"], $srchflags)) {
|
||||||
printf("<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" checked title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
|
printf(
|
||||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
"<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" checked title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||||
|
$flagcheckbox["flagid"],
|
||||||
|
$flagcheckbox["flagcolor"],
|
||||||
|
$flagcheckbox["flagname"],
|
||||||
|
$flagcheckbox["flagsym"]
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
$flagid=$flagcheckbox["flagid"];
|
$flagid = $flagcheckbox["flagid"];
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
if (mysqli_num_rows(mysqli_query($db, "select flagid from flags where flagid=\"$flagid\" and status=1"))) {
|
||||||
printf("<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
|
printf(
|
||||||
$flagcheckbox["flagid"],$flagcheckbox["flagcolor"],$flagcheckbox["flagname"],$flagcheckbox["flagsym"]);
|
"<input type=\"checkbox\" name=\"srchflags[]\" value=\"%s\" title=\"When checked, only results with this flag set will be shown\"><font color=\"%s\" title=\"%s\">%s</font>",
|
||||||
|
$flagcheckbox["flagid"],
|
||||||
|
$flagcheckbox["flagcolor"],
|
||||||
|
$flagcheckbox["flagname"],
|
||||||
|
$flagcheckbox["flagsym"]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($flagcount<$flagsperline) {
|
if ($flagcount < $flagsperline) {
|
||||||
echo " ";
|
echo " ";
|
||||||
$flagcount++;
|
$flagcount++;
|
||||||
} else {
|
} else {
|
||||||
echo "<br>";
|
echo "<br>";
|
||||||
$flagcount=1;
|
$flagcount = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "
|
echo "
|
||||||
@@ -656,20 +675,23 @@ if ($search) {
|
|||||||
$logsubjname=dblookup($db,"subjects","subjectid","subjectname",$logtablerow['subject']);
|
$logsubjname=dblookup($db,"subjects","subjectid","subjectname",$logtablerow['subject']);
|
||||||
// create links of urls in note
|
// create links of urls in note
|
||||||
$logfmtnote=convertweblinks($logtablerow['lognote']);
|
$logfmtnote=convertweblinks($logtablerow['lognote']);
|
||||||
|
|
||||||
// generate the flags string
|
// generate the flags string
|
||||||
$flagstring="";
|
$flagstring="";
|
||||||
$allflagqry=mysqli_query($db,"select flagid from flags");
|
$flagqry=mysqli_query($db,"select flagid from flagmap where lognoteid=$logtablerow[lognoteid]");
|
||||||
while ($allflagids=mysqli_fetch_row($allflagqry)) {
|
while ($flagid=mysqli_fetch_row($flagqry)) {
|
||||||
$flagid=$allflagids[0];
|
$flagparams=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid[0]\""));
|
||||||
$flag_tbl="flag_".$flagid;
|
$flagcolor=$flagparams["flagcolor"];
|
||||||
if (mysqli_num_rows(mysqli_query($db,"select id from $flag_tbl where target=\"lognotes\" and id=\"$logtablerow[lognoteid]\""))) {
|
$flagsym=$flagparams["flagsym"];
|
||||||
$flagparam=mysqli_fetch_assoc(mysqli_query($db,"select * from flags where flagid=\"$flagid\""));
|
$flagname=$flagparams["flagname"];
|
||||||
$flagcolor=$flagparam["flagcolor"];
|
$flagstring=$flagstring."<font color=\"$flagcolor\" title=\"$flagname\">$flagsym</font> ";
|
||||||
$flagsym=$flagparam["flagsym"];
|
|
||||||
$flagstring=$flagstring."<font color=\"$flagcolor\">$flagsym</font> ";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($flagstring) $logfmtnote=$logfmtnote."<br>".$flagstring;
|
if ($flagstring) {
|
||||||
|
$logfmtnote=$logfmtnote."<br>".$flagstring." ";
|
||||||
|
} else {
|
||||||
|
$logfmtnote=$logfmtnote."<br>";
|
||||||
|
}
|
||||||
|
|
||||||
printf("<tr>
|
printf("<tr>
|
||||||
<td valign=\"top\"><a href=logentry.php?edit=1¬eid=%s>%s</a></td>
|
<td valign=\"top\"><a href=logentry.php?edit=1¬eid=%s>%s</a></td>
|
||||||
<td valign=\"top\">%s / %s</td>
|
<td valign=\"top\">%s / %s</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user