Mapping CSV Import column to Item Type

I've been successful using the CSV Import system to transfer data mapped to Dublin Core elements, and using the plugin, to PBCore elements, but although I selected an Item Type element to map to an import column, nothing shows up.

Any ideas?

Thanks,

Steve

I ran some import tests since last posting. I was able to map from a CSV file column to the new element I created for Moving Image.

Moving Image Item Type Metadata

Embedded Video (element): Color (value)

Embedded Video is the new element I added to the Moving Image type. It accepts data from the Color column and maps it to the Embedded Video element. However, when I try to map a column containing HTML, it does not migrate.

Just wanted to add more detail.

So you're saying that a column with HTML, when mapped to an Item Type element, doesn't import, but that the same column imports correctly if mapped to a Dublin Core or other Set element?

I've traced it to the presence of double quotes in the embed HTML code. I can use another enclosed by delimiter or convert the double quotes to single quotes before exporting from the database.

Yes. I mapped our Short Description column to the PBCore Description element. I marked that as HTML and it comes through fine. I mapped our Long Description column to the DC Description element. That is also marked as HTML and comes through. When I look at the edit mode for the item, I get HTML editors for those element inputs.

I was having trouble when mapping an HTML column to an Item Type element, which I added to Moving Image. Its a custom element.

I'm going to try one more thing and post back.

This is what I get when I DO NOT check HTML during the import.

Dublin Core

Title
Les Blues de Balfa

Moving Image Item Type Metadata

Original Format
16mm

Duration
00:26:45

Embedded Video
<iframe src='http://player.vimeo.com/video/32529438?title=0&byline=0&portrait=0&color=cccccc' width='440' height='330' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>

This is what I get when HTML is checked

Dublin Core

Title
Les Blues de Balfa

Moving Image Item Type Metadata

Original Format
16mm

Duration
00:26:45

This is examining the one entry that I replaced double quote with single quote in the Vimeo embed code.

Is it possible that it's not the "Embedded Video" element that's special, but the fact that you're putting an iframe in there?

Have you checked your Omeka security settings for whether HTML is filtered and what elements are allowed?

No. That is a good suggestion. I'll do that.

You're right. Its stripping iframe.

When I turn off HTML filtering, the iframe code is there. I'm not sure if it was storing it and just not displaying it on forms and views, or if the value was being filtered out of the mapping.

Hi. I'm having a similar issue. When manually adding an item I can use an iframe element when checking the html box and it goes in as expected. When we try and import a csv with the same code it strips out the iframe attributes. The html filtering is unchecked in settings - security. So '<iframe width="420" height="315" src="//www.youtube.com/embed/IWQFZ7Lx-rg" frameborder="0" allowfullscreen></iframe>' gets added as '<iframe width="320" height="240"></iframe>'. So Test 1 is added manually 'http://clinton.presidentiallibraries.us/items/show/870' Test 2 added by csv import 'http://clinton.presidentiallibraries.us/items/show/871'. Any help appreciated. Thanks.

Hi,

This is not a bug but a feature: html code is filtered for security reasons, so you can't import iframe...

The quick solution is to import it as text and to set html via sql.

Another quick and unsecure solution is to add <iframe> and other needed tags in the list of authorized tags in application/libraries/Omeka/Filter/HtmlPurifier.php.

The alternative solution is to modify the plugin, either:
- to add an option in order to remove this filtering if wanted,
- or to use the security settings set in /admin/settings/edit-security (CsvImport uses an Omeka hard coded html filter)

I'm going to fix it in my improved version of CsvImport (https://github.com/Daniel-KM/csvimport) next week.

Sincerely,

Daniel Berthereau
Infodoc & Knowledge management

Hi. I know this thread has been silent for a month, but I figured before I start a new one I'd try here first. We are having trouble with importing csv files with html. link code works fine, img code gets stripped out. The code is basically 'Title of Item<img src="http://website.com/image.jpg"></img>' We added img to the html filtering, and have html filtering turned off (unchecked). It completely strips it out. I tried removing
'
if ($this->_isHtml) {
$filter = new Omeka_Filter_HtmlPurifier();
$text = $filter->filter($row[$this->_columnName]);
} else {
$text = $row[$this->_columnName];
}
'
from plugins/CsvImport/models/CsvImport/ColumnMap/Element.php and got the same result. What am I missing? Thanks

Since this is a new issue, a new thread would have been appropriate.

It does look like there's a funny interaction between the plugin's filtering settings and the general Omeka filtering settings. But, adding both img to the HTML elements allowed, and img.src to the attributes got it working for me

Thanks Patrick, that did it.