Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Update the com_templates options to add the diff options
UPDATE `#__extensions` SET `params` = REPLACE(`params`, '}', ',"difference":"SideBySide"}') WHERE `name` = 'com_templates';
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Update the com_templates options to add the diff options
UPDATE "#__extensions" SET "params" = REPLACE("params", '}', ',"difference":"SideBySide"}') WHERE "name" = 'com_templates';
18 changes: 18 additions & 0 deletions administrator/components/com_templates/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,24 @@
default="zip"
extension="com_templates"
/>

<field
name="spacer2"
type="spacer"
hr="true"
/>

<field
name="difference"
type="radio"
label="COM_TEMPLATES_DIFF_OPTIONS"
layout="joomla.form.field.radio.switcher"
default="SideBySide"
>
<option value="Inline">COM_TEMPLATES_DIFF_OPTIONS_INLINE</option>
<option value="SideBySide">COM_TEMPLATES_DIFF_OPTIONS_SIDE</option>
</field>

</fieldset>

<fieldset
Expand Down
36 changes: 24 additions & 12 deletions administrator/components/com_templates/tmpl/template/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@
defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Session\Session;
use Jfcherng\Diff\DiffHelper;

HTMLHelper::_('behavior.multiselect', 'updateForm');
HTMLHelper::_('bootstrap.modal');
Expand All @@ -27,9 +29,9 @@
// Enable assets
$wa->useScript('form.validate')
->useScript('keepalive')
->useScript('diff')
->useScript('com_templates.admin-template-compare')
->useScript('com_templates.admin-template-toggle-switch');
->useScript('com_templates.admin-template-toggle-switch')
->useScript('com_templates.admin-templates')
->useStyle('com_templates.admin-templates');

// No access if not global SuperUser
if (!Factory::getUser()->authorise('core.admin')) {
Expand All @@ -40,9 +42,6 @@
$wa->usePreset('cropperjs');
}

$wa->useStyle('com_templates.admin-templates')
->useScript('com_templates.admin-templates');

if ($this->type == 'font') {
$wa->addInlineStyle("
@font-face {
Expand All @@ -55,7 +54,6 @@
");
}
?>

<div class="main-card">
<?php echo HTMLHelper::_('uitab.startTabSet', 'myTab', ['active' => 'editor', 'recall' => true, 'breakpoint' => 768]); ?>
<?php echo HTMLHelper::_('uitab.addTab', 'myTab', 'editor', Text::_('COM_TEMPLATES_TAB_EDITOR')); ?>
Expand Down Expand Up @@ -141,20 +139,34 @@
</form>
</div>
<?php if (!empty($this->source->coreFile)) : ?>
<?php $coreFileContent = file_get_contents($this->source->coreFile); ?>
<?php $overrideFileContent = file_get_contents($this->source->filePath); ?>
<div class="col-md-12" id="core-pane">
<h2><?php echo Text::_('COM_TEMPLATES_FILE_CORE_PANE'); ?></h2>
<div class="editor-border">
<?php echo $this->form->getInput('core'); ?>
</div>
</div>
<?php
$difference = DiffHelper::calculateFiles(
$this->source->coreFile,
$this->source->filePath,
ComponentHelper::getParams('com_templates')->get('difference', 'SideByside'),
['context' => 1],
[
'language' => [
'old_version' => Text::_('COM_TEMPLATES_DIFF_CORE'),
'new_version' => Text::_('COM_TEMPLATES_DIFF_OVERRIDE'),
'differences' => Text::_('COM_TEMPLATES_DIFF_DIFFERENCES'),
],
'resultForIdenticals' => Text::_('COM_TEMPLATES_DIFF_IDENTICAL'),
'detailLevel' => 'word',
'spaceToHtmlTag' => true,
],
);
?>
<div class="col-md-12" id="diff-main">
<h2><?php echo Text::_('COM_TEMPLATES_FILE_COMPARE_PANE'); ?></h2>
<div class="diff-pane">
<div class="diffview d-none" id="original"><?php echo htmlspecialchars($coreFileContent, ENT_COMPAT, 'UTF-8'); ?></div>
<div class="diffview d-none" id="changed"><?php echo htmlspecialchars($overrideFileContent, ENT_COMPAT, 'UTF-8'); ?></div>
<div id="diff"></div>
<div id="diff"><?php echo $difference; ?></div>
</div>
</div>
<?php endif; ?>
Expand Down
51 changes: 29 additions & 22 deletions administrator/language/en-GB/com_templates.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,24 @@ COM_TEMPLATES_CHILD_SUCCESS="Child template created."
COM_TEMPLATES_CLICK_TO_ENLARGE="Select to enlarge."
COM_TEMPLATES_COMPILE_ERROR="An error occurred. Failed to compile."
COM_TEMPLATES_COMPILE_LESS="You should compile %s to generate a CSS file."
COM_TEMPLATES_CONFIGURATION="Template: Options"
COM_TEMPLATES_CONFIG_FIELDSET_DESC="Global configuration for templates."
COM_TEMPLATES_CONFIG_FONT_LABEL="Valid Font Formats"
COM_TEMPLATES_CONFIG_IMAGE_LABEL="Valid Image Formats"
COM_TEMPLATES_CONFIG_POSITIONS_LABEL="Preview Module Positions"
COM_TEMPLATES_CONFIG_SOURCE_LABEL="Valid Source Formats"
COM_TEMPLATES_CONFIG_UPLOAD_LABEL="Max. Upload Size (MB)"
COM_TEMPLATES_CONFIGURATION="Template: Options"
COM_TEMPLATES_COPY_CHILD_TEMPLATE_STYLES="%s, copy of %s"
COM_TEMPLATES_COPY_SUCCESS="New template called %s was installed."
COM_TEMPLATES_CROP_AREA_ERROR="Crop area not selected."
COM_TEMPLATES_DIFF_CORE="Original"
COM_TEMPLATES_DIFF_DIFFERENCES="Differences"
COM_TEMPLATES_DIFF_IDENTICAL="The two files are identical."
COM_TEMPLATES_DIFF_OPTIONS="File Diff Display"
COM_TEMPLATES_DIFF_OPTIONS_INLINE="Inline"
COM_TEMPLATES_DIFF_OPTIONS_SIDE="Side-by-Side"
COM_TEMPLATES_DIFF_OVERRIDE="Override"
COM_TEMPLATES_DIRECTORY_NOT_WRITABLE="The template folder is not writable. Some features may not work."
COM_TEMPLATES_ERR_XML="Template XML data not available"
COM_TEMPLATES_ERROR_ASSET_FILE_DELETE="The file joomla.asset.json can't be deleted. Make changes in the editor if you want to change the file."
COM_TEMPLATES_ERROR_ASSET_FILE_INVALID_JSON="The joomla.asset.json file doesn't contain valid JSON, aborting save."
COM_TEMPLATES_ERROR_CANNOT_DELETE_LAST_STYLE="Can't delete the last style of a template."
Expand All @@ -69,8 +75,8 @@ COM_TEMPLATES_ERROR_INDEX_DELETE="The file index.php can't be deleted. Make chan
COM_TEMPLATES_ERROR_INVALID_FROM_NAME="Template to copy from can't be found."
COM_TEMPLATES_ERROR_INVALID_TEMPLATE_NAME="Invalid template name. Please use only letters, numbers and underscores."
COM_TEMPLATES_ERROR_NO_FILE_SELECTED="No file selected."
COM_TEMPLATES_ERROR_RENAME_INDEX="The file index.php can't be renamed."
COM_TEMPLATES_ERROR_RENAME_ASSET_FILE="The file joomla.asset.json can't be renamed."
COM_TEMPLATES_ERROR_RENAME_INDEX="The file index.php can't be renamed."
COM_TEMPLATES_ERROR_ROOT_DELETE="The root folder can't be deleted."
COM_TEMPLATES_ERROR_SAVE_DISABLED_TEMPLATE="Unable to save a style associated to a disabled template."
COM_TEMPLATES_ERROR_SOURCE_FILE_NOT_FOUND="Source file not found."
Expand All @@ -85,6 +91,7 @@ COM_TEMPLATES_ERROR_WARNFILENAME="Invalid file name. Please correct the name of
COM_TEMPLATES_ERROR_WARNFILETOOLARGE="This file is too large to upload."
COM_TEMPLATES_ERROR_WARNFILETYPE="File format not supported."
COM_TEMPLATES_ERROR_WARNIEXSS="Can't be uploaded. Has XSS."
COM_TEMPLATES_ERR_XML="Template XML data not available"
COM_TEMPLATES_FIELD_CLIENT_LABEL="Location"
COM_TEMPLATES_FIELD_HOME_LABEL="Default"
COM_TEMPLATES_FIELD_SOURCE_LABEL="Source Code"
Expand Down Expand Up @@ -153,7 +160,6 @@ COM_TEMPLATES_INVALID_FILE_TYPE="File type not selected."
COM_TEMPLATES_INVALID_FOLDER_NAME="Invalid folder name. Please choose a folder name with a-z, A-Z, 0-9, - and _."
COM_TEMPLATES_LAYOUTS_DIFFVIEW_CORE="Show Original File"
COM_TEMPLATES_LAYOUTS_DIFFVIEW_DIFF="Show Differences"
COM_TEMPLATES_MANAGE_FOLDERS="Manage Folders"
COM_TEMPLATES_MANAGER_ADD_STYLE="Templates: Add Style"
COM_TEMPLATES_MANAGER_EDIT_STYLE="Templates: Edit Style"
COM_TEMPLATES_MANAGER_STYLES="Templates: Styles"
Expand All @@ -164,12 +170,18 @@ COM_TEMPLATES_MANAGER_TEMPLATES="Templates"
COM_TEMPLATES_MANAGER_TEMPLATES_ADMIN="Templates: Templates (Administrator)"
COM_TEMPLATES_MANAGER_TEMPLATES_SITE="Templates: Templates (Site)"
COM_TEMPLATES_MANAGER_VIEW_TEMPLATE="Templates: Customise (%s)"
COM_TEMPLATES_MANAGE_FOLDERS="Manage Folders"
COM_TEMPLATES_MENUS_ASSIGNMENT="Menu Assignment"
COM_TEMPLATES_MENU_CHANGED_1="One menu item has been assigned or unassigned to this style."
COM_TEMPLATES_MENU_CHANGED_MORE="%d menu items have been assigned or unassigned to this style."
COM_TEMPLATES_MENUS_ASSIGNMENT="Menu Assignment"
COM_TEMPLATES_MODAL_FILE_DELETE="The file %s will be deleted."
COM_TEMPLATES_MSG_MANAGE_NO_STYLES="There are no styles installed matching your query."
COM_TEMPLATES_MSG_MANAGE_NO_TEMPLATES="There are no templates installed matching your query."
COM_TEMPLATES_NEW_FILE_HEADER="Create or Upload a new file."
COM_TEMPLATES_NEW_FILE_NAME="New File Name"
COM_TEMPLATES_NEW_FILE_SELECT="Select a file type"
COM_TEMPLATES_NEW_FILE_TYPE="File Type"
COM_TEMPLATES_NO_TEMPLATE_SELECTED="No template selected."
COM_TEMPLATES_N_CONFLICT="%d Changes found"
COM_TEMPLATES_N_CONFLICT_1="Change found"
COM_TEMPLATES_N_ITEMS_DELETED="%d template styles deleted."
Expand All @@ -180,13 +192,13 @@ COM_TEMPLATES_N_OVERRIDE_DELETED="%d records removed."
COM_TEMPLATES_N_OVERRIDE_DELETED_1="Record removed."
COM_TEMPLATES_N_OVERRIDE_UNCHECKED="%d records unchecked."
COM_TEMPLATES_N_OVERRIDE_UNCHECKED_1="Record unchecked."
COM_TEMPLATES_NEW_FILE_HEADER="Create or Upload a new file."
COM_TEMPLATES_NEW_FILE_NAME="New File Name"
COM_TEMPLATES_NEW_FILE_SELECT="Select a file type"
COM_TEMPLATES_NEW_FILE_TYPE="File Type"
COM_TEMPLATES_NO_TEMPLATE_SELECTED="No template selected."
COM_TEMPLATES_OPTION_NONE=":: None ::"
COM_TEMPLATES_OPTION_SELECT_MENU_ITEM="- Select Menu Item -"
COM_TEMPLATES_OVERRIDES="Override Files"
COM_TEMPLATES_OVERRIDES_COMPONENTS="Components"
COM_TEMPLATES_OVERRIDES_LAYOUTS="Layouts"
COM_TEMPLATES_OVERRIDES_MODULES="Modules"
COM_TEMPLATES_OVERRIDES_PLUGINS="Plugins"
COM_TEMPLATES_OVERRIDE_CHECKED="Checked"
COM_TEMPLATES_OVERRIDE_CORE_REMOVED="Original file removed"
COM_TEMPLATES_OVERRIDE_CREATED="Override created in "
Expand All @@ -197,25 +209,20 @@ COM_TEMPLATES_OVERRIDE_NOT_UPTODATE="The originals of the template override file
COM_TEMPLATES_OVERRIDE_SOURCE="Update Source"
COM_TEMPLATES_OVERRIDE_TEMPLATE_FILE="Template File"
COM_TEMPLATES_OVERRIDE_UPTODATE="Override files are up to date. Nothing has been changed in the last extension or Joomla update."
COM_TEMPLATES_OVERRIDES="Override Files"
COM_TEMPLATES_OVERRIDES_COMPONENTS="Components"
COM_TEMPLATES_OVERRIDES_LAYOUTS="Layouts"
COM_TEMPLATES_OVERRIDES_MODULES="Modules"
COM_TEMPLATES_OVERRIDES_PLUGINS="Plugins"
COM_TEMPLATES_PREVIEW="Preview"
COM_TEMPLATES_RENAME_FILE="Rename file %s"
COM_TEMPLATES_RESIZE_IMAGE="Resize Image"
COM_TEMPLATES_SCREENSHOT="%s Screenshot"
COM_TEMPLATES_SOURCE_CODE="Source"
COM_TEMPLATES_STYLE_CANNOT_DELETE_DEFAULT_STYLE="Can't delete default style."
COM_TEMPLATES_STYLE_FORM_EDIT="Edit Style"
COM_TEMPLATES_STYLE_SAVE_SUCCESS="Style saved."
COM_TEMPLATES_STYLES_FILTER_SEARCH_DESC="Search in style description."
COM_TEMPLATES_STYLES_PAGES_ALL="Default for all pages"
COM_TEMPLATES_STYLES_PAGES_ALL_LANGUAGE="Default for %s pages"
COM_TEMPLATES_STYLES_PAGES_NONE="Not assigned"
COM_TEMPLATES_STYLES_PAGES_SELECTED="Assigned on %s pages"
COM_TEMPLATES_STYLES_TABLE_CAPTION="Table of Template Styles"
COM_TEMPLATES_STYLE_CANNOT_DELETE_DEFAULT_STYLE="Can't delete default style."
COM_TEMPLATES_STYLE_FORM_EDIT="Edit Style"
COM_TEMPLATES_STYLE_SAVE_SUCCESS="Style saved."
COM_TEMPLATES_SUBMENU_TEMPLATES="Templates"
COM_TEMPLATES_SUCCESS_DUPLICATED="Style duplicated."
COM_TEMPLATES_SUCCESS_HOME_SET="Default style set."
Expand All @@ -224,10 +231,11 @@ COM_TEMPLATES_TAB_DESCRIPTION="Template Description"
COM_TEMPLATES_TAB_EDITOR="Editor"
COM_TEMPLATES_TAB_OVERRIDES="Create Overrides"
COM_TEMPLATES_TAB_UPDATED_FILES="Updated Files"
COM_TEMPLATES_TEMPLATES_FILTER_SEARCH_DESC="Search in template name or folder name."
COM_TEMPLATES_TEMPLATES_TABLE_CAPTION="Table of Templates"
COM_TEMPLATES_TEMPLATE_CHILD="Child Template"
COM_TEMPLATES_TEMPLATE_CHILD_NAME_LABEL="Child Template Name"
COM_TEMPLATES_TEMPLATE_CHILD_STYLE_LABEL="Additional Template Styles"
COM_TEMPLATES_TEMPLATE_NEW_STYLE_DESC="Duplicate existing styles for the new child template."
COM_TEMPLATES_TEMPLATE_CLOSE="Close"
COM_TEMPLATES_TEMPLATE_COPY="Copy Template"
COM_TEMPLATES_TEMPLATE_CORE_FILENAME="Original file &quot;%s&quot;."
Expand All @@ -243,11 +251,10 @@ COM_TEMPLATES_TEMPLATE_MEDIA_FOLDER="Media Folder"
COM_TEMPLATES_TEMPLATE_NEW_NAME_DESC="Letters, numbers and underscore only."
COM_TEMPLATES_TEMPLATE_NEW_NAME_LABEL="New Template Name"
COM_TEMPLATES_TEMPLATE_NEW_PREVIEW="Preview %s in new window."
COM_TEMPLATES_TEMPLATE_NO_PREVIEW="No preview available. You can enable preview in the options."
COM_TEMPLATES_TEMPLATE_NEW_STYLE_DESC="Duplicate existing styles for the new child template."
COM_TEMPLATES_TEMPLATE_NOT_SPECIFIED="Template not specified."
COM_TEMPLATES_TEMPLATE_NO_PREVIEW="No preview available. You can enable preview in the options."
COM_TEMPLATES_TEMPLATE_PREVIEW="Preview"
COM_TEMPLATES_TEMPLATES_FILTER_SEARCH_DESC="Search in template name or folder name."
COM_TEMPLATES_TEMPLATES_TABLE_CAPTION="Table of Templates"
COM_TEMPLATES_TOOLBAR_SET_HOME="Default"
COM_TEMPLATES_UPTODATE="Up to date"
COM_TEMPLATES_WARNING_FORMAT_WILL_NOT_BE_VISIBLE="You have created a new file with the extension '%s'. This is supported but as you did not have that file extension in the list of supported formats this can't be displayed. Please double check the options for Templates and add the format if needed."
Expand Down
8 changes: 8 additions & 0 deletions build/build.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,14 @@ function clean_checkout(string $dir)
// willdurand/negotiation
system('rm -rf libraries/vendor/willdurand/negotiation/tests');

// jfcherng
system('rm -rf libraries/vendor/jfcherng/php-color-output/demo.php');
system('rm -rf libraries/vendor/jfcherng/php-color-output/UPGRADING_v2.md');
system('rm -rf libraries/vendor/jfcherng/php-diff/CHANGELOG');
system('rm -rf libraries/vendor/jfcherng/php-diff/example');
system('rm -rf libraries/vendor/jfcherng/php-diff/UPGRADING');
system('rm -rf libraries/vendor/jfcherng/php-mb-string/CHANGELOG');

echo "Cleanup complete.\n";

chdir($cwd);
Expand Down
Loading