Skip to content

Commit 5de27e1

Browse files
committed
Made page more accessible, to pass wave tests
1 parent e5e4221 commit 5de27e1

2 files changed

Lines changed: 101 additions & 26 deletions

File tree

HTML/index.php

Lines changed: 62 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
echo "Error: Unable to open database\n";
1111
} else {
1212

13-
$Sql='SELECT idpattern,patternpublisher,publishername,patternnum,patternsize,patternbust,patternwaist,patternhips,patternera,patterngender,patterndesc,patternnotes
13+
$Sql='SELECT idpattern,patternpublisher,publishername,patternnum,patternsize,patternbust,patternwaist,patternhips,patternera,patterngender,patterndesc,patternnotes,puborder
1414
FROM pattern,publisher
1515
WHERE patternpublisher=idpublisher ';
1616
if(isset($_GET['pubID'])>0){
@@ -41,73 +41,109 @@
4141
}
4242

4343
$Sql .= '
44-
ORDER BY patternpublisher,patternnum';
44+
ORDER BY puborder,patternnum';
4545
$rs = pg_query($Sql) or die('Query failed: ' .pg_last_error());
4646

4747
$rows_returned = pg_num_rows($rs);
4848
$title="Home";
4949
$bg='butterickL';
5050
include('includes/head.php');
51+
echo '<h1 style="h2">'.$title.'</h1>';
5152
echo '<h2>Results from the database: '.$rows_returned.' </h2>
5253
<h3><a href="'.$_SERVER['PHP_SELF'].'">Display all results</a> or <a href="protected/new.php?add=1">add a new pattern</a></h3>
53-
<div><span class="h2 text-success bg-secondary">To edit an entry, select its ID in the first column.</span></div>
54+
<div><span class="h2 text-danger">To edit an entry, select its ID in the first column.</span></div>
5455
<!--<form action="'.$_SERVER['PHP_SELF'].'" method="get">
5556
Search word/s in description: <input type="text" name="desc"><br />
5657
Search word/s in notes: <input type="text" name="notes"><br />
5758
<input type="submit" value="Submit">
5859
</form>-->
59-
<input id="pInput" type="text" placeholder="Search all cells">';
60+
<label for="pInput">Search all cells</label><input id="pInput" type="text" >';
6061
if($_GET['gender'] == 'Male' || $_GET['gender'] == 'Boy') {$chestName='Chest';}
6162
elseif($_GET['gender'] == 'Female') {$chestName='Bust';}
6263
else { $chestName='Bust/Chest'; }
6364
echo "<table class=\"table table-sm table-hover\" border width=\"100%\">\n";
64-
echo '<thead class="thead-light"><tr><th class="text-center">DB ID</th><th class="text-center">Publisher</th><th class="text-center">Number<br />(image)</th><th class="text-center">Size</th><th class="text-center">'.$chestName.'</th><th class="text-center">Waist</th><th class="text-center">Hips</th><th class="text-center">Era</th><th class="text-center">Gender</th><th class="text-center">Description</th><th class="text-center">Notes</th></tr></thead>
65+
echo '<thead class="thead-light"><tr><th class="text-center">DB ID</th>
66+
<th class="text-center">Publisher</th>
67+
<th class="text-center">Number<br />(image)</th>
68+
<th class="text-center">Size</th>
69+
<th class="text-center">'.$chestName.'</th>
70+
<th class="text-center">Waist</th>
71+
<th class="text-center">Hips</th>
72+
<th class="text-center">Era</th>
73+
<th class="text-center">Gender</th>
74+
<th class="text-center">Description</th>
75+
<th class="text-center">Notes</th>
76+
</tr>
77+
</thead>
6578
<tbody id="pTable">';
6679
while($row = pg_fetch_assoc($rs)){
6780
$pub=$row['patterngender'];
6881
$td='<td>';
6982
switch($pub){
7083
case "Male":
71-
$td='<td style="background-color:#ccccff;opacity:0.7">';
84+
$td='<td class="gender male">';
85+
break;
86+
case "Boy":
87+
$td='<td class="gender male">';
7288
break;
7389
case "Child":
74-
$td='<td style="background-color:#ffccff;opacity:0.7">';
90+
$td='<td class="gender child">';
7591
break;
7692
case "Baby":
77-
$td='<td style="background-color:#ffcccc;opacity:0.7">';
93+
$td='<td class="gender baby">';
7894
break;
7995
case "Female":
80-
$td='<td style="background-color:pink;opacity:0.7">';
96+
$td='<td class="gender female">';
8197
break;
8298
case "Girl":
83-
$td='<td style="background-color:#C7EF8A;opacity:0.7">';
99+
$td='<td class="gender girl">';
84100
break;
85101
case "Decor":
86-
$td='<td style="background-color:#FFFF66;opacity:0.7">';
102+
$td='<td class="gender decor">';
87103
break;
88104
case "Doll":
89-
$td='<td style="background-color:#FF66FF;opacity:0.7">';
105+
$td='<td class="gender doll">';
106+
break;
107+
case "Toddler":
108+
$td='<td class="gender toddler">';
90109
break;
91110
case "Either":
92-
$td='<td style="background-color:#ffffcc;opacity:0.7">';
111+
$td='<td class="gender either">';
93112
break;
94113
}
95-
echo "<tr>".$td."<a href='protected/edit.php?ID=" . $row['idpattern'] . "'>".$row['idpattern'].'</a></td>';
96-
echo $td."<a href='".$_SERVER['PHP_SELF']."?pubID=" . $row['patternpublisher'] ."'>" . $row['publishername'] . '</a></td>';
97-
$filename = 'pattern-pics/'.$row['idpattern'].'.jpg';
98-
if (!file_exists($filename)) echo $td."<a href=\"protected/file_insert.php?ID=".$row['idpattern']."\">upload</a>".$row['patternnum'].'</td>' ;
99-
else echo $td."<a href='display_image.php?id=" . $row['idpattern'] ."'>" . $row['patternnum'] .'</a></td>';
100-
echo $td."<a href='".$_SERVER['PHP_SELF']."?size=" . $row['patternsize'] ."'>" . $row['patternsize'] . '</td>';
114+
echo "<tr>";
115+
echo $td."<a href='protected/edit.php?ID=" . $row['idpattern'] . "'>".$row['idpattern'].'</a></td>'; # ID column
116+
echo $td."<a href='".$_SERVER['PHP_SELF']."?pubID=" . $row['patternpublisher'] ."'>" . $row['publishername'] . '</a></td>';# publisher
117+
$filename = 'pattern-pics/'.$row['idpattern'].'.jpg';# pattern image is <<its ID>>.jpg
118+
if (!file_exists($filename)) echo $td."<a href=\"protected/file_insert.php?ID=".$row['idpattern']."\">upload</a>".$row['patternnum'].'</td>' ;# if it's not there, offer to upload
119+
else echo $td."<a href='display_image.php?id=" . $row['idpattern'] ."'>" . $row['patternnum'] .'</a></td>';# otherwise, display and link
120+
echo $td; # pattern size
121+
if($row['patternsize']) echo "<a href='".$_SERVER['PHP_SELF']."?size=" . $row['patternsize'] ."'>" . $row['patternsize'];
122+
echo ' </td>';
101123
$bust = str_replace("NULL","",$row['patternbust']);
102-
echo $td."<a href='".$_SERVER['PHP_SELF']."?bust=" . $bust ."'>" . $bust . '</a></td>';
124+
echo $td; # bust
125+
if($bust) echo "<a href='".$_SERVER['PHP_SELF']."?bust=" . $bust ."'>" . $bust . '</a>';
126+
echo ' </td>';
103127
$waist = str_replace("NULL","",$row['patternwaist']);
104-
echo $td."<a href='".$_SERVER['PHP_SELF']."?waist=" . $waist ."'>" . $waist . '</a></td>';
128+
echo $td; # waist
129+
if($waist) echo "<a href='".$_SERVER['PHP_SELF']."?waist=" . $waist ."'>" . $waist . '</a>';
130+
echo ' </td>';
105131
$hips = str_replace("NULL","",$row['patternhips']);
106-
echo $td."<a href='".$_SERVER['PHP_SELF']."?hips=" . $hips ."'>" . $hips . '</a></td>';
107-
echo $td."<a href='".$_SERVER['PHP_SELF']."?era=" . $row['patternera'] ."'>" . $row['patternera'] . '</td>';
108-
echo $td."<a href='".$_SERVER['PHP_SELF']."?gender=" . $row['patterngender'] ."'>" . $row['patterngender'] . '</a></td>';
109-
echo $td."" . $row['patterndesc'] . '</td>';
110-
echo $td."" . $row['patternnotes'] . "</td></tr>\n";
132+
echo $td; # hips
133+
if($hips) echo "<a href='".$_SERVER['PHP_SELF']."?hips=" . $hips ."'>" . $hips . '</a>';
134+
echo ' </td>';
135+
echo $td; # era or year
136+
if($row['patternera']) echo "<a href='".$_SERVER['PHP_SELF']."?era=" . $row['patternera'] ."'>" . $row['patternera'] ;
137+
echo ' </td>';
138+
echo $td; # gender
139+
if($row['patterngender']) echo "<a href='".$_SERVER['PHP_SELF']."?gender=" . $row['patterngender'] ."'>" . $row['patterngender'] . '</a>';
140+
echo ' </td>';
141+
echo $td; # description
142+
if($row['patterndesc']) echo $row['patterndesc'] ;
143+
echo ' </td>';
144+
echo $td; # notes
145+
if($row['patternnotes']) $row['patternnotes'];
146+
echo " </td></tr>\n";
111147
}
112148
echo "</tbody>\n</table>";
113149
echo '<script src="/js/jquery-3.3.1.min.js"></script>

HTML/styles/basic.css

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,42 @@ table {
2929
content: " | ";
3030
padding: 0 1rem;
3131
}
32+
.gender{
33+
opacity:0.7;
34+
}
35+
36+
.male {
37+
background-color: #ccccff;
38+
}
39+
40+
.female {
41+
background-color: pink;
42+
}
43+
44+
.child {
45+
background-color: #ffccff;
46+
}
47+
48+
.baby {
49+
background-color: #ffcccc;
50+
}
51+
52+
.girl {
53+
background-color: #c7ef8a;
54+
}
55+
56+
.decor {
57+
background-color: #ffff66;
58+
}
59+
60+
.toddler {
61+
background-color: #ff6600;
62+
}
63+
64+
.doll {
65+
background-color: #ff66ff;
66+
}
67+
68+
.either {
69+
background-color: #ffffcc;
70+
}

0 commit comments

Comments
 (0)