// null => delete effectively, false => no deletion, SQL
var $delete_action;
var $delete_message;
+ // Should "Save" button return to the list view
+ var $auto_return = true;
+
/* table editor for platal
* $plname : the PLname of the page, ex: admin/payments
* $table : the table to edit, ex: profile_medals
}
return $entry;
}
+ // set whether the save button show redirect to list view or edit view
+ function list_on_edit($var)
+ {
+ $this->auto_return = $var;
+ }
// change display of a field
function describe($name, $desc, $display) {
$this->vars[$name]['desc'] = $desc;
XDB::execute("REPLACE INTO {$this->table} VALUES ($values)");
if ($id !== false)
$page->trig("L'entrée ".$id." a été mise à jour.");
- else
+ else {
$page->trig("Une nouvelle entrée a été créée.");
+ $id = XDB::insertId();
+ }
} else
$page->trig("Impossible de mette à jour.");
+ if (!$this->auto_return) {
+ return $this->apply($page, 'edit', $id);
+ }
}
if ($action == 'sort') {
$this->sortfield = $id;
$table_editor->describe('state', 'actif', true);
$table_editor->describe('text', 'texte (html) de l\'astuce', false);
$table_editor->describe('priorite', '0<=priorité<=255', true);
+ $table_editor->list_on_edit(false);
$table_editor->apply($page, $action, $id);
- if ($action == 'edit' && !is_null($id)) {
+ if (($action == 'edit' && !is_null($id)) || $action == 'update') {
$page->changeTpl('events/admin_tips.tpl');
}
}