That's something that will likely end up in an addon, though it's just something I put together this afternoon to see how features can be "tweaked".
The droppy is generated by a jQuery plusing (I created a plugin because it may be used for other things as well
).
But the nicest thing (at least for me), is how the server-side code is handled.
In order to populate the droppy I needed to grab the mentions, so I decided to try to use any possible existing function, and I was able to to everything with just that code:
<?php
if (!defined('ELK'))
die('No access...');
require_once(CONTROLLERDIR . '/Mentions.controller.php');
class Mentions_ajax_Controller extends Mentions_Controller
{
public function action_list()
{
global $context;
parent::action_list();
$context['sub_template'] = 'json_mentions';
}
public function list_loadMentions($start, $limit, $sort, $all, $type)
{
global $context;
$limit = isset($_GET['limit']) ? (int) $_GET['limit'] : 5;
$limit = !empty($limit) ? $limit : 5;
$mentions = parent::list_loadMentions(0, $limit, $sort, true, $type);
foreach ($mentions as $id => $mention)
$context['json_data'][] = array(
'status' => $context['mentions_ajax'][$id],
'member' => $value['data']['id_member_from']['value'],
'message' => $value['data']['type']['value'],
'logtime' => $value['data']['log_time']['value'],
);
return $mentions;
}
}
About 40 lines of php in total.
Code reuse FTW!!