Commit 1c71c94c authored by metzlerd's avatar metzlerd
Browse files

Added datatables support for structure page.

parent 79a724ec
......@@ -17,11 +17,17 @@ function forena_admin_reports() {
$content = drupal_get_form('forena_sync_form');
$output = drupal_render($content);
$output .= theme('links',
array(
'links' => $links,
'attributes' => array('class' => 'action-links'),
)
array(
'links' => $links,
'attributes' => array('class' => 'action-links'),
)
);
// Add Data tables if it exists.
drupal_add_css(drupal_get_path('module', 'forena') . '/forena.css');
if (file_exists('sites/all/libraries/dataTables/media/js/jquery.dataTables.min.js')) {
drupal_add_js(drupal_get_path('module', 'forena') . '/forena.admin.js');
drupal_add_js('sites/all/libraries/dataTables/media/js/jquery.dataTables.min.js');
}
$headers = array(t('title'), t('name'), t('category'), t('operation'));
$result = db_query('SELECT * FROM {forena_reports} where language=:language ORDER BY category,title', array(':language' => $language->language));
foreach ($result as $row) {
......@@ -32,7 +38,7 @@ function forena_admin_reports() {
$title = l(t($row->title), 'reports/' . $rpt);
$data[] = array($title, $row->report_name, $row->category, $edit . ' ' . $clone . ' ' . $delete);
}
$output .= theme_table(array('header' => $headers, 'rows' => $data, 'attributes' => array(), 'caption' => '', 'sticky' => TRUE, 'colgroups' => array(), 'empty' => ''));
$output .= theme_table(array('header' => $headers, 'rows' => $data, 'attributes' => array('class' => array( 'dataTable-paged')), 'caption' => '', 'sticky' => TRUE, 'colgroups' => array(), 'empty' => ''));
return $output;
}
......@@ -2122,6 +2128,26 @@ function forena_admin_params_form($formid, $form_state, $report_name) {
$filename = $desc['filename'];
$format = @$desc['format'];
if ($desc['exists'] && $name) {
// Set up basic control types.
$control_types= array('textfield' => 'Text',
'hidden' => 'Hidden',
'radios' => 'Radios',
'checkbox' => 'Checkbox',
'checkboxes' => 'Checkboxes',
'select' => 'Select',
'selectajax' => 'Select with Refresh',
'multiselect' => 'Multi-Select',
'multiselectajax' => 'Multi-select With Refresh',
);
// Supported module specific control types.
if (module_exists('date_api')) {
$control_types['date_select'] = 'Date Select';
}
if (module_exists('date_popup')) {
$control_types['date_popup'] = 'Date Popup';
}
//Construct report editor
$r = forena_get_report_editor($name);
drupal_set_title($r->title);
$form = array();
......@@ -2136,11 +2162,11 @@ function forena_admin_params_form($formid, $form_state, $report_name) {
$form['add_link'] = array(
'#type' => 'markup',
'#markup' => theme('links',
array(
'links' => $links,
'attributes' => array('class' => 'action-links'),
)
)
array(
'links' => $links,
'attributes' => array('class' => 'action-links'),
)
)
);
if ($r) $nodes = $r->simplexml->xpath('head/frx:parameters/frx:parm');
......@@ -2208,12 +2234,20 @@ function forena_admin_params_form($formid, $form_state, $report_name) {
'#description' => t('Enter a helpful description about this parameter. This will display on the form when the user is prompted to enter a parameter.'),
);
$form['params'][$id]['type'] = array(
'#type' => 'select',
'#title' => t('Input Control Type'),
'#default_value' => $type,
'#options' => $control_types,
'#description' => t('Enter a helpful description about this parameter. This will display on the form when the user is prompted to enter a parameter.'),
);
$form['params'][$id]['data_source'] = array(
'#type' => 'textfield',
'#title' => t('Data Source'),
'#default_value' => $data_source,
'#autocomplete_path' => 'forena/data_block/autocomplete',
'#description' => t('Data block to be used for list of values'),
'#description' => t('Data block to be used for select, multiselect, and checkboxes types'),
);
$form['params'][$id]['data_field'] = array(
......@@ -2222,30 +2256,6 @@ function forena_admin_params_form($formid, $form_state, $report_name) {
'#default_value' => $data_field,
'#description' => t('Column in data block to be used for ID'),
);
$control_types= array('textfield' => 'Text',
'hidden' => 'Hidden',
'radios' => 'Radios',
'checkbox' => 'Checkbox',
'checkboxes' => 'Checkboxes',
'select' => 'Select',
'selectajax' => 'Select with Refresh',
'multiselect' => 'Multi-Select',
'multiselectajax' => 'Multi-select With Refresh',
);
if (module_exists('date_api')) {
$control_types['date_select'] = 'Date Select';
}
if (module_exists('date_popup')) {
$control_types['date_popup'] = 'Date Popup';
}
$form['params'][$id]['type'] = array(
'#type' => 'select',
'#title' => t('Input Control Type'),
'#default_value' => $type,
'#options' => $control_types,
'#description' => t('Enter a helpful description about this parameter. This will display on the form when the user is prompted to enter a parameter.'),
);
$form['params'][$id]['options'] = array(
'#type' => 'textfield',
......
/**
* @file
* Legacy forena behaviors. These are deprecated.
*/
(function ($) {
Drupal.behaviors.forenaAdmin = {
attach: function (context, settings) {
$('table.dataTable-paged').dataTable({
"sPaginationType": "full_numbers"
});
}
};
})(jQuery);
......@@ -4,4 +4,71 @@ div.doclinks {
a.doclinks {
padding-left: 10px;
}
\ No newline at end of file
}
.paging_full_numbers a.paginate_button,
.paging_full_numbers a.paginate_active {
border: 1px solid;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
padding: 2px 5px;
margin: 0 3px;
cursor: pointer;
background-color : #eee ;
}
.paging_full_numbers {
width: 400px;
height: 22px;
line-height: 2em;
}
.paging_full_numbers a:active {
outline: none
}
.paging_full_numbers a:hover {
text-decoration: none;
}
.dataTables_wrapper {
clear: both;
zoom: 1; /* Feeling sorry for IE */
margin-bottom: 4em;
}
.dataTables_processing {
border: 1px solid #ddd;
background-color: white;
}
.dataTables_wrapper input {
border: solid 1px;
}
.dataTables_length {
width: 40%;
float: right;
text-align: right;
}
.dataTables_filter {
width: 50%;
float: left;
}
.dataTables_info {
width: 60%;
float: left;
}
.dataTables_paginate {
float: right;
text-align: right;
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment