diff options
author | Andrew Dolgov <[email protected]> | 2010-11-09 01:04:00 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2010-11-09 01:04:00 +0300 |
commit | 1c31e1908a1c8d8e46df83a756f2a5ad445ceb70 (patch) | |
tree | abef2cbd40d9c0ee4ef875ccd2760b3402fc4766 /modules | |
parent | ec16da866b94a9ddc00bffb0ed8c242edc33b4d1 (diff) |
allow adding labels on the fly
Diffstat (limited to 'modules')
-rw-r--r-- | modules/pref-filters.php | 5 | ||||
-rw-r--r-- | modules/pref-labels.php | 16 |
2 files changed, 18 insertions, 3 deletions
diff --git a/modules/pref-filters.php b/modules/pref-filters.php index f3ca8e4cb..c629f9c18 100644 --- a/modules/pref-filters.php +++ b/modules/pref-filters.php @@ -523,7 +523,8 @@ $result = db_query($link, "SELECT caption FROM ttrss_labels2 WHERE owner_uid = '".$_SESSION["uid"]."' ORDER BY caption"); - print "<select name=\"$name\" style=\"$style\">"; + print "<select default=\"$value\" name=\"$name\" style=\"$style\" + onchange=\"labelSelectOnChange(this)\" >"; while ($line = db_fetch_assoc($result)) { @@ -533,6 +534,8 @@ } + print "<option value=\"ADD_LABEL\">" .__("Add label...") . "</option>"; + print "</select>"; diff --git a/modules/pref-labels.php b/modules/pref-labels.php index a744b9f6a..d9cacecc3 100644 --- a/modules/pref-labels.php +++ b/modules/pref-labels.php @@ -93,15 +93,27 @@ } if ($subop == "add") { - $caption = db_escape_string($_REQUEST["caption"]); + $output = db_escape_string($_REQUEST["output"]); if ($caption) { if (label_create($link, $caption)) { - print T_sprintf("Created label <b>%s</b>", htmlspecialchars($caption)); + if (!$output) { + print T_sprintf("Created label <b>%s</b>", htmlspecialchars($caption)); + } } + if ($output == "select") { + header("Content-Type: text/xml"); + + print "<rpc-reply><payload><![CDATA["; + + print_label_select($link, "select_label", + $caption, ""); + + print "]]></payload></rpc-reply>"; + } } return; |