{
  "Sitemap_Tree": {
    "layout":"form",
    "table":"",
    "actions":"BIUD",
    "roles": {"AUTHOR": "BIUD","PUBLISHER": "BIUD","VIEWER":"B"},
    "title": { "sql": "select concat('Pages (Sitemap View) :: ',sitemap_name) from {schema}.v_my_sitemap where sitemap_key=@sitemap_key" },
    "caption":["Sitemap","Sitemaps"],
    "unbound":true,
    "menu":"jsHarmonyCMS/Sitemap_Listing",
    "breadcrumbs":"#CMS_BRANCH_BREADCRUMBS",
    "hide_system_buttons" : ["print","export","help","delete"], 
    "oninit": "_this.oninit();",
    "onload": "_this.onload();",
    "buttons":[
      { "name": "search", "link":"Page_Search","icon":"search","text":"Search","roles": { "AUTHOR": "B", "PUBLISHER": "B", "VIEWER":"B" }, "bindings": {} },
      { "name":"configureSitemaps", "link":"Sitemap_Listing&","icon":"edit","text":"Sitemap Config", "actions": "U", "roles": { "AUTHOR": "U", "PUBLISHER": "U" } },
      { "name":"saveSitemap", "link":"js:_this.save();","icon":"save","text":"Save (Autosave Enabled)", "actions": "IUD" }
    ],
    "fields":[
      {"name":"sitemap_key","control":"hidden","type":"bigint","key":true},
      {"name":"form_instructions","control":"html","value":[
        "<div style='position:relative;top:-4px;'><span style='font-size:1.3em;position:relative;top:1px;margin-right:2px;margin-left:4px;'>&#x1f6c8;</span> Manage pages in the Sitemap View :: Select or right-click for options :: Double-click to edit a page :: Drag to reorder</div>",
      ]},
	    {"control": "html", "value": "<div class=\"clear\"></div><div class='<%=model.class%>_browser'>" },
      {"name": "sitemap_item_id", "actions": "BIUD","foreignkey":1,"caption": "","control": "tree",
       "unbound": 1, "always_editable":1,
       "controlparams": {
          "expand_all": true,
          "item_context_menu": [
            { "icon": "add", "text": "Add Home Page", "command": "_this.addSitemapPage(context_item, 'home');", "actions": "I", "onrender": "return _this.sitemap_item_id_context_menu_onrender(context_item, 'add_home', this);" },
            { "icon": "add", "text": "Add Child Page", "command": "_this.addSitemapPage(context_item);", "actions": "I" },
            { "icon": "add", "text": "Add Child Menu Item", "command": "_this.addSitemapItem(context_item);", "actions": "I" },
            { "icon": "edit", "text": "Edit Page", "command": "_this.getSitemapItemPageKey(context_item, function(page_key){ _this.editPageContent(page_key); });", "actions": "U", "onrender": "return _this.sitemap_item_id_context_menu_onrender(context_item, 'edit', this);" },
            { "icon": "list", "text": "Page Settings", "command": "_this.getSitemapItemPageKey(context_item, function(page_key){ _this.editPageSettings(page_key); });", "actions": "U", "onrender": "return _this.sitemap_item_id_context_menu_onrender(context_item, 'page');" },
            { "icon": "refresh", "text": "View Page Revisions", "command": "_this.getSitemapItemPageKey(context_item, function(page_key){ _this.viewPageRevisions(page_key); });", "actions": "U", "onrender": "return _this.sitemap_item_id_context_menu_onrender(context_item, 'page');" },
            { "icon": "copy", "text": "Duplicate Page", "command": "_this.getSitemapItemPageKey(context_item, function(page_key){ _this.duplicatePage(_this.getSitemapItemParentID(context_item), page_key); });", "actions": "I", "onrender": "return _this.sitemap_item_id_context_menu_onrender(context_item, 'page');" },
            { "icon": "delete", "text": "Delete", "command": "_this.deleteSitemapItem(context_item);", "actions": "D", "onrender": "return _this.sitemap_item_id_context_menu_onrender(context_item, 'delete');" }
          ],
          "item_dropdown": { "caption": "Actions" },
          "onmove": "return _this.sitemap_item_id_onmove(dragval, dropval, anchor, e);",
          "drag_anchor_settings": { "anchors": ["top","bottom","full"] }
        },
        "onchange": "_this.sitemap_item_id_onchange(obj, newval, undoChange, e);"
      },
      {
        "name": "Sitemap_Tree_Info",
        "control": "subform",
        "target": "Sitemap_Tree_Info",
        "bindings": { "sitemap_item_id": "sitemap_item_id" },
        "caption": "",
        "actions": "BIUD"
      },
      {"control":"html", "value": "</div>"},
      {"control":"hidden", "name":"page_template_id", "lov":"#LOV_CMS_PAGE_TEMPLATES" },
      "#CMS_SITE_EDITOR_LOV",
      {"name":"revision_page","unbound":true,"control":"hidden","bindings":{"revision_page_key":"js:if(xmodel) return jsh.App[xmodel.id].revision_page_key;"},
        "popuplov": {"target": "Page_Revision_Listing", "code_val": "page_id", "popupstyle": "height:400px;width:770px;", "popupiconstyle": "display:none;"}
      }
    ]
  },
  "Sitemap_Tree_Browse": {
    "inherits": "Sitemap_Tree",
    "actions": "B",
    "breadcrumbs": "__REMOVEPROPERTY__",
    "popup": [1000, 600],
    "fields":[
      {"name":"form_instructions","__REMOVE__":true},
    ]
  },
  "Sitemap_Tree_Page_Duplicate": {
    "layout": "exec",
    "title": "Duplicate File",
    "actions": "U",
    "roles": {"AUTHOR": "U","PUBLISHER": "U"},
    "sqlexec": [
      "{schema}.duplicate_page(@page_key, @page_path, @page_title)"
    ],
    "fields": [
      {"name":"page_key", "actions":"U", "type":"bigint", "caption":"Page Key", "validate": ["Required"]},
      {"name":"page_path", "actions":"U", "type":"varchar", "length": 2048, "caption":"Page Folder", "validate": ["Required"]},
      {"name":"page_title", "actions":"U", "type":"varchar", "length": 1024, "caption":"Page Title"}
    ]
  }
}