primo commit

This commit is contained in:
2024-12-17 17:34:10 +01:00
commit e650f8df99
16435 changed files with 2451012 additions and 0 deletions

View File

@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>

View File

@ -0,0 +1,122 @@
<?php
/**
* @version $Id: accesslevel.php 20196 2011-01-09 02:40:25Z ian $
* @package Joomla.Framework
* @subpackage Form
* @copyright Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\Field\ListField;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Form\Form;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
jimport('joomla.form.helper');
FormHelper::loadFieldClass('list');
/**
* Form Field class for the Joomla Framework.
*
* @package Joomla.Framework
* @subpackage Form
* @since 1.6
*/
class JFormFieldPhocaAccessLevel extends ListField
{
/**
* The form field type.
*
* @var string
* @since 1.6
*/
public $type = 'AccessLevel';
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
// Initialize variables.
$attr = '';
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$attr .= $this->multiple ? ' multiple="multiple"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
// Get the field options.
$options = $this->getOptions();
//return $this->_level( $this->name, $this->value, $attr, $options, $this->id);
$data = $this->getLayoutData();
$data['options'] = (array) $this->_level( $this->name, $this->value, $attr, $options, $this->id);
return $this->getRenderer($this->layout)->render($data);
}
public static function _level($name, $selected, $attribs = '', $params = true, $id = false) {
$db = Factory::getDbo();
$query = $db->getQuery(true);
$query->select('a.id AS value, a.title AS text');
$query->from('#__viewlevels AS a');
//PHOCAEDIT
$query->where('a.id <> 1');
//ENDPHOCAEDIT
$query->group('a.id, a.title');
$query->order('a.ordering ASC');
$query->order('`title` ASC');
// Check for a database error.
/* if ($db->getErrorNum()) {
throw new Exception($db->getErrorMsg(), 500);
return false;
}*/
try {
// Get the options.
$db->setQuery($query);
$options = $db->loadObjectList();
} catch (RuntimeException $e) {
throw new Exception($e->getMessage(), 500);
return false;
}
// If params is an array, push these options to the array
if (is_array($params)) {
$options = array_merge($params,$options);
}
// If all levels is allowed, push it into the array.
elseif ($params) {
array_unshift($options, HTMLHelper::_('select.option', '', Text::_('JOPTION_ACCESS_SHOW_ALL_LEVELS')));
}
return $options;
/*
return HTMLHelper::_('select.genericlist', $options, $name,
array(
'list.attr' => $attribs,
'list.select' => $selected,
'id' => $id
)
);*/
}
}

View File

@ -0,0 +1,87 @@
<?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('JPATH_BASE') or die;
jimport('joomla.form.formfield');
class JFormFieldPhocaColorText extends JFormField
{
protected $type = 'PhocaColorText';
protected $phocaParams = null;
protected function getInput() {
$document = JFactory::getDocument();
$option = JFactory::getApplication()->input->getCmd('option');
$globalValue = $this->_getPhocaParams( $this->element['name'] );
JHTML::stylesheet( 'administrator/components/com_phocadownload/assets/jcp/picker.css' );
$document->addScript(JURI::base(true).'/components/com_phocadownload/assets/jcp/picker.js');
// Initialize some field attributes.
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
// TODO 1.6
// MENU - Set Default value to "" because of saving "" value into the menu link ( use global = "")
if ($option == "com_menus") {
$DefaultValue = (string)$this->element['default'];
if ($value == $DefaultValue) {
$value = '';
}
}
$html ='<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>';
// Color Picker
$nameCP = str_replace('[', '_', $this->name);
$nameCP = str_replace(']', '', $nameCP);
$html .= '<span style="margin-left:10px" onclick="openPicker(\''.$nameCP.'\')" class="picker_buttons">' . JText::_('COM_PHOCADOWNLOAD_PICK_COLOR') . '</span>';
// MENU - Display the global value
if ($option == "com_menus") {
$html .= '<span style="margin-left:10px;">[</span><span style="background:#fff"> ' . $globalValue . ' </span><span>]</span>';
}
return $html;
}
protected function getLabel() {
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
protected function _setPhocaParams(){
$component = 'com_phocadownload';
$paramsC = JComponentHelper::getParams($component) ;
$this->phocaParams = $paramsC;
}
protected function _getPhocaParams( $name ){
// Don't call sql query by every param item (it will be loaded only one time)
if (!$this->phocaParams) {
$params = $this->_setPhocaParams();
}
$globalValue = $this->phocaParams->get( $name, '' );
return $globalValue;
}
}
?>

View File

@ -0,0 +1,205 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die();
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
if (! class_exists('PhocaDownloadCategory')) {
require_once( JPATH_ADMINISTRATOR.'/components/com_phocadownload/libraries/phocadownload/category/category.php');
}
Factory::getApplication()->getLanguage()->load('com_phocadownload');
class JFormFieldPhocaDownloadCategory extends FormField
{
protected $type = 'PhocaDownloadCategory';
protected $layout = 'phocadownload.form.field.category';
protected function getRenderer($layoutId = 'default')
{
// Make field usable outside of Phoca Cart component
$renderer = parent::getRenderer($layoutId);
$renderer->addIncludePath(JPATH_ADMINISTRATOR . '/components/com_phocadownload/layouts');
return $renderer;
}
private function buildCategoryTree(array &$options, array $categories, string $treeTitle, array $typeFilter, array $langFilter, array $omitIds): void {
foreach ($categories as $category) {
if ($typeFilter && !in_array($category->type, $typeFilter)) continue;
if ($langFilter && !in_array($category->language, $langFilter)) continue;
if ($omitIds && in_array($category->id, $omitIds)) continue;
$title = ($treeTitle ? $treeTitle . ' - ' : '') . $category->title;
$options[] = (object)[
'text' => $title . ($category->language === '*' ? '' : ' (' . $category->language . ')'),
'value' => $category->id,
];
if ($category->children)
$this->buildCategoryTree($options, $category->children, $title, $typeFilter, $langFilter, $omitIds);
}
}
protected function getInput() {
$db = Factory::getDBO();
$multiple = (string)$this->element['multiple'] == 'true';
$typeMethod = $this->element['typemethod'];
switch($this->element['categorytype']) {
case 1:
$typeFilter = [0, 1];
break;
case 2:
$typeFilter = [0, 2];
break;
case 0:
default:
$typeFilter = [];
break;
}
if ($this->element['language']) {
$langFilter = explode(',', $this->element['language']);
} elseif ($this->form->getValue('language', 'filter')) {
$langFilter = [$this->form->getValue('language', 'filter')];
} else {
$langFilter = [];
}
// TO DO - check for other views than category edit
$omitIds = [];
switch (Factory::getApplication()->input->get('view')) {
case 'phocadownloadcategory':
if ($this->form->getValue('id') > 0)
$omitIds[] = $this->form->getValue('id');
break;
}
$db->setQuery('SELECT a.*, null AS children FROM #__phocadownload_categories AS a ORDER BY a.ordering, a.id');
$categories = $db->loadObjectList('id') ?? [];
array_walk($categories, function ($category) use ($categories) {
if ($category->parent_id) {
if ($categories[$category->parent_id]->children === null) {
$categories[$category->parent_id]->children = [];
}
$categories[$category->parent_id]->children[] = $category;
}
});
$rootCategories = array_filter($categories, function($category) {
return !$category->parent_id;
});
$options = [];
if ($multiple) {
if ($typeMethod == 'allnone') {
$options[] = HTMLHelper::_('select.option', '0', Text::_('COM_PHOCADOWNLOAD_NONE'), 'value', 'text');
$options[] = HTMLHelper::_('select.option', '-1', Text::_('COM_PHOCADOWNLOAD_ALL'), 'value', 'text');
}
} else {
// in filter we need zero value for canceling the filter
if ($typeMethod == 'menulink') {
// Required for menu link,
} else if ($typeMethod == 'filter') {
$options[] = HTMLHelper::_('select.option', '', '- ' . Text::_('COM_PHOCADOWNLOAD_SELECT_CATEGORY') . ' -', 'value', 'text');
} else {
$options[] = HTMLHelper::_('select.option', '0', '- '.Text::_('COM_PHOCADOWNLOAD_SELECT_CATEGORY').' -', 'value', 'text');
}
}
$this->buildCategoryTree($options, $rootCategories, '', $typeFilter, $langFilter, $omitIds);
$data = $this->getLayoutData();
$data['options'] = $options;
//if (!empty($activeCats)) {
// $data['value'] = $activeCats;
//} else {
$data['value'] = $this->value;
//}
$data['refreshPage'] = (bool)$this->element['refresh-enabled'];
$data['refreshCatId'] = (string)$this->element['refresh-cat-id'];
$data['refreshSection'] = (string)$this->element['refresh-section'];
$data['hasCustomFields']= !empty(FieldsHelper::getFields('com_phocadownload.phocadownloadfile'));
$document = Factory::getDocument();
$document->addCustomTag('<script type="text/javascript">
function changeCatid() {
/* var catid = document.getElementById(\'jform_catid\').value;*/
}
</script>');
return $this->getRenderer($this->layout)->render($data);
}
/*
protected function getInput() {
$db = Factory::getDBO();
//build the list of categories
$query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parent_id'
. ' FROM #__phocadownload_categories AS a'
//. ' WHERE a.published = 1' // don't lose information about category when it will be unpublished - you should still be able to edit file with such category in administration
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$data = $db->loadObjectList();
$view = Factory::getApplication()->input->get( 'view' );
$catId = -1;
if ($view == 'phocadownloadcat') {
$id = $this->form->getValue('id'); // id of current category
if ((int)$id > 0) {
$catId = $id;
}
}/*
if ($view == 'phocadownloadfile') {
$id = $this->form->getValue('catid'); // id of current category
if ((int)$id > 0) {
$catId = $id;
}
}*//*
//$required = ((string) $this->element['required'] == 'true') ? TRUE : FALSE;
$attr = '';
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$attr .= $this->required ? ' required aria-required="true"' : '';
$attr .= ' class="form-select"';
$tree = array();
$text = '';
$tree = PhocaDownloadCategory::CategoryTreeOption($data, $tree, 0, $text, $catId);
//if ($required == TRUE) {
//} else {
array_unshift($tree, HTMLHelper::_('select.option', '', '- '.Text::_('COM_PHOCADOWNLOAD_SELECT_CATEGORY').' -', 'value', 'text'));
//}
return HTMLHelper::_('select.genericlist', $tree, $this->name, trim($attr), 'value', 'text', $this->value, $this->id );
}*/
}
?>

View File

@ -0,0 +1,128 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('JPATH_BASE') or die;
jimport('joomla.html.editor');
jimport('joomla.form.formfield');
class JFormFieldPhocaDownloadEditor extends JFormField
{
public $type = 'PhocaDownloadEditor';
protected $phocaParams = null;
protected $editor;
protected function getInput()
{
// Initialize some field attributes.
$rows = (int) $this->element['rows'];
$cols = (int) $this->element['cols'];
$height = ((string) $this->element['height']) ? (string) $this->element['height'] : '250';
$width = ((string) $this->element['width']) ? (string) $this->element['width'] : '100%';
// Build the buttons array.
$buttons = (string) $this->element['buttons'];
if ($buttons == 'true' || $buttons == 'yes' || $buttons == '1') {
$buttons = true;
} else if ($buttons == 'false' || $buttons == 'no' || $buttons == '0') {
$buttons = false;
} else {
$buttons = explode(',', $buttons);
}
$hide = ((string) $this->element['hide']) ? explode(',',(string) $this->element['hide']) : array();
$globalValue = $this->_getPhocaParameter( 'display_editor' );
if ($globalValue == '') {
$globalValue = 1;
}
$widthE = $width + 200;
if ($globalValue == 1) {
// Get an editor object.
$editor = $this->getEditor();
$editorOutput = '<div style="width:'.$widthE.'px">'. $editor->display($this->name, htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8'), $width, $height, $cols, $rows, $buttons ? (is_array($buttons) ? array_merge($buttons,$hide) : $hide) : false, $this->id).'</div>';
return '<div style="clear:both;margin-top:5px"></div>' .$editorOutput;
}
else {
$style = '';
if ($width != '' && $height != '') {
$style = 'style="width:'.$width.'; height:'.$height.'"';
}
return '<textarea name="'.$this->name.'" cols="'.$cols.'" rows="'.$rows.'" '.$style.' id="'.$this->name.'" >'.htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8').'</textarea>';
}
}
protected function & getEditor()
{
// Only create the editor if it is not already created.
if (empty($this->editor)) {
// Initialize variables.
$editor = null;
// Get the editor type attribute. Can be in the form of: editor="desired|alternative".
$type = trim((string) $this->element['editor']);
if ($type) {
// Get the list of editor types.
$types = explode('|', $type);
// Get the database object.
$db = JFactory::getDBO();
// Iterate over teh types looking for an existing editor.
foreach ($types as $element) {
// Build the query.
$query = $db->getQuery(true);
$query->select('element');
$query->from('#__extensions');
$query->where('element = '.$db->quote($element));
$query->where('folder = '.$db->quote('editors'));
$query->where('enabled = 1');
// Check of the editor exists.
$db->setQuery($query, 0, 1);
$editor = $db->loadResult();
// If an editor was found stop looking.
if ($editor) {
break;
}
}
}
// Create the JEditor intance based on the given editor.
$this->editor = JFactory::getEditor($editor ? $editor : null);
}
return $this->editor;
}
public function save()
{
return $this->getEditor()->save($this->id);
}
protected function _setPhocaParams(){
$component = 'com_phocadownload';
$paramsC = JComponentHelper::getParams($component) ;
$this->phocaParams = $paramsC;
}
protected function _getPhocaParameter( $name ){
// Don't call sql query by every param item (it will be loaded only one time)
if (!$this->phocaParams) {
$params = $this->_setPhocaParams();
}
$globalValue = $this->phocaParams->get( $name, '' );
return $globalValue;
}
}

View File

@ -0,0 +1,51 @@
<?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();
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
class JFormFieldPhocaDownloadFile extends FormField
{
protected $type = 'PhocaDownloadFile';
protected function getInput() {
$db = Factory::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[] = HTMLHelper::_('select.option', $message->id, $message->title);
}
}
$attr = '';
$attr .= $this->required ? ' required aria-required="true"' : '';
$attr .= ' class="form-control"';
array_unshift($options, HTMLHelper::_('select.option', '', '- '.Text::_('COM_PHOCADOWNLOAD_SELECT_FILE').' -', 'value', 'text'));
return HTMLHelper::_('select.genericlist', $options, $this->name, trim($attr), 'value', 'text', $this->value, $this->id );
}
}
?>

View File

@ -0,0 +1,41 @@
<?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();
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
class JFormFieldPhocaDownloadLicense extends FormField
{
protected $type = 'PhocaDownloadLicense';
protected function getInput() {
$db = Factory::getDBO();
//build the list of categories
$query = 'SELECT a.title AS text, a.id AS value'
. ' FROM #__phocadownload_licenses AS a'
//. ' WHERE a.published = 1'
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$licenses = $db->loadObjectList();
$id = $this->form->getValue('id'); // id of current license
$required = ((string) $this->element['required'] == 'true') ? TRUE : FALSE;
array_unshift($licenses, HTMLHelper::_('select.option', '', '- '.Text::_('COM_PHOCADOWNLOAD_SELECT_LICENSE').' -', 'value', 'text'));
return HTMLHelper::_('select.genericlist', $licenses, $this->name, 'class="form-select"', 'value', 'text', $this->value, $this->id );
}
}
?>

View File

@ -0,0 +1,90 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
class JFormFieldPhocaDownloadOrdering extends FormField
{
protected $type = 'PhocaDownloadOrdering';
protected function getInput() {
// Initialize variables.
$html = array();
$attr = '';
// Get some field values from the form.
$id = (int) $this->form->getValue('id');
if ($this->element['table']) {
switch (strtolower($this->element['table'])) {
case "category":
$whereLabel = 'parent_id';
$whereValue = (int) $this->form->getValue('parent_id');
$table = '#__phocadownload_categories';
break;
case "tag":
$whereLabel = '';
$whereValue = '';
$table = '#__phocadownload_tags';
break;
case "file":
default:
$whereLabel = 'catid';
$whereValue = (int) $this->form->getValue('catid');
$table = '#__phocadownload';
break;
}
} else {
$whereLabel = 'catid';
$whereValue = (int) $this->form->getValue('catid');
$table = '#__phocadownload';
}
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
// Initialize JavaScript field attributes.
$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
// Build the query for the ordering list.
$query = 'SELECT ordering AS value, title AS text' .
' FROM ' . $table;
if ($whereLabel != '') {
$query .= ' WHERE '.$whereLabel.' = ' . (int) $whereValue;
}
$query .= ' ORDER BY ordering';
// Create a read-only list (no name) with a hidden input to store the value.
if ((string) $this->element['readonly'] == 'true') {
$html[] = HTMLHelper::_('list.ordering', '', $query, trim($attr), $this->value, $id ? 0 : 1);
$html[] = '<input type="hidden" name="'.$this->name.'" value="'.$this->value.'"/>';
}
// Create a regular list.
else {
$html[] = HTMLHelper::_('list.ordering', $this->name, $query, trim($attr), $this->value, $id ? 0 : 1);
}
return implode($html);
}
}

View File

@ -0,0 +1,53 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('_JEXEC') or die();
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
class JFormFieldPhocaDownloadToken extends FormField
{
protected $type = 'PhocaDownloadToken';
protected function getInput() {
//PhocaDownlooadUtils::getToken()
$salt = md5('string '. date('s'). mt_rand(0,9999) . str_replace(mt_rand(0,9), mt_rand(0,9999), date('r')). 'end string');
$token = hash('sha256', $salt . time());
// Initialize variables.
$html = array();
// Initialize some field attributes.
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$maptype = ( (string)$this->element['maptype'] ? $this->element['maptype'] : '' );
// Initialize JavaScript field attributes.
$onchange = (string) $this->element['onchange'];
$onchangeOutput = ' onChange="'.(string) $this->element['onchange'].'"';
$html[] = '<div class="input-append input-group">';
$html[] = '<input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .
' '.$class.$size.$disabled.$readonly.$onchangeOutput.$maxLength.' />';
$html[] = '<a class="btn btn-primary" title="'.Text::_('COM_PHOCADOWNLOAD_SET_TOKEN').'"'
.' href="javascript:void(0);"'
.' onclick="javascript:document.getElementById(\''.$this->id.'_id\').value = \''.$token.'\';return true;">'
. Text::_('COM_PHOCADOWNLOAD_SET_TOKEN').'</a>';
$html[] = '</div>'. "\n";
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1,61 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
class JFormFieldPhocaHead extends FormField
{
protected $type = 'PhocaHead';
protected function getLabel() { return '';}
protected function getInput() {
$tc = 'phocadownload';
//$ts = 'media/com_'.$tc.'/css/administrator/';
$ti = 'media/com_'.$tc.'/images/administrator/';
//HTMLHelper::stylesheet( $ts.'/'.$tc.'options.css' );
$app = Factory::getApplication();
$wa = $app->getDocument()->getWebAssetManager();
$option = 'com_phocadownload';
$wa->registerAndUseStyle($option . '.options', 'media/' .$option . '/css/administrator/phocadownloadoptions.css', array('version' => 'auto'));
$wa->registerAndUseStyle($option . '.theme', 'media/' .$option . '/css/administrator/theme-dark.css', array('version' => 'auto'), [], ['template.active']);
//echo '<div style="clear:both;"></div>';
$phocaImage = ( (string)$this->element['phocaimage'] ? $this->element['phocaimage'] : '' );
$image = '';
if ($phocaImage != ''){
$image = HTMLHelper::_('image', $ti . $phocaImage, '' );
}
if ($this->element['default']) {
if ($image != '') {
return '<div class="ph-options-head">'
.'<div>'. $image.' <strong>'. Text::_($this->element['default']) . '</strong></div>'
.'</div>';
} else {
return '<div class="ph-options-head">'
.'<strong>'. Text::_($this->element['default']) . '</strong>'
.'</div>';
}
} else {
return parent::getLabel();
}
//echo '<div style="clear:both;"></div>';
}
}
?>

View File

@ -0,0 +1,51 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
jimport('joomla.html.html');
jimport('joomla.form.formfield');
class JFormFieldPhocaHeadExpert extends FormField
{
protected $type = 'PhocaHeadExpert';
protected function getLabel() { return '';}
protected function getInput() {
$tc = 'phocadownload';
$ts = 'media/com_'.$tc.'/css/administrator/';
$ti = 'media/com_'.$tc.'/images/administrator/';
HTMLHelper::stylesheet( $ts.'/'.$tc.'options.css' );
echo '<div style="clear:both;"></div>';
$phocaImage = ( (string)$this->element['phocaimage'] ? $this->element['phocaimage'] : '' );
$image = '';
if ($phocaImage != ''){
$image = HTMLHelper::_('image', $ti . $phocaImage, '' );
}
if ($this->element['default']) {
if ($image != '') {
return '<div class="ph-options-head-expert">'
.'<div>'. $image.' <strong>'. Text::_($this->element['default']) . '</strong></div>'
.'</div>';
} else {
return '<div class="ph-options-head-expert">'
.'<strong>'. Text::_($this->element['default']) . '</strong>'
.'</div>';
}
} else {
return parent::getLabel();
}
echo '<div style="clear:both;"></div>';
}
}
?>

View File

@ -0,0 +1,40 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('JPATH_BASE') or die;
jimport('joomla.form.formfield');
class JFormFieldPhocaInfoText extends JFormField
{
protected $type = 'PhocaInfoText';
protected function getInput()
{
$class = 'inputbox';
if ((string) $this->element['class'] != '') {
$class = $this->element['class'];
}
return '<div class="'.$class.'" style="padding-top:5px">'.$this->value.'</div>';
}
protected function getLabel()
{
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
}

View File

@ -0,0 +1,80 @@
<?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('JPATH_BASE') or die;
jimport('joomla.form.formfield');
class JFormFieldPhocaLongText extends JFormField
{
protected $type = 'PhocaLongText';
protected $phocaParams = null;
protected function getInput() {
$document = JFactory::getDocument();
$option = JFactory::getApplication()->input->getCmd('option');
$globalValue = $this->_getPhocaParams( $this->element['name'] );
// Initialize some field attributes.
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
// TODO 1.6
// MENU - Set Default value to "" because of saving "" value into the menu link ( use global = "")
if ($option == "com_menus") {
$DefaultValue = (string)$this->element['default'];
if ($value == $DefaultValue) {
$value = '';
}
}
// MENU - Display the global value
if ($option == "com_menus") {
$html ='<table><tr><td colspan="3"><input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/></td></tr>';
$html .='<tr><td>[</td><td><input type="text" value="'. $globalValue .'" style="width:15em;border:1px solid #fff;background:#fff;" /></td><td>]</td></tr></table>';
} else {
$html ='<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>';
}
return $html;
}
protected function getLabel() {
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
protected function _setPhocaParams(){
$component = 'com_phocadownload';
$paramsC = JComponentHelper::getParams($component) ;
$this->phocaParams = $paramsC;
}
protected function _getPhocaParams( $name ){
// Don't call sql query by every param item (it will be loaded only one time)
if (!$this->phocaParams) {
$params = $this->_setPhocaParams();
}
$globalValue = $this->phocaParams->get( $name, '' );
return $globalValue;
}
}
?>

View File

@ -0,0 +1,153 @@
<?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('JPATH_BASE') or die;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectFilename extends FormField
{
public $type = 'PhocaSelectFilename';
protected function getInput()
{
// Initialize variables.
$html = array();
$idA = 'phFileNameModal';
$onchange = (string) $this->element['onchange'];
//$size = ($v = $this->element['size']) ? ' size="' . $v . '"' : '';
//$class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="form-control"';
$required = ($v = $this->element['required']) ? ' required="required"' : '';
// Initialize some field attributes.
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : 'form-control';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
// Manager
$manager = $this->element['manager'] ? $this->element['manager'] : '';
$managerOutput = $this->element['manager'] ? '&amp;manager='.(string) $this->element['manager'] : '';
$idA .= 'mo' . $manager;
$group = PhocaDownloadSettings::getManagerGroup((string) $this->element['manager']);
$textButton = 'COM_PHOCADOWNLOAD_FORM_SELECT_'.strtoupper($group['t']);
$link = 'index.php?option=com_phocadownload&amp;view=phocadownloadmanager'.$group['c'].$managerOutput.'&amp;field='.$this->id;
HTMLHelper::_('jquery.framework');
$script = array();
$script[] = ' function phocaSelectFileName_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'").value = title;';
$script[] = ' '.$onchange;
//$script[] = ' jModalClose();';
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
//$script[] = ' SqueezeBox.close();';
//$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
$script[] = ' }';
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
$html[] = '<div class="input-append input-group">';
$html[] = '<span class="input-append input-group"><input type="text" id="' . $this->id . '" name="' . $this->name . '"'
. ' value="' . $this->value . '"' . $attr . ' />';
$html[] = '<a href="'.$link.'" role="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#'.$idA.'" title="' . Text::_($textButton) . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_($textButton) . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_($textButton),
'width' => '',
'height' => '',
'modalWidth' => '80',
'bodyHeight' => '80',
'footer' => '<div class="ph-info-modal"></div><button type="button" class="btn btn-primary" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCADOWNLOAD_CLOSE') . '</button>'
)
);
return implode("\n", $html);
// Load the modal behavior script.
//JHtml::_('behavior.modal', 'a.modal_'.$this->id);
// Build the script.
/* $script = array();
$script[] = ' function phocaSelectFileName_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = title;';
$script[] = ' '.$onchange;
$script[] = ' SqueezeBox.close();';
$script[] = ' }';
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
*/
/*$html[] = '<div class="fltlft">';
$html[] = ' <input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .
' '.$attr.' />';
$html[] = '</div>';
// Create the user select button.
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
$html[] = ' <a class="modal_'.$this->id.'" title="'.Text::_($textButton).'"' .
' href="'.($this->element['readonly'] ? '' : $link).'"' .
' rel="{handler: \'iframe\', size: {x: 780, y: 560}}">';
$html[] = ' '.Text::_($textButton).'</a>';
$html[] = ' </div>';
$html[] = '</div>';*/
/* Factory::getDocument()->addScriptDeclaration('
function phocaSelectFileName_' . $this->id . '(name) {
document.getElementById("' . $this->id . '").value = name;
jQuery(\'#'.$idA.'\').modal(\'toggle\');
}
');*/
/*$html[] = '<span class="input-append"><input type="text" ' . $required . ' id="' . $this->id . '" name="' . $this->name . '"'
. ' value="' . $this->value . '"' . $size . $class . ' />';
$html[] = '<a href="#'.$idA.'" role="button" class="btn btn-primary" data-toggle="modal" title="' . Text::_($textButton) . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_($textButton) . '</a></span>';
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_($textButton),
'width' => '700px',
'height' => '400px',
'modalWidth' => '80',
'bodyHeight' => '70',
'footer' => '<button type="button" class="btn btn-primary" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCADOWNLOAD_CLOSE') . '</button>'
)
);*/
}
}

View File

@ -0,0 +1,41 @@
<?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();
use Joomla\CMS\Form\FormField;
class JFormFieldPhocaTags extends FormField
{
protected $type = 'PhocaTags';
protected function getInput() {
$id = (int) $this->form->getValue('id');
$activeTags = array();
if ((int)$id > 0) {
$activeTags = PhocaDownloadTag::getTags($id, 1);
}
//return PhocaGalleryTag::getAllTagsSelectBox($this->name, $this->id, $activeTags, NULL,'id' );
$tags = PhocaDownloadTag::getAllTags();
$data = $this->getLayoutData();
$data['options'] = (array)$tags;
$data['value'] = $activeTags;
return $this->getRenderer($this->layout)->render($data);
}
}
?>

View File

@ -0,0 +1,75 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('JPATH_BASE') or die;
jimport('joomla.form.formfield');
class JFormFieldPhocaText extends JFormField
{
protected $type = 'PhocaText';
protected $phocaParams = null;
protected function getInput() {
$document = JFactory::getDocument();
$option = JFactory::getApplication()->input->getCmd('option');
$globalValue = $this->_getPhocaParams( $this->element['name'] );
// Initialize some field attributes.
$size = $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$maxLength = $this->element['maxlength'] ? ' maxlength="'.(int) $this->element['maxlength'].'"' : '';
$readonly = ((string) $this->element['readonly'] == 'true') ? ' readonly="readonly"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
// TODO 1.6
// MENU - Set Default value to "" because of saving "" value into the menu link ( use global = "")
if ($option == "com_menus") {
$DefaultValue = (string)$this->element['default'];
if ($value == $DefaultValue) {
$value = '';
}
}
$html ='<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="'.$value.'"'
.$class.$size.$disabled.$readonly.$onchange.$maxLength.'/>';
// MENU - Display the global value
if ($option == "com_menus") {
$html .= '<span style="margin-left:10px;">[</span><span style="background:#fff;"> ' . $globalValue . ' </span><span>]</span>';
}
return $html;
}
protected function getLabel() {
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
protected function _setPhocaParams(){
$component = 'com_phocadownload';
$paramsC = JComponentHelper::getParams($component) ;
$this->phocaParams = $paramsC;
}
protected function _getPhocaParams( $name ){
// Don't call sql query by every param item (it will be loaded only one time)
if (!$this->phocaParams) {
$params = $this->_setPhocaParams();
}
$globalValue = $this->phocaParams->get( $name, '' );
return $globalValue;
}
}
?>

View File

@ -0,0 +1,81 @@
<?php
/* @package Joomla
* @copyright Copyright (C) Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* @extension Phoca Extension
* @copyright Copyright (C) Jan Pavelka www.phoca.cz
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
*/
defined('JPATH_BASE') or die;
jimport('joomla.form.formfield');
class JFormFieldPhocaTextArea extends JFormField
{
protected $type = 'PhocaTextArea';
protected $phocaParams = null;
protected function getInput() {
$document = JFactory::getDocument();
$option = JFactory::getApplication()->input->getCmd('option');
$globalValue = $this->_getPhocaParams( $this->element['name'] );
// Initialize some field attributes.
$class = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$disabled = ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : '';
$columns = $this->element['cols'] ? ' cols="'.(int) $this->element['cols'].'"' : '';
$rows = $this->element['rows'] ? ' rows="'.(int) $this->element['rows'].'"' : '';
// Initialize JavaScript field attributes.
$onchange = $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';
$value = htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8');
// TODO 1.6
// MENU - Set Default value to "" because of saving "" value into the menu link ( use global = "")
if ($option == "com_menus") {
$DefaultValue = (string)$this->element['default'];
if ($value == $DefaultValue) {
$value = '';
}
}
// MENU - Display the global value
if ($option == "com_menus") {
$html ='<table><tr><td colspan="3"><textarea name="'.$this->name.'" id="'.$this->id.'"' .
$columns.$rows.$class.$disabled.$onchange.'>' .
$value .
'</textarea></td></tr>';
$html .='<tr><td>[</td><td><input type="text" value="'. $globalValue .'" style="width:15em;border:1px solid #fff;background:#fff;" /></td><td>]</td></tr></table>';
} else {
$html = '<textarea name="'.$this->name.'" id="'.$this->id.'"' .
$columns.$rows.$class.$disabled.$onchange.'>' .
$value .
'</textarea>';
}
return $html;
}
protected function getLabel() {
echo '<div class="clearfix"></div>';
return parent::getLabel();
echo '<div class="clearfix"></div>';
}
protected function _setPhocaParams(){
$component = 'com_phocadownload';
$paramsC = JComponentHelper::getParams($component) ;
$this->phocaParams = $paramsC;
}
protected function _getPhocaParams( $name ){
// Don't call sql query by every param item (it will be loaded only one time)
if (!$this->phocaParams) {
$params = $this->_setPhocaParams();
}
$globalValue = $this->phocaParams->get( $name, '' );
return $globalValue;
}
}
?>

View File

@ -0,0 +1,46 @@
<?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();
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Form\Field\ListField;
phocadownloadimport('phocadownload.user.user');
class JFormFieldPhocaUsers extends ListField
{
protected $type = 'PhocaUsers';
protected function getInput() {
$data = $this->getLayoutData();
$userId = (string) $this->form->getValue($this->element['name']);
$data['options'] = (array) PhocaDownloadUser::usersList($this->name, $this->id, $userId, 1, NULL,'name', 0, 1 );
$activeArray = $userId;
if ($userId != '') {
$activeArray = explode(',',$userId);
}
if (!empty($activeArray)) {
$data['value'] = $activeArray;
} else {
$data['value'] = $this->value;
}
return $this->getRenderer($this->layout)->render($data);
}
}
?>