Nuxeo/Blogs

Industry Insight, Product & Development, Updates.

Archive for the ‘Monday Dev Heaven’ tag

[Monday Dev Heaven] Pick a Random Picture as Background for the Login Page

with 2 comments

Here’s a fun project to help you learn more about working with the Nuxeo Platform — display a random background image on the login page. And of course we’ll be picking up the image into our Nuxeo instance. Part of the challenge is to access this image when there is no user session :) This an opportunity to learn more about OpenURL and UnrestrictedSessionRunner. Here’s how we’re going to do this.

Create a WebEngine Module

What we need is to return an image for a simple URL. A WebEngine module is the simplest and quickest solution to achieve that. So using Nuxeo IDE, I’ve created a new WebEngine module called RandomLoginPage. It doesn’t do much for now. If you deploy it on your server and go to yourserver/nuxeo/site/RandomLoginPage/, you should be redirected to the login page. Once you login, you see a simple web page explaining hte module …

Written by

August 19th, 2013 at 2:11 pm

[Monday Dev Heaven] Nuxeo and Atlassian HipChat Integration

without comments

Being big Atlassian fans here at Nuxeo, we recently started using HipChat. It’s an enterprise chat room. One of the cool things about HipChat is its very simple web API. It makes it really easy to send notifications to a chat room.

To show you how dead easy it is, I did a project showing how to send Nuxeo events to a Hipchat room using their web API. I did it using Nuxeo IDE to generate my plugin structure, using the Nuxeo Plugin Project and Nuxeo Listener wizards. My listener only listens to documentCreated and documentModified events. Each time they occur, we send a small message to a HipChat room, containing the URL of the document, its title, date and creator. The code is really simple (especially because most of it is generated by Nuxeo IDE):

What it does is simply relay the modify or create events to a room. …

Written by

April 29th, 2013 at 11:00 am

[Monday Dev Heaven] Trying IntelliJ IDEA and Nuxeo Platform

without comments

Today I’ll write a post a little differently than usual. I won’t write about code per say but about my experience with IntelliJ IDEA. Some of you might be aware that one of our developers has developed an IDEA plugin for Nuxeo, so I decided to give it a try.

First thing I did was import Nuxeo Platform source code using maven. All I had to do was tell IDEA where the root pom and the addon parent pom were. As you know we have many modules so I was expecting this step to take forever. I’m happy to say I was wrong. It went really fast. And I didn’t have to specify my maven repo as an environment variable. What surprised me though is that there is no default JDK, hence there are errors everywher — something fixed quickly using the contextual help. Anyway, it feels great just to …

Written by

February 11th, 2013 at 2:23 pm

[Monday Dev Heaven] Creating DeckJS Slides in Markdown

without comments

Today we’re going to play with the templating module. It lets you render a document using a template. You can easily install it through our Marketplace. It comes with a bunch of examples to give you an idea of what’s doable. You will also find information in our user guide.

A live example is the last Webinar slide deck. It was written in a Markdown Note document and rendered using a DeckJS based template.

If you want to try it now it’s available in the nuxeo-template-rendering-deckjs bundle. Just copy the jar in the plugins folder and the template and its example should be automatically loaded. Be aware that the pdf conversion will only work if you have PhantomJS (version >= 1.8) installed on your server.

The template document is a regular WebTemplate. You need to import JavaScripts, StyleSheets, images, etc. as document attachments. Then where you usually …

Written by

January 22nd, 2013 at 10:30 am

[Monday Dev Heaven] Extract Metadata from Content File Attachments #2

without comments

Welcome to the second part of the file metadata blog post. Last time I explained the issues I wanted to address and started to code a service for that. Today I’ll try to show you when and how to do the actual mapping.

First comes the “When.” We need to update metadata each time the document is about to be modified or created. So I need a Listener with the following configuration:

I’ve chosen to listen to aboutToCreate and beforeDocumentModification instead of the common documentModified or documentCreated. This way we don’t have to save document again, which could trigger another documentModified hence a loop.

The listener itself is simple. It just calls the mapping service. This is where all the logic is. This way you can call it from somewhere else like an importer or from an operation.

