We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    When I have time, I'll have to play around with Tiny4 and RESPONSIVE filemanager (their inexplicable orthography).

    This looks interesting as well: http://forums.aurigma.com/yaf_postst4033_Amazon-S3-File-Manager-for-TinyMCE-and-CKEditor.aspx#post12430. Not sure if it works with Tiny4
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 40088
      • 708 Posts
      Quote from: BobRay at Feb 21, 2015, 01:09 PM
      When I have time, I'll have to play around with Tiny4 and RESPONSIVE filemanager (their inexplicable orthography).

      This looks interesting as well: http://forums.aurigma.com/yaf_postst4033_Amazon-S3-File-Manager-for-TinyMCE-and-CKEditor.aspx#post12430. Not sure if it works with Tiny4

      Oh Brother, could I use that S3 File manager! So many cool tools that I hope can be made to work with MODX. If not then it's just a cruel temptation. ;-)
        Todd
        • 3749
        • 24,544 Posts
        @donshakespeare Have you looked into integrating RF with the version of TinyMCE4 hosted at the CacheFly CDN? I was able to make that version work with NewsPublisher in less than 10 minutes (minus any configuration options). It would be fantastic if RF could be added, but I'm not sure it's possible. I haven't looked at the code, but from the docs, it sounds like RF depends on the local, physical TinyMCE plugins directory. I hope I'm wrong about that.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 42562
          • 1,145 Posts
          Yes I have.

          Responsive Filemanager does not depend in anyway on TinyMCE. It is an app with its own rights.
          Responsive Filemanager comes with a TinyMCE plugin that merely links to Responsive Filemanager from TinyMCE, when TinyMCE is loaded, however it is loaded, locally or via CDN.

          A similar Responsive Filemanager TinyMCE plugin can be written for any other sensible RTE, namely CKEditor...

          TinyMCE 4+ can allow its core to be loaded via CDN, and indeed all its native plugins on the CDN, while allowing for what it calls "external_plugins"
          http://www.tinymce.com/wiki.php/Configuration:external_plugins

          The dissociated integration is remarkable!

          You are too right, 5 minutes max to integrate with NewsPublisher, or any other RTE for that matter. Still, thanks for NP, it's rocking my world.
            TinymceWrapper: Complete back/frontend content solution.
            Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
            5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
            • 40088
            • 708 Posts
            @BobRay and @donshakespeare
            Out of curiosity, is there anything special required to hook the CDN version into NP?

            I've used the CDN version outside of MODX so I'm familiar with setting it up, I just haven't investigated using it with NP.
              Todd
              • 42562
              • 1,145 Posts
              @todd.b
              There is nothing special at all.
              NP gives you CSS ids and classnames to play with, in fact that is one strong point of NP. It exposes a lot for you in the front-end.

              NP has content textarea, no? something like
              <textarea id="np-content">blah blah</textarea>

              np-content becomes your TinyMCE selector.
              Unlike one other RTE out there, it updates your original textarea automatically, before submitting.

              Please bare in mind, that TinyMCE is wholly JavaScript (client-side) and does not need any sort of super duper whatnot.
              The fiddle is your friend http://fiddle.tinymce.com/
              That example will work straight up in NP.
                TinymceWrapper: Complete back/frontend content solution.
                Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                • 3749
                • 24,544 Posts
                Actually, if the richtext properties are set in the NP tag, it's:

                <textarea class="modx-richtext"></textarea>


                So this in the template head section:

                <script src = "//tinymce.cachefly.net/4.1/tinymce.min.js" ></script >


                and this, in the TinyMCE init section of NP, will make it work right away (after you remove the code that loads the MODX TinyMCE):

                selector: ".modx-richtext"


                Making Responsive Filemanager work with Tiny in the front end is more of a challenge, because by default, Tiny wants to make the path from the bogus URL of the NewsPublisher page. It took me about three hours to get the paths right. You have to use something like this in the tiny init section and mess with the Filemanager config paths:

                   relative_urls : false,
                   remove_script_host : true,
                   document_base_url : "http://yoursite.com/path/to/image/dir"


                So far, I have no clue how to make it work with file and image TVs (though the original code still handles that). And unless you want all users uploading to the same directory, you have to put in some code to set everything dynamically.

                The good news is that Responsive Filemanager *will* work with the CDN version of TinyMCE4. I did not have to initialize MODX (since NP is running inside it), but I did have to leave in the session_start(); line in the RF config file, which may indicate problems down the road.

                In theory, you should be able to use the CDN version with a plugin in the Manager and set properties for all the TinyMCE config settings. Integrating RF may be less of a challenge in the Manager. There should be a way to specify the config file RF uses, but so far I don't see one.
                  Did I help you? Buy me a beer
                  Get my Book: MODX:The Official Guide
                  MODX info for everyone: http://bobsguides.com/modx.html
                  My MODX Extras
                  Bob's Guides is now hosted at A2 MODX Hosting
                  • 42562
                  • 1,145 Posts
                  So in my setup I have RF taking care of only content, it runs outside of NP. I am yet to consider image TVs and the like.

                  MODx is initialized in RF thus taking care of sessions.
                  assets/filemanager/config/config.php
                  //this is the MODx addition to config.php, replacing lines 2 - 32
                  //session_start();
                  if (!defined('MODX_CORE_PATH')) {
                      define('MODX_CORE_PATH', '/path/to/core/');
                  }
                  if (!defined('MODX_CONFIG_KEY')) {
                      define('MODX_CONFIG_KEY', 'config');
                  }
                  require_once( MODX_CORE_PATH . 'model/modx/modx.class.php');
                  $modx = new modx();
                  $modx->initialize('web');
                   
                  //DONE Loading MODx Externally! Now let's play with sweet ol' MODx
                   
                  $modxId = $modx->user->get('id');
                  $myUsername = $modx->user->get('username');
                  //only trusted members of the Club have access to filemanger - better security
                  if ($modx->user->isMember('Writers-Club') ) {
                   } else {
                  header( 'Location: http://www.homepage.com' ) ; //send unwanted people home
                  }
                  /* another option to lock out unwanted pests - all non-members - spammer members still have access
                  //if ($modxId == 0)
                  //{header( 'Location: http://www.homepage.com' ) ;}
                  */
                   
                  /*CREATE PERSONAL FOLDER NAMES for Admin and mere plebeians.
                  ID of 1 is you, the ultimate Admin
                  If you have several admins and want them to share a folder, use something like the below lines
                  //if ($modxId == 1 || $modxId == 6 || $modxId == 13)
                  //{$personalFolder = "adminGuys";}
                  */
                  if ($modxId == 1)
                  {$personalFolder = "admin";}
                  else
                  {$personalFolder = $modx->user->get('username');} 
                  //all other non-admins get a folder with their name; if they have a strange username with spaces, let's clean it up a bit.
                  $personalFolder = strtolower($personalFolder);
                  $xters = array(" ", "_");
                  $personalFolder = str_replace($xters, "-", $personalFolder);
                  mb_internal_encoding('UTF-8');
                  date_default_timezone_set('America/Newyork'); //from the original filemanager file
                  /*CREATE ACTUAL FOLDERS AND SUB FOLDERS,  FIRST TIME USER VISITS.
                  CREATE NEW CONFIG.PHP FILE, WHICH THE USER CANNOT SEE OR DELETE
                  /media/username/mp3
                  /media/username/pictures*/
                  if (!file_exists('../media/' . $personalFolder)) {
                      mkdir('../media/' . $personalFolder, 0755, true);
                  }
                  if (!file_exists('../media/' . $personalFolder . '/mp3')) {
                      mkdir('../media/' . $personalFolder . '/mp3', 0755, true);
                  }
                  if (!file_exists('../media/' . $personalFolder . '/pictures')) {
                      mkdir('../media/' . $personalFolder . '/pictures', 0755, true);
                  }
                  /*THE CONFIG.TXT FILE YOU ALREADY UPLOADED IS THE TEMPLATE FOR THIS NEW CONFIG.PHP
                  /media/username/config.php
                  */
                  $userConfigTemplate = '../media/config.txt';
                  $newConfig = '../media/' . $personalFolder . '/config.php';
                  if ($modxId !== 1) //do not create a new config.php for the BOSS, he uses the filemanager/config/config.php file and has total access.
                  {
                  if (!file_exists('../media/' . $personalFolder . '/config.php')) {
                  copy($userConfigTemplate , $newConfig);
                  }
                  }
                  //FINISH MODx folders setup
                   
                  //original Lines 23-32 - PLEASE BE CAREFUL WITH RELATIVE PATHS - observe the $personalFolder part
                   
                  $base_url =
                   // Get HTTP/HTTPS
                   ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && !in_array(strtolower($_SERVER['HTTPS']),array('off','no'))) ? 'https' : 'http').
                   '://'.
                   // Get domain portion
                   $_SERVER['HTTP_HOST']; // DON'T TOUCH (base url (only domain) of site (without final /)).
                  $upload_dir = '/assets/media/' . $personalFolder . '/'; // path from base_url to base of upload folder (with start and final /)
                  $current_path = '../media/' . $personalFolder . '/'; // relative path from filemanager folder to upload folder (with final /)
                  //thumbs folder can't put inside upload folder
                  $thumbs_base_path = '../media/thumbs/'; // relative path from filemanager folder to thumbs folder (with final /)

                  assets/media/config.txt This will serve as template config for other non admin users( referenced from line 59 above)
                  <?php
                  /*config.txt is our template for user specific config.php
                  it will be copied to each user's folder automatically*/
                  $relative_image_creation = true; 
                  $file_number_limit_js=5;
                  $MaxSizeUpload=1000; 
                  $default_language="en_EN"; 
                  $icon_theme="ico"; 
                  $show_folder_size=false; 
                  $show_sorting_bar=false; 
                  $loading_bar=true; 
                  $transliteration=false; 
                  $image_max_width=970;
                  $image_max_height=500;
                  $image_resizing=false;
                  $image_resizing_width=0;
                  $image_resizing_height=0;
                  $default_view=2;
                  $ellipsis_title_after_first_row=false;
                  $create_folders=false;
                  $delete_files=true;
                  $delete_folders=false;
                  $upload_files=true;
                  $rename_files=true;
                  $rename_folders=false;
                  $duplicate_files=false;
                  $ext_img = array('jpg', 'jpeg', 'png', 'gif'); //Images
                  $ext_file = array('jpg', 'jpeg', 'png', 'gif'); //Files
                  $ext_video = array('jpg', 'jpeg', 'png', 'gif'); //Video 
                  $ext_music = array('jpg', 'jpeg', 'png', 'gif'); //Audio
                  $ext_misc = array('jpg', 'jpeg', 'png', 'gif'); //Archives
                  $folder_message= "Hello " . $myUsername . ", this is your folder (/media/" . $personalFolder . "). You may upload images. Right-click items for more info..."
                  ?>
                    TinymceWrapper: Complete back/frontend content solution.
                    Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                    5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                    • 3749
                    • 24,544 Posts
                    I've got it working well with images in NP, but with links it looks like you're screwed if you have FURL paths turned off unless your directory is right under the MODX root. I don't think that would be an issue in the Manager, though.
                      Did I help you? Buy me a beer
                      Get my Book: MODX:The Official Guide
                      MODX info for everyone: http://bobsguides.com/modx.html
                      My MODX Extras
                      Bob's Guides is now hosted at A2 MODX Hosting
                      • 40088
                      • 708 Posts
                      Quote from: BobRay at Feb 22, 2015, 01:58 AM
                      and this, in the TinyMCE init section of NP, will make it work right away (after you remove the code that loads the MODX TinyMCE):

                      selector: ".modx-richtext"


                      @BobRay Where does the above selector code go exactly?

                      Also, is this the code that gets removed?
                      [[+npx.insert]] [[+np.post_stuff]]
                        Todd