static function owner($obj, $instance, $field, $type)
    {
        if ($type == 'save') {
            if (isset($_POST[$instance . '-' . $field['name']])) {
                return sanitize($_POST[$instance . '-' . $field['name']]);
            } else {
                return NULL;
            }
        } else {
            $item = NULL;
            if (zp_loggedin(MANAGE_ALL_ALBUM_RIGHTS)) {
                ob_start();
                ?>
				<select name="<?php 
                echo $instance . '-' . $field['name'];
                ?>
">
					<?php 
                echo admin_album_list($obj->getOwner());
                ?>
				</select>
				<?php 
                $item = ob_get_contents();
                ob_end_clean();
            }
            return $item;
        }
    }
/**
 * Edit tab bulk actions drop-down
 * @param array $checkarray the list of actions
 * @param bool $checkAll set true to include check all box
 */
function printBulkActions($checkarray, $checkAll = false)
{
    $customInfo = $colorboxBookmark = array();
    foreach ($checkarray as $key => $value) {
        if (is_array($value)) {
            $checkarray[$key] = $value['name'];
            switch ($action = $value['action']) {
                case 'mass_customTextarea_data':
                    $data['size'] = -1;
                case 'mass_customText_data':
                    $customInfo[$value['name']] = $value;
                    $action = 'mass_' . $value['name'] . '_data';
                    break;
            }
            $colorboxBookmark[$value['name']] = $action;
        }
    }
    if (!empty($colorboxBookmark)) {
        ?>
		<script type="text/javascript">
			//<!-- <![CDATA[
			function checkFor(obj) {
				var sel = obj.options[obj.selectedIndex].value;
				var mark;
				switch (sel) {
		<?php 
        foreach ($colorboxBookmark as $key => $mark) {
            ?>
					case '<?php 
            echo $key;
            ?>
':
									mark = '<?php 
            echo $mark;
            ?>
';
									break;
			<?php 
        }
        ?>
				default:
								mark = false;
								break;
			}
			if (mark) {
				$.colorbox({
					href: '#' + mark,
					inline: true,
					open: true,
					close: '<?php 
        echo gettext("ok");
        ?>
'
				});
				}
			}
			// ]]> -->
		</script>
		<?php 
    }
    ?>
	<span style="float:right">
		<select class="ignoredirty" name="checkallaction" id="checkallaction" size="1" onchange="checkFor(this);" >
			<?php 
    generateListFromArray(array('noaction'), $checkarray, false, true);
    ?>
		</select>
		<?php 
    if ($checkAll) {
        ?>
			<br />
			<?php 
        echo gettext("Check All");
        ?>
			<input class="ignoredirty" type="checkbox" name="allbox" id="allbox" onclick="checkAll(this.form, 'ids[]', this.checked);" />
			<?php 
    }
    ?>
	</span>
	<?php 
    foreach ($customInfo as $key => $data) {
        ?>
		<div id="mass_<?php 
        echo $key;
        ?>
" style="display:none;
				 ">
			<div id="mass_<?php 
        echo $key;
        ?>
_data">
				<?php 
        printf('Value for %s:', $data['desc']);
        if ($data['action'] == 'mass_customText_data') {
            if (isset($data['size']) && $data['size'] >= 0) {
                $size = max(5, min($data['size'], 200));
            } else {
                $size = 100;
            }
            ?>
					<input type="text" name="<?php 
            echo $key;
            ?>
" size="<?php 
            echo $size;
            ?>
" value="">
					<?php 
        } else {
            ?>
					<textarea name="<?php 
            echo $key;
            ?>
" cols="<?php 
            echo TEXTAREA_COLUMNS;
            ?>
"	style="width: 320px" rows="6"></textarea>
					<?php 
        }
        ?>
			</div>
		</div>
		<?php 
    }
    if (in_array('mass_tags_data', $colorboxBookmark)) {
        ?>
		<div id="mass_tags" style="display:none;">
			<div id="mass_tags_data">
				<?php 
        tagSelector(NULL, 'mass_tags_', false, getTagOrder(), true, false, 'checkTagsAuto ignoredirty');
        ?>
			</div>
		</div>
		<?php 
    }
    if (in_array('mass_cats_data', $colorboxBookmark)) {
        ?>
		<div id="mass_cats" style="display:none;">
			<div id="mass_cats_data">
				<?php 
        echo gettext('New categorys:');
        ?>
				<ul>
					<?php 
        printNestedItemsList('cats-checkboxlist', '', 'all', 'ignoredirty');
        ?>
				</ul>
			</div>
		</div>
		<?php 
    }
    if (in_array('mass_owner_data', $colorboxBookmark)) {
        ?>
		<div id="mass_owner" style="display:none;">
			<div id="mass_owner_data">
				<?php 
        echo gettext('New owner:');
        ?>
				<ul>
					<select class="ignoredirty" id="massownermenu" name="massownerselect" onchange="">
						<?php 
        echo admin_album_list(NULL);
        ?>
					</select>
				</ul>
			</div>
		</div>
		<?php 
    }
    if (in_array('mass_movecopy_data', $colorboxBookmark)) {
        global $mcr_albumlist, $album, $bglevels;
        ?>
		<div id="mass_movecopy_copy" style="display:none;">
			<div id="mass_movecopy_data">
				<input type="hidden" name="massfolder" value="<?php 
        echo $album->name;
        ?>
" />
				<?php 
        echo gettext('Destination');
        ?>
				<select class="ignoredirty" id="massalbumselectmenu" name="massalbumselect" onchange="">
					<?php 
        foreach ($mcr_albumlist as $fullfolder => $albumtitle) {
            $singlefolder = $fullfolder;
            $saprefix = "";
            $salevel = 0;
            $selected = "";
            if ($album->name == $fullfolder) {
                $selected = " selected=\"selected\" ";
            }
            // Get rid of the slashes in the subalbum, while also making a subalbum prefix for the menu.
            while (strstr($singlefolder, '/') !== false) {
                $singlefolder = substr(strstr($singlefolder, '/'), 1);
                $saprefix = "&nbsp; &nbsp;&nbsp;" . $saprefix;
                $salevel++;
            }
            echo '<option value="' . $fullfolder . '"' . ($salevel > 0 ? ' style="background-color: ' . $bglevels[$salevel] . ';"' : '') . "{$selected}>" . $saprefix . $singlefolder . "</option>\n";
        }
        ?>
				</select>
			</div>
		</div>
		<?php 
    }
}
/**
 * Edit tab bulk actions drop-down
 * @param array $checkarray the list of actions
 * @param bool $checkAll set true to include check all box
 */
function printBulkActions($checkarray, $checkAll = false)
{
    $tags = in_array('addtags', $checkarray) || in_array('alltags', $checkarray);
    $movecopy = in_array('moveimages', $checkarray) || in_array('copyimages', $checkarray);
    $categories = in_array('addcats', $checkarray) || in_array('clearcats', $checkarray);
    $changeowner = in_array('changeowner', $checkarray);
    if ($tags || $movecopy || $categories || $changeowner) {
        ?>
		<script type="text/javascript">
			//<!-- <![CDATA[
			function checkFor(obj) {
				var sel = obj.options[obj.selectedIndex].value;
		<?php 
        if ($tags) {
            ?>
					if (sel == 'addtags' || sel == 'alltags') {
						$.colorbox({
							href: "#mass_tags_data",
							inline: true,
							open: true,
							close: '<?php 
            echo gettext("ok");
            ?>
'
						});
					}
			<?php 
        }
        if ($movecopy) {
            ?>
					if (sel == 'moveimages' || sel == 'copyimages') {
						$.colorbox({
							href: "#mass_movecopy_data",
							inline: true,
							open: true,
							close: '<?php 
            echo gettext("ok");
            ?>
'
						});
					}
			<?php 
        }
        if ($categories) {
            ?>
					if (sel == 'addcats') {
						$.colorbox({
							href: "#mass_cats_data",
							inline: true,
							open: true,
							close: '<?php 
            echo gettext("ok");
            ?>
'
						});
					}
			<?php 
        }
        if ($changeowner) {
            ?>
					if (sel == 'changeowner') {
						$.colorbox({
							href: "#mass_owner_data",
							inline: true,
							open: true,
							close: '<?php 
            echo gettext("ok");
            ?>
'
						});
					}
			<?php 
        }
        ?>
			}
			// ]]> -->
		</script>
		<?php 
    }
    ?>
	<span style="float:right">
		<select class="ays-ignore" name="checkallaction" id="checkallaction" size="1" onchange="checkFor(this);" >
			<?php 
    generateListFromArray(array('noaction'), $checkarray, false, true);
    ?>
		</select>
		<?php 
    if ($checkAll) {
        ?>
			<br />
			<?php 
        echo gettext("Check All");
        ?>
			<input class="ays-ignore" type="checkbox" name="allbox" id="allbox" onclick="checkAll(this.form, 'ids[]', this.checked);" />
			<?php 
    }
    ?>
	</span>
	<?php 
    if ($tags) {
        ?>
		<div id="mass_tags" style="display:none;">
			<div id="mass_tags_data">
				<?php 
        tagSelector(NULL, 'mass_tags_', false, false, true, false, 'checkTagsAuto ays-ignore');
        ?>
			</div>
		</div>
		<?php 
    }
    if ($categories) {
        ?>
		<div id="mass_cats" style="display:none;">
			<ul id="mass_cats_data">
				<?php 
        printNestedItemsList('cats-checkboxlist', '', 'all', 'ays-ignore');
        ?>
			</ul>
		</div>
		<?php 
    }
    if ($changeowner) {
        ?>
		<div id="mass_owner" style="display:none;">
			<ul id="mass_owner_data">
				<select class="ays-ignore" id="massownermenu" name="massownerselect" onchange="">
					<?php 
        echo admin_album_list(NULL);
        ?>
				</select>
			</ul>
		</div>
		<?php 
    }
    if ($movecopy) {
        global $mcr_albumlist, $album, $bglevels;
        ?>
		<div id="mass_movecopy_copy" style="display:none;">
			<div id="mass_movecopy_data">
				<input type="hidden" name="massfolder" value="<?php 
        echo $album->name;
        ?>
" />
				<?php 
        echo gettext('Destination');
        ?>
				<select class="ays-ignore" id="massalbumselectmenu" name="massalbumselect" onchange="">
					<?php 
        foreach ($mcr_albumlist as $fullfolder => $albumtitle) {
            $singlefolder = $fullfolder;
            $saprefix = "";
            $salevel = 0;
            $selected = "";
            if ($album->name == $fullfolder) {
                $selected = " selected=\"selected\" ";
            }
            // Get rid of the slashes in the subalbum, while also making a subalbum prefix for the menu.
            while (strstr($singlefolder, '/') !== false) {
                $singlefolder = substr(strstr($singlefolder, '/'), 1);
                $saprefix = "&nbsp; &nbsp;&nbsp;" . $saprefix;
                $salevel++;
            }
            echo '<option value="' . $fullfolder . '"' . ($salevel > 0 ? ' style="background-color: ' . $bglevels[$salevel] . ';"' : '') . "{$selected}>" . $saprefix . $singlefolder . "</option>\n";
        }
        ?>
				</select>
			</div>
		</div>
		<?php 
    }
}
Exemple #4
0
</p>
														</td>
														<td align="left" valign="top"><?php 
                        echo gettext("Owner:");
                        ?>
