Skip to content

Commit

Permalink
Mise à jour pour la version alpha9 du CMS.
Browse files Browse the repository at this point in the history
  • Loading branch information
noelma committed Nov 20, 2019
1 parent d8da2ab commit d080d55
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 53 deletions.
7 changes: 7 additions & 0 deletions Config/routes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

use Soosyze\Components\Router\Route as R;

R::useNamespace('SoosyzeExtension\Trumbowyg\Controller');

R::post('trumbowyg.upload', 'trumbowyg/upload', 'Trumbowyg@pluginUpload');
7 changes: 0 additions & 7 deletions Config/routing.json

This file was deleted.

15 changes: 9 additions & 6 deletions Controller/Trumbowyg.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ class Trumbowyg extends \Soosyze\Controller
public function __construct()
{
$this->pathServices = dirname(__DIR__) . '/Config/service.json';
$this->pathRoutes = dirname(__DIR__) . '/Config/routing.json';
$this->pathRoutes = dirname(__DIR__) . '/Config/routes.php';
}

public function pluginUpload($req)
{
$server = $req->getServerParams();

if (!empty($server[ 'HTTP_X_REQUESTED_WITH' ]) && strtolower($server[ 'HTTP_X_REQUESTED_WITH' ]) != 'xmlhttprequest') {
if (!$req->isAjax()) {
$post = $req->getParsedBody();

return $this->json(405, [
Expand All @@ -35,8 +33,13 @@ public function pluginUpload($req)

if ($validator->isValid()) {
$image = $validator->getInput('image');
$path = self::core()->getSetting('files_public', 'app/files/public');
$link = self::file()->cleanPathAndMoveTo($path, $image);
$path = self::core()->getSettingEnv('files_public', 'app/files') . '/node';
$link = self::file()
->add($image)
->setPath($path)
->setResolvePath()
->setResolveName()
->saveOne();

$data = [
'success' => true,
Expand Down
33 changes: 0 additions & 33 deletions Install.php

This file was deleted.

4 changes: 2 additions & 2 deletions Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

class Installer implements \SoosyzeCore\System\Migration
{
public function getComposer()
public function getDir()
{
return __DIR__ . '/composer.json';
return __DIR__;
}

public function install(ContainerInterface $ci)
Expand Down
2 changes: 1 addition & 1 deletion Services/Trumbowyg.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct($core, $router)

public function getEditor($request, &$response)
{
$vendor = $this->core->getPath('modules_contributed') . '/Trumbowyg/vendor/';
$vendor = $this->core->getPath('modules_contributed', 'app/modules', false) . '/Trumbowyg/vendor/';
$script = $response->getBlock('this')->getVar('scripts');
$style = $response->getBlock('this')->getVar('styles');
$script .= '<script src="' . $vendor . 'dist/trumbowyg.min.js"></script>';
Expand Down
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
}
},
"extra": {
"soosyze-module": {
"soosyze": {
"title": "Trumbowyg",
"package": "Content",
"controllers": {
"Trumbowyg": "SoosyzeExtension\\Trumbowyg\\Controller\\Trumbowyg"
},
"controller": "SoosyzeExtension\\Trumbowyg\\Controller\\Trumbowyg",
"icon": {
"name": "fas fa-paragraph",
"background-color": "#fc5951",
Expand Down

0 comments on commit d080d55

Please sign in to comment.