#5914: plugin/myplugin/vendors/*-folders only accepting the specific content
--------------------------+-------------------------------------------------
    Reporter:  stevieboy  |          Type:  Optimization
      Status:  new        |      Priority:  Medium      
   Milestone:  1.2.x.x    |     Component:  Core Libs   
     Version:  RC4        |      Severity:  Normal      
    Keywords:             |   Php_version:  PHP 5       
Cake_version:  7945       |  
--------------------------+-------------------------------------------------
 I recently wrote a plugin with a helper for TinyMce-Editor.[[BR]]
 [[BR]]
 As a normal helper it worked fine but when I tried to load the helper in
 the plugin the editor window all the buttons and colors where
 missing.[[BR]][[BR]]

 In a long detective session I figured out that the dispatcher only allows
 js-files in the js-folder. In the case of TinyMce which has a template
 folder (incl. css+images) as a subdir this restriction leads to TinyMce
 having no css and no images for the buttons (if I call it directly (let's
 say a css or an image) I'll get a myplugincontroller missing-
 error.[[BR]][[BR]]

 I found the part responsible and I found a way to enable the correct
 behaviour. But for that I had to modify the dispatcher.php.[[BR]][[BR]]

 {{{
 Index: dispatcher.php
 ===================================================================
 --- dispatcher.php      (revision 208)
 +++ dispatcher.php      (working copy)
 @@ -623,10 +623,13 @@

                         foreach ($assets as $type => $contentType) {
                                 if ($type === $ext) {
 -                                       if ($type === 'css' || $type ===
 'js') {
 -                                               $pos = strpos($url, $type
 . '/');
 -                                       } else {
 -                                               $pos = strpos($url,
 'img/');
 +                                       foreach ($assets as $asstype =>
 $asscontentType) {
 +                                                       /*
 +                                                        * Stefan Hoth:
 had to remove the part where the path is checked against the extension
 +                                                        * because some
 javascripts (like TinyMce) bring their own css and/or images within the
 js-directory
 +                                                        */
 +                                                       $pos =
 strpos($url, $asstype.'/');
 +                                                       if($pos > 0)
 break;
                                         }
                                         $isAsset = true;
                                         break;

 }}}

 I want to ask if there's a particular reason (besides plain wish to have a
 clean folder/file-structure) for the restriction?[[BR]][[BR]]

 I would be glad if some cake-dev enlighten me and even more if the
 restriction is lifted that way I proposed in my patch.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5914>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to