Skip to content

Commit

Permalink
query & button updates (#139)
Browse files Browse the repository at this point in the history
* xxx

* Delete Database_JobTables.txt

* comma strip

* Added Educator Job Table

Modified Database_JobTables to include Educator Table

* Updated Tooltip Descriptions

Changed the ears_tipped and pregnant_cats images to have a more meaningful description.

* updated login page

not sure if it'll show up correctly because I couldn't get to run in on my computer... I tested it by changing it to html instead of php..

* minor change to login

* merge problems..

* userprofile.css small modification

* create.account ext rename

* updated createaccount.php

* error msg box added

* Added a couple of tooltips

Tooltips to forms

* tooltip updates

* removed everthing

removed everything

* add everything

added everything back in

* buttons for "text ok" added to forms

* volunteerform

* volunteerform textok

* removed <<<<<HEAD

* small change so add 1 to db if textok is checked

* Rename Database_JobTables.txt to Database_JobTables

* a

* Rename Database_JobTables to Database_JobTables.txt

* a

a

* Added button on the side

Added button on the side to logout and go to catstats

* Add dropdown menu

Add dropdown menu with catstats and log out link

* Uploading the icon

Uploading icon

* updateprofile.php

* able to submit update to profile

* auto populate city&county by zip

* restrict zip to CA

* Update reportform.php

* Update reportform.php

* fixed city problem

* city fix

* Update reportform.php

* display form on checkbox

* email tooltip

* minor form updates

* caregiver/feeder update

* Update script.js

* form update #2

* form update #3

* search.php: removed colony name & ear tipped

* db: removed colony name & ear tipped

* forgot to remove eartipped

* form updates #4

* minor changes

* found it

* added "are there any kittens"

* added friendly/pet

* combined first & last name

* found error with first/last name

* basic Custom Query Builder

* undo

* custom query builder

partially working

* forgot to remove

* again

* custom query builder v2

* custom query builder v2

* Update search.php

* Update search.php

* minor search.php update

* comments1 fix

* reportform updates

* moved css to sacferals folder

* zip fix

* search.php update

* css fix

* map fix

* map fix

* one more try

* a

* map fix2

* custom query update

* report form update

* clean

* report form updates #2

* volunteer table update

* undo

* volunteer table updates

* db fix

added new values to wrong table lol

* db fix

* search.php fix

* oops

* oops#2

* #3

* update#4

* #5

* reportform update

* reportform update

* a

* update

* fixed not updating error

* update

* undo

* undo

* total records

* updateprofile.php updated

* report form update

* updateprofile udpate

* small update to updateprofile.php

added check for empty pwd

* forgot =

* ahhh

* fix =

* reports can now be seen by triage and master

* edit

* Canned Queries

Canned Queries

* Canned Queries Table

* canned query

* table for canned queries in db

* create new query

* Navbar

* update

* cannedquery added to db.txt

* manual query added & renaimed hr

* css update

* reportform & search update

* reportform update

* copy function added

* oops

* volunteerform updated & validation added

* a

* a

* undo

* message when copy successful

* updateprofile update

* authentication update

* email req

* auth fix

* form submit fix

* update submit fix

wasn't submitting for admin

* moved links to top of table

* link fixes

* createaccount page update

* createaccount alert update

* update

* update#2

* table columns renamed

* added queries to volunteerlist

* update

* report form and search update

* update

* a

* b

* c

* query update

* update

* query update

* UPDATES

* zip & address validation fix

* query update

* query save updates

* update2

* undos

* query save updates

* update

* more updates

* button updates
  • Loading branch information
vitadub authored and JustinLangshaw committed Dec 1, 2017
1 parent 7bff988 commit 3586651
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 60 deletions.
61 changes: 42 additions & 19 deletions sacferals/adminprofile.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
$Ausername = $_SESSION['Ausername'];
$level = $_SESSION['level'];

//prevent page from appending same query to current query
$curr_url = (isset($_SERVER['HTTPS']) ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if(strpos($curr_url,"?query")>0){
$cleared_url = strtok($curr_url, "?"); //remove get variables
header("Location: ".$cleared_url);
}

if($level == 1)
{
?>
Expand Down Expand Up @@ -183,7 +190,7 @@
<form id="queryform" method='get' action='adminprofile.php'>
<label><b>Custom Query</b></label>
&nbsp;&nbsp;&nbsp;
<span style="color: darkgray;"><small>(Enter null or '' for empty value)</small></span>
<span style="color: darkgray;"><small>(Enter null for empty value)</small></span>
<div class="row" id="cqrow">
<div id="blueprint">
<select class="input-sm" id="query" name="query[]" tabindex='3'>
Expand Down Expand Up @@ -401,9 +408,13 @@
$condition=" not like ";
$value="%".$value."%";
}
else if($condition=='=' && ($value=='null' || $value=="''")) $value="";
if(strcasecmp($value,'null')==0 || $value=="''" || $value=='""'){
$condition="is null or ".$column." = ''";
$value="";
}
else $value="'".$value."'";

$search = $search."".$andor." ".$column." ".$condition." '".$value."'";
$search = $search." ".$andor." ".$column." ".$condition." ".$value;
}
$andor = $_GET['andor'][$i];
$i++;
Expand Down Expand Up @@ -456,7 +467,7 @@
$sea = 'select * from CannedQueriesVolunteers where QueryString="'.$_SESSION['volunteerquerysearch'].'"';
$res = mysqli_query($link, $sea);
if(mysqli_num_rows($res)==0){
$savecannedqry = "insert into CannedQueriesVolunteers values('', '".$qryname."', \"".$_SESSION['volunteerquerysearch']."\")";
$savecannedqry = "insert into CannedQueriesVolunteers values('', '".$qryname."', ".'"'.$_SESSION['volunteerquerysearch'].'"'.")";
mysqli_query($link, $savecannedqry);
}
}
Expand All @@ -482,33 +493,36 @@
}
//manual query check for existance & then display modal to get name
if(isset($_GET['savewrittenqry'])){
$qryname = str_replace("'", "\'", $_GET['queryname2']);
$newq = str_replace("'", "\'", $_GET['manquery']);

//dont do anything if empty
if($newq != ''){
$wrttnqry = 'select * from CannedQueriesVolunteers where QueryString="'.$_GET['manquery'].'"';
$wrttnqry = "select * from CannedQueriesVolunteers where QueryString='".$newq."'";
$wrttnqryres = mysqli_query($link, $wrttnqry);
if(mysqli_num_rows($wrttnqryres)==0){
$_SESSION['volunteerquerytosave'] = $newq;
echo "<script type='text/javascript'>
$(document).ready(function(){
$('#getcndqnameModal2').modal('show');
});
</script>";
} else {
$rw = mysqli_fetch_row($wrttnqryres);
echo "<div id='emptyquerymsg'><h3>This Canned Query already exists under the name \"".$rw[1]."\"</h3></div>";
echo "<div id='emptyquerymsg'><h3>This Canned Query already exists under the name ".'"'.$rw[1].'"'."</h3></div>";
}
} else {
echo "<div id='emptyquerymsg'><h3>No Query to save</h3></div>";
}
}
//manual query save
if(isset($_GET['addcurrentquery2'])){
$qryname = $_GET['queryname2'];

//still check if exists so doesn't keep adding to db
$wrttnqry = 'select * from CannedQueries where QueryString="'.$_GET['manquery'].'"';
$qryname = str_replace("'", "\'", $_GET['queryname2']);

$wrttnqry = "select * from CannedQueriesVolunteers where QueryString='".$_SESSION['volunteerquerytosave']."'";
$wrttnqryres = mysqli_query($link, $wrttnqry);
if(mysqli_num_rows($wrttnqryres)==0){
$savewrttnqry = "insert into CannedQueries values('', '".$qryname."', \"".$wrttnqry."\")";
$savewrttnqry = "insert into CannedQueriesVolunteers values('', '".$qryname."', '".$_SESSION['volunteerquerytosave']."')";
mysqli_query($link, $savewrttnqry);
}
}
Expand Down Expand Up @@ -563,7 +577,14 @@
<div class='col-sm-12'>
<form method='post' action='adminprofile.php'>
<b>Volunteer Table</b><br><br>
<b>Volunteer Table</b>
<div class='row' style='float: right'>
<div class='col-xs-12 col-sm-12 col-md-12' style='text-align:right; padding-right:5px;'>
<input class='btn btn-default' type='button' value='Reset' name='RefreshTable' onclick=\"location.href='adminprofile.php?RefreshTable=Reset'\"/>
<input class='btn btn-success' type='button' id='exportButton' onclick=\"tableToExcel('volunteerTable', 'Volunteers')\" value='Export' />
</div>
</div>
<table id='volunteerTable' class='table table-striped table-bordered table-condensed'>
<thead>
<tr>
Expand Down Expand Up @@ -1056,7 +1077,13 @@
<span id='querymsg'><h5>".$q.$_SESSION['volunteerquerysearch']."</h5></span>
<div class='row'>
<div class='col-sm-12'>
<b>Volunteers</b><br><br>
<b>Volunteers</b>
<div class='row' style='float: right'>
<div class='col-xs-12 col-sm-12 col-md-12' style='text-align:right; padding-right:5px;'>
<input class='btn btn-default' type='button' value='Reset' name='RefreshTable' onclick=\"location.href='adminprofile.php?RefreshTable=Reset'\"/>
<input class='btn btn-success' type='button' id='exportButton' onclick=\"tableToExcel('volunteerTable', 'Volunteers')\" value='Export' />
</div>
</div>
<table id='volunteerTable' class='table table-striped table-bordered table-condensed'>
<thead>
Expand Down Expand Up @@ -1330,16 +1357,12 @@
else if($level == 2)
{
print "you aren't supposed to be here.. STOP SNEAKING AROUND";
header("Location: userprofile.php");
header("Location: search.php");
}
}
?>

