function dlgstruct = getDialogSchema(h, ~)
%

% Copyright 2014 The MathWorks, Inc.

  v = h.viewmarker;
  dialogTag = v.getDialogTag();

  pos = h.pos;
  sysInfoModel = v.getSysInfoModel();

  if isempty(sysInfoModel)
      sysInfoModel.watermark_value = 0;
  end
  
  if ~isempty(h.option)
      option = h.option;
  else
      error('viewmark manager should have option field.');
  end

  isPC = ispc;  

  thumbnail.Type = 'webbrowser';
  thumbnail.Name = 'thumbnail';
  %Inititate connector service:
  connector.ensureServiceOn;
  if ~connector.isRunning
      warning(message('dastudio:util:FailedToStartConnector'));
      return;
  end
  if v.getDebugMode()
        htmlFile = 'index-debug.html';
        dlgstruct.Transient = false;
        thumbnail.EnableInspectorOnLoad = true;
      else
        htmlFile = 'index.html';
  end
      
  if strcmp(option.mode, 'creation')
      connector.addWebAddOnsPath('ViewMarks',fileparts(option.vm_path));
      url = sprintf('/toolbox/shared/dastudio/web/viewmarks/%s',htmlFile);
      thumbnail.Url = connector.getUrl(url);
      pos(2) = pos(2) + pos(4) - 280;
      pos(3) = 400;
      if isPC
        pos(4) = 250;
      else
        pos(4) = 280;
      end
          
  end
  
  if strcmp(option.mode, 'open')
      info = v.getInfo();
      [infoModel, modelNameChanged] = v.getInfoModel();
      if modelNameChanged
        return;
      end
      if(size(info)>0)
          connector.addWebAddOnsPath('ViewMarks',fileparts(info{1}.vm_path));
      end
      url = sprintf('/toolbox/shared/dastudio/web/viewmarksmanager/%s',htmlFile);
      thumbnail.Url = connector.getUrl(url);
      
      queryParams = matlab.net.QueryParameter(extractBetween(thumbnail.Url,strfind(thumbnail.Url,'?'),length(thumbnail.Url)));
      key = queryParams(1).Value;
      
      if(~isempty(fileparts(get_param(bdroot, 'filename'))))
        connector.addWebAddOnsPath(strcat("CurrentModel", key), fileparts(get_param(bdroot, 'filename')));
      end
      if(size(infoModel)>0)
          connector.addWebAddOnsPath(strcat("ModelViewMarks", key),fileparts(infoModel{1}.vm_path));
      end
      
      pos(1) = pos(1) + 2;
      pos(3) = pos(3) - 4;
      pos(4) = pos(4) - 2;
  end
  thumbnail.Tag = 'viewmarker_manager';
  thumbnail.DisableContextMenu = true;
  thumbnail.ClearCache = true;

  %%%%%%%%%%%%%%%%%%%%%%%
  % Main dialog
  %%%%%%%%%%%%%%%%%%%%%%% 
  manager.Type    = 'group';
  manager.Name    = '';
  manager.Flat    = true;
  manager.Items   = {thumbnail};  

  dlgstruct.DialogTitle = '';
  dlgstruct.Items = {manager};
  dlgstruct.StandaloneButtonSet = {''};
  dlgstruct.EmbeddedButtonSet = {''};
  dlgstruct.Transient = true;
  dlgstruct.DialogStyle = 'frameless';
  dlgstruct.Geometry = pos;
  dlgstruct.DialogTag = dialogTag;
  
  dlgstruct.CloseCallback = 'DAStudio.Viewmarker.onClose';
  dlgstruct.CloseArgs = {v, h};
end
