UC Davis College of Agricultural & Environmental Sciences
Personal tools


Oct 27, 2010


by Trish Ang — last modified Oct 27, 2010 02:05 PM

Basic setup instructions for collective.uploadify — a multifileuploader for Plone.

What? You say you're tired of adding new files and images one by one using Plone's 'Add new' interface? Preposterous! There is no more enjoyable task than stepping one by one through that 'Add new' > 'Browse' > 'Save' rinse & repeat process.

...Unless you're any sane human being. Luckily! There's a lovely jQuery-based multiple file uploader add-on called Uploadify. It works as a portal action on an object, so that you navigate to a folder, append @@upload to the address, and then away you go uploading a storm of files all at once!

Basic set up

First install collective.uploadify through your buildout.cfg. Oddly enough, this product doesn't need to be added in through portal_quickinstaller. Instead, to activate it you create a new portal action for it:

  • In your ZMI, navigate to /portal_actions/object. Add a new CMF Object using the drop-down in the top right of the page.
  • In the URL (Expression) field, enter:
    and choose Visible.
  • Back up from the root of the ZMI, go to /portal_properties/site_properties. At the very bottom, add a new property. The name should be ul_size_limit, type is string, and the value is whatever size limit you want there to be for uploads in bytes. We set ours at 15000000.
    There are a ton of extra customizable options available at http://plone.org/products/collective.uploadify

Boom! You're good to go.

Who's got issues?

Apparently we've got issues. On most of the sites we've installed collective.uploadify on, it works like a charm! There's one site in particular though where the Browse button does not show up, thus making it a little difficult to upload anything. Granted, we've had issues with this site before, but this just happens to be a site where they upload hundreds of .pdfs and could really use something like uploadify! Has anyone else run into this problem? I know this person, grahamperrin, has but no one acknowledged their comment in the #plone IRC chat room, unfortunately. Please let us know if you've found a way to fix the issue. 

Uploadify issue
What's the deal? And ignore those carrot orange buttons, please...

The source for the broken example looks like:

<fieldset id="uploadify">

<!-- uploadify comes here -->
<div id="uploader"></div>

<hr />

<!-- upload button -->

<a id="uploadify-upload" class="context"
href="javascript:jq('#uploader').uploadifyUpload();">Upload Files</a>
<!-- clear button -->
<a id="uploadify-clear-queue" class="context"
href="javascript:jq('#uploader').uploadifyClearQueue();">Clear Queue</a>

While the source for the working example looks like:

<fieldset id="uploadify">

<!-- uploadify comes here -->
<div id="uploader"></div>

<hr />

<div id="uploader" style="display: none;" width="110" height="30"></div>
<object height="30" width="110" type="application/x-shockwave-flash" data="++resource++uploader.swf" id="uploaderUploader" style="visibility: visible;">
<param name="quality" value="high">
<param name="wmode" value="opaque">
<param name="allowScriptAccess" value="sameDomain">
<param name="flashvars" value="uploadifyID=uploader&amp;pagepath=/CAES/&amp;buttonText=BROWSE&amp;script=@@upload_file&amp;folder=/CAES&amp;scriptData=cookie%3D&amp;width=110&amp;height=30&amp;wmode=opaque&amp;method=POST&amp;queueSizeLimit=999&amp;simUploadLimit=4&amp;fileExt=*.*;&amp;multi=true&amp;fileDataName=Filedata">

<div class="uploadifyQueue" id="uploaderQueue"></div>

<a id="uploadify-upload" class="context"
href="javascript:jq('#uploader').uploadifyUpload();">Upload Files</a>
<!-- clear button -->
<a id="uploadify-clear-queue" class="context"
href="javascript:jq('#uploader').uploadifyClearQueue();">Clear Queue</a>

I'm wondering if it's something to do with it being a ++ resource thing. The problem we had before on this site had to do with a missing rule in our ++resource++manage-portlets.kss file, which worked after we cleared the cache and reloaded it.

May 06, 2010

UCLA Plone Day 2010

