{
  "Branch_Clone": {
    "layout":"form",
    "title":"Clone Revision",
    "menu":"Revisions",
    "onecolumn":true,
    "roles": {"AUTHOR": "BU","PUBLISHER": "BU"},
    "sqlselect":[
      "select ",
      "(select branch_desc from {schema}.v_my_branch_desc where branch_id=@branch_id) source_branch_name,",
      "(select site_name from {schema}.v_my_branch_desc where branch_id=@branch_id) source_site_name,",
      "(select branch_type from {schema}.v_my_branch_desc where branch_id=@branch_id) source_branch_type,",
      "'USER' new_branch_type,",
      "'COPY' new_branch_changes,",
      "'' new_branch_name"
    ],
    "sqlupdate":"insert into {schema}.v_my_current_branch(branch_parent_id, branch_type, branch_name, new_branch_changes) values(@branch_id, @new_branch_type, @new_branch_name, @new_branch_changes);",
    "hide_system_buttons":["print","save"],
    "onload": "_this.onload();",
    "fields": [
      {"name":"branch_id","type":"bigint","control":"hidden","key":true},
      {"name":"source_branch_name","control":"label","caption":"Source Revision","captionstyle":"text-align:right;font-weight:bold;"},
      {"name":"source_site_name","control":"label","caption":"New Revision","captionstyle":"text-align:right;font-weight:bold;","controlstyle":"margin-right:0px;"},
      {"name":"source_branch_type","control":"hidden","actions":"B"},
      {"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":"html","value":"<span class='<%=model.class%>_change_status_group'>"},
      {"control":"html","value":"<div class='<%=model.class%>_Change_Status'></div>","caption":"Change Status","captionclass":"Change_Status_caption","captionstyle":"vertical-align:top;font-weight:bold;padding-top:3px;"},
      {"control":"html","value":"</span>"},
      {"name":"new_branch_changes","control":"hidden","type":"varchar","length":8,"actions":"BU","ongetvalue":"return _this.Change_Status_getvalue(val,field,xmodel);"},
      {"control":"button","value":"Clone","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_branch_type: xmodel.get('new_branch_type'), new_branch_name: xmodel.get('new_branch_name'), new_branch_changes: xmodel.get('new_branch_changes')  }, function(rslt){ xmodel.controller.form.ResetDirty(); XExt.navTo(jsh._BASEURL+xmodel.module_namespace+'Sitemap_Listing_Redirect'); });"}
    ]
  }
}
