<?php 
$flagDB = false;  // indica se aplicação faz uso de componentes dataAccess

/**
 *  Carrega Bibliotecas PHP dos Componentes  // 
 */ 
  foreach( $componentes_no_Prj as $_ind_ => $_val_ ) 
  { 
    include( CORE . $_ind_ . ".lib.php" );

    if( $_ind_ == 'dataSource' )
    {
      $flagDB = true;
    }// End if( $_ind_ == 'dataSource' )
  }// End foreach( $componentes_no_Prj as $_ind_ => $_val_ )
  
/**  
 *  Arquivo Header da Page Principal  
 *  ----------------------------------------------------------  //  
 */  
  include( $_SERVER['DOCUMENT_ROOT'] .  
           $_desenv_ . "config/" .  
           $nPage . ".header.php" );  
  
/**
 *  carrega o arquivo .Conf da Page
 */
  include( $_SERVER['DOCUMENT_ROOT'] .
           $_desenv_ . "config/" .
           $nPage . ".config.def.php" );
/**
 *  carrega a Folha de Estilos da Page  //  
 */  
  include( $_SERVER['DOCUMENT_ROOT'] .  
           $_desenv_ . "css/" .  
           $nPage . ".css.php" );  
  
/** 
 *  Carrega os Objetos da Page  ------------------------------  //
 */
  foreach( $componentes_no_Prj as $_ind_ => $_val_ )
  {
    include( _USES_ . $nPage . "." . $_ind_ . ".obj.php" );
  }// End
  
/** 
 *  Carrega Bibliotecas JavaScript dos Componentes  //
 */
  foreach( $componentes_no_Prj as $_ind_ => $_val_ )
  {
    include( CORE . $_ind_ . ".lib.js.php" );
  }// End foreach( $componentes_no_Prj as $_ind_ => $_val_ )

  $root_ = "http://" . $_SERVER["HTTP_HOST"] . "/studio/lib_JS/";
  $dirJS = $_SESSION["nBrowser"];
  $iniJS = "  <script type=\"text/javascript\" ";
  $endJS = "</script>\n";

/**
 *  carrega os arquivos da biblioteca básica de JavaScript //
 *  ----------------------------------------------------------------------  //
 */
  echo( $iniJS . "src=\"" . $root_ . $dirJS . "/control.js\">" . $endJS );
  echo( $iniJS . "src=\"" . $root_ . $dirJS . "/findDOM.js\">" . $endJS );
  echo( $iniJS . "src=\"" . $root_ . $dirJS . "/StudioLIB.js\">" . $endJS );
?>
<?php
  if ( $modo_RAD )
  {
?>
  <script language="javascript">
    var objATIVO = <?php echo($projeto['pageMain']);?>;
  </script>
<?php  
  }else
  {
    echo( $iniJS . "src=\"" . $root_ . $dirJS . "/wddx.js\">" . $endJS );
    echo( $iniJS . "src=\"" . $root_ . $dirJS . "/wddxDes.js\">" . $endJS );
    echo( $iniJS . "src=\"" . $root_ . $dirJS . "/jsrsClient.js\">" . $endJS );
    echo( $iniJS . "src=\"" . $root_ . $dirJS . "/rpcStudio.js\">" . $endJS );
    if( $flagDB )
    {
      echo( $iniJS . "src=\"" . $root_ . $dirJS . "/dataAccess.js\">" . $endJS );
    }// End if( $flagDB )
  }// End if ( $modo_RAD )
  
  
/**
 *  carrega o Controle de Eventos  //
 */
  include( INC . $dirJS . "/EventoMouse.js.php" );
  include( INC . $dirJS . "/EventoTeclado.js.php" );
  include( INC . $dirJS . "/EventoGlobal.js.php" );

/** 
 *  Arquivo Body da Page 
 *  ------------------------------------------------------------  // 
 */ 
  include( $_SERVER['DOCUMENT_ROOT'] . 
           $_desenv_ . "config/" . 
           $nPage . ".body.php" ); 
 

/*
 *  Executa os arquivos de comandos "antes" de carregar a Page
 *  ----------------------------------------------------------------------  //
 */
  $arrFile = getFile( _INC_, $projeto['pageMain'] . ".onBeforeLoad" );
  foreach( $arrFile as $i_ => $nFile )
  {
    include( _INC_ . $nFile );
  }// End foreach()


/**
 *  Carrega os templates dos Componentes na Page Principal
 */
  $arr = getTemplates( $componentes_no_Prj, $nPage );
  
  foreach( $arr as $_i_ => $_n_)
  {
    include( _INC_ . $_n_ . ".tpl.php" );
  }// 
  
  
 /*
 *  Executa os arquivos de comandos "depois" de carregar a Page
 *  ----------------------------------------------------------------------  //
 */
  $arrFile = getFile( _INC_, $projeto['pageMain'] . ".onAfterLoad" );
  foreach( $arrFile as $i_ => $nFile )
  {
    include( _INC_ . $nFile );
  }// End foreach()

  
/**
 *  Arquivo Foot da Page
 *  -------------------------------------------------------------  //
 */
  include( $_SERVER['DOCUMENT_ROOT'] .
           $_desenv_ . "config/" .
           $nPage . ".foot.php" );
  
?> 
