Timeline Plugin

58 views
Skip to first unread message

Wayne Graham

unread,
Apr 12, 2010, 1:59:34 PM4/12/10
to Omeka Dev
On behalf of the Scholars' Lab, we're happy to announce a new Timeline
plugin ready for general testing.

source: https://addons.omeka.org/svn/plugins/Timeline/trunk/
documentation: http://omeka.org/codex/Plugins/Timeline

This code is one of the components for the Neatline Project and was
developed to the specifications described in the Plugin Rush (http://
omeka.org/c/index.php/Plugin_Rush_2010#Timeline_.281.1-1.0.29).

If you find a bug, or have any comments, let us know on the list!

Wayne

Sheila

unread,
Apr 13, 2010, 1:39:14 PM4/13/10
to Omeka Dev
Hi Wayne,

Testing you wanted, so testing you've gotten.

I installed the Timeline on 2 different 1.2. sites, and a 1.1 site.
After clicking Install on each of them, I get this error:
.../application/logs/timeline.log" cannot be opened with mode "a"
breaking every page in the site--admin or public.

There is no timeline.log file in the application folder

Anyone else having issues?

Thanks,
Sheila

ocymum basilicum

unread,
Apr 13, 2010, 1:51:09 PM4/13/10
to omek...@googlegroups.com
Sheila--

The plugin currently logs various information, as is appropriate for a very early release. See:


for some background.

You can enable your webuser (the user who runs the web server process on your server) to write to your log directory (as reported) so that the plugin can write its logging messages as appropriate. If you don't want to or don't know how to do that, you can simply wait a little while until the initial rollout stabilizes and I will turn logging off in the plugin. I am going keep logging on for at least some time in order to catch more subtle errors that people report. Doubtless they'll come in. {grin}

If you know the username of your webuser but not how to enable writing, try:

touch YOUR-OMEKA-INSTALL-DIRECTORY/application/logs/timeline.log
chown -R YOUR-WEBUSER YOUR-OMEKA-INSTALL-DIRECTORY/application/logs/timeline.log

---
A. Soroka


--
You received this message because you are subscribed to the Google Groups "Omeka Dev" group.
To post to this group, send email to omek...@googlegroups.com.
To unsubscribe from this group, send email to omeka-dev+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/omeka-dev?hl=en.


Sheila

unread,
Jun 9, 2010, 3:15:53 PM6/9/10
to Omeka Dev
I'm back at it, and finding a JS error when trying to display my
timeline on items/show:
http://dev.omeka.org/sbrennan/ziponetwo/items

"Error: unterminated string literal
Source File: http://dev.omeka.org/sbrennan/ziponetwo/items
Line: 88"

ocymum basilicum

unread,
Jun 9, 2010, 3:28:32 PM6/9/10
to omek...@googlegroups.com
Looks like an apostrophe:

"he later went on to serve in the military, receive his master’s degree"

might be the problem. Can you try taking that out for a moment and trying again? If that is the issue, I can write some fix for it.


---
A. Soroka
Digital Research and Scholarship R & D
the University of Virginia Library



John Flatness

unread,
Jun 9, 2010, 3:31:46 PM6/9/10
to omek...@googlegroups.com
It looks like the problem is caused by the newlines in your item descriptions. These newlines are being output by the plugin, but Javascript doesn't allow strings to span multiple lines like that.

The getMet function in the plugin needs to replace newlines by using nl2br(), str_replace(), or some other string-escaping function.

-John

Jeremy Boggs

unread,
Jun 9, 2010, 4:02:28 PM6/9/10
to omek...@googlegroups.com
It might also be better to use an Omeka helper called js_escape()
instead of addslashes(), which is located in StringFunctions.php. This
escapes the text for use in javascript. We use this in our JSON
outputs. It may help with both the new line issue John mentions and
the apostrophe Adam mentions. js_escape() is not documented, but I'll
work on remedying that. :)

