<?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_ )

  $uri_  = "http://" . $_SERVER["HTTP_HOST"] . '/' . getRoot() . "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="' . $uri_ . $dirJS . '/control.js">'   . $endJS );
  echo( $iniJS . 'src="' . $uri_ . $dirJS . '/findDOM.js">'   . $endJS );
  echo( $iniJS . 'src="' . $uri_ . $dirJS . '/StudioLIB.js">' . $endJS );

  writeTO( '<script language="javascript">' );
  writeTO( '  var loginUSER = "' . $_SESSION["loginUSER"] . '";' );

  if ( $modo_RAD )
  {
    writeTO( 'var objATIVO = ' . $projeto['pageMain'] . ';');
  }// End if ( $modo_RAD )
  writeTO( '</script>' );

  echo( $iniJS . 'src="' . $uri_ . $dirJS . '/wddx.js">'        . $endJS );
  echo( $iniJS . 'src="' . $uri_ . $dirJS . '/wddxDes.js">'     . $endJS );
  echo( $iniJS . 'src="' . $uri_ . $dirJS . '/jsrsClient1.js">' . $endJS );
  echo( $iniJS . 'src="' . $uri_ . $dirJS . '/rpcStudio.js">'   . $endJS );
  if( $flagDB )
  {
    echo( $iniJS . 'src="' . $uri_ . $dirJS . '/dataAccess.js">' . $endJS );
  }// End if( $flagDB )
  
/**
 *  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( $projeto['projeto_nome'], $nPage );
  
  foreach( $arr as $_i_ => $_n_)
  {
    include( _INC_ . $_n_ . ".tpl.php" );
  }// End foreach( $arr as $_i_ => $_n_)
  
  
 /*
 *  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" );
  
?> 
