Drupal 7 bietet uns mittlerweile viele neue und tolle Techniken, um komplexe Webprojekte zu realisieren. Doch an einem sehr großen und wichtigen Punkt bringt es Sitebuilder und Entwickler immer wieder zum Verzweifeln: Multilingualität.
Dies ist keineswegs eine neues Problem, aber auch kein altes. i18n hilft aus, wo Drupal nicht hilft, so dass man in der Lage ist, seine Seite zu übersetzen. Doch woher wissen, wo noch Übersetzungen fehlen? Oder in welchem Status sich eine Übersetzung befindet?
Wir brauchen also eine Möglichkeit, wie wir einen nicht übersetzen Node erkennen und taggen können und im besten Falle gleich einem User zur Übersetzung oder gar einem externen Übersetzungsdienstleister zuweisen können.
So ungefähr war das Ziel des Sprints in Zürich definiert, von jedem ein wenig anders interpretiert. Der Konsens entsprach dem Willen nach einer Möglichkeit, die diesen Zweck erfüllt.
Der angesetzte Codesprint, initiiert von den in Zürich ansässigen md-systems unter der Obhut von Miro Dietiker, fand im Zeitraum vom 16. - 22. Januar 2012 statt. Über eine Woche haben bis zu 23 (http://drupalevents.ch/drupal/codesprint-participants) Programmierer, Designer, Dokumentationsschreiber und Organisatoren daran gearbeitet diese Idee umzusetzen.
Nach 7 (für mich 6) spannenden Tagen der Planung, Diskussion und schlussendlich Programmierung ist ein recht ansehnliches Ergebnis zustande gebracht worden. Vor allem dank der großartigen Core-Arbeit von fubhy und berdir ist es möglich, jeden nur denkbaren Service zur Übersetzung zu integrieren und unter Umständen auch neue Sources hinzuzufügen.
Das Translation Management Tool hat derzeit Source-Plugins für Entitys, Fields, i18n_strings und Nodes. Für jede dieser Sources gibt es eine Übersicht der übersetzbaren Dinge und wie deren Status ist.
Integrierbare Services zur Übersetzung sind z.B. Microsoft Bing, HTML Export, Supertext, Mygengo und Nativy.
Das ganze Projekt ist noch nicht fertig, aber auch jetzt, nach dem Sprint, wird noch fleißig daran weiter gearbeitet, so dass es in naher Zukunft als vollständiges Projekt auf Drupal.org erscheinen kann. Mithilfe und Initiative ist natürlich auch gerne gesehen!
Insgesamt habe ich einen sehr positiven Eindruck von dem Sprint, da wir wirklich eine Menge erreicht haben und in Zukunft stark von der Vorarbeit, die dort geleistet wurde, profitieren werden.
Ein recht herzlichen Dank an alle Sponsoren, die diesen Event erst möglich gemacht haben und dank denen wir auch immer genügend Club Mate hatten! md-systems, amazee labs, Microsoft, ...
Mittlerweile hat sich das Entwickeln von Drupal-Seiten mit dem Modul Features durchgesetzt.
Manchmal braucht man um die gewohnte Funktionalität zu erreichen eine Template Datei. Um diese einzubinden ist mühsam.
Das Views Modul ab Version3 bietet hier einen sehr einfachen Weg.
Im featurename.features.inc muss man eine kleine Zeile ändern.
<?php
/**
* Implements hook_views_api().
*/
function news_views_api() {
return array("version" => "3.0", 'template path' => drupal_get_path('module', 'news') . '/templates');
}
?>
Sobald "template path" gesetzt ist wird dieses Verzeichnis als Views Templates gescannt und entsprechend eingebunden, siehe Bild.
Im Anhang befindet sich das komplette Beispiel-Feature, falls es sich jemand detailierter anschauen möchte.
Probleme:Leider aktualisiert das Feature-modul hook_views_api bei jedem Export, eventuell muss man hier noch einen einfacheren Weg finden.
Eine Möglichkeit wäre ein alte-hook für diesen Hook.
As default, Omega uses the h1.title in region--content.tpl.php.
When using panels, the panel title is used in $title. But what will happen if you want to use your headline inside your panel-layout? A use case might be a project where you have both sidebars in some parts of the project and panels in another part "simulating" a sidebar, for instance with block-styled content in the left panel pane, while main content goes into the right one. Now you will have the headline "within" the main content area on a sidebar display, while it's above the main content area on a panel display. If classic blocks are situated in a sidebar and block-styled content in a sidebar-like panel pane, they will now have a different upper margin relatively to the site header and the headline might also "flip" over the blocks on the left hand side.
As this is difficult to explain only using words, we have a little scheme here:
Our goal is that the H1 title headline "optically" behaves the same in the panel context as if we would just have a normal sidebar. So how to do this?
First, we have to add the title to the panel template.
If you use one of Omegas default panel layouts, copy and paste the layout from Omega to yourtheme/panels/layouts/ and open the *.tpl file. Add the h1 to the position where you want ot to appear (normally the main content part).
<h1 class="title" id="page-title"><?php print $display->get_title(); ?></h1>
($display->get_title() will catch the title that is defined in the panel.)
For custom templates, just add this code snippet to the place you want the title to be displayed.
Now the title should be displayed at the correct position. Or, at least, one of two, as now it is probably displayed twice, since it's still in region--content.tpl.php
However, we can't just remove it from there, because it should still be displayed if we are on a non panel page.
To check if the page is displayed with panels, you can use this function.
function has_panel() {
if (panels_get_current_page_display()) {
return true;
}
return false;
}
Put this in your template.php
Copy and paste the region--content.tpl from omega to your themes template folder and add the has_panel condition to the title request.
This should look like this:
<?php if ($title): ?>
Transform it to:
<?php if ($title && !has_panel()): ?>
Now it should work! Don't forget to set the titles in Panels now.
Im täglichen Einsatz von Panels ohne Panels Everywhere
tritt oft das Problem auf, dass bestimmte Module bisher nicht
mit Panels integriert sind, z.B. das Quiz Modul.
Eine Möglichkeit wäre es das entsprechende Modul zu erweitern,
aber klar das benötigt alles seine Zeit.
Swentel hat dafür eine Lösung: Page manager existing pages
Mit diesem Modul kann man jeden Drupal-Pfad übernehmen.
Um es zu benutzen geht man auf admin > structure > pages
und wählt dort "add existing pages".
Auf dieser Seite kann man unten Pfade eintippen, und es wird
via Autovervollständigung die entsprechende Seite angezeigt.
Sobald dies getan wurde findet man unter "admin > structure > pages" dieses Panel. Dies lässt sich konfigurieren wie jedes Panel.
Zu beachten ist hier das Pane "existing page", siehe Bild.
Dieses beinhaltet den bisherigen Inhalt der Seite.
Und siehe man hat aus der Panels-Konfiguration ein Panel gemacht
One major problem with using panels for all pages is
that many modules doesn't have built in integration
for panels. A solution to this problem is to write an
integration for the module to get the full control but
this sure needs some time. So Swentel wrote a
module which allows to take over any existing page, yes any!
To use it start on admin > structure > pages
and "add an existing page". Let's put the Panels configuration page into a panel, so input something into the search paths, see image.
Once you have done this go back to admin > structure > pages,
there you see "pm_existing_pages-{name you choosed above}"; enable it
and configure the panel.
One important pane you should know is under "existing page" -> "existing page":
That's all, see
Möchte man herausfinden, welche Mysql Abfragen
lange benötigten, so kann man die mysql-slow-query-logs benutzen.
Um dies zu aktivieren gibt es in der Mysql-Konfigurationsdatei folgende Zeilen:
log_slow_queries = /var/log/mysql/mysql-slow.log
long_query_time = 2
Sobald die erste Zeile gesetzt ist, werden alle Sql-Abfragen,
welche länger als 2 Sekunden dauern, in die Datei geschrieben.
Leider sind die Dateien selber dadurch sehr unübersichtlich,
da sie je nach long_query_time sehr viele Einträge hat.
Hierzu beitet sich das Tool mk-query-digest an/
Zur Installation ruft man
wget http://www.maatkit.org/get/mk-query-digest
chmod 700 mk-query-digest
auf.
Generell legt mysql nach bestimmter Zeit eine neue Log-Datei an
und packt die alte in eine .gz Datei.
Um nun mehrere GZ Dateien gleichzeitig zu untersuchen benutzt man
# Alle gz Dateien entpacken
gunzip *.gz
# Alle Dateien in eine Neue schreiben
cat *.log > slow-log
Diese Datei kann dann durch das obige Tool gelesen werden:
./mk-query-digest slow-log > analyze.log
Dort finden sich viele interessante Informationen, z.B. am Anfang eine Zusammenfassung:
# Profile
# Rank Query ID Response time Calls R/Call Apdx V/M Item
# ==== ================== =============== ===== ======= ==== ===== =======
# 1 0x12A44B5E1C8F4AB8 2298.0000 23.8% 155 14.8258 0.00 8.19 UPDATE node_counter
# 2 0xF6E057E4E0610CA9 2208.0000 22.9% 126 17.5238 0.00 8.69 INSERT accesslog
# 3 0x67A347A2812914DF 1094.0000 11.3% 85 12.8706 0.00 2.86 SELECT cache_views_data
# 4 0x7AF789F9862CBC08 923.0000 9.6% 99 9.3232 0.00 0.02 SELECT search_total search_index
# 5 0x67FB378EC58B6BB2 528.0000 5.5% 23 22.9565 0.00 11.57 INSERT term_node
Sowohl das Update der Tabelle node_counter und die Inserts in accesslog sind langsam. Man sollte sich also überlegen ob es Sinn macht das Statistik Modul zu benutzen.
In diesem Blog-Beitrag wurde also beschrieben wie
man Mysql-Slow-Query logs aktiviert und zusammenfasst.
Last weekend, between November 25th to 27th,
the awesome guys from Comm-Press hosted a views (code) sprint in their new office .
At first I was a little bit sceptical. Can you scale a codesprint up to 20 people?
But they proved it's definitive possible!
At Saturday everyone said hello to each other and Karsten started to throw in some ideas what people could do. It turned out there where enough tasks for everyone, such as:
Quite some people started with the issue triage aka rock in the issue queue.
For this, Karsten gave a really good explanation on how to act in the issue queue.
After that, around 10 people started to work on it, and the outcoming results blew my mind: they worked
on 250 isses within two days (c.f. http://drupal.org/project/issues/views?page=4&status=All ) accompanied by around 50 issues in several other issue queues. This impressive figures don't even include the work of the documentation and the UI team, because they did more kind of a preperation work for future issues.
The enviroment was incredible: We were provided with food, something to drink and even some nerf guns! Furthermore, special thanks go to @freudenreich_m and @ralfhendel for organizing the famous German hacker elixir "club-mate" at Sunday morning.
The total statistics:
* ~300 issues
* 60 commits directly to Views and 40 to other projects/sandboxes etc.
* 5 Nerf guns
Thanks for all people which took part or were involved via sponsoring etc.
The drupal community is unique!
A total list of the sprinters according to http://www.comm-press.de/blog/views-code-sprint-am-26271111-zur-comm-pre... :
There were also some remote part-time sprinters: das-peter, damz and maybe other people I forgot to mention (I apologize if that might have been the case).
Mit einem coolen Event feiern unsere Freunde von Comm-Press den Bezug ihrer neuen 200qm großen Räume. Am am 26. und 27. November findet in den neuen Comm-Press Räumen ein zweitägiger Views-Sprint statt.
Views gehört für uns alle mit zu dem wichtigsten Modul und der Sprint soll dazu beitragen, die Wissensbasis bei den Entwicklern zu festigen und zu erweitern. Comm-Press stellt die Räume und sorgt für das leibliche Wohl. Von erdfisch kommt Daniel Wehner aka dereine und unterstützt den Sprint. Als tatkräftiger Co-Maintainer kennt wohl kaum jemand Views so gut wie Daniel.
Damit sind alle Zutaten für ein geniales Sprintwochenende zusammen. Fehlt nur noch ihr! Meldet euch bitte bis zum 23. November bei Comm-Press an, damit die Jungs auch ordentlich planen können.
Let's rock Drupal!