Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
f695238
Working on Media Library implementation - product edit page in progress
Jan 13, 2019
c230109
Implementing Cloudinary Media Library (in progress) - currently avail…
Jan 17, 2019
3a54b12
Implementing Cloudinary Media Library (in progress) - working on cate…
Jan 17, 2019
29c64f5
CLOUDINARY-74
Jan 20, 2019
6c4f057
CLOUDINARY-74
Jan 20, 2019
efbde40
CLOUDINARY-74
Jan 20, 2019
5905a17
CLOUDINARY-74
Jan 20, 2019
f35a368
CLOUDINARY-74
Jan 21, 2019
38dfcc2
CLOUDINARY-74: Implemented on image-upload & file-upload components a…
Jan 30, 2019
9f1562d
CLOUDINARY-74: Working on ML implementation + Reversed migration (sti…
Jan 31, 2019
d2417f9
CLOUDINARY-74: Disabled Cloudinary-ML implementation on System-Config…
Jan 31, 2019
bb647cc
CLOUDINARY-74: Working on Cloudinary-ML implementation (in progress, …
Feb 3, 2019
146eb4d
CLOUDINARY-74: Working on Cloudinary-ML implementation (in progress, …
Feb 3, 2019
8e52cb1
CLOUDINARY-74: Working on Cloudinary-ML implementation (in progress, …
Feb 3, 2019
ecd1448
CLOUDINARY-74: Working on Cloudinary-ML implementation (in progress, …
Feb 3, 2019
84d2909
CLOUDINARY-74,CLOUDINARY-84: Reversed migration CLI
Feb 5, 2019
be755b2
CLOUDINARY-74,CLOUDINARY-84: Reversed migration CLI
Feb 5, 2019
3c8aae7
CLOUDINARY-74,CLOUDINARY-91: New design for ML buttons
Feb 17, 2019
3d6cafd
CLOUDINARY-74: Refactored ML Wysiwyg imageUploaderUrl in order to rem…
Feb 19, 2019
1b0522a
CLOUDINARY-74,CLOUDINARY-89: Added support for derived images + refac…
Feb 20, 2019
1d5bf68
CLOUDINARY-74,CLOUDINARY-89: Added support for derived images + refac…
Feb 20, 2019
0736556
CLOUDINARY-74: small fixes on reversed migration
Feb 21, 2019
07b76d1
CLOUDINARY-74: small fixes on reversed migration
Feb 21, 2019
473dee4
CLOUDINARY-74: Added .tmp to file name on tmp product files
Feb 26, 2019
1b2d6af
CLOUDINARY-74: Removed .tmp to file name on tmp product files
Feb 26, 2019
e489df5
CLOUDINARY-74: Fixed constraint key violation on product gallery
Feb 26, 2019
2ad9f34
CLOUDINARY-74: Fixed constraint key violation on product gallery
Feb 26, 2019
b2b2e9a
CLOUDINARY-74: Fixed constraint key violation on product gallery
Feb 26, 2019
6558f10
CLOUDINARY-74: Moved free transformation validation to after product …
Feb 26, 2019
1bf6531
CLOUDINARY-74: small fixes
Feb 26, 2019
4606a72
CLOUDINARY-74: Added error message to cloudinary-ML JS
Feb 27, 2019
cc1c02c
CLOUDINARY-74: Removed double-slash from video thumbnail URL
Mar 3, 2019
3fde261
CLOUDINARY-74: Removed double-slash from video thumbnail URL
Mar 3, 2019
428f317
Changed version to 1.8.0 - Media Library Implementation
Mar 7, 2019
650fc14
CLOUDINARY-74: Fixes on ML
Mar 14, 2019
3fe8d9c
CLOUDINARY-74: Fixes on ML
Mar 14, 2019
b7643c9
CLOUDINARY-104
Mar 18, 2019
a20b877
CLOUDINARY-109: Disabled exception throwing the FileExists exception …
Mar 18, 2019
55c4505
CLOUDINARY-111: Fixed removeItem event on #media_gallery_content
Mar 18, 2019
0f47266
CLOUDINARY-106,CLOUDINARY-113:Added type to retrieveImage controller
Mar 18, 2019
a882069
CLOUDINARY-102: Working on Cloudinary-Product-Gallery implementation …
Mar 13, 2019
902cc1a
CLOUDINARY-102: Working on Cloudinary-Product-Gallery implementation
Mar 14, 2019
75d3bb5
CLOUDINARY-102: Working on Cloudinary-Product-Gallery implementation
Mar 14, 2019
609be7f
CLOUDINARY-102: Working on Cloudinary-Product-Gallery implementation
Mar 14, 2019
e5c085d
CLOUDINARY-102: Working on Cloudinary-Product-Gallery implementation …
Mar 17, 2019
35836c6
CLOUDINARY-102: Working on Cloudinary-Product-Gallery implementation …
Mar 17, 2019
07ff551
CLOUDINARY-102: Working on Cloudinary-Product-Gallery implementation …
Mar 17, 2019
7bd8e27
CLOUDINARY-102: Working on Cloudinary-Product-Gallery implementation …
Mar 17, 2019
88bb8a3
CLOUDINARY-102: Working on Cloudinary-Product-Gallery implementation …
Mar 17, 2019
4b78946
CLOUDINARY-105,CLOUDINARY-107: Minor content fixes
Mar 17, 2019
2316363
v1.9.0: Changed module version to 1.9.0
Mar 18, 2019
3083db1
v1.9.0: small fix
Mar 20, 2019
1566998
v1.9.0: ProductGallery unnecessary files clean-up
Apr 1, 2019
fb75bf7
v1.9.0: Product Gallery - splitted transformations & publicId
Apr 4, 2019
340cc97
v1.9.0: Product Gallery - splitted transformations & publicId
Apr 4, 2019
752de75
v1.9.0: Product Gallery - splitted transformations & publicId
Apr 4, 2019
6ae3469
v1.9.0: Product Gallery - splitted transformations & publicId
Apr 4, 2019
6b741fc
v1.9.0,CLOUDINARY-119,CLOUDINARY-120,CLOUDINARY-122,CLOUDINARY-124: S…
Apr 10, 2019
502fbce
v1.9.0,CLOUDINARY-123: Updated system.xml texts
Apr 10, 2019
4ee8bf1
CLOUDINARY-102: Replaced array_merge_recursive() with array_replace_r…
Apr 14, 2019
a1b0d9d
v1.9.0: Small fix on system.xml
Apr 21, 2019
aabf0ec
v1.9.0: Added support for global default free transform on product-ga…
Apr 21, 2019
14d9411
Disabled browser autofill on system config
Apr 24, 2019
66c4f72
Disabled browser autofill on system config
Apr 24, 2019
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
76 changes: 76 additions & 0 deletions Block/Adminhtml/Cms/Wysiwyg/Images/Content.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

namespace Cloudinary\Cloudinary\Block\Adminhtml\Cms\Wysiwyg\Images;

use Cloudinary\Cloudinary\Helper\MediaLibraryHelper;
use Magento\Backend\Block\Widget\Context;
use Magento\Framework\Json\EncoderInterface;

/**
* Wysiwyg Images content block
*
* @api
* @since 100.0.2
*/
class Content extends \Magento\Cms\Block\Adminhtml\Wysiwyg\Images\Content
{
/**
* MediaLibraryHelper
* @var array|null
*/
protected $mediaLibraryHelper;

/**
* @param Context $context
* @param EncoderInterface $jsonEncoder
* @param MediaLibraryHelper $mediaLibraryHelper
* @param array $data
*/
public function __construct(
Context $context,
EncoderInterface $jsonEncoder,
MediaLibraryHelper $mediaLibraryHelper,
array $data = []
) {
parent::__construct($context, $jsonEncoder, $data);
$this->mediaLibraryHelper = $mediaLibraryHelper;
}

/**
* Get Cloudinary media library widget options
*
* @param bool $multiple Allow multiple
* @param bool $refresh Refresh options
* @return string
*/
public function getCloudinaryMediaLibraryWidgetOptions($multiple = false, $refresh = false)
{
if (!($cloudinaryMLoptions = $this->mediaLibraryHelper->getCloudinaryMLOptions($multiple, $refresh))) {
return null;
}
return $this->_jsonEncoder->encode(
[
'cldMLid' => 'wysiwyg_media_gallery',
'imageUploaderUrl' => $this->_urlBuilder->addSessionParam()->getUrl('cloudinary/cms_wysiwyg_images/upload', ['type' => $this->_getMediaType()]),
'triggerSelector' => '.media-gallery-modal',
'triggerEvent' => 'fileuploaddone',
'cloudinaryMLoptions' => $cloudinaryMLoptions,
'addTmpExtension' => false,
'cloudinaryMLshowOptions' => $this->mediaLibraryHelper->getCloudinaryMLshowOptions("image"),
]
);
}

/**
* Return current media type based on request or data
*
* @return string
*/
protected function _getMediaType()
{
if ($this->hasData('media_type')) {
return $this->_getData('media_type');
}
return $this->getRequest()->getParam('type');
}
}
81 changes: 81 additions & 0 deletions Block/Adminhtml/Product/Helper/Form/Gallery/Content.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

/**
* Catalog product form gallery content
*
* @author Magento Core Team <core@magentocommerce.com>
*
* @method \Magento\Framework\Data\Form\Element\AbstractElement getElement()
*/
namespace Cloudinary\Cloudinary\Block\Adminhtml\Product\Helper\Form\Gallery;

use Cloudinary\Cloudinary\Helper\MediaLibraryHelper;
use Magento\Backend\Block\Template\Context;
use Magento\Catalog\Model\Product\Media\Config;
use Magento\Framework\Json\EncoderInterface;

/**
* Block for gallery content.
*/
class Content extends \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery\Content
{
/**
* @var string
*/
protected $_template = 'Cloudinary_Cloudinary::catalog/product/helper/gallery.phtml';

/**
* MediaLibraryHelper
* @var array|null
*/
protected $mediaLibraryHelper;

/**
* @param Context $context
* @param EncoderInterface $jsonEncoder
* @param Config $mediaConfig
* @param MediaLibraryHelper $mediaLibraryHelper
* @param array $data
*/
public function __construct(
Context $context,
EncoderInterface $jsonEncoder,
Config $mediaConfig,
MediaLibraryHelper $mediaLibraryHelper,
array $data = []
) {
parent::__construct($context, $jsonEncoder, $mediaConfig, $data);
$this->mediaLibraryHelper = $mediaLibraryHelper;
}

/**
* Get Cloudinary media library widget options
*
* @param bool $multiple Allow multiple
* @param bool $refresh Refresh options
* @return string
*/
public function getCloudinaryMediaLibraryWidgetOptions($multiple = true, $refresh = false)
{
if (!($cloudinaryMLoptions = $this->mediaLibraryHelper->getCloudinaryMLOptions($multiple, $refresh))) {
return null;
}
return $this->_jsonEncoder->encode(
[
'htmlId' => $this->getHtmlId(),
'cldMLid' => 'product_gallery_' . $this->getHtmlId(),
'imageUploaderUrl' => $this->_urlBuilder->addSessionParam()->getUrl('cloudinary/ajax/retrieveImage'),
'triggerSelector' => '#media_gallery_content',
'triggerEvent' => 'addItem',
'useDerived' => false,
'addTmpExtension' => true,
'cloudinaryMLoptions' => $cloudinaryMLoptions,
'cloudinaryMLshowOptions' => $this->mediaLibraryHelper->getCloudinaryMLshowOptions(null),
]
);
}
}
43 changes: 43 additions & 0 deletions Block/Adminhtml/System/Config/Form/Field/ColorPicker.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace Cloudinary\Cloudinary\Block\Adminhtml\System\Config\Form\Field;

use Magento\Framework\Data\Form\Element\AbstractElement;

class ColorPicker extends \Magento\Config\Block\System\Config\Form\Field
{

/**
* add color picker in admin configuration fields
* @param AbstractElement $element
* @return string script
*/
protected function _getElementHtml(AbstractElement $element)
{
$html = $element->getElementHtml();
$value = $element->getData('value');

$html .= '<script type="text/javascript">
require(["jquery", "jquery/colorpicker/js/colorpicker"], function ($) {
$(document).ready(function () {
var $el = $("#' . $element->getHtmlId() . '");
$el.css("backgroundColor", $el.val()).val("#" + $el.val().replace(/^(#)/,"").substring(0, 6));
$el.ColorPicker({
color: "#" + $el.val().replace(/^(#)/,"").substring(0, 6),
onChange: function (hsb, hex, rgb) {
$el.css("backgroundColor", "#" + hex).val("#" + hex);
}
});
$el.on("change keyup focus", function(){
var currentVal = $(this).val().replace(/^(#)/,"").substring(0, 6);
$(this).val("#" + currentVal);
$(this).css("backgroundColor", "#" + currentVal);
$(this).ColorPickerSetColor("#" + currentVal);
});
});
});
</script>';

return $html;
}
}
96 changes: 96 additions & 0 deletions Command/DownloadImages.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
<?php

namespace Cloudinary\Cloudinary\Command;

use Cloudinary\Cloudinary\Model\BatchDownloader;
use Cloudinary\Cloudinary\Model\Logger\OutputLogger;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;

class DownloadImages extends Command
{
/**#@+
* Keys and shortcuts for input arguments and options
*/
const OVERRIDE = 'override';
/**#@- */

const OVERRIDE_CONFIRM_MESSAGE = "<question>Are you sure you want to override local files (y/n)[n]?</question>";

private $_override = false;

/**
* @var BatchDownloader
*/
private $batchDownloader;

/**
* @var OutputLogger
*/
private $outputLogger;

/**
* @param BatchDownloader $batchDownloader
*/
public function __construct(BatchDownloader $batchDownloader, OutputLogger $outputLogger)
{
parent::__construct('cloudinary:download:all');

$this->batchDownloader = $batchDownloader;
$this->outputLogger = $outputLogger;
}

/**
* Configure the command
*
* @return void
*/
protected function configure()
{
$this->setName('cloudinary:download:all');
$this->setDescription('Download images from Cloudinary to the local pub/media dir');
$this->setDefinition([
new InputOption(
self::OVERRIDE,
'-o',
InputOption::VALUE_NONE,
'Override local images if already exists'
),
]);
}

/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
try {
if ($input->getOption(self::OVERRIDE) && $this->confirmQuestion(self::OVERRIDE_CONFIRM_MESSAGE, $input, $output)) {
$this->_override = true;
}
$this->outputLogger->setOutput($output);
$this->batchDownloader->downloadUnsynchronisedImages($this->outputLogger, $this->_override);
} catch (\Exception $e) {
$output->writeln($e->getMessage());
}
}

/**
* @method confirmQuestion
* @param string $message
* @param InputInterface $input
* @param OutputInterface $output
* @return bool
*/
private function confirmQuestion(string $message, InputInterface $input, OutputInterface $output)
{
$confirmationQuestion = new ConfirmationQuestion($message, false);
return (bool)$this->getHelper('question')->ask($input, $output, $confirmationQuestion);
}
}
10 changes: 5 additions & 5 deletions Command/StopMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

class StopMigration extends Command
{
const NOP_MESSAGE = 'No upload running to stop.';
const STOPPED_MESSAGE = 'Upload manually stopped.';
const NOP_MESSAGE = 'No upload/download running to stop.';
const STOPPED_MESSAGE = 'Upload/Download manually stopped.';

/**
* @var MigrationTask
*/
Expand All @@ -22,7 +22,7 @@ class StopMigration extends Command
*/
public function __construct(MigrationTask $migrationTask)
{
parent::__construct('cloudinary:upload:stop');
parent::__construct('cloudinary:migration:stop');

$this->migrationTask = $migrationTask;
}
Expand All @@ -34,7 +34,7 @@ public function __construct(MigrationTask $migrationTask)
*/
protected function configure()
{
$this->setDescription('Stops any currently running upload.');
$this->setDescription('Stops any currently running upload/download.');
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Controller/Adminhtml/Ajax/Free/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace Cloudinary\Cloudinary\Controller\Adminhtml\Ajax\Free;

use Cloudinary\Cloudinary\Core\Image\Transformation\Freeform;
use Cloudinary\Cloudinary\Core\ConfigurationInterface;
use Cloudinary\Cloudinary\Core\Image\Transformation;
use Cloudinary\Cloudinary\Core\Image\Transformation\Freeform;
use Cloudinary\Cloudinary\Model\Config\Backend\Free as FreeBackendModel;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\Result\JsonFactory;
use Cloudinary\Cloudinary\Model\Config\Backend\Free as FreeBackendModel;
use Cloudinary\Cloudinary\Core\ConfigurationInterface;

class Image extends Action
{
Expand Down
Loading