Changeset 2227 for trunk/picture.php
- Timestamp:
- Feb 29, 2008, 2:25:13 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/picture.php
r2224 r2227 82 82 { 83 83 $uuid = uniqid(rand()); 84 $template->assign _block_vars(84 $template->assign( 85 85 'high', 86 86 array( … … 90 90 ); 91 91 } 92 $template->assign _vars( array(92 $template->assign( array( 93 93 'SRC_IMG' => $element_info['image_url'], 94 94 'ALT_IMG' => $element_info['file'], … … 473 473 'picture' => 474 474 (($page['slideshow'] and $conf['light_slideshow']) ? 'slideshow.tpl' : 'picture.tpl'), 475 'nav_buttons' => 'picture_nav_buttons.tpl')); 476 477 if ($page['slideshow']) 478 { 479 // Add local-slideshow.css file if exists 480 // Not only for ligth 481 $css = get_root_url() . get_themeconf('template_dir') . '/theme/' 482 . get_themeconf('theme') . '/local-slideshow.css'; 483 if (file_exists($css)) 484 { 485 $template->assign_block_vars('slideshow', array()); 486 } 487 } 475 )); 476 488 477 489 478 $title = $picture['current']['name']; … … 524 513 and $picture['next']['is_picture'] ) 525 514 { 526 $template->assign_block_vars( 527 'prefetch', 528 array ( 529 'URL' => $picture['next']['image_url'] 530 ) 531 ); 515 $template->assign('U_PREFETCH', $picture['next']['image_url'] ); 532 516 } 533 517 534 518 //------------------------------------------------------- navigation management 535 foreach (array('first','previous','next','last' ) as $which_image)519 foreach (array('first','previous','next','last', 'current') as $which_image) 536 520 { 537 521 if (isset($picture[$which_image])) 538 522 { 539 $template->assign _block_vars(523 $template->assign( 540 524 $which_image, 541 525 array( 542 'TITLE _IMG' => $picture[$which_image]['name'],543 ' IMG' => $picture[$which_image]['thumbnail'],526 'TITLE' => $picture[$which_image]['name'], 527 'THUMB_SRC' => $picture[$which_image]['thumbnail'], 544 528 // Params slideshow was transmit to navigation buttons 545 529 'U_IMG' => 546 530 add_url_params( 547 $picture[$which_image]['url'], $slideshow_url_params) 531 $picture[$which_image]['url'], $slideshow_url_params), 532 'U_DOWNLOAD' => @$picture['current']['download_url'], 548 533 ) 549 534 ); 550 535 } 551 else552 {553 $template->assign_block_vars(554 $which_image.'_unactive',555 array()556 );557 }558 536 } 559 537 … … 561 539 if ($page['slideshow']) 562 540 { 541 // Add local-slideshow.css file if exists 542 // Not only for ligth 543 $css = PHPWG_ROOT_PATH . get_themeconf('template_dir') . '/theme/' 544 . get_themeconf('theme') . '/local-slideshow.css'; 545 if (file_exists($css)) 546 { 547 //TODO CORRECT THIS $template->assign_block_vars('slideshow', array()); 548 } 549 550 $tpl_slideshow = array(); 551 563 552 //slideshow end 564 $template->assign_block_vars( 565 'stop_slideshow', 553 $template->assign( 566 554 array( 567 'U_SLIDESHOW ' => $picture['current']['url'],555 'U_SLIDESHOW_STOP' => $picture['current']['url'], 568 556 ) 569 557 ); … … 571 559 foreach (array('repeat', 'play') as $p) 572 560 { 573 $template->assign_block_vars( 574 ($slideshow_params[$p] ? 'stop' : 'start').'_'.$p, 575 array( 576 // Params slideshow was transmit to navigation buttons 577 'U_IMG' => 561 $var_name = 562 'U_' 563 .($slideshow_params[$p] ? 'STOP_' : 'START_') 564 .strtoupper($p); 565 566 $tpl_slideshow[$var_name] = 578 567 add_url_params( 579 568 $picture['current']['url'], 580 569 array('slideshow' => 581 570 encode_slideshow_params( 582 array_merge($slideshow_params, 571 array_merge($slideshow_params, 583 572 array($p => ! $slideshow_params[$p])) 584 )585 573 ) 586 574 ) 587 ) 588 ); 575 ); 589 576 } 590 577 … … 594 581 $new_slideshow_params = 595 582 correct_slideshow_params( 596 array_merge($slideshow_params, 583 array_merge($slideshow_params, 597 584 array('period' => $new_period))); 598 $block_period = $op.'_period';599 585 600 586 if ($new_slideshow_params['period'] === $new_period) 601 587 { 602 $template->assign_block_vars( 603 $block_period, 604 array( 605 // Params slideshow was transmit to navigation buttons 606 'U_IMG' => 588 $var_name = 'U_'.strtoupper($op).'_PERIOD'; 589 $tpl_slideshow[$var_name] = 607 590 add_url_params( 608 591 $picture['current']['url'], 609 592 array('slideshow' => encode_slideshow_params($new_slideshow_params) 610 593 ) 611 )612 )613 594 ); 614 595 } 615 else 616 { 617 $template->assign_block_vars( 618 $block_period.'_unactive', 619 array() 620 ); 621 } 622 } 596 } 597 $template->assign('slideshow', $tpl_slideshow ); 623 598 } 624 599 else 625 600 { 626 $template->assign_block_vars( 627 'start_slideshow', 601 $template->assign( 628 602 array( 629 'U_SLIDESHOW ' =>603 'U_SLIDESHOW_START' => 630 604 add_url_params( 631 605 $picture['current']['url'], … … 633 607 ) 634 608 ); 635 $template->assign_block_vars( 636 'up',array('U_URL' => $url_up)); 637 } 638 639 $template->assign_vars( 609 } 610 611 $template->assign( 640 612 array( 641 613 'SECTION_TITLE' => $page['title'], 642 'PICTURE_TITLE' => $picture['current']['name'],643 614 'PHOTO' => $title_nb, 644 ' TITLE' => $picture['current']['name'],615 'SHOW_PICTURE_NAME_ON_TITLE' => $conf['show_picture_name_on_title'], 645 616 646 617 'LEVEL_SEPARATOR' => $conf['level_separator'], 618 619 'FILE_PICTURE_NAV_BUTTONS' => 'picture_nav_buttons.tpl', 647 620 648 621 'U_HOME' => make_index_url(), 622 'U_UP' => $url_up, 649 623 'U_METADATA' => $url_metadata, 650 'U_ADMIN' => $url_admin,651 'U_ADD_COMMENT' => $url_self,652 624 ) 653 625 ); 654 626 655 if ($conf['show_picture_name_on_title'])656 {657 $template->assign_block_vars('title', array());658 }659 627 660 628 //------------------------------------------------------- upper menu management 661 629 662 // download link 663 if ( isset($picture['current']['download_url']) ) 664 { 665 $template->assign_block_vars( 666 'download', 630 // admin links 631 if (is_admin()) 632 { 633 if (isset($page['category'])) 634 { 635 $template->assign( 636 array( 637 'U_SET_AS_REPRESENTATIVE' => add_url_params($url_self, 638 array('action'=>'set_as_representative') 639 ) 640 ) 641 ); 642 } 643 644 $template->assign( 667 645 array( 668 'U_DOWNLOAD' => $picture['current']['download_url'] 669 ) 670 ); 671 } 672 673 // button to set the current picture as representative 674 if (is_admin() and isset($page['category'])) 675 { 676 $template->assign_block_vars( 677 'representative', 678 array( 679 'URL' => add_url_params($url_self, 680 array('action'=>'set_as_representative') 681 ) 682 ) 683 ); 684 } 685 686 // caddie button 687 if (is_admin()) 688 { 689 $template->assign_block_vars( 690 'caddie', 691 array( 692 'URL' => add_url_params($url_self, 646 'U_CADDIE' => add_url_params($url_self, 693 647 array('action'=>'add_to_caddie') 694 ) 648 ), 649 'U_ADMIN' => $url_admin, 695 650 ) 696 651 ); … … 712 667 if ($row['nb_fav'] == 0) 713 668 { 714 $template->assign _block_vars(669 $template->assign( 715 670 'favorite', 716 671 array( … … 728 683 else 729 684 { 730 $template->assign _block_vars(685 $template->assign( 731 686 'favorite', 732 687 array( … … 743 698 } 744 699 } 745 //------------------------------------ admin link for information modifications746 if ( is_admin() )747 {748 $template->assign_block_vars('admin', array());749 }750 700 751 701 //--------------------------------------------------------- picture information … … 755 705 and !empty($picture['current']['comment'])) 756 706 { 757 $template->assign_block_vars( 758 'legend', 759 array( 760 'COMMENT_IMG' => 707 $template->assign( 708 'COMMENT_IMG', 761 709 trigger_event('render_element_description', 762 710 $picture['current']['comment']) 763 ) );711 ); 764 712 $header_infos['COMMENT'] = strip_tags($picture['current']['comment']); 765 713 } … … 781 729 $header_infos['INFO_AUTHOR'] = $picture['current']['author']; 782 730 } 783 else784 {785 $infos['INFO_AUTHOR'] = l10n('N/A');786 }787 731 788 732 // creation date … … 800 744 $infos['INFO_CREATION_DATE'] = 801 745 '<a href="'.$url.'" rel="nofollow">'.$val.'</a>'; 802 }803 else804 {805 $infos['INFO_CREATION_DATE'] = l10n('N/A');806 746 } 807 747 … … 837 777 } 838 778 } 839 else840 {841 $infos['INFO_DIMENSIONS'] = l10n('N/A');842 }843 779 844 780 // filesize … … 848 784 sprintf(l10n('%d Kb'), $picture['current']['filesize']); 849 785 } 850 else851 {852 $infos['INFO_FILESIZE'] = l10n('N/A');853 }854 786 855 787 // number of visits … … 859 791 $infos['INFO_FILE'] = $picture['current']['file']; 860 792 861 // tags 793 $template->assign($infos); 794 795 // related tags 862 796 $tags = get_common_tags( array($page['image_id']), -1); 863 797 if ( count($tags) ) 864 798 { 865 $infos['INFO_TAGS'] = ''; 866 foreach ($tags as $num => $tag) 867 { 868 $infos['INFO_TAGS'] .= $num ? ', ' : ''; 869 $infos['INFO_TAGS'] .= '<a href="' 870 .make_index_url( 799 foreach ($tags as $tag) 800 { 801 $template->append( 802 'related_tags', 871 803 array( 872 'tags' => array($tag) 804 'ID' => $tag['id'], 805 'NAME' => $tag['name'], 806 'U_TAG' => make_index_url( 807 array( 808 'tags' => array($tag) 809 ) 810 ), 811 'U_TAG_IMAGE' => duplicate_picture_url( 812 array( 813 'section' => 'tags', 814 'tags' => array($tag) 815 ) 816 ) 873 817 ) 874 ) 875 .'">'.$tag['name'].'</a>'; 876 } 877 $header_infos['INFO_TAGS'] = strip_tags($infos['INFO_TAGS']); 878 } 879 else 880 { 881 $infos['INFO_TAGS'] = l10n('N/A'); 882 } 883 884 $template->assign_vars($infos); 818 ); 819 } 820 } 885 821 886 822 // related categories 887 823 foreach ($related_categories as $category) 888 824 { 889 $template->assign_block_vars( 890 'category', 891 array( 892 'LINE' => count($related_categories) > 3 825 $template->append( 826 'related_categories', 827 count($related_categories) > 3 893 828 ? get_cat_display_name_cache($category['uppercats']) 894 829 : get_cat_display_name_from_id($category['category_id']) 895 ) 896 ); 897 } 898 899 // assign tpl picture_nav_buttons 900 $template->assign_var_from_handle('NAV_BUTTONS', 'nav_buttons'); 830 ); 831 } 901 832 902 833 // maybe someone wants a special display (call it before page_header so that … … 907 838 $picture['current'] 908 839 ); 909 $template->assign _var( 'ELEMENT_CONTENT', $element_content );840 $template->assign( 'ELEMENT_CONTENT', $element_content ); 910 841 911 842 // +-----------------------------------------------------------------------+ … … 924 855 include(PHPWG_ROOT_PATH.'include/page_header.php'); 925 856 trigger_action('loc_end_picture'); 926 $template->p arse('picture');857 $template->pparse('picture'); 927 858 include(PHPWG_ROOT_PATH.'include/page_tail.php'); 928 859 ?>
Note: See TracChangeset
for help on using the changeset viewer.