+ filter_file = csp->rlist;
+ filter_group = ((filter_file != NULL) ? filter_file->f : NULL);
+
+ if (!err) err = map_conditional(exports, "any-filters-defined", (filter_group != NULL));
+
+ if (err)
+ {
+ edit_free_file(file);
+ free_map(exports);
+ return err;
+ }
+
+ if (filter_group == NULL)
+ {
+ err = map(exports, "filter-params", 1, "", 1);
+ }
+ else
+ {
+ /* We have some entries in the filter list */
+ char * result;
+ int index = 0;
+ char * filter_template;
+
+ err = template_load(csp, &filter_template, "edit-actions-for-url-filter");
+ if (err)
+ {
+ edit_free_file(file);
+ free_map(exports);
+ if (err == JB_ERR_FILE)
+ {
+ return cgi_error_no_template(csp, rsp, "edit-actions-for-url-filter");
+ }
+ return err;
+ }
+
+ result = strdup("");
+
+ for (;(!err) && (filter_group != NULL); filter_group = filter_group->next)
+ {
+ char current_mode = 'x';
+ struct list_entry *filter_name;
+ char * this_line;
+ struct map *line_exports;
+ char number[20];
+
+ filter_name = cur_line->data.action->multi_add[ACTION_MULTI_FILTER]->first;
+ while ((filter_name != NULL)
+ && (0 != strcmp(filter_group->filtername, filter_name->str)))
+ {
+ filter_name = filter_name->next;
+ }
+
+ if (filter_name != NULL)
+ {
+ current_mode = 'y';
+ }
+ else
+ {
+ filter_name = cur_line->data.action->multi_remove[ACTION_MULTI_FILTER]->first;
+ while ((filter_name != NULL)
+ && (0 != strcmp(filter_group->filtername, filter_name->str)))
+ {
+ filter_name = filter_name->next;
+ }
+ if (filter_name != NULL)
+ {
+ current_mode = 'n';
+ }
+ }
+
+ /* Generate a unique serial number */
+ snprintf(number, sizeof(number), "%x", index++);
+ number[sizeof(number) - 1] = '\0';
+
+ line_exports = new_map();
+ if (line_exports == NULL)
+ {
+ err = JB_ERR_MEMORY;
+ freez(result);
+ }
+ else
+ {
+ if (!err) err = map(line_exports, "index", 1, number, 1);
+ if (!err) err = map(line_exports, "name", 1, filter_group->filtername, 1);
+ if (!err) err = map_radio(line_exports, "this-filter", "ynx", current_mode);
+
+ this_line = NULL;
+ if (!err)
+ {
+ this_line = strdup(filter_template);
+ if (this_line == NULL) err = JB_ERR_MEMORY;
+ }
+ if (!err) err = template_fill(&this_line, line_exports);
+ string_join(&result, this_line);
+
+ free_map(line_exports);
+ }
+ }
+ if (!err)
+ {
+ err = map(exports, "filter-params", 1, result, 0);
+ }
+ else
+ {
+ freez(result);
+ }
+ }
+
+ if (!err) err = map_radio(exports, "filter-all", "nx",
+ (cur_line->data.action->multi_remove_all[ACTION_MULTI_FILTER] ? 'n' : 'x'));
+