This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

AJAX form_autocomplete problems (CVS)

Hi,

I'm having some problem with AJAX form_autocomplete functionality from the CVS build.

When I navigate to my page with the form_autocomplete it works fine! But when I navigate to another page and again to the one with the form_automplete it doen't work anymore... The form_autocomplete field keeps loading and loading. Looks like a infinitive loop.

I've put in the code I'm using.
The form_autocomplete functionality is great but it doesn't look stable. Any help welcome.

Regards,
Marcel


<?php
// $Id$

/**
* Implementation of hook_help().
*/
function email_help($section='') {
$output = '';
switch ($section) {
case 'admin/modules#description':
$output = t('Allows messages to be send between users.');
break;
}
return $output;
} // function email_help

/**
* Implementation of hook_perm().
*/
function email_perm() {
return array('read messages', 'send messages');
} // function email_perm

/**
* Implementation of hook_menu().
*/
function email_menu($may_cache) {
global $user;

$read_messages = user_access('read messages' );
$send_messages = user_access('send messages' );

$items = array();
if ($may_cache) {
$items[] = array('path' => 'email/recipient_autocomplete',
'title' => t('email recipient autocomplete'),
'callback' => '_email_recipient_autocomplete',
'access' => $send_messages,
'type' => MENU_CALLBACK);
}
else {
$items[] = array('path' => 'email',
'title' => t('email') . ' (' . (int)_email_get_unread_messages() . ')',
'callback' => '_email_inbox',
'access' => $read_messages || $send_messages,
'type' => MENU_NORMAL_ITEM);
$items[] = array('path' => 'email/compose_message',
'title' => t('compose message'),
'callback' => '_email_compose_message',
'access' => $send_messages,
'type' => MENU_NORMAL_ITEM,
'weight' => 1);
$items[] = array('path' => 'email/inbox',
'title' => t('inbox'),
'callback' => '_email_inbox',
'access' => $read_messages,
'type' => MENU_NORMAL_ITEM,
'weight' => 2);
}
return $items;
} // function email_menu

/**
* Helper function for autocompletion
*/
function _email_recipient_autocomplete($string) {
$matches = array();
$sql = 'SELECT name ' .
'FROM {users} ' .
'WHERE LOWER(name) LIKE LOWER("%%%s%%") ' .
'AND status = 1';
$result = db_query_range($sql, $string, 0, 10);
while ($user = db_fetch_object($result)) {
$matches[$user->name] = check_plain($user->name);
}
print drupal_implode_autocomplete($matches);
exit();
} // _email_user_autocomplete

function _email_get_unread_messages($uid = 0) {
// return 3 while not implemented.
return 3;
} // function _email_get_unread_messages

function _email_compose_message() {
$output .= '

Compose Message

User-defined aggregator feeds

Hi there,
I'm looking to allow my registered users to select which RSS feeds will be displayed on their page. Anyone have ideas?

Thanks!
Cyrus

How to do multi-version modules

I have several customers with Drupal versions 4.5 and 4.6. Now I want to write a module that is compatible with both versions. Is there a way to check the drupal version so I can branch to the correct function calls?
For example checking the version to determine if I should use module_get_path or drupal_get_path.

What I don't want to do is fiddle with a version control system and having two branches.

httpclient for uploading images to galleries

Hi friends of the image module

Since there is no way to upload whole directories or archives into image galleries of drupal, I wrote a small command line tool in php5 to upload files from a local directory into a specified drupal gallery.

You can find the tool here on my homepage. The drupal relevant part has its own subdirectory. You have to edit drupal_upload.php and specify your user data, gallery-id (taxonomy-id), and the local directory containing the pics:

proper "drupal" way to send http response directly to the client

i want to create links in pages that when clicked on will result in a complete response (http header and body) sent to the client.

specifically, i want to send an extended m3u format playlist that will be generated dynamically (not stored on disc).

rather than hack it and create an external script that does it, i'd like to learn how this would be done drupal style.

i'm assumming i'd be writing a hook_* callback that would perform the task, but not sure which/how etc...

Blog module update

Hi all :)
Sorry if i make some mystake but i'm french so my english is not ( really not ) perfect ^^.
I'm looking for someone who can help me in develloping a module ( or something else ) who can allow someone who have a blog ( someone other than the admin ) to set his own logo ... Of course, all people are accepted, english or french :)
Thx,

Mat_

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions