Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1] 2   Go Down
Print
Author Topic: Import and chopped up HTML  (Read 2555 times)
0 Members and 1 Guest are viewing this topic.
TechnoShroom
New Member
*

Karma: 0
Offline Offline

Posts: 14


WWW
« on: August 19, 2008, 12:03:28 PM »

Having a problem with import when the field contains HTML.

One of my fields is a map field and contains data like this. . .

<a href="hxxp: maps. google. com/maps?q=2450+Cabrillo+Ave. ,+Santa+Clara,+CA&iwloc=A&hl=en" target="_blank"><img src="/images/map. gif" border="0"></a>

Once imported the result is this. . .

"<a href="" http:="" maps. google. com="" maps?q="2450+Cabrillo+Ave. ,+Santa+Clara,+CA&amp;iwloc=A&amp;hl=en&quot;&quot;" target="" _blank=""><img src="" images="" map. gif="" 0="" border=""></a>"

In the past I've always added via Add Event or Add One-Click Event without problems.  Seems to just be a problem with import.  I'm importing via a | delimited file.
Logged
DanO
Full Member
***

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: August 19, 2008, 04:56:29 PM »

.
It also looks to be doing something with quote (") and ampersand (&) characters. I don't know when/if *I* will have a chance to look into it. Maybe if someone else has had the same problem they will post how they got around it?

Dan O.
Logged
musicvid
New Member
*

Karma: 1
Offline Offline

Posts: 8


WWW
« Reply #2 on: August 19, 2008, 09:33:51 PM »

No such problem here.  Regularly import events with lots of html and links, and get no double quotes or odd stuff.  You may want to look at your source text -- sometimes stuff created with WYSIWYG editors causes weird output.
Logged
TechnoShroom
New Member
*

Karma: 0
Offline Offline

Posts: 14


WWW
« Reply #3 on: August 24, 2008, 03:09:57 PM »

It appears to be something related to how Excel creates CSV files.    Quotes are escaped with quotes and text fields are surrounded in quotes. 

EDIT: Even in tab delimited files Excel is escaping quotes in URLs.   I did have luck with opening the xls file in Google Docs, Exporting as txt, then editing the tabs to |, and then importing but that's a lot more work than should be necessary.

One other issue.  When an event has a single date, after import the date is in the Date Range field instead of the Individual Date(s) field.  So if an event had a date of 20080910 it would be in the Date Range field as 09/10/2008 through 09/10/2008.  Is there a way to have import always treat the date as individual dates?
« Last Edit: August 24, 2008, 04:31:37 PM by TechnoShroom » Logged
TechnoShroom
New Member
*

Karma: 0
Offline Offline

Posts: 14


WWW
« Reply #4 on: August 24, 2008, 07:15:15 PM »

I'm now using this Excel macro I found which pumps out the text without problem.  I forgot where I found it but here it is in case anyone is interested.

    Public Sub TextNoModification()
        Const DELIMITER As String = "|" 'or ",", vbTab, etc. 
        Dim myRecord As Range
        Dim myField As Range
        Dim nFileNum As Long
        Dim sOut As String
       
        nFileNum = FreeFile
        Open "Test. txt" For Output As #nFileNum
        For Each myRecord In Range("A1:A" & _
                Range("A" & Rows. Count). End(xlUp). Row)
            With myRecord
                For Each myField In Range(. Cells(1), _
                        Cells(. Row, Columns. Count). End(xlToLeft))
                    sOut = sOut & DELIMITER & myField. Text
                Next myField
                Print #nFileNum, Mid(sOut, 2)
                sOut = Empty
            End With
        Next myRecord
        Close #nFileNum
    End Sub
Logged
DanO
Full Member
***

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #5 on: August 25, 2008, 04:02:11 PM »

.
** if an event had a date of 20080910 it would be in the Date Range field [of the Edit Schedule screen] as 09/10/2008 through 09/10/2008. **

How does that event's schedule look in the actual schedule.txt file compared to non-imported events?

** Is there a way to have import always treat the date as individual dates? **

That's the way it's suppose to work. I don't recall ever seeing what you describe (although I don't know if I ever specifically looked). Maybe someone that uses the import feature a lot will tell us their experience using it?

JMO

Dan O.

Logged
TechnoShroom
New Member
*

Karma: 0
Offline Offline

Posts: 14


