How do I limit upload files to 1 per node &
for a challenge - how do I save that one RTF file content in the node body field - HTML format ?
TNX

Comments

archatas’s picture

Not sure about the 1st question, but talking about the 2nd one, I would suggest you to install some rich text editor, such as TinyMCE or Htmlarea, and then copy-paste the contents of the RTF to the rich text fields.

Note that the style (font names, text colors, sizes, default alignment) of the text may change according to your current theme.

fatfish’s picture

any way - my user are afraid of the whole copy/paste thing. I like to enable a upload of Docs made in word (saved as RTF) and inside drupal open them, read the content and store it in $node->body.
Any idea

..:| Tomer Fish |:..
fatFish - Lean Mean Coding Machine

andyb’s picture

my user are afraid of the whole copy/paste thing

So they should be - the HTML that Word produces is atrocious!

Right now there isn't a mechanism for auto-converting Word (or any other document format) files after upload. I did find an old forum thread that also covered this. (link)

IIRC, tinyMCE has a "tidy up word HTML" button that you can press after pasting in text that has been copied from a Word document. It does a decent job but you still end up with a bunch of extra HTML that you need to manually edit out of the tidied HTML. You would hit exactly the same problems if a module that did perform the document conversion that you are asking about did exist.

Rhetorical question, but is this existing content that needs to be converted, or new content that the users would be creating?

If it is new content then you might as well go down the tinyMCE route as it is a less complex work flow. (This way you click on create content->select content type->Enter text into the textarea->publish. With the file upload way you click on create content->select content type->upload file->preview page->edit the page to update the inevitable formatting problems that would result as part of the conversion from Word to HTML->repeat until happy.)

Honestly - if your users can use Word then they can also use tinyMCE. If they are using Firefox then maybe Xinha Here! would be another option?

If you hit any "Why can't I use Word to write this?" resistance, then tell them that they can use word for writing letters, and a web browser for writing on the web. ;-)

Adding some icing to the tinyMCE option, with Firefox (but pre-1.5 only right now) install the Scribe extension. Use this with tinyMCE so that the contents of the tinyMCE form can be saved using Scribe. (I haven't tested this with tinyMCE specifically, but it has worked for me with other forms in the past).

Just my 0.02

fatfish’s picture

Tnx for a well detailed answer.
Eventually I'm going to use external RTF converter (this or that) since Uploading content that was written in word is a must in this project (with much respect to open source.
But hey, don't get too disappointed, there was much easier question - adding a limit to the document a user can upload - that is one. If the user tries to upload another one, the new one is replacing the old one.

Tnx again

..:| Tomer Fish |:..
fatFish - Lean Mean Coding Machine

toemaz’s picture

As you didn't get an answer yet on your first question, I was wondering how badly you want this. I guess it requires to write a module implementing the nodeapi hook or modifying the upload module.

As a matter of fact, if you see the solution more like a restriction rule for your node type, then it might be usefull to combine your request with this request here.

archatas’s picture

I decided one viable solution: install Flexinode module, create a content type with two fields - textarea and file upload, - and then disable file uploads through core upload module for that content type.

Good luck!