Impmroved Tinymce module

This commit is contained in:
Franck Allimant
2014-06-18 15:36:24 +02:00
parent 39c9ca1b2b
commit 04135032bf
187 changed files with 71 additions and 13158 deletions

View File

@@ -18,15 +18,57 @@ use Thelia\Module\BaseModule;
class Tinymce extends BaseModule
{
private $jsPath, $mediaPath, $webJsPath, $webMediaPath;
public function __construct()
{
$this->jsPath = __DIR__ . DS .'Resources' . DS . 'js' . DS . 'tinymce';
$this->mediaPath = __DIR__ . DS .'Resources' . DS . 'media';
$this->webJsPath = THELIA_WEB_DIR . 'tinymce';
$this->webMediaPath = THELIA_WEB_DIR . 'media';
}
/**
* YOU HAVE TO IMPLEMENT HERE ABSTRACT METHODD FROM BaseModule Class
* Like install and destroy
* @inheritdoc
*/
public function postActivation(ConnectionInterface $con = null)
{
// Create symbolic links in the web directory, to make the TinyMCE code
// and the content of the 'media' directory available.
$fs = new Filesystem();
$fs->mirror(__DIR__ . DS .'Resources'.DS.'js'.DS.'tinymce', THELIA_WEB_DIR . 'tinymce');
$fs->symlink(__DIR__ . DS .'Resources'.DS.'media', THELIA_WEB_DIR . 'media');
if (false === $fs->exists($this->webJsPath)) {
$fs->symlink($this->jsPath, $this->webJsPath);
}
// Create the media directory in the web root
if (false === $fs->exists($this->webMediaPath)) {
$fs->mkdir($this->webMediaPath."/upload");
$fs->mkdir($this->webMediaPath."/thumbs");
}
}
}
/**
* @inheritdoc
*/
public function postDeactivation(ConnectionInterface $con = null)
{
$fs = new Filesystem();
$fs->remove($this->webJsPath);
$fs->remove($this->mediaPath);
}
/**
* @inheritdoc
*/
public function destroy(ConnectionInterface $con = null, $deleteModuleData = false)
{
if ($deleteModuleData) {
$fs = new Filesystem();
$fs->remove($this->webMediaPath);
}
}
}