New Journal and TAL Page Templates for ownCloud releases

Freshly packed releases of Journal and TAL Page Templates are now available. If you use ownCloud 5 you can go to the App settings and enable them there.

There are very few changes in the apps, except that they have been updated for ownCloud 5.


 - Updated for ownCloud 5 and TAL Page Templates 0.2.
 - Fix: Author not being saved.
 - Fix: Share entry not removed.
 - Fix: Journals didn't show in search.
Fork on Github

TAL Page Templates:

- Use OC_TemplateLayout to render the layout. All apps using TALTemplate
  will have to update their templates and remove any markup besides what
  they want rendered. See the manual for more info.

- The classes now uses the OCA\TAL namespace.
NOTE: This version requires adjusting of your templates.
Since version 0.2 TAL Page Templates uses OC_TemplateLayout to, well, layout the page ;) This means that you will have to strip your templates from any HTML elements sorrounding your content. If your page previously looked like:
<!DOCTYPE html>
<html metal:use-macro="${maintemplate}">
		<title>TAL Page Templates</title>
		<div id="content" metal:fill-slot="content">
		Your content here...
You will need to strip it down to:
	Your content here...
Read more about TAL Page Templates
Fork on Github

flattr this!

Posted in KDE, ownCloud. No Comments »

ownCloud 5.0 beta 1

ownCloud-200pxStart testing :-)

From:	Frank Karlitschek 
To:	" Mailinglist" 
Date:	Wed, 20 Feb 2013

Hi everybody,

I'm very happy to announce the beta 1 of ownCloud 5

You can download it here:

This is beta quality and it is not recommended to use this in a production environment. 
But if you want to help with testing and QA please download it and give feedback on 
the bugtracker:
Let's give it a hard test.

The new encryption system is not yet part of this release but it will be included in
the next beta. An improved UI for the external filesystem mounting will also come with 
the next beta.

Thanks to everybody who contributed and especially the people who worked super hard on
fixing bugs in the last few weeks and during the developer sprint last weekend.

You guys rock!!!


Posted in Cloud, ownCloud. Tags: . 6 Comments »

Installing Ruby RVM on Ubuntu 12.10

I've never used Ruby even though it's apparently the language of the hour (or maybe some hours ago - I'm often late on such stuff), but had to use it today to run some scripts. I didn't know what RVM was until a couple of hours ago, but when I had to use it, I found out that the package doesn't exist on 12.10 :-/

There's probably some PPA out there with updated packages, but a quick search didn't reveal any, so I decided to install it manually. As the packaged Ruby is kinda outdated, and doesn't match with some of the gems, I also installed a fresh version of that. To avoid clashing with anything that might need the packaged version, I installed it in my home directory. Luckily the RVM packagers made it very simple to do.


sudo apt-get install libxslt1.1 libxslt-dev xvfb build-essential git-core curl
Maybe they're not all needed for ruby/rvm, but I followed an instruction on how to run Cumbumber tests for ownCloud. Install RVM (from the RVM install page):
\curl -L | bash -s stable --ruby
Add code to source some init code to your .bashrc (no idea what it does):
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
Add the bin directory to your PATH:
echo 'export PATH=$HOME/.rvm/bin:$PATH' >> ~/.bashrc
And source it:
. .bashrc
Install necessary dependencies:
bundle install

That's it. Feel free to comment, but I most likely can't answer any questions, because all I did was to collect some snippets from various sources and boil them down to some easy steps :-)

flattr this!

Posted in Ruby, Ubuntu. Tags: , , . 4 Comments »

Syncing your N900 with ownCloud – an update

Back in January I wrote a post about syncing your Nokia N900 with ownCloud (btw, please read that first, if you have any questions/problems using the instructions here). Since I got a lot of very good advice and information in the comments on it, I thought I would post an update with a simpler and more correct configuration. Karel, who also commented on the post, was kind enough to send me his setup. Please refer to the original post for info about connecting to your device with SSH etc. For reference I use syncevolution version 1.2.2-1 from the extras-devel repository and a snapshot of ownCloud from git master, but it should also work fine with a recent 4.0.x release. As in the original post owncloud refers to the URL to the root of your onCloud installation e.g., user is your login and password is your password. My default calendar is called calendar and my address book is called default. First create a main configuration for ownCloud:
syncevolution --configure \
	--template webdav \
	username=user \
	password=password \