WWW
« Reply #6 on: August 25, 2008, 04:16:02 PM »

Quote from: DanO link=topic=1860. msg8042#msg8042 date=1219698131
How does that event's schedule look in the actual schedule. txt file compared to non-imported events?

It looks the same it's just strange seeing it in the range field instead of the individual dates field like all non-imported events.  I haven't found any difference in functionality with it showing in the range field.  Searches, etc.  appear to show normally.

Quote from: DanO link=topic=1860. msg8042#msg8042 date=1219698131
That's the way it's suppose to work.  I don't recall ever seeing what you describe (although I don't know if I ever specifically looked).  Maybe someone that uses the import feature a lot will tell us their experience using it?

Well, it doesn't appear to be hurting anything at the moment.  As long as it remains benign I'm going to ignore it.


Logged
TechnoShroom
New Member
*

Karma: 0
Offline Offline

Posts: 14


WWW
« Reply #7 on: August 25, 2008, 04:57:01 PM »

Actually, I was wrong.  The events are different in schedule. txt.  I was looking at some events I "corrected" when I thought import was screwing up.

Here's an event entered via Add One-Click Event.
34570 5688 1225468800 1225468800 10 31 1600 1800


Here's an event entered via Import.
36500 5864 1225015200 1225029600 10 26 1000 1400

So Add One-Click uses the UNIX start time for both and Import uses the UNIX start time for start and the UNIX end time for end.
Logged
DanO
Full Member
***

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #8 on: August 27, 2008, 03:07:56 AM »

** One-Click uses the UNIX start time for both and Import uses the UNIX start time for start and the UNIX end time for end. **

You can try editing the calendar_admin.pl file and adding:

$schedule->{'static_dates_range'} = "dates";

right after the line:

$schedule->{'type'} = "static";

to see if it changes the handling of those event schedules.

*This code is untested so use at your own risk. Shocked

Dan O.
Logged
TechnoShroom
New Member
*

Karma: 0
Offline Offline

Posts: 14


WWW
« Reply #9 on: August 27, 2008, 03:58:08 AM »

I gave it a try.  It causes imported events not to be scheduled at all.  One-Click events continue to work.  Below is the else statement that was changed.  Did I correctly edit it?

else {
   # One-time event
   $schedule->{'type'} = "static";
   $schedule->{'static_dates_range'} = "dates";
   }
Logged
DanO
Full Member
***

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #10 on: August 27, 2008, 01:00:33 PM »

** Did I correctly edit it? **

Yes. That is what I thought might help but I guess not. Unless someone else knows of a fix you'll just have to put up with it for the time being.

Dan O.
Logged
TechnoShroom
New Member
*

Karma: 0
Offline Offline

Posts: 14


WWW
« Reply #11 on: August 27, 2008, 02:38:10 PM »

Ok, will do.  The current behavior doesn't appear to be causing any problems so I have no problem leaving it alone.

Thanks for taking a look!
Logged
TechnoShroom
New Member
*

Karma: 0
Offline Offline

Posts: 14


WWW
« Reply #12 on: September 08, 2008, 07:34:26 PM »

I just noticed another issue with import. With multi-day events it assigns the first end timestamp to all subsequent days. This makes the end before the start and causes the event to not display in the calendar after the first occurrence. Any thoughts?
Logged
DanO
Full Member
***

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #13 on: September 09, 2008, 12:28:52 PM »

With multi-day events it assigns the first end timestamp to all subsequent days.

Can you provide a sample of the data you're importing and also the header row you're using for it?

Dan O.
Logged
TechnoShroom
New Member
*

Karma: 0
Offline Offline

Posts: 14


WWW
« Reply #14 on: September 09, 2008, 12:44:40 PM »

INPUT|EVENT TITLE|TYPE|REGION|DESCRIPTION|WHERE|DATES|START TIME|END TIME|WHEN|ADMISSION|INFORMATION|MAP|REVIEW LINK|END

y|Test-multi Import|Other|East Bay|test|test|20081211,20081212|18:00|19:30|test|Free|test|||.

This was the last test I did. It's similar to other events. Happens on two days, the same time each day. Input isn't used for calendar, just for the spreadsheet. End also isn't used but was added because Excel doesn't like empty cells at the end in delimited files and collapses them so I just add a non-empty cell to preserve any empty cells that may exist.
Logged
Pages: [1] 2   Go Up
Print
Jump to: