Hi!

Is it possible to have multiple fck-profiles and assign them to certain content-types only?

What I do right now is:
- 2 profiles: enhanced-profile for "page" and basic-profile for "forum".
- visibility is set to "include" and paths are set to node/add/page and node/add/forum.

That works fine until I want to edit content:
The path is always node/*/edit. For "page" and "forum". So I can only have one editor-profile for this. :(
There is no php-evaluation which could solve this. Is there another way to get around this?

Thx for help!

Comments

maulwuff’s picture

Ok, seems as if this scenario is completely undoable with fck.
I deleted the second profile and wanted to re-create it. Then it said, I can only assign one fck-profile per role. :(

wwalc’s picture

Category: support » feature

At this moment, you can force simplified toolbar on some fields.
So it is somehow possible to use two different toolbars in one profile... but that's all.

Anyway, I've never thought about assigning multiple profiles to a single role depending on content type. Sounds interesting, feel free to propose a patch.

maulwuff’s picture

hehe, if I had a clue where to start, I might have already put something in :)

I did not have a look at the code, so my stupid proposal would sound like this:

- assuming, there are settings per node type
- on call of hook_form
--- check node type
--- return the appropriate profile

Do you think this is a passable way?

If it is, there need to be settings to assign a nodetype to a editor-profile.

In my eyes, assigning editor-profiles to roles is nonsense, because:
Assume you are a apprentice. Your task is to create the SAME workpiece as your instructor. The difference is, you have a handsaw, your instructor has a jigsaw. You will start scrubbing around with your handsaw, getting frustrated very quickly. Your instructor finishes in a fraction of time. Why all that? Life could be so easy ;)
That's the view I could compare me to my users. We all want to have a jigsaw for the same workpiece! On a different workpiece we want another tool, though.

wwalc’s picture

That may be the way to go but... how could you check what is the current content type in fckeditor_process_textarea() in Drupal 5/6?
In Drupal7, there will probably be #input_format available in Form API (http://drupal.org/node/125315) to help wysiwyg editors to use the correct buttons... or even to choose the correct wysiwyg editor, I think I have no idea how this can be achieved in Drupal 5/6.

maulwuff’s picture

Good question. Is there any chance to get the node or the form at this point?

what about getting this info from the url?

while creating a node, the type is in the url: arg(3);
node/add/contenttype

on formedit we could use arg(1) to get the nid.
node/XX/edit

dwarner’s picture

maulwuff's comment in comment#6 seems to be the way to go right now; these URLs are fairly fixed in Drupal 5, I believe. Let me know if there's anything I can do to help work on this.

wwalc’s picture

Unfortunately I may have no time this week to take care of this due to urgent server migration, but I like your ideas. Can you try to code it?
I can help if you have any specific questions.

dwarner’s picture

Sure; I'll try to get a patch to everyone shortly.

I've started working on the admin interface to select content types and have added a new table for storing the selections (and added an update script).

Do people feel this should just be an additional requirement to the user roles? IE, an fckeditor instance will show up only if the user role AND the content type is chosen? If this is the case, it might mean that user roles won't be unique across fckeditor profiles.

maulwuff’s picture

"user role AND the content type"

please not!!

dwarner’s picture

How do you think the options should be setup so you can choose between roles and node types? Another radio box to choose between:
1) roles AND node types
2) roles OR node types

Either way, I still think the roles need to be allowed to be used across multiple fckeditor profiles; thoughts on that?

maulwuff’s picture

My proposal is:
Choose either roles or content types.
Using roles + content types may be interesting too, though.

Maybe an opt-in? That is, checkboxes for roles and content types:
with both checked = roles + content types
with only roles checked = roles
with only content types checked = content types

do you think this is possible?

dwarner’s picture

Maybe an opt-in? That is, checkboxes for roles and content types:
with both checked = roles + content types
with only roles checked = roles
with only content types checked = content types

This is actually what I had in mind but did a poor job explaining; I'll keep working towards this.

dwarner’s picture

StatusFileSize
new8.79 KB

Here's my first stab at enabling per-node-type configuration; it should work like maulwuff said in #12.

wwalc’s picture

Status: Active » Needs work

That looks promissing! It doesn't work yet, for example it is impossible to select a role in "Roles allowed to use this profile" that is already used, but it definitely sounds like a way to go. It would be awesome if you could provide fully working patch.

radsail’s picture

I'am searching for this option too. I think it's a very usable feature. Especcially for comments and forums vs 'create content'. When I was searching for this feature I saw this search-result:

FCKeditor Plus
... of FCKeditor to meet Drupal website to provide different toolbar for regular content type, forum and comment. So, a "page" can ...

I'am not authorized to access that page (Don't know why, just a newbie on drupal) Maybe it's useful.

wwalc’s picture

wwalc’s picture

Jorrit’s picture

Status: Needs work » Fixed

Fixed in CVS (tag DRUPAL-6--2)

dwarner’s picture

That's great to hear; sorry I hadn't been able to finish up my patch to make it function a little better.

Any chance of this being backported to the 5.x release? Would I be able to help with that at all?

avpaderno’s picture

You can find what the content type can be with two methods:

  • If the user is modifying a node, the node instance is available from the form (if I remember right that is in $form['#node']);
  • if the user is creating a new node, then you can check the menu path (it can be, i.e. node/page/add).

From the node object you can know its type by calling node_type(), and passing the node reference to the function.

I hope this can help.

Jorrit’s picture

I got it from menu_get_item() in my patch actually, but it can be enhanced using your suggestions. An important note: currently this feature will only be made available for Drupal 6.

avpaderno’s picture

Using menu_get_item() can be useful, without to pass any arguments, when the menu path is something like node/<nid>; it could not be of any help if the path is node/page/add, i.e.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

TimG1’s picture

Hi I had the same problem. I read the thread above, but I still don't understand how to set this up. Sorry, I'm still pretty new to Drupal.

How do I set this up from the web admin? I tried just going into Site Configuration > FCKEditor > Visibility Settings > Paths to Include/Exclude: and then typed this in the box.... manuals/*. But, when I go to my page and then click the Edit tab, my URL changes to node/###/edit and I still see the FCKEditor.

I'm using Drupal 6 & FCKeditor 6.x-1.3-rc1

Thanks!
-Tim

mvc’s picture

StatusFileSize
new5.25 KB

The patch in #14 worked for me for 5.x-2.2-rc3, except that

if ('add' == arg(1)) {
  $page_node_type = arg(2);
} // end if add

should be

if ('add' == arg(1)) {
  $page_node_type = strtr(arg(2), '-', '_');
} // end if add

or else the editor won't launch when creating new nodes which have _ in their machine names. I'm attaching a new patch for anyone else still using the 5.x-2.2 branch which works for me (reviews welcome).

mvc’s picture

Version: 5.x-2.1 » 5.x-2.2-rc3
Status: Closed (fixed) » Needs review

Updating version number and status, since patch is ready for review for inclusion in the 5.x-2.2 branch.

jaydub’s picture

Version: 5.x-2.2-rc3 » 5.x-2.x-dev
StatusFileSize
new8.35 KB

I've re-rolled the patches from #14 and #26 (which didn't have the changes to fckeditor.install) against the latest 5.x-2.x code in CVS.

I reworked the query in fckeditor_user_get_profile() a bit in to make it cleaner and used a d6 db_placeholders() like hack to properly set the placeholders for the portion of the query doing an IN clause where the IN values are role IDs and thus integers.

Jorrit’s picture

Status: Needs review » Closed (won't fix)

This has been implemented in 6.x-2.x, will not be done in 5.x.

dagomar’s picture

Perhaps related issue, I may create a new issue for this:

I have a basic fckeditor profile for all roles.
I have an advanced profile for site maintainer role.

On one content type, I want the maintainer role to use the basic fckeditor profile. So I tuned off the visibility for the path (i'm using pathauto). But now the maintainers do not have an editor, and everybody else does for that node type. I would expect it would fall back on the basic profile, but it doesnt.

-- Edit --

Ok, So I figured this out for my use case, simply forsing the basic config for the specific fields is what i was after.