1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994
|
<?php
/*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2006 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*
* $Id: view_album.php 14311 2006-08-14 07:49:09Z jenst $
*/
?>
<?php
require_once(dirname(__FILE__) . '/init.php');
list($page,$votes, $Vote) = getRequestVar(array('page', 'votes', 'Vote'));
// Hack check and prevent errors
if (empty($gallery->session->albumName) || !$gallery->user->canReadAlbum($gallery->album) || !$gallery->album->isLoaded()) {
$gallery->session->gRedirDone = false;
header("Location: " . makeAlbumHeaderUrl('', '', array('gRedir' => 1)));
return;
}
$gallery->session->offlineAlbums[$gallery->album->fields["name"]]=true;
$page = intval($page);
if (empty($page) || $page < 0) {
if (isset($gallery->session->albumPage[$gallery->album->fields['name']])) {
$page = $gallery->session->albumPage[$gallery->album->fields["name"]];
} else {
$page = 1;
}
} else {
$gallery->session->albumPage[$gallery->album->fields["name"]] = $page;
}
$albumName = $gallery->session->albumName;
if (!isset($gallery->session->viewedAlbum[$albumName]) && !$gallery->session->offline) {
$gallery->session->viewedAlbum[$albumName] = 1;
$gallery->album->incrementClicks();
}
$rows = $gallery->album->fields["rows"];
$cols = $gallery->album->fields["cols"];
list ($numPhotos, $numAlbums, $visibleItems) = $gallery->album->numVisibleItems($gallery->user, 1);
$numVisibleItems = $numPhotos + $numAlbums;
$perPage = $rows * $cols;
$maxPages = max(ceil(($numPhotos + $numAlbums) / $perPage), 1);
if ($page > $maxPages) {
$page = $maxPages;
}
$start = ($page - 1) * $perPage + 1;
$end = $start + $perPage;
$nextPage = $page + 1;
if ($nextPage > $maxPages) {
$nextPage = 1;
$last = 1;
}
$previousPage = $page - 1;
if ($previousPage == 0) {
$previousPage = $maxPages;
$first = 1;
}
if (!empty($Vote)) {
if ($gallery->album->getPollScale() == 1 && $gallery->album->getPollType() != "rank") {
for ($index=$start; $index < $start+$perPage; $index ++) {
$id=$gallery->album->getPhotoId($index);
if (!$votes[$id]) {
$votes[$id]=null;
}
}
}
saveResults($votes);
}
$bordercolor = $gallery->album->fields["bordercolor"];
$imageCellWidth = floor(100 / $cols) . "%";
$navigator["page"] = $page;
$navigator["pageVar"] = "page";
$navigator["maxPages"] = $maxPages;
$navigator["fullWidth"] = "100";
$navigator["widthUnits"] = "%";
$navigator["url"] = makeAlbumUrl($gallery->session->albumName);
$navigator["spread"] = 5;
$navigator["bordercolor"] = $bordercolor;
$fullWidth = $navigator["fullWidth"] . $navigator["widthUnits"];
$upArrowURL = '<img src="' . getImagePath('nav_home.gif') . '" width="13" height="11" ' .
'alt="' . gTranslate('core', "navigate UP") .'" title="' . gTranslate('core', "navigate UP") .'" border="0">';
if ($gallery->album->fields['returnto'] != 'no') {
foreach ($gallery->album->getParentAlbums() as $navAlbum) {
$breadcrumb["text"][] = $navAlbum['prefixText'] .': <a class="bread" href="'. $navAlbum['url'] . '">'.
$navAlbum['title'] . " " . $upArrowURL . "</a>";
}
}
$breadcrumb["bordercolor"] = $bordercolor;
global $GALLERY_EMBEDDED_INSIDE;
if (!$GALLERY_EMBEDDED_INSIDE) {
doctype();
?>
<html>
<head>
<title><?php echo $gallery->app->galleryTitle ?> :: <?php echo $gallery->album->fields["title"] ?></title>
<?php common_header();
/* RSS */
if ($gallery->app->rssEnabled == "yes" && !$gallery->session->offline) {
$title = sprintf(gTranslate('core', "%s RSS"), $gallery->app->galleryTitle . " :: " . $gallery->album->fields["title"]);
$rssHref = $gallery->app->photoAlbumURL . "/rss.php?set_albumName=" . $gallery->album->fields["name"];
?>
<link rel="alternate" title="<?php echo $title; ?>" href="<?php echo $rssHref; ?>" type="application/rss+xml">
<?php
}
/* prefetching/navigation */
if (!isset($first)) { ?>
<link rel="first" href="<?php echo makeAlbumUrl($gallery->session->albumName, '', array('page' => 1)) ?>" >
<link rel="prev" href="<?php echo makeAlbumUrl($gallery->session->albumName, '', array('page' => $previousPage)) ?>" >
<?php }
if (!isset($last)) { ?>
<link rel="next" href="<?php echo makeAlbumUrl($gallery->session->albumName, '', array('page' => $nextPage)) ?>" >
<link rel="last" href="<?php echo makeAlbumUrl($gallery->session->albumName, '', array('page' => $maxPages)) ?>" >
<?php } if ($gallery->album->isRoot() &&
(!$gallery->session->offline ||
isset($gallery->session->offlineAlbums["albums.php"]))) { ?>
<link rel="up" href="<?php echo makeAlbumUrl(); ?>" >
<?php
} else if (!$gallery->session->offline ||
isset($gallery->session->offlineAlbums[$pAlbum->fields['parentAlbumName']])) { ?>
<link rel="up" href="<?php echo makeAlbumUrl($gallery->album->fields['parentAlbumName']); ?>" >
<?php }
if (!$gallery->session->offline ||
isset($gallery->session->offlineAlbums["albums.php"])) { ?>
<link rel="top" href="<?php echo makeGalleryUrl('albums.php', array('set_albumListPage' => 1)) ?>" >
<?php } ?>
<style type="text/css">
<?php
// the link colors have to be done here to override the style sheet
if ($gallery->album->fields["linkcolor"]) {
?>
A:link, A:visited, A:active
{ color: <?php echo $gallery->album->fields['linkcolor'] ?>; }
A:hover
{ color: #ff6600; }
<?php
}
if ($gallery->album->fields["bgcolor"]) {
echo "BODY { background-color:".$gallery->album->fields['bgcolor']."; }";
}
if (isset($gallery->album->fields['background']) && $gallery->album->fields['background']) {
echo "BODY { background-image:url(".$gallery->album->fields['background']."); } ";
}
if ($gallery->album->fields["textcolor"]) {
echo "BODY, TD {color:".$gallery->album->fields['textcolor']."; }";
echo ".head {color:".$gallery->album->fields['textcolor']."; }";
echo ".headbox {background-color:".$gallery->album->fields['bgcolor']."; }";
}
?>
</style>
</head>
<body dir="<?php echo $gallery->direction ?>">
<?php
}
includeHtmlWrap("album.header");
if (!$gallery->session->offline) { ?>
<script language="javascript1.2" type="text/JavaScript">
<!-- //
var statusWin;
function showProgress() {
statusWin = <?php echo popup_status("progress_uploading.php"); ?>
}
function hideProgress() {
if (typeof(statusWin) != "undefined") {
statusWin.close();
statusWin = void(0);
}
}
function hideProgressAndReload() {
hideProgress();
location.reload();
}
//-->
</script>
<?php }
$adminText = '';
$albums_str = gTranslate('core', "1 sub-album", "%d sub-albums", $numAlbums, gTranslate('core', "No albums"));
$imags_str = gTranslate('core', "1 image", "%d images", $numPhotos, gTranslate('core', "no images"));
$pages_str = gTranslate('core', "1 page", "%d pages", $maxPages, gTranslate('core', "0 pages"));
if ($numAlbums && $maxPages > 1) {
$adminText .= sprintf(gTranslate('core', "%s and %s in this album on %s"),
$albums_str, $imags_str, $pages_str);
} else if ($numAlbums) {
$adminText .= sprintf(gTranslate('core', "%s and %s in this album"),
$albums_str, $imags_str);
} else if ($maxPages > 1) {
$adminText .= sprintf(gTranslate('core', "%s in this album on %s"),
$imags_str, $pages_str);
} else {
$adminText .= sprintf(gTranslate('core', "%s in this album"),
$imags_str);
}
if ($gallery->user->canWriteToAlbum($gallery->album) &&
!$gallery->session->offline) {
$hidden = $gallery->album->numHidden();
$verb = gTranslate('core', "%s are hidden");
if ($hidden == 1) {
$verb = gTranslate('core', "%s is hidden");
}
if ($hidden) {
$adminText .= "(".sprintf($verb, $hidden).")";
}
}
/* admin items for drop-down menu */
$adminOptions = array(
'add_photos' => array(
'name' => gTranslate('core', "Add photos"),
'requirements' => array('canAddToAlbum'),
'action' => 'popup',
'value' => makeGalleryUrl('add_photos_frame.php',
array('set_albumName' => $gallery->session->albumName, 'type' => 'popup'))),
'delete_root_album' => array(
'name' => gTranslate('core', "Delete this album"),
'requirements' => array('canDeleteAlbum', 'albumIsRoot'),
'action' => 'popup',
'value' => makeGalleryUrl('delete_album.php', array('type' => 'popup'))),
'delete_sub_album' => array(
'name' => gTranslate('core', "Delete this (sub)album"),
'requirements' => array('canDeleteAlbum', '!albumIsRoot'),
'action' => 'popup',
'value' => makeGalleryUrl('delete_photo.php',
array('set_albumName' => $gallery->album->fields["parentAlbumName"],
'type' => 'popup',
'id' => $gallery->album->fields["name"],
'albumDelete' => true))),
'rename_album' => array(
'name' => gTranslate('core', "Rename album"),
'requirements' => array('isAdminOrAlbumOwner'),
'action' => 'popup',
'value' => makeGalleryUrl('rename_album.php', array(
'set_albumName' => $gallery->session->albumName,
'type' => 'popup', 'useLoad' => 1))),
'nested_album' => array(
'name' => gTranslate('core', "New nested album"),
'requirements' => array('canCreateSubAlbum', 'notOffline'),
'action' => 'url',
'value' => doCommand('new-album',
array('parentName' => $gallery->session->albumName), 'view_album.php')),
'edit_captions' => array(
'name' => gTranslate('core', "Edit captions"),
'requirements' => array('canChangeText','notOffline'),
'action' => 'url',
'value' => makeGalleryUrl('captionator.php',
array('set_albumName' => $gallery->session->albumName, 'page' => $page, 'perPage' => $perPage))),
'sort_items' => array(
'name' => gTranslate('core', "Sort items"),
'requirements' => array('canWriteToAlbum', 'photosExist'),
'action' => 'popup',
'value' => makeGalleryUrl('sort_album.php',
array('set_albumName' => $gallery->session->albumName, 'type' => 'popup'))),
'resize_all' => array(
'name' => gTranslate('core', "Resize all"),
'requirements' => array('canWriteToAlbum', 'photosExist'),
'action' => 'popup',
'value' => makeGalleryUrl('resize_photo.php',
array('set_albumName' => $gallery->session->albumName, 'index' => 'all', 'type' => 'popup'))),
'rebuild_thumbs' => array(
'name' => gTranslate('core', "Rebuild thumbs"),
'requirements' => array('canWriteToAlbum', 'photosExist'),
'action' => 'popup',
'value' => doCommand('remake-thumbnail',
array('set_albumName' => $gallery->session->albumName, 'index' => 'all', 'type' => 'popup'))),
'properties' => array(
'name' => gTranslate('core', "Properties"),
'requirements' => array('canWriteToAlbum'),
'action' => 'popup',
'value' => makeGalleryUrl('edit_appearance.php',
array('set_albumName' => $gallery->session->albumName, 'type' => 'popup'))),
'rearrange' => array(
'name' => gTranslate('core', "Rearrange items"),
'requirements' => array('canWriteToAlbum', 'photosExist'),
'action' => 'popup',
'value' => makeGalleryUrl('rearrange.php',
array('set_albumName' => $gallery->session->albumName, 'type' => 'popup'))),
'permissions' => array(
'name' => gTranslate('core', "Permissions"),
'requirements' => array('isAdminOrAlbumOwner'),
'action' => 'popup',
'value' => makeGalleryUrl('album_permissions.php',
array('set_albumName' => $gallery->session->albumName, 'type' => 'popup'))),
'poll_results' => array(
'name' => gTranslate('core', "Poll results"),
'requirements' => array('isAdminOrAlbumOwner'),
'action' => 'url',
'value' => makeGalleryUrl('poll_results.php',
array('set_albumName' => $gallery->session->albumName,))),
'poll_reset' => array(
'name' => gTranslate('core', "Poll reset"),
'requirements' => array('isAdminOrAlbumOwner'),
'action' => 'popup',
'value' => makeGalleryUrl('reset_votes.php',
array('set_albumName' => $gallery->session->albumName, 'type' => 'popup'))),
'view_comments' => array(
'name' => gTranslate('core', "View comments"),
'requirements' => array('isAdminOrAlbumOwner', 'allowComments', 'comments_enabled', 'hasComments'),
'action' => 'url',
'value' => makeGalleryUrl('view_comments.php',
array('set_albumName' => $gallery->session->albumName))),
'watermark_album' => array(
'name' => gTranslate('core', "Watermark album"),
'requirements' => array('isAdminOrAlbumOwner','photosExist','watermarkingEnabled'),
'action' => 'popup',
'value' => makeGalleryUrl('watermark_album.php',
array('set_albumName' => $gallery->session->albumName, 'type' => 'popup'))),
);
/* sort the drop-down array by translated name */
array_sort_by_fields($adminOptions, 'name', 'asc', true, true);
$adminOptionHTML = '';
$adminJavaScript = '';
/* determine which options to include in admin drop-down menu */
if (!$gallery->session->offline) {
foreach ($adminOptions as $key => $data) {
$enabled = true;
while ($enabled && $test = array_shift($data['requirements'])) {
$success = testRequirement($test);
if (!$success) {
$enabled = false;
}
}
if ($enabled) {
$adminOptionHTML .= "\t\t<option value=\"$key\">${data['name']}</option>\n";
$adminJavaScript .= "adminOptions.$key = new Object;\n";
$adminJavaScript .= "adminOptions.$key.action = \"${data['action']}\";\n";
/* We need to pass un-html-entityified URLs to the JavaScript
* This line effectively reverses htmlentities() */
$decodeHtml = unhtmlentities($data['value']);
$adminJavaScript .= "adminOptions.$key.value = \"${decodeHtml}\";\n";
}
}
}
$adminCommands = '';
$adminJSFrame = '';
/* build up drop-down menu and related javascript */
if (!empty($adminOptionHTML)) {
$adminJSFrame .= "<script language=\"javascript1.2\" type=\"text/JavaScript\">\n"
. "adminOptions = new Object;\n"
. $adminJavaScript
. "\nfunction execAdminOption() {\n"
. "\tkey = document.forms.admin_options_form.admin_select.value;\n"
. "\tdocument.forms.admin_options_form.admin_select.selectedIndex = 0;\n"
. "\tdocument.forms.admin_options_form.admin_select.blur();\n"
. "\tswitch (adminOptions[key].action) {\n"
. "\tcase 'popup':\n"
. "\t\tnw = window.open(adminOptions[key].value, 'Edit', 'height=500,width=600,location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes');\n"
. "\t\tnw.opener=self;\n"
. "\t\tbreak;\n"
. "\tcase 'url':\n"
. "\t\tdocument.location = adminOptions[key].value;\n"
. "\t\tbreak;\n"
. "\t}\n"
. "}\n"
. "</script>\n\n";
$iconElements[] = "\n\t<select class=\"adminform\" name=\"admin_select\" onChange=\"execAdminOption()\">\n"
. "\t\t<option value=\"\">« " . gTranslate('core', 'Album Actions') . " »</option>\n"
. $adminOptionHTML
. "\t</select>\n";
}
if ($gallery->album->fields["slideshow_type"] != "off" &&
($numPhotos != 0 || ($numVisibleItems != 0 && $gallery->album->fields['slideshow_recursive'] == "yes"))) {
$iconText = getIconText('display.gif', gTranslate('core', "slideshow"));
$iconElements[] = '<a href="'
. makeGalleryUrl("slideshow.php",
array("set_albumName" => $albumName)) .'">'. $iconText .'</a>';
}
/* User is allowed to view ALL comments */
if ( $numVisibleItems != 0 && ($gallery->app->comments_enabled == 'yes' && $gallery->album->lastCommentDate("no") != -1) &&
((isset($gallery->app->comments_overview_for_all) && $gallery->app->comments_overview_for_all == "yes") ||
$gallery->user->canViewComments($gallery->album))) {
$iconText = getIconText('showcomment.gif', gTranslate('core', "view comments"));
$iconElements[] = '<a href="'.
makeGalleryUrl("view_comments.php",
array("set_albumName" => $gallery->session->albumName)) . '">'. $iconText .'</a>';
}
if (!$GALLERY_EMBEDDED_INSIDE && !$gallery->session->offline) {
if ($gallery->user->isLoggedIn()) {
$iconText = getIconText('exit.gif', gTranslate('core', "logout"));
$iconElements[] = '<a href="'.
doCommand("logout", array(), "view_album.php",
array("page" => $page, 'set_albumName' => $albumName)) .'">'. $iconText .'</a>';
} else {
$iconText = getIconText('identity.gif', gTranslate('core', "login"));
$iconElements[] = popup_link($iconText, "login.php", false, true, 500, 500);
}
}
$adminbox["text"] = $adminText;
$adminbox["commands"] = $adminCommands . makeIconMenu($iconElements, 'right');
$adminbox["bordercolor"] = $bordercolor;
if (!empty($adminOptionHTML)) {
print $adminJSFrame;
}
includeLayout('navtablebegin.inc');
includeLayout('adminbox.inc');
?>
<!-- top nav -->
<?php
$breadcrumb["top"] = true;
$breadcrumb['bottom'] = false;
if (!empty($breadcrumb["text"]) || $gallery->user->isLoggedIn()) {
includeLayout('navtablemiddle.inc');
includeLayout('breadcrumb.inc');
}
if ($navigator["maxPages"] > 1) {
includeLayout('navtablemiddle.inc');
includeLayout('navigator.inc');
}
includeLayout('navtableend.inc');
#-- if borders are off, just make them the bgcolor ----
$borderwidth = $gallery->album->fields["border"];
if ($borderwidth == 0) {
$bordercolor = $gallery->album->fields["bgcolor"];
$borderwidth = 1;
}
if ($page == 1 && !empty($gallery->album->fields["summary"])) {
echo '<div align="center"><p class="vasummary">'. $gallery->album->fields["summary"] . '</p></div>';
}
if (($gallery->album->getPollType() == "rank") && canVote()) {
$my_choices = array();
if ( $gallery->album->fields["votes"]) {
foreach ($gallery->album->fields["votes"] as $id => $image_votes) {
$index=$gallery->album->getIndexByVotingId($id);
if ($index < 0) {
// image has been deleted!
unset($gallery->album->fields["votes"][$id]);
continue;
}
if (isset($image_votes[getVotingID()])) {
$my_choices[$image_votes[getVotingID()]] = $id;
}
}
}
if (sizeof($my_choices) > 0) {
ksort($my_choices);
$nv_pairs = $gallery->album->getVoteNVPairs();
$va_poll_box1 = gTranslate('core', "Your votes are :");
$pollInfoTable = new galleryTable();
foreach ($my_choices as $key => $id) {
$index = $gallery->album->getIndexByVotingId($id);
$pollInfoTable->addElement(array('content' => "- ". $nv_pairs[$key]["name"]));
$pollInfoTable->addElement(array('content' => ':'));
if ($gallery->album->isAlbum($index)) {
$albumName = $gallery->album->getAlbumName($index);
$myAlbum = new Album();
$myAlbum->load($albumName);
$pollInfoTable->addElement(array('content' =>
galleryLink(
makeAlbumUrl($albumName),
sprintf(gTranslate('core', "Album: %s"), $myAlbum->fields['title']))
));
}
else {
$desc = $gallery->album->getCaption($index);
if (trim($desc) == '') {
$desc = $gallery->album->getPhotoId($index);
}
$photoId = str_replace('item.', '', $id);
$pollInfoTable->addElement(array('content' =>
galleryLink(makeAlbumUrl($gallery->session->albumName, $photoId), $desc)
));
}
}
$va_poll_box1 .= $pollInfoTable->render();
echo "\n<div class=\"g-va-poll-box1\">\n";
echo $va_poll_box1;
echo "\n</div>\n";
}
}
list($va_poll_result, $results) = showResultsGraph( $gallery->album->getPollNumResults());
if ($gallery->album->getPollShowResults()) {
echo $va_poll_result;
}
if(!empty($results) && testRequirement('isAdminOrAlbumOwner')) {
echo galleryLink(
makeGalleryUrl("poll_results.php", array("set_albumName" => $gallery->session->albumName)),
gTranslate('core', "[ See full poll results ]"),
array('class' => 'admin'));
}
?>
<script language="javascript1.2" type="text/JavaScript">
function chooseOnlyOne(i, form_pos, scale) {
for(var j=0;j<scale;j++) {
if(j != i) {
eval("document.vote_form['votes["+j+"]']["+form_pos+"].checked=false");
}
}
}
</script>
<?php
echo makeFormIntro('view_album.php',
array('name' => 'vote_form', 'style' => 'margin-bottom: 0px;'));
if (canVote()) {
$nv_pairs = $gallery->album->getVoteNVPairs();
if ($gallery->album->getPollScale() == 1) {
$options = $nv_pairs[0]["name"];
}
else {
/** note to translators:
* This produces (in English) a list of the form: "a, b, c or d". Correct translation
* of ", " and " or " should produce a version that makes sense in your language.
*/
$options = '';
for ($count=0; $count < $gallery->album->getPollScale()-2 ; $count++) {
$options .= $nv_pairs[$count]["name"] .gTranslate('core', ", ");
}
$options .= $nv_pairs[$count++]["name"] .gTranslate('core', " or ");
$options .= $nv_pairs[$count]["name"];
}
$va_poll_box3 = sprintf(gTranslate('core', "To vote for an image, click on %s."), $options);
$va_poll_box3 .= ' ';
$va_poll_box3 .= sprintf(gTranslate('core', "You MUST click on %s for your vote to be recorded."), "<b>".gTranslate('core', "Vote")."</b>");
$va_poll_box3 .= ' ';
if ($gallery->album->getPollType() == 'rank') {
$voteCount = $gallery->album->getPollScale();
$va_poll_box3 .= gTranslate('core',
"You have a total of %d vote and can change it later if you wish.",
"You have a total of %d votes and can change them later if you wish.", $voteCount, '', true);
}
else {
$va_poll_box3 .= gTranslate('core', "You can change your votes later, if you wish.");
}
echo "\n<div class=\"g-va-poll-box3\">\n";
echo $va_poll_box3;
echo "\n</div>\n";
?>
<div align="center">
<input type=submit name="Vote" value="<?php print gTranslate('core', "Vote") ?>">
</div>
<?php
}
?>
<!-- image grid table -->
<table border="0" cellspacing="5" cellpadding="0" width="100%" class="vatable" align="center">
<?php
$numPhotos = $gallery->album->numPhotos(1);
$displayCommentLegend = 0; // this determines if we display "* Item contains a comment" at end of page
if ($numPhotos) {
$rowCount = 0;
// Find the correct starting point, accounting for hidden photos
$rowStart = 0;
$cnt = 0;
$form_pos=0; // counts number of images that have votes below, ie withou albums;
$rowStart = $start;
while ($rowCount < $rows) {
/* Do the inline_albumthumb header row */
$visibleItemIndex = $rowStart;
$i = $visibleItemIndex<=$numVisibleItems ? $visibleItems[$visibleItemIndex] : $numPhotos+1;
$j = 1;
$printTableRow = false;
if ($j <= $cols && $i <= $numPhotos) {
$printTableRow = true;
}
while ($j <= $cols && $i <= $numPhotos) {
$j++;
$visibleItemIndex++;
$i = $visibleItemIndex <= $numVisibleItems ? $visibleItems[$visibleItemIndex] : $numPhotos+1;
}
if ($printTableRow) {
}
/* Do the picture row */
$visibleItemIndex = $rowStart;
$i = $visibleItemIndex <= $numVisibleItems ? $visibleItems[$visibleItemIndex] : $numPhotos+1;
$j = 1;
if ($printTableRow) {
echo('<tr>');
}
while ($j <= $cols && $i <= $numPhotos) {
echo("<td align=\"center\" valign=\"top\" class=\"vathumbs\">\n");
//-- put some parameters for the wrap files in the global object ---
$gallery->html_wrap['borderColor'] = $bordercolor;
$borderwidth= $gallery->html_wrap['borderWidth'] = $borderwidth;
$gallery->html_wrap['pixelImage'] = getImagePath('pixel_trans.gif');
if ($gallery->album->isAlbum($i)) {
$scaleTo = 0; //$gallery->album->fields["thumb_size"];
$myAlbum = $gallery->album->getNestedAlbum($i);
list($iWidth, $iHeight) = $myAlbum->getHighlightDimensions($scaleTo);
} else {
unset($myAlbum);
$scaleTo=0; // thumbs already the right
// size for this album
list($iWidth, $iHeight) = $gallery->album->getThumbDimensions($i, $scaleTo);
}
if ($iWidth == 0) {
$iWidth = $gallery->album->fields["thumb_size"];
}
if ($iHeight == 0) {
$iHeight = 100;
}
$gallery->html_wrap['imageWidth'] = $iWidth;
$gallery->html_wrap['imageHeight'] = $iHeight;
$id = $gallery->album->getPhotoId($i);
if ($gallery->album->isMovieByIndex($i)) {
$gallery->html_wrap['imageTag'] = $gallery->album->getThumbnailTag($i);
$gallery->html_wrap['imageHref'] = makeAlbumUrl($gallery->session->albumName, $id);
$frame= $gallery->html_wrap['frame'] = $gallery->album->fields['thumb_frame'];
/*begin backwards compatibility */
$gallery->html_wrap['thumbTag'] = $gallery->html_wrap['imageTag'];
$gallery->html_wrap['thumbHref'] = $gallery->html_wrap['imageHref'];
/*end backwards compatibility*/
list($divCellWidth, $divCellHeight, $padding) = calcVAdivDimension($frame, $iHeight, $iWidth, $borderwidth);
// If there is only one column, we don't need to try and match row heights
if ($cols == 1) {
$padding = 0;
}
echo "<div style=\"padding-top: {$padding}px; padding-bottom:{$padding}px; width: {$divCellWidth}px; height: {$divCellHeight}px;\" align=\"center\" class=\"vafloat2\">\n";
includeHtmlWrap('inline_moviethumb.frame');
} elseif (isset($myAlbum)) {
// We already loaded this album - don't do it again, for performance reasons.
$gallery->html_wrap['imageTag'] = $myAlbum->getHighlightTag($scaleTo,'',gTranslate('core', "Highlight for Album:"). " ". gallery_htmlentities(strip_tags($myAlbum->fields['title'])));
$gallery->html_wrap['imageHref'] = makeAlbumUrl($gallery->album->getAlbumName($i));
$frame= $gallery->html_wrap['frame'] = $gallery->album->fields['album_frame'];
/*begin backwards compatibility */
$gallery->html_wrap['thumbWidth'] = $gallery->html_wrap['imageWidth'];
$gallery->html_wrap['thumbHeight'] = $gallery->html_wrap['imageHeight'];
$gallery->html_wrap['thumbTag'] = $gallery->html_wrap['imageTag'];
$gallery->html_wrap['thumbHref'] = $gallery->html_wrap['imageHref'];
/*end backwards compatibility*/
list($divCellWidth,$divCellHeight, $padding) = calcVAdivDimension($frame, $iHeight, $iWidth, $borderwidth);
echo "<div style=\"padding-top: {$padding}px; padding-bottom:{$padding}px; width: {$divCellWidth}px; height: {$divCellHeight}px;\" align=\"center\" class=\"vafloat2\">\n";
includeHtmlWrap('inline_albumthumb.frame');
} else {
$gallery->html_wrap['imageTag'] = $gallery->album->getThumbnailTag($i);
$gallery->html_wrap['imageHref'] = makeAlbumUrl($gallery->session->albumName, $id);
$frame= $gallery->html_wrap['frame'] = $gallery->album->fields['thumb_frame'];
/*begin backwards compatibility */
$gallery->html_wrap['thumbTag'] = $gallery->html_wrap['imageTag'];
$gallery->html_wrap['thumbHref'] = $gallery->html_wrap['imageHref'];
/*end backwards compatibility*/
list($divCellWidth,$divCellHeight, $padding) = calcVAdivDimension($frame, $iHeight, $iWidth, $borderwidth);
echo "<div style=\"padding-top: {$padding}px; padding-bottom:{$padding}px; width: {$divCellWidth}px; height: {$divCellHeight}px;\" align=\"center\" class=\"vafloat2\">\n";
includeHtmlWrap('inline_photothumb.frame');
}
echo "\n";
echo "</div>\n";
if (canVote()){
if ($gallery->album->fields["poll_type"] == 'rank' && $divCellWidth < 200) {
$divCellWidth=200;
}
}
echo "<div style=\"width: {$divCellWidth}px;\" align=\"center\" class=\"vafloat\">\n";
/* Do the clickable-dimensions row */
if (!strcmp($gallery->album->fields['showDimensions'], 'yes')) {
echo '<span class="dim">';
$photo = $gallery->album->getPhoto($i);
$image = $photo->image;
if (!empty($image) && !$photo->isMovie()) {
$viewFull = $gallery->user->canViewFullImages($gallery->album);
$fullOnly = (isset($gallery->session->fullOnly) &&
!strcmp($gallery->session->fullOnly, 'on') &&
!strcmp($gallery->album->fields['use_fullOnly'], 'yes'));
list($wr, $hr) = $image->getDimensions();
list($wf, $hf) = $image->getRawDimensions();
/* display file sizes if dimensions are identical */
if ($wr == $wf && $hr == $hf && $viewFull && $photo->isResized()) {
$fsr = ' ' . sprintf(gTranslate('core', '%dkB'), (int) $photo->getFileSize(0) >> 10);
$fsf = ' ' . sprintf(gTranslate('core', '%dkB'), (int) $photo->getFileSize(1) >> 10);
} else {
$fsr = '';
$fsf = '';
}
if (($photo->isResized() && !$fullOnly) || !$viewFull) {
echo '<a href="'.
makeAlbumUrl($gallery->session->albumName, $image->name) .
"\">[${wr}x{$hr}${fsr}]</a> ";
}
if ($viewFull) {
echo '<a href="'.
makeAlbumUrl($gallery->session->albumName,
$image->name, array('full' => 1)) .
"\">[${wf}x${hf}${fsf}]</a>";
}
} else {
echo " ";
}
echo '</span>';
}
/* Now do the caption row */
if ($gallery->album->isAlbum($i)) {
$myAlbum = new Album;
$myAlbum->load($gallery->album->getAlbumName($i));
}
else {
$myAlbum = NULL;
}
if ($gallery->album->isAlbum($i)) {
$iWidth = $gallery->album->fields['thumb_size'];
} else {
list($iWidth, $iHeight) = $gallery->album->getThumbDimensions($i);
}
// Caption itself
echo "\n<div align=\"center\" class=\"modcaption\">\n";
$id = $gallery->album->getPhotoId($i);
if ($gallery->album->isHidden($i) && !$gallery->session->offline) {
echo "(" . gTranslate('core', "hidden") .")<br>";
}
$photo = $gallery->album->getPhoto($i);
if ($gallery->user->canWriteToAlbum($gallery->album) &&
$photo->isHighlight() && !$gallery->session->offline) {
echo "(" . gTranslate('core', "highlight") .")<br>";
}
if (isset($myAlbum)) {
$myDescription = $myAlbum->fields['description'];
$buf = '';
$link = '';
if ($gallery->user->canDownloadAlbum($myAlbum) && $myAlbum->numPhotos(1)) {
$iconText = getIconText('compressed.png', gTranslate('core', "Download entire album as archive"), 'yes');
$link = popup_link($iconText, 'download.php?set_albumName='. $gallery->album->getAlbumName($i),false,false,500,500);
}
$buf .="<center><b>";
$buf .= sprintf(gTranslate('core', "Album: %s"),
'<a class="modcaption" href="'. makeAlbumUrl($gallery->album->getAlbumName($i)) .'">'. $myAlbum->fields['title'] .'</a>');
$buf .= "</b> $link</center>";
if ($myDescription != gTranslate('core', "No description") &&
$myDescription != "No description" &&
$myDescription != "") {
$buf = $buf."<br>".$myDescription."";
}
echo $buf;
echo '<div class="fineprint" style="margin-top:3px">';
printf (gTranslate('core', "Last change: %s"), $myAlbum->getLastModificationDate());
echo "\n<br>";
$visItems = array_sum($myAlbum->numVisibleItems($gallery->user));
printf (gTranslate('core', "Contains: %s"), gTranslate('core', "1 item", "%d items", $visItems)) . '. ';
// If comments indication for either albums or both
switch ($gallery->app->comments_indication) {
case "albums":
case "both":
$lastCommentDate = $myAlbum->lastCommentDate(
$gallery->app->comments_indication_verbose);
if ($lastCommentDate > 0) {
print lastCommentString($lastCommentDate, $displayCommentLegend);
}
break;
}
echo '</div>';
if (!(strcmp($gallery->album->fields["display_clicks"] , "yes")) && !$gallery->session->offline && ($myAlbum->getClicks() > 0)) {
echo '<div class="viewcounter" style="margin-top:3px">';
printf (gTranslate('core', "Viewed: %s"), gTranslate('core', "1 time", "%d times", $myAlbum->getClicks()));
echo ".</div>";
}
}
else {
echo "<div align=\"center\">\n";
echo nl2br($gallery->album->getCaption($i));
echo $gallery->album->getCaptionName($i) . ' ';
// indicate with * if we have a comment for a given photo
if ($gallery->user->canViewComments($gallery->album)
&& $gallery->app->comments_enabled == 'yes') {
// If comments indication for either photos or both
switch ($gallery->app->comments_indication) {
case "photos":
case "both":
$lastCommentDate = $gallery->album->itemLastCommentDate($i);
print lastCommentString($lastCommentDate, $displayCommentLegend);
break;
}
}
echo "</div>\n";
if (!(strcmp($gallery->album->fields["display_clicks"] , "yes")) && !$gallery->session->offline && ($gallery->album->getItemClicks($i) > 0)) {
echo '<div class="viewcounter" style="margin-top:3px">';
echo gTranslate('core', "Viewed: 1 time.", "Viewed: %d times.", $gallery->album->getItemClicks($i));
echo "</div>\n";
}
}
echo "<br>\n";
// End Caption
if (canVote()) {
echo("<div align=\"center\">\n");
addPolling($gallery->album->getVotingIdByIndex($i), $form_pos, false);
$form_pos++;
}
$albumItemOptions = getItemActions($i, false);
if (sizeof($albumItemOptions) > 2 ||
(sizeof($albumItemOptions) == 2 && !isset($albumItemOptions['showExif']))) {
echo drawSelect2("s$i", $albumItemOptions, array(
'onChange' => "imageEditChoice(document.vote_form.s$i)",
'class' => 'adminform'));
}
if (canVote()) {
print '</div>';
}
echo("</div></div>");
echo "\n";
echo("</td>");
echo "\n";
$j++;
$visibleItemIndex++;
$i = $visibleItemIndex<=$numVisibleItems ? $visibleItems[$visibleItemIndex] : $numPhotos+1;
}
if ($printTableRow) {
echo('</tr>');
}
/* Now do the inline_albumthumb footer row */
$visibleItemIndex = $rowStart;
$i = $visibleItemIndex <= $numVisibleItems ? $visibleItems[$visibleItemIndex] : $numPhotos+1;
$j = 1;
if ($printTableRow) {
}
while ($j <= $cols && $i <= $numPhotos) {
$j++;
$visibleItemIndex++;
$i = $visibleItemIndex<=$numVisibleItems ? $visibleItems[$visibleItemIndex] : $numPhotos+1;
}
if ($printTableRow) {
}
$rowCount++;
$rowStart = $visibleItemIndex;
}
} else {
?>
<td colspan="<?php echo $rows ?>" align="center" class="headbox">
<?php if ($gallery->user->canAddToAlbum($gallery->album) && !$gallery->session->offline) {
$url = makeGalleryUrl('add_photos_frame.php', array('set_albumName' => $gallery->session->albumName, 'type' => 'popup'));
echo popup_link('['. gTranslate('core', "Hey! Add some photos.") .']', $url, 1, true, 500, 600, 'admin');
} else {
echo gTranslate('core', "This album is empty.");
}
?>
</td>
</tr>
<?php
}
?>
</table>
<?php //display legend for comments
if ($displayCommentLegend) { ?>
<span class="commentIndication">*</span>
<span class="fineprint"> <?php echo gTranslate('core', "Comments available for this item.") ?></span>
<br>
<?php }
if (canVote()) { ?>
<p align="center">
<input type=submit name="Vote" value="<?php print gTranslate('core', "Vote") ?>">
</p>
<?php
}
?>
</form>
<?php if ($gallery->user->isLoggedIn() &&
$gallery->user->getEmail() &&
!$gallery->session->offline &&
$gallery->app->emailOn == "yes") {
if (getRequestVar('submitEmailMe')) {
if (getRequestVar('comments')) {
$gallery->album->setEmailMe('comments', $gallery->user);
} else {
$gallery->album->unsetEmailMe('comments', $gallery->user);
}
if (getRequestVar('other')) {
$gallery->album->setEmailMe('other', $gallery->user);
} else {
$gallery->album->unsetEmailMe('other', $gallery->user);
}
}
echo makeFormIntro("view_album.php",
array("name" => "email_me", "style" => "margin-bottom: 0px;"));
echo gTranslate('core', "Email me when one of the following actions are done to this album:")." ";
$checked_com = ($gallery->album->getEmailMe('comments', $gallery->user)) ? "checked" : "" ;
$checked_other = ($gallery->album->getEmailMe('other', $gallery->user)) ? "checked" : "";
?>
<ul>
<li><?php echo gTranslate('core', "Comments are added"); ?>
<input type="checkbox" name="comments" <?php echo $checked_com; ?> onclick="document.email_me.submit()">
</li>
<li><?php print gTranslate('core', "Other changes are made") ?>
<input type="checkbox" name="other" <?php echo $checked_other; ?> onclick="document.email_me.submit()">
</li>
</ul>
<input type="hidden" name="submitEmailMe" value="true">
</form>
<?php } ?>
<!-- bottom nav -->
<?php
if($numVisibleItems != 0) {
includeLayout('navtablebegin.inc');
if ($navigator["maxPages"] > 1) {
includeLayout('navigator.inc');
includeLayout('navtablemiddle.inc');
}
includeLayout('breadcrumb.inc');
includeLayout('navtableend.inc');
}
echo languageSelector();
includeHtmlWrap("album.footer");
if (!$GALLERY_EMBEDDED_INSIDE) { ?>
</body>
</html>
<?php } ?>
|