Gossamer Forum
Home : Products : DBMan SQL : Discussion :

dbman -> dbman sql (paragraph indenting)

Quote Reply
dbman -> dbman sql (paragraph indenting)
Hi! Cool

I imported my flatfile dbman database to dbman sql, and everything looks fine except for the paragraphs. The paragraph indentations did not come up. For example,






``the same manufacturing lots.````If you have any questions regarding the analysis performed on these units,``or need any additional information please feel free to contact me.````Best regards,``






should be:






the same manufacturing lots.

If you have any questions regarding the analysis performed on these units,
or need any additional information please feel free to contact me.

Best regards,








Any idea how I might fix this problem? Blush

Thanks,

Reena

Last edited by:

Reena0330: Jun 10, 2002, 1:14 PM
Quote Reply
Re: [Reena0330] dbman -> dbman sql (paragraph indenting) In reply to
I have encountered probably the same kind of problem, which I have told GT about. If I take a standard Word document and transfer it into a TEXT field, I loose all the formatting. Such as linefeeds or paragraph breaks and where the only solution I have found - for the moment - is to manually insert HTML codes such as <P> etc. I know from experience with another (Content Management System) programme also based on SQL that a choice (straight text which is formatted correctly by the program, or HTML file) correctly displays the content in all cases. Unless I am mistaken, this must be a priority improvement to DBMan SQL for all those who deal with a lot of lengthly textual data. But then something may have escaped me in this fine program, where unfortunately so little is explained !
Quote Reply
Re: [charly] dbman -> dbman sql (paragraph indenting) In reply to
Hi Charly,

Isn't there anyway to edit the dbman code so that the paragraph spacings are entered into the text by the database. For example, I use the following line of code to keep text formatting:

Code:
# Keeps line spacing in text field.
$rec{'Case History'} =~ s/\n/<BR>/g;
$rec{'Modification History'} =~ s/\n/<BR>/g;


Can I edit this in anyway to make it so that the db puts in <p> or <br> into the .db file instead of ````?

Perhaps I should try changing the code to:

Code:
$rec{'Case History'} =<p> s/\n/<BR>/g;


Reena
Reena
Quote Reply
Re: [Reena0330] dbman -> dbman sql (paragraph indenting) In reply to
Reena,
I found the answer to my problems - and perhaps yours - in the plugin/globals section of the Links SQL forum (search for 'BR tags in admin submissions')

My original TEXT field is called 'Content'.
I created a global called 'Content_Formatted'

sub {
my $tags = shift;
my $content = $tags->{Content};
$content = GT::CGI::html_escape ($content);
$content =~ s/\n/<BR>\n/g;
return $content;
}

Then I included a field/column which I called TextFormat (ENUM, values: PlainText, HTML) with radio buttons. So when I add each record I select what kind of text I'm including.[:)]

Last step, in my template, I have simply:

<%if TextFormat eq 'PlainText'%>
<%Content_Formatted%>
<%else%>
<%Content%>
<%endif%>

This works fine - all thanks to the fora contributions, notably Alex!
BTW: it's worth browsing through the Links SQL fora, because there seems to be a lot of things useful to DBMan SQL users. - much more than in the DBMan SQL fora [:/]
Cheers
Charly
Quote Reply
Re: [charly] dbman -> dbman sql (paragraph indenting) In reply to
Reena - further examination leaves me disappointed. The global works if you modify plaintext in your field - but the global does NOT automatically concert line feeds to <CR> - at least not on the attempts I've made. I am wits end. I see the hex 0B signs there and I'd like to convert them but HOW !!!
Quote Reply
Re: [charly] dbman -> dbman sql (paragraph indenting) In reply to
Hey Charly,

Does your paragraph indenting work when you add new records? If yes, what code did you add to get it working?

I add the following code to my globals..but it doesn't seem to be doing anything

Code:
sub {
my $tags = shift;
my $casehistory = $tags->{casehistory};
$casehistory = GT::CGI::html_escape($casehistory);
$casehistory =~ s/\n/<BR>\n/g;
return $casehistory;
}


Reena
Reena
Quote Reply
Re: [charly] dbman -> dbman sql (paragraph indenting) In reply to
Hi Charly,

I e-mailed gossamer-threads with my problem and here's what Alex responded with:

Quote:


> When I add a new file line feeds and returns
> do not show up. Can you please let me know what I need to do to fix this?

By default, DBMan shows exactly what was entered. So it's displaying the
line feeds as line feeds. HTML however ignores line feeds, and in order
for your browser to display the line feeds you need to replace it with
an HTML <BR> tag.

To do this for all your tags, you could add a global called
'convert_linefeeds' (without quotes) that has:

sub {
my $tags = shift;
foreach my $tag (%$tags) {
$tags->{$tag} =~ s/\r\n/<BR>\n/g;
}
}

and then add:

<%convert_linefeeds%>

at the top of your template. This will alter all your tags so that
linefeeds get <BR> tags inserted.

> AIso, I imported my flatfile dbman database to dbman sql, and everything
> looks fine except for the paragraphs. The paragraph indentations do not
> come up. For example,
>
> ----------------------------------------------
> ``the same manufacturing lots.````If you have any questions regarding the
> analysis performed on these units,``or need any additional information
> please feel free to contact me.````Best regards,``
> ----------------------------------------------
>
> should be:
> ----------------------------------------------
>
> the same manufacturing lots.
>
> If you have any questions regarding the analysis performed on these units,
> or need any additional information please feel free to contact me.

Hmm, the import should have handled this. The `` are from the flatfile
version. A quick fix would be to go to SQL Monitor and type:

UPDATE table SET col = REPLACE(col, "``", "\n");

where table is the name of the SQL table and col is the column name that
has the `` chars in it.

Let me know if you have any other problems.

Cheers,

Alex
Hopefully this will help you out.Crazy hehe
Reena
Quote Reply
Re: [Reena0330] dbman -> dbman sql (paragraph indenting) In reply to
Hi Reena - and I hope Alex sees this too!

If I do a cut and paste online there is no problem, my text gets formatted properly. But with imports that's not the case.

Alex says:
---
Hmm, the import should have handled this. The `` are from the flatfile
version. A quick fix would be to go to SQL Monitor and type:

UPDATE table SET col = REPLACE(col, "``", "\n");

where table is the name of the SQL table and col is the column name that
has the `` chars in it.
---
I confirm that the import does not handle this. Testing Alex's 'Quickfix', there is no change and the linefeeds are still not converted. To be precise, in my imported file what you Reena see as apostrophes, in mine is present as hex 0B data and this is not converted into <CR>.

I hope that GT can make progress on this issue which has been dogging me for over a month!!
Hopeful
Charly
Quote Reply
Re: [Reena0330] dbman -> dbman sql (paragraph indenting) In reply to
Just tried this global, but all I get is Unknown Tag: 'convert_linefeeds'

In Reply To:
... then add:

<%convert_linefeeds%>

at the top of your template. This will alter all your tags so that
linefeeds get <BR> tags inserted.

Is that really correct ... just insert <%convert_linefeeds%> at the top of the template?