{
  "Media_Revision_Listing": {
    "layout":"grid",
    "table":"{schema}.media",
    "sqlwhere":"(media_is_folder = 0) and (media_key in (select media_key from {schema}.branch_media where branch_id={schema}.my_current_branch_id()))",
    "actions":"B",
    "roles": {"AUTHOR": "B","PUBLISHER": "B","VIEWER":"B"},
    "caption":["Media","Media"],
    "title":"Revision History",
    "reselectafteredit": "row",
    "sort":["vmedia_mtstmp"],
    "grid_expand_search": true,
    "hide_system_buttons" : ["clear"],
    "rowclass":"<%=xejs.iif(xmodel.parent&&(datarow['media_id']==jsh.XModels[xmodel.parent].get('revision_media_id')),'active_revision')%>",
    "css": [".xform<%=model.class%> .xgrid_select_item { display: none; }"],
    "fields": [
      {"name":"media_id","caption":"ID","control":"hidden","key":true},
      {"name":"revision_media_key","type":"bigint","caption":"Revision Key","control":"hidden","sqlwhere":"media_key=@revision_media_key","sqlselect":"media_key"},
      {"name":"media_key","caption":"Key","control":"hidden"},
      {"name":"media_file_id","caption":"File ID","control":"hidden"},
      {"name":"media_ext","caption":"Extension","control":"hidden"},
      {"name":"restore_button","control":"html","caption":"Restore","cellstyle":"text-align:center;",
        "value":"<% if(xmodel.parent&&(datarow['media_id']==jsh.XModels[xmodel.parent].get('revision_media_id'))){ %>Active<% } else { %><a href='#' onclick='<%-js(\"var obj = this; XExt.Confirm('Restore alternate revision?',function(){ XExt.popupSelect(xmodel.id, obj); }); return false;\")%>'>Restore</a><% } %>"},
      {"control":"html","caption":"","cellstyle":"text-align:center;","link":"js:jsh.App[xmodel.parent].previewFile(xmodel.controller.form.DataSet[jsh.XExt.XModel.GetRowID(modelid, this)]);","value":"<img height='14' src='/images/icon_browse.png' class='xicon' />"},
      {"name":"media_mtstmp","caption":"Modified","control":"label","actions":"B","format":["date","MM/DD/YYYY h:mm a"],"cellstyle":"white-space:nowrap;"},
      {"name":"media_muser_fmt","caption":"Modified By","sqlselect":"(jsharmony.my_db_user_fmt(media_muser))","control":"label","actions":"B"},
      {"name":"media_desc","caption":"Title","control":"label"},
      {"name":"media_path","caption":"Path","control":"label","format":"js:return (val||'').toString().replace(/\\//g,'/\\u200B');"},
      {"name":"media_type","caption":"Type","control":"label"},
      {"name":"media_tags","caption":"Tags","control":"label"}
    ]
  }
}