Jump to content

Multiple CKEditor configurations


acsineaston

Recommended Posts

I would like to be able to allow superusers access to the full capabilities of CKEditor (the default as shipped with CubeCart), but only allow non-superuser administrators to use a very small subset of those capabilities (e.g., preset Basic).

Has anyone attempted this?

Link to comment
Share on other sites

In acp.class.php  -  function SetTemplate  I added:

            if(Admin::getInstance()->superUser()) {
                $GLOBALS['smarty']->assign('ADMIN_IS_SUPER', 'true');
            }

to give me an easy way to test in template products.index.php

My thought is to use the /includes/ckeditor directory to provide the CKEditor for a superuser, and another directory (/includes/ckeditor-basic) to provide the CKEditor for non-superusers. Not sure if this makes sense, or how I would go about changing the path to the correct directory.

Link to comment
Share on other sites

Turns out I don't have to deal with template products.index.php at all, but rather template main.php

Changed:

      <!-- Include CKEditor -->
      <script type="text/javascript" src="includes/ckeditor/ckeditor.js"></script>
      <script type="text/javascript" src="includes/ckeditor/adapters/jquery.js"></script>

To:

      <!-- Include CKEditor -->
      {if isset($ADMIN_IS_SUPER)}
      <script type="text/javascript" src="includes/ckeditor/ckeditor.js"></script>
      {else}
      <script type="text/javascript" src="includes/ckeditor-basic/ckeditor.js"></script>
      {/if}
      <script type="text/javascript" src="includes/ckeditor/adapters/jquery.js"></script>


Works like a champ!!! :D

Link to comment
Share on other sites

Sorry for dropping the ball on this.

In CC6010 and earlier, CKEditor 3 is used. In CC6011, CKEditor 4 is used. From what I've seen so far, these two major versions have different approaches to declaring the toolbar set available. (But I'll have to dig deeper.)

CC6010 establishes the toolbar configuration in /includes/ckeditor/config.js (CKEditor calls for this itself).

CC6011 (I haven't found it) does not declare a toolbar set. I believe a "FULL" CKEditor 4 package is being used by CC6011. But adding a custom config should still be possible.

Installing distinct variants of CKEditor works but may have unforeseen consequences.

Just personally, I would choose custom toolbar sets. It gives me more granularity on a per-admin basis.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...