Skip to content

Commit

Permalink
2.1.1
Browse files Browse the repository at this point in the history
Joomla 5.x compatibility
Namespace ConseilGouz instead of Joomla
Remove Zoom increment/Icons size list sizes
Use Webassets
+ Display dynamic version number
  • Loading branch information
conseilgouz committed Jul 31, 2023
1 parent 2a1404b commit 6fd0e30
Show file tree
Hide file tree
Showing 13 changed files with 129 additions and 22 deletions.
7 changes: 5 additions & 2 deletions language/en-GB/mod_cg_zoompage.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
CG_XML_ZOOM_DESCRIPTION="<p style='text-align:left;padding-left:5px;font-size:inherit'>CG Zoom Page version 2.1.0 : increase/decrease your page size</p>"
CG_XML_ZOOM_DESCRIPTION="<p style='text-align:left;padding-left:5px;font-size:inherit'>CG Zoom Page : increase/decrease your page size</p>"
CG_INC="Zoom Increment"
CG_INC_DESC="Select increment to apply at each click."
CG_ICON_COLOR="Icons color"
CG_ICON_COLOR_DESC="Select your icons' color."
CG_ICON_HEIGHT="Icons size"
CG_ICON_HEIGHT_DESC="Select your icons' size (default: 2.5 em)"
CG_ICON_HEIGHT_DESC="Select your icons' size (default: 2.5 em)"
CG_ZOOM_INCREASE="Increase page size"
CG_ZOOM_RESTORE="Back to default style"
CG_ZOOM_DECREASE="Decrease page size"
2 changes: 1 addition & 1 deletion language/en-GB/mod_cg_zoompage.sys.ini
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
CG_XML_ZOOM_DESCRIPTION="<p style='text-align:left;padding-left:5px;font-size:inherit'>CG Zoom Page version 2.1.0 : agrandit/Diminue une page</p>"
CG_XML_ZOOM_DESCRIPTION="<p style='text-align:left;padding-left:5px;font-size:inherit'>CG Zoom Page : increase/decrease page size.</p>"

