wp2drupal module for drupal 6

Submitted by DenRaf on Thu, 06/19/2008 - 21:41

On my previous post (link) about this, the port was just in a state of "It works for me". But as commented on the post and I heard from others it wasn't working.

But for a new project it was required to work again :)

So after some little changes everything was working. As prove my colleague Dieter ported his blog from wordpress 2.5. Thanks to Dieter for the help.

The module can use a cleanup, but it works.

faceted_search module for drupal 6

Submitted by DenRaf on Wed, 06/11/2008 - 09:27

For a project I needed the faceted_search module and that project was screaming for being made in Drupal 6. Since there isn't a drupal 6 version of this module, I decided to just port it myself.

The patch isn't complete yet. I just ported the things we needed directly. When I have some spare time, I will continue the port.

Faceted Search Views and Field Keyword Filter are untested, but the views will not work for sure, since it's not updated yet for views 2.

Create custom user filter in Drupal

Submitted by DenRaf on Tue, 06/03/2008 - 22:21

For a little project I needed to list all users, but not with the default user information, but with extra profile_values. Since users were not known by username, but by user id, I wanted a filter for a quick search.

In my module I recreated the form:

function messageboard_form_alter($form_id, &$form) {
if ($form_id == 'user_filter_form') {
unset($form['filters']['status']['status']); // remove status filter
unset($form['filters']['status']['permission']); // remove permission filter

$form['filters']['filter'] = array (
'#type' => 'radios',
'#options' => array (
'role' => role, // keep role filter
'uid' => uid // add my uid filter
)
);
$form['filters']['status']['uid'] = array (
'#type' => 'textfield',
'#size' => 18,
);
}
)

At first I also had the code added to fill the user_overview_filter session array with the values of the added filter, but then I got a SQL error.

At the end I saw no other way then editing the user_filters() function in the user.module like this:
$sql = db_query("SELECT uid FROM {users}");
while($row = db_fetch_array($sql)) {
$options[$row['uid']] = $row['uid'];
}
$filters['uid'] = array('title' => t('number'),
'where' => 'u.uid = %d',
'options' => $options,
);

The options are necessary if you want the text of the search displayed correctly.

I would be nice if there was some kind of hook for editing these filters. If so, please let me know. I really don't like to edit core modules.

Flat jscalendar in Drupal 5

Submitted by DenRaf on Sat, 05/31/2008 - 13:40

How to make a flat jscalendar in drupal.

Download and install the jstools module and activate the jscalendar module.

Then in /path/to/jstools/jscalendar/jscalendar.js change the calendar setup into:

Calendar.setup({
flat : "calendar-container", // ID of the parent element
flatCallback : dateChanged // our callback function
});

And at the flatCallback function:
function dateChanged(calendar) {
// Beware that this function is called even if the end-user only
// changed the month/year. In order to determine if a date was
// clicked you can use the dateClicked property of the calendar:
if (calendar.dateClicked) {
// OK, a date was clicked, redirect to /yyyy/mm/dd/index.php
var y = calendar.date.getFullYear();
var m = calendar.date.getMonth() + 1; // integer, 1..12
var d = calendar.date.getDate(); // integer, 1..31
// redirect...
window.location = "/" + y + "/" + m + "/" + d + "index.php";
}
};

Then in your form:

$form['date'] = array(
'#type' => 'textfield',
'#attributes' => array('class' => 'jscalendar'),
'#jscalendar_showsTime' => 'false',
'#suffix' => '',
);

Then I added display:none to nearly all entries in jscalendar.css so that the textbox and the image don't appear anymore.

It is not the cleanest way of doing things, but it works and you still can select the wished theme in your jscalendar settings.

Dynamic selectbox in Drupal

Submitted by DenRaf on Tue, 05/27/2008 - 19:40

For a subscribing form I need a dynamic selectbox, which was reloaded when a first selectbox was changed.

I tried activeselect, which worked in my testing environment, but not on the actual site which had a hook_regions (bug: http://drupal.org/node/125451).

Hierarchical select was just not the way to go in case of this site. It required the use of vocabularies, while I was working with database content directly. And so many other solutions I tried, but without the wished result. After some searching I found this: http://f5sitedesign.com/drupalcamp.
After modifying the module, I finally had it working.

Attached you can find a simple module. As you can see in the code it requires the location module and some content in the db. I'll see if I can provide some data for in the location db.

It provides a lillte module for subscriptions. In this case it's for selecting a province which will load the second selectbox with offices in that province. It's not the best example. because for this you can use HS, but atleast you get an idea.

The module provided at the drupalcamp site shows an example with replacing text in a div and the principal for this is just the same. So you can replace anything you want as long as you have an id to hook in to.

CentOs 5 on Dell R200

Submitted by DenRaf on Sun, 04/27/2008 - 00:38

For our company there was a need to do some expansion and we decided to do that with the Dell R200.

Since it was just the new version of the PowerEdge 860 ( an other server we have ) I thought it would be fairly easy to install this machine, since I had the kickstart and all other docs and scripts of the 860 installation. But that turned out otherwise.
After trying and failing several times, it was time for googling.
Went through several pages till I hit this one: http://www.jameslittle.me.uk/installing-centos-5-on-a-dell-r200/

It saved my day.