+ function hook_prefs_tab($args) {
+ if ($args != "prefPrefs") return;
+
+ print "<div dojoType=\"dijit.layout.AccordionPane\" title=\"".__("NSFW Plugin")."\">";
+
+ print "<br/>";
+
+ $tags = $this->host->get($this, "tags");
+
+ print "<form dojoType=\"dijit.form.Form\">";
+
+ print "<script type=\"dojo/method\" event=\"onSubmit\" args=\"evt\">
+ evt.preventDefault();
+ if (this.validate()) {
+ new Ajax.Request('backend.php', {
+ parameters: dojo.objectToQuery(this.getValues()),
+ onComplete: function(transport) {
+ notify_info(transport.responseText);
+ }
+ });
+ //this.reset();
+ }
+ </script>";
+
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"op\" value=\"pluginhandler\">";
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"method\" value=\"save\">";
+ print "<input dojoType=\"dijit.form.TextBox\" style=\"display : none\" name=\"plugin\" value=\"nsfw\">";
+
+ print "<table width=\"100%\" class=\"prefPrefsList\">";
+
+ print "<tr><td width=\"40%\">".__("Tags to consider NSFW (comma-separated)")."</td>";
+ print "<td class=\"prefValue\"><input dojoType=\"dijit.form.ValidationTextBox\" required=\"1\" name=\"tags\" value=\"$tags\"></td></tr>";
+
+ print "</table>";
+
+ print "<p><button dojoType=\"dijit.form.Button\" type=\"submit\">".
+ __("Save")."</button>";
+
+ print "</form>";
+
+ print "</div>"; #pane
+ }
+
+ function save() {
+ $tags = explode(",", db_escape_string($_POST["tags"]));
+ $tags = array_map("trim", $tags);
+ $tags = array_map("mb_strtolower", $tags);
+ $tags = join(", ", $tags);
+
+ $this->host->set($this, "tags", $tags);
+
+ echo __("Configuration saved.");
+ }
+