Then configure remote URLs and link them to the owncloud config we just created. First the calendar:
syncevolution --configure \
	database=owncloud/remote.php/caldav/calendars/user/calendar/ \
	backend=caldav \
	target-config@owncloud calendar
And the address book:
syncevolution --configure \
	database=owncloud/remote.php/carddav/addressbooks/user/default/ \
	backend=carddav \
	target-config@owncloud contacts
I think the next command creates the entry which will be available in the UI pointing to the owncloud config we created with the first command, and yes, username and password are supposed to be empty:
syncevolution --configure \
	--template SyncEvolution_Client \
	sync=none \
	syncURL=local://@owncloud \
	username= \
	password= \
Now create the configuration for the local storage. The calendar:
syncevolution --configure \
	sync=two-way \
	backend=calendar \
	database=N900 \
	owncloud calendar
The N900 database is the standard storage. You can see the available ones by running syncevolution from the command line, and you can create new local calendars from the Calendar app and link them to e.g. your Work and Private calendars, just remember that the case matters, so the names must be entered exactly as they are printed by syncevolution. And the address book:
syncevolution --configure \
	sync=two-way \
	backend=contacts \
	database=file:///home/user/.osso-abook/db \
	owncloud contacts
Now everything should be OK, but let us make some quick tests.
syncevolution --print-items target-config@owncloud calendar
This should print the URI part and and the summary of all events.
syncevolution --print-items target-config@owncloud contacts
This should just show the URI part of all contacts. If everything worked out OK it's time to do the actual syncing. If you already have events and/or contacts on your device you want to keep you should do an initial slow sync:
syncevolution --sync slow owncloud
Some times you need to do it several times for it to succeed, but once you don't get any more error you can run a normal incrementel sync just by running
syncevolution owncloud
I chose to update everything from the server and ran
syncevolution --sync refresh-from-server owncloud calendar
syncevolution --sync refresh-from-server owncloud contacts
Note: Read this comment first!

Now you can also sync using the syncevolution-frontend app. Just click on the icon Syncevolution and you will see owncloud listed, and when you click on it you will get to the sync options:

Syncevolution overview

Syncevolution overview

Syncevolution options

Syncevolution options

Unfortunately the latest stable release still doesn't support VTODO or VJOURNAL for Notes and Tasks, but according to the information on the pre-release page for version 1.3, it is added there.

If you have any problems when configuring, please read the original post and any comments there first.

flattr this!

Posted in ownCloud, Sync. Tags: , , . 75 Comments »

Tales of a Metal Cloud – Part 2

Metal Cloud
Photo by dedalusj

This article is looong overdue. I started it in July 2012 and never got any further, but now ownCloud 5 is released, and I have just released version 0.2 of TAL Page Templates for ownCloud so here it goes ;) (Some of the examples for "current" ownCloud templates are a bit outdated, but I hope you get the gist of it)

In last episode of...

In the previous post about TAL Page Templates for ownCloud I gave my reasons for wanting to implement PHPTAL in ownCloud, and gave a short example of the benefits it will give for the developer. I wrote I "...will dig deeper into how to use it to render a full page, how to access variables, how to make use of the powerfull METAL.." which I have later decided not to do, as many have described that better than I could do, so if you're not familiar with TAL and METAL, there's plenty to read in the resources section in that post. I also wrote that I would show " I’ve plugged it all in to use ownClouds built-in authentication, template discovery and internationalization system", but thinking about it, there is no reason for showing how it's implemented, but rather I should show more of how to use the ownCloud specific parts. So this will mostly be a manual-like listing of how to use TAL page templates compared to the current use of inline PHP code.

What's next

With ownCloud 5 comes the new App Framework with another template engine - Twig. Personally I'm not very fond of the Twig markup, so hopefully from ownCloud 6 it will be possible to choose which engine to use. The App Framework is still very new, and I haven't explored it properly, but I'm sure it will be a great adition to ownCloud - especially if you can use TAL to write your templates ;)