Now that we took care of the “When,” we can handle …

Written by

January 14th, 2013 at 3:26 pm

[Monday Dev Heaven] Extract Metadata from Content File Attachments

with one comment

Today I’m digging out an old question about XMP support in Nuxeo. I’m actually going to widen this a bit and talk about metadata in Nuxeo. A limitation we have these days is the fact that you can only read metadata from a file, not write them. So let’s think about what this means.

A few questions first: do you write back metadata to files when you edit them in Nuxeo? Do you sync everything you can extract from the file? How do you map this to existing document properties? When should you do all of this?

What we need to know is which metadata from which type of file should we extract and/or write back to the file?

So we can define a specific mapping between document properties and file metadata. It will be differentiated by the file mime type, the type of the document and the file’s xPath. …

Written by

December 3rd, 2012 at 10:28 pm

[Monday Dev Heaven] How to search for PDF files, or any other type for that matter

without comments

Hi, here’s a common need that is not really addressed in Nuxeo’s default UI: searching for documents with only PDF as attachments, or any other kind of file for that matter. So today I’m going to show you how to write a widget for the search form. This widget will let the user select any type of file.

The Query

I’m going to start with the NXQL, as I feel it’s really the part people usually don’t know about. The query part you need is quite simple. Let’s say you want to search for audio files stored in file:content. The appropriate query would be:

There’s no schema here, just the complex content metadata that is declared as follows:

So of course you can also search using other metadata like size:

or name:

Now let’s say you want all attachments, like all the files stored in files:files, this is …

Written by

November 19th, 2012 at 1:48 pm

[Monday Dev Heaven] Unleash Nuxeo Shell

with one comment

Today I bring you the Nuxeo Shell. This is a wonderful toolbox for developers and administrators and I think it deserves more recognition.

Playing with the Shell

Using the Shell is quite easy when you have Nuxeo IDE. You need to be in the Nuxeo perspective and click on the little shell icon on the bottom left of the screen.

You can now type tab to see a list of the available commands. These commands are sorted by namespaces. Namespaces are command registries that you can register in the shell. A command registry helps bring inside the shell a new set of commands for a specific context without having name clash problems with already existing commands. It is also very useful because you have a different type of completion for each namespace. For instance, if you have selected the local namespace, hitting tab after ls will show you the list …

Written by

October 15th, 2012 at 12:56 pm

[Monday Dev Heaven] Nuxeo-lang-ext-assistant, a WebEngine site here to help you translate Nuxeo

with 3 comments

As you may know, we’re in the process of a releasing Nuxeo 5.6. The first RC is available here: http://www.nuxeo.com/5.6/ . Feedbacks are welcome :-)

The good thing about the code freeze is that the different labels we have are very unlikely to change. Hence it’s the perfect time to start translating Nuxeo in another language or update existing translations.

So I started a small WebEngine project to ease the process. It has really basic features right now. You can select any languages available in nuxeo-platform-lang-ext. You get to see every keys, English labels and labels of the selected language in a table. Those columns have a text filter input to ease navigation through the 2000+ labels. There’s also a checkbox that display only empty labels for the selected languages. Fields you have modified are saved to the server automatically so that we can add them to the current …

Written by

July 24th, 2012 at 10:24 am

[Monday Dev Heaven] Highlight searched keyword in document preview

with 2 comments

Today I’ll deal with another demand from Brendan (Yes he asks lots of stuff. You don’t wannna know… but also, he is not shy. If you also have ideas for this blog, please tell me about them, don’t be shy!). He would like to highlight text in the document preview. The highlighted text should be the keywords from the search. So what I’m going to do is inject some JavaScript in the preview frame using BlobPostProcessor like I did for the waiter. This is gonna be the easy part. The less easy part is to find the search keywords from the preview frame.

The search box

So about that search box, I’ve found a very nice JQuery script from Johann Burkard that does most of the work. It highlights the given String in a DOM element. I’ve modified it slightly so that each time it adds a span with …

Written by

July 9th, 2012 at 7:07 pm