{
  "Branch_Add_Empty": {
    "layout":"form",
    "title":"New Empty Revision",
    "menu":"Revisions",
    "breadcrumbs":"#CMS_SITE_BREADCRUMBS",
    "oninit": "jsh.System.RequireSite(xmodel);",
    "onecolumn":true,
    "roles": {"AUTHOR": "BU","PUBLISHER": "BU"},
    "sqlselect":[
      "select ",
      "'PUBLIC' new_branch_type,",
      "'' new_branch_name"
    ],
    "sqlupdate":[
      "begin transaction;",
      "insert into {schema}.v_my_current_branch(branch_type, branch_name, site_id) values(@new_branch_type, @new_branch_name, @new_site_id);",
      "insert into {schema}.v_my_sitemap(sitemap_name, sitemap_type) values('Primary Sitemap', 'PRIMARY');",
      "commit transaction;",
    ],
    "hide_system_buttons":["print","save"],
    "fields": [
      {"name":"branch_id","type":"bigint","control":"hidden","key":true},
      {"control":"html","value":[
        "<div class='jsHarmonyCms_info_tip'>",
        "Create a new empty Revision without any pages, media, or menus.<br/>",
        "If you would like to make changes to an existing site, <a href='<%=jsh._BASEURL%>{namespace}Branch_Active_Listing'>clone a Release</a> instead.",
        "</div>",
      ]},
      {"name":"source_site_name","control":"label","caption":"New Revision","controlstyle":"margin-right:0px;"},
      {"name":"new_site_id","type":"bigint","control":"hidden","default":"js:jsh.globalparams.site_id","validate":["Required"]},
      {"name":"new_site_name","control":"label","controlstyle":"margin-right:4px;","readonly":true,"caption":"","caption_ext":"Site","validate":["Required"],"nl":false,"default":"js:jsh.globalparams.site_name"},
      {"control":"html","value":"/&nbsp;","nl":false},
      {"name":"new_branch_type","actions":"BU","type":"varchar","control":"dropdown","caption":"","nl":false,
        "controlstyle":"margin-right:0px;","validate":["Required"],"caption_ext":"Revision Location",
        "lov":{ "sql": "select 'PUBLIC' code_val, 'Release' code_txt where ({schema}.my_user_is_publisher({schema}.my_current_site_id()) = 1) union all select 'USER' code_val, (select concat(sys_user_fname,' ',sys_user_lname) from jsharmony.sys_user where jsharmony.sys_user.sys_user_id=jsharmony.my_sys_user_id()) code_txt" } },
      {"control":"html","value":"&nbsp;/&nbsp;","nl":false},
      {"name":"new_branch_name","actions":"BU","type":"varchar","control":"textbox","caption":"","nl":false,"validate":["Required"],"caption_ext":"New Revision Name","focus":true,"controlparams":{"placeholder":"New Revision Name"}},
      {"control":"button","value":"Create","controlstyle": "padding:3px 8px;margin-top:6px;","onclick": "if(!xmodel.controller.form.Data.Commit()) return; XForm.prototype.XExecutePost(xmodel.id+'/?branch_id='+xmodel.get('branch_id'), { new_site_id: xmodel.get('new_site_id'), new_branch_type: xmodel.get('new_branch_type'), new_branch_name: xmodel.get('new_branch_name') }, function(rslt){ xmodel.controller.form.ResetDirty(); XExt.navTo(jsh._BASEURL+xmodel.module_namespace+'Sitemap_Listing_Redirect'); });"}
    ]
  }
}
