0byt3m1n1
Path:
/
data
/
applications
/
aps
/
b2evolution
/
3.3.1-5
/
standard
/
htdocs
/
inc
/
items
/
views
/
[
Home
]
File: _item_links.view.php
<?php /** * This file displays the links attached to an Item (called within the attachment_frame) * * This file is part of the evoCore framework - {@link http://evocore.net/} * See also {@link http://sourceforge.net/projects/evocms/}. * * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/} * * {@internal License choice * - If you have received this file as part of a package, please find the license.txt file in * the same folder or the closest folder above for complete license terms. * - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/) * then you must choose one of the following licenses before using the file: * - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php * - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php * }} * * {@internal Open Source relicensing agreement: * }} * * @package admin * * {@internal Below is a list of authors who have contributed to design/coding of this file: }} * @author fplanque: Francois PLANQUE. * * @version $Id: _item_links.view.php,v 1.6 2009/03/08 23:57:44 fplanque Exp $ */ if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' ); /** * @var Blog */ global $Blog; /** * Needed by functions * @var Item */ global $edited_Item; global $AdminUI; // Override $debug in order to keep the display of the iframe neat global $debug; $debug = 0; // Name of teh iframe we want some atiosn to come back to: param( 'iframe_name', 'string', '', true ); $SQL = & new SQL(); $SQL->SELECT( 'link_ID, link_ltype_ID, file_ID, file_title, file_root_type, file_root_ID, file_path, file_alt, file_desc' ); $SQL->FROM( 'T_links LEFT JOIN T_files ON link_file_ID = file_ID' ); $SQL->WHERE( 'link_itm_ID = '.$edited_Item->ID ); $SQL->ORDER_BY( 'link_ID' ); $Results = & new Results( $SQL->get(), 'link_' ); $Results->title = T_('Attachments'); /* * Sub Type column */ function display_subtype( & $row ) { if( empty($row->file_ID) ) { return ''; } global $current_File; // Instantiate a File object for this line: $current_File = new File( $row->file_root_type, $row->file_root_ID, $row->file_path ); // COPY! // Flow meta data into File object: $current_File->load_meta( false, $row ); return $current_File->get_preview_thumb( 'fulltype' ); } $Results->cols[] = array( 'th' => T_('Icon/Type'), 'td_class' => 'shrinkwrap', 'td' => '%display_subtype( {row} )%', ); /* * LINK column */ function display_link( & $row ) { if( !empty($row->file_ID) ) { /** * @var File */ global $current_File; global $edited_Item; $r = ''; // File relative path & name: // return $current_File->get_linkedit_link( '&fm_mode=link_item&itm_ID='.$edited_Item->ID ); if( $current_File->is_dir() ) { // Directory $r .= $current_File->dget( '_name' ); } else { // File if( $view_link = $current_File->get_view_link() ) { $r .= $view_link; } else { // File extension unrecognized $r .= $current_File->dget( '_name' ); } } $r .= '<span class="filemeta"> - '.$current_File->dget('title').'</span>'; return $r; } return '?'; } $Results->cols[] = array( 'th' => T_('Destination'), 'td' => '%display_link( {row} )%', ); if( $current_User->check_perm( 'files', 'view' ) ) { function file_actions( $link_ID ) { /** * @var File */ global $current_File; global $edited_Item, $current_User; global $iframe_name; $r = ''; if( isset($current_File) ) { $title = T_('Locate this file!'); $url = $current_File->get_linkedit_url( $edited_Item->ID ); $r = '<a href="'.$url.'" onclick="return pop_up_window( \'' .url_add_param( $url, 'mode=upload&iframe_name='.$iframe_name.'' ).'\', \'fileman_upload\', 1000 )" target="_parent" title="'.$title.'">' .get_icon( 'locate', 'imgtag', array( 'title'=>$title ) ).'</a> '; } if( $current_User->check_perm( 'item_post!CURSTATUS', 'edit', false, $edited_Item ) ) { // Check that we have permission to edit item: $r .= action_icon( T_('Delete this link!'), 'unlink', regenerate_url( 'p,itm_ID,action', "link_ID=$link_ID&action=unlink" ) ); } return $r; } $Results->cols[] = array( 'th' => T_('Actions'), 'td_class' => 'shrinkwrap', 'td' => '%file_actions( #link_ID# )%', ); } $Results->display( $AdminUI->get_template( 'compact_results' ) ); ?>