A client needed a bit more styling on the node admin form than was there. I needed the filtering options to match a normal drupal form so I could use its styles.
I've worked up the table header using drupal_render. In the process I added an autocomplete to the userFilter. I thought you might want to take a look over. At some point you could output this through a theme and let people alter it more if needed. I would normally give you a line break down, but there's just a ton of changes. It'd be over whelming. I'll just leave the parts commented out above the new methods. (Note that I did not do the 'add node.' I've had to disable that for reasons in another issue.)
* Callback for generating nodeadmin page.
*/
function nodeadmin_page() {
global $base_url;
// build map of content type names
$types = array();
$types[''] = 'All';
$ctypes = node_get_types();
foreach ($ctypes as $ctype => $cdata) {
$types[$ctype] = $cdata->name;
}
// generate content administration page
/*
$output = '<div>Filter by type: <select id="filterType"><option value="" selected>All</option>';
foreach ($types as $ctype => $cname) {
$output .= '<option value="' . $ctype .'">'. $cname .'</option>';
}
$output .= '</select></div>';
*/
$form = array();
$form['type_filter'] = array(
'#type' => 'select',
'#title' => 'Filter by type',
'#options' => $types,
'#weight' => -5,
'#id' => 'filterType',
);
//$output .= '<div>Filter by author: <input id="filterUser" type="text" size="20" value="" /></div>';
$form['author_filter'] = array(
'#type' => 'textfield',
'#title' => 'Filter by user',
'#autocomplete_path' => 'user/autocomplete',
'#weight' => -4,
'#id' => 'filterUser',
);
if (module_exists('search')) {
//$output .= '<div>Filter by text content: <input id="filterText" type="text" size="20" value="" /></div>';
$form['text_filter'] = array(
'#type' => 'textfield',
'#title' => 'Filter by text',
'#weight' => -3,
'#id' => 'filterText',
);
}
//$output .= '<div>Results per page: <input id="optionLimit" type="text" size="6" value="50" /><span id="numberResults"> </span><div id="pageResults"></div></div>';
$form['limit'] = array(
'#type' => 'textfield',
'#title' => 'Results per page',
'#value' => 50,
'#weight' => -2,
'#id' => 'optionLimit',
);
$form['numberResults'] = array(
'#weight' => -1,
'#value' => '<div id="pageResults"></div><span id="numberResults"> </span>',
);
//$output .= '</div>';
/*$output .= '<br/><div class="nodeadmin-addnode"><img src="'. $base_url .'/'. drupal_get_path('module', 'nodeadmin') .'/icons/doc-option-add.png" width="16" height="16" /> Add new content by type: <select id="addType"><option value="" selected></option>';
foreach ($ctypes as $ctype => $cdata) {
$output .= '<option value="' . $ctype .'">'. $cdata->name .'</option>';
}
$output .= '</select></div>';
*/
$output .= '<div class="nodeadmin-options"><form>'.drupal_render($form).'</form></div>';
Comments
Comment #1
lance.gliser commentedHmm...
Well the autocomplete works in Firefox, but it doesn't in IE 7. It might be because both the autocomplete and nodeadmin fire events for change.
The filtering still works, it's autocomplete that fails. I've tried commenting out your code to see if it activates, I'm still getting nothing.
Comment #2
alisonThank you (both you and detour obviously) for all your work on this and other issues. Anything a non-programmer/developer -- but still quite competent with basic/intermediate-level web "things," even if my vocabulary isn't top-notch :) -- like me could do to help?