by Trish Ang — last modified May 06, 2010 08:20 AM

UCLA celebrated this year's World Plone Day by putting on some great presentations on Dexterity, Deliverance, FSD, etc.

Tyler and I considered pulling an all-nighter eight hour road trip to attend, but luckily they sent out the slides after. Go get 'em over here!

Apr 21, 2010

Adapting add-on Plone products

by Trish Ang — last modified Apr 21, 2010 02:00 PM

Our run-in with CMFBibliographyAT: what we found, what we wanted, and how we got it.

For one of our current web projects, we required an organized system for adding and maintaining publication references. We came across Products.CMFBibliographyAT and found that it met most of our project requirements save a few important ones. Here's how we worked around and adapted the product to meet our needs!

right Off the bat

For starters, CMFBibliographyAT is a product that "enables the handling of references to various types of publications as they are used mainly in the context of scientific publications." It provides a number of custom reference types – from article & book references to master thesis, court proceedings, and more — along with a bibliography folder view to display them, and a bibliography advanced search page. All the reference types are based off the same schema (?) and have mostly the same fields (multiple authors, journal, year, page number, URL, etc.). 

A couple dilemmas we had were:

  1. The full publication list needed to display the URL to the full article. Upon installing it, only 'Web published references' displayed their URLs in the list view. For all other references, you needed to click on the reference title to see the full information and its URL.
  2. The references needed to be broken into separate folders based on categorization, but some references also needed to fall into multiple folders. 

adapting 'source'

To address the first issue, we looked at the Web published Reference types. In the list view, we found that these displayed the URL in the way we wanted, except as plain text. Our steps to get all of the references to display URLs in this manner were as follows:

  • development eggs

    Tyler and I are humble graphic designers slash web developers. I'm just saying. Personally, I have limited programming abilities and struggled through the lower division ECS classes I took while at UC Davis. So whenever it comes to actually adapting a product's base python code, it's like walking through a labyrinth in the dark with snowshoes and beer goggles on. Eventually we found the files that we needed to edit in buildout-cache/eggs/Products.CMFBibliographyAT- — however we also quickly learned not to edit the files in buildout-cache.

    With a little help from our local Plone group and Steve McMahon we learned that the right way to modify a product is to checkout a copy of it's source* with

    svn co https://svn.plone.org/svn/collective/Products.CMFBibliographyAT/trunk/  Products.CMFBibliographyAT

    into the /src directory, then to add it into buildout.cfg under development eggs, re-run buildout, and restart the cluster.

    *We couldn't actually get svn to work directly to our Plone box, for whatever reason. So essentially I just ran it from Terminal to my machine, edited all the .py files I needed, and Tyler Putty copied or File-zilla'd or somehow moved the files to the home directory of our Plone box.

  • article.py etc

    Once the development egg was in place and running the correct version of CMFBibliographyAT on our server, I edited the necessary .py files with the following code. Each content type had it's own .py file in the content folder (address above), and each .py file had a def Source(self) section.

    url = self.getPublication_url()
    if url: source += ', %s' % url

    This code doesn't modify any existing reference objects (maybe I should've mentioned this earlier), it only applies to any reference objects created after the change. (Another oddity we found was that anytime you re-install the CMFBibliographyAT product, the main Bibliography folder no longer detects any existing reference objects.)

  • Linkify

    Now upon creating a new reference object in the folder with a URL in the 'Full text' tab section, it prints the URL in the main folder list view! ...But! It prints it in plain text. The next step to get the links handled as links was actually handled with some jQuery magic by Tyler, and expounded on in this blog entry.

  • Formatting

    An additional albeit not really necessary modification I made was that, since now the URL displayed twice in the Bibliography_entry_view, you can modify the portal_skins/bibliography/bibliography_entry_macros with:

    <p tal:content="structure here/Source" tal:condition="here/Source" class="source" />

    And then in your .css, just add in:

    .section-bib.template-bibliography_entry_view p.source a {display: none;}

collections & bibliography folders

The next thing we needed was to have the publications organized by categories. CMFBibliographyAT objects have their own 'keywords' available, however they're separate from the Plone categories that collections can look for. Secondly, CMFBibliographyAT folders weren't nestable by default. What we really wanted were a series of nested collection folders that inherited their parent criteria, but also displayed the publications in the bibliography folder style.

The project we're using this for had an extensive nested list of category labels, so in order to control the list of categories, we took a tip from Joel Burton's Plone Bootcamp and created a hidden Master Tag reference object, gave it all the necessary categories, and then locked out the ability to add new categories.

Next up, we created the set of nested collection folders. The top level folders had the criteria: location = Bibliography master folder; category = whatever-category-that-folder-was-for. Each subsequent folder inherited the parent criteria, and also searched for an additional category.

In retrospect, I probably should have cloned the collection content type (in portal_types), but I didn't realize it til I had most of the folders created already. Anyway, once we had all our collection folders ready to go, we needed them to display the way the bibliography folders do (with the author listing, then title, then source w/ the URL). After stressing over trying to modify a copy of the atct_topic_view to match the bibliographyfolder_view, we had a stroke of genius — we could just set the default view for all Topic types (collection folders) to use bibliographyfolder_view!! Luckily for us, this totally just worked with no real adjustments needed.

To do this, you just need to go to /portal_types/Topic, then set the default view method to bibliography_view (this is why I should have cloned the content type to start with, but also luckily we didn't need collection folders anywhere else in the site).

The end result

Some additional fancy-ness we created for this was a portlet to navigate the set of collection folders using a nested ul & some magic jQuery to open and close the lists as necessary, but that I'll save for another post in the future. The finished product is still in the process of being filled up with publications, but you can view a little bit of it here. We're currently working on importing the old bibliography (from Endnote) into the new system, but we're hopeful of finding an automated solution, and are looking into either Bibutils or csvreplicata.

As always, much of this might not necessarily be the best way to go about things, but we're all about getting things done, here at the Dean's Office! If you have any suggestions or questions on better means of using this product, feel free to comment below. =)

Feb 03, 2010

Squall on Plone 3.3.1

by Trish Ang — last modified Feb 03, 2010 07:35 AM

May day, may day.

We launched a new website recently, however a glitch with the blog set up has been found. We're running two Plone products in tandem, Products.QuillsEnabled and Products.Scrawl, as per the cleverness found at Jon Stahl's blog.

On its own, Scrawl provides a simple content type Blog Entry that allows comments by default, and includes a 'blog_view' for collections and folders. QuillsEnabled, on the other hand, allows you to convert any folder into a blog using any content type. It appends a number of functional portlets that you might find on other blog services, such as a tag cloud, archives, recent entries, etc.

The problem we've run into is that attempting to access any of the auto-generated structure on the Quills end throws traversal errors like no other. That means, no clicking on any of the 'topics', no access to the archives, or authors. Sure, it's not interrupting with consuming the blog in a normal fashion, but all those extras are crippled in the meantime.

No solutions yet. I found someone who ran into the same errors with QuillsEnabledRemoteBlogging, however the ticket was closed with no resolution as the makers were unable to reproduce the problem. I added my notes their, but wanted to document (aha!) here as well, to keep track of what I've tested thus far. And as a note, I'm fairly certain this worked on the site sometime before, while I was initially testing the site before it launched.

Anyway, haven't tried much so far but:

  • Creating a blog on the same server (.28) with just QuillsEnabled, Scrawl, and qPloneComments installed produces no errors.
  • Creating a blog in a folder lower than the root level does not produce errors.
  • Creating a blog on the same server with all the same products installed as the ASI site produces no errors.
  • Creating a blog on the same server with the same products, and then creating folders within the 'Blog' folder (named 'test' and then '2010' and '2009') doesn't create errors, although the year folders have odd properties.

And in the meantime, I've:

  • Hidden the archives portlet and authors portlet.
  • Adjusted the tagcloud.pt in portal_view_customizations so that the topics still appear in their weighted formats, but aren't links.

Rawr! Little help, anyone?