Permalink
Browse files

Add create category functions to scanner permissions

  • Loading branch information...
cubehouse committed Sep 10, 2013
1 parent 1b4d4c2 commit da32b083e657749d09244f2e11bc80086777b0b1
Showing with 45 additions and 4 deletions.
  1. +42 −4 js/admin.js
  2. +3 −0 js/lists.js
View
@@ -92,7 +92,26 @@ define(["config", "popup", "api", "msg", "items", "forms", "jquery", "jqueryui/s
// add new category to this category
// note that cats usually report one item as it's top-rated item
- if (_config.settings.database_admin && list.type == "cat" && data && data.items && !data.items[0]) {
+ if (_config.settings.database_scan && list.type == "cat" && data && data.items && !data.items[0]) {
+ var dropdownOpts = [
+ {
+ name: "Space ID",
+ value: "space_id"
+ },
+ {
+ name: "Item ID",
+ value: "item_id"
+ }
+ ];
+
+ // only admins can do this one
+ if (_config.settings.database_admin) {
+ dropdownOpts.push({
+ name: "AZ4 CDN Filename",
+ value: "file"
+ });
+ }
+
menus.push(
{
name: "Add New Category",
@@ -103,13 +122,32 @@ define(["config", "popup", "api", "msg", "items", "forms", "jquery", "jqueryui/s
name: "name",
label: "Category Name"
},
+ {
+ type: "dropdown",
+ name: "iconsrc",
+ label: "<p style='margin:8px'>Icon Source</p>",
+ options: dropdownOpts
+ },
{
type: "text",
- name: "icon",
- label: "Icon"
+ name: "datainput",
+ label: "Icon Value (space ID, item ID etc.)"
}
], "Add New Child Category", function(form) {
- api.post("admin/add/cat/"+data.id, form, function(response) {
+ // sort out correct URL/postdata
+ var url = "add/cat";
+
+ // use a space icon
+ if (form.iconsrc == "space_id") {
+ url = "add/cat_space";
+ form.space_id = form.datainput;
+ } else if (form.iconsrc == "item_id") {
+ // use an item icon
+ url = "add/cat_item";
+ form.item_id = form.datainput;
+ }
+
+ api.post("admin/"+url+"/"+data.id, form, function(response) {
// show error/success message
if (response.error) {
msg.error(response.error);
View
@@ -230,6 +230,9 @@ define(["config", "nav", "img", "stars", "api", "items", "resize", "pricer", "ad
// render freebie links
page = page.replace(/\[free=([^\]]+)\]([A-Z]+)\[\/free\]/g, "<a href='"+_config.baseURL+"freebies/$2' class='loader'>$1</a>");
+ // search links!
+ page = page.replace(/\[search=([^\]]+)\]([a-zA-Z0-9 \'"_\-]+)\[\/search\]/g, "<a href='"+_config.baseURL+"search/$2' class='loader'>$1</a>");
+
// jQueryify
page = $("<div>").html(page);

0 comments on commit da32b08

Please sign in to comment.