Wednesday, February 24, 2010

Communities and Collections in collapsable treelist, plus graphical webui.strength

Also in my dump of visual changes that may or may not be going anywhere is the Communities and Collection page with a jQuery treelist that is expandable and collapsable. As well as changing the default for webui.strengths.show to instead of showing a number, to show a little strength meter from Google Charts.




This is the snippet of code that shows the pretty little image.

out.println("<img src=\"http://chart.apis.google.com/chart?cht=bhs&chs=25x13&chco=4d89f9&chds=0,50&chd=t:" + ic.getCount(comms[k]) + "\" />");

Luau, a DSpace admin module for Libarians

Presenting A DSpace Admin Module: 
Librarians Understandably want to stay Away from Unix
or LUAU for short.

It allows people to do some of the routine administrative server settings tasks in DSpace without touching unix. Here's the goods: No more ensuring you have the latest copy of input-forms.xml, ftp'ing it to the server, and restarting tomcat.

You can download the running config of dspace.cfg and input-forms.xml.
Upload that file, with their modifications, and restart the server.

Other features include viewing the last however many lines from a log file. Which is useful in debugging a buggered config file.

UPDATE: Adding another image so its clearer what you can be done with an admin module.

Monday, February 22, 2010

Document Preview in DSpace, using Google Docs Viewer

    

I've made a modification that allows a DSpace repository to embed a "preview" of the document into the page, so the user never has to leave, just to get to the good stuff.

Adding a Preview link to the item's bitstream.

Then showing the document with Google Doc's Viewer. It essentially becomes a very easy way to make your content more easily accessible, as files that are MS Word or Adobe PDF don't require the visitor to have those programs installed to view them, and load instantly on the page.

How it works
The Google Docs viewer essentially works the same as the user downloading the document to their computer and having the Adobe Reader display the file for them, however, it uses Google Docs to download the document, and then render the PDF before their eyes in real-time so that they can immediately see the document on that page.

It involves modifying ItemTag.java to add the link and a preview box, adding four javascript functions, and used some jQuery. Going forward, I'm thinking that this builds off of Stuart Lewis' idea of having a preview anything. As this is generally a response (for documents) to:
Perhaps we should make this is into a pluggable system for DSpace 1.6 where you can register classes that can render file types, and then make a configurable option to register viewers to filetypes?

UPDATE: The code is available in a writeup at the DSpace Wiki: Document Preview with Google Docs Viewer

Friday, February 05, 2010

What is visual document search and preview?


"You may not use the Service to develop a visual document search and preview application which embeds multiple uses of the Google Docs Viewer in a single webpage for DOC, DOCX, or PPTX filetypes."
- Google Docs (view on Google Sidewiki)
Heh??

So this terse statement is to prevent the user from doing something, but without really saying what not to do. I get the logic for that, because a note the says "Do Not Turn Off", will invariably get someone to flick the switch. So this is my layman's understanding of this legalese:

Please limit yourself to embedding the Viewer just once per page for files (DOC, DOCX, PPTX).

And what is this visual document search and preview? It sounds like I want one of those.

Monday, February 01, 2010

Get notified of latest IRC message onscreen with notify-osd (code)

Problem
 When working away in the editor, you see that xChat, "your IRC client" has a new message of activity, and you can't bear to not check on it. The deeper problem lies in the fact that you are like one of Pavlov's dogs and respond to activity.

Solution
 A shell script + php script that reads your xchat channel log, and then sends to notify-osd (the onscreen popup display in Ubuntu et al) that latest message.


#### xchatNotify.sh ####

#!/bin/bash
while [ 1 ]; do
     ./main.php
     sleep 1m
done

#### main.php ####
#!/usr/bin/php
$update_file = DIRNAME(__FILE__).'/last_updated';
$log_file = '/home/peter/.xchat2/xchatlogs/FreeNode-#dspace.log';

$last_updated = filemtime($update_file);
$last_message = filemtime($log_file);
touch($update_file);


if($last_message > $last_updated) {
        $lines = file($log_file);
        echo 'Now: '.date('M d G:i:s');
        $message = $lines[count($lines)-1];
        $cmd = "notify-send \"$message\"";
        echo $cmd;
        system($cmd);
}

You need to have notify-osd and/or notify-osd installed on your system. My system is Ubuntu 9.10.

Room for Improvement
The shell script checks once a minute, and only displays the last message, so intermediate messages are not shown. But the purpose was just to show a message, which should give you enough context to either care or not care. Also, its only checking the one channel, and its not presented as a command line argument. Also, it would be nice to not alert you if xChat is currently the active window.