Got this nice feedback today from gnome while trying to copy some files, seems that my beloved DE really suits it’s title:D

Traq, the new kid on the block.
I was looking for something like trac the other day, because trac is a pain to set up and just a little too much for my small company. After browsing around for a while I came a cross this new project that simply runs on php/mysql, it’s called traq and my first impressions are positive.
I haven’t given it much testing yet, but I added a couple of our projects and successfully connected them to their dedicated svn repo. At a first glance it appears to have everything I am looking for in a ticket system, it can handle all the stuff I find most important like:
- access control
- users & groups
- tickets
- roadmap
- changelog
- wiki
You can browse the source of your repos, view revisions and you even get some graphs. The interface could use some polishing but overall it looks pretty nice, and if it does the job, I really don’t care:) A couple of other things worth to mention is that it also has support for themes and 3rd-party plugins.
Honestly I wish I could write a little bit more detailed, but I’ve only scratched the surface yet, so we’ll see. Visit traq for more information.
WordPress jquery form plugin, json parsing and IE
I have just recently written a Web Shop plugin for some clients, but after upgrading one of their sites to WordPress 3.2.1 it made my checkout code flip backwards in ie7 and ie8.
After some debugging and googeling I found out that older versions of IE has some problems handling application/json mime type (This is the correct header content-type by the way). So instead of content-type application/json I had to change it to text/plain, pass the data as an array and then json_encode, this worked for IE9 but still not for IE7/8. So after a few hours of more debugging I came to realize that this thing works fine using WordPress 3.1.3, so I began to compare the differences. It turns out that the jquery form plugin I was using in WordPress 3.2.1 was not working so well, after copying over from 3.1.3 it was all good, even down to IE7.
So if you want to make IE happy, stay away from jquery form plugin 2.7.3 and use content-type: text/plain in your headers, below is an example of how I do this for the klarna gateway module to make it work:
// Ajax Form Options.
var options = {
target: '#shop-ajax-response',
beforeSubmit: validate,
success: respond,
url: shop_frontend_ajax.ajaxurl,
data: {action: 'checkout_order'},
dataType: 'json',
cache: false
};
// Bind form using 'ajaxForm'.
jQuery("#dishop-checkout-form").ajaxForm(options);
$feedback .= '<p class="shop-message">'.$shop_gateway_msg.' | '.$klarna_result.'</p>';
if(defined('DOING_AJAX')) {
$response = array('success' => false, 'modal' => true, 'feedback' => $feedback);
header('Content-type: text/plain; charset=utf-8');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: 0");
echo json_encode($response);
exit;
}
I know this is a half-way solution, I intend to notify about this problem so it can get fixed:)
Using custom fields to sort posts
Recently I’ve been working with a client that wanted me to create a way to sort recipes into different types of food and under different types of dishes. This had me thinking about custom fields where you have meta_key and meta_value for each key. The client also wanted to use this in other scenarios so basically i started thinking it should be sorted on categories as well. The function takes one argument which is the category slug, it will then loop through meta_keys belonging to that category, secondly the meta_values and third each posts matching that specific value.
It’s a whole new take on the custom field principle, since you basically start with the meta_key and not the post itself. Probably not the prettiest code in the world, but it does the job:) And it uses definition lists which is ideal here, below the function there’s a css example aswell.
To use this code, put it in your theme’s functions.php and fetch it in your desired template with
function cfMenu($catID) {
global $wpdb, $post;
$catID = get_cat_id('Mat');
$queryKey = "SELECT DISTINCT meta_key FROM $wpdb->postmeta
LEFT JOIN $wpdb->term_relationships AS tr ON $wpdb->postmeta.post_id = tr.object_id
LEFT JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id
WHERE SUBSTRING(meta_key,1,1) != '_' AND tt.term_id = '$catID'";
$cfKeys = $wpdb->get_results($queryKey, OBJECT);
echo '<div id="cfMenu">';
foreach ($cfKeys as $cfKey) {
echo '<dl>';
echo '<h3 class="cfKey">'.$cfKey->meta_key.'</h3>';
$queryValue = "SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = '$cfKey->meta_key'";
$cfValues = $wpdb->get_results($queryValue, OBJECT);
foreach ($cfValues as $cfValue) {
echo '<dt class="cfValue">'.$cfValue->meta_value.'</dt>';
$cfPosts = get_posts('meta_value='.$cfValue->meta_value);
foreach ($cfPosts as $cfPost) {
$permalink = get_permalink($cfPost->ID);
echo '<dd class="cfTitle">» <a href='.$permalink.'>'.$cfPost->post_title.'</a></dd>';
}
}
echo '</dl>';
}
echo '</div>';
}
Here’s a CSS example to get you started
#cfMenu {
float: left;
display: inline;
}
#cfMenu h3 {
margin: 0 0 0 0;
padding: 0 0 0 0;
}
#cfMenu dl {
float: left;
width: 230px;
margin-right: 10px;
margin-bottom: 20px;
}
#cfMenu dt {
font-weight: bold;
margin: 5px 0 0 0;
padding: 0 0 0 10px;
}
#cfMenu dd {
margin: 0 0 2px 0;
padding: 0 0 0 10px;
font-size: 90%;
}
A Smarter Menu for WordPress
With the release of wordpress 3.0 this function is no longer needed, I’d like to thank everyone showing interest in it:) I’ve always thought it would be nice to combine pages and categories all inside one menu, and recently I was looking for a nice way to add subtitles as well. So I thought it would be cool to write my own menu function to suit my own needs. Continue reading →
SHR Logo Contest
These are my entries for the SHR Logo Contest Each variant comes in two versions, black & white and colors. These are vectors and can easily be modified/converted. The cogwheel and the drawn one are my personal favorites. I wanted to keep it earthy and simple, no fancy web2.0 bs! :D Hope you guys will enjoy these!
Continue reading →
Paroli UI/Theme proposals
Hello! I will now present a proposal that I have made for paroli. Each photo comes with it’s own description. These are just mock-ups and are meant to be a base proposal for further development of paroli. I am not a developer and so I am not familiar with potential limitations. So there might be stuff here that in reality won’t work with paroli.