Jeremy

>> omeka-dev+...@googlegroups.com<omeka-dev%2Bunsu...@googlegroups.com

Kris Kelly

unread,
Jun 9, 2010, 5:05:31 PM6/9/10
to omek...@googlegroups.com
I'd like to jump on the bandwagon with Jerm and suggest using js_escape(). All that does is JSON-encode your data so that it's valid javascript. You could easily opt for PHP's built-in json_encode(), or use the Zend_Json component directly.

In general it's good practice to make sure that all user data, meaning anything coming from the database, or from the request like $_GET, $_POST, etc. is properly JSON-encoded before you pass it to some javascript. That prevents a lot of basic XSS security flaws and also ensures that your content is not broken by things like newlines, etc.

Happy trails,
Kris

A. Soroka / the University of Virginia Library

unread,
Jun 14, 2010, 11:26:32 AM6/14/10
to Omeka Dev
Please try using a copy from:

https://addons.omeka.org/svn/plugins/Timeline/tags/1.2-0.1.1

The escaping has been improved as per Jeremy's suggestion.


---
A. Soroka
Digital Research and Scholarship R & D
the University of Virginia Library



Sheila

unread,
Jun 14, 2010, 2:37:47 PM6/14/10
to Omeka Dev
Just tested this version and it appears to be working well. My only
question is how can you change the default start date of the timeline
from 2010 to say, 1860? I ask because I know our users are going to
want to adjust it accordingly to match their archive.

Thanks,
Sheila

On Jun 14, 11:26 am, "A. Soroka / the University of Virginia Library"

Will Riley

unread,
Jun 14, 2010, 2:44:19 PM6/14/10
to Omeka Dev
I installed 1.2-0.1.1 and put the following into the items/browse.php
page of my theme:

<div id="timeline"></div>
<?php createTimeline('timeline', get_items_for_loop()); ?>

When I do this, the timeline does not appear and I get this javascript
error:

Error: containerDiv is null
Source File: http://static.simile.mit.edu/timeline/api-2.3.0/scripts/timeline.js
Line: 466

Any ideas?

-Will

On Jun 14, 11:26 am, "A. Soroka / the University of Virginia Library"

ocymum basilicum

unread,
Jun 14, 2010, 2:56:23 PM6/14/10
to omek...@googlegroups.com
Sheila-- that can only be accomplished by JavaScript right now. You can use:

Omeka.Timeline[0].getBand(0).setCenterVisibleDate(SimileAjax.DateTime.parseGregorianDateTime("July 4 1860"));

in a theme-sourced or other JavaScript file after the Timeline has loaded.

---
A. Soroka
Digital Research and Scholarship R & D
the University of Virginia Library

Will Riley

unread,
Jun 14, 2010, 2:59:53 PM6/14/10
to Omeka Dev
So I added specifed the height property using the style attribute, and
the timeline appears:

<div id="timeline" style="height:200px;"></div>

This might be useful to add to the wiki.

One other minor issue. Our convention for global functions is to
lowercase the function name and seperate the words by underscores. So
createTimeline, should be something like create_timeline.

--Will

ocymum basilicum

unread,
Jun 14, 2010, 3:00:06 PM6/14/10
to omek...@googlegroups.com
Will--

Firstly, I would use 'get_items'. I don't know what 'get_items_for_loop' returns-- are you sure it's an array?

Otherwise, I'm not sure what the issue is. Please send me the HTML output of your page.


---
A. Soroka
Digital Research and Scholarship R & D
the University of Virginia Library



ocymum basilicum

unread,
Jun 14, 2010, 3:19:15 PM6/14/10
to omek...@googlegroups.com
That's interesting. I'll see if I can code in a default for that height.

As for the name of the function, it makes no difference to me at all. I'm happy to use any particular name. Is there a reference available for Omeka coding style? The closets thing I find is:


---
A. Soroka
Digital Research and Scholarship R & D
the University of Virginia Library


