diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..8e1b786053f495ba6fe860df5329af793c882b94 --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +BASE=versioncompat +PLUGINTYPE=vmcustom +VERSION=0.2 + +PLUGINFILES=$(BASE).php $(BASE).script.php $(BASE).xml index.html $(BASE)/ + +SYSTRANSLATIONS=$(call wildcard,language/*/*.plg_$(PLUGINTYPE)_$(BASE).*sys.ini) +NONSYSTRANSLATIONS=${SYSTRANSLATIONS:%.sys.ini=%.ini} +TRANSLATIONS=$(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS) $(call wildcard,language/*/index.html) language/index.html + +FIELDS=fields/ elements/ + +ZIPFILE=plg_$(PLUGINTYPE)_$(BASE)_v$(VERSION).zip + +all: zip + +$(NONSYSTRANSLATIONS): %.ini: %.sys.ini + cp $< $@ + +zip: $(PLUGINFILES) $(TRANSLATIONS) $(SYSTRANSLATIONS) $(NONSYSTRANSLATIONS) + @echo "Packing all files into distribution file $(ZIPFILE):" + @zip -r $(ZIPFILE) $(PLUGINFILES) $(TRANSLATIONS) $(FIELDS) + +clean: + rm -f $(ZIPFILE) diff --git a/elements/compatfolders.php b/elements/compatfolders.php new file mode 100644 index 0000000000000000000000000000000000000000..3b2ec020109214471ad3d5f374a397ab46dcdb22 --- /dev/null +++ b/elements/compatfolders.php @@ -0,0 +1,81 @@ +<?php +defined ('_JEXEC') or die(); +/** + * + * @package VirtueMart + * @subpackage Plugins - Elements + * @author Reinhold Kainhofer + * @link http://www.open-tools.net + * @copyright Copyright (C) 2014 Open Tools, Reinhold Kainhofer. All rights reserved. + * Based on Joomla core files: + * @copyright Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE + * + * VirtueMart and this plugin are free software. This version may have been modified pursuant + * to the GNU General Public License, and as distributed it includes or + * is derivative of works licensed under the GNU General Public License or + * other free or open source software licenses. + * + */ +if (!class_exists('VmConfig')) require(JPATH_VM_ADMINISTRATOR.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php'); +if(!class_exists('VmModel')) require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'vmmodel.php'); +jimport('joomla.filesystem.folder'); + +/* + * This class is used by VirtueMart Payment or Shipment Plugins + * which uses JParameter + * So It should be an extension of JElement + * Those plugins cannot be configured througth the Plugin Manager anyway. + */ +class JElementCompatFolders extends JElement { + + /** + * Element name + * + * @access protected + * @var string + */ + var $_name = 'CompatFolders'; + + protected function getGroups($node) + { + $groups = array(''=>JHtml::_('select.option', '', '---')); + foreach ($node->children() as $dir) { + if ($dir->name() != 'folder') continue; + + $directory = (string)$dir->data(); + if ($groupLabel = (string) $dir->attributes('label')) { + $label = JText::_($groupLabel); + } else { + $label = $directory; + } + if (!JFolder::exists($directory)) + $directory = JPATH_ROOT . DS . $directory; + if (!JFolder::exists($directory)) continue; + + // Initialize the group if necessary. + if (!isset($groups[$label])) { + $groups[$label]['id'] = $label; + $groups[$label]['text'] = $label; + $groups[$label]['items'] = array(); + } + + // List all subfolders of the given directory: + $folders = JFolder::folders($directory, (string)$dir->attributes('filter')); + + foreach ($folders as $option) { + $groups[$label]['items'][] = JHtml::_('select.option', (string)$dir->data().$option, $option); + } + } + reset($groups); + return $groups; + } + + function fetchElement ($name, $value, &$node, $control_name) { + $dirs = $this->getGroups($node); + $class = ($node->attributes('class') ? 'class="' . $node->attributes('class') . '"' : ''); + return JHTML::_ ('select.groupedlist', $dirs, '' . $control_name . '[' . $name . ']', + array('id' => $control_name . $name, 'list.attr' => $class, 'list.select' => array($value))); + } + +} diff --git a/elements/index.html b/elements/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0e44bd0ebe788fb287c40c7e92a93b7b1540f0b6 --- /dev/null +++ b/elements/index.html @@ -0,0 +1,4 @@ +<html> +<body bgcolor="#FFFFFF"> +</body> +</html> \ No newline at end of file diff --git a/fields/compatfolders.php b/fields/compatfolders.php index f15ec7c72d383c8ccf18fe2771472b2bf76abb72..0f69303175de468375f83b103c6d45901cf304a3 100644 --- a/fields/compatfolders.php +++ b/fields/compatfolders.php @@ -20,10 +20,10 @@ class JFormFieldCompatFolders extends JFormFieldGroupedList protected function getGroups() { - $groups = array(); + $groups = array(JHtml::_('select.option', '', '---')); foreach ($this->element->children() as $dir) { if ($dir->getName() != 'folder') continue; - + $directory = (string)$dir; if ($groupLabel = (string) $dir['label']) { $label = JText::_($groupLabel); @@ -31,18 +31,18 @@ class JFormFieldCompatFolders extends JFormFieldGroupedList $label = $directory; } if (!JFolder::exists($directory)) - $directory = JPATH_ROOT . '/' . $directory; + $directory = JPATH_ROOT . DS . $directory; if (!JFolder::exists($directory)) continue; // Initialize the group if necessary. - if (!isset($groups[$label])) + if (!isset($groups[$label])) $groups[$label] = array(); - + // List all subfolders of the given directory: $folders = JFolder::folders($directory, (string)$dir['filter']); - + foreach ($folders as $option) { - $groups[$label][] = JHtml::_('select.option', (string)$dir.'/'.$option, $option); + $groups[$label][] = JHtml::_('select.option', (string)$dir.DS.$option, $option); } } reset($groups); diff --git a/fields/index.html b/fields/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0e44bd0ebe788fb287c40c7e92a93b7b1540f0b6 --- /dev/null +++ b/fields/index.html @@ -0,0 +1,4 @@ +<html> +<body bgcolor="#FFFFFF"> +</body> +</html> \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0e44bd0ebe788fb287c40c7e92a93b7b1540f0b6 --- /dev/null +++ b/index.html @@ -0,0 +1,4 @@ +<html> +<body bgcolor="#FFFFFF"> +</body> +</html> \ No newline at end of file diff --git a/language/en-GB/en-GB.plg_vmcustom_versioncompat.ini b/language/en-GB/en-GB.plg_vmcustom_versioncompat.ini index abd7ae0154895f29a0df2c4af74a96c909c5bbf4..a596460739cf404b7009edcb40c6b5f77b463a59 100644 --- a/language/en-GB/en-GB.plg_vmcustom_versioncompat.ini +++ b/language/en-GB/en-GB.plg_vmcustom_versioncompat.ini @@ -8,4 +8,9 @@ VMCUSTOM_VERSIONCOMPAT_FOLDER="Folder containing choices" VMCUSTOM_VERSIONCOMPAT_FOLDER_PLUGIN="Plugin's directory" VMCUSTOM_VERSIONCOMPAT_FOLDER_JOOMLA="Joomla Media directory" VMCUSTOM_VERSIONCOMPAT_FOLDER_IMAGES="Joomla Image directory" -VMCUSTOM_VERSIONCOMPAT_SEARCHABLE="Searchable" \ No newline at end of file +VMCUSTOM_VERSIONCOMPAT_SEARCHABLE="Searchable" +VMCUSTOM_VERSIONCOMPAT_NONE="(None)" +VMCUSTOM_VERSIONCOMPAT_TEXTVERSIONS="Text versions" +VMCUSTOM_VERSIONCOMPAT="Version compatibility" +VMCUSTOM_VERSIONCOMPAT_IMAGES="Images" +VMCUSTOM_VERSIONCOMPAT_TEXTS="Text versions" diff --git a/language/en-GB/en-GB.plg_vmcustom_versioncompat.sys.ini b/language/en-GB/en-GB.plg_vmcustom_versioncompat.sys.ini index abd7ae0154895f29a0df2c4af74a96c909c5bbf4..a596460739cf404b7009edcb40c6b5f77b463a59 100644 --- a/language/en-GB/en-GB.plg_vmcustom_versioncompat.sys.ini +++ b/language/en-GB/en-GB.plg_vmcustom_versioncompat.sys.ini @@ -8,4 +8,9 @@ VMCUSTOM_VERSIONCOMPAT_FOLDER="Folder containing choices" VMCUSTOM_VERSIONCOMPAT_FOLDER_PLUGIN="Plugin's directory" VMCUSTOM_VERSIONCOMPAT_FOLDER_JOOMLA="Joomla Media directory" VMCUSTOM_VERSIONCOMPAT_FOLDER_IMAGES="Joomla Image directory" -VMCUSTOM_VERSIONCOMPAT_SEARCHABLE="Searchable" \ No newline at end of file +VMCUSTOM_VERSIONCOMPAT_SEARCHABLE="Searchable" +VMCUSTOM_VERSIONCOMPAT_NONE="(None)" +VMCUSTOM_VERSIONCOMPAT_TEXTVERSIONS="Text versions" +VMCUSTOM_VERSIONCOMPAT="Version compatibility" +VMCUSTOM_VERSIONCOMPAT_IMAGES="Images" +VMCUSTOM_VERSIONCOMPAT_TEXTS="Text versions" diff --git a/language/index.html b/language/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0e44bd0ebe788fb287c40c7e92a93b7b1540f0b6 --- /dev/null +++ b/language/index.html @@ -0,0 +1,4 @@ +<html> +<body bgcolor="#FFFFFF"> +</body> +</html> \ No newline at end of file diff --git a/releases/plg_vmcustom_versioncompat_v0.2.zip b/releases/plg_vmcustom_versioncompat_v0.2.zip new file mode 100644 index 0000000000000000000000000000000000000000..53b01f8c3e6b009a8b89300185b9d0ba94b8baab Binary files /dev/null and b/releases/plg_vmcustom_versioncompat_v0.2.zip differ diff --git a/versioncompat.php b/versioncompat.php index c0a97e2de8e58cb674cb3c7ca6edb3f70dcb319c..874e6ffa325774f600688ae2ee3a32cfa9233861 100644 --- a/versioncompat.php +++ b/versioncompat.php @@ -18,170 +18,133 @@ if (!class_exists('vmCustomPlugin')) require(JPATH_VM_PLUGINS . DS . 'vmcustompl class plgVmCustomVersionCompat extends vmCustomPlugin { - function __construct(& $subject, $config) { - - parent::__construct($subject, $config); - - $this->_tablepkey = 'id'; - $this->tableFields = array_keys($this->getTableSQLFields()); - $this->varsToPush = array('compatibility'=> array('', 'string'),'searchable'=>array(0,'int')); - - $this->setConfigParameterable('custom_params',$this->varsToPush); - - } - /** - * Create the table for this plugin if it does not yet exist. - */ - public function getVmPluginCreateTableSQL() { - return $this->createTableSQL('Joomla Compatibility Table'); - } - - function getTableSQLFields() { - $SQLfields = array( - 'id' => 'bigint(20) unsigned NOT NULL AUTO_INCREMENT', - 'virtuemart_custom_id' => 'int(11) UNSIGNED DEFAULT NULL', - 'virtuemart_product_id' => 'int(11) UNSIGNED DEFAULT NULL', - 'compatibility' => 'varchar(50) NOT NULL DEFAULT \'\' ', - ); - - return $SQLfields; - } - - function getImages() { - jimport('joomla.filesystem.file'); - jimport('joomla.filesystem.folder'); - $path = __DIR__.DS.'joocompatibility'; - $images = JFolder::files($path,'.png'); - return $images; - } - - - // get product param for this plugin on edit - function plgVmOnProductEdit($field, $product_id, &$row,&$retValue) { + function __construct(& $subject, $config) { + parent::__construct($subject, $config); + + $this->varsToPush = array( + 'compatibility'=>array(array(), 'array'), + 'versions'=>array(array(), 'array'), + 'searchable'=>array(0,'int'), + 'directory'=>array('', 'string'), + 'textversions'=>array('', 'string'), + ); + + if(!defined('VM_VERSION') or VM_VERSION < 3){ + $this->setConfigParameterable ('custom_params', $this->varsToPush); + } else { + $this->setConfigParameterable ('customfield_params', $this->varsToPush); + } + + } + + function getImages($path) { + jimport('joomla.filesystem.file'); + jimport('joomla.filesystem.folder'); + + if (!JFolder::exists($path)) + $path = JPATH_ROOT . DS . $path; + if (!JFolder::exists($path)) continue; + $images = JFolder::files($path, '.png'); + return $images; + } + + + // get product param for this plugin on edit + function plgVmOnProductEdit($field, $product_id, &$row, &$retValue) { if ($field->custom_element != $this->_name) return ''; - $this->getCustomParams($field); - $this->getPluginCustomData($field, $product_id); - $images = $this->getImages(); - - $logos = array(); - foreach ($images as $logo) { - $logos[] = JHTML::_('select.option', $logo, strtoupper(basename($logo,'.png'))); - } - - $id = $this->getIdForCustomIdProduct ($product_id, $field->virtuemart_custom_id); - $datas = $this->getPluginInternalData ($id); - $selectedOptions = explode($this->glue,$datas->compatibility); - - $html ='<div>'; - $html .= '<input type="hidden" name="plugin_param['.$row.']['.$this->_name.'][virtuemart_custom_id]" value="'.$field->virtuemart_custom_id.'" />'; - $html .= JHTML::_('select.genericlist', $logos, 'plugin_param['.$row.']['.$this->_name.'][compatibility][]', ' size="5" multiple="multiple"', 'value', 'text', $selectedOptions ); - $html .='</div>'; - $retValue .= $html ; - $row++; - return true ; - } + if(!defined('VM_VERSION') or VM_VERSION < 3){ + $this->parseCustomParams ($field); // Not needed in VM3! + $paramName = 'custom_param'; + } else { + $paramName = 'customfield_params'; + } + $html = ''; + $html .='<fieldset>'; +// $html .= '<legend>'. JText::_('VMCUSTOM_VERSIONCOMPAT') .'</legend>'; + $html .= '<table class="admintable"> + '; + if (!empty($field->directory)) { + $images = $this->getImages($field->directory); + $logos = array(); + foreach ($images as $logo) { + $logos[] = JHTML::_('select.option', $logo, strtoupper(basename($logo,'.png'))); + } + + $html .= VmHTML::row('genericlist', 'VMCUSTOM_VERSIONCOMPAT_IMAGES', $logos, $paramName.'['.$row.'][compatibility][]', ' size="5" multiple data-placeholder="' . JText::_('VMCUSTOM_VERSIONCOMPAT_NONE') . '" ', 'value', 'text', $field->compatibility); + } + + if (!empty($field->textversions)) { + $textversions = explode(",", $field->textversions); + $logos = array(); + foreach ($textversions as $ver) { + $v = trim($ver); + $versions[] = JHTML::_('select.option', $v, $v); + } + + $html .= VmHTML::row('genericlist', 'VMCUSTOM_VERSIONCOMPAT_TEXTS', $versions, $paramName.'['.$row.'][versions][]', ' size="5" multiple data-placeholder="' . JText::_('VMCUSTOM_VERSIONCOMPAT_NONE') . '" ', 'value', 'text', $field->versions); + } + $html .= '</table></fieldset>'; + + $retValue .= $html; + $row++; + return true; + } + + function displayProductFE ($product, &$group) { + // default return if it's not this plugin + if ($group->custom_element != $this->_name) return ''; + if (!defined('VM_VERSION') or VM_VERSION < 3) { // VM2 + $this->parseCustomParams($group); + } + + jimport('joomla.filesystem.file'); + jimport('joomla.filesystem.folder'); + $group->display .= $this->renderByLayout('default',array($group->directory, $group->compatibility, $group->versions) ); + + return true; + } /** * @ idx plugin index * @see components/com_virtuemart/helpers/vmCustomPlugin::onDisplayProductFE() * @author Patrick Kohl * Display product */ - function plgVmOnDisplayProductFE($product,&$idx,&$group) { - // default return if it's not this plugin - if ($group->custom_element != $this->_name) return ''; - - $this->_tableChecked = true; - $this->getCustomParams($group); - $this->getPluginCustomData($group, $product->virtuemart_product_id); - $id = $this->getIdForCustomIdProduct ($product->virtuemart_product_id, $group->virtuemart_custom_id); - $datas = $this->getPluginInternalData ($id); - $this->params->selectedOptions = explode($this->glue,$datas->compatibility); - - jimport('joomla.filesystem.file'); - jimport('joomla.filesystem.folder'); - $this->params->path = 'plugins/vmcustom/joocompatibility/'; - if (JFolder::exists(JPATH_SITE.DS.'plugins'.DS.'vmcustom'.DS.'joocompatibility'.DS.'joocompatibility')) { - $this->params->path = 'plugins/vmcustom/joocompatibility/joocompatibility/'; - } - $group->display .= $this->renderByLayout('default',array($this->params,&$idx,&$group ) ); - - return true; - } - - function plgVmOnStoreProduct($data,$plugin_param){ - if (key ($plugin_param) == $this->_name) { - if (is_array($plugin_param[$this->_name]['compatibility'])) { - $compatibility = implode($this->glue,$plugin_param[$this->_name]['compatibility']); - } else { - $compatibility = $plugin_param[$this->_name]['compatibility']; - } - $plugin_param[$this->_name]['compatibility'] = $compatibility; - } - return $this->OnStoreProduct($data,$plugin_param); - } - - public function plgVmSelectSearchableCustom(&$selectList,&$searchCustomValues,$virtuemart_custom_id) - { - $db =JFactory::getDBO(); - $db->setQuery('SELECT `virtuemart_custom_id`, `custom_title`, custom_params FROM `#__virtuemart_customs` WHERE `custom_element` ="'.$this->_name.'"'); - $custom_param = $db->loadObject(); - $this->selectList = $db->loadAssocList(); - VmTable::bindParameterable ($custom_param, 'custom_params', $this->_varsToPushParam); - if (!$custom_param->searchable) { - return; - } - - $this->params->custom_title = $custom_param->custom_title; - - jimport('joomla.filesystem.file'); - jimport('joomla.filesystem.folder'); - - $this->params->path = 'plugins/vmcustom/joocompatibility/'; - if (JFolder::exists(JPATH_SITE.DS.'plugins'.DS.'vmcustom'.DS.'joocompatibility'.DS.'joocompatibility')) { - $this->params->path = 'plugins/vmcustom/joocompatibility/joocompatibility/'; - } - $this->params->images = $this->getImages(); - $this->params->searched = JRequest::getVar('joocompatibility',array()); - - $selectList = array_merge((array)$this->selectList,$selectList); - $searchCustomValues .= $this->renderByLayout('search',array($this->params) ); - return true; - } + function plgVmOnDisplayProductFE($product, &$idx, &$group) { + return $this->displayProductFE($product, $group); + } - public function plgVmAddToSearch(&$where,&$PluginJoinTables,$custom_id) - { - $searched = JRequest::getVar('joocompatibility',array()); - $conditions = array(); - if (count($searched)) { - foreach ($searched as $searchOption) { - $conditions[] = $this->_name .'.`compatibility` LIKE "%'.$searchOption.'%"'; - } - $where[] = implode(' OR ', $conditions); - $PluginJoinTables[] = $this->_name ; - } - return true; - } + function plgVmOnDisplayProductFEVM3(&$product, &$group) { + return $this->displayProductFE($product, $group); + } /** * We must reimplement this triggers for joomla 1.7 * vmplugin triggers note by Max Milbers */ - public function plgVmOnStoreInstallPluginTable($psType,$name) { - return $this->onStoreInstallPluginTable($psType,$name); - } +// public function plgVmOnStoreInstallPluginTable($psType,$name) { +// return $this->onStoreInstallPluginTable($psType,$name); +// } function plgVmSetOnTablePluginParamsCustom($name, $id, &$table){ return $this->setOnTablePluginParams($name, $id, $table); } - function plgVmDeclarePluginParamsCustom($psType,$name,$id, &$data){ - return $this->declarePluginParams('custom', $name, $id, $data); - } + function plgVmDeclarePluginParamsCustom($psType,$name,$id, &$data){ + return $this->declarePluginParams('custom', $name, $id, $data); + } - /** - * Custom triggers note by Max Milbers - */ + function plgVmDeclarePluginParamsCustomVM3(&$data){ + return $this->declarePluginParams('custom', $data); + } + + function plgVmGetTablePluginParams($psType, $name, $id, &$xParams, &$varsToPush){ + return $this->getTablePluginParams($psType, $name, $id, $xParams, $varsToPush); + } + +// /** +// * Custom triggers note by Max Milbers +// */ function plgVmOnDisplayEdit($virtuemart_custom_id,&$customPlugin){ return $this->onDisplayEditBECustom($virtuemart_custom_id,$customPlugin); } diff --git a/versioncompat.xml b/versioncompat.xml index 5ba37815f52f346d4c7e9ff301eb3b696a4b97b9..21c38fd4063c5a53ab044722b665b0f664a946e3 100644 --- a/versioncompat.xml +++ b/versioncompat.xml @@ -6,7 +6,7 @@ <authorUrl>http://www.open-tools.net/</authorUrl> <creationDate>2014-12-16</creationDate> <copyright>2010 Daycounts.com, 2014 OpenTools.net</copyright> - <version>2.0.0</version> + <version>0.2</version> <description>Version compatibility custom field</description> <files> <filename plugin="versioncompat">versioncompat.php</filename> @@ -25,26 +25,23 @@ <!-- VM 3.x support (fields rather than params): --> <vmconfig> <fields name="params" addfieldpath="/administrator/components/com_virtuemart/fields"> - <fieldset name="customfield" label="VMCUSTOM_VERSIONCOMPAT_CONFIG" addfieldpath="/plugins/vmcustom/versioncompat/fields"> - <field name="directory" size="500" type="compatfolders" scope="com_virtuemart" label="VMCUSTOM_VERSIONCOMPAT_FOLDER"> - <folder label="VMCUSTOM_VERSIONCOMPAT_FOLDER_PLUGIN">/plugins/vmcustom/versioncompat/versioncompat/images/</folder> - <folder label="VMCUSTOM_VERSIONCOMPAT_FOLDER_JOOMLA">/media/plg_vmcustom_versioncompat/</folder> - <folder label="VMCUSTOM_VERSIONCOMPAT_FOLDER_IMAGES">/images/versioncompat/</folder> + <fieldset name="versioncompat" addfieldpath="/plugins/vmcustom/versioncompat/fields"> + <field name="directory" type="compatfolders" scope="com_virtuemart" label="VMCUSTOM_VERSIONCOMPAT_FOLDER"> + <folder label="VMCUSTOM_VERSIONCOMPAT_FOLDER_PLUGIN">plugins/vmcustom/versioncompat/versioncompat/images/</folder> + <folder label="VMCUSTOM_VERSIONCOMPAT_FOLDER_JOOMLA">media/plg_vmcustom_versioncompat/</folder> + <folder label="VMCUSTOM_VERSIONCOMPAT_FOLDER_IMAGES">images/versioncompat/</folder> </field> - <field name="searchable" type="radio" scope="com_virtuemart" default="1" class="btn-group btn-group-yesno" label="VMCUSTOM_VERSIONCOMPAT_SEARCHABLE"> - <option value="1">JYES</option> - <option value="0">JNO</option> - </field> - + <field name="textversions" type="text" size="70" label="VMCUSTOM_VERSIONCOMPAT_TEXTVERSIONS" /> </fieldset> </fields> </vmconfig> - <params addpath="/administrator/components/com_virtuemart/elements"> - <param type="vmjpluginwarning" /> - <param name="searchable" type="radio" default="1" label="searchable"> - <option value="1">Yes</option> - <option value="0">No</option> + <params name="params" addpath="/plugins/vmcustom/versioncompat/elements"> + <param name="directory" type="compatfolders" scope="com_virtuemart" label="VMCUSTOM_VERSIONCOMPAT_FOLDER"> + <folder label="VMCUSTOM_VERSIONCOMPAT_FOLDER_PLUGIN">plugins/vmcustom/versioncompat/versioncompat/images/</folder> + <folder label="VMCUSTOM_VERSIONCOMPAT_FOLDER_JOOMLA">media/plg_vmcustom_versioncompat/</folder> + <folder label="VMCUSTOM_VERSIONCOMPAT_FOLDER_IMAGES">images/versioncompat/</folder> </param> + <param name="textversions" type="text" size="70" label="VMCUSTOM_VERSIONCOMPAT_TEXTVERSIONS" /> </params> </extension> \ No newline at end of file diff --git a/versioncompat/images/ExtensionTypes/component.png b/versioncompat/images/ExtensionTypes/component.png new file mode 100644 index 0000000000000000000000000000000000000000..87867a722b9ab5febe80ad321429865b1c16ab39 Binary files /dev/null and b/versioncompat/images/ExtensionTypes/component.png differ diff --git a/versioncompat/images/ExtensionTypes/hack.png b/versioncompat/images/ExtensionTypes/hack.png new file mode 100644 index 0000000000000000000000000000000000000000..a3ba7f5695210170b4876bd308d8949b7e3d0eab Binary files /dev/null and b/versioncompat/images/ExtensionTypes/hack.png differ diff --git a/versioncompat/images/ExtensionTypes/index.html b/versioncompat/images/ExtensionTypes/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0e44bd0ebe788fb287c40c7e92a93b7b1540f0b6 --- /dev/null +++ b/versioncompat/images/ExtensionTypes/index.html @@ -0,0 +1,4 @@ +<html> +<body bgcolor="#FFFFFF"> +</body> +</html> \ No newline at end of file diff --git a/versioncompat/images/ExtensionTypes/language.png b/versioncompat/images/ExtensionTypes/language.png new file mode 100644 index 0000000000000000000000000000000000000000..380e27a711cca19e1daf5df012b844f39d114f06 Binary files /dev/null and b/versioncompat/images/ExtensionTypes/language.png differ diff --git a/versioncompat/images/ExtensionTypes/module.png b/versioncompat/images/ExtensionTypes/module.png new file mode 100644 index 0000000000000000000000000000000000000000..4f54d092d93cd42b7d5532783481e0bb9c5984dc Binary files /dev/null and b/versioncompat/images/ExtensionTypes/module.png differ diff --git a/versioncompat/images/ExtensionTypes/plugin.png b/versioncompat/images/ExtensionTypes/plugin.png new file mode 100644 index 0000000000000000000000000000000000000000..bfdfd16f4529be7a46db6f330911c626a2796d6d Binary files /dev/null and b/versioncompat/images/ExtensionTypes/plugin.png differ diff --git a/versioncompat/images/ExtensionTypes/specific.png b/versioncompat/images/ExtensionTypes/specific.png new file mode 100644 index 0000000000000000000000000000000000000000..64bfc8b07b25cb91998b8e1849262bdf5821f2dd Binary files /dev/null and b/versioncompat/images/ExtensionTypes/specific.png differ diff --git a/versioncompat/images/ExtensionTypes/template.png b/versioncompat/images/ExtensionTypes/template.png new file mode 100644 index 0000000000000000000000000000000000000000..85f36fad1518296d7182b515d17b5a354c4c1baa Binary files /dev/null and b/versioncompat/images/ExtensionTypes/template.png differ diff --git a/versioncompat/images/Joomla/index.html b/versioncompat/images/Joomla/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0e44bd0ebe788fb287c40c7e92a93b7b1540f0b6 --- /dev/null +++ b/versioncompat/images/Joomla/index.html @@ -0,0 +1,4 @@ +<html> +<body bgcolor="#FFFFFF"> +</body> +</html> \ No newline at end of file diff --git a/versioncompat/images/VirtueMart/index.html b/versioncompat/images/VirtueMart/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0e44bd0ebe788fb287c40c7e92a93b7b1540f0b6 --- /dev/null +++ b/versioncompat/images/VirtueMart/index.html @@ -0,0 +1,4 @@ +<html> +<body bgcolor="#FFFFFF"> +</body> +</html> \ No newline at end of file diff --git a/versioncompat/images/VirtueMart/vm1.0.png b/versioncompat/images/VirtueMart/vm1.0.png new file mode 100644 index 0000000000000000000000000000000000000000..a9a19d223daa1c341fd13621ebab663839def8c0 Binary files /dev/null and b/versioncompat/images/VirtueMart/vm1.0.png differ diff --git a/versioncompat/images/VirtueMart/vm1.1.png b/versioncompat/images/VirtueMart/vm1.1.png new file mode 100644 index 0000000000000000000000000000000000000000..a740d7837e01b3da518b44458da9ad379cb025b0 Binary files /dev/null and b/versioncompat/images/VirtueMart/vm1.1.png differ diff --git a/versioncompat/images/VirtueMart/vm2.0.png b/versioncompat/images/VirtueMart/vm2.0.png new file mode 100644 index 0000000000000000000000000000000000000000..531e5405b647b1111703754ba96505f9916c5440 Binary files /dev/null and b/versioncompat/images/VirtueMart/vm2.0.png differ diff --git a/versioncompat/images/VirtueMart/vm3.0.png b/versioncompat/images/VirtueMart/vm3.0.png new file mode 100644 index 0000000000000000000000000000000000000000..ca5a73f0268842ce1c0d34189f49cd627dad8ce1 Binary files /dev/null and b/versioncompat/images/VirtueMart/vm3.0.png differ diff --git a/versioncompat/images/index.html b/versioncompat/images/index.html new file mode 100644 index 0000000000000000000000000000000000000000..0e44bd0ebe788fb287c40c7e92a93b7b1540f0b6 --- /dev/null +++ b/versioncompat/images/index.html @@ -0,0 +1,4 @@ +<html> +<body bgcolor="#FFFFFF"> +</body> +</html> \ No newline at end of file diff --git a/versioncompat/tmpl/default.php b/versioncompat/tmpl/default.php index c5594156a17de0e245575ed295b42f9ccd6c90f2..ce24d65bba6db11437e08e9eba75e71ee3a7853a 100644 --- a/versioncompat/tmpl/default.php +++ b/versioncompat/tmpl/default.php @@ -1,21 +1,54 @@ -<?php +<?php /*------------------------------------------------------------------------ -# joocompatibility - Custom field for Virtuemart +# versioncompat - Custom field for Virtuemart # ------------------------------------------------------------------------ -# author Jeremy Magne +# author Reinhold Kainhofer, Jeremy Magne +# copyright Copyright (C) 2014 OpenTools.net. All Rights Reserved. # copyright Copyright (C) 2010 Daycounts.com. All Rights Reserved. -# Websites: http://www.daycounts.com -# Technical Support: http://www.daycounts.com/en/contact/ # @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL -------------------------------------------------------------------------*/ -defined('_JEXEC') or die(); +defined('_JEXEC') or die(); // Here the plugin values -//JHTML::_('behavior.tooltip'); + +$path = $viewData[0]; +$compatibility = $viewData[1]; +$versions = $viewData[2]; +$cssclass = 'versioncompat-'.strtolower(basename($path)); + +static $versioncompat_css_included; +if (!$versioncompat_css_included) { + $css = +"ul.versioncompat { + list-style: none; + margin-left: 0; +} +.versioncompat li { + float: left; + margin-left: 0; + margin-right: 0px; +} +.versioncompat-versions { + margin-left: 5px; +} +"; + $document = JFactory::getDocument(); + $document->addStyleDeclaration($css); + $versioncompat_css_included = true; +} + +// style="list-style:none; margin-left:0;" +// style="float:left; margin-left:0; margin-right:10px;" +if (count($compatibility)>0) { ?> -<ul class="joocompatibility" style="list-style:none; margin-left:0;"> +<ul class="versioncompat <?php echo $cssclass; ?>"> <?php - foreach ($this->params->selectedOptions as $compat) { - echo '<li style="float:left; margin-left:0; margin-right:10px;">'.JHTML::image(JURI::root() . $this->params->path.$compat, JText::_(basename($compat,'.png'))).'</li>'; + foreach ($compatibility as $compat) { + echo '<li>'.JHTML::image(JURI::root() . $path . DS . $compat, JText::_(basename($compat,'.png'))).'</li>'; } ?> -</ul> +</ul> +<?php +} +if (count($versions)>0) { + echo "<span class=\"versioncompat-versions\">".join(", ", $versions)."</span>"; +} diff --git a/versioncompat/tmpl/search.php b/versioncompat/tmpl/search.php index 6ab9de4a6c848f9b1cd10361e62554a0e45d65a8..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/versioncompat/tmpl/search.php +++ b/versioncompat/tmpl/search.php @@ -1,27 +0,0 @@ -<?php -/*------------------------------------------------------------------------ -# joocompatibility - Custom field for Virtuemart -# ------------------------------------------------------------------------ -# author Jeremy Magne -# copyright Copyright (C) 2010 Daycounts.com. All Rights Reserved. -# Websites: http://www.daycounts.com -# Technical Support: http://www.daycounts.com/en/contact/ -# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL --------------------------------------------------------------------------*/ -defined('_JEXEC') or die(); -// Here the plugin values -?> -<?php - echo $this->params->custom_title.' : '; - foreach ($this->params->images as $image) { - if (in_array($image,$this->params->searched)) { - $checked = 'checked="checked"'; - } else { - $checked = ''; - } - ?> - <label><input type="checkbox" value="<?php echo $image ?>" name="joocompatibility[]" <?php echo $checked; ?>><?php echo JHTML::image(JURI::root() . $this->params->path.$image, basename($image,'.png')); ?></label> - <?php - } -?> -<br />