Commit 216384cc authored by David Metzler's avatar David Metzler
Browse files

Working delete of report sections.

parent 184795a2
......@@ -10,6 +10,15 @@ define('FRX_SQL_TOKEN', '/(?<!(:|[a-zA-Z]|[0-9]|[_\.])):[a-zA-Z]([a-zA-Z]|[0-9]|
class Frx {
/**
* Helper method to return current url parameters.
* @return unknown
*/
public static function parms() {
$parms = $_GET;
unset($parms['q']);
return $parms;
}
/**
* Skin Factory
......
......@@ -919,7 +919,10 @@ class FrxEditor {
$options = array();
if ($context) $options['query'] = $context;
$o .= '<div class="forena-edit-links">' . l('Insert Data', "reports/$report_name/edit/select-data/prepend-data/$id") . "</div>";
$o .= '<div class="forena-edit-links">' . l($block_name, "reports/$report_name/edit/edit-data/$block_link/$id", $options ) . "</div>";
$o .= '<div class="forena-edit-links">'
. l($block_name, "reports/$report_name/edit/edit-data/$block_link/$id", $options )
. ' ' . l('Delete', "reports/$report_name/edit/delete-data/$id", $options)
. "</div>";
}
return $o;
......
......@@ -175,95 +175,105 @@ function forena_menu() {
);
$items['reports/%/edit/layout'] = array(
'title' => 'Layout',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_layout_form',1),
'access arguments' => array('design any report'),
'description' => 'Edit the layout of your report',
'type' => MENU_LOCAL_TASK,
'weight' => 1,
'file' => 'forena.admin.inc',
'title' => 'Layout',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_layout_form',1),
'access arguments' => array('design any report'),
'description' => 'Edit the layout of your report',
'type' => MENU_LOCAL_TASK,
'weight' => 1,
'file' => 'forena.admin.inc',
);
$items['reports/%/edit/edit-data/%/%'] = array(
'title' => 'Edit Block',
'file' => 'forena.report.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_report_data_block_form', 1, 3, 4, 5, 'edit-data'),
'access arguments' => array('design any report'),
'description' => 'Add a data block to your report',
'type' => MENU_CALLBACK,
'title' => 'Edit Block',
'file' => 'forena.report.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_report_data_block_form', 1, 3, 4, 5, 'edit-data'),
'access arguments' => array('design any report'),
'description' => 'Add a data block to your report',
'type' => MENU_CALLBACK,
);
$items['reports/%/edit/select-data/%'] = array(
'title' => 'Select Data Block',
'file' => 'forena.report.inc',
'page callback' => 'forena_select_block_list',
'page arguments' => array(1, 4),
'access arguments' => array('design any report'),
'description' => 'Select the data blcok to add',
'type' => MENU_CALLBACK,
'title' => 'Select Data Block',
'file' => 'forena.report.inc',
'page callback' => 'forena_select_block_list',
'page arguments' => array(1, 4),
'access arguments' => array('design any report'),
'description' => 'Select the data blcok to add',
'type' => MENU_CALLBACK,
);
$items['reports/%/edit/select-data/%/%'] = array(
'title' => 'Select Data Block',
'file' => 'forena.report.inc',
'page callback' => 'forena_select_block_list',
'page arguments' => array(1, 4, 5),
'access arguments' => array('design any report'),
'description' => 'Select the data blcok to add',
'type' => MENU_CALLBACK,
'title' => 'Select Data Block',
'file' => 'forena.report.inc',
'page callback' => 'forena_select_block_list',
'page arguments' => array(1, 4, 5),
'access arguments' => array('design any report'),
'description' => 'Select the data blcok to add',
'type' => MENU_CALLBACK,
);
$items['reports/%/edit/preview-data/%/%'] = array(
'title' => 'Preview Data Block',
'file' => 'forena.report.inc',
'page callback' => 'forena_report_block_preview',
'page arguments' => array(1, 4, 5),
'access arguments' => array('design any report'),
'description' => 'Select the data block to add',
'type' => MENU_CALLBACK,
'title' => 'Preview Data Block',
'file' => 'forena.report.inc',
'page callback' => 'forena_report_block_preview',
'page arguments' => array(1, 4, 5),
'access arguments' => array('design any report'),
'description' => 'Select the data block to add',
'type' => MENU_CALLBACK,
);
$items['reports/%/edit/preview-data/%/%/%'] = array(
'title' => 'Preview Data Block',
'file' => 'forena.report.inc',
'page callback' => 'forena_report_block_preview',
'page arguments' => array(1, 4, 5, 6),
'access arguments' => array('design any report'),
'description' => 'Select the data block to add',
'type' => MENU_CALLBACK,
);
'title' => 'Preview Data Block',
'file' => 'forena.report.inc',
'page callback' => 'forena_report_block_preview',
'page arguments' => array(1, 4, 5, 6),
'access arguments' => array('design any report'),
'description' => 'Select the data block to add',
'type' => MENU_CALLBACK,
);
$items['reports/%/edit/add-data/%'] = array(
'title' => 'Data',
'file' => 'forena.report.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_report_data_block_form', 1, 3, 4),
'access arguments' => array('design any report'),
'description' => 'Edit a data block on the report. ',
'type' => MENU_CALLBACK,
'title' => 'Data',
'file' => 'forena.report.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_report_data_block_form', 1, 3, 4),
'access arguments' => array('design any report'),
'description' => 'Edit a data block on the report. ',
'type' => MENU_CALLBACK,
);
$items['reports/%/edit/add-data/%/%'] = array(
'title' => 'Add Data',
'file' => 'forena.report.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_report_data_block_form', 1, 3, 4, 5),
'access arguments' => array('design any report'),
'description' => 'Edit a data block on the report. ',
'type' => MENU_CALLBACK,
'title' => 'Add Data',
'file' => 'forena.report.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_report_data_block_form', 1, 3, 4, 5),
'access arguments' => array('design any report'),
'description' => 'Edit a data block on the report. ',
'type' => MENU_CALLBACK,
);
$items['reports/%/edit/prepend-data/%/%'] = array(
'title' => 'Add Data',
'file' => 'forena.report.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_report_data_block_form', 1, 3, 4, 5),
'access arguments' => array('design any report'),
'description' => 'Edit a data block on the report. ',
'type' => MENU_CALLBACK,
'title' => 'Add Data',
'file' => 'forena.report.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_report_data_block_form', 1, 3, 4, 5),
'access arguments' => array('design any report'),
'description' => 'Edit a data block on the report. ',
'type' => MENU_CALLBACK,
);
$items['reports/%/edit/delete-data/%'] = array(
'title' => 'Delete Data',
'file' => 'forena.report.inc',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_report_delete_confirm', 1, 4),
'access arguments' => array('design any report'),
'description' => 'Delete this form',
'type' => MENU_CALLBACK,
);
$items['reports/%/edit/fields'] = array(
......
......@@ -461,5 +461,44 @@ function forena_report_block_preview($report_name, $action, $block_name, $id='')
}
function forena_report_delete_confirm($form, $form_state, $report_name, $id) {
$parms = $_GET;
unset($parms['q']);
$form['report_name'] = array(
'#type' => 'value',
'#value' => $report_name,
);
$form['id'] = array(
'#type' => 'value',
'#value' => $id,
);
$path = array('path' => "reports/$report_name/edit", 'options' => array('query' => $parms));
$form = confirm_form(
$form,
t('Are you sure you would like to remove the %s content', array('%s' => $id)),
$path,
'Detail blocks contain inside this block will also be deleted.',
'Yes', 'No'
);
return $form;
}
function forena_report_delete_confirm_submit($form, &$form_state) {
extract($form_state['values']);
// Delete the block
$r = Frx::Editor($report_name);
$r->deleteNode($id);
$r->update();
$parms = $_GET;
unset($parms['q']);
$form_state['redirect'] = array("reports/$report_name/edit", array('query' => $parms));
}
Markdown is supported
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