Install eZWebin Toolbar into an existing site

eZWebin is an extension providing a toolbar that lets you manage your content directly in the front-end of an eZ Publish site. When refreshing the design of this site, integrating the toolbar was one of my goals. Łukasz Serwatka had already published a nice article on how to create your own toolbar extension (serwatka.net/blog/how_to_create_and_use_an_ez_publish_website_toolbar_extension, dead page :-() by copying files from the ezwebin extension. I don't like this solution because you have to copy again those files when the extension is upgraded (I'm lazy as all developers!). That's why I use the following steps on my blog.

Install and configure the ezwebin extension

If you don't have the ezwebin extension installed, you have to download and install it. Retrieve the ezwebin extension as a package on the eZ Publish 4.0 packages page (it should work with eZ Publish 4.0.1 to) and install it through the admin interface and finally activate it. As I have my own design, I don't need the others ezwebin_* packages. Then, you have to add ezwebin as an additional design, in the site.ini.append.php of your front end siteaccess you should have something like:

[DesignSettings]
SiteDesign=your_design_name
AdditionalSiteDesignList[]=ezwebin

Template modification

This step depends on your site. With most designs, you just need to add those lines of code in the pagelayout template before the {$module_result.content}:

{def $current_node_id = first_set( $module_result.node_id, 0 )
     $content_info = cond( is_set( $module_result.content_info ), $module_result.content_info, hash())}
{if and( $current_node_id,
         $current_user.is_logged_in,
         and( is_set( $content_info.viewmode ), ne( $content_info.viewmode, 'sitemap' )),
         and( is_set( $content_info.viewmode ), ne( $content_info.viewmode, 'tagcloud' )) )}
<style type="text/css">
@import url({"stylesheets/websitetoolbar.css"|ezdesign(no)});
</style>
{include uri='design:parts/website_toolbar.tpl'}
{elseif or( $uri_string|begins_with( 'content/versionview' ),
            $uri_string|begins_with( 'content/edit' ))}
<style type="text/css">
@import url({"stylesheets/websitetoolbar.css"|ezdesign(no)});
</style>
{/if}
{undef $current_node_id $content_info}

If you have several pagelayout templates, you can put this code in a template file and include it. It only adds the toolbar and/or a stylesheet if you are identified or if you edit or preview a content. The toolbar seems to be flexible enough to be included without major layout problem.

And then ?

These steps bring an easy to use interface to manage your content. You probably need to adjust your stylesheet(s) to have a nice edit form.

eZWebin Toolbar
Front end interface

I also have two small problems:

  1. It's not possible to make an override condition to use a special pagelayout for edit mode. Depending on your layout, you may need to add some conditions to have only one column (or enough space) in edit mode. For instance, the toolbar of the new Online Editor needs 750px to be displayed on a single line (even if it works well when the toobar is displayed on many lines)
  2. content/versionview has a bug when it is used from the ezwebin toolbar. It doesn't use the right pagelayout if you have some override rules on it. I propose a patch in the bug report which works well for me.

Nevertheless, it works well and it's very convenient for a blog.