7 changes: 5 additions & 2 deletions language/fr-FR/mod_cg_zoompage.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
CG_XML_ZOOM_DESCRIPTION="<p style='text-align:left;padding-left:5px;font-size:inherit'>CG Zoom Page version 2.1.0 : agrandit/diminue une page</p>"
CG_XML_ZOOM_DESCRIPTION="<p style='text-align:left;padding-left:5px;font-size:inherit'>CG Zoom Page : agrandit/diminue une page</p>"
CG_INC="Incr&eacute;ment du zoom"
CG_INC_DESC="S&eacute;lectionnez l'incr&eacute;ment &agrave; appliquer sur votre page &agrave; chaque click."
CG_ICON_COLOR="Couleur des ic&ocirc;nes"
CG_ICON_COLOR_DESC="S&eacute;lectionnez la couleur de vos ic&ocirc;nes"
CG_ICON_HEIGHT="Taille des ic&ocirc;nes"
CG_ICON_HEIGHT_DESC="S&eacute;lectionnez la taille des ic&ocirc;nes (d&eacute;faut: 2.5 em)"
CG_ICON_HEIGHT_DESC="S&eacute;lectionnez la taille des ic&ocirc;nes (d&eacute;faut: 2.5 em)"
CG_ZOOM_INCREASE="Agrandir la page"
CG_ZOOM_RESTORE="Revenir au style par d&eacute;faut"
CG_ZOOM_DECREASE="Diminuer la page"
2 changes: 1 addition & 1 deletion language/fr-FR/mod_cg_zoompage.sys.ini
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CG_XML_ZOOM_DESCRIPTION="<p style='text-align:left;padding-left:5px;font-size:inherit'>CG Zoom Page version 2.1.0 : agrandit/Diminue une page</p>"
CG_XML_ZOOM_DESCRIPTION="<p style='text-align:left;padding-left:5px;font-size:inherit'>CG Zoom Page : agrandit/Diminue une page</p>"
13 changes: 7 additions & 6 deletions mod_cg_zoompage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<extension type="module" version="3.8.0" client="site" method="upgrade">
<name>CG Zoom Page</name>
<author>ConseilGouz</author>
<version>2.1.0</version>
<version>2.1.1</version>
<description>CG_XML_ZOOM_DESCRIPTION</description>
<creationDate>2023/05/27</creationDate>
<creationDate>2023/07/31</creationDate>
<files>
<filename>mod_cg_zoompage.xml</filename>
<filename module="mod_cg_zoompage">mod_cg_zoompage.php</filename>
Expand All @@ -22,19 +22,20 @@
<folder>js</folder>
<filename>index.html</filename>
</media>
<namespace path="src">Joomla\Module\CGZoomPage</namespace>
<namespace path="src">ConseilGouz\Module\CGZoomPage</namespace>
<scriptfile>script.php</scriptfile>
<changelogurl>https://raw.githubusercontent.com/conseilgouz/mod_cg_zoompage_j4/master/mod_cg_zoompage_changelog.xml</changelogurl>
<config>
<fields name="params">
<fieldset name="basic">
<field name="zoom" type="list" default="5" label="CG_INC" description="CG_INC_DESC" size="5">
<fieldset name="basic" addfieldprefix="ConseilGouz\Module\CGZoomPage\Site\Field">
<field name="version" type="version" margintop="-3em" extension="mod_cg_zoompage"/>
<field name="zoom" type="list" default="5" label="CG_INC" description="CG_INC_DESC" class="btn-group">
<option value="2">2%</option>
<option value="5">5%</option>
<option value="10">10%</option>
</field>
<field name="font-color" type="color" default="#52c0ff" label="CG_ICON_COLOR" description="CG_ICON_COLOR_DESC"/>
<field name="icon-size" type="list" default="2.5" label="CG_ICON_HEIGHT" description="CG_ICON_HEIGHT_DESC" size="5">
<field name="icon-size" type="list" default="2.5" label="CG_ICON_HEIGHT" description="CG_ICON_HEIGHT_DESC" class="btn-group">
<option value="1">1em</option>
<option value="1.5">1.5em</option>
<option value="2">2em</option>
Expand Down
19 changes: 19 additions & 0 deletions mod_cg_zoompage_changelog.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
<changelogs>
<changelog>
<element>mod_cg_zoompage</element>
<type>Module</type>
<version>2.1.1</version>
<note>
<item>Update : 31/07/2023</item>
</note>
<fix>
<item>Joomla 5.x compatibility</item>
<item>Namespace ConseilGouz instead of Joomla</item>
<item>remove Zoom increment/Icons size list sizes</item>
</fix>
<change>
<item>Use Webassets</item>
</change>
<addition>
<item>Display dynamic version number</item>
</addition>
</changelog>
<changelog>
<element>mod_cg_zoompage</element>
<type>Module</type>
Expand Down
9 changes: 5 additions & 4 deletions script.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* CG Zoom Page Module - Joomla 4.x Module
* Version : 2.1.0
* Version : 2.1.1
* Package : CG Zoom Page
* copyright : Copyright (C) 2023 ConseilGouz. All rights reserved.
* license : http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
Expand All @@ -10,9 +10,9 @@
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Filesystem\Folder;
use Joomla\Filesystem\Folder;
use Joomla\CMS\Version;
use Joomla\CMS\Filesystem\File;
use Joomla\Filesystem\File;