<form id="resettable" method='get' action='adminprofile.php'>
<input class="btn btn-default" type="submit" value="Reset" name="RefreshTable"/>
<input class="btn btn-success" type="button" id="exportButton" onclick="tableToExcel('volunteerTable', 'Volunteers')" value="Export" />
<span id="ttlrecs">Total Records: <?php echo $_SESSION['volunteertotalrecords']; ?></span>
</form>
<span id="ttlrecs"><b>Total Records: <?php echo $_SESSION['volunteertotalrecords']; ?></b></span>
</div> <!-- end div class='col-sm'12' -->
</div> <!-- end div class='row' -->
</div> <!-- end maindiv -->
Expand Down
64 changes: 41 additions & 23 deletions sacferals/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
<form id="queryform" method='get' action='search.php'>
<label><b>Custom Query</b></label>
&nbsp;&nbsp;&nbsp;
<span style="color: darkgray;"><small>(Enter null or '' for empty value)</small></span>
<span style="color: darkgray;"><small>(Enter null for empty value)</small></span>
<div class="row" id="cqrow">
<div id="blueprint">
<select class="input-sm" id="query" name="query[]" tabindex='3'>
Expand Down Expand Up @@ -418,9 +418,13 @@
$condition=" not like ";
$value="%".$value."%";
}
else if($condition=='=' && ($value=='null' || $value=="''")) $value="";
if(strcasecmp($value,'null')==0 || $value=="''" || $value=='""'){
$condition="is null or ".$column." = ''";
$value="";
}
else $value="'".$value."'";

