Page 1 of 1

menu-item file view: unabel to select file

Posted: 14 Aug 2011, 18:39
by Anielita
Hi

I installed phoca download and would like a menu with items directly linking to download files. When I select "file view" in the menu item settings, I'm unable to browse for the file. There's just a text box next to "select file". I don't know how to fill in the url manually. Is there any way to get a browsing facility?

Re: menu-item file view: unabel to select file

Posted: 19 Aug 2011, 14:36
by Jan
Hi, if you need a directly link to download - from the menu link, you need to do custom menu link (external) and set the right URL directly to download (copy it from the standard menu links)

Jan

Re: menu-item file view: unabel to select file

Posted: 20 Aug 2011, 10:43
by malquaid
Great App!!!

When going to Menu Item - Phoca File View the required field * on the left is Select File with a value of 0.

How do you select which file to place here and what value (currently its number 0, a link address, a filename, etc...) should be placed in the Select file entry box?

Again, thank you for such a great application and your support

Re: menu-item file view: unabel to select file

Posted: 20 Aug 2011, 18:59
by toemon
Hi.
Thanks for a great component.
I'm japanese
First, i appologize to my poor English.

"select file" instead of "File ID" would be better named.
If you want to select a file from a select box,Perform the following steps:
Note; changes are based on the com_phocadownload_v2.1.0_beta
Step.1
Add the following code in the language files 'language/en-GB/en-GB.com_phocadownload.ini' and 'language/en-GB/en-GB.com_phocadownload.ini'.

Code: Select all

COM_PHOCADOWNLOAD_SELECT_FILE="select file"
COM_PHOCADOWNLOAD_FIELD_SELECT_FILE_LABEL="Select file"
COM_PHOCADOWNLOAD_FIELD_SELECT_FILE_DESC="Select display file"
step. 2
Create a new phocadownloadfile.php file in administrator/components/com_phocadownload/models/fields/ folder.
phocadownloadfile.php contains the following code:

Code: Select all

<?php
/*
 * @package		Joomla.Framework
 * @copyright	Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 *
 * @component Phoca Component
 * @copyright Copyright (C) Jan Pavelka www.phoca.cz
 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License version 2 or later;
 */
defined('_JEXEC') or die();

class JFormFieldPhocaDownloadFile extends JFormField
{
	protected $type = 'PhocaDownloadFile';

	protected function getInput() {
	
		$db = &JFactory::getDBO();

       //build the list of files
		$query = 'SELECT a.title , a.id , a.catid'
		. ' FROM #__phocadownload AS a'
		. ' WHERE a.published = 1'
		. ' ORDER BY a.ordering';
		$db->setQuery( $query );

		$messages = $db->loadObjectList();
		$options = array();
		if ($messages)
		{
			foreach($messages as $message) 
			{
				$options[] = JHtml::_('select.option', $message->id, $message->title);
			}
		}
		array_unshift($options, JHTML::_('select.option', '', '- '.JText::_('COM_PHOCADOWNLOAD_SELECT_FILE').' -', 'value', 'text'));
		return JHTML::_('select.genericlist',  $options,  $this->name, 'class="inputbox"', 'value', 'text', $this->value, $this->id );

	}
}
?>
step. 3
Change as follows: components/com_phocadownload/views/file/tmpl/default.xml

Code: Select all

<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="COM_PHOCADOWNLOAD_FILE_LAYOUT">
		<message>
			<![CDATA[COM_PHOCADOWNLOAD_FILE_LAYOUT_DESC]]>
		</message>
	</layout>

	<name>COM_PHOCADOWNLOAD_FILE_LAYOUT</name>
	<description>COM_PHOCADOWNLOAD_FILE_LAYOUT_DESC</description>
	<fields name="request">
		<fieldset name="request" addfieldpath="/administrator/components/com_phocadownload/models/fields">

			<field 
				name="id" 
				type="phocadownloadfile" 
				section="com_phocadownload" 
				class="inputbox"
				default="0" 
				label="COM_PHOCADOWNLOAD_FIELD_SELECT_FILE_LABEL" 
				description="COM_PHOCADOWNLOAD_FIELD_SELECT_FILE_DESC" 
				required="true"
			/>
		</fieldset>
	</fields>
	<fields name="params">
		<fieldset name="basic" addfieldpath="/administrator/components/com_phocadownload/models/fields" >
			<field name="show_pagination" type="radio" default="1" label="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LABEL" description="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_DESC">
				<option value="0">COM_PHOCADOWNLOAD_HIDE</option>
				<option value="1">COM_PHOCADOWNLOAD_DISPLAY</option>
			</field>
			
			<field name="show_pagination_limit" type="radio" default="1" label="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LIMIT_LABEL" description="COM_PHOCADOWNLOAD_FIELD_SHOW_PAGINATION_LIMIT_DESC">
				<option value="0">COM_PHOCADOWNLOAD_HIDE</option>
				<option value="1">COM_PHOCADOWNLOAD_DISPLAY</option>
			</field>
		</fieldset>
	</fields>

</metadata>
Thanks.

Re: menu-item file view: unabel to select file

Posted: 21 Aug 2011, 00:06
by Jan
Hi, thank you for this guide.

Jan

Re: menu-item file view: unabel to select file

Posted: 01 Sep 2011, 18:19
by Jan
Added into Phoca Download 2.1.0 stable