{
  "Publish_Add_Release": {
    "layout":"form",
    "unbound":true,
    "title":"Publish Release",
    "menu":"Publish",
    "breadcrumbs":"#CMS_SITE_BREADCRUMBS",
    "oninit": "jsh.System.RequireSite(xmodel);",
    "actions":"BU",
    "roles": {"PUBLISHER": "BU"},
    "onecolumn":true,
    "onload": "_this.onload();",
    "hide_system_buttons":["print","save"],
    "fields": [
      {"control":"html","value":[
        "<div class='jsHarmonyCms_info_tip'>",
        "Submit revisions for review, and then merge them into a Release on the <a href='<%=jsh._BASEURL%>{namespace}Branch_Active_Listing'>Active Revisions</a> page<br/>",
        "When the Release is ready, publish to a test or production deployment target below",
        "</div>",
      ]},
      {"name":"site_id","control":"dropdown","caption":"Site","validate":["Required"],"readonly":true,
        "lov":{"sql":"select site_id code_val, site_name code_txt from {schema}.site where site_sts='ACTIVE' and site_id={schema}.my_current_site_id()"}},
      {"name":"deployment_target_id","control":"dropdown","caption":"Deployment Target","validate":["Required"],
        "lov":{"parent":"site_id" ,"sql2":"select site_id code_parent, deployment_target_id code_val, deployment_target_name code_txt from {schema}.v_my_deployment_target where ((deployment_target_can_publish = 1) or (deployment_target_can_publish_release = 1)) and deployment_target_sts='ACTIVE' and site_id={schema}.my_current_site_id() order by site_id,deployment_target_name"}},
      {"control":"html","value":[
        "<% if(jsh.globalparams.isWebmaster){ %>",
        "<a href='#' onclick='<%=jsh._instance%>.XExt.popupForm(\"{namespace}Site_Tabs\",\"update\",{site_id:<%=jsh._instance%>.globalparams.site_id}); return false;'>Configure Deployment Targets</a>",
        "<% } %>",
      ]},
      {"name":"branch_id","control":"dropdown","caption":"Release","validate":["Required"],"onchange":"_this.branch_id_onchange(obj, newval, undoChange);",
        "lov":{"parent":"site_id" ,"sql2":"select site_id code_parent, branch_id code_val, branch_desc code_txt from {schema}.v_my_branch_desc where branch_type='PUBLIC' and branch_sts='ACTIVE' and site_id={schema}.my_current_site_id() order by site_id,branch_desc"}},
      {"name":"deployment_date","control":"textbox","caption":"Publish Date", "validate":["Required","IsDate:'YYYY-MM-DD hh:mm A'"],"default":"","controlstyle":"width:160px;"},
      {"name":"deployment_tag","control":"textbox_L","caption":"Tag", "validate":["Required","MaxLength:256"]},
      {"control":"button","value":"Schedule Deployment","controlstyle": "padding:3px 8px;margin-top:6px;","onclick": "_this.publish();"}
    ]
  },
  "Publish_Add_Release_Exec": {
    "layout": "exec",
    "title": "Add Deployment",
    "actions": "U",
    "roles": {"PUBLISHER": "BU"},
    "sqlexec": [
      "{schema}.insert_deployment(@site_id, @deployment_target_id, @branch_id, @deployment_date, @deployment_tag);"
    ],
    "fields": [
      {"name":"site_id", "actions":"BU", "type":"bigint", "caption":"Site ID", "validate": ["Required"]},
      {"name":"deployment_target_id", "actions":"BU", "type":"bigint", "caption":"Deployment Target ID", "validate": ["Required"]},
      {"name":"branch_id", "actions":"BU", "type":"bigint", "caption":"Branch ID", "validate": ["Required"]},
      {"name":"deployment_date", "actions":"BU", "type": "datetime", "length": 7, "caption":"Deployment Date", "validate": ["Required"]},
      {"name":"deployment_tag", "actions":"BU", "type":"varchar", "length": 256, "caption":"Deployment Tag", "validate": ["Required"]}
    ]
  }
}