Contextual Menu for files in the Theme Editor

For my 2017 GSoC project, I've added four contextual menu items, which will be displayed whenever a user right clicks on a file in the file tree. They are:

  • New Folder
  • New File
  • Rename
  • Delete

Apart from Copy, Paste and Move contextual menu itens that I'm going to add shortly. Is there any other contextual menu item you would like me to add? I'm up for suggestions.


Duplicate and Open file is always useful for me. Though I suppose in this context, clicking a file is enough to open it.
@djay may have feedback.

download ?

Valuable option.
To do this, I'm assuming I would have to zip the file(s) first, especially if it's a folder, then trigger the start of the download. I'm not sure if there are endpoints available for this. I might have to build those endpoints.

I'll definitely look into this.

So should I separate Copy and Paste from Duplicate? they are essentially the same thing, except duplicate may only create a copy within the parent folder of the file.

I'd separate them. There's code on line that does the zipping thing, this may be a good starting point:

A few notes:

  • This example is based on content tyeps, you're working with portal_resources which behaves a bit differently.
  • The code does more than you need since it needed to deal with multilingual content


  • as much as possible I would keep the names consistent between top menu and context menu.
  • I think "find in path..." is a useful context menu
  • the popup needs to have "apply" and "cancel" buttons.
  • if you have an download context menu I'd consider a "upload here" context menu. Since you might have a preexisting zip that should fit in a subdir. You might also want to upload single files

+1 ... though some of these things might be out of the scope of the original GSoC project it's worth keeping them in the backlog.
@b4oshany ... thoughts?
I really like @espenmn's download feature.

@djay, I will add the download contextual menu to the list of additional features to do. I'm assuming that I can accomplish this by using JavaScript only, similar to how the search within files works, with the capability of zipping files on the client side. I will definitely, rename and take more consideration in the naming of menu items.

Just a note. There are some limitations with zipping on the client side. For large enough files client side zipping didn't work for us. This is why we ended up using server side zipping here:

Bear in mind that this was almost 3 years ago and things may have changed since then.

There's a download function in plone.resourceeditor that I replicated from the FileManager class in the same package. It seems to work out of the box.

1 Like