";
$params2TEPgI["fontBoldEnd"] = "";
}
#FontItalics.
$params2TEPgI["fontItalics"] = "";
$params2TEPgI["fontItalicsEnd"] = "";
if ("false" == "true") {
$params2TEPgI["fontItalics"] = "
";
$params2TEPgI["fontItalicsEnd"] = "";
}
#FontUnderline
$params2TEPgI["fontUnder"] = "";
$params2TEPgI["fontUnderEnd"] = "";
if ("false" == "true") {
$params2TEPgI["fontUnder"] = "
";
$params2TEPgI["fontUnderEnd"] = "";
}
#FontDescBold.
$params2TEPgI["fontDesc"] = "";
$params2TEPgI["fontDescEnd"] = "";
if ("false" == "true") {
$params2TEPgI["fontDesc"] = "";
$params2TEPgI["fontDescEnd"] = "";
}
#FontDescItalics.
$params2TEPgI["fontDescItalics"] = "";
$params2TEPgI["fontDescItalicsEnd"] = "";
if ("false" == "true") {
$params2TEPgI["fontDescItalics"] = "
";
$params2TEPgI["fontDescItalicsEnd"] = "";
}
#FontDescUnderline
$params2TEPgI["fontDescUnder"] = "";
$params2TEPgI["fontDescUnderEnd"] = "";
if ("false" == "true") {
$params2TEPgI["fontDescUnder"] = "
";
$params2TEPgI["fontDescUnderEnd"] = "";
}
$params2TEPgI["Width"] = "630";
$params2TEPgI["Height"] = "1000";
#FontCapBold.
$params2TEPgI["fontCapBold"] = "";
$params2TEPgI["fontCapBoldEnd"] = "";
if ("false" == "true") {
$params2TEPgI["fontCapBold"]= "
";
$params2TEPgI["fontCapBoldEnd"] = "";
}
#FontCapItalics.
$params2TEPgI["fontCapItalics"] = "";
$params2TEPgI["fontCapItalicsEnd"] = "";
if ("false" == "true") {
$params2TEPgI["fontCapItalics"] = "
";
$params2TEPgI["fontCapItalicsEnd"] = "";
}
#FontCapUnderline
$params2TEPgI["fontCapUnder"] = "";
$params2TEPgI["fontCapUnderEnd"] = "";
if ("false" == "true") {
$params2TEPgI["fontCapUnder"] = "
";
$params2TEPgI["fontCapUnderEnd"] = "";
}
$params2TEPgI["Rows"] = 4;
$params2TEPgI["Cols"] = 3;
$params2TEPgI["Border"] = "1";
$params2TEPgI["KeepWidth"] = "true";
$params2TEPgI["BorderColor"] = "#000000";
$params2TEPgI["caption_file"] = realpath("captions2TEPgI.txt");
#print "\n";
print "\n";
#print "\n";
## The program initialization and run
if ($_REQUEST["file"] != "" && $QSID2TEPgI == $MyID2TEPgI){
print "
| \n";
display2TEPgI($params2TEPgI);
print " |
\n";
}
else if ($_REQUEST["file"] == "") {
print "
| \n";
tn_grid2TEPgI($params2TEPgI);
print " |
\n";
}
#########################
function display2TEPgI($params)
{
$query="?ID2={$params['ID']}&RowIdx={$_REQUEST['RowIdx']}";
$file = $_REQUEST['file'];
$idx = (int)($_REQUEST['idx']);
#Check for Image Descriptions
$desc="";
if ($file != "") {
$lines = file ($params["caption_file"]);
$numlines = count($lines);
print "
";
for ($i=0; $i < $numlines; $i++) {
if ($i == $idx) {
list($tmpfilename,$thumbfilename,$width,$height,$caption, $desc, $byline) = split(":~:", trim($lines[$i]));
$prevlink="
< Back";
$nextlink="
Next >";
if ($idx > 0) {
$newidx = $idx - 1;
list($newfile) = split(":~:", trim($lines[$newidx]));
$prevlink = "
< Back";
}
if ($idx < $numlines-1) {
$newidx = $idx + 1;
list($newfile) = split(":~:", trim($lines[$newidx]));
$nextlink = "
Next >";
}
print "
\n";
print "
\n";
print "| {$params['fontDescUnder']}{$params['fontDescItalics']}{$params['fontDescBold']}\n";
print "$prevlink $nextlink \n";
print " |
";
if ($params['KeepWidth'] == "true") {
print "";
}
print "  \n";
if ($params['KeepWidth'] == "true") {
print " ";
}
print " |
";
$desc = str_replace("\\r\\n", " ", $desc);
if ($desc != "" || $byline != "") {
print "{$params['fontBold']}{$params['fontItalics']}{$params['fontUnder']}$byline{$params['fontUnderEnd']}{$params['fontItalicsEnd']}{$params['fontBoldEnd']} |
\n";
print "
\n";
print "{$params['fontDescUnder']}{$params['fontDescItalics']}{$params['fontDescBold']}\n";
print "$desc \n";
print "{$params['fontDescBoldEnd']}{$params['fontDescItalicsEnd']}{$params['fontDescUnderEnd']} \n";
}
print " |
\n";
$i = $numlines;
}
}
}
}
#######################
# Initialize base table
function tn_grid2TEPgI($params)
{
$script_name = $_SERVER['URL'];
$filelist = array();
$tnlist = array();
$captions = array();
$widthlist = array();
$heightlist = array();
if ($params["caption_file"] != "") {
$lines = file ($params["caption_file"]);
foreach ($lines as $line_num => $line)
{
$line = trim($line);
list($key,$tnname,$width,$height,$caption,$desc,$byline) = split(":~:", $line);
$iheight = (int)($height);
$iwidth = (int)($width);
if ($iwidth > 180) {
$iheight = $iheight * (180 / $iwidth);
$iwidth = 180;
}
if ($iheight > 120) {
$iwidth = $iwidth * (120 / $iheight);
$iheight = 120;
}
if ($tnname == '') {
$tnname = $key;
}
array_push ($filelist,$key);
array_push ($tnlist,$tnname);
array_push ($captions,$caption);
array_push ($widthlist,$iwidth);
array_push ($heightlist,$iheight);
}
}
$cols = (int)($params['Cols']);
if ($cols < 1) { $cols = 1; }
if ($cols > 10) { $cols = 10; }
$RowIdx = (int)($_REQUEST{'RowIdx'});
$tnnum = count($tnlist);
$tn_rows = (int) ($tnnum / $cols); #number of rows
$tn_remain = (int) ($tnnum - $tn_rows * $cols); #remainder
$rows = (int)($params['Rows']);
if ($rows < 1) { $rows = 4; }
$perpage = $rows * $cols;
$tot_tn = ($tn_rows * $cols);
$cur_tn = ($RowIdx);
$last_tn = $cur_tn + $perpage;
if ($last_tn > $tot_tn) {
$last_tn = $tot_tn;
}
else {
$tn_remain = 0;
}
$colwidth = (int)(100/$cols);
$colwidth = "200px";
$query="&ID2={$params['ID']}";
$linkstr = "";
$r=0;
if ($tnnum > $perpage) {
if ($RowIdx > 0) {
$r1 = $RowIdx-$perpage;
$linkstr = "
< ";
}
else {
$linkstr = "< ";
}
$pg = 1;
while ($r < $tnnum) {
if ($r != $RowIdx) {
$linkstr = "$linkstr
$pg ";
}
else {
$linkstr = "$linkstr$pg ";
}
$r = $r + $perpage;
$pg++;
}
if ($RowIdx < ($rows-1) * $cols) {
$r1 = $RowIdx+$perpage;
$linkstr = "$linkstr
> ";
}
else {
$linkstr = "$linkstr> ";
}
}
print "
\n";
print "| \n";
print " $linkstr
";
print "\n";
while ($last_tn > $cur_tn) {
print "\n";
for ($col = 0; $col < $cols; $col++) {
$idx = $cur_tn + $col;
print " {$params['fontCapUnder']}{$params['fontCapItalics']}{$params['fontCapBold']}$captions[$idx]{$params['fontCapBoldEnd']}{$params['fontCapItalicsEnd']}{$params['fontCapUnderEnd']}
| \n";
}
print " \n";
$cur_tn = $cur_tn + $cols;
}
if ($tn_remain > 0) {
print "";
for ($col = 0; $col < $cols; $col++) {
if ($col < $tn_remain) {
$idx = $cur_tn + $col;
print " {$params['fontCapUnder']}{$params['fontCapItalics']}{$params['fontCapBold']}$captions[$idx]{$params['fontCapBoldEnd']}{$params['fontCapItalicsEnd']}{$params['fontCapUnderEnd']}
| \n";
}
else {
print " | \n";
}
}
print " ";
}
print " \n";
print "$linkstr
";
print " | \n";
print "Click image to see a larger version\n";
print " |
\n";
}
?>