Assign editor-profiles to content types

maulwuff - June 8, 2008 - 07:59
Project:FCKeditor - WYSIWYG HTML editor
Version:5.x-2.1
Component:User interface
Category:feature request
Priority:normal
Assigned:Unassigned
Status:fixed
Description

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!

#1

maulwuff - June 8, 2008 - 08:22

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. :(

#2

wwalc - June 19, 2008 - 11:26
Category:support request» feature request

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.

#3

maulwuff - June 19, 2008 - 12:13

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.

#4

wwalc - June 19, 2008 - 14:07

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.

#6

maulwuff - June 23, 2008 - 11:09

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

#7

silfreed - June 23, 2008 - 13:43

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.

#8

wwalc - June 25, 2008 - 07:56

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.

#9

silfreed - June 25, 2008 - 15:31

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.

#10

maulwuff - June 25, 2008 - 16:08

"user role AND the content type"

please not!!

#11

silfreed - June 25, 2008 - 18:04

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?

#12

maulwuff - June 25, 2008 - 20:01

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?

#13

silfreed - June 27, 2008 - 16:04

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.

#14

silfreed - June 27, 2008 - 19:35

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

AttachmentSize
fckeditor-5.x-2.1-node-type.patch8.79 KB

#15

wwalc - June 30, 2008 - 18:57
Status:active» patch (code 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.

#16

radsail - July 16, 2008 - 13:11

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.

#17

wwalc - July 25, 2008 - 10:26

#18

wwalc - July 31, 2008 - 13:04

#19

Jorrit - August 26, 2008 - 15:23
Status:patch (code needs work)» fixed

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

#20

silfreed - August 26, 2008 - 15:53

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?

#21

Kiam@avpnet.org - August 26, 2008 - 16:21

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.

#22

Jorrit - August 26, 2008 - 16:04

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.

#23

Kiam@avpnet.org - August 26, 2008 - 16:25

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.

 
 

Drupal is a registered trademark of Dries Buytaert.