Links and images

A lot of the scripting used in ownClouds page templates is for linking to apps, pages, services and images. There are several convenience methods for this. PHPTAL implements the standard set of TALES expressions, but also allows you to create custom expression modifiers. I have utilized this to substitute the direct PHP calls.

Linking to an image

<img class="svg" src="<?php echo image_path('', 'logo-wide.svg'); ?>" alt="ownCloud" />
<img class="svg" src="<?php echo image_path('app', 'someimage.png'); ?>" alt="ownCloud" />
<img class="svg" tal:attributes="src image:string:logo-wide.svg" alt="ownCloud" />
<img class="svg" tal:attributes="src image:string:app/someimage.png" alt="ownCloud" />

Constructing a link

<a href="<?php echo link_to('', 'index.php'); ?>">Home</a>
<a href="<?php echo link_to('app', 'index.php'); ?>">Some app</a>
<a tal:attributes="href linkto:string:index.php">Home</a>
<a tal:attributes="href linkto:string:app/index.php">Some app</a>

Link to remote service

<link rel="stylesheet" href="<?php echo OC_Helper::linkToRemote('core.css') ?>" type="text/css" media="screen" />
<a href="<?php echo OC_Helper::linkToRemote('webdav') ?>">WebDAV</a>
<link rel="stylesheet" type="text/css" media="screen" tal:attributes="href remote:string:core.css" />
<a tal:attributes="href remote:string:webdav">WebDAV</a>

Accessing configuration

ownCloud version: <?php echo OCP\Config::getSystemValue('version'); ?>
Default quota: <?php echo OCP\Config::getAppValue('files', 'default_quota'); ?>
Calendar time zone: <?php echo OCP\Config::getUserValue(OCP\User::getUser(), 'calendar', 'timezone'); ?>
ownCloud version: ${config:string:sys/version}
Default quota: ${config:string:app/files/default_quota}
Calendar time zone: ${config:string:user/calendar/timezone}

Translating content

<p><?php echo $l->t('This will be translated.'); ?><p>
<p i18n:translate="">This will be translated.<p>

Translating content with variables


There is no standardized way to do this currently. I have seen both translation keys using printf formatting and custom interpolation using e.g. curly brackets.

<tal:block i18n:name="username" tal:content="user" />
<p i18n:translate="">Your user name is ${username}.</p>

Your user name is ${username}.

Or you can wrap it in some markup:

<p i18n:translate="">
Welcome back <span i18n:name="username" tal:replace="user"/>.

Welcome back .


Translating attributes.

<img alt="<?php echo $l->t('Log out');?>" title="<?php echo $l->t('Log out');?>" src="<?php echo image_path('', 'actions/logout.svg'); ?>" />
<img tal:attributes="src image:string:/actions/logout.svg" i18n:attributes="alt;title" alt="Log out" title="Log out" />
See more...


$arr = array('color' => 'red',
            'taste' => 'sweet',
            'shape' => 'round',
            'name'  => 'apple');
<select size="4">
<?php foreach($$arr as $key=>$value) { ?>
<option value="<php echo $key; >" ><php echo $value; ></option>
<?php } ?>
<select size="4">
<option tal:repeat="item arr" tal:attributes="value repeat/item/key" tal:content="item"></option>

If you want to try it out, you will need ownCloud 5.x where you can enable the "TAL Page Templates for ownCloud" app from Settings/Apps. If you prefer to install from git, it's available at Github.

flattr this!

Posted in ownCloud, PHP. Tags: , , . No Comments »

Tales of a Metal Cloud – Part 1

About reaching the goal and beautifying the path or Usability is also about the code (usability in the code?).
Metal Cloud

Many moons ago, when I unintentionally had ended up as a web developer, I had the pleasure of working for two small companies that both used Plone and hence ZPT - Zope Page Templates. After messing around with all kinds of ugly, inconsistent web coding, it was a relief to be able to use the clean markup that TAL provides, and seamlessly assemble pages using METAL.

Using Zope also had the benefit of having Python as it's backend scripting language. I don't want to dive into how much I prefer Python over PHP - enough has been said about that already - and I fully acknowledge that the ubiquity of PHP makes it the perfect choice for a project like ownCloud. Nor do I want to question the strength of the template class used in ownCloud; you can do practically everything. But the strength of OC_Template is IMHO also it's weakness.

During the few months I've been coding for ownCloud, ideas for it's usage have spawned, new apps pop up, code is being tweaked to do amazing stuff and soon the app repository will be "there's an app for that" also for ownCloud.

Being at the point where everyone can create and publish an app for ownCloud sets up some requirements:

  • Maintainability: If the app is ever abandoned, it has to be easy for a new maintainer to take over. This leads to:
  • Readability: No-one wants to maintain an app with poorly structured code and markup, or with none or insufficient documentation.
  • Validity: This is very broad and covers e.g. packaging, cross browser usability and that the markup adheres to common standards.
Maintain the beauty of the markup.

With the Template Attribute Language (TAL) we can achieve having beautifully structured markup, and the interpreter will let us know of any missing end tags or wrongly nested markup, as a matter of fact the page won't render if we mess it up.

The good thing is that some good people have made a PHP library that implements TAL, TALES and METAL, so I've made a proof of concept ownCloud integration using it, which actually works pretty well, if I may say so ;-)

Time to show what this will mean for the template author. As example I use the form for editing the structured name data in the ownCloud Contacts app.
Below is how the currently used markup looks.

< ?php
$name = isset($_['name'])?$_['name']:'';
<div id="edit_name_dialog" title="Edit name">
	<dl class="form">
		<dt><label for="pre">< ?php echo $l->t('Hon. prefixes'); ?></label></dt>
			<input name="pre" id="pre" value="<?php echo isset($name[3]) ? $name[3] : ''; ?/>" type="text" list="prefixes" />
			<datalist id="prefixes">
				<option value="<?php echo $l->t('Mrs.'); ?>">
				</option><option value="<?php echo $l->t('Mr.'); ?>">
				</option><option value="<?php echo $l->t('Sir'); ?>">
				</option><option value="<?php echo $l->t('Dr.'); ?>">
		<dt><label for="giv">< ?php echo $l->t('Given name'); ?></label></dt>
		<dd><input name="giv" id="giv" value="<?php echo isset($name[1]) ? $name[1] : ''; ?/>" type="text" /></dd>
		<dt><label for="add">< ?php echo $l->t('Additional names'); ?></label></dt>
		<dd><input name="add" id="add" value="<?php echo isset($name[2]) ? $name[2] : ''; ?/>" type="text" /></dd>
		<dt><label for="fam">< ?php echo $l->t('Family name'); ?></label></dt>
		<dd><input name="fam" id="fam" value="<?php echo isset($name[0]) ? $name[0] : ''; ?/>" type="text" /></dd>
		<dt><label for="suf">< ?php echo $l->t('Hon. suffixes'); ?></label></dt>
			<input name="suf" id="suf" value="<?php echo isset($name[4]) ? $name[4] : ''; ?/>" type="text" list="suffixes" />
			<datalist id="suffixes">
				<option value="<?php echo $l->t('M.D.'); ?>">
				</option><option value="<?php echo $l->t('Ph.D.'); ?>">
				</option><option value="<?php echo $l->t('Jr.'); ?>">
				</option><option value="<?php echo $l->t('Sn.'); ?>">

This isn't exactly pretty, and if you want to use a visual HTML editor, it won't look good there either. And believe me, this isn't the worst looking example ;-)
Let's see the same snippet edited for using TAL and TALES