class mod_cg_zoompageInstallerScript
{
Expand All @@ -24,6 +24,7 @@ class mod_cg_zoompageInstallerScript
private $previous_version = '';
private $dir = null;
private $installerName = 'lcg_zoompageinstaller';
private $lang;
public function __construct()
{
$this->dir = __DIR__;
Expand Down Expand Up @@ -137,7 +138,7 @@ private function passMinimumPHPVersion()
}
private function uninstallInstaller()
{
if ( ! JFolder::exists(JPATH_PLUGINS . '/system/' . $this->installerName)) {
if ( ! is_dir(JPATH_PLUGINS . '/system/' . $this->installerName)) {
return;
}
$this->delete([
Expand Down
75 changes: 75 additions & 0 deletions src/Field/VersionField.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
/**
* CG Zoom Article for Joomla 4.x/5.x
* Version : 2.1.1
* Package : CG Zoom Page
* copyright : Copyright (C) 2021 ConseilGouz. All rights reserved.
* license : http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
* From : http://stackoverflow.com/questions/10464038/imitate-browser-zoom-with-javascript
*/
namespace ConseilGouz\Module\CGZoomPage\Site\Field;

use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Form\FormField;
use Joomla\CMS\Language\Text;
use Joomla\String\StringHelper;

// Prevent direct access
defined('_JEXEC') || die;

class VersionField extends FormField
{
/**
* Element name
*
* @var string
*/
protected $_name = 'Version';

function getInput()
{
$return = '';
// Load language
$extension = $this->def('extension');

$version = '';

$jinput = Factory::getApplication()->input;
$db = Factory::getDBO();
$query = $db->getQuery(true);
$query
->select($db->quoteName('manifest_cache'))
->from($db->quoteName('#__extensions'))
->where($db->quoteName('element') . '=' . $db->Quote($extension));
$db->setQuery($query, 0, 1);
$row = $db->loadAssoc();
$tmp = json_decode($row['manifest_cache']);
$version = $tmp->version;
/** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();

$css = '';
$css .= ".version {display:block;text-align:right;color:brown;font-size:10px;}";
$css .= ".readonly.plg-desc {font-weight:normal;}";
$css .= "fieldset.radio label {width:auto;}";
$wa->addInlineStyle($css);
$margintop = $this->def('margintop');
if (StringHelper::strlen($margintop)) {
$js = "document.addEventListener('DOMContentLoaded', function() {
vers = document.querySelector('.version');
parent = vers.parentElement.parentElement;
parent.style.marginTop = '".$margintop."';
})";
$wa->addInlineScript($js);
}
$return .= '<span class="version">' . Text::_('JVERSION') . ' ' . $version . "</span>";

return $return;
}
public function def($val, $default = '')
{
return ( isset( $this->element[$val] ) && (string) $this->element[$val] != '' ) ? (string) $this->element[$val] : $default;
}

}
1 change: 1 addition & 0 deletions src/Field/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html><body></body></html>
6 changes: 3 additions & 3 deletions src/Helper/CGZoompageHelper.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php
/**
* CG Zoom Article for Joomla 4
* Version : 2.0.1
* CG Zoom Article for Joomla 4.x/5.x
* Version : 2.1.1
* Package : CG Zoom Page
* copyright : Copyright (C) 2021 ConseilGouz. All rights reserved.
* license : http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
* From : http://stackoverflow.com/questions/10464038/imitate-browser-zoom-with-javascript
*/
// No direct access
namespace Joomla\Module\CGZoomPage\Site\Helper;
namespace ConseilGouz\Module\CGZoomPage\Site\Helper;
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Helper\ModuleHelper;
Expand Down
1 change: 1 addition & 0 deletions src/Helper/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html><body></body></html>
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<!DOCTYPE html><html><body></body></html>
8 changes: 5 additions & 3 deletions tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,22 @@
*/
// No direct access
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;

$zoom_in = $params->get('zoom');
$font_color = $params->get('font-color','#52c0ff');
$icon_size = $params->get('icon-size','2.5');
?>
<div class= "mod_zoom_page" id="mod_zoom_page_<?php echo $module->id; ?>" data="<?php echo $module->id;?>">
<table width=100% >
<tr><td width=35%>
<a href="#" id="In_<?php echo $module->id;?>" title="Agrandir la page"><i class="fa fa-search-plus" style="font-size:<?php echo $icon_size;?>em;color:<?php echo $font_color;?>" ></i></a>
<a href="#" id="In_<?php echo $module->id;?>" title="<?php echo Text::_('CG_ZOOM_INCREASE');?>"><i class="fa fa-search-plus" style="font-size:<?php echo $icon_size;?>em;color:<?php echo $font_color;?>" ></i></a>
</td>
<td width=35%>
<a href="#" id="Reset_<?php echo $module->id;?>" title="Revenir au style par d&eacute;faut" ><i class="fa fa-undo" style="font-size:<?php echo $icon_size;?>em;color:<?php echo $font_color;?>"></i></a>
<a href="#" id="Reset_<?php echo $module->id;?>" title="<?php echo Text::_('CG_ZOOM_RESTORE');?>" ><i class="fa fa-undo" style="font-size:<?php echo $icon_size;?>em;color:<?php echo $font_color;?>"></i></a>
</td>
<td>
<a href="#" id="Out_<?php echo $module->id;?>" title="Diminuer la page" ><i class="fa fa-search-minus" style="font-size:<?php echo $icon_size;?>em;color:<?php echo $font_color;?>" ></i></a></h2>
<a href="#" id="Out_<?php echo $module->id;?>" title="<?php echo Text::_('CG_ZOOM_DECREASE');?>" ><i class="fa fa-search-minus" style="font-size:<?php echo $icon_size;?>em;color:<?php echo $font_color;?>" ></i></a></h2>
</td>
</tr>
</table>
Expand Down

0 comments on commit 6fd0e30

Please sign in to comment.