diff --git a/VERSIONS_HOTLINE/74605 b/VERSIONS_HOTLINE/74605 new file mode 100644 index 0000000000000000000000000000000000000000..3d87af72008e1013800ebf72e9bdda8ea995aa47 --- /dev/null +++ b/VERSIONS_HOTLINE/74605 @@ -0,0 +1,2 @@ + - ticket #74605 : Administration : correction de l'ajout d'images dans les articles. + \ No newline at end of file diff --git a/library/Class/FileManager.php b/library/Class/FileManager.php index 0d8ee7b59f03e440754a5515879ed9b846d1ad64..a9de5817db3a2de3161adfdaaf4696d027d32490 100644 --- a/library/Class/FileManager.php +++ b/library/Class/FileManager.php @@ -138,12 +138,18 @@ class Class_FileManager extends Class_Entity { public static function find($path) { + $path = static::_urlToPath($path); return ($item = static::directory($path)) ? $item : static::file($path); } + protected static function _urlToPath($path) { + return str_replace(BASE_URL . '/' , '', $path); + } + + public static function delete($item) { if (!$item) return true; diff --git a/library/Class/Notice/Xsl.php b/library/Class/Notice/Xsl.php index a4a23b3ed197cac37c9a3565942990ff448d6088..17831604ff1e14b8b24f38d3f227e90e8b044589 100644 --- a/library/Class/Notice/Xsl.php +++ b/library/Class/Notice/Xsl.php @@ -99,7 +99,8 @@ class Class_Notice_Xsl { public function getXslFileUrl() { - $settings = $this->_profile->getCfgModulesPreferences('recherche', 'viewnotice', $this->_record->getTypeDoc()); + $settings = $this->_profile->getCfgModulesPreferences('recherche', 'viewnotice', $this->_record->getTypeDoc()); + if(!$settings) return; diff --git a/library/ZendAfi/Controller/Plugin/Manager/FileManager.php b/library/ZendAfi/Controller/Plugin/Manager/FileManager.php index 9479b013176bf39b6dc3b1230fbc6eec8b25fc8f..8230ae7d7cee9bc5339b1cdccc0f4fdc2091f28f 100644 --- a/library/ZendAfi/Controller/Plugin/Manager/FileManager.php +++ b/library/ZendAfi/Controller/Plugin/Manager/FileManager.php @@ -46,7 +46,7 @@ class ZendAfi_Controller_Plugin_Manager_FileManager extends ZendAfi_Controller_P }, 'label' => $this->_('Sélectionner "%s"', $model->getName()), 'anchorOptions' => array_filter(['title' => $this->_('Sélectionner "%s"', $model->getName()), - 'onclick' => "$(this).selectItemForCKEditor('" . str_replace(["'", '"'], ['%27', '%22'], $model->getId()) . "');"])], + 'onclick' => "$(this).selectItemForCKEditor('" . str_replace(["'", '"'], ['%27', '%22'], Class_Url::relative($model->getPath())) . "');"])], ['url' => ['action' => 'create', 'into' => $model->getId()], diff --git a/tests/application/modules/admin/controllers/FileManagerControllerTest.php b/tests/application/modules/admin/controllers/FileManagerControllerTest.php index 3decc2196972fa800dd621524fc6d329e9c19747..2af63ced65cfeaaeffb3e69ca2602b240cba1478 100644 --- a/tests/application/modules/admin/controllers/FileManagerControllerTest.php +++ b/tests/application/modules/admin/controllers/FileManagerControllerTest.php @@ -1595,7 +1595,7 @@ class FileManagerControllerWithSpecialCharTest extends FileManagerControllerTest /** @test */ public function selectButtonShouldBePresent() { - $this->assertXPathContentContains('//div//a[contains(@onclick, "$(this).selectItemForCKEditor(")][contains(@onclick, "selectItemForCKEditor(\'userfiles/my %27direct%22ory/new%27_ima%22ge.jpg")]', 'Sélectionner'); + $this->assertXPathContentContains('//div//a[contains(@onclick, "$(this).selectItemForCKEditor(")][contains(@onclick, "/userfiles/my %27direct%22ory/new%27_ima%22ge.jpg")]', 'Sélectionner'); } diff --git a/tests/scenarios/Xsl/XslTest.php b/tests/scenarios/Xsl/XslTest.php index fb6425121983d3188cbc60be5898f58b086bfd34..3357c6ccfb9d99adea4c1a2fba53d54197e2bcad 100644 --- a/tests/scenarios/Xsl/XslTest.php +++ b/tests/scenarios/Xsl/XslTest.php @@ -159,7 +159,7 @@ class XslNoticeajaxDetailDispatchTest extends AbstractControllerTestCase { Class_Notice_Xsl::setXSLTProcessor($xslt_processor); $profile = Class_Profil::getCurrentProfil(); - $profile->setCfgModulesPreferences(['xslt' => 'tests/scenarios/Xsl/record_description.xsl'], + $profile->setCfgModulesPreferences(['xslt' => '/tests/scenarios/Xsl/record_description.xsl'], 'recherche', 'viewnotice', '1'); @@ -204,7 +204,7 @@ class XslNoticeajaxDetailDispatchWithoutXSLTest extends AbstractControllerTestCa Class_Notice_Xsl::setPhpCommand($php_command); $profile = Class_Profil::getCurrentProfil(); - $profile->setCfgModulesPreferences(['xslt' => 'tests/scenarios/Xsl/record_description.xsl'], + $profile->setCfgModulesPreferences(['xslt' => '/tests/scenarios/Xsl/record_description.xsl'], 'recherche', 'viewnotice', '1');