$search = $search." ".$andor." ".$column." ".$condition." '".$value."'";
$search = $search." ".$andor." ".$column." ".$condition." ".$value;
}
$andor = $_GET['andor'][$i];
$i++;
Expand Down Expand Up @@ -473,7 +477,8 @@
$sea = 'select * from CannedQueries where QueryString="'.$_SESSION['querysearch'].'"';
$res = mysqli_query($link, $sea);
if(mysqli_num_rows($res)==0){
$savecannedqry = "insert into CannedQueries values('', '".$qryname."', \"".$_SESSION['querysearch']."\")";
$savecannedqry = "insert into CannedQueries values('', '".$qryname."', '".$_SESSION['querysearch']."')";
echo $savecannedqry;
mysqli_query($link, $savecannedqry);
}
}
Expand All @@ -499,33 +504,36 @@
}
//manual query check for existance & then display modal to get name
if(isset($_GET['savewrittenqry'])){
$qryname = str_replace("'", "\'", $_GET['queryname2']);
$newq = str_replace("'", "\'", $_GET['manquery']);

//dont do anything if empty
if($newq != ''){
$wrttnqry = 'select * from CannedQueries where QueryString="'.$_GET['manquery'].'"';
$wrttnqry = "select * from CannedQueries where QueryString='".$newq."'";
$wrttnqryres = mysqli_query($link, $wrttnqry);
if(mysqli_num_rows($wrttnqryres)==0){
$_SESSION['querytosave'] = $newq;
echo "<script type='text/javascript'>
$(document).ready(function(){
$('#getcndqnameModal2').modal('show');
});
</script>";
} else {
$rw = mysqli_fetch_row($wrttnqryres);
echo "<div id='emptyquerymsg'><h3>This Canned Query already exists under the name \"".$rw[1]."\"</h3></div>";
echo "<div id='emptyquerymsg'><h3>This Canned Query already exists under the name ".'"'.$rw[1].'"'."</h3></div>";
}
} else {
echo "<div id='emptyquerymsg'><h3>No Query to save</h3></div>";
}
}
//manual query save
if(isset($_GET['addcurrentquery2'])){
$qryname = $_GET['queryname2'];

//still check if exists so doesn't keep adding to db
$wrttnqry = 'select * from CannedQueries where QueryString="'.$_GET['manquery'].'"';
$qryname = str_replace("'", "\'", $_GET['queryname2']);

$wrttnqry = "select * from CannedQueries where QueryString='".$_SESSION['querytosave']."'";
$wrttnqryres = mysqli_query($link, $wrttnqry);
if(mysqli_num_rows($wrttnqryres)==0){
$savewrttnqry = "insert into CannedQueries values('', '".$qryname."', \"".$wrttnqry."\")";
$savewrttnqry = "insert into CannedQueries values('', '".$qryname."', '".$_SESSION['querytosave']."')";
mysqli_query($link, $savewrttnqry);
}
}
Expand Down Expand Up @@ -577,8 +585,14 @@
<div class='col-sm-12'>
<form method='post' action='search.php'>
<b>Report A Feral Cat Colony</b><br><br>
<b>Report A Feral Cat Colony</b>
<div class='row' style='float: right'>
<div class='col-xs-12 col-sm-12 col-md-12' style='text-align:right; padding-right:5px;'>
<input class='btn btn-default' type='button' value='Reset' name='RefreshTable' onclick=\"location.href='search.php?RefreshTable=Reset'\"/>
<input class='btn btn-success' type='button' id='exportButton' onclick=\"tableToExcel('reportTable', 'Reports')\" value='Export' />
</div>
</div>
<table id='reportTable' class='table table-striped table-bordered table-condensed'>
<thead>
<tr>
Expand Down Expand Up @@ -1052,11 +1066,19 @@
<span id='querymsg'><h5>".$q.$_SESSION['querysearch']."</h5></span>
<div class='row'>
<div class='col-sm-12'>
<b>Report A Feral Cat Colony</b><br><br>
<button class='btn btn-success' id='editrowbtn' style='margin-bottom:2px' onclick='editFunction()' disabled='true'>Edit</button>
<button class='btn btn-danger' id='deleterowbtn' style='margin-bottom:2px' onclick='deleteFunction()' class='confirmation' disabled='true'>Delete</button>
<button class='btn btn-info' id='formviewbtn' style='margin-bottom:2px' onclick='formviewFunction()' disabled='true'>Form View</button>
<button class='btn' id='copyrowbtn' style='background-color:gold; color:black; margin-bottom:2px' id='copyrow' onclick='copyFunction2()' disabled='true'>Copy</button>
<b>Report A Feral Cat Colony</b>
<div class='row'>
<div class='col-xs-6 col-sm-6 col-md-6' style='padding-left:7px; padding-right:7px;'>
<button class='btn btn-success' id='editrowbtn' style='margin-bottom:2px' onclick='editFunction()' disabled='true'>Edit</button>
<button class='btn btn-danger' id='deleterowbtn' style='margin-bottom:2px' onclick='deleteFunction()' class='confirmation' disabled='true'>Delete</button>
<button class='btn btn-info' id='formviewbtn' style='margin-bottom:2px' onclick='formviewFunction()' disabled='true'>Form View</button>
<button class='btn' id='copyrowbtn' style='background-color:gold; color:black; margin-bottom:2px' id='copyrow' onclick='copyFunction2()' disabled='true'>Copy</button>
</div>
<div class='col-xs-6 col-sm-6 col-md-6' style='text-align:right; padding-right:5px; padding-left:7px;'>
<input class='btn btn-default' type='button' value='Reset' name='RefreshTable' onclick=\"location.href='search.php?RefreshTable=Reset'\"/>
<input class='btn btn-success' type='button' id='exportButton' onclick=\"tableToExcel('reportTable', 'Reports')\" value='Export' />
</div>
</div>
<table id='reportTable' class='table table-striped table-bordered table-condensed'>
<thead>
Expand Down Expand Up @@ -1311,11 +1333,7 @@
*/
?>

<form id="resettable" method='get' action='search.php'>
<input class="btn btn-default" type="submit" value="Reset" name="RefreshTable"/>
<input class="btn btn-success" type="button" id="exportButton" onclick="tableToExcel('reportTable', 'Reports')" value="Export" />
<span id="ttlrecs"><b>Total Records: <?php echo $_SESSION['totalrecords']; ?></b></span>
</form>
<span id="ttlrecs"><b>Total Records: <?php echo $_SESSION['totalrecords']; ?></b></span>
</div> <!-- end div class='col-sm'12' -->
</div> <!-- end div class='row' -->
<hr>
Expand Down
Loading

0 comments on commit 3586651

Please sign in to comment.