Commit c57f4590 authored by David Metzler's avatar David Metzler
Browse files

Changed logic to reference remove/revert instead of delete.

parent bba62bc6
......@@ -55,6 +55,7 @@ class FrxFile {
* @param string $prefix a prefix to use in the base name
*/
private function scanInclude($directory, $prefix='') {
$default = strpos($directory, $this->dir) === 0;
$files = array();
$this->scanDirectory($directory, $files);
foreach($files as $ext => $files_of_type ) {
......@@ -65,19 +66,28 @@ class FrxFile {
$obj->file = $file;
$obj->mtime = $mtime;
$obj->cache = NULL;
$obj->include = !$default;
$obj->override = FALSE;
$this->cache[$ext][$base_name] = $obj;
}
else {
// If its our first pas on this replace the entry
$entry = $this->cache[$ext][$base_name];
if (isset($this->filesToDelete[$ext][$base_name])) {
$entry = $this->cache[$ext][$base_name];
if ($entry->file != $file) {
$entry->file = $file;
$entry->cache = NULL;
$entry->mtime = $mtime;
$entry->include = !$default;
$entry->override = FALSE;
}
}
else {
if (!$entry->override) {
$entry->override = TRUE;
}
}
unset($this->filesToDelete[$ext][$base_name]);
}
}
......
......@@ -33,9 +33,24 @@ function forena_admin_reports() {
$result = Frx::File()->allReports();
foreach ($result as $row) {
$rpt = str_replace('/', '.', $row->name);
$edit = l(t('Edit'), 'reports/' . $rpt . '/edit');
if ($row->include) {
$edit = l(t('Override'), 'reports/' . $rpt . '/edit');
}
else {
$edit = l(t('Edit'), 'reports/' . $rpt . '/edit');
}
$clone = l(t('Clone'), 'reports/add/' . $rpt);
$delete = l(t('Delete'), 'reports/' . $rpt . '/delete', array('query' => array('destination' => 'admin/structure/forena')));
// Determine the nature of the report delete link.
if ($row->override) {
$delete = l(t('Revert'), 'reports/' . $rpt . '/delete', array('query' => array('destination' => 'admin/structure/forena')));
}
else if (!$row->include) {
$delete = l(t('Delete'), 'reports/' . $rpt . '/delete', array('query' => array('destination' => 'admin/structure/forena')));
}
else {
$delete = '';
}
$title = l(t($row->cache['title']), 'reports/' . $rpt);
$data[] = array($row->cache['category'], $title, $row->name, $edit . ' ' . $clone . ' ' . $delete);
}
......@@ -2035,7 +2050,7 @@ function forena_delete_form($form_state, $formid, $name_in) {
);
$form['delete_all_languages'] = array(
'#type' => 'radios',
'#title' => t('Delete report in all languages?'),
'#title' => t('Remove custom reports in all languages?'),
'#options' => $options,
'#default_value' => 'single',
);
......@@ -2045,10 +2060,10 @@ function forena_delete_form($form_state, $formid, $name_in) {
);
}
return confirm_form($form,
t('Are you sure you want to delete %title?', array('%title' => $report_name)),
t('Are you sure you want to remove %title?', array('%title' => $report_name)),
isset($_GET['destination']) ? $_GET['destination'] : $link,
t('This action cannot be undone.'),
t('Delete'),
t('Remove'),
t('Cancel')
);
return $form;
......
......@@ -211,7 +211,7 @@ function forena_menu() {
);
$items['reports/%/delete'] = array(
'title' => 'Delete Report',
'title' => 'Remove Custom Report',
'page callback' => 'drupal_get_form',
'page arguments' => array('forena_delete_form', 1),
'access arguments' => array('delete report'),
......
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