t('YUI datatable settings'), 'page callback' => 'drupal_get_form', 'page arguments' => array('yui_datatable_settings_form'), 'access callback' => 'user_access', 'access arguments' => array('administer site configuration'), 'description' => t("View/Modify YUI datatable settings"), ); return $items; } /* * implementation of hook_perm(). */ function yui_datatable_perm() { $array = array('Access YUI datatable'); return $array; } /* *The settings page. */ function yui_datatable_settings_form() { $form = array(); return system_settings_form($form); } function yui_datatable_get_formatter($data) { } function theme_yui_datatable_table($header, $rows, $attributes = array(), $caption = NULL) { static $tableID; $tableID++; $thisTableID = 'table-' . $tableID; $thisMarkupID = 'markup-' . $tableID; render_datatable(); $attributes['id'] = $thisTableID; $sort = ''; foreach ($header as $row) { if (is_array($row)) { if ($row['data'] == NULL) { $row['data'] = ' '; } if (isset($row['sort'])) { $sort = ", { sortedBy : { key: '" . str_replace(' ', '', $row['data']) . "', dir : '" . $row['sort'] . "' } } "; } $rowJS .= "{ className : '" . $row['class'] . "', key : '" . str_replace(' ', '', $row['data']) . "', label : '" . $row['data'] . "', sortable : " . (isset($row['field']) ? 'true' : 'false') . " },"; } else { $rowJS .= "{ key : '$row', label : '$row' },"; } } foreach ($rows as $index => $row) { while (sizeof($rows[$index]) < sizeof($header)) { $rows[$index][] = array('data' => ' '); } } drupal_add_js(" YAHOO.util.Event.addListener(window, 'load', function() { YAHOO.example.EnhanceFromMarkup = new function() { var myColumnDefs = [ $rowJS ]; this.myDataSource = new YAHOO.util.DataSource(YAHOO.util.Dom.get('$thisTableID')); this.myDataSource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE; this.myDataSource.responseSchema = { fields: [ $rowJS ] }; this.myDataTable = new YAHOO.widget.DataTable('$thisMarkupID', myColumnDefs, this.myDataSource$sort); $('form table:has(th div.select-all):not(.tableSelect-processed)').each(Drupal.yui_datatable_select); }; });", "inline", "footer"); return '