Sheila

unread,
Jun 14, 2010, 4:10:10 PM6/14/10
to Omeka Dev
Ok, I'll try to work through that tomorrow.

Another issue: on the timeline, I expected that clicking on the item's
title (in the bubble popup w/the description) would take me to the
items/show page for that item and it does not. Both Will and I are
getting the same error:

Error: Omeka.Timeline.behavior is not a function
Source File: javascript:Omeka.Timeline.behavior(13)
Line: 1

Thanks,
Sheila


On Jun 14, 2:56 pm, ocymum basilicum <ocy...@gmail.com> wrote:
> Sheila-- that can only be accomplished by JavaScript right now. You can use:
>
> Omeka.Timeline[0].getBand(0).setCenterVisibleDate(SimileAjax.DateTime.parseGregorianDateTime("July
> 4 1860"));
>
> in a theme-sourced or other JavaScript file after the Timeline has loaded.
>
> ---
> A. Soroka
> Digital Research and Scholarship R & D
> the University of Virginia Library
>
> > omeka-dev+...@googlegroups.com<omeka-dev%2Bunsu...@googlegroups.com>
> > .

ocymum basilicum

unread,
Jun 14, 2010, 4:30:46 PM6/14/10
to omek...@googlegroups.com
Can you tell me what browser you are using?

In any event, that click will not take you to the Item's page. It will simply display a bubble with the Item's DC Description. More complicated behavior is certainly possible, and should be implemented with the very Omeka.Timeline.behavior function you just discovered. See the Omeka Wiki docs on this plugin.


---
A. Soroka
Digital Research and Scholarship R & D
the University of Virginia Library



To unsubscribe from this group, send email to omeka-dev+...@googlegroups.com.

Sheila

unread,
Jun 14, 2010, 10:20:48 PM6/14/10
to Omeka Dev
Thanks, Adam.

I'm using Firefox 3.6.3 for PC.

I'm trying to figure out what the default behavior is, because within
the bubble that includes DC title and DC description, the title is a
link leading me to believe that it will take me some place magical, or
perhaps just to another page.



On Jun 14, 4:30 pm, ocymum basilicum <ocy...@gmail.com> wrote:
> Can you tell me what browser you are using?
>
> In any event, that click will *not* take you to the Item's page. It will
> simply display a bubble with the Item's DC Description. More complicated
> behavior is certainly possible, and should be implemented with the very
> Omeka.Timeline.behavior function you just discovered. See the Omeka Wiki
> docs on this plugin<http://omeka.org/codex/Plugins/Timeline#Using_the_Timeline_Plugin>
> .
>
> ---
> A. Soroka
> Digital Research and Scholarship R & D
> the University of Virginia Library
>
> > <omeka-dev%2Bunsu...@googlegroups.com<omeka-dev%252Buns...@googlegroups.com>

ocymum basilicum

unread,
Jun 15, 2010, 11:32:24 AM6/15/10
to omek...@googlegroups.com
I'm afraid there's very little magic in my code.

If you'd like to update to trunk for the Timeline plugin, you'll find that there is now a helper function on the Omeka.Timeline objects, which allows you to shorten the JavaScript for centering a timeline to:

Omeka.Timeline[0].setCenter("July 4 1860");

Keep in mind that the array index ("[0]") is the index of which Timeline in the page is being manipulated. If you have only one, it will always be 0. In fact, Omeka.Timeline[] is an array of the Simile Timeline objects that are created, so you can call the Timeline API:


on those objects, as well as my new helper method.

The default behavior in the trunk of the plugin is to do nothing when that link is clicked. If there's a great desire and consensus for some other default behavior, I'm perfectly amenable to that. Feel free to suggest some JavaScript for the purpose.

---
A. Soroka
Digital Research and Scholarship R & D
the University of Virginia Library


To unsubscribe from this group, send email to omeka-dev+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages