mirror of
https://git.tt-rss.org/fox/tt-rss.git
synced 2025-08-06 06:07:29 +02:00
Use 'clone' wording for filter duplication.
This commit is contained in:
parent
2eb3c150c2
commit
e546e73914
@ -506,7 +506,7 @@ class Pref_Filters extends Handler_Protected {
|
||||
$sth->execute([...$ids, $_SESSION['uid']]);
|
||||
}
|
||||
|
||||
private function _copy_rules_and_actions(int $filter_id, ?int $src_filter_id = null): bool {
|
||||
private function _clone_rules_and_actions(int $filter_id, ?int $src_filter_id = null): bool {
|
||||
$sth = $this->pdo->prepare('INSERT INTO ttrss_filters2_rules
|
||||
(filter_id, reg_exp, inverse, filter_type, feed_id, cat_id, match_on, cat_filter)
|
||||
SELECT :filter_id, reg_exp, inverse, filter_type, feed_id, cat_id, match_on, cat_filter
|
||||
@ -646,13 +646,13 @@ class Pref_Filters extends Handler_Protected {
|
||||
if ($src_filter_id === null)
|
||||
$this->_save_rules_and_actions($filter_id);
|
||||
else
|
||||
$this->_copy_rules_and_actions($filter_id, $src_filter_id);
|
||||
$this->_clone_rules_and_actions($filter_id, $src_filter_id);
|
||||
}
|
||||
|
||||
$this->pdo->commit();
|
||||
}
|
||||
|
||||
function copy(): void {
|
||||
function clone(): void {
|
||||
/** @var array<int, int> */
|
||||
$src_filter_ids = array_map('intval', array_filter(explode(',', clean($_REQUEST['ids'] ?? ''))));
|
||||
|
||||
@ -665,7 +665,7 @@ class Pref_Filters extends Handler_Protected {
|
||||
// see checkbox_to_sql_bool() for 0+1 justification
|
||||
$this->add([
|
||||
'src_filter_id' => $src_filter->id,
|
||||
'title' => sprintf(__('Copy of %s'), $src_filter->title),
|
||||
'title' => sprintf(__('Clone of %s'), $src_filter->title),
|
||||
'enabled' => 0,
|
||||
'match_any_rule' => $src_filter->match_any_rule ? 1 : 0,
|
||||
'inverse' => $src_filter->inverse ? 1 : 0,
|
||||
@ -707,8 +707,8 @@ class Pref_Filters extends Handler_Protected {
|
||||
|
||||
<button dojoType="dijit.form.Button" onclick="return Filters.edit()">
|
||||
<?= __('Create filter') ?></button>
|
||||
<button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').copySelectedFilters()">
|
||||
<?= __('Copy') ?></button>
|
||||
<button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').cloneSelectedFilters()">
|
||||
<?= __('Clone') ?></button>
|
||||
<button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').joinSelectedFilters()">
|
||||
<?= __('Combine') ?></button>
|
||||
<button dojoType="dijit.form.Button" onclick="return dijit.byId('filterTree').removeSelectedFilters()">
|
||||
|
@ -167,27 +167,28 @@ define(["dojo/_base/declare", "dojo/dom-construct", "lib/CheckBoxTree"], functio
|
||||
|
||||
return false;
|
||||
},
|
||||
copySelectedFilters: function() {
|
||||
cloneSelectedFilters: function() {
|
||||
const sel_rows = this.getSelectedFilters();
|
||||
|
||||
if (sel_rows.length > 0) {
|
||||
const query = {op: "Pref_Filters", method: "copy", ids: sel_rows.toString()};
|
||||
const query = {op: "Pref_Filters", method: "clone", ids: sel_rows.toString()};
|
||||
let proceed = false;
|
||||
|
||||
if (sel_rows.length === 1) {
|
||||
const selected_filter = this.model.getCheckedItems()[0];
|
||||
const new_title = prompt(__("Name for copied filter:"), 'Copy - ' + this.model.store.getValue(selected_filter, "bare_name"));
|
||||
const new_title = prompt(__("Name for new filter:"),
|
||||
__("Clone of %s").replace("%s", this.model.store.getValue(selected_filter, "bare_name")));
|
||||
|
||||
if (new_title) {
|
||||
query.new_title = new_title;
|
||||
proceed = true;
|
||||
}
|
||||
} else if (sel_rows.length > 1) {
|
||||
proceed = confirm(__("Copy selected filters?"));
|
||||
proceed = confirm(__("Clone selected filters?"));
|
||||
}
|
||||
|
||||
if (proceed) {
|
||||
Notify.progress("Copying selected filters...");
|
||||
Notify.progress(__("Cloning selected filters..."));
|
||||
|
||||
xhr.post("backend.php", query, () => {
|
||||
this.reload();
|
||||
|
Loading…
Reference in New Issue
Block a user