
lists at gmnet
Aug 7, 2009, 4:32 PM
Post #10 of 10
(1349 views)
Permalink
|
|
Re: Character encodings and FCK editor [SOLVED?]
[In reply to]
|
|
On Fri, 2009-08-07 at 23:27 +0000, Rick Bragg wrote: > On Thu, 2009-08-06 at 15:36 +0000, Rick Bragg wrote: > > On Thu, 2009-08-06 at 09:22 +0300, Gert van der Spoel wrote: > > > > -----Original Message----- > > > > From: interchange-users-bounces [at] icdevgroup [mailto:interchange- > > > > users-bounces [at] icdevgroup] On Behalf Of Rick Bragg > > > > Sent: Thursday, August 06, 2009 1:48 AM > > > > To: interchange-users [at] icdevgroup > > > > Subject: Re: [ic] Character encodings and FCK editor > > > > > > > > On Wed, 2009-08-05 at 20:53 +0300, Gert van der Spoel wrote: > > > > > > -----Original Message----- > > > > > > From: interchange-users-bounces [at] icdevgroup [mailto:interchange- > > > > > > users-bounces [at] icdevgroup] On Behalf Of Rick Bragg > > > > > > Sent: Wednesday, August 05, 2009 8:49 PM > > > > > > To: interchange-users [at] icdevgroup > > > > > > Subject: [ic] Character encodings and FCK editor > > > > > > > > > > > > Hi List; > > > > > > > > > > > > I am having lots of trouble with this and I hope someone can please > > > > > > help > > > > > > me through this, point me in the write direction, or talk me down > > > > from > > > > > > the leadge! > > > > > > > > > > > > I am wondering if there is a "best practice" or examples for using > > > > the > > > > > > FCK editor for editing and saving content but not in the admin > > > > area. I > > > > > > have a field in a database called "content" and I want it to be > > > > > > editable > > > > > > by affiliates via the FCK editor. Again, this is NOT in the admin > > > > > > area, > > > > > > but in the catalog itself. The problem I am having is that when > > > > they > > > > > > paste certain things from a pdf or word file (they have to be able > > > > to > > > > > > do > > > > > > this!) things look fine in the editor, but when they save it, > > > > things > > > > > > sometimes get encoded in strange ways. I have FCK configured to > > > > paste > > > > > > as plain text only! (no strait paste, or paste from word is > > > > enabled). > > > > > > I > > > > > > have been writing strange filters to try to catch them, but this > > > > seems > > > > > > the totally wrong way to go. Does anybody have a sample of a form > > > > that > > > > > > calls up data, sticks it into FCK, then when submitted, saves back > > > > to > > > > > > the table in such a way that strange characters don't get > > > > introduced? > > > > > > It does not seem to be a browser issue at all. > > > > > > > > > > Interchange version? > > > > > > > > > > > > > > > > Thanks! > > > > > > Rick > > > > > > > > > > > > > > > > > > > > Oh sorry, I am using IC version 5.6.1 and FCK Version 2.6.3 > > > > > > Ok .. > > > > > > Additional Q's: > > > Q1: does it work correct via the admin UI, or you do not have the ability to > > > test this? > > Seems to work fine in the admin UI. it changes the tm into ™ > > > > > Q2: would you have the option to install the nightly build? > > Yes do have this option > > > > > Q3: your database has a certain encoding? > > Database Server info: > > # Server version: 5.0.51a-3ubuntu5.4-log > > # Protocol version: 10 > > # Server: Localhost via UNIX socket > > # User: root [at] localhos > > # MySQL charset: UTF-8 Unicode (utf8) > > # MySQL connection collation: utf8_unicode_ci > > > > Table specific info: > > # collation: latin1_swedish_ci <---Maybe this is part of my problem?? > > > > > Q4: is it possible to paste the snippet of code/page that makes use of the > > > FCKeditor, > > > If so paste it at http://paste.me.uk/ > > > This could help in making sure we're on the same base to test this > > > issue. > > > > > > > I realize that there is allot that I am doing wrong here, and > > I am currently in the middle of changing things around. but here goes > > anyway... > > http://www.paste.me.uk/1335.html > > > > Thanks > > rick > > > > > > OK, I think I have this, and seems acceptable right now. I was making it > way to complex. Word to the wise: simplify! > > The goal here is to deal with filtering of input values while using an > FCK editor to allow web users to edit content on an IC website. What is > not covered here is how to deal with authentication or any other user > issue. Issues of authentication, uploading content, etc, are not > addressed here. What is assumed is that you have a fly page for a table > displaying some content, and you want an "edit" form that brings you to > a page that loads the content into an FCK editor with a form to save it. > > So far it seems to work nice as a way to build quick and easy FCK editor > for web contributors. > > First, when displaying content (In my case, using a fly page, showing a > field called "content" in a table called "groups") simply use something > like the following: (adjust for your restrict_html filter) > > [item-filter restrict_html.a.address.b.blockquote.br.h1.h2.h3.h4][item-data groups content][/item-filter] > > You can have an edit form and button/link right there, but you don't > need to pass the content field. just the code or id of the record you > want to edit. > > > > Once submitted, now you are in the "edit" page where you show the FCK > editor. (here you can do a "light" authentication to make sure this user > may have the rights to edit...) Grab the "content" field fresh like > this: (this assumes you have a record you are updating, and are passing > the id of that record in a value called "group_code". Also assumes you > have a config set for FCK called "content") > > [.query > type=list > label=content_edit > prefix=content_edit > list_prefix=content_edit_list > sql=| > SELECT code, content > FROM groups > WHERE code = "[value group_code]" > LIMIT 0,1 > |] > [content_edit_list] > [.display type="htmlarea" > name="content" > height="750" > htmlarea_config="content" > value="[content_edit-data groups content]" > ] > [/content_edit_list] > [/query] > > > > > Once you submit a form with that, there are two options. One is to > update an existing record, the other is to create a new row. > > (1) update a current row: > > [tag flag write]groups[/tag] > [.query list=1 > row-count=1 > table=groups > st=sql > sql=|UPDATE groups > SET content = [cgi name="content" > enable_html="1" > filter="restrict_html.a.address.b.blockquote.br.h1.h2.h3.h4 > dbi_quote" > ] > WHERE code = '[value group_code]' > |] > [/query] > > > > (2) create a new row: > > For this, I am setting a quick [tmp content] variable for the "content" > value that was passed in from FCK so I can easily filter it: > > [tmp content][cgi name="content" > enable_html="1" > filter="restrict_html.a.address.b.blockquote.br.h1.h2.h3.h4" > ][/tmp] > > [perl tables=groups] > my $db = $Db{groups}; > my %record; > $record{code} = ""; > $record{content} = $Scratch->{content}; > $Scratch->{key} = $db->set_slice(undef, \%record); > return; > [/perl] > > > > > Feedback? > > Thanks, and HTH someone. > Rick > Oh yea, I forgot to mention, on that final submit to "save" the data, do a "heavy" authentication check somehow to make sure the user really has the permissions to do this... (that is another discussion altogether) Rick -- This message has been scanned for viruses and dangerous content by Green Mountain Network, and is believed to be clean. _______________________________________________ interchange-users mailing list interchange-users [at] icdevgroup http://www.icdevgroup.org/mailman/listinfo/interchange-users
|