diff --git a/sacferals/Database_creation_tables.txt b/sacferals/Database_creation_tables.txt index f469163..66f371a 100644 --- a/sacferals/Database_creation_tables.txt +++ b/sacferals/Database_creation_tables.txt @@ -125,6 +125,19 @@ INSERT INTO CannedQueries VALUES ('','status open', "SELECT * FROM ReportColonyForm where Status='open'"); +CREATE TABLE CannedQueriesVolunteers ( + ID int NOT NULL AUTO_INCREMENT, + QueryName varchar(45) NOT NULL, + QueryString varchar(200) NOT NULL, + PRIMARY KEY (ID) +); + +INSERT INTO CannedQueriesVolunteers values + ('', 'Default', "SELECT * FROM VolunteerForm"); +INSERT INTO CannedQueriesVolunteers VALUES + ('','status inactive', "SELECT * FROM VolunteerForm where VolunteerStatus='Inactive'"); + + CREATE TABLE SundaySSPCA ( RecordNumber int NOT NULL AUTO_INCREMENT, primary key(RecordNumber), diff --git a/sacferals/adminprofile.php b/sacferals/adminprofile.php index a2474c7..5414845 100644 --- a/sacferals/adminprofile.php +++ b/sacferals/adminprofile.php @@ -37,13 +37,13 @@ - + - + diff --git a/sacferals/createaccount.php b/sacferals/createaccount.php index b26dffe..b12c22f 100755 --- a/sacferals/createaccount.php +++ b/sacferals/createaccount.php @@ -4,6 +4,26 @@ $link = connectdb($host, $user, $pass, $db); ?> + + + + + Create Account + + + + + + + + + + + + + + + +
+ ×' + .$email.' hasn\'t been registered yet. You must first fill out a volunteer form.
'; } } else { - print "error: That account name or email already exists"; + //print "error: That account name or email already exists"; + echo '
+
+ ×' + .$username.' and\or '.$email.' already exist
'; } } else @@ -61,33 +89,6 @@ ?> - - - - - Create Account - - - - - - - - - - - - - - - - -
@@ -117,7 +118,7 @@ - @@ -141,16 +142,17 @@ $('#password').attr('style','border: 1px solid #d66'); $('#repass').attr('style','border: 1px solid #d66'); $('#passerrmsg').html("passwords do not match"); - $('#updatebtn').prop('disabled',true); + $('#reg').attr('disabled',true); } else if(pwd=='' || repwd==''){ $('#repass').attr('style','border: 1px solid #d66'); + $('#password').attr('style','border: 1px solid #d66'); $('#passerrmsg').html("passwords cannot be emtpy"); - $('#updatebtn').prop('disabled',true); + $('#reg').attr('disabled',true); } else { $('#password').attr('style',''); $('#repass').attr('style',''); $('#passerrmsg').html(""); - $('#updatebtn').prop('disabled',false); + $('#reg').attr('disabled',false); } } }); diff --git a/sacferals/css/search.css b/sacferals/css/search.css index aa3a5ae..b41711e 100755 --- a/sacferals/css/search.css +++ b/sacferals/css/search.css @@ -88,16 +88,17 @@ table { tbody { overflow-y: auto; } -table textarea{ +.row textarea{ + max-width: 100%; overflow-x: hidden; } th { text-align: center; vertical-align: middle !important; } -.selected td{ +tr[selected="selected"]{ color: white; - background-color: darkgray;/*#337ab7 !important; */ + background-color: darkgray !important;/*#337ab7 !important; */ } /*#container { white-space: nowrap; diff --git a/sacferals/userprofile.css b/sacferals/css/userprofile.css old mode 100755 new mode 100644 similarity index 76% rename from sacferals/userprofile.css rename to sacferals/css/userprofile.css index a2c6716..d9cad01 --- a/sacferals/userprofile.css +++ b/sacferals/css/userprofile.css @@ -22,7 +22,10 @@ h1, html, label{ height:100% } .main_login .button{ - background-color:#b2d947 + background-color:#BE1D2C; +} +button[disabled="disabled"]{ + background-color: gray !important; } .main_login .main{ max-width:1200px; @@ -63,9 +66,16 @@ a{color:rgba(0,0,0,.54)} margin-right:2.3%; width:31.7% } -.main_container:last-child{ +.main_container:last-child, #alert-box:last-child{ margin-right:0 } +#alert-box{ + margin-left:30%; + float:left; + display:block; + margin-right:2.3%; + width:40% +} @media screen and (max-width:1025px){ .main_container{ margin-left:25.5%; @@ -74,43 +84,64 @@ a{color:rgba(0,0,0,.54)} margin-right:2.3%; width:48.8% } - .main_container:last-child{ + .main_container:last-child, #alert-box:last-child{ margin-right:0 } + #alert-box{ + margin-left:20%; + float:left; + display:block; + margin-right:2.3%; + width:60% + } } @media screen and (max-width:625px){ - .main_container{ + .main_container, #alert-box{ margin-left:17%; float:left; display:block; margin-right:2.3%; width:65.8% } - .main_container:last-child{ + .main_container:last-child, #alert-box:last-child{ margin-right:0 } + #alert-box{ + margin-left:10%; + float:left; + display:block; + margin-right:2.3%; + width:80% + } } @media screen and (max-width:550px){ - .main_container{ + .main_container, #alert-box{ margin-left:8.5%; float:left; display:block; margin-right:2.3%; width:82.9% } - .main_container:last-child{ + .main_container:last-child, #alert-box:last-child{ margin-right:0 } + #alert-box{ + margin-left:0; + float:left; + display:block; + margin-right:2.3%; + width:100% + } } @media screen and (max-width:475px){ - .main_container{ + .main_container, #alert-box{ margin-left:0; float:left; display:block; margin-right:2.3%; width:100% } - .main_container:last-child{ + .main_container:last-child, #alert-box:last-child{ margin-right:0 } } @@ -250,4 +281,31 @@ img { } #tooltip:hover .tooltiptext { visibility: visible; +} + +.fieldset-auto-width +{ + display: inline-block; +} + +/*error msg*/ +.alert { + padding: 20px; + background-color: #f44336; /* Red */ + color: white; + margin-bottom: 15px; + text-align: center; +} +.closebtn { + margin-left: 15px; + color: white; + font-weight: bold; + float: right; + font-size: 22px; + line-height: 20px; + cursor: pointer; + transition: 0.3s; +} +.closebtn:hover { + color: black; } \ No newline at end of file diff --git a/sacferals/js/searchScript.js b/sacferals/js/searchScript.js index b3e2a77..ffe0867 100755 --- a/sacferals/js/searchScript.js +++ b/sacferals/js/searchScript.js @@ -25,7 +25,7 @@ $(document).ready(function () }); }); -function copyFunction(el){ +function copyFunction(el){ //copy single row //combine all cells into singe string var str=el.cells[1].innerHTML; for(var i=2; i<(el.cells.length)-2; i++){ @@ -40,6 +40,35 @@ function copyFunction(el){ } } + copyToClipboard(str); +} +function copyFunction2(){ //copy multiple rows, each separated by a semicolon + var str=""; + var table = document.getElementsByTagName("tbody"); + for(var j=0, row; row=table[0].rows[j]; j++){ + if($(row).attr("selected")=="selected"){ + str=str+row.cells[1].innerHTML; + for(var i=2; i<(row.cells.length)-2; i++){ + col = row.cells[i]; + if($(col).find("textarea").length){ + if($(col).find("textarea").val()!='') + str=str+" "+$(col).find("textarea").val(); + } + else { + if(col.innerHTML!='') + str=str+" "+col.innerHTML; + } + } + str=str+"; "; + } + } + + if(str=="") alert("Nothing selected"); + else{ + copyToClipboard(str); + } +} +function copyToClipboard(str){ //For IE if(window.clipboardData){ window.clipboardData.setData("Text", str); @@ -72,4 +101,36 @@ function copyFunction(el){ tmpElem.remove(); } } +} + +function editFunction(){ + var table = document.getElementsByTagName("tbody"); + for(var j=0, row; row=table[0].rows[j]; j++){ + if($(row).attr("selected")=="selected"){ + window.location.replace("search.php?editrow=yes&RecordNumber="+$(row).attr('id')); + break; + } + } +} +function deleteFunction(){ + var result=confirm("Are you sure?"); + if(result){ + var str="search.php?del=yes"; + var table = document.getElementsByTagName("tbody"); + for(var j=0, row; row=table[0].rows[j]; j++){ + if($(row).attr("selected")=="selected"){ + str=str+"&RecordNumber[]="+$(row).attr('id'); + } + } + window.location.replace(str); + } +} +function formviewFunction(){ + var table = document.getElementsByTagName("tbody"); + for(var j=0, row; row=table[0].rows[j]; j++){ + if($(row).attr("selected")=="selected"){ + window.open("form_view.php?&RecordNumber="+$(row).attr('id')); + break; + } + } } \ No newline at end of file diff --git a/sacferals/search.php b/sacferals/search.php index 73c0a06..9fab6fb 100755 --- a/sacferals/search.php +++ b/sacferals/search.php @@ -77,20 +77,20 @@

Note: Hold down ctrl or shift to select multiple columns

- + + - - + - + @@ -183,9 +183,9 @@ - + - + @@ -231,7 +231,7 @@
@@ -254,7 +254,7 @@
@@ -298,19 +298,19 @@ else if($selectedOption=="Comments1") $printvalue = "Comments"; else if($selectedOption=="DateAndTime") $printvalue = "Date/Time"; else if($selectedOption=="FeedIfReturned") $printvalue = "Will Feed"; - else if($selectedOption=="ColonyAddress") $printvalue = "Colony Address"; + else if($selectedOption=="ColonyAddress") $printvalue = "Address"; else if($selectedOption=="ZipCode") $printvalue = "Zip"; - else if($selectedOption=="AnyoneAttempted") $printvalue = "Anyone Attempted"; + else if($selectedOption=="AnyoneAttempted") $printvalue = "Trapping/ Eartip"; else if($selectedOption=="ApproximateCats") $printvalue = "# Cats"; - else if($selectedOption=="ColonyCareGiver") $printvalue = "Caregiver/ Feeder"; + else if($selectedOption=="ColonyCareGiver") $printvalue = "Caregiver"; else if($selectedOption=="FeederDescription" || $selectedOption=="InjuryDescription") $printvalue = "Description"; - else if($selectedOption=="Injured") $printvalue = "Injured/ Pregnant"; - else if($selectedOption=="FriendlyPet") $printvalue = "Friendly/ Pet"; + else if($selectedOption=="Injured") $printvalue = "Sick"; + else if($selectedOption=="FriendlyPet") $printvalue = "Friendly"; else if($selectedOption=="ColonySetting") $printvalue = "Setting"; - else if($selectedOption=="ReqAssistance") $printvalue = "Require Assistance"; + else if($selectedOption=="ReqAssistance") $printvalue = "Assist"; else if($selectedOption=="VolunteerResponding") $printvalue = "Responder"; - else if($selectedOption=="ResponseDate") $printvalue = "Response Date"; - else if($selectedOption=="CustNeedOutcome") $printvalue = "Outcome Needed"; + else if($selectedOption=="ResponseDate") $printvalue = "Date"; + else if($selectedOption=="CustNeedOutcome") $printvalue = "Needs"; else $printvalue = $selectedOption; $thString.="".$printvalue.""; } @@ -454,8 +454,9 @@ if(isset($_GET['runwrittenqry'])){ unset($_SESSION['querysearch']); //refresh variable $wrttnqry = $_GET['manquery']; + $cols = explode(" ",$wrttnqry); $wrttnqryres = mysqli_query($link, $wrttnqry); - if(mysqli_num_rows($wrttnqryres)==0) + if(mysqli_num_rows($wrttnqryres)==0 || (!(strcasecmp($cols[0],'select')) && $cols[3]!='ReportColonyForm')) echo "

EMPTY QUERY

"; else $_SESSION['querysearch'] = $wrttnqry; } @@ -556,33 +557,33 @@ { print " ID - Comments + Date/Time Responder + Comments Status - Date/Time Will Feed FullName Email Phone1 Phone2 - Colony Address + Address City County Zip - Anyone Attempted + Trapping/ Eartip # Cats Kittens - Caregiver/ Feeder + Caregiver Description - Injured/ Pregnant + Sick Description - Friendly/ Pet + Friendly Setting Additional Comments - Require Assistance + Assist Responder - Response Date - Outcome Needed + Date + Needs Beat_Team_Leader Outcome Completion_Date @@ -681,8 +682,9 @@ print " $RecordNumber - + $DateAndTime + "//
Current Status: ' $Status ' ."
" //
*/"
- $DateAndTime @@ -734,7 +735,7 @@ print " Edit - Delete + Delete Form_View Copy @@ -757,10 +758,10 @@ { print " $RecordNumber - $Comments1 + $DateAndTime $Responder + $Comments1 $Status - $DateAndTime $FeedIfReturned $FullName $Email @@ -936,10 +937,12 @@ if(isset($_GET['del'])) { $RecordNumber = $_GET['RecordNumber']; - $query = "delete from ReportColonyForm where RecordNumber='$RecordNumber'"; - mysqli_query($link, $query); + foreach ($RecordNumber as $rec){ + $query = "delete from ReportColonyForm where RecordNumber='$rec'"; + mysqli_query($link, $query); + } //print $query; - print "

Record Deleted

"; + print "

Record(s) Deleted

"; //showReportColony(); } @@ -975,6 +978,10 @@
Report A Feral Cat Colony

+ + + + @@ -992,33 +999,33 @@ print " - + + - - + - + - + - + - + - + - - + + @@ -1043,10 +1050,10 @@ // then printed in one table row $myArray[0]=$RecordNumber; - $myArray[1]=$Comments1; + $myArray[1]=$DateAndTime; $myArray[2]=$Responder; - $myArray[3]=$Status; - $myArray[4]=$DateAndTime; + $myArray[3]=$Comments1; + $myArray[4]=$Status; $myArray[5]=$FeedIfReturned; $myArray[6]=$FullName; $myArray[7]=$Email; @@ -1077,10 +1084,10 @@ $myArray[32]=$Lng; $myArray1[0]="RecordNumber"; - $myArray1[1]="Comments1"; + $myArray1[1]="DateAndTime"; $myArray1[2]="Responder"; - $myArray1[3]="Status"; - $myArray1[4]="DateAndTime"; + $myArray1[3]="Comments1"; + $myArray1[4]="Status"; $myArray1[5]="FeedIfReturned"; $myArray1[6]="FullName"; $myArray1[7]="Email"; @@ -1111,9 +1118,9 @@ $myArray1[32]="Lng"; print " - + @@ -1161,10 +1168,10 @@ print " - + + - @@ -1262,5 +1269,30 @@ ?> + + + diff --git a/sacferals/updateprofile.php b/sacferals/updateprofile.php index 1132266..bb3395c 100755 --- a/sacferals/updateprofile.php +++ b/sacferals/updateprofile.php @@ -232,7 +232,7 @@ function formatPhone(phoneId) { ?>

Update Profile

-
+
@@ -355,7 +355,7 @@ function formatPhone(phoneId) { - + + + + + + + + diff --git a/sacferals/volunteerlist.php b/sacferals/volunteerlist.php index 1115e1b..12c5969 100755 --- a/sacferals/volunteerlist.php +++ b/sacferals/volunteerlist.php @@ -26,7 +26,7 @@ $Ausername = $_SESSION['Ausername']; $level = $_SESSION['level']; - if($level == 1) + if($level == 1 || $level==2) { ?> @@ -37,20 +37,20 @@ - + - + -
+
Logged in as

@@ -71,11 +71,12 @@

+
-
Note: Hold down ctrl or shift to select multiple columns
- @@ -118,79 +119,160 @@
- + -
+
-
- -
- Custom Query -
-
-
- +
+ + +
+ +
+
+
+
+
+ +
+ +
+
+ + + +
+ +
+
+
+ +
+
+ - + - - + + +
+
+
+
-
-
- -
+ + + + + 0 && ( count($_GET['editrow']) != 0 || count($_POST['recordEdit']) != 0 )) + if(count($_SESSION['volunteerselectedColumns']) > 0 && ( count($_GET['editrow']) != 0 || count($_POST['recordEdit']) != 0 )) { - $_GET['select2'] = $_SESSION['selectedColumns']; + $_GET['select2'] = $_SESSION['volunteerselectedColumns']; } if(count($_GET['select2']) >= 0) { - $_SESSION['selectedColumns'] = $_GET['select2']; + $_SESSION['volunteerselectedColumns'] = $_GET['select2']; } foreach ($_GET['select2'] as $selectedOption) @@ -238,32 +320,9 @@ } - /* - print"
IDCommentsDate/Time ResponderComments StatusDate/Time Will Feed FullName Email Phone1 Phone2Colony AddressAddress City County ZipAnyone AttemptedTrapping/ Eartip # Cats KittensCaregiver/ FeederCaregiver DescriptionInjured/ PregnantSick DescriptionFriendly/ PetFriendly Setting Additional CommentsRequire AssistanceAssist ResponderResponse DateOutcome NeededDateNeeds Beat_Team_Leader Outcome Completion_Date
Edit - Delete + Delete Form_View Copy $RecordNumber$DateAndTime $Responder $Status$DateAndTime $FeedIfReturned $FullName $Email
"; - print $thString; - print""; - - print""; - print $tdString; - print"
"; - - print""; - print $tdEditString; - print""; - */ - - /* this doesn't work with edit yet - print "Select which tables you would like to view:
- ReportColonyForm - FeralInterventionForm - VolunteerForm - SundaySSPCA - EmergencyC4CCVouchers -
"; */ - //custom query builder search if(isset($_GET['submitquery'])){ - unset($_SESSION['querysearch']); //refresh variable + unset($_SESSION['volunteerquerysearch']); //refresh variable //mysql: contains == like // column like '%value%' $value = $_GET['queryvalue'][0]; @@ -280,8 +339,8 @@ $value="%".$value."%"; } - $search = $search." ".$andor." (".$column." ".$condition." '".$value."')"; - //$search = "select * from ReportColonyForm where ".$column[0].$condition[0]."'".$value."'"; + $search = $search." ".$andor." ".$column." ".$condition." '".$value."'"; + //$search = "select * from VolunteerForm where ".$column[0].$condition[0]."'".$value."'"; } $andor = $_GET['andor'][$i]; $i++; @@ -289,16 +348,112 @@ $r = mysqli_query($link, $search); if(mysqli_num_rows($r)==0) echo "

EMPTY QUERY

"; - else $_SESSION['querysearch'] = $search; + else $_SESSION['volunteerquerysearch'] = $search; + } + } + //canned query search + if(isset($_GET['submitcannedquery'])){ + unset($_SESSION['volunteerquerysearch']); //refresh variable + $cannedqueryname = $_GET['cannedquery'][0]; + + $sea = "select * from CannedQueriesVolunteers where QueryName='".$cannedqueryname."'"; + $res = mysqli_query($link, $sea); + if(mysqli_num_rows($res)==0) + echo "

EMPTY QUERY

"; + else { + $rw = mysqli_fetch_row($res); + $_SESSION['volunteerquerysearch'] = $rw[2]; + } + } + //canned query check for existance & then display modal + if(isset($_GET['savecurrentquery'])){ + if(isset($_SESSION['volunteerquerysearch'])){ + $sea = 'select * from CannedQueriesVolunteers where QueryString="'.$_SESSION['volunteerquerysearch'].'"'; + $res = mysqli_query($link, $sea); + if(mysqli_num_rows($res)==0){ + echo ""; + } else { + $rw = mysqli_fetch_row($res); + echo "

This Canned Query already exists under the name \"".$rw[1]."\"

"; + } + } else { + echo "

No Query to save

"; + } + } + //canned query save + if(isset($_GET['addcurrentquery'])){ + $qryname = $_GET['queryname']; + + //still check if exists so doesn't keep adding to db + $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']."\")"; + mysqli_query($link, $savecannedqry); + } + } + //canned query delete + if(isset($_GET['deletecannedquery'])){ + $cannedqueryname = $_GET['cannedquery'][0]; + + $sea = "delete from CannedQueriesVolunteers where QueryName='".$cannedqueryname."'"; + $res = mysqli_query($link, $sea); + if(mysqli_num_rows($res)==0){ + print "

Query \"".$cannedqueryname."\" was removed

"; + } else print "error"; + } + //manual query run + if(isset($_GET['runwrittenqry'])){ + unset($_SESSION['volunteerquerysearch']); //refresh variable + $wrttnqry = $_GET['manquery']; + $cols = explode(" ",$wrttnqry); + $wrttnqryres = mysqli_query($link, $wrttnqry); + if(mysqli_num_rows($wrttnqryres)==0 || (!(strcasecmp($cols[0],'select')) && $cols[3]!='VolunteerForm')) + echo "

EMPTY QUERY

"; + else $_SESSION['volunteerquerysearch'] = $wrttnqry; + } + //manual query check for existance & then display modal to get name + if(isset($_GET['savewrittenqry'])){ + //dont do anything if empty + if($newq != ''){ + $wrttnqry = 'select * from CannedQueriesVolunteers where QueryString="'.$_GET['manquery'].'"'; + $wrttnqryres = mysqli_query($link, $wrttnqry); + if(mysqli_num_rows($wrttnqryres)==0){ + echo ""; + } else { + $rw = mysqli_fetch_row($wrttnqryres); + echo "

This Canned Query already exists under the name \"".$rw[1]."\"

"; + } + } else { + echo "

No Query to save

"; + } + } + //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'].'"'; + $wrttnqryres = mysqli_query($link, $wrttnqry); + if(mysqli_num_rows($wrttnqryres)==0){ + $savewrttnqry = "insert into CannedQueries values('', '".$qryname."', \"".$wrttnqry."\")"; + mysqli_query($link, $savewrttnqry); } } - if(isset($_GET['Reset'])) - { - unset($_SESSION['selectedColumns']); + if(isset($_GET['Reset'])){ + unset($_SESSION['volunteerselectedColumns']); } if(isset($_GET['RefreshTable'])){ //nullify the query - unset($_SESSION['querysearch']); + unset($_SESSION['volunteerquerysearch']); } /////////////////////////////////////////////////////////////////////////////////////////// @@ -323,9 +478,9 @@ { $sort = "RecordNumber"; } - if(isset($_SESSION['querysearch'])){ + if(isset($_SESSION['volunteerquerysearch'])){ //query search - $s = mysqli_query($link, $_SESSION['querysearch']); + $s = mysqli_query($link, $_SESSION['volunteerquerysearch']); if (mysqli_num_rows($s)!=0) $result = $s; } else{ @@ -336,10 +491,10 @@ ////////////////////////////////////////////////////////////////////////////////////// // print table (happens first before input) - if(isset($_SESSION['querysearch'])) $q="QUERY: "; + if(isset($_SESSION['volunteerquerysearch'])) $q="QUERY: "; // first print row of links/headers that sort print " -
".$q.$_SESSION['querysearch']."
+
".$q.$_SESSION['volunteerquerysearch']."
@@ -748,9 +903,9 @@ $sort = "RecordNumber"; } - if(isset($_SESSION['querysearch'])){ + if(isset($_SESSION['volunteerquerysearch'])){ //query search - $s = mysqli_query($link, $_SESSION['querysearch']); + $s = mysqli_query($link, $_SESSION['volunteerquerysearch']); if (mysqli_num_rows($s)!=0) $result = $s; } @@ -759,7 +914,7 @@ $query = "select * from VolunteerForm order by $sort"; $result = mysqli_query($link, $query); } - $_SESSION['totalrecords']=mysqli_num_rows($result); + $_SESSION['volunteertotalrecords']=mysqli_num_rows($result); if(!isset($_GET['editrow'])) { @@ -767,10 +922,10 @@ // print table (happens first before input) - if(isset($_SESSION['querysearch'])) $q="QUERY: "; else $q=""; + if(isset($_SESSION['volunteerquerysearch'])) $q="QUERY: "; else $q=""; // first print row of links/headers that sort print " -
".$q.$_SESSION['querysearch']."
+
".$q.$_SESSION['volunteerquerysearch']."
Volunteers

@@ -1038,7 +1193,7 @@
"; */ } - else if($level == 2) + else if($level == 0) { print "you aren't supposed to be here.. STOP SNEAKING AROUND"; } @@ -1046,12 +1201,13 @@ ?> - + - Total Records: + Total Records:
+