newfold.ssc

来自「PowerBuilder8.0开发分散式应用所帶的例程」· SSC 代码 · 共 69 行

SSC
69
字号
<!--SCRIPT
  var webRoot = site.GetRootDocument();
  import ( webRoot.location + '/system/utils/strtable.ssc' );
  import ( webRoot.location + '/system/utils/wizard.ssc' );
  
  var folderWiz;
  var connList;
  var i;
  var connName;
  var inherited;
  
  folderWiz.name = new wizardPage( 'Text',
    IntlStr.wizNewFold.p1.title,
    IntlStr.wizNewFold.p1.explanation,
    IntlStr.wizNewFold.p1.question
    );
  
  folderWiz.description = new wizardPage( 'TextArea',
    IntlStr.wizNewFold.p2.title,
    IntlStr.wizNewFold.p2.explanation,
    IntlStr.wizNewFold.p2.question
    );
  
  // determine if there is more than one connection, and if so,
  // allow the user to specify a connection for the folder
  connList = site.GetConnectionNameList();
  i = 0;
  inherited = 0;
  for( connName in connList ) {
    i++;
    if( connList[connName] ==  IntlStr.inherited ) break;  // stop if we found the inherited connection
    inherited++;
  }
  if( i > 1 ) {
    folderWiz.connect = new wizardPage( 'Choice',
      IntlStr.wizNewFold.p3.title,
      IntlStr.wizNewFold.p3.explanation,
      IntlStr.wizNewFold.p3.question,
      connList,
      inherited
      );
  }
  
  /* Display the wizard */
  if( site.CreateWizard(folderWiz) ) {
    /* Check if a folder name was provided */
    if( folderWiz.name.value.length > 0 ) {
      /* Check if we need to specify a connection when creating the folder */
      var fullname = document.location + '/' + folderWiz.name.value;
      var newFolder;
      if( i > 1 ) {
	/* Create the folder in the specified directory with the chosen connection */
	newFolder = site.CreateDocument( fullname,
	  'directory', folderWiz.description.value, '', folderWiz.connect.value );
      } else {
	/* Create the folder in the specified directory */
	newFolder = site.CreateDocument( fullname,
	  'directory', folderWiz.description.value );
      }
      if( newFolder == null ) {
	document.writeln( formatString( IntlStr.unableToCreate, fullname ) );
      }
    } else {
      document.writeln( IntlStr.noFolderName );
    }
  }
-->

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?