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,98 @@
<?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\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');
class JFormFieldPhocaAccessLevel extends ListField
{
public $type = 'PhocaAccessLevel';
protected function getInput()
{
// Initialize variables.
$attr = '';
// Initialize some field attributes.
$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : 'class="form-control"';
$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 JHtml::_('access.level', $this->name, $this->value, $attr, $options, $this->id);
return JFormFieldPhocaAccessLevel::accessLevel( $this->name, $this->value, $attr, $options, $this->id);
}
/*
* Copy of JHtml::_('access.level', $this->name, $this->value, $attr, $options, $this->id);
* because of prevent from loading the "Public"
*/
public static function accessLevel($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');
$query->group('a.id, a.title');
$query->order('a.ordering ASC');
$query->where('a.id <> 1');//PHOCAEDIT
$query->order('`title` ASC');
// Get the options.
$db->setQuery($query);
$options = $db->loadObjectList();
// Check for a database error.
/*if ($db->getErrorNum()) {
throw new Exception($db->getErrorMsg(), 500);
return null;
}*/
// 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 HTMLHelper::_('select.genericlist', $options, $name,
array(
'list.attr' => $attribs,
'list.select' => $selected,
'id' => $id
)
);
}
}

View File

@ -0,0 +1,93 @@
<?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\HTML\HTMLHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaColorText extends FormField
{
protected $type = 'PhocaColorText';
protected $phocaParams = null;
protected function getInput() {
$document = Factory::getDocument();
$option = Factory::getApplication()->input->getCmd('option');
$globalValue = $this->_getPhocaParams( $this->element['name'] );
HTMLHelper::stylesheet( 'media/com_phocagallery/js/jcp/picker.css' );
$document->addScript(Uri::base(true).'/media/com_phocagallery/js/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');
// TO DO 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" class="btn" onclick="openPicker(\''.$nameCP.'\')" >' . Text::_('COM_PHOCAGALLERY_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_phocagallery';
$paramsC = ComponentHelper::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,156 @@
<?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;
use Joomla\Component\Fields\Administrator\Helper\FieldsHelper;
if (! class_exists('PhocaGalleryLoader')) {
require_once( JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries/loader.php');
}
phocagalleryimport('phocagallery.render.renderadmin');
phocagalleryimport('phocagallery.html.categoryhtml');
Factory::getApplication()->getLanguage()->load('com_phocagallery');
class JFormFieldPhocaGalleryCategory extends FormField
{
protected $type = 'PhocaGalleryCategory';
protected $layout = 'phocagallery.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_phocagallery/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 'phocagallerycategory':
if ($this->form->getValue('id') > 0)
$omitIds[] = $this->form->getValue('id');
break;
}
$db->setQuery('SELECT a.*, null AS children FROM #__phocagallery_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_PHOCAGALLERY_NONE'), 'value', 'text');
$options[] = HTMLHelper::_('select.option', '-1', Text::_('COM_PHOCAGALLERY_ALL'), 'value', 'text');
}
} else {
// in filter we need zero value for canceling the filter
if ($typeMethod == 'filter') {
$options[] = HTMLHelper::_('select.option', '', '- ' . Text::_('COM_PHOCAGALLERY_SELECT_CATEGORY') . ' -', 'value', 'text');
} else {
$options[] = HTMLHelper::_('select.option', '0', '- '.Text::_('COM_PHOCAGALLERY_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_phocagallery.phocagalleryitem'));
$document = Factory::getDocument();
$document->addCustomTag('<script type="text/javascript">
function changeCatid() {
var catid = document.getElementById(\'jform_catid\').value;
var href = document.getElementById(\'pgselectytb\').getAttribute(\'data-url\');
href = href ? href.substring(0, href.lastIndexOf("&")) : \'\';
href += \'&catid=\' + catid;
document.getElementById(\'pgselectytb\').setAttribute(\'data-url\', href);
}
</script>');
return $this->getRenderer($this->layout)->render($data);
}
}
?>

View File

@ -0,0 +1,116 @@
<?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 JFormFieldPhocaGalleryOrdering extends FormField
{
protected $type = 'PhocaGalleryOrdering';
protected function getInput() {
// Initialize variables.
$html = array();
$attr = '';
// Get some field values from the form.
$id = (int) $this->form->getValue('id');
$title = 'title';
if ($this->element['table']) {
switch (strtolower($this->element['table'])) {
case "category":
$whereLabel = 'parent_id';
$whereValue = (int) $this->form->getValue('parent_id');
$table = '#__phocagallery_categories';
break;
case "commentimage":
$whereLabel = 'imgid';
$whereValue = (int) $this->form->getValue('imgid');
$table = '#__phocagallery_img_comments';
break;
case "comment":
$whereLabel = 'catid';
$whereValue = (int) $this->form->getValue('catid');
$table = '#__phocagallery_comments';
break;
case "fbuser":
$whereLabel = '';
$whereValue = '';
$table = '#__phocagallery_fb_users';
$title = 'name';
break;
case "tag":
$whereLabel = '';
$whereValue = '';
$table = '#__phocagallery_tags';
break;
case "styles":
$whereLabel = 'type';
$whereValue = (int) $this->form->getValue('type');
$table = '#__phocagallery_styles';
break;
case "image":
default:
$whereLabel = 'catid';
$whereValue = (int) $this->form->getValue('catid');
$table = '#__phocagallery';
break;
}
} else {
$whereLabel = 'catid';
$whereValue = (int) $this->form->getValue('catid');
$table = '#__phocagallery';
}
// 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,57 @@
<?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\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() {
$app = Factory::getApplication();
$wa = $app->getDocument()->getWebAssetManager();
$option = 'com_phocagallery';
$wa->registerAndUseStyle($option . '.options', 'media/' .$option . '/css/administrator/phocagalleryoptions.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', 'media/com_phocagallery/images/administrator/'. $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,43 @@
<?php
/*
* @package Joomla
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
*
* @component Phoca Gallery
* @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;
jimport('joomla.form.formfield');
class JFormFieldPhocaInfoText extends FormField
{
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,83 @@
<?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\Component\ComponentHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaLongText extends FormField
{
protected $type = 'PhocaLongText';
protected $phocaParams = null;
protected function getInput() {
$document = Factory::getDocument();
$option = Factory::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');
// TO DO 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_phocagallery';
$paramsC = ComponentHelper::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,117 @@
<?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;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectFbAlbum extends FormField
{
public $type = 'phocaSelectFbAlbum';
protected function getInput()
{
// Initialize variables.
$html = array();
// Initialize some field attributes.
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$uid = $this->form->getValue('extfbuid');
$suffix = '';
if ($uid != '') { $suffix .= '&amp;uid='.$uid;}
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryfba&amp;tmpl=component&amp;field='.$this->id. $suffix;
// Initialize JavaScript field attributes.
$onchange = (string) $this->element['onchange'];
// Build the script.
/* $script = array();
$script[] = ' function phocaSelectFbAlbum_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = title;';
$script[] = ' '.$onchange;
$script[] = ' SqueezeBox.close();';
$script[] = ' }';*/
HTMLHelper::_('jquery.framework');
$idA = 'pgselectfbalbum';
// Build the script.
$script = array();
$script[] = ' function phocaSelectFBAlbum_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'").value = title;';
$script[] = ' '.$onchange;
//$script[] = ' SqueezeBox.close();';
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
$script[] = ' }';
$script[] = 'window.closeModal = function(){';
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'hide\');';
$script[] = '}';
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
/* $html[] = '<div class="input-append">';
$html[] = '<input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .' '.$attr.' />';
$html[] = '<a id="pglinktoalbum" class="modal_'.$this->id.' btn" title="'.Text::_('COM_PHOCAGALLERY_FB_SELECT_ALBUM').'"'
.' href="'.($this->element['readonly'] ? '' : $link).'"'
.' rel="{handler: \'iframe\', size: {x: 650, y: 400}}">'
. Text::_('COM_PHOCAGALLERY_FB_SELECT_ALBUM').'</a>';
$html[] = '</div>'. "\n";*/
$html[] = '<div class="input-append">';
$html[] = '<span class="input-append"><input type="text" id="' . $this->id . '" name="' . $this->name . '"'
. ' value="' . $this->value . '"' . $attr . ' />';
$html[] = '<a href="#'.$idA.'" role="button" class="btn " data-toggle="modal" title="' . Text::_('COM_PHOCAGALLERY_FB_SELECT_ALBUM') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FB_SELECT_ALBUM') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FB_SELECT_ALBUM'),
'width' => '700px',
'height' => '400px',
'modalWidth' => '80',
'bodyHeight' => '70',
'footer' => '<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1,61 @@
<?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;
if (! class_exists('PhocaGalleryLoader')) {
require_once( JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries/loader.php');
}
phocagalleryimport('phocagallery.render.renderadmin');
class JFormFieldPhocaSelectFbUser extends FormField
{
protected $type = 'PhocaSelectFbUser';
protected function getInput() {
$db = Factory::getDBO();
//build the list of categories
$query = 'SELECT a.id AS value, '
. ' CASE WHEN CHAR_LENGTH(a.name) THEN a.name ELSE a.appid END as text'
. ' FROM #__phocagallery_fb_users AS a'
. ' WHERE a.published = 1'
. ' ORDER BY a.ordering';
$db->setQuery( $query );
$items = $db->loadObjectList();
// TO DO - check for other views than category edit
/*$view = JFactory::getApplication()->input->get( 'view' );
$catId = -1;
if ($view == 'phocagalleryc') {
$id = $this->form->getValue('id'); // id of current category
if ((int)$id > 0) {
$catId = $id;
}
}*/
$fieldId = $this->element['fieldid'] ? $this->element['fieldid'] : '';
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryfba&amp;tmpl=component&amp;field=jform_'.$fieldId.'&amp;uid=';
$js = 'document.getElementById(\'pglinktoalbum\').href = \''.$link.'\' + this.value';
array_unshift($items, HTMLHelper::_('select.option', '', '- '.Text::_('COM_PHOCAGALLERY_SELECT_FB_USER').' -', 'value', 'text'));
return HTMLHelper::_('select.genericlist', $items, $this->name, 'class="form-control" onchange="'.$js.'"', 'value', 'text', $this->value, $this->id );
}
}
?>

View File

@ -0,0 +1,136 @@
<?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;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectFilename extends FormField
{
public $type = 'PhocaSelectFilename';
protected function getInput()
{
// Initialize variables.
$html = array();
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryi&amp;tmpl=component&amp;field='.$this->id;
$onchange = (string) $this->element['onchange'];
$size = ($v = $this->element['size']) ? ' size="' . $v . '"' : '';
$class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"';
$required = ($v = $this->element['required']) ? ' required="required"' : '';
// Initialize some field attributes.
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$idA = 'phFileNameModal';
// If external image, we don't need the filename will be required
$extId = (int) $this->form->getValue('extid');
if ($extId > 0) {
$readonly = ' readonly="readonly"';
$attr = '';
return '<input type="text" name="'.$this->name.'" id="'.$this->id.'" value="-" '.$attr.$readonly.' class="form-control" />';
}
/*$script = array();
$script[] = ' function phocaSelectFileName_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'").value = title;';
$script[] = ' '.$onchange;
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
$script[] = ' }';
JFactory::getDocument()->addScriptDeclaration(implode("\n", $script));*/
HTMLHelper::_('jquery.framework');
/* JFactory::getDocument()->addScriptDeclaration('
function phocaSelectFileName_' . $this->id . '(name) {
document.getElementById("' . $this->id . '").value = name;
jQuery(\'#'.$idA.'\').modal(\'toggle\');
}
');*/
$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-group input-append">';
$html[] = '<span class="input-group input-append"><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::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME'),
'width' => '',
'height' => '',
'modalWidth' => '80',
'bodyHeight' => '80',
'footer' => '<div class="ph-info-modal"></div><button type="button" class="btn" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);
/*
//readonly="readonly"
$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::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME') . '</a></span>';
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_FILENAME'),
'width' => '700px',
'height' => '400px',
'modalWidth' => '80',
'bodyHeight' => '70',
'footer' => '<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);*/
// We don't use hidden field name, we can edit it the filename form field, there are three ways of adding filename:
// - manually typed
// - selected by image select box
// - added per YouTube import
//
// The name="' . $this->name . '" is used above in standard input form
//
//$html[] = '<input class="input-small" type="hidden" name="' . $this->name . '" value="'
// . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';
return implode("\n", $html);
}
}

View File

@ -0,0 +1,110 @@
<?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;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectFolder extends FormField
{
public $type = 'PhocaSelectFolder';
protected function getInput()
{
// Initialize variables.
$html = array();
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryf&amp;tmpl=component&amp;field='.$this->id;
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$onchange = (string) $this->element['onchange'];
$required = ($v = $this->element['required']) ? ' required="required"' : '';
// Build the script.
/* $script = array();
$script[] = ' function phocaSelectFolder_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = title;';
$script[] = ' '.$onchange;
$script[] = ' SqueezeBox.close();';
$script[] = ' }';*/
HTMLHelper::_('jquery.framework');
$idA = 'pgselectfolder';
// Build the script.
$script = array();
$script[] = ' function phocaSelectFolder_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'").value = title;';
$script[] = ' '.$onchange;
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'hide\');';
$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::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER').'"' .
' href="'.($this->element['readonly'] ? '' : $link).'"' .
' rel="{handler: \'iframe\', size: {x: 650, y: 375}}">';
$html[] = ' '.Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER').'</a>';
$html[] = ' </div>';
$html[] = '</div>';*/
/* $html[] = '<div class="input-append">';
$html[] = '<input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' .' '.$attr.' />';
$html[] = '<a class="modal_'.$this->id.' btn" title="'.Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER').'"'
.' href="'.($this->element['readonly'] ? '' : $link).'"'
.' rel="{handler: \'iframe\', size: {x: 650, y: 400}}">'
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER').'</a>';
$html[] = '</div>'. "\n";*/
$html[] = '<div class="input-group input-append">';
$html[] = '<span class="input-group input-append"><input type="text" ' . $required . ' 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::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_FOLDER'),
'width' => '700px',
'height' => '400px',
'modalWidth' => '80',
'bodyHeight' => '70',
'footer' => '<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);
return implode("\n", $html);
}
}

View File

@ -0,0 +1,108 @@
<?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\Session\Session;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectItem extends FormField
{
public $type = 'PhocaSelectItem';
protected function getInput() {
$html = array();
$url = 'index.php?option=com_phocagallery&view=phocagalleryitema&format=json&tmpl=component&'. Session::getFormToken().'=1';
// Possible problem with modal
//$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].' typeahead"' : ' class="typeahead"';
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].' "' : ' class=""';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
$attr .= $this->element['required'] ? ' required aria-required="true"' : '';
$clearId = 'phClearId'.$this->id;
if ($this->multiple) {
$multiple = 'true';
} else {
$multiple = 'false';
}
$onchange = (string) $this->element['onchange'];
$value = '';
$image = PhocaGalleryImage::getImageByImageId((int)$this->value);// We don't need catid, we get all categories title
if(isset($image->id)) {
$value .= (int)$image->id . ':'. $image->title .' ('.$image->category_title.')';
}
$id = (int)$this->value;
$document = Factory::getDocument();
$app = Factory::getApplication();
$wa = $app->getDocument()->getWebAssetManager();
HTMLHelper::_('jquery.framework', false);
//HTMLHelper::_('script', 'media/com_phocagallery/js/administrator/select2/select2.js', array('version' => 'auto'));
//HTMLHelper::_('script', 'media/com_phocagallery/js/administrator/select2/jquery.phocaselect2.js', array('version' => 'auto'));
//HTMLHelper::_('stylesheet', 'media/com_phocagallery/js/administrator/select2/select2.css', array('version' => 'auto'));
$wa->registerAndUseScript('com_phocagallery.select2', 'media/com_phocagallery/js/administrator/select2/select2.js', array('version' => 'auto'));
$wa->registerAndUseScript('com_phocagallery.phocaselect2', 'media/com_phocagallery/js/administrator/select2/jquery.phocaselect2.js', array('version' => 'auto'));
$wa->registerAndUseStyle('com_phocagallery.select2', 'media/com_phocagallery/js/administrator/select2/select2.css', array('version' => 'auto'));
$document->addScriptOptions('phLang', array(
'COM_PHOCAGALLERY_NO_MATCHES_FOUND' => Text::_('COM_PHOCAGALLERY_NO_MATCHES_FOUND'),
'COM_PHOCAGALLERY_PLEASE_ENTER' => Text::_('COM_PHOCAGALLERY_PLEASE_ENTER'),
'COM_PHOCAGALLERY_S_MORE_CHARACTER' => Text::_('COM_PHOCAGALLERY_S_MORE_CHARACTER'),
'COM_PHOCAGALLERY_PLEASE_DELETE' => Text::_('COM_PHOCAGALLERY_PLEASE_DELETE'),
'COM_PHOCAGALLERY_S_CHARACTER' => Text::_('COM_PHOCAGALLERY_S_CHARACTER'),
'COM_PHOCAGALLERY_YOU_CAN_ONLY_SELECT' => Text::_('COM_PHOCAGALLERY_YOU_CAN_ONLY_SELECT'),
'COM_PHOCAGALLERY_S_ITEM' => Text::_('COM_PHOCAGALLERY_S_ITEM'),
'COM_PHOCAGALLERY_LOADING_MORE_RESULTS' => Text::_('COM_PHOCAGALLERY_LOADING_MORE_RESULTS'),
'COM_PHOCAGALLERY_SEARCHING' => Text::_('COM_PHOCAGALLERY_SEARCHING')
));
$document->addScriptOptions('phVars', array('uriRoot' => Uri::root()));
$s = array();
$s[] = 'jQuery(document).ready(function() {';
$s[] = ' phSearchItemsMultiple("#'.$this->id.'", "'.$url.'", '.(int)$id.', '.$multiple.', "[|]");';
if (!$this->multiple) {
$s[] = ' jQuery("#' . $clearId . '").on("click", function() {jQuery("#' . $this->id . '").select2("val", ""); });';
}
$s[] = '});';
$document->addScriptDeclaration(implode("\n", $s));
$class = '';
if (!$this->multiple) {
$class = 'ph-select2-clear-btn-box';
}
$html[] = '<div class="input-append input-group">';
$html[] = '<input type="text" placeholder="&nbsp;" class="'.$class.'" id="'.$this->id.'" name="'.$this->name.'" value="'. $value.'"' .' '.$attr.' />';
if (!$this->multiple) {
$html[] = '<input type="button" class="btn btn-primary" id="' . $clearId . '" name="' . $clearId . '" value="' . Text::_('COM_PHOCAGALLERY_CLEAR') . '"' . ' />';
}
$html[] = '</div>'. "\n";
return implode("\n", $html);
}
}
?>

View File

@ -0,0 +1,127 @@
<?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;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectMap extends FormField
{
public $type = 'PhocaSelectMap';
protected function getInput()
{
// Initialize variables.
$html = array();
// Initialize some field attributes.
$attr = $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';
$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
if ($this->id == 'jform_latitude') {
// One link for latitude, longitude, zoom
$lat = $this->form->getValue('latitude');
$lng = $this->form->getValue('longitude');
$zoom = $this->form->getValue('zoom');
$suffix = '';
if ($lat != '') { $suffix .= '&amp;lat='.$lat;}
if ($lng != '') { $suffix .= '&amp;lng='.$lng;}
if ($zoom != '') { $suffix .= '&amp;zoom='.$zoom;}
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryg&amp;tmpl=component&amp;field='.$this->id. $suffix;
HTMLHelper::_('jquery.framework');
}
$idA = 'pgselectmap';
// Initialize JavaScript field attributes.
$onchange = (string) $this->element['onchange'];
/* // Build the script.
$script = array();
$script[] = ' function phocaSelectMap_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'_id").value = title;';
$script[] = ' '.$onchange;
//$script[] = ' SqueezeBox.close();';
$script[] = ' }';*/
// Build the script.
$script = array();
$script[] = ' function phocaSelectMap_'.$this->id.'(title) {';
$script[] = ' document.getElementById("'.$this->id.'").value = title;';
$script[] = ' '.$onchange;
$script[] = ' jModalClose();';
//$script[] = ' SqueezeBox.close();';
//$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
$script[] = ' }';
// Hide Info box on start
if ($this->id == 'jform_latitude') {
$script[] = ' jQuery(document).ready(function() {';
$script[] = ' jQuery(\'#'.$idA.'\').on(\'shown.bs.modal\', function () {';
$script[] = ' jQuery(\'#phmPopupInfo\').html(\'\');';
$script[] = ' })';
$script[] = ' })';
}
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
if ($this->id == 'jform_latitude') {
/*$html[] = '<div class="input-append">';
$html[] = '<input type="text" id="'.$this->id.'_id" name="'.$this->name.'" value="'. $this->value.'"' . ' '.$attr.' />';
$html[] = '<a class="modal_'.$this->id.' btn" title="'.Text::_('COM_PHOCAGALLERY_FORM_SELECT_COORDINATES').'"'
.' href="'.($this->element['readonly'] ? '' : $link).'"'
.' rel="{handler: \'iframe\', size: {x: 560, y: 470}}">'
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_COORDINATES').'</a>';
$html[] = '</div>'. "\n";*/
$html[] = '<div class="input-group input-append">';
$html[] = '<span class="input-group input-append"><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::_('COM_PHOCAGALLERY_FORM_SELECT_COORDINATES') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_COORDINATES') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_COORDINATES'),
'width' => '560px',
'height' => '470px',
'modalWidth' => '50',
'bodyHeight' => '70',
'footer' => '<div id="phmPopupInfo" class="ph-info-modal"></div><button type="button" class="btn" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);
} else {
$html[] = '<input type="text" id="'.$this->id.'" name="'.$this->name.'" value="'. $this->value.'"' . ' '.$attr.' />';
}
return implode("\n", $html);
}
}

View File

@ -0,0 +1,144 @@
<?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;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
jimport('joomla.form.formfield');
class JFormFieldPhocaSelectYtb extends FormField
{
public $type = 'PhocaSelectYtb';
protected function getInput()
{
// Initialize variables.
$html = array();
$suffix = '';
$catid = $this->form->getValue('catid');
if ((int)$catid > 0) {
$suffix .= '&amp;catid='.$catid;
} else {
$suffix .= '&amp;catid=0';
}
$link = 'index.php?option=com_phocagallery&amp;view=phocagalleryytb&amp;tmpl=component&amp;field='.$this->id.$suffix;
// 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'].'"' : '';
//$required = ($v = $this->element['required']) ? ' required="required"' : '';
// Initialize JavaScript field attributes.
$onchange = (string) $this->element['onchange'];
HTMLHelper::_('jquery.framework');
$idA = 'pgselectytb';
// Build the script.
$script = array();
$script[] = ' function phocaSelectYtb_'.$this->id.'(link, title, desc, filename) {';
$script[] = ' document.getElementById("'.$this->id.'").value = link;';
$script[] = ' document.getElementById("jform_title").value = title;';
$script[] = ' document.getElementById("jform_description").value = desc;';
$script[] = ' document.getElementById("jform_filename").value = filename;';
$script[] = ' '.$onchange;
//$script[] = ' SqueezeBox.close();';
//$script[] = ' jQuery(\'#'.$idA.'\').modal(\'toggle\');';
$script[] = ' jQuery(\'#'.$idA.'\').modal(\'hide\');';
$script[] = ' }';
// Add the script to the document head.
Factory::getDocument()->addScriptDeclaration(implode("\n", $script));
/*
$html[] = '<div class="fltlft">';
$html[] = '<textarea name="'.$this->name.'" id="'.$this->id.'"' .
$columns.$rows.$class.$disabled.$onchange.'>' .
htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') .
'</textarea>';
$html[] = '</div>';
// Create the user select button.
$html[] = '<div class="button2-left">';
$html[] = ' <div class="blank">';
$html[] = ' <a id="pgselectytb" class="modal_'.$this->id.'" title="'.Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB').'"' .
' href="'.($this->element['readonly'] ? '' : $link).'"' .
' rel="{handler: \'iframe\', size: {x: 650, y: 375}}">';
$html[] = ' '.Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB').'</a>';
$html[] = ' </div>';
$html[] = '</div>';*/
$html[] = '<div class="input-group input-append">';
$html[] = '<input type="text" name="'.$this->name.'" id="'.$this->id.'"' .
$columns.$rows.$class.$disabled.$onchange.' value="' .
htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') .
'" />';
//$html[] = '<a id="pgselectytb" class="modal_'.$this->id.' btn" title="'.JText::_('COM_PHOCAGALLERY_FORM_SELECT_YTB').'"'
// .' href="'.($this->element['readonly'] ? '' : $link).'"'
// .' rel="{handler: \'iframe\', size: {x: 650, y: 400}}">'
// . JText::_('COM_PHOCAGALLERY_FORM_SELECT_YTB').'</a>';
//$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 " data-toggle="modal" title="' . JText::_('COM_PHOCAGALLERY_FORM_SELECT_YTB') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB'),
'width' => '700px',
'height' => '400px',
'modalWidth' => '80',
'bodyHeight' => '70',
'footer' => '<button type="button" class="btn" data-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
); */
$html[] = '<a href="'.$link.'" role="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#'.$idA.'" title="' . Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB') . '">'
. '<span class="icon-list icon-white"></span> '
. Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB') . '</a></span>';
$html[] = '</div>'. "\n";
$html[] = HTMLHelper::_(
'bootstrap.renderModal',
$idA,
array(
'url' => $link,
'title' => Text::_('COM_PHOCAGALLERY_FORM_SELECT_YTB'),
'width' => '560px',
'height' => '470px',
'modalWidth' => '50',
'bodyHeight' => '70',
'footer' => '<div class="ph-info-modal"></div><button type="button" class="btn" data-bs-dismiss="modal" aria-hidden="true">'
. Text::_('COM_PHOCAGALLERY_CLOSE') . '</button>'
)
);
return implode("\n", $html);
}
}

View File

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

View File

@ -0,0 +1,83 @@
<?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\Component\ComponentHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaText extends FormField
{
protected $type = 'PhocaText';
protected $phocaParams = null;
protected function getInput() {
$document = Factory::getDocument();
$option = Factory::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');
// TO DO 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_phocagallery';
$paramsC = ComponentHelper::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,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;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
jimport('joomla.form.formfield');
class JFormFieldPhocaTextArea extends FormField
{
protected $type = 'PhocaTextArea';
protected $phocaParams = null;
protected function getInput() {
$document = Factory::getDocument();
$option = Factory::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');
// TO DO 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_phocagallery';
$paramsC = ComponentHelper::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,82 @@
<?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\Field\ListField;
use Joomla\CMS\Form\FormField;
if (! class_exists('PhocaGalleryLoader')) {
require_once( JPATH_ADMINISTRATOR.'/components/com_phocagallery/libraries/loader.php');
}
phocagalleryimport('phocagallery.access.access');
class JFormFieldPhocaUsers extends ListField
{
protected $type = 'PhocaUsers';
protected function getInput() {
$data = $this->getLayoutData();
$userId = $this->form->getValue($this->element['name']);
$owner = ( (string)$this->element['typeowner'] ? $this->element['typeowner'] : 0 );
if ($owner == 1) {
//return PhocaGalleryAccess::usersListOwner($this->name, $this->id, $userId, 1, NULL, 'name', 0, 1 );
$data['options'] = (array) PhocaGalleryAccess::usersListOwner($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);
} else {
// Joomla! 3.1.5: $this->name.'[]'
// Joomla! 3.2.0: $this->name
$userIdString = $userId;
if (is_array($userId)) {
$userIdString = implode(',', $userId);
}
//return PhocaGalleryAccess::usersList($this->name, $this->id, $userIdString, 1, NULL,'name', 0 );
$data['options'] = (array) PhocaGalleryAccess::usersList($this->name, $this->id, $userIdString, 1, NULL,'name', 0, 1 );
$activeArray = $userId;
if ($userId != '' && !is_array($userId)) {
$activeArray = explode(',',$userId);
}
if (!empty($activeArray)) {
$data['value'] = $activeArray;
} else {
$data['value'] = $this->value;
}
return $this->getRenderer($this->layout)->render($data);
}
}
}
?>