›
Class-attribute-based button sets in new MCE Online Editor
One of my primary postulates towards the new MCE Online Editor is that it supports different button sets, depending on explicit call or preset settings. Actually, presets would stand a much better approach, so let's forget about template declaration for a while. I decided to find out how much work it would require to make the preset approach run.
Ini structure modification
First of all, we have to store the settings we will be using later on. Current button declaration in ezoe.ini looks as follows:
Once we're done with our preset configuration, we have to make the XML Block datatype actually display and store the preset values. First of all, we need to modify the datatype itself (kernel/classes/datatypes/ezxmltext/ezxmltexttype.php):
The example above is not complete, there are other methods to modify, like initialization or (un)serialization ones. This should be enough to run the test, though.
We still have to modify the datatype templates. Again, we'll do the minimum: modify the datatype's class attribute template (design/standard/templates/class/datatype/edit/ezxmltext.tpl) by adding the following code:
Now, all pieces are in their place for the final cuts.
MCE Online Editor modification
First of all, we have to modify the method responsible for collecting the button settings from the configuration files. We locate the eZOEXMLInput handler class and extend the proper method:
// filter out underline if custom underline tag is not enabled
if ( !in_array('underline', $tags ) ) $hideButtons[] = 'underline';
// filter out pagebreak if custom pagebreak tag is not enabled
if ( !in_array('pagebreak', $tags ) ) $hideButtons[] = 'pagebreak';
// filter out relations buttons if user dosn't have access to relations
if ( !eZOEXMLInput::currentUserHasAccess( 'relations' ) )
{
$hideButtons[] = 'image';
$hideButtons[] = 'objects';
}
foreach( $buttonList as $button )
{
if ( !in_array( $button, $hideButtons ) )
$showButtons[] = $button;
}
$this->editorButtonList = $showButtons;
}
return $this->editorButtonList; }
All this modification does is choose a proper button preset instead of a general one. It could be more warning-secured, this is the minimum.
This seems to be all, but it is not. The main MCE init template uses run-once operator to make sure that OE init is only run once. This is going to be a problem since OE button configuration is part of the init. We have to remove the run-once operator and allow multiple initializations. Now, I'm not sure at the moment if this is JavaScript-safe, but seems to work fine at first glance. Edit ezxmltext_ezoe.tpl template file and comment out run-once operators:
{*run-once*}
... {*/run-once*}
This should be it.
Summary
As this example shows, a number of kernel-located files have to be modified in order to achieve this functionality. This takes just a couple of minutes once you know what you're doing, but kernel modification won't likely be accepted for premium support, for example. This is why I really hope this modification makes it to the eZ Publish 4.1.0 release, with some 4.0.x backward compatibility mode.
Also, note that this is hardly a substitute for server-side validation of what user is allowed to do within the OE (which ideally should automatically control what a user can do and I hope for that in eZ 4.2+), but stands a great transitional presentation-layer functionality that can be backed up with proper access control. Many projects will suffer if this is not in place...
One sleepy morning I got up and went for my very first eZ Conference. My expectations were skyhigh as the Dash-8 slowly approached Torp airport. I rented a car and drove the last miles to Skien. After checking in to the hotel, I walked through the rain up the hill to Ibsenhuset where the conference [...]
Last Thursday, during the Open
Nordic Conference 2008eZ Systems
handed out its annual awards again. For the eZ Components award, there were
four nominees, which are all recognised for their support of the eZ
Components project.
The nominees were Stefan Marr and Falko Menge: for the work on
the upcoming Extended Reflection component, James Pic: for the
work on the upcoming MVC additions, Andreas Schamberger: for
contributions to the Template
and Translation tie-in functionality, and Freddie
Witherden: for the contribution of SVG font support in the Graph component.
This year's eZ Components award has been awarded to James Pic ,
congratulations!
PHP Vikinger is over again. With about 35 attendees, I would think it
was a great success. After opening the event, we figured out which
topics people were interested in. After voting for the topics, we came
up with a nice couple of topics. First we had a little discussion on QA
and Testing, which Thomas Nuninnger moderated. I include my (raw) notes
from this:
Selenium takes a long time
to run tests, so Thomas only uses it for front end only, whereas phpunit is used for as much as possible
backend code. Selenium apparently has some functionality for parallizing
( selenium grid), but
there are some issues as well as you can not tell it to run specific
tests parallel. WebDriver does exactly
the same, except for running it in the same browser. But it's going away
from actually using a real browser... which sorta defeats the point of
Selenium. Thomas also mentions that sometimes a fixed value as recorded
by the IDE is not good... but you can "fix" that yourself in
the PHPUnit tests that Selenium can export. The IDE is getting better
BTW. CruiseControl, phpUnderControl, phing (phing is not gnu make) - a port
of Ant.
After this, we had a discussion about the deployment of web
applications, where we discussed some different approaches such as
"svn check-out", but also tools for doing so such as Capistrano.
Sebastian then explained a little bit about the PHP Object Model. We also tried to
figure out a strange profiling issue in one of Zoë Slattery's
applications with Xdebug, but we
could not manage to figure out what it was just yet. The last talk
before lunch was from Kore Nordmann about CouchDb.
After the pizza lunch provided by Klosterøya, we continued with
presentations on Project
Zero, by Ant Philips of IBM; the new lexer in PHP by Scott
MacVicar and a talk by Sebastian Bergmann on the eZ Components' Workflow
component. The last talk of the day was by Tobias Schlitt on database abstraction with eZ
Components.
I will put the slides online at the PHP Vikinger website once I receive
all of them.
›
Developer training in San Francisco, August 2008
eZ Partner Granite Horizon will be running eZ Publish Developer Basics training at the University of California, Berkeley from August 5 - 8. Note that this is not an Official eZ Training course, but it is based on eZ Systems material and is run by a certified eZ Publish developer.
The eZ Components development team is happy to announce the eZ Components 2008.1 release. Starting from this version, eZ Components requires PHP 5.2.1.
In this release, there are three new components:
The Document component enables you to convert documents between different formats.
The Feed component parses and generates RSS1, RSS2 and ATOM feeds.
The new Search component provides a unified interface to different search engine back-ends, quite similar to what the Database and PersistentObject components provide for database access.
The eZ Components 2008.1 release also comes with a new version of my workflow engine, Workflow 1.2. Here are the highlights of this update:
Exciting ! Only two days before eZConf and the eZAwards !
So a year is gone since last time I trampled the Norvegian floor and I'm ready to go there again. Why ? Simply for the best :
The bigger CMS conference in the world
The eZAward after party
Salmon
Grenland
As a nominee, I would like to wish a good luck to everybody.
However, I've got bad news for everyone, it won't be a pleasure like last year. It seems that we will have bad weather suring the conf but it will be better just after.
And now, a little trick in order to make accept eZFlow by women.
During Stefan Priebsch' session at the Dutch PHP Conference on PHP 5.3 and PHP 6 - A look
ahead a discussion popped up about PHP's namespace support. One of
the things that came up is the conflicts that can arise with internal
classes.
Take for example this code:
<?php
use PEAR::Date::Interval as Interval;
?>
In PHP 5.3 this would alias the class Interval in the namespace
PEAR::Date to the class Interval. For now, this code would work just
fine. However, if PHP would introduce a class "Interval" at
some point in the future (and PHP can do this as it owns the
global namespace) then the above code would suddenly stop failing.
So in order to use namespaces properly, you always need to have at least
two elements left, like:
<?php
use PEAR::Date as pd;
$interval = new pd::Interval;
?>
You need to make sure of course that the short name that you pick is
something that does not sound to much like a class name otherwise you'll
have exactly the same issue. It's not very likely that PHP will
introduce a class pd though.