<div id="edit_name_dialog" i18n:domain="contacts" i18n:attributes="title" title="Edit name">
	<fieldset tal:condition="name">
	<dl class="form">
		<dt><label for="pre">Hon. prefixes</label></dt>
			<input name="pre" id="pre" tal:attributes="value name/3|nothing" value="" type="text" list="prefixes" />
			<datalist id="prefixes">
				<option i18n:attributes="value" value="Mrs." />
				<option i18n:attributes="value" value="Mr." />
				<option i18n:attributes="value" value="Sir" />
				<option i18n:attributes="value" value="Dr" />
		<dt><label for="giv" i18n:translate="">Given name</label></dt>
		<dd><input name="giv" id="giv" tal:attributes="value name/1|nothing" value="" type="text" /></dd>
		<dt><label for="add" i18n:translate="">Additional names</label></dt>
		<dd><input name="add" id="add" tal:attributes="value name/2|nothing" value="" type="text" /></dd>
		<dt><label for="fam" i18n:translate="">Family name</label></dt>
		<dd><input name="fam" id="fam" tal:attributes="value name/0|nothing" value="" type="text" /></dd>
		<dt><label for="suf" i18n:translate="">Hon. suffixes</label></dt>
			<input name="suf" id="suf" tal:attributes="value name/4|nothing" value="" type="text" list="suffixes" />
			<datalist id="suffixes">
				<option i18n:attributes="value" value="M.D." />
				<option i18n:attributes="value" value="Ph.D." />
				<option i18n:attributes="value" value="Jr." />
				<option i18n:attributes="value" value="Sn." />

In part 1 I've shown the basics of using TAL, but this is only a foretaste of how PHPTAL can be used in ownCloud. In the next part - hopefully comming shortly - I will dig deeper into how to use it to render a full page, how to access variables, how to make use of the powerfull METAL macros and how I've plugged it all in to use ownClouds built-in authentication, template discovery and internationalization system.

In the meanwhile have a look at the resources below for information about TAL, TALES and METAL

Update: I wrote this article quite a while ago, but never got around to publishing it. In the mean time I've made my implementation available at and made a Journal/Notes app utilizing it which is available at I will publish both soon at the ownCloud app repository.
Update 2: The TAL Page Templates only works on current git master which will be released as ownCloud 5 in some time within the next couple of months ;-) Update 3: I have released TAL Page Templates for ownCloud 4.5 and it is available from the app repository, or from Settings/Apps when you have installed/upgraded to 4.5. At the same time I have released a small Journal/Notes app which uses the TAL templates.

flattr this!

Posted in ownCloud, Programming. Tags: , , . 7 Comments »

Backup ownCloud Calendar and Contacts

I have my ownCloud instance in a sub-domain at my hosting provider, so I prefer to make a weekly backup of my calendar and contacts. There is no documented way of doing this afaik, but if you run a *nix-like system where wget is installed, it's actually pretty straight forward. In this example owncloud refers to the URL to the root of your ownCloud installation e.g., user is your login and password is your password. The URL to use is the same you use if you want to download the calendar or address book manually. In the upper, right corner of the Calendar and the Contacts app, there's a button named respectively Calendars and Address books. When you click on that, you get a dialog box with a list of your calendar(s) and address book(s). The screen shot below is from the Contacts app. To download manually push the Download button button. Instead of doing that, right-click on it, and select "Copy link location" (or whatever your browser calls it) from the context menu. Choose addressbook Your clipboard will now hold a URL looking something owncloud/apps/contacts/export.php?bookid=1 - for the calendar it would look like owncloud/apps/calendar/export.php?calid=1. Make a simple script using those URLs:
DATE=`date +"%Y-%W"`

# Download and gzip contacts.
wget --auth-no-challenge --no-clobber --http-user=user --http-password=password \
  -O $HOME/pimdata_backup/contacts-$DATE.vcf "owncloud/?app=contacts&getfile=export.php?bookid=1"
gzip -f $HOME/pimdata_backup/contacts-$DATE.vcf

# Download and gzip calendar.
wget --auth-no-challenge --no-clobber --http-user=user --http-password=password \
  -O $HOME/pimdata_backup/calendar-$DATE.ics "owncloud/?app=calendar&getfile=export.php?calid=1"
gzip -f $HOME/pimdata_backup/calendar-$DATE.ics
The --auth-no-challenge is to avoid having the server send an authentication challenge, which would mess up the download. The --no-clobber is to avoid downloading a file that already exists. When gzipping the downloaded file it gets a .gz extension appended to the filename, so it should normally not be an issue though. The backup files will now have names containing the year and week number like contacts-2012-17.vcf.gz and calendar-2012-17.ics.gz. If you prefer to backup in another schedule than weekly, you will of course have to change the date command accordingly. Save the script somewhere preferably in your PATH - I use ~/bin for my scripts - and make it executable: chmod u+x ~/bin/ - or whatever you choose to call it. Test if the script works and set it up to run on a regular basis as a cron job or any other job scheduler; I use KAlarm because it's so damn easy to use ;-) You could use curl instead of wget, it's just a matter of preference. Update: As Klaus Muth mentions in a comment, it cannot be stressed enough that this method should not be used in a multi user environment as it places passwords in the process list at runtime.
Update 2 June 13 2012: I have updated the paths for ownCloud >= 4.3 (git master and stable4). HTTP Auth was broken in versions before that.

flattr this!

Posted in Cloud, Linux, ownCloud. Tags: . 23 Comments »

Yet another MySQL vs. AppArmor barf

I freaking hate AppArmor! Of course only because I don't want to be bothered when an update makes a mess of it - I really don't know how it works but I don't want to need to know either. Some months ago I tried out Logitech Media Server on my box, and it screwed it up big time. Now it seems there has been an update, so it doesn't accept symlinks anymore. It seems logical that it shouldn't, but Ubuntu could have done a better job fixing it - or maybe it's because I had already edited it, that it didn't get updated..? A search lead me to an issue at Launchpad about it, but I've only skimmed through it. Anyways, today when I rebooted MySQL wouldn't run and /var/log/syslog was filled with entries like this:
Mar 30 11:55:31 tanghus kernel: [ 1309.198481] type=1400 audit(1333101331.343:97): apparmor="DENIED" operation="mknod" parent=1 profile="/usr/sbin/mysqld" name="/run/mysqld/mysqld.sock" pid=7192 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=114 ouid=114
Mar 30 11:55:36 tanghus kernel: [ 1314.463559] init: mysql main process (7192) terminated with status 1
Mar 30 11:55:36 tanghus kernel: [ 1314.463606] init: mysql main process ended, respawning
Mar 30 11:56:01 tanghus kernel: [ 1339.105333] init: mysql post-start process (7194) terminated with status 1
Mar 30 11:56:01 tanghus kernel: [ 1339.111425] type=1400 audit(1333101361.335:98): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=7291 comm="apparmor_parser"
To fix it edit /etc/apparmor.d/usr.sbin.mysqld and replace the lines: /var/run/mysqld/ w, /var/run/mysqld/mysqld.sock w, with: /run/mysqld/ w, /run/mysqld/mysqld.sock w, and restart mysql by running sudo service mysql restart - if it doesn't respawn by itself. AppArmor should automagically refresh from the change of it's configuration file, otherwise run sudo service apparmor restart.

flattr this!

Is Kubuntu up for a great future?

One could argue so. Harald Sitter (apachelogger) tells that a lot of the base software Kubuntu relies on, will move from the main to universe repository, and that it:
(...) bares a great deal of opportunities for Kubuntu. Primarily it gives the community yet bigger control over what the distribution looks like as we do not need to get software approved to be worthy of Canonical’s support. At the same time it also reduces the policy overhead (main inclusion for those who have heared of it). The detanglement allows us to move even closer to KDE without having to worry about conflicting interests (...)
I have used Kubuntu since one of the first releases (something with a hedgehog?) and enjoy that KDE packages appears in the PPA fast and well tested. One of my major complaints about Kubuntu is that packages such as qtwebkit are totally out of date, and causes crashes and lack of functionality in the up-to-date KDE programs and libraries. Maybe a really community driven Kubuntu will prove to be much better in the long run? Via How Kubuntu Did Not Change | Apachelogger's Log.

flattr this!

Posted in KDE, Kubuntu. No Comments »

Still not wanting it

Like so many other people have said: It's too little, too late. Google has scared away a LOT of people, including me who wasn't even subject to their name witch hunt. I have deleted my G+ account, and I don't want it back. I don't want to be part of a "community" where I can risk being asked about identification, or if I know the right people. The former sounds like a police state, the latter either as a fancy night club, or the local biker gang - I'm not sure which is worst.

flattr this!

Posted in Personal. Tags: , . No Comments »