Location: PHPKode > scripts > Photos > photos/load_folder.inc.php
<?php

// This file is part of Photos
// Copyright (c) 2001-2004 Alex King
// see LICENSE.txt for more information

// get number of photos from $photo_URLs
$count = count($photo_URLs);

if ($debug == 1) {
	$iframe = '<iframe src="load.php?'.$_SERVER["QUERY_STRING"].'&start=0" name="load" height="200" width="500"></iframe>';
}
else {
	$iframe = '<iframe src="load.php?'.$_SERVER["QUERY_STRING"].'&start=0" name="load" height="1" width="1" style="position: absolute; top: -2000px; left: -2000px;"></iframe>';
}
$script = "";

ob_start();
?>
<div class="groupBorder" id="loading"<?
// hack to handle weird spacing with IE and mozilla
	if (strstr(strtolower($HTTP_SERVER_VARS["HTTP_USER_AGENT"]), "msie") != false) {
		print(' style="width: 100%;"');
	}
?>>
	<div class="groupHeader"><?php print($lang->str("status")); ?></div>
	<table width="100%" cellpadding="0" cellspacing="7" border="0">
		<tr valign="top">
			<td align="center">
				<?php print($lang->str("saving_counter", array(count($photo_URLs)))); ?>
			</td>
		</tr>
		<tr valign="top">
			<td align="center">
				<nobr><img src="images/progress_blue.gif" id="progress_done" height="20" width="1" alt=""><img src="images/progress_line.gif" id="progress_done" height="20" width="1" alt=""><img src="images/progress_grey.gif" id="progress_left" height="20" width="399" alt=""></nobr>
			</td>
		</tr>
		<tr valign="top">
			<td align="center">
				<span id="status"><?php print($lang->str("processing_counter", array(count($photo_URLs)))); ?></span> (<a href="empty.html" target="load" onclick="location.href='index.php?screen=transaction';"><?php print($lang->str("cancel")); ?></a>)
			</td>
		</tr>
	</table>
</div>
<?php
$loading = ob_get_contents();
ob_end_clean();

if (in_array("load_check", $page->flags)) {
	print('<!-- placeholder -->');	
}
else if ($action == "store_images") {
	if ($count % 2 != 0) {
		$col = ($count + 1) / 2;
	}
	else {
		$col = $count/2;
	}
	print($iframe);
	print($loading);
?>
<div class="groupBorder" id="loaded" style="display: none;<?
// hack to handle weird spacing with IE and mozilla
	if (strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "msie") != false) {
		print(' width: 100%;');
	}
?>">
	<div class="groupHeader"><?php print($lang->str("add_folder")); ?></div>
	<table width="100%" cellpadding="0" cellspacing="7" border="0">
		<tr valign="top">
			<td colspan="2"><?php print($lang->str("images_added")); ?></td>
		</tr>
		<tr valign="top">
			<td colspan="2" class="trHR"><img src="images/clear.gif" height="1" width="1"></td>
		<tr valign="top">
			<td width="50%">
<?
	for ($i = 0; $i < $col; $i++) {
		print("\t\t\t\t".$photo_URLs[$i]);
		if ($i + 1 != $col) {
			print("<br>");
		}
		print("\n");
	}
?>
			</td>
			<td width="50%">
<?
	for ($i = $i; $i < $count; $i++) {
		print("\t\t\t\t".$photo_URLs[$i]);
		if ($i + 1 != $count) {
			print("<br>");
		}
		print("\n");
	}
?>
			</td>
		</tr>
	</table>
</div>
<?
}
else if ($action == "check_path") {
	if ($count % 4 != 0) {
		if (($count + 1) % 4 == 0) {
			$col = ($count + 1) / 4;
		}
		elseif (($count + 2) % 4 == 0) {
			$col = ($count + 2) / 4;
		}
		elseif (($count + 3) % 4 == 0) {
			$col = ($count + 3) / 4;
		}
	}
	else {
		$col = $count/4;
	}
	print($iframe);
	$script = "showLoadFolderThumb('temp/".$_SESSION["load_thumbs"][$photo_URLs[0]]."');";	
	print($loading);
?>
<div id="loaded" style="display: none;">
<div class="groupBorder" style="<?
// hack to handle weird spacing with IE and mozilla
	if (strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "msie") != false) {
		print(' width: 100%;');
	}