</td>
														<td style="width:100%;">
															<?php 
                        if (zp_loggedin(MANAGE_ALL_ALBUM_RIGHTS)) {
                            ?>
																<select name="<?php 
                            echo $currentimage;
                            ?>
-owner">
																	<?php 
                            echo admin_album_list($image->getOwner());
                            ?>
																</select>
																<?php 
                        } else {
                            echo $image->getOwner();
                        }
                        ?>
														</td>
														<td style="padding-left: 1em; text-align: left; border-bottom:none;" rowspan="14" valign="top">
															<h2 class="h2_bordered_edit"><?php 
                        echo gettext("General");
                        ?>
</h2>
															<div class="box-edit">
																<label class="checkboxlabel">
/**
 * emits the html for editing album information
 * called in edit album and mass edit
 * @param string $index the index of the entry in mass edit or '0' if single album
 * @param object $album the album object
 * @param bool $collapse_tags set true to initially hide tab list
 * @since 1.1.3
 */
function printAlbumEditForm($index, $album, $collapse_tags)
{
    global $sortby, $gallery, $mcr_albumlist, $albumdbfields, $imagedbfields, $_thumb_field_text;
    $tagsort = getTagOrder();
    if ($index == 0) {
        if (isset($saved)) {
            $album->setSubalbumSortType('manual');
        }
        $suffix = $prefix = '';
    } else {
        $prefix = "{$index}-";
        $suffix = "_{$index}";
        echo "<p><em><strong>" . $album->name . "</strong></em></p>";
    }
    ?>
	<input type="hidden" name="<?php 
    echo $prefix;
    ?>
folder" value="<?php 
    echo $album->name;
    ?>
" />
	<input type="hidden" name="tagsort" value="<?php 
    echo html_encode($tagsort);
    ?>
" />
	<input	type="hidden" name="<?php 
    echo $prefix;
    ?>
password_enabled" id="password_enabled<?php 
    echo $suffix;
    ?>
" value="0" />
	<span class="buttons">
		<?php 
    $parent = dirname($album->name);
    if ($parent == '/' || $parent == '.' || empty($parent)) {
        $parent = '';
    } else {
        $parent = '&amp;album=' . $parent . '&amp;tab=subalbuminfo';
    }
    ?>
		<a title="<?php 
    echo gettext('Back to the album list');
    ?>
" href="<?php 
    echo WEBPATH . '/' . ZENFOLDER . '/admin-edit.php?page=edit' . $parent;
    ?>
">
		<img	src="images/arrow_left_blue_round.png" alt="" />
		<strong><?php 
    echo gettext("Back");
    ?>
</strong>
		</a>
		<button type="submit" title="<?php 
    echo gettext("Apply");
    ?>
">
		<img	src="images/pass.png" alt="" />
		<strong><?php 
    echo gettext("Apply");
    ?>
</strong>
		</button>
		<button type="reset" title="<?php 
    echo gettext("Reset");
    ?>
" onclick="javascript:$('.deletemsg').hide();" >
		<img	src="images/fail.png" alt="" />
		<strong><?php 
    echo gettext("Reset");
    ?>
</strong>
		</button>
		<div class="floatright">
		<?php 
    if (!$album->isDynamic()) {
        ?>
			<button type="button" title="<?php 
        echo gettext('New subalbum');
        ?>
" onclick="javascript:newAlbum('<?php 
        echo pathurlencode($album->name);
        ?>
',true);">
			<img src="images/folder.png" alt="" />
			<strong><?php 
        echo gettext('New subalbum');
        ?>
</strong>
			</button>
			<?php 
    }
    ?>
		<a title="<?php 
    echo gettext('View Album');
    ?>
" href="<?php 
    echo WEBPATH . "/index.php?album=" . pathurlencode($album->getFolder());
    ?>
">
		<img src="images/view.png" alt="" />
		<strong><?php 
    echo gettext('View Album');
    ?>
</strong>
		</a>
		</div>
	</span>
<br clear="all" /><br />
	<table>
		<tr>
			<td width="70%" valign="top">
				<table>
					<tr>
						<td valign="top"><?php 
    echo gettext("Owner");
    ?>
</td>
						<td>
							<?php 
    if (zp_loggedin(MANAGE_ALL_ALBUM_RIGHTS)) {
        ?>
								<select name="<?php 
        echo $prefix;
        ?>
-owner">
									<?php 
        echo admin_album_list($album->getOwner());
        ?>
								</select>
								<?php 
    } else {
        echo $album->getOwner();
    }
    ?>
						</td>
					</tr>
					<tr>
						<td align="left" valign="top" width="150">
						<?php 
    echo gettext("Album Title");
    ?>
:
						</td>
						<td>
						<?php 
    print_language_string_list($album->get('title'), $prefix . "albumtitle");
    ?>
						</td>
					</tr>

					<tr>
						<td align="left" valign="top" >
						<?php 
    echo gettext("Album Description:");
    ?>
						</td>
						<td>
						<?php 
    print_language_string_list($album->get('desc'), $prefix . "albumdesc", true, NULL, 'texteditor');
    ?>
						</td>
					</tr>
					<?php 
    if (GALLERY_SECURITY != 'private') {
        ?>
						<tr class="password<?php 
        echo $suffix;
        ?>
extrashow" <?php 
        if (GALLERY_SECURITY == 'private') {
            echo 'style="display:none"';
        }
        ?>
 >
							<td align="left" valign="top">
								<p>
									<a href="javascript:toggle_passwords('<?php 
        echo $suffix;
        ?>
',true);">
									<?php 
        echo gettext("Album password:"******"images/lock_open.png" />
								<?php 
        } else {
            $x = '          ';
            ?>
							<a onclick="resetPass();" title="<?php 
            echo gettext('clear password');
            ?>
"><img src="images/lock.png" /></a>
								<?php 
        }
        ?>
							</td>
						</tr>
						<tr class="password<?php 
        echo $suffix;
        ?>
extrahide" style="display:none" >
							<td align="left" valign="top">
								<p>
								<a href="javascript:toggle_passwords('<?php 
        echo $suffix;
        ?>
',false);">
									<?php 
        echo gettext("Album guest user:"******"Album password:"******"repeat:");
        ?>
								</p>
								<p>
								<?php 
        echo gettext("Password hint:");
        ?>
								</p>
							</td>
							<td>
								<p>
									<input type="text" size="<?php 
        echo TEXT_INPUT_SIZE;
        ?>
" id="user_name" name="<?php 
        echo $prefix;
        ?>
albumuser" value="<?php 
        echo $album->getUser();
        ?>
" />
								</p>
								<p>
								<input type="password" size="<?php 
        echo TEXT_INPUT_SIZE;
        ?>
" id="pass" name="<?php 
        echo $prefix;
        ?>
albumpass"  value="<?php 
        echo $x;
        ?>
" />
								<br />
								<input type="password" size="<?php 
        echo TEXT_INPUT_SIZE;
        ?>
" id="pass_2" name="<?php 
        echo $prefix;
        ?>
albumpass_2" value="<?php 
        echo $x;
        ?>
" />
								</p>
								<p>
								<?php 
        print_language_string_list($album->get('password_hint'), $prefix . "albumpass_hint", false, NULL, 'hint');
        ?>
								</p>
							</td>
						</tr>
					<?php 
    }
    $d = $album->getDateTime();
    if ($d == "0000-00-00 00:00:00") {
        $d = "";
    }
    ?>


					<tr>
						<td align="left" valign="top"><?php 
    echo gettext("Date:");
    ?>
 </td>
						<td width="400">
							<script type="text/javascript">
								// <!-- <![CDATA[
								$(function() {
									$("#datepicker<?php 
    echo $suffix;
    ?>
").datepicker({
													showOn: 'button',
													buttonImage: 'images/calendar.png',
													buttonText: '<?php 
    echo gettext('calendar');
    ?>
',
													buttonImageOnly: true
													});
								});
								// ]]> -->
							</script>
							<input type="text" id="datepicker<?php 
    echo $suffix;
    ?>
" size="20" name="<?php 
    echo $prefix;
    ?>
albumdate" value="<?php 
    echo $d;
    ?>
" />
						</td>
					</tr>
					<tr>
						<td align="left" valign="top"><?php 
    echo gettext("Location:");
    ?>
 </td>
						<td>
						<?php 
    print_language_string_list($album->getLocation(), $prefix . "albumlocation");
    ?>
						</td>
					</tr>
					<?php 
    $custom = zp_apply_filter('edit_album_custom_data', '', $album, $prefix);
    if (empty($custom)) {
        ?>
					<tr>
						<td align="left" valign="top"><?php 
        echo gettext("Custom data:");
        ?>
</td>
						<td><?php 
        print_language_string_list($album->get('custom_data'), $prefix . "album_custom_data", true, NULL, 'texteditor_albumcustomdata');
        ?>
</td>
					</tr>
						<?php 
    } else {
        echo $custom;
    }
    $sort = $sortby;
    if (!$album->isDynamic()) {
        $sort[gettext('Manual')] = 'manual';
    }
    $sort[gettext('Custom')] = 'custom';
    /*
     * not recommended--screws with peoples minds during pagination!
    	$sort[gettext('Random')] = 'random';
    */
    ?>
					<tr>
						<td align="left" valign="top"><?php 
    echo gettext("Sort subalbums by:");
    ?>
 </td>
						<td>
							<span class="nowrap">
								<select id="albumsortselect<?php 
    echo $prefix;
    ?>
" name="<?php 
    echo $prefix;
    ?>
subalbumsortby" onchange="update_direction(this,'album_direction_div<?php 
    echo $suffix;
    ?>
','album_custom_div<?php 
    echo $suffix;
    ?>
')">
								<?php 
    if (is_null($album->getParent())) {
        $globalsort = gettext("*gallery album sort order");
    } else {
        $globalsort = gettext("*parent album subalbum sort order");
    }
    echo "\n<option value =''>{$globalsort}</option>";
    $cvt = $type = strtolower($album->get('subalbum_sort_type'));
    if ($type && !in_array($type, $sort)) {
        $cv = array('custom');
    } else {
        $cv = array($type);
    }
    generateListFromArray($cv, $sort, false, true);
    ?>
								</select>
								<?php 
    if ($type == 'manual' || $type == 'random' || $type == '') {
        $dsp = 'none';
    } else {
        $dsp = 'inline';
    }
    ?>
								<label id="album_direction_div<?php 
    echo $suffix;
    ?>
" style="display:<?php 
    echo $dsp;
    ?>
;white-space:nowrap;">
									<?php 
    echo gettext("Descending");
    ?>
									<input type="checkbox" name="<?php 
    echo $prefix;
    ?>
album_sortdirection" value="1" <?php 
    if ($album->getSortDirection('album')) {
        echo "CHECKED";
    }
    ?>
 />
								</label>
							</span>
							<?php 
    $flip = array_flip($sort);
    if (empty($type) || isset($flip[$type])) {
        $dsp = 'none';
    } else {
        $dsp = 'block';
    }
    ?>
							<span id="album_custom_div<?php 
    echo $suffix;
    ?>
" class="customText" style="display:<?php 
    echo $dsp;
    ?>
;white-space:nowrap;">
								<br />
								<?php 
    echo gettext('custom fields:');
    ?>
								<input id="customalbumsort<?php 
    echo $suffix;
    ?>
" class="customalbumsort" name="<?php 
    echo $prefix;
    ?>
customalbumsort" type="text" value="<?php 
    echo html_encode($cvt);
    ?>
"></input>
							</span>
					</td>
				</tr>

				<tr>
					<td align="left" valign="top"><?php 
    echo gettext("Sort images by:");
    ?>
 </td>
						<td>
							<span class="nowrap">
								<select id="imagesortselect<?php 
    echo $prefix;
    ?>
" name="<?php 
    echo $prefix;
    ?>
sortby" onchange="update_direction(this,'image_direction_div<?php 
    echo $suffix;
    ?>
','image_custom_div<?php 
    echo $suffix;
    ?>
')">
								<?php 
    if (is_null($album->getParent())) {
        $globalsort = gettext("*gallery image sort order");
    } else {
        $globalsort = gettext("*parent album image sort order");
    }
    ?>
								<option value =""><?php 
    echo $globalsort;
    ?>
</option>
								<?php 
    $cvt = $type = strtolower($album->get('sort_type'));
    if ($type && !in_array($type, $sort)) {
        $cv = array('custom');
    } else {
        $cv = array($type);
    }
    generateListFromArray($cv, $sort, false, true);
    ?>
								</select>
							<?php 
    if ($type == 'manual' || $type == 'random' || $type == '') {
        $dsp = 'none';
    } else {
        $dsp = 'inline';
    }
    ?>
							<label id="image_direction_div<?php 
    echo $suffix;
    ?>
" style="display:<?php 
    echo $dsp;
    ?>
;white-space:nowrap;">
								<?php 
    echo gettext("Descending");
    ?>
								<input type="checkbox" name="<?php 
    echo $prefix;
    ?>
image_sortdirection" value="1"
									<?php 
    if ($album->getSortDirection('image')) {
        echo ' checked="checked"';
    }
    ?>
 />
							</label>
						</span>
						<?php 
    $flip = array_flip($sort);
    if (empty($type) || isset($flip[$type])) {
        $dsp = 'none';
    } else {
        $dsp = 'block';
    }
    ?>
						<span id="image_custom_div<?php 
    echo $suffix;
    ?>
" class="customText" style="display:<?php 
    echo $dsp;
    ?>
;white-space:nowrap;">
							<br />
							<?php 
    echo gettext('custom fields:');
    ?>
							<input id="customimagesort<?php 
    echo $suffix;
    ?>
" class="customimagesort" name="<?php 
    echo $prefix;
    ?>
customimagesort" type="text" value="<?php 
    echo html_encode($cvt);
    ?>
"></input>
						</span>
					 </td>
				</tr>

				<?php 
    if (is_null($album->getParent())) {
        ?>
					<tr>
						<td align="left" valign="top"><?php 
        echo gettext("Album theme:");
        ?>
 </td>
						<td>
							<select id="album_theme" class="album_theme" name="<?php 
        echo $prefix;
        ?>
album_theme"	<?php 
        if (!zp_loggedin(THEMES_RIGHTS)) {
            echo 'disabled="disabled" ';
        }
        ?>
	>
							<?php 
        $themes = $gallery->getThemes();
        $oldtheme = $album->getAlbumTheme();
        if (empty($oldtheme)) {
            $selected = 'selected="selected"';
        } else {
            $selected = '';
        }
        ?>
							<option value="" style="background-color:LightGray" <?php 
        echo $selected;
        ?>
 ><?php 
        echo gettext('*gallery theme');
        ?>
</option>
							<?php 
        foreach ($themes as $theme => $themeinfo) {
            if ($oldtheme == $theme) {
                $selected = 'selected="selected"';
            } else {
                $selected = '';
            }
            ?>
								<option value = "<?php 
            echo $theme;
            ?>
" <?php 
            echo $selected;
            ?>
 ><?php 
            echo $themeinfo['name'];
            ?>
</option>
							<?php 
        }
        ?>
							</select>
						</td>
					</tr>
					<?php 
    }
    if (!$album->isDynamic()) {
        ?>
					<tr>
						<td align="left" valign="top" width="150"><?php 
        echo gettext("Album watermarks:");
        ?>
 </td>
						<td>
							<?php 
        $current = $album->getWatermark();
        ?>
							<select id="album_watermark" name="<?php 
        echo $prefix;
        ?>
album_watermark">
								<option value="<?php 
        echo NO_WATERMARK;
        ?>
" <?php 
        if ($current == NO_WATERMARK) {
            echo ' selected="selected"';
        }
        ?>
 style="background-color:LightGray"><?php 
        echo gettext('*no watermark');
        ?>
</option>
								<option value="" <?php 
        if (empty($current)) {
            echo ' selected="selected"';
        }
        ?>
 style="background-color:LightGray"><?php 
        echo gettext('*default');
        ?>
</option>
								<?php 
        $watermarks = getWatermarks();
        generateListFromArray(array($current), $watermarks, false, false);
        ?>
							</select>
							<?php 
        echo gettext('Images');
        ?>
							</td>
					</tr>
					<tr>
						<td align="left" valign="top" width="150"></td>
						<td>
							<?php 
        $current = $album->getWatermarkThumb();
        ?>
							<select id="album_watermark_thumb" name="<?php 
        echo $prefix;
        ?>
album_watermark_thumb">
								<option value="<?php 
        echo NO_WATERMARK;
        ?>
" <?php 
        if ($current == NO_WATERMARK) {
            echo ' selected="selected"';
        }
        ?>
 style="background-color:LightGray"><?php 
        echo gettext('*no watermark');
        ?>
</option>
								<option value="" <?php 
        if (empty($current)) {
            echo ' selected="selected"';
        }
        ?>
 style="background-color:LightGray"><?php 
        echo gettext('*default');
        ?>
</option>
								<?php 
        $watermarks = getWatermarks();
        generateListFromArray(array($current), $watermarks, false, false);
        ?>
							</select>
							<?php 
        echo gettext('Thumbs');
        ?>
						</td>
					</tr>
					<?php 
    }
    if ($index == 0) {
        // suppress for mass-edit
        ?>
					<tr>
						<td align="left" valign="top" width="150"><?php 
        echo gettext("Thumbnail:");
        ?>
 </td>
						<td>
						<?php 
        $showThumb = $gallery->getThumbSelectImages();
        $thumb = $album->get('thumb');
        if ($showThumb) {
            ?>
							<script type="text/javascript">
								// <!-- <![CDATA[
								updateThumbPreview(document.getElementById('thumbselect'));
								// ]]> -->
							</script>
							<?php 
        }
        ?>
						<select style="width:320px" <?php 
        if ($showThumb) {
            ?>
class="thumbselect" onchange="updateThumbPreview(this)"	<?php 
        }
        ?>
 name="<?php 
        echo $prefix;
        ?>
thumb">
							<option <?php 
        if ($showThumb) {
            ?>
class="thumboption" style="background-color:#B1F7B6"<?php 
        }
        if ($thumb === '1') {
            ?>
selected="selected"<?php 
        }
        ?>
	value="1"><?php 
        echo $_thumb_field_text[getOption('AlbumThumbSelectField')];
        ?>
							</option>
							<option <?php 
        if ($showThumb) {
            ?>
class="thumboption" style="background-color:#B1F7B6" <?php 
        }
        ?>
								<?php 
        if (empty($thumb) && $thumb !== '1') {
            ?>
 selected="selected" <?php 
        }
        ?>
									value=""><?php 
        echo gettext('randomly selected');
        ?>
							</option>
							<?php 
        if ($album->isDynamic()) {
            $params = $album->getSearchParams();
            $search = new SearchEngine(true);
            $search->setSearchParams($params);
            $images = $search->getImages(0);
            $thumb = $album->get('thumb');
            $imagelist = array();
            foreach ($images as $imagerow) {
                $folder = $imagerow['folder'];
                $filename = $imagerow['filename'];
                $imagelist[] = '/' . $folder . '/' . $filename;
            }
            if (count($imagelist) == 0) {
                $subalbums = $search->getAlbums(0);
                foreach ($subalbums as $folder) {
                    $newalbum = new Album($gallery, $folder);
                    if (!$newalbum->isDynamic()) {
                        $images = $newalbum->getImages(0);
                        foreach ($images as $filename) {
                            $imagelist[] = '/' . $folder . '/' . $filename;
                        }
                    }
                }
            }
            foreach ($imagelist as $imagepath) {
                $list = explode('/', $imagepath);
                $filename = $list[count($list) - 1];
                unset($list[count($list) - 1]);
                $folder = implode('/', $list);
                $albumx = new Album($gallery, $folder);
                $image = newImage($albumx, $filename);
                $selected = $imagepath == $thumb;
                echo "\n<option";
                if ($showThumb) {
                    echo " class=\"thumboption\"";
                    echo " style=\"background-image: url(" . html_encode($image->getSizedImage(80)) . "); background-repeat: no-repeat;\"";
                }
                echo " value=\"" . $imagepath . "\"";
                if ($selected) {
                    echo " selected=\"selected\"";
                }
                echo ">" . $image->getTitle();
                echo " ({$imagepath})";
                echo "</option>";
            }
        } else {
            $images = $album->getImages();
            if (count($images) == 0 && $album->getNumAlbums() > 0) {
                $imagearray = array();
                $albumnames = array();
                $strip = strlen($album->name) + 1;
                $subIDs = getAllSubAlbumIDs($album->name);
                if (!is_null($subIDs)) {
                    foreach ($subIDs as $ID) {
                        $albumnames[$ID['id']] = $ID['folder'];
                        $query = 'SELECT `id` , `albumid` , `filename` , `title` FROM ' . prefix('images') . ' WHERE `albumid` = "' . $ID['id'] . '"';
                        $imagearray = array_merge($imagearray, query_full_array($query));
                    }
                    foreach ($imagearray as $imagerow) {
                        $filename = $imagerow['filename'];
                        $folder = $albumnames[$imagerow['albumid']];
                        $imagepath = substr($folder, $strip) . '/' . $filename;
                        if (substr($imagepath, 0, 1) == '/') {
                            $imagepath = substr($imagepath, 1);
                        }
                        $albumx = new Album($gallery, $folder);
                        $image = newImage($albumx, $filename);
                        if (is_valid_image($filename)) {
                            $selected = $imagepath == $thumb;
                            echo "\n<option";
                            if ($gallery->getThumbSelectImages()) {
                                echo " class=\"thumboption\"";
                                echo " style=\"background-image: url(" . html_encode($image->getSizedImage(80)) . "); background-repeat: no-repeat;\"";
                            }
                            echo " value=\"" . $imagepath . "\"";
                            if ($selected) {
                                echo " selected=\"selected\"";
                            }
                            echo ">" . $image->getTitle();
                            echo " ({$imagepath})";
                            echo "</option>";
                        }
                    }
                }
            } else {
                foreach ($images as $filename) {
                    $image = newImage($album, $filename);
                    $selected = $filename == $album->get('thumb');
                    if (is_valid_image($filename)) {
                        echo "\n<option";
                        if ($gallery->getThumbSelectImages()) {
                            echo " class=\"thumboption\"";
                            echo " style=\"background-image: url(" . html_encode($image->getSizedImage(80)) . "); background-repeat: no-repeat;\"";
                        }
                        echo " value=\"" . $filename . "\"";
                        if ($selected) {
                            echo " selected=\"selected\"";
                        }
                        echo ">" . $image->getTitle();
                        if ($filename != $image->getTitle()) {
                            echo " ({$filename})";
                        }
                        echo "</option>";
                    }
                }
            }
        }
        ?>
						</select>
						</td>
					</tr>
		<?php 
    }
    ?>
	<tr valign="top">
		<td class="topalign-nopadding"><br /><?php 
    echo gettext("Codeblocks:");
    ?>
</td>
		<td>
		<br />
			<div class="tabs">
				<ul class="tabNavigation">
					<li><a href="#first"><?php 
    echo gettext("Codeblock 1");
    ?>
</a></li>
					<li><a href="#second"><?php 
    echo gettext("Codeblock 2");
    ?>
</a></li>
					<li><a href="#third"><?php 
    echo gettext("Codeblock 3");
    ?>
</a></li>
				</ul>
					<?php 
    $getcodeblock = $album->getCodeblock();
    if (!empty($getcodeblock)) {
        $codeblock = unserialize($getcodeblock);
    } else {
        $codeblock[1] = "";
        $codeblock[2] = "";
        $codeblock[3] = "";
    }
    ?>
				<div id="first">
					<textarea name="<?php 
    echo $prefix;
    ?>
codeblock1" id="codeblock1<?php 
    echo $suffix;
    ?>
" rows="40" cols="60"><?php 
    echo html_encode($codeblock[1]);
    ?>
</textarea>
				</div>
				<div id="second">
					<textarea name="<?php 
    echo $prefix;
    ?>
codeblock2" id="codeblock2<?php 
    echo $suffix;
    ?>
" rows="40" cols="60"><?php 
    echo html_encode($codeblock[2]);
    ?>
</textarea>
				</div>
				<div id="third">
					<textarea name="<?php 
    echo $prefix;
    ?>
codeblock3" id="codeblock3<?php 
    echo $suffix;
    ?>
" rows="40" cols="60"><?php 
    echo html_encode($codeblock[3]);
    ?>
</textarea>
				</div>
			</div>
		</td>
	</tr>
</table>
			</td>
			<?php 
    $bglevels = array('#fff', '#f8f8f8', '#efefef', '#e8e8e8', '#dfdfdf', '#d8d8d8', '#cfcfcf', '#c8c8c8');
    ?>
			<td valign="top">
				<h2 class="h2_bordered_edit"><?php 
    echo gettext("General");
    ?>
</h2>
				<div class="box-edit">

						<label class="checkboxlabel">
							<input type="checkbox" name="<?php 
    echo $prefix;
    ?>
Published" value="1" <?php 
    if ($album->getShow()) {
        echo ' checked="checked"';
    }
    ?>
 />
							<?php 
    echo gettext("Published");
    ?>
						</label>
						<label class="checkboxlabel">
							<input type="checkbox" name="<?php 
    echo $prefix . 'allowcomments';
    ?>
" value="1" <?php 
    if ($album->getCommentsAllowed()) {
        echo ' checked="checked"';
    }
    ?>
 />
							<?php 
    echo gettext("Allow Comments");
    ?>
						</label>
						<?php 
    $hc = $album->get('hitcounter');
    if (empty($hc)) {
        $hc = '0';
    }
    ?>
						<label class="checkboxlabel">
							<input type="checkbox" name="<?php 
    echo $prefix;
    ?>
reset_hitcounter" />
							<?php 
    echo sprintf(gettext("Reset hitcounter (%u hits)"), $hc);
    ?>
						</label>
						<?php 
    $tv = $album->get('total_value');
    $tc = $album->get('total_votes');
    if ($tc > 0) {
        $hc = $tv / $tc;
        ?>
							<label class="checkboxlabel">
								<input type="checkbox" id="reset_rating<?php 
        echo $suffix;
        ?>
" name="<?php 
        echo $prefix;
        ?>
reset_rating" value="1" />
								<?php 
        printf(gettext('Reset rating (%u stars)'), $hc);
        ?>
							</label>
							<?php 
    } else {
        ?>
									<label class="checkboxlabel">
										<input type="checkbox" name="<?php 
        echo $prefix;
        ?>
reset_rating" value="1" disabled="disabled"/>
										<?php 
        echo gettext('Reset rating (unrated)');
        ?>
									</label>
							<?php 
    }
    ?>

					<br clear="all" />
				</div>
				<!-- **************** Move/Copy/Rename ****************** -->
				<h2 class="h2_bordered_edit"><?php 
    echo gettext("Utilities");
    ?>
</h2>
				<div class="box-edit">

						<label class="checkboxlabel">
							<input type="radio" id="a-<?php 
    echo $prefix;
    ?>
move" name="a-<?php 
    echo $prefix;
    ?>
MoveCopyRename" value="move"
								onclick="toggleAlbumMoveCopyRename('<?php 
    echo $prefix;
    ?>
', 'movecopy');"/>
							<?php 
    echo gettext("Move");
    ?>
						</label>

						<label class="checkboxlabel">
							<input type="radio" id="a-<?php 
    echo $prefix;
    ?>
copy" name="a-<?php 
    echo $prefix;
    ?>
MoveCopyRename" value="copy"
								onclick="toggleAlbumMoveCopyRename('<?php 
    echo $prefix;
    ?>
', 'movecopy');"/>
							<?php 
    echo gettext("Copy");
    ?>
						</label>

						<label class="checkboxlabel">
							<input type="radio" id="a-<?php 
    echo $prefix;
    ?>
rename" name="a-<?php 
    echo $prefix;
    ?>
MoveCopyRename" value="rename"
								onclick="toggleAlbumMoveCopyRename('<?php 
    echo $prefix;
    ?>
', 'rename');"/>
							<?php 
    echo gettext("Rename Folder");
    ?>
						</label>
						<label class="checkboxlabel">
								<input type="radio" id="Delete-<?php 
    echo $prefix;
    ?>
" name="a-<?php 
    echo $prefix;
    ?>
MoveCopyRename" value="delete"
									onclick="image_deleteconfirm(this,'<?php 
    echo $prefix;
    ?>
',deleteAlbum1)" />
							<?php 
    echo gettext("Delete album");
    ?>
						</label>
						<br clear="all" />
						<div class="deletemsg" id="deletemsg<?php 
    echo $prefix;
    ?>
"	style="padding-top: .5em; padding-left: .5em; color: red; display: none">
						<?php 
    echo gettext('Album will be deleted when changes are applied.');
    ?>
						<p class="buttons"><a	href="javascript:toggleMoveCopyRename('<?php 
    echo $prefix;
    ?>
', '');"><img src="images/reset.png" alt="" /><?php 
    echo gettext("Cancel");
    ?>
</a></p>
						</div>
					<div id="a-<?php 
    echo $prefix;
    ?>
movecopydiv" style="padding-top: .5em; padding-left: .5em; display: none;">
						<?php 
    echo gettext("to:");
    ?>
						<select id="a-<?php 
    echo $prefix;
    ?>
albumselectmenu" name="a-<?php 
    echo $prefix;
    ?>
albumselect" onchange="">
							<?php 
    $exclude = $album->name;
    if (count(explode('/', $exclude)) > 1 && zp_loggedin(MANAGE_ALL_ALBUM_RIGHTS)) {
        ?>
								<option value="" selected="selected">/</option>
								<?php 
    }
    foreach ($mcr_albumlist as $fullfolder => $albumtitle) {
        // don't allow copy in place or to subalbums
        if ($fullfolder == dirname($exclude) || $fullfolder == $exclude || strpos($fullfolder, $exclude . '/') === 0) {
            $disabled = ' disabled="disabled"';
        } else {
            $disabled = '';
        }
        // Get rid of the slashes in the subalbum, while also making a subalbum prefix for the menu.
        $singlefolder = $fullfolder;
        $saprefix = '';
        $salevel = 0;
        while (strstr($singlefolder, '/') !== false) {
            $singlefolder = substr(strstr($singlefolder, '/'), 1);
            $saprefix = "&nbsp; &nbsp;&nbsp;" . $saprefix;
            $salevel = ($salevel + 1) % 8;
        }
        echo '<option value="' . $fullfolder . '"' . ($salevel > 0 ? ' style="background-color: ' . $bglevels[$salevel] . ';"' : '') . "{$disabled}>" . $saprefix . $singlefolder . "</option>\n";
    }
    ?>
						</select>
						<br clear="all" /><br />
						<p class="buttons">
							<a href="javascript:toggleAlbumMoveCopyRename('<?php 
    echo $prefix;
    ?>
', '');"><img src="images/reset.png" alt="" /><?php 
    echo gettext("Cancel");
    ?>
</a>
						</p>
					</div>
					<div id="a-<?php 
    echo $prefix;
    ?>
renamediv" style="padding-top: .5em; padding-left: .5em; display: none;">
						<?php 
    echo gettext("to:");
    ?>
						<input name="a-<?php 
    echo $prefix;
    ?>
renameto" type="text" value="<?php 
    echo basename($album->name);
    ?>
"/><br />
						<br clear="all" />
						<p class="buttons">
						<a href="javascript:toggleAlbumMoveCopyRename('<?php 
    echo $prefix;
    ?>
', '');"><img src="images/reset.png" alt="" /><?php 
    echo gettext("Cancel");
    ?>
</a>
						</p>
					</div>
					<span style="line-height: 0em;"><br clear="all" /></span>
					<?php 
    echo zp_apply_filter('edit_album_utilities', '', $album, $prefix);
    ?>
					<span style="line-height: 0em;"><br clear="all" /></span>
					</div>
					<h2 class="h2_bordered_edit"><?php 
    echo gettext("Tags");
    ?>
</h2>
					<div class="box-edit-unpadded">
						<?php 
    $tagsort = getTagOrder();
    tagSelector($album, 'tags_' . $prefix, false, $tagsort);
    ?>
					</div>
			</td>
		</tr>
	</table>
	<?php 
    if ($album->isDynamic()) {
        ?>
		<table>
			<tr>
				<td align="left" valign="top" width="150"><?php 
        echo gettext("Dynamic album search:");
        ?>
</td>
				<td>
					<table class="noinput">
						<tr>
							<td><?php 
        echo html_encode(urldecode($album->getSearchParams()));
        ?>
</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	<?php 
    }
    ?>


<br clear="all" />
	<span class="buttons">
		<a title="<?php 
    echo gettext('Back to the album list');
    ?>
" href="<?php 
    echo WEBPATH . '/' . ZENFOLDER . '/admin-edit.php?page=edit' . $parent;
    ?>
">
		<img	src="images/arrow_left_blue_round.png" alt="" />
		<strong><?php 
    echo gettext("Back");
    ?>
</strong>
		</a>
		<button type="submit" title="<?php 
    echo gettext("Apply");
    ?>
">
		<img	src="images/pass.png" alt="" />
		<strong><?php 
    echo gettext("Apply");
    ?>
</strong>
		</button>
		<button type="reset" title="<?php 
    echo gettext("Reset");
    ?>
" onclick="javascript:$('.deletemsg').hide();">
		<img	src="images/fail.png" alt="" />
		<strong><?php 
    echo gettext("Reset");
    ?>
</strong>
		</button>
		<div class="floatright">
		<?php 
    if (!$album->isDynamic()) {
        ?>
			<button type="button" title="<?php 
        echo gettext('New subalbum');
        ?>
" onclick="javascript:newAlbum('<?php 
        echo pathurlencode($album->name);
        ?>
',true);">
			<img src="images/folder.png" alt="" />
			<strong><?php 
        echo gettext('New subalbum');
        ?>
</strong>
			</button>
			<?php 
    }
    ?>
		<a title="<?php 
    echo gettext('View Album');
    ?>
" href="<?php 
    echo WEBPATH . "/index.php?album=" . pathurlencode($album->getFolder());
    ?>
">
		<img src="images/view.png" alt="" />
		<strong><?php 
    echo gettext('View Album');
    ?>
</strong>
		</a>
		</div>
	</span>
<br clear="all" />
<?php 
}