if (!qcms){
   var qcms = {}
}
/**
 * THIS FILE DEPENDS ON qcms.html.Common
 */

qcms.dialog = {}

qcms.dialog.show = function (_args){
   
      if (_args.uri.match(/=/)){
         _args.uri = _args.uri.split(/=/)[1]
       }
      var http = HttpClient.instance()
      http.setHeader('dom',_args.title)
      http.setHeader('uri',_args.uri)
      http.get(`${qcms.context}/dialog`,(x)=>{
         $('.jxmodal').remove()
         jx.modal.show({html:x.responseText,id:'body'})
         if(jx.dom.exists('dialog-message') && _args.message != null){
          jx.dom.set.value('dialog-message',_args.message)         
       }
       //-- are there scripts in the modal window
       var scripts = $('.jxmodal script')
       scripts.each((_index)=>{
         var _code = $(scripts)[_index].text
         eval(_code)
       })
   })
   
  


   
}



//
// Make a proxy for backward compatibility (not everything was prefixed by qcms)
//
var dialog = qcms.dialog