?>">
	<div class="groupHeader"><?php print($lang->str("review_photos")); ?></div>
<?
	$show_form = 0;
	if (isset($path) && is_dir($path)) {
		$msg_load = $lang->str("found_photos", array(count($photo_URLs), $path));
		$show_form = 1;
	}
?>
	<table width="100%" cellpadding="0" cellspacing="7" border="0">
		<tr valign="top">
			<td colspan="5"><? print($msg_load); ?> (<a href="index.php?screen=load_folder"><?php print($lang->str("add_different")); ?></a>)</td>
		</tr>
<?
	if ($count != 0) {
?>
		<tr valign="top">
			<td colspan="5" class="trHR"><img src="images/clear.gif" height="1" width="1"></td>
		</tr>
		<tr valign="top">
			<td width="160" align="center"><img src="images/clear.gif" name="loadFolderThumb" id="loadFolderThumb" class="onePixelBorder"><img src="image/clear.gif" width="160" height="1"></td>
			<td width="20%">
<?
// show thumbnail image and list of images to be added
		for ($i = 0; $i < $col && $i < $count; $i++) {
			print("\t\t\t\t<a href=\"javascript:showLoadFolderThumb('temp/".$_SESSION["load_thumbs"][$photo_URLs[$i]]."');\">".substr($photo_URLs[$i], (strrpos($photo_URLs[$i], "/") + 1))."</a>");
			if ($i + 1 != $col) {
				print("<br>");
			}
			print("\n");
		}
?>
				&nbsp;
			</td>
			<td width="20%">
<?
		for ($i = $i; $i < ($col * 2) && $i < $count; $i++) {
			print("\t\t\t\t<a href=\"javascript:showLoadFolderThumb('temp/".$_SESSION["load_thumbs"][$photo_URLs[$i]]."');\">".substr($photo_URLs[$i], (strrpos($photo_URLs[$i], "/") + 1))."</a>");
			if ($i + 1 != ($col * 2)) {
				print("<br>");
			}
			print("\n");
		}
?>
				&nbsp;
			</td>
			<td width="20%">
<?
		for ($i = $i; $i < ($col * 3) && $i < $count; $i++) {
			print("\t\t\t\t<a href=\"javascript:showLoadFolderThumb('temp/".$_SESSION["load_thumbs"][$photo_URLs[$i]]."');\">".substr($photo_URLs[$i], (strrpos($photo_URLs[$i], "/") + 1))."</a>");
			if ($i + 1 != ($col * 3)) {
				print("<br>");
			}
			print("\n");
		}
?>
				&nbsp;
			</td>
			<td width="20%">
<?			 
		for ($i = $i; $i < $count; $i++) {
			print("\t\t\t\t<a href=\"javascript:showLoadFolderThumb('temp/".$_SESSION["load_thumbs"][$photo_URLs[$i]]."');\">".substr($photo_URLs[$i], (strrpos($photo_URLs[$i], "/") + 1))."</a>");
			if ($i + 1 != $count) {
				print("<br>");
			}
			print("\n");
		}
?>
				&nbsp;
			</td>
		</tr>
<?
	}
?>
	</table>
