<?php
function create_dataSource( $dataSource )
{
  $nFile = _CFG_ . $dataSource . ".config.data.ini";
  if ( file_exists( $nFile ) )
  {
    $arrINI = readINIfile( $nFile );
    if( !isset($arrINI['db_conect'][ 'host' ] ) )
    {
      $arrINI = reset_arrINI_dataSource( $dataSource );
      //echo"\n<pre>";print_r($arrINI);exit;
      writeINIfile($nFile, $arrINI, ";", "");
    }
  }else
  {
    /**
     *  inicializa o dataSource vazio
     */
    $arrINI = reset_arrINI_dataSource( $dataSource );
    writeINIfile($nFile, $arrINI, ";", "");
  }// End if ( file_exists( $nFile ) )

}// End function create_dataSource( $dataSource )

function create_dataSource_css( $dataSource,
                                $dataSource_Global )
{
  global $projeto,
         $esquema;
  $bg_color   = $esquema[$projeto['esquema']]['ThreeDFace'];
  writeTO( '  #' . $dataSource . '{ '                                );
  writeTO( '    position:absolute;'                                  );
  writeTO( '    top:' . $dataSource_Global['top'] . 'px'       . ';' );
  writeTO( '    left:' . $dataSource_Global['left'] . 'px'     . ';' );
  writeTO( '    '                                                    );
  writeTO( '    z-index:10;'                                         );
  writeTO( '    '                                                    );
  writeTO( '    width:' . $dataSource_Global['width'] . 'px'   . ';' );
  writeTO( '    height:' . $dataSource_Global['height'] . 'px' . ';' );
  writeTO( '    '                                                    );
  writeTO( '    background-color:' . $bg_color . ';'                 );
  writeTO( '  }'                                                     );
}

function reset_arrINI_dataSource( $dataSource_ )
{
  $arrINI_ = array();
  $arrINI_[ 'db_conect' ]['host']  = 'localhost';
  $arrINI_[ 'db_conect' ]['user']  = ' ';
  $arrINI_[ 'db_conect' ]['pass']  = ' ';
  $arrINI_[ 'db_conect' ]['dbase'] = ' ';

  return( $arrINI_ );
}// End function reset_arrINI_dataSource( $dataSource_ )



?>
