2006-10-01 12:05:20 +02:00
|
|
|
<?php
|
|
|
|
function module_pref_filters($link) {
|
2009-12-29 16:49:27 +01:00
|
|
|
$subop = $_REQUEST["subop"];
|
|
|
|
$quiet = $_REQUEST["quiet"];
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2010-11-18 13:49:26 +01:00
|
|
|
if ($subop == "getfiltertree") {
|
|
|
|
$root = array();
|
|
|
|
$root['id'] = 'root';
|
|
|
|
$root['name'] = __('Filters');
|
|
|
|
$root['items'] = array();
|
|
|
|
|
|
|
|
$result = db_query($link, "SELECT
|
|
|
|
ttrss_filters.id AS id,reg_exp,
|
|
|
|
ttrss_filter_types.name AS filter_type_name,
|
|
|
|
ttrss_filter_types.description AS filter_type_descr,
|
|
|
|
enabled,
|
|
|
|
inverse,
|
|
|
|
feed_id,
|
|
|
|
action_id,
|
|
|
|
filter_param,
|
|
|
|
filter_type,
|
|
|
|
ttrss_filter_actions.description AS action_description,
|
|
|
|
ttrss_feeds.title AS feed_title,
|
|
|
|
ttrss_filter_actions.name AS action_name,
|
|
|
|
ttrss_filters.action_param AS action_param
|
|
|
|
FROM
|
|
|
|
ttrss_filter_types,ttrss_filter_actions,ttrss_filters LEFT JOIN
|
|
|
|
ttrss_feeds ON (ttrss_filters.feed_id = ttrss_feeds.id)
|
|
|
|
WHERE
|
|
|
|
filter_type = ttrss_filter_types.id AND
|
|
|
|
ttrss_filter_actions.id = action_id AND
|
|
|
|
ttrss_filters.owner_uid = ".$_SESSION["uid"]."
|
|
|
|
ORDER by action_description, reg_exp");
|
|
|
|
|
|
|
|
$cat = false;
|
|
|
|
$cur_action_description = "";
|
|
|
|
|
2010-11-20 19:08:12 +01:00
|
|
|
if (db_num_rows($result) > 0) {
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
if ($cur_action_description != $line['action_description']) {
|
|
|
|
|
|
|
|
if ($cat)
|
|
|
|
array_push($root['items'], $cat);
|
|
|
|
|
|
|
|
$cat = array();
|
|
|
|
$cat['id'] = 'ACTION:' . $line['action_id'];
|
|
|
|
$cat['name'] = $line['action_description'];
|
|
|
|
$cat['items'] = array();
|
|
|
|
|
|
|
|
$cur_action_description = $line['action_description'];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (array_search($line["action_name"],
|
|
|
|
array("score", "tag", "label")) === false) {
|
|
|
|
|
|
|
|
$line["action_param"] = '';
|
|
|
|
} else {
|
|
|
|
if ($line['action_name'] == 'label') {
|
|
|
|
|
|
|
|
$tmp_result = db_query($link, "SELECT fg_color, bg_color
|
|
|
|
FROM ttrss_labels2 WHERE caption = '".
|
|
|
|
db_escape_string($line["action_param"])."' AND
|
|
|
|
owner_uid = " . $_SESSION["uid"]);
|
|
|
|
|
|
|
|
if (db_num_rows($tmp_result) != 0) {
|
|
|
|
$fg_color = db_fetch_result($tmp_result, 0, "fg_color");
|
|
|
|
$bg_color = db_fetch_result($tmp_result, 0, "bg_color");
|
|
|
|
|
|
|
|
$tmp = "<span class=\"labelColorIndicator\" style='color : $fg_color; background-color : $bg_color'>α</span> " . $line['action_param'];
|
|
|
|
|
|
|
|
$line['action_param'] = $tmp;
|
|
|
|
}
|
2010-11-18 21:09:55 +01:00
|
|
|
}
|
2010-11-18 13:49:26 +01:00
|
|
|
}
|
2010-11-20 19:08:12 +01:00
|
|
|
|
|
|
|
$filter = array();
|
|
|
|
$filter['id'] = 'FILTER:' . $line['id'];
|
|
|
|
$filter['bare_id'] = $line['id'];
|
|
|
|
$filter['name'] = $line['reg_exp'];
|
|
|
|
$filter['type'] = $line['filter_type'];
|
|
|
|
$filter['enabled'] = sql_bool_to_bool($line['enabled']);
|
|
|
|
$filter['param'] = $line['action_param'];
|
|
|
|
$filter['inverse'] = sql_bool_to_bool($line['inverse']);
|
|
|
|
$filter['checkbox'] = false;
|
|
|
|
|
|
|
|
if ($line['feed_id'])
|
|
|
|
$filter['feed'] = $line['feed_title'];
|
|
|
|
|
|
|
|
array_push($cat['items'], $filter);
|
2010-11-18 13:49:26 +01:00
|
|
|
}
|
2010-11-20 19:08:12 +01:00
|
|
|
|
|
|
|
array_push($root['items'], $cat);
|
2010-11-18 13:49:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$fl = array();
|
|
|
|
$fl['identifier'] = 'id';
|
|
|
|
$fl['label'] = 'name';
|
|
|
|
$fl['items'] = array($root);
|
|
|
|
|
|
|
|
print json_encode($fl);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-10-01 12:05:20 +02:00
|
|
|
if ($subop == "edit") {
|
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$filter_id = db_escape_string($_REQUEST["id"]);
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
$result = db_query($link,
|
|
|
|
"SELECT * FROM ttrss_filters WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]);
|
|
|
|
|
2007-05-19 16:09:16 +02:00
|
|
|
$reg_exp = htmlspecialchars(db_fetch_result($result, 0, "reg_exp"));
|
2006-10-01 12:05:20 +02:00
|
|
|
$filter_type = db_fetch_result($result, 0, "filter_type");
|
|
|
|
$feed_id = db_fetch_result($result, 0, "feed_id");
|
|
|
|
$action_id = db_fetch_result($result, 0, "action_id");
|
2006-12-08 08:21:44 +01:00
|
|
|
$action_param = db_fetch_result($result, 0, "action_param");
|
2008-12-13 14:49:19 +01:00
|
|
|
$filter_param = db_fetch_result($result, 0, "filter_param");
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
$enabled = sql_bool_to_bool(db_fetch_result($result, 0, "enabled"));
|
2007-01-30 17:23:35 +01:00
|
|
|
$inverse = sql_bool_to_bool(db_fetch_result($result, 0, "inverse"));
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2007-03-02 21:58:29 +01:00
|
|
|
print "<form id=\"filter_edit_form\" onsubmit='return false'>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2010-11-20 12:10:26 +01:00
|
|
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pref-filters\">";
|
|
|
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"id\" value=\"$filter_id\">";
|
|
|
|
print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"subop\" value=\"editSave\">";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
$result = db_query($link, "SELECT id,description
|
|
|
|
FROM ttrss_filter_types ORDER BY description");
|
|
|
|
|
|
|
|
$filter_types = array();
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
//array_push($filter_types, $line["description"]);
|
2007-08-10 18:16:43 +02:00
|
|
|
$filter_types[$line["id"]] = __($line["description"]);
|
2006-10-01 12:05:20 +02:00
|
|
|
}
|
|
|
|
|
2008-08-06 08:47:56 +02:00
|
|
|
print "<div class=\"dlgSec\">".__("Match")."</div>";
|
|
|
|
|
|
|
|
print "<div class=\"dlgSecCont\">";
|
|
|
|
|
2008-12-13 13:35:26 +01:00
|
|
|
if ($filter_type != 5) {
|
2009-01-11 09:50:16 +01:00
|
|
|
$date_ops_invisible = 'style="display : none"';
|
2008-12-13 13:35:26 +01:00
|
|
|
}
|
|
|
|
|
2010-11-20 12:10:26 +01:00
|
|
|
print "<span id=\"filterDlg_dateModBox\" $date_ops_invisible>";
|
2008-12-13 13:35:26 +01:00
|
|
|
print __("Date") . " ";
|
2008-12-13 14:49:19 +01:00
|
|
|
|
|
|
|
$filter_params = array(
|
|
|
|
"before" => __("before"),
|
|
|
|
"after" => __("after"));
|
|
|
|
|
|
|
|
print_select_hash("filter_date_modifier", $filter_param,
|
2010-11-20 12:10:26 +01:00
|
|
|
$filter_params, 'dojoType="dijit.form.Select"');
|
2008-12-13 14:49:19 +01:00
|
|
|
|
|
|
|
print " </span>";
|
2008-12-13 13:35:26 +01:00
|
|
|
|
2010-11-20 12:10:26 +01:00
|
|
|
print "<input dojoType=\"dijit.form.ValidationTextBox\"
|
|
|
|
required=\"1\"
|
|
|
|
name=\"reg_exp\" style=\"font-size : 16px;\" value=\"$reg_exp\">";
|
2008-08-06 08:47:56 +02:00
|
|
|
|
2010-11-20 12:10:26 +01:00
|
|
|
print "<span id=\"filterDlg_dateChkBox\" $date_ops_invisible>";
|
2010-11-20 12:53:52 +01:00
|
|
|
print " <button dojoType=\"dijit.form.Button\" onclick=\"return filterDlgCheckDate()\">".
|
2010-11-11 21:33:52 +01:00
|
|
|
__('Check it')."</button>";
|
2008-12-13 13:35:26 +01:00
|
|
|
print "</span>";
|
|
|
|
|
2010-11-21 20:55:57 +01:00
|
|
|
print "<hr/> " . __("on field") . " ";
|
2008-12-13 13:35:26 +01:00
|
|
|
print_select_hash("filter_type", $filter_type, $filter_types,
|
2010-11-20 12:10:26 +01:00
|
|
|
'onchange="filterDlgCheckType(this)" dojoType="dijit.form.Select"');
|
2008-08-06 08:47:56 +02:00
|
|
|
|
2010-11-21 20:55:57 +01:00
|
|
|
print "<hr/>";
|
2008-08-06 08:47:56 +02:00
|
|
|
|
|
|
|
print __("in") . " ";
|
2010-11-20 12:10:26 +01:00
|
|
|
print_feed_select($link, "feed_id", $feed_id,
|
|
|
|
'dojoType="dijit.form.FilteringSelect"');
|
2008-08-06 08:47:56 +02:00
|
|
|
|
|
|
|
print "</div>";
|
|
|
|
|
2008-08-06 09:51:28 +02:00
|
|
|
print "<div class=\"dlgSec\">".__("Perform Action")."</div>";
|
2008-08-06 08:47:56 +02:00
|
|
|
|
|
|
|
print "<div class=\"dlgSecCont\">";
|
|
|
|
|
2010-11-20 12:10:26 +01:00
|
|
|
print "<select name=\"action_id\" dojoType=\"dijit.form.Select\"
|
2008-08-06 08:47:56 +02:00
|
|
|
onchange=\"filterDlgCheckAction(this)\">";
|
|
|
|
|
|
|
|
$result = db_query($link, "SELECT id,description FROM ttrss_filter_actions
|
|
|
|
ORDER BY name");
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
2010-11-20 12:10:26 +01:00
|
|
|
$is_sel = ($line["id"] == $action_id) ? "selected=\"1\"" : "";
|
2008-08-06 08:47:56 +02:00
|
|
|
printf("<option value='%d' $is_sel>%s</option>", $line["id"], __($line["description"]));
|
|
|
|
}
|
|
|
|
|
|
|
|
print "</select>";
|
|
|
|
|
2009-01-18 09:28:42 +01:00
|
|
|
$param_hidden = ($action_id == 4 || $action_id == 6 || $action_id == 7) ? "" : "display : none";
|
2008-08-06 08:47:56 +02:00
|
|
|
|
2010-11-20 12:10:26 +01:00
|
|
|
print "<span id=\"filterDlg_paramBox\" style=\"$param_hidden\">";
|
2008-08-07 05:17:24 +02:00
|
|
|
print " " . __("with parameters:") . " ";
|
2009-01-18 09:28:42 +01:00
|
|
|
|
|
|
|
$param_int_hidden = ($action_id != 7) ? "" : "display : none";
|
|
|
|
|
2010-11-20 12:10:26 +01:00
|
|
|
print "<input style=\"$param_int_hidden\"
|
|
|
|
dojoType=\"dijit.form.TextBox\" id=\"filterDlg_actionParam\"
|
2008-08-07 05:17:24 +02:00
|
|
|
name=\"action_param\" value=\"$action_param\">";
|
2009-01-18 09:28:42 +01:00
|
|
|
|
|
|
|
$param_int_hidden = ($action_id == 7) ? "" : "display : none";
|
|
|
|
|
|
|
|
print_label_select($link, "action_param_label", $action_param,
|
2010-11-20 12:10:26 +01:00
|
|
|
"style=\"$param_int_hidden\"" .
|
|
|
|
'id="filterDlg_actionParamLabel" dojoType="dijit.form.Select"');
|
2009-01-18 09:28:42 +01:00
|
|
|
|
2008-08-07 05:17:24 +02:00
|
|
|
print "</span>";
|
2008-08-06 08:47:56 +02:00
|
|
|
|
2008-08-07 05:17:24 +02:00
|
|
|
print " "; // tiny layout hack
|
2008-08-06 08:47:56 +02:00
|
|
|
|
|
|
|
print "</div>";
|
|
|
|
|
|
|
|
print "<div class=\"dlgSec\">".__("Options")."</div>";
|
|
|
|
print "<div class=\"dlgSecCont\">";
|
|
|
|
|
2008-08-06 09:51:28 +02:00
|
|
|
print "<div style=\"line-height : 100%\">";
|
|
|
|
|
2008-08-06 08:47:56 +02:00
|
|
|
if ($enabled) {
|
2010-11-20 12:10:26 +01:00
|
|
|
$checked = "checked=\"1\"";
|
2008-08-06 08:47:56 +02:00
|
|
|
} else {
|
|
|
|
$checked = "";
|
|
|
|
}
|
|
|
|
|
2010-11-20 12:10:26 +01:00
|
|
|
print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"enabled\" id=\"enabled\" $checked>
|
2010-11-21 20:55:57 +01:00
|
|
|
<label for=\"enabled\">".__('Enabled')."</label><hr/>";
|
2008-08-06 08:47:56 +02:00
|
|
|
|
|
|
|
if ($inverse) {
|
2010-11-20 12:10:26 +01:00
|
|
|
$checked = "checked=\"1\"";
|
2008-08-06 08:47:56 +02:00
|
|
|
} else {
|
|
|
|
$checked = "";
|
|
|
|
}
|
|
|
|
|
2010-11-20 12:10:26 +01:00
|
|
|
print "<input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" name=\"inverse\" id=\"inverse\" $checked>
|
2008-08-06 08:47:56 +02:00
|
|
|
<label for=\"inverse\">".__('Inverse match')."</label>";
|
|
|
|
|
|
|
|
print "</div>";
|
2008-08-06 09:51:28 +02:00
|
|
|
print "</div>";
|
2008-08-06 08:47:56 +02:00
|
|
|
|
|
|
|
print "<div class=\"dlgButtons\">";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2008-08-07 05:17:24 +02:00
|
|
|
print "<div style=\"float : left\">";
|
2010-11-21 10:08:03 +01:00
|
|
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').removeFilter()\">".
|
2010-01-12 13:56:29 +01:00
|
|
|
__('Remove')."</button>";
|
2008-08-07 05:17:24 +02:00
|
|
|
print "</div>";
|
|
|
|
|
2010-11-20 12:53:52 +01:00
|
|
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').execute()\">".
|
2010-01-12 13:56:29 +01:00
|
|
|
__('Save')."</button> ";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2010-11-20 12:53:52 +01:00
|
|
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('filterEditDlg').hide()\">".
|
2010-01-12 13:56:29 +01:00
|
|
|
__('Cancel')."</button>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2010-11-20 12:10:26 +01:00
|
|
|
print "</div>";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($subop == "editSave") {
|
|
|
|
|
2010-01-20 10:29:28 +01:00
|
|
|
global $memcache;
|
|
|
|
|
|
|
|
if ($memcache) $memcache->flush();
|
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$reg_exp = db_escape_string(trim($_REQUEST["reg_exp"]));
|
|
|
|
$filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
|
|
|
|
$filter_id = db_escape_string($_REQUEST["id"]);
|
|
|
|
$feed_id = db_escape_string($_REQUEST["feed_id"]);
|
|
|
|
$action_id = db_escape_string($_REQUEST["action_id"]);
|
|
|
|
$action_param = db_escape_string($_REQUEST["action_param"]);
|
|
|
|
$action_param_label = db_escape_string($_REQUEST["action_param_label"]);
|
|
|
|
$enabled = checkbox_to_sql_bool(db_escape_string($_REQUEST["enabled"]));
|
|
|
|
$inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"]));
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2008-12-13 14:49:19 +01:00
|
|
|
# for the time being, no other filters use params anyway...
|
2009-12-29 16:49:27 +01:00
|
|
|
$filter_param = db_escape_string($_REQUEST["filter_date_modifier"]);
|
2008-12-13 14:49:19 +01:00
|
|
|
|
2006-10-01 12:05:20 +02:00
|
|
|
if (!$feed_id) {
|
|
|
|
$feed_id = 'NULL';
|
|
|
|
} else {
|
|
|
|
$feed_id = sprintf("'%s'", db_escape_string($feed_id));
|
|
|
|
}
|
2009-01-18 09:28:42 +01:00
|
|
|
|
|
|
|
/* When processing 'assign label' filters, action_param_label dropbox
|
|
|
|
* overrides action_param */
|
|
|
|
|
|
|
|
if ($action_id == 7) {
|
|
|
|
$action_param = $action_param_label;
|
|
|
|
}
|
|
|
|
|
2006-10-01 12:05:20 +02:00
|
|
|
$result = db_query($link, "UPDATE ttrss_filters SET
|
|
|
|
reg_exp = '$reg_exp',
|
|
|
|
feed_id = $feed_id,
|
|
|
|
action_id = '$action_id',
|
|
|
|
filter_type = '$filter_type',
|
2006-12-08 08:21:44 +01:00
|
|
|
enabled = $enabled,
|
2007-01-30 17:23:35 +01:00
|
|
|
inverse = $inverse,
|
2008-12-13 14:49:19 +01:00
|
|
|
action_param = '$action_param',
|
|
|
|
filter_param = '$filter_param'
|
2007-03-05 13:50:46 +01:00
|
|
|
WHERE id = '$filter_id' AND owner_uid = " . $_SESSION["uid"]);
|
2006-10-01 12:05:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($subop == "remove") {
|
2010-01-28 16:52:46 +01:00
|
|
|
|
|
|
|
if ($memcache) $memcache->flush();
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2007-03-05 13:50:46 +01:00
|
|
|
foreach ($ids as $id) {
|
|
|
|
db_query($link, "DELETE FROM ttrss_filters WHERE id = '$id' AND owner_uid = ". $_SESSION["uid"]);
|
2006-10-01 12:05:20 +02:00
|
|
|
}
|
2010-11-21 10:08:03 +01:00
|
|
|
return;
|
2006-10-01 12:05:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($subop == "add") {
|
2010-01-28 16:52:46 +01:00
|
|
|
|
|
|
|
if ($memcache) $memcache->flush();
|
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$regexp = db_escape_string(trim($_REQUEST["reg_exp"]));
|
|
|
|
$filter_type = db_escape_string(trim($_REQUEST["filter_type"]));
|
|
|
|
$feed_id = db_escape_string($_REQUEST["feed_id"]);
|
|
|
|
$action_id = db_escape_string($_REQUEST["action_id"]);
|
|
|
|
$action_param = db_escape_string($_REQUEST["action_param"]);
|
|
|
|
$action_param_label = db_escape_string($_REQUEST["action_param_label"]);
|
|
|
|
$inverse = checkbox_to_sql_bool(db_escape_string($_REQUEST["inverse"]));
|
2007-03-05 13:50:46 +01:00
|
|
|
|
2008-12-13 14:49:19 +01:00
|
|
|
# for the time being, no other filters use params anyway...
|
2009-12-29 16:49:27 +01:00
|
|
|
$filter_param = db_escape_string($_REQUEST["filter_date_modifier"]);
|
2008-12-13 14:49:19 +01:00
|
|
|
|
2007-03-05 13:50:46 +01:00
|
|
|
if (!$regexp) return;
|
|
|
|
|
|
|
|
if (!$feed_id) {
|
|
|
|
$feed_id = 'NULL';
|
|
|
|
} else {
|
|
|
|
$feed_id = sprintf("'%s'", db_escape_string($feed_id));
|
|
|
|
}
|
|
|
|
|
2009-01-18 11:04:54 +01:00
|
|
|
/* When processing 'assign label' filters, action_param_label dropbox
|
|
|
|
* overrides action_param */
|
|
|
|
|
|
|
|
if ($action_id == 7) {
|
|
|
|
$action_param = $action_param_label;
|
|
|
|
}
|
|
|
|
|
2007-03-05 13:50:46 +01:00
|
|
|
$result = db_query($link,
|
|
|
|
"INSERT INTO ttrss_filters (reg_exp,filter_type,owner_uid,feed_id,
|
2008-12-13 13:22:16 +01:00
|
|
|
action_id, action_param, inverse, filter_param)
|
2007-03-05 13:50:46 +01:00
|
|
|
VALUES
|
|
|
|
('$regexp', '$filter_type','".$_SESSION["uid"]."',
|
2008-12-13 13:22:16 +01:00
|
|
|
$feed_id, '$action_id', '$action_param', $inverse, '$filter_param')");
|
2007-03-05 13:50:46 +01:00
|
|
|
|
2007-03-05 14:45:34 +01:00
|
|
|
if (db_affected_rows($link, $result) != 0) {
|
|
|
|
print T_sprintf("Created filter <b>%s</b>", htmlspecialchars($regexp));
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
2006-10-01 12:05:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($quiet) return;
|
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$sort = db_escape_string($_REQUEST["sort"]);
|
2006-10-01 12:05:20 +02:00
|
|
|
|
|
|
|
if (!$sort || $sort == "undefined") {
|
|
|
|
$sort = "reg_exp";
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = db_query($link, "SELECT id,description
|
|
|
|
FROM ttrss_filter_types ORDER BY description");
|
|
|
|
|
|
|
|
$filter_types = array();
|
|
|
|
|
|
|
|
while ($line = db_fetch_assoc($result)) {
|
|
|
|
//array_push($filter_types, $line["description"]);
|
|
|
|
$filter_types[$line["id"]] = $line["description"];
|
|
|
|
}
|
|
|
|
|
2008-05-17 04:52:46 +02:00
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
$filter_search = db_escape_string($_REQUEST["search"]);
|
2008-05-17 04:52:46 +02:00
|
|
|
|
2009-12-29 16:49:27 +01:00
|
|
|
if (array_key_exists("search", $_REQUEST)) {
|
2008-05-17 04:52:46 +02:00
|
|
|
$_SESSION["prefs_filter_search"] = $filter_search;
|
|
|
|
} else {
|
|
|
|
$filter_search = $_SESSION["prefs_filter_search"];
|
|
|
|
}
|
2010-11-17 12:49:06 +01:00
|
|
|
|
|
|
|
print "<div id=\"pref-filter-wrap\" dojoType=\"dijit.layout.BorderContainer\" gutters=\"false\">";
|
|
|
|
print "<div id=\"pref-filter-header\" dojoType=\"dijit.layout.ContentPane\" region=\"top\">";
|
|
|
|
print "<div id=\"pref-filter-toolbar\" dojoType=\"dijit.Toolbar\">";
|
2008-05-17 04:52:46 +02:00
|
|
|
|
2010-11-17 19:39:51 +01:00
|
|
|
print "<div dojoType=\"dijit.form.DropDownButton\">".
|
|
|
|
"<span>" . __('Select')."</span>";
|
|
|
|
print "<div dojoType=\"dijit.Menu\" style=\"display: none;\">";
|
2010-11-18 13:49:26 +01:00
|
|
|
print "<div onclick=\"dijit.byId('filterTree').model.setAllChecked(true)\"
|
2010-11-17 19:39:51 +01:00
|
|
|
dojoType=\"dijit.MenuItem\">".__('All')."</div>";
|
2010-11-18 13:49:26 +01:00
|
|
|
print "<div onclick=\"dijit.byId('filterTree').model.setAllChecked(false)\"
|
2010-11-17 19:39:51 +01:00
|
|
|
dojoType=\"dijit.MenuItem\">".__('None')."</div>";
|
|
|
|
print "</div></div>";
|
|
|
|
|
2010-11-17 19:13:41 +01:00
|
|
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"return quickAddFilter()\">".
|
2010-11-20 22:34:18 +01:00
|
|
|
__('Create filter')."</button> ";
|
2007-03-02 20:16:45 +01:00
|
|
|
|
2010-11-17 19:13:41 +01:00
|
|
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"return editSelectedFilter()\">".
|
2010-11-20 22:34:18 +01:00
|
|
|
__('Edit')."</button> ";
|
2006-10-01 12:05:20 +02:00
|
|
|
|
2010-11-17 19:13:41 +01:00
|
|
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"return removeSelectedFilters()\">".
|
2010-11-20 22:34:18 +01:00
|
|
|
__('Remove')."</button> ";
|
2010-01-11 16:43:53 +01:00
|
|
|
|
2010-11-10 09:49:31 +01:00
|
|
|
if (defined('_ENABLE_FEED_DEBUGGING')) {
|
2010-11-17 19:13:41 +01:00
|
|
|
print "<button dojoType=\"dijit.form.Button\" onclick=\"rescore_all_feeds()\">".
|
2010-11-20 22:34:18 +01:00
|
|
|
__('Rescore articles')."</button> ";
|
2010-11-10 09:49:31 +01:00
|
|
|
}
|
2008-05-04 06:46:14 +02:00
|
|
|
|
2010-11-17 12:49:06 +01:00
|
|
|
print "</div>"; # toolbar
|
|
|
|
print "</div>"; # toolbar-frame
|
|
|
|
print "<div id=\"pref-filter-content\" dojoType=\"dijit.layout.ContentPane\" region=\"center\">";
|
|
|
|
|
2010-11-18 13:49:26 +01:00
|
|
|
print "<div id=\"filterlistLoading\">
|
|
|
|
<img src='images/indicator_tiny.gif'>".
|
|
|
|
__("Loading, please wait...")."</div>";
|
|
|
|
|
|
|
|
print "<div dojoType=\"dojo.data.ItemFileWriteStore\" jsId=\"filterStore\"
|
|
|
|
url=\"backend.php?op=pref-filters&subop=getfiltertree\">
|
|
|
|
</div>
|
|
|
|
<div dojoType=\"lib.CheckBoxStoreModel\" jsId=\"filterModel\" store=\"filterStore\"
|
|
|
|
query=\"{id:'root'}\" rootId=\"root\" rootLabel=\"Feeds\"
|
|
|
|
childrenAttrs=\"items\" checkboxStrict=\"false\" checkboxAll=\"false\">
|
|
|
|
</div>
|
|
|
|
<div dojoType=\"fox.PrefFilterTree\" id=\"filterTree\"
|
|
|
|
model=\"filterModel\" openOnClick=\"true\">
|
|
|
|
<script type=\"dojo/method\" event=\"onLoad\" args=\"item\">
|
|
|
|
Element.hide(\"filterlistLoading\");
|
|
|
|
</script>
|
2010-11-21 21:05:51 +01:00
|
|
|
<script type=\"dojo/method\" event=\"onClick\" args=\"item\">
|
|
|
|
var id = String(item.id);
|
|
|
|
var bare_id = id.substr(id.indexOf(':')+1);
|
|
|
|
|
|
|
|
if (id.match('FILTER:')) {
|
|
|
|
editFilter(bare_id);
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2010-11-18 13:49:26 +01:00
|
|
|
</div>";
|
2010-11-17 12:49:06 +01:00
|
|
|
|
|
|
|
print "</div>"; #pane
|
|
|
|
print "</div>"; #container
|
2006-10-01 12:05:20 +02:00
|
|
|
}
|
2009-01-18 09:28:42 +01:00
|
|
|
|
2006-10-01 12:05:20 +02:00
|
|
|
?>
|