</div>
<?
	if ($show_form == 1) {
?>
<img src="images/clear.gif" height="10" width="1" alt="" />
<form name="imageForm" method="get" action="index.php">
	<input type="hidden" name="screen" value="load_folder">
	<input type="hidden" name="action" value="store_images">
	<input type="hidden" name="path" value="<? if (isset($path)) { print($path); } ?>">
	<div class="groupBorder">
		<div class="groupHeader"><?php print($lang->str("photo_group_details")); ?></div>
<?php
$button_effects = 'onmouseover="highlightButton(this, \'over\');" '
				 .'onmousedown="highlightButton(this, \'down\');" '
				 .'onmouseup="highlightButton(this, \'over\');" '
				 .'onmouseout="highlightButton(this, \'out\');"';
?>
<ul class="toolbar">
	<li <?php print($button_effects); ?> onclick="clearEntryData();" style="float: right;"><nobr><img src="images/clear.gif" style="margin: 0; width: 1px;" /><?php print($lang->str("tb_clear")); ?></nobr></li>
	<li <?php print($button_effects); ?> onclick="document.imageForm.submit();"><nobr><img src="images/icon_save.gif" alt="<?php print($lang->str("tb_save_tip")); ?>" /><?php print($lang->str("tb_save")); ?></nobr></li>
	<li><nobr>&nbsp;&nbsp;<input type="checkbox" name="needdetails" value="1" checked><span onclick="toggleCheckbox(document.imageForm.needdetails);" class="hand"> <?php print($lang->str("add_details_later")); ?></span></nobr></li>
</ul>
		<table width="100%" cellpadding="5" cellspacing="0" border="0">
<!-- shim row -->
			<tr>
				<td width="1%" style="padding: 0px;"><img src="images/clear.gif" height="1" width="85"></td>
				<td width="50%" style="padding: 0px;"><img src="images/clear.gif" height="1" width="150"></td>
				<td width="1%" style="padding: 0px;"><img src="images/clear.gif" height="1" width="85"></td>
				<td width="5%" style="padding: 0px;"><img src="images/clear.gif" height="1" width="50"></td>
				<td width="1%" style="padding: 0px;"><img src="images/clear.gif" height="1" width="50"></td>
				<td width="1%" style="padding: 0px;"><img src="images/clear.gif" height="1" width="50"></td>
			</tr>
			<tr class="rowOdd">
				<td align="right"><?php print($lang->str("title")); ?></td>
				<td colspan="4"><input type="text" name="title" value="<? print(html($image_entry->title)); ?>" style="width: 95%;" class="onePixelBorder"></td>
				<td><span onclick="toggleCheckbox(document.imageForm.portfolio);" class="hand"><?php print($lang->str("portfolio_shot")); ?></span> <input type="checkbox" name="portfolio" value="1" <? if(isset($image_entry->portfolio) && $image_entry->portfolio == 1) { print("checked"); } ?>></td>
			</tr>
			<tr valign="top" class="rowEven">
				<td align="right"><?php print($lang->str("description")); ?></td>
				<td colspan="5"><textarea name="description" style="width: 98%;" class="onePixelBorder"><? print(html($image_entry->description)); ?></textarea></td>
			</tr>
			<tr valign="top" class="rowOdd">
				<td align="right"><?php print($lang->str("keywords")); ?></td>
				<td><textarea name="keywords" style="width: 95%;" class="onePixelBorder"><? print(html($image_entry->keywords)); ?></textarea></td>
				<td align="right"><?php print($lang->str("people")); ?></td>
				<td colspan="3"><textarea name="people" style="width: 95%;" class="onePixelBorder"><? print(html($image_entry->people)); ?></textarea></td>
			</tr>
			<tr class="rowEven">
				<td align="right"><?php print($lang->str("event")); ?></td>
		<td><input type="text" name="event" value="<? print(html($image_entry->event)); ?>" style="width: 95%;" class="onePixelBorder"></td>
				<td align="right"><?php print($lang->str("in_outdoors")); ?></td>
				<td colspan="3">
					<select name="indoors" class="onePixelBorder">
						<option value="" selected></option>
						<option value="Indoors"><?php print($lang->str("indoors")); ?></option>
						<option value="Outdoors"><?php print($lang->str("outdoors")); ?></option>
					</select>
				</td>
			</tr>
			<tr class="rowOdd">
				<td align="right"><?php print($lang->str("location")); ?></td>
				<td><input type="text" name="location" value="<? print(html($image_entry->location)); ?>" style="width: 95%;" class="onePixelBorder"></td>
				<td align="right"><?php print($lang->str("state")); ?></td>
				<td><input type="text" name="state" value="<? print(html($custom->entry_state)); ?>" style="width: 50px;" class="onePixelBorder"></td>
				<td align="right"><?php print($lang->str("country")); ?></td>
				<td><input type="text" name="country" value="<? print(html($custom->entry_country)); ?>" style="width: 150px;" class="onePixelBorder"></td>
			</tr>
			<tr class="rowEven">
				<td align="right"><?php print($lang->str("photographer")); ?></td>
				<td><input type="text" name="photographer" value="<? print(html($custom->default_photographer)); ?>" style="width: 95%;" class="onePixelBorder"></td>
				<td align="right"></td>
				<td></td>
				<td align="right"></td>
				<td></td>
			</tr>
		</table>
	</div>
	<div id="hidden" style="width: 1; height: 1; position: absolute; top: -200; left: -200; overflow: hidden">
	<input type="submit" name="submitButton" value="Save (s)" accesskey="s" onclick="document.imageForm.submit();">
	</div>
</div>
</form>
<?
	}
}
else {
?>
<div class="groupBorder"<?
// hack to handle weird spacing with IE and mozilla
	if (strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "msie") != false) {
		print(' style="width: 100%;"');
	}
?>>
	<div class="groupHeader"><?php print($lang->str("choose_folder_file")); ?></div>
	<iframe name="finderFrame" src="empty.html" style="height: 1px; width: 1px; position: absolute; top: -2000px; left: -2000px;"></iframe>
<!--
	<iframe name="finderFrame" src="empty.html" height="200" width="500"></iframe>
-->
	<table width="100%" cellpadding="0" cellspacing="7" border="0">
		<tr valign="top">
			<td>
				<?php print($lang->str("path")); ?> <span id="path">gallery_photos / (<img src="images/icon_add_path.gif" alt="" /> <a href="index.php?screen=load_folder&action=check_path&path=gallery_photos"><?php print($lang->str("add")); ?></a>)</span>
			</td>
		</tr>
		<tr valign="top">
			<td class="trHR"><img src="images/clear.gif" height="1" width="1" alt="" /></td>
		</tr>
		<tr valign="top">
			<td>
				<div id="finder">
<?=get_finder('gallery_photos')?>
				</div>
			</td>
		</tr>
	</table>
</div>
<img src="images/clear.gif" width="1" height="10" alt="" />
<div class="groupBorder"<?
// hack to handle weird spacing with IE and mozilla
	if (strstr(strtolower($_SERVER["HTTP_USER_AGENT"]), "msie") != false) {
		print(' style="width: 100%;"');
	}
?>>
	<div class="groupHeader"><?php print($lang->str("path_instructions")); ?> <span style="color: #ccc;">(&quot;gallery_photos/folder/&quot; or &quot;gallery_photos/folder/photo.jpg&quot;)</span></div>
	<table width="100%" cellpadding="7" cellspacing="0" border="0">
		<tr valign="top">
			<td>
				<form name="checkPathForm" method="get" action="index.php" onsubmit="if (document.checkPathForm.path.value == '') { return false; alert(sEnterPath); }" >
				<input type="hidden" name="action" value="check_path">
				<input type="hidden" name="screen" value="load_folder">
				<input type="text" name="path" value="<?
if (isset($path)) {
	print($path);
}
elseif (isset($custom->load_folder_path)) {
	print($custom->load_folder_path);
} 

?>" style="width: 300px;">
				&nbsp;
				<input type="submit" accesskey="1" value="<?php print($lang->str("apply_1")); ?>">
				</form>
			</td>
		</tr>
	</table>
</div>
<?
}
?>
<script language="JavaScript">
<!--
function showThumb() {
<?
print($script);
?>
}
// -->
</script>
Return current item: Photos