Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
170 changes: 95 additions & 75 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</head>
<body>

<?php // Version 2: May 2017
<?php // Version 2: November 2017

#functions

Expand Down Expand Up @@ -118,69 +118,15 @@
}

if ($path_info['call_parts'][0] == "gallery") {
$DIR = "bm_mcm1890";
if(count($path_info['call_parts']) > 1 ){ #&&$path_info['call_parts'][1]
$DIR = ($path_info['call_parts'][1]);
}
else{ //This can be a little more graceful.
$DIR = "bm_mcm1890";
}
// TODO: Maybe make a reference array for the DIR or pull from the query if
// available so that the $id can be passed around instead.
$title = $DIR;
$dirArray = [
"bm_mcm1890",
"bm_mcm2062",
"bm_mcm2064",
"bm_mcm2212",
"bm_mcm4973_back",
"bm_mcm4973_front",
"bm_mcm5222",
"bm_mcm5241",
"bm_mcm5330_back",
"bm_mcm5330_front",
"mol_2016_33",
"mol_84_434",
"sbh_1019_back",
"sbh_1019_front",
"sbh_1090_s2_back",
"sbh_1090_s2_front",
"sbh_1094",
"sbh_1143_back",
"sbh_1143_front",
"sbh_1263",
"sbh_1290",
"sbh_1337",
"sbh_1550",
"sbh_1_s1",
"sbh_1_s2",
"sbh_881_back",
"sbh_881_front",
"tna_883a",
"tna_883b",
"tna_e26_1a_58_back",
"tna_e26_1a_58_front",
"tna_e40_11002_s1_back",
"tna_e40_11002_s1_front",
"tna_e40_11002_s2",
"tna_e40_6839",
"tna_e40_6884_back",
"tna_e40_6884_front",
"tna_e42_146_s1",
"tna_e42_146_s2",
"tna_e42_543_back",
"tna_e42_543_front",
"tna_sc13_h88_back",
"tna_sc13_h88_front",
"tna_sc13_i34_back",
"tna_sc13_i34_front",
"tna_sc13_i38_back",
"tna_sc13_i38_front",
"tna_sc13_k36_back",
"tna_sc13_k36_front",
"tna_sc13_q1_back",
"tna_sc13_q1_front"
];

if (count($path_info['call_parts']) > 1) {
$id = ($path_info['call_parts'][1]);
}
else {
//set a default RTI
$id = 11887234;
}
$title = $id;
}

//Dataset statistics
Expand Down Expand Up @@ -209,8 +155,49 @@

switch($path_info['call_parts'][0]) {
case 'gallery' :

#1:identify the RTI that needs to be displayed
$queryrti = "SELECT * FROM gallery_rti WHERE id_representation = $id";
$queryrtiresult = mysqli_query($link, $queryrti);
$row = mysqli_fetch_assoc($queryrtiresult);
#establish the directory where the RTI is located
$val1_directory = $row['representation_folder'];

#info to display about RTI
$val2_image_state = $row['image_state'];
$val3_itemID = $row['id_item'];
$val4_material = $row['material'];
$val5_credit1 = $row['name_first'];
$val6_credit2 = $row['name_last'];
$val7_dim_vert = $row['face_vertical'];
$val8_dim_hori = $row['face_horizontal'];
$val9_support = $row['id_support'];
$val10_repository1 = $row['repository_fulltitle'];
$val11_repository2 = $row['reference_full'];
$val12_id_digisig = $row['fk_digisig'];

#test whether there is an RTI of another side of the object. If TRUE then we need button to reload RTI gallery with the target set to "gallery/" . $val13_alternaterti
$queryrti_dblsided = "SELECT id_representation FROM gallery_rti WHERE id_support = $val9_support and fk_digisig <> $val12_id_digisig";
$queryrti_dblsided_result = mysqli_query($link, $queryrti_dblsided);
$row = mysqli_fetch_assoc($queryrti_dblsided_result);
$val13_alternaterti = $row['id_representation'];
if(isset($val_alternaterti)) {
$flip = TRUE;
}
else {
$flip = FALSE;
}

#test whether this is a positive or negative object. If TRUE then offer 'flip' button (which should perhaps be renamed to invert
if ($val2_image_state == 'negative') {
$invert = TRUE;
}
else {
$invert = FALSE;
}

echo '<div class="pageWrap">

<div style="display: flex; align-items: center; justify-content: center;">
<div id=toolbar style="margin:.5rem;float:left;width:2rem;height:400px;">
<button class="toolbarButton" id="zoomIn" touch-action="none">
Expand Down Expand Up @@ -241,7 +228,7 @@ function launchRTI() {
let dindex = params.indexOf("directory=") + 10;
let windex = params.indexOf("width=") + 6;
let hindex = params.indexOf("height=") + 7;
let dir = "'.$DIR.'";
let dir = "'.$val1_directory.'";
let w = params.substring(windex).split("&")[0] || 900;
let h = params.substring(hindex).split("&")[0] || 600;
$("#canvas-width").val(w).change();
Expand Down Expand Up @@ -273,13 +260,47 @@ function toggleFlip(el) {
}
</script>
<div style="display:flex;flex-wrap:wrap;">';
foreach($dirArray as $dir){
echo '<div class="cardInfo"><a href="/digisig/gallery/'.$dir.'">'.$dir.'</a></div>';
}
echo '</div>
</div>';
break;


echo "<div>";


#the metadata needs to be displayed alongside the RTI in some fashion
echo $val3_itemID . $val10_repository1 . $val11_repository2 . $val4_material . $val7_dim_vert . $val8_dim_hori . $val5_credit1 . $val6_credit2;


#Populate the RTI gallery
$queryrti2 = "SELECT * from gallery_rti";
$queryrtiresult2 = mysqli_query($link, $queryrti2);
$row = mysqli_fetch_assoc($queryrtiresult2);

while ($row = mysqli_fetch_array($queryrtiresult2)) {
$val1_filename = $row['representation_thumbnail'];
$val2_thumb = $row['thumb'];
//test to see if the connection string indicates that it is in the local image store
if ($val2_thumb == "local" || $val2_thumb==null) {
$val3_connection = $small;
}
else ($val3_connection = $val2_thumb);
$val4_id_rti = $row['id_representation'];

echo '<br><div class="imageRTI"><a href="/digisig/gallery/'. $val4_id_rti . '"><img src="' . $val3_connection . $val1_filename . '"></div>';

}


/*
foreach($dirArray as $dir){
echo '<div class="cardInfo"><a href="/digisig/gallery/'.$dir.'">'.$dir.'</a></div>';
}
*/


echo "<div></div>"; //close page wrap
break;




case 'search' :
echo '<div class="pageWrap">';
//test to see if the search string has more than 1 character
Expand Down Expand Up @@ -964,8 +985,7 @@ function toggleFlip(el) {
echo "</div>"; //close page wrap
break;




default :
echo '<div class="pageWrap homeWrap">';
include "include/imageGallery.php";
Expand Down