|
From: Jon O. <jon...@us...> - 2005-10-02 18:30:46
|
Update of /cvsroot/mxbb/mx_gallery2 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7161/modules/mx_gallery2 Modified Files: gallery2.php mx_gallery2.pak Added Files: gallery2_toplist.php Log Message: added support for imageBlock (random, recent) Index: gallery2.php =================================================================== RCS file: /cvsroot/mxbb/mx_gallery2/gallery2.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** gallery2.php 27 Sep 2005 18:56:13 -0000 1.1 --- gallery2.php 1 Oct 2005 08:52:41 -0000 1.2 *************** *** 30,34 **** $block_config = read_block_config($block_id); $title = $block_config[$block_id]['block_title']; ! $xtra_gallery_get_pars = !empty($block_config[$block_id]['xtra_get_vars']) ? '&g2_view=core.ShowItem&g2_itemId=' . $block_config[$block_id]['xtra_get_vars'] : ''; // // Includes --- 30,35 ---- $block_config = read_block_config($block_id); $title = $block_config[$block_id]['block_title']; ! $xtra_gallery_get_pars = !empty($block_config[$block_id]['base_album']) ? '&g2_view=core.ShowItem&g2_itemId=' . intval($block_config[$block_id]['base_album']) : ''; ! // // Includes *************** *** 48,54 **** // $relativeG2Path = 'modules/gallery2'; ! $fullpath = realpath($mx_root_path).$relativeG2Path; $embedPath = '/'; ! $embedUri = 'index.php?page=' . $page_id . $xtra_gallery_get_pars; $loginRedirect = '/'; $cookiePath = '/'; --- 49,55 ---- // $relativeG2Path = 'modules/gallery2'; ! $fullpath = realpath($mx_root_path).'/'.$relativeG2Path; $embedPath = '/'; ! $embedUri = 'index.php?page=' . $page_id; $loginRedirect = '/'; $cookiePath = '/'; *************** *** 134,138 **** 'BODY' => $bodyHtml, 'CSS' => $links, ! 'JAVASCRIPT' => $jlink)); $template->pparse('body'); --- 135,140 ---- 'BODY' => $bodyHtml, 'CSS' => $links, ! 'JAVASCRIPT' => $jlink ! )); $template->pparse('body'); --- NEW FILE: gallery2_toplist.php --- <?php /*************************************************************************** * gallery2.php * ------------------- * begin : Sep, 2005 * copyright : (C) 2005 mxBB * email : jon...@mx... * * $Id: gallery2_toplist.php,v 1.1 2005/10/01 08:52:41 jonohlsson Exp $ * * ***************************************************************************/ /*************************************************************************** * * 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. * ***************************************************************************/ /* Externt Bildblock Använd ett PHP-block liknande det som visas nedan för att inkludera ett blidblock på en PHP sida utanför Gallery. <?php @readfile('http://www.samskolan.se/modules/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?> g2_blocks Pipe(|) separate list chosen from: randomImage, recentImage, viewedImage, randomAlbum, recentAlbum, viewedAlbum, dailyImage, weeklyImage, monthlyImage, dailyAlbum, weeklyAlbum, monthlyAlbum, specificItem; default is randomImage g2_show * Pipe(|) separated list chosen from: title, date, views, owner, heading, fullSize; the value can also be: none g2_itemId Limit the item selection to the subtree of the gallery under the album with the given id; or the id of the item to display when used with specificItem block type g2_maxSize Scale images to this maximum size. If maxSize exceeds the thumbnail dimensions, you must also specify g2_show=fullSize g2_linkTarget Add a link target (for example, to open links in a new browser window) g2_itemFrame * Ram att använda runt bilder g2_albumFrame * Ram att använda runt album If a parameter marked with * is omitted then the site default defined above is used. Image frames require CSS to be displayed correctly. Include the following in the <head> section to support image frames. <link rel="stylesheet" href="http://www.samskolan.se/modules/gallery2/main.php?g2_controller=imageblock.ExternalCSS&g2_frames=wood"/> Specify the frame id (or pipe separated list of ids) in the frames parameter. Omit the parameter to support the image frames configured above. Frame ids are the directory names in the modules/imageframe/frames directory. */ if( !defined('IN_PORTAL') ) { die("Hacking attempt !!!"); } // // Read block settings // $block_config = read_block_config($block_id); $title = $block_config[$block_id]['block_title']; // // Includes // include_once($mx_root_path . "modules/mx_gallery2/includes/gallery_constants.$phpEx"); include_once($mx_root_path . "modules/mx_gallery2/includes/gallery_functions.$phpEx"); // // Get vars // $g2_blocks = !empty($block_config[$block_id]['g2_blocks']['parameter_value']) ? $block_config[$block_id]['g2_blocks']['parameter_value'] : 'randomImage'; $g2_num_of_blocks = !empty($block_config[$block_id]['g2_num_of_blocks']['parameter_value']) ? $block_config[$block_id]['g2_num_of_blocks']['parameter_value'] : '1'; $g2_show = !empty($block_config[$block_id]['g2_show']['parameter_value']) ? unserialize($block_config[$block_id]['g2_show']['parameter_value']) : ''; $g2_subtreeId = !empty($block_config[$block_id]['g2_subtreeId']['parameter_value']) ? $block_config[$block_id]['g2_subtreeId']['parameter_value'] : ''; $g2_maxSize = !empty($block_config[$block_id]['g2_maxSize']['parameter_value']) ? intval($block_config[$block_id]['g2_maxSize']['parameter_value']) : ''; $g2_linkTarget = !empty($block_config[$block_id]['g2_linkTarget']['parameter_value']) ? $block_config[$block_id]['g2_linkTarget']['parameter_value'] : ''; $g2_itemFrame = !empty($block_config[$block_id]['g2_itemFrame']['parameter_value']) ? $block_config[$block_id]['g2_itemFrame']['parameter_value'] : ''; $g2_albumFrame = !empty($block_config[$block_id]['g2_albumFrame']['parameter_value']) ? $block_config[$block_id]['g2_albumFrame']['parameter_value'] : ''; $gallery_block_id = !empty($block_config[$block_id]['target_block']['parameter_value']) ? $block_config[$block_id]['target_block']['parameter_value'] : ''; $g2_page_id = get_page_id( $gallery_block_id ); // // Format the GalleryEmbed::getImageBlock args // /* * @param array ('blocks' => string, 'show' => string, (optional)'heading' => int, * (optional)'itemId' => int, (optional)'maxSize' => int, * (optional)'itemFrame' => frameId, (optional)'albumFrame' => frameId) */ $getImageBlockargs = array(); $getImageBlockargs['heading'] = 1; $g2_blocks_var = ''; for ($i=0;$i<$g2_num_of_blocks;$i++) { $g2_blocks_var .= $i == 0 ? $g2_blocks : '|' . $g2_blocks; } $getImageBlockargs['blocks'] = $g2_blocks_var; $g2_show_var = ''; foreach($g2_show as $key => $value) { $g2_show_var .= empty($g2_show_var) ? $key : '|' . $key; } $getImageBlockargs['show'] = $g2_show_var; $getImageBlockargs['maxSize'] = $g2_maxSize; //$g2_linkTarget_var = $g2_linkTarget != 'none' ? '&g2_linkTarget=' . $g2_linkTarget : ''; if (!empty($g2_subtreeId)) { $getImageBlockargs['itemId'] = $g2_subtreeId; } if ( !empty($g2_itemFrame) ) { $$getImageBlockargs['itemFrame'] = $g2_itemFrame; $g2_frames = 'g2_frames=' . $g2_itemFrame; } else if ( !empty($g2_albumFrame) ) { $getImageBlockargs['albumFrame'] = $g2_albumFrame; $g2_frames = 'g2_frames=' . $g2_albumFrame; } else { $g2_frames = ''; } // // Start template // $template->set_filenames(array( 'body' => 'gallery2.tpl') ); // // Environment variables // $relativeG2Path = 'modules/gallery2'; $fullpath = realpath($mx_root_path).'/'.$relativeG2Path; $embedPath = '/'; $embedUri = 'index.php?page=' . $g2_page_id; $loginRedirect = '/'; $cookiePath = '/'; // // Include the gallery embed class // require_once($relativeG2Path . '/embed.php'); // // Instatiate the mxBB to Gallery Class // $mx_gallery = new mx_gallery(); // // Is mxBB user already mapped in Gallery? If not, do it. // if ( !$mx_gallery->do_map() ) { mx_message_die(CRITICAL_ERROR, $map_debug); } // // When in debug mode, output all gallery embed actions // if (MAP_DEBUG) { echo($map_debug); } // // Init the GalleryEmbed class, passing current user_id // if($userdata['user_id'] != ANONYMOUS) { $ret = GalleryEmbed::init(array( 'embedUri' => $embedUri, 'embedPath' => $embedPath, 'relativeG2Path' => $relativeG2Path, 'loginRedirect' => $loginRedirect, 'activeUserId' => $userdata['user_id'])); if ($ret->isError()) { echo $ret->getAsHtml(); exit; } } else { $ret = GalleryEmbed::init(array( 'embedUri' => $embedUri, 'embedPath' => $embedPath, 'relativeG2Path' => $relativeG2Path, 'loginRedirect' => $loginRedirect, 'activeUserId' => 0)); if ($ret->isError()) { echo $ret->getAsHtml(); exit; } } $links = !empty($g2_frames) ? '<link rel="stylesheet" href="'.PORTAL_URL.'modules/gallery2/main.php?g2_controller=imageblock.ExternalCSS&'.$g2_frames.'"/>' : ''; // // If this is not the main gallery page itself, do NOT send utf-8 header // Note: this is a temp solution to avoid weird characters for mxBB if the imageBlock is used // /* Set the appropriate charset in our HTTP header */ if (!headers_sent() && $g2_page_id != $page_id) { header('Content-Type: text/html; charset=' . $lang['ENCODING']); } // // Hook up with ImageAlbum // $g2data = GalleryEmbed::getImageBlock($getImageBlockargs); $bodyHtml = GalleryUtilities::utf8ToUnicodeEntities($g2data[1]); // // Send to template // $template->assign_vars(array( 'BODY' => $bodyHtml, 'CSS' => $links)); $template->pparse('body'); // // End of code // ?> Index: mx_gallery2.pak =================================================================== RCS file: /cvsroot/mxbb/mx_gallery2/mx_gallery2.pak,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mx_gallery2.pak 27 Sep 2005 18:58:05 -0000 1.1 --- mx_gallery2.pak 1 Oct 2005 08:52:41 -0000 1.2 *************** *** 5,7 **** --- 5,20 ---- parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 block=+:=+:Demo - GalleryBlock=+:Demo block=+:102=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 + New_function=+:---------------------------=+:0=+:0=+:0=+:0=+:0 + function=+:58=+:103=+:Toplist=+:Recent - random - block=+:gallery2_toplist.php=+: + parameter=+:103=+:345=+:g2_albumFrame=+:Text=+:=+: + parameter=+:103=+:338=+:g2_blocks=+:Menu_single_select=+:randomImage=+:a:10:{i:0;s:11:"randomImage";i:1;s:11:"recentImage";i:2;s:11:"viewedImage";i:3;s:11:"randomAlbum";i:4;s:11:"recentAlbum";i:5;s:11:"viewedAlbum";i:6;s:10:"dailyImage";i:7;s:11:"weeklyImage";i:8;s:10:"dailyAlbum";i:9;s:11:"weeklyAlbum";} + parameter=+:103=+:344=+:g2_itemFrame=+:Text=+:=+: + parameter=+:103=+:343=+:g2_linkTarget=+:Radio_single_select=+:none=+:a:2:{i:0;s:4:"none";i:1;s:6:"_blank";} + parameter=+:103=+:342=+:g2_maxSize=+:Number=+:150=+: + parameter=+:103=+:339=+:g2_num_of_blocks=+:Number=+:3=+: + parameter=+:103=+:340=+:g2_show=+:Checkbox_multiple_select=+:=+:a:7:{i:0;s:4:"none";i:1;s:5:"title";i:2;s:4:"date";i:3;s:5:"views";i:4;s:5:"owner";i:5;s:7:"heading";i:6;s:8:"fullSize";} + parameter=+:103=+:341=+:g2_subtreeId=+:Number=+:=+: + parameter=+:103=+:346=+:target_block=+:Function=+:=+:get_list_formatted("block_list","{parameter_value}","{parameter_id}[]", "gallery2.php") + parameter=+:0=+:0=+:0=+:endoflist=+:0=+:0 + block=+:=+:Demo - Toplist=+:Demo block=+:103=+:0=+:5=+:0=+:0=+:0=+:0=+:1=+:1 function=+:0=+:0=+:0=+:endoflist=+:0=+:0 |