Merge pull request #167 from thelia/tinymce

Tinymce
This commit is contained in:
Manuel Raynaud
2014-01-14 02:24:42 -08:00
274 changed files with 296 additions and 49 deletions

2
.gitignore vendored
View File

@@ -18,6 +18,8 @@ local/media/documents/*
local/media/images/* local/media/images/*
web/assets/* web/assets/*
web/cache/* web/cache/*
web/tinymce
web/media
phpdoc*.log phpdoc*.log
php-cs php-cs
xhprof/ xhprof/

View File

@@ -1,3 +1,6 @@
#2.0.0-beta4
- Tinymce is now a dedicated module. You need to activate it.
#2.0.0-beta3 #2.0.0-beta3
- Coupon effect inputs are now more customisable (input text, select, ajax, etc.. are usable) and unlimited amount of input for coupon effect are now possible too - Coupon effect inputs are now more customisable (input text, select, ajax, etc.. are usable) and unlimited amount of input for coupon effect are now possible too
- when a category is deleted, all subcategories are deleted - when a category is deleted, all subcategories are deleted

View File

@@ -213,7 +213,7 @@ class TheliaHttpKernel extends HttpKernel
} }
} }
protected function initSession(Request $request) public function initSession(Request $request)
{ {
if (null === self::$session) { if (null === self::$session) {
$storage = new Session\Storage\NativeSessionStorage(); $storage = new Session\Storage\NativeSessionStorage();

View File

@@ -76,7 +76,8 @@ INSERT INTO `module` (`id`, `code`, `type`, `activate`, `position`, `full_namesp
(1, 'TheliaDebugBar', 1, 1, 1, 'TheliaDebugBar\\TheliaDebugBar', NOW(), NOW()), (1, 'TheliaDebugBar', 1, 1, 1, 'TheliaDebugBar\\TheliaDebugBar', NOW(), NOW()),
(2, 'Colissimo', 2, 0, 1, 'Colissimo\\Colissimo', NOW(), NOW()), (2, 'Colissimo', 2, 0, 1, 'Colissimo\\Colissimo', NOW(), NOW()),
(3, 'Cheque', 3, 0, 1, 'Cheque\\Cheque', NOW(), NOW()), (3, 'Cheque', 3, 0, 1, 'Cheque\\Cheque', NOW(), NOW()),
(4, 'Front', 1, 1, 2, 'Front\\Front', NOW(), NOW()); (4, 'Front', 1, 1, 2, 'Front\\Front', NOW(), NOW())
(5, 'Tinymce', 1, 0, 1, 'Tinymce\\Tinymce', NOW(), NOW());
INSERT INTO `module_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES INSERT INTO `module_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
('1', 'en_US', 'Debug bar', NULL, NULL, NULL), ('1', 'en_US', 'Debug bar', NULL, NULL, NULL),
@@ -84,7 +85,9 @@ INSERT INTO `module_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `po
('2', 'en_US', '72h delivery', NULL, NULL, NULL), ('2', 'en_US', '72h delivery', NULL, NULL, NULL),
('2', 'fr_FR', 'Livraison par colissimo en 72h', NULL, NULL, NULL), ('2', 'fr_FR', 'Livraison par colissimo en 72h', NULL, NULL, NULL),
('4', 'en_US', 'Front office integration', NULL, NULL, NULL), ('4', 'en_US', 'Front office integration', NULL, NULL, NULL),
('4', 'fr_FR', 'Module Front office', NULL, NULL, NULL); ('4', 'fr_FR', 'Module Front office', NULL, NULL, NULL)
('5', 'en_US', 'tinymce wysiwyg editor', NULL, NULL, NULL),
('5', 'fr_FR', 'éditeur wysiwyg tinymce', NULL, NULL, NULL);
INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES INSERT INTO `customer_title`(`id`, `by_default`, `position`, `created_at`, `updated_at`) VALUES

View File

@@ -0,0 +1,15 @@
# This is a fix for InnoDB in MySQL >= 4.1.x
# It "suspends judgement" for fkey relationships until are tables are set.
SET FOREIGN_KEY_CHECKS = 0;
INSERT INTO `module` (`code`, `type`, `activate`, `position`, `full_namespace`, `created_at`, `updated_at`) VALUES
( 'Tinymce', 1, 0, 1, 'Tinymce\\Tinymce', NOW(), NOW());
INSERT INTO `module_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `postscriptum`) VALUES
(LAST_INSERT_ID(), 'en_US', 'tinymce wysiwyg editor', NULL, NULL, NULL),
(LAST_INSERT_ID(), 'fr_FR', 'éditeur wysiwyg tinymce', NULL, NULL, NULL);
UPDATE `config` SET `value`='2.0.0-beta4' WHERE `name`='thelia_version';
UPDATE `config` SET `value`='beta4' WHERE `name`='thelia_extra_version';
SET FOREIGN_KEY_CHECKS = 1;

1
local/modules/Tinymce/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
Resources/*

View File

@@ -0,0 +1 @@
{include file="include/tinymce_init.tpl"}

View File

@@ -0,0 +1 @@
{include file="include/tinymce_init.tpl"}

View File

@@ -0,0 +1 @@
{include file="include/tinymce_init.tpl"}

View File

@@ -0,0 +1 @@
{include file="include/tinymce_init.tpl"}

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8" ?>
<config xmlns="http://thelia.net/schema/dic/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">
<loops>
<!-- sample definition
<loop name="MySuperLoop" class="MyModule\Loop\MySuperLoop" />
-->
</loops>
<forms>
<!--
<form name="MyFormName" class="MyModule\Form\MySuperForm" />
-->
</forms>
<commands>
<!--
<command class="MyModule\Command\MySuperCommand" />
-->
</commands>
<templateDirectives>
<!-- Sample definition
<templateDirectives class="MyModule\Directive\MyTemplateDirective" name="my_filter"/>
-->
</templateDirectives>
<services>
<service id="tinymce.listener" class="Tinymce\Listener\VerifyTinymceListener">
<tag name="kernel.event_subscriber"/>
</service>
</services>
</config>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module>
<fullnamespace>Tinymce\Tinymce</fullnamespace>
<descriptive locale="en_US">
<title>Tinymce wysiwyg editor</title>
</descriptive>
<descriptive locale="fr_FR">
<title>éditeur wysiwyg Tinymce</title>
</descriptive>
<version>0.1</version>
<author>
<name>Manuel Raynaud</name>
<email>manu@thelia.net</email>
</author>
<type>classic</type>
<thelia>2.0.0</thelia>
<stability>alpha</stability>
</module>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<database defaultIdMethod="native" name="thelia" namespace="Tinymce\Model">
<!--
See propel documentation on http://propelorm.org for all information about schema file
-->
<external-schema filename="/home/manu/dev/www/thelia/local/config/schema.xml" referenceOnly="true" />
</database>

View File

@@ -0,0 +1,93 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Tinymce\Listener;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\Filesystem\Filesystem;
use Thelia\Core\Event\TheliaEvents;
use Thelia\Core\Event\Cache\CacheEvent;
use Thelia\Core\Thelia;
/**
* Class VerifyTinymceListener
* @package Tinymce\Listener
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class VerifyTinymceListener implements EventSubscriberInterface
{
public function verifyTinymce(Event $event)
{
$fs = new Filesystem();
if (false === file_exists(THELIA_WEB_DIR . '/tinymce')) {
$fs->mirror(__DIR__ . '/../Resources/js/tinymce', THELIA_WEB_DIR . '/tinymce');
}
if (false === file_exists(THELIA_WEB_DIR . '/media')) {
$fs->symlink(__DIR__ . '/../Resources/media', THELIA_WEB_DIR . '/media');
}
}
public function clearCache(CacheEvent $event)
{
if (true === file_exists(THELIA_WEB_DIR . '/tinymce')) {
echo "toto";
$fs = new Filesystem();
$directory = new \DirectoryIterator(THELIA_WEB_DIR . '/tinymce');
$fs->remove($directory);
}
}
/**
* Returns an array of event names this subscriber wants to listen to.
*
* The array keys are event names and the value can be:
*
* * The method name to call (priority defaults to 0)
* * An array composed of the method name to call and the priority
* * An array of arrays composed of the method names to call and respective
* priorities, or 0 if unset
*
* For instance:
*
* * array('eventName' => 'methodName')
* * array('eventName' => array('methodName', $priority))
* * array('eventName' => array(array('methodName1', $priority), array('methodName2'))
*
* @return array The event names to listen to
*
* @api
*/
public static function getSubscribedEvents()
{
return array(
TheliaEvents::BOOT => array('verifyTinymce', 128),
TheliaEvents::CACHE_CLEAR => array("clearCache", 0)
);
}
}

View File

Before

Width:  |  Height:  |  Size: 354 B

After

Width:  |  Height:  |  Size: 354 B

View File

Before

Width:  |  Height:  |  Size: 329 B

After

Width:  |  Height:  |  Size: 329 B

View File

Before

Width:  |  Height:  |  Size: 340 B

After

Width:  |  Height:  |  Size: 340 B

View File

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 338 B

View File

Before

Width:  |  Height:  |  Size: 323 B

After

Width:  |  Height:  |  Size: 323 B

View File

Before

Width:  |  Height:  |  Size: 344 B

After

Width:  |  Height:  |  Size: 344 B

View File

Before

Width:  |  Height:  |  Size: 350 B

After

Width:  |  Height:  |  Size: 350 B

View File

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 336 B

View File

@@ -1,5 +1,45 @@
<?php <?php
session_start(); use Thelia\Core\HttpKernel\HttpCache\HttpCache;
use Thelia\Core\Thelia;
use Thelia\Core\HttpFoundation\Request;
//use Symfony\Component\DependencyInjection;
$env = 'prod';
require __DIR__ . '/../../../../../core/bootstrap.php';
$request = Request::createFromGlobals();
$thelia = new Thelia("prod", false);
$thelia->boot();
$httpKernel = $thelia->getContainer()->get('http_kernel');
$httpKernel->getContainer()->enterScope('request');
$httpKernel->getContainer()->set('request', $request, 'request');
$httpKernel->initSession($request);
/** @var \Thelia\Core\Security\SecurityContext $securityContext */
$securityContext = $httpKernel->getContainer()->get('thelia.securityContext');
$isGranted = $securityContext->isGranted(
array('ADMIN'),
array(
\Thelia\Core\Security\Resource\AdminResources::PRODUCT,
\Thelia\Core\Security\Resource\AdminResources::CATEGORY,
\Thelia\Core\Security\Resource\AdminResources::FOLDER,
\Thelia\Core\Security\Resource\AdminResources::CONTENT,
),
array(),
array(
\Thelia\Core\Security\AccessManager::UPDATE,
\Thelia\Core\Security\AccessManager::CREATE,
)
);
if (false === $isGranted) {
exit;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// DON'T COPY THIS VARIABLES IN FOLDERS config.php FILES // DON'T COPY THIS VARIABLES IN FOLDERS config.php FILES
@@ -19,11 +59,11 @@ session_start();
// | | | |- responsivefilemanager // | | | |- responsivefilemanager
// | | | | |- plugin.min.js // | | | | |- plugin.min.js
$base_url="http://www.site.com"; // base url (only domain) of site (without final /). If you prefer relative urls leave empty $base_url=rtrim(\Thelia\Model\ConfigQuery::read('url_site'), '/'); // base url (only domain) of site (without final /). If you prefer relative urls leave empty
$upload_dir = '/source/'; // path from base_url to base of upload folder (with start and final /) $upload_dir = '/media/'; // path from base_url to base of upload folder (with start and final /)
$current_path = '../source/'; // relative path from filemanager folder to upload folder (with final /) $current_path = '../../../media/'; // relative path from filemanager folder to upload folder (with final /)
//thumbs folder can't put inside upload folder //thumbs folder can't put inside upload folder
$thumbs_base_path = '../thumbs/'; // relative path from filemanager folder to thumbs folder (with final /) $thumbs_base_path = '../../../media/'; // relative path from filemanager folder to thumbs folder (with final /)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// YOU CAN COPY AND CHANGE THESE VARIABLES IN FOLDERS config.php FILES // YOU CAN COPY AND CHANGE THESE VARIABLES IN FOLDERS config.php FILES

View File

Before

Width:  |  Height:  |  Size: 648 B

After

Width:  |  Height:  |  Size: 648 B

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 412 B

After

Width:  |  Height:  |  Size: 412 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Some files were not shown because too many files have changed in this diff Show More