<?php
/**
 *  Criar um Componente
 */

  define( 'NEWLINE', "\n" );
  
if ( isset( $_REQUEST['nComp'] ) &&
     !empty( $_REQUEST['nComp'] )
    )
{
  //echo"<pre>";print_r($_REQUEST);
  //echo "nComp: ".$_REQUEST['nComp']; exit;

  $nPaleta   = $_REQUEST['nPaleta'];                 // Nome da Paleta
  $nComp     = $_REQUEST['nComp'];                   // Nome do Componente
  $container = $_REQUEST['isContainer'];             // Componente é container
  $visual    = $_REQUEST['isVisual'];                // Componente é visual
  
  $arrComp = array(
    'modelo',
    'style'
  );
    
  $arrCss = array(
    'top',
    'left',
    'width',
    'height',
    'color',
    'bgcolor',
    'fontFamily',
    'fontSize',
    'visibility' 
  );

  $flag = true;
  $erro = createObjeto();
}else
{
  $flag = false;
  $erro = "";
}// End if()

?>
<head>
  <title>Criar Componente no PhPage</title>
<head>
<html>
  <body>
    <center>
    <form name="formAdd" method="POST">
      <table>
        <tr>
          <th colspan="2" align="left">Criar Estrutura Básica de Componente<th>
        </tr>
        <tr>
          <td>Componente</td>
          <td><input type="text" name="nComp" /></td>
        </tr>
        <tr>
          <td>Paleta</td>
          <td>
            <select name="nPaleta">
              <option value="padrao">Padrão</option>
              <option value="win32">Adicional</option>
              <option value="sistema">Sistema</option>
              <option value="dataAccess">dataAccess</option>
            </select>
          </td>
        </tr>
        <tr>
          <td>Containner</td>
          <td>
            <select name="isContainer">
              <option value="sim">Sim</option>
              <option value="nao">Não</option>
            </select>
          </td>
        </tr>
        <tr>
          <td>Visual</td>
          <td>
            <select name="isVisual">
              <option value="sim">Sim</option>
              <option value="nao">Não</option>
            </select>
          </td>
        </tr>
<?php
  if( $flag )
  {
    if ( !empty( $erro ) )
      $msg = $erro;
    else
      $msg = "Estrutura básica para o componente [$nComp] criada com Sucesso...";
?>
        <tr>
          <td colspan="2"><?php echo($msg);?></td>
        </tr>
<?php
  }// End if
?>
      </table>
      <br />
      <input type="submit" value=" Criar Estrutura ">
    </form>
    </center>
  </body>
</html>


<?php
  
/**
 *  createObjeto()
 */  
function createObjeto()
{
  global $nComp, 
         $nPaleta, 
         $container, 
         $visual,
         $arrComp;
         
$ret = "";

//  1º Passo  ------------------------------------------------------------  //
//  Criar o arquivo de Especificação: nomeComponente.ini
//  no diretorio core/paletas/nome_da_paleta
  createEspec( $nComp, $nPaleta, $container, $visual );

//  2º Passo  -------------------------------------------------------------  //
//  Criar o arquivo de composição das propriedades do componente:
//  nomeComponente.comp.ini
  createComp( $nComp, $arrComp );

//  3º Passo  -------------------------------------------------------------  //
//  Criar o arquivo de configuração do componente
  createConfig( $nComp, $nPaleta );

//  4º Passo  -------------------------------------------------------------  //
//  Criar o arquivo de Folha de Estilo do componente
  createCss( $nComp, $nPaleta );

//  5º Passo  -------------------------------------------------------------  //
//  Criar o arquivo de Template do componente
  createTemplate( $nComp, $nPaleta, $container );

//  6º Passo  -------------------------------------------------------------  //
//  Criar o arquivo de Biblioteca PHP do componente
  createLibPHP( $nComp );

//  7º Passo  -------------------------------------------------------------  //
//  Criar o arquivo de Biblioteca JavaScript do componente
  createLibJS( $nComp );
  //  Passo  7.1  ---------------------------------------------------------  //
  createEventoOnClick( $nComp );
  //  Passo  7.2  ---------------------------------------------------------  //
  createEventoOnDown( $nComp );
  //  Passo  7.3  ---------------------------------------------------------  //
  createEventoOnUp( $nComp );
  //  Passo  7.4  ---------------------------------------------------------  //
  createEventoOnOver( $nComp );
  //  Passo  7.5  ---------------------------------------------------------  //
  createEventoOnOut( $nComp );
  //  Passo  7.6  ---------------------------------------------------------  //
  createEventoOnMove( $nComp );
  

//  8º Passo  -------------------------------------------------------------  //
//  Criar o arquivo Objeto do componente
  createOBJ( $nComp, $nPaleta );
  
  return $ret;
}
 
  

  
  
function createEspec( $nComp, $nPaleta, $container, $visual )
{
  $fileName = "core/paletas/" . $nPaleta . "/" . $nComp . ".ini";
  $fp       = @fopen($fileName, 'wb');

  fwrite($fp, "; arquivo de Configuração Geral"  . NEWLINE );
  fwrite($fp, "; do Componente no ambiente RAD"  . NEWLINE );
  fwrite($fp, "; e informações básica da Paleta" . NEWLINE );
  fwrite($fp, "[component]"                      . NEWLINE );
  fwrite($fp, "  versao    = 1"                  . NEWLINE );
  fwrite($fp, "  revisao   = 0"                  . NEWLINE );
  fwrite($fp, "  container = " . $container      . NEWLINE );
  fwrite($fp, "  visual    = " . $visual         . NEWLINE );
  fwrite($fp, "  paleta    = " . $nPaleta        . NEWLINE );
  fwrite($fp, "  icone     = "                   . NEWLINE );

  @fclose($fp);
}

function createComp( $nComp, $arrComp )
{
  $fileName = "core/" . $nComp . ".comp.ini";
  $fp       = @fopen($fileName, 'wb');
  fwrite($fp, "[" . $nComp . "_Config]" . NEWLINE );
  fwrite($fp, "  modelo = system"       . NEWLINE );
  fwrite($fp, "  top    = 300"          . NEWLINE );
  fwrite($fp, "  left   = 150"          . NEWLINE );
  fwrite($fp, "  style  = none"         . NEWLINE );
  fwrite($fp, "  width  = 100"          . NEWLINE );
  fwrite($fp, "  height = 18"           . NEWLINE );
  fwrite($fp, "  "                      . NEWLINE );
  fwrite($fp, "[" . $nComp . "_Conf]"   . NEWLINE );
  fwrite($fp, "  top    = inteiro"      . NEWLINE );
  fwrite($fp, "  left   = inteiro"      . NEWLINE );
  fwrite($fp, "  width  = inteiro"      . NEWLINE );
  fwrite($fp, "  height = inteiro"      . NEWLINE );


  @fclose($fp);
}

function createEspec_old( $nComp, $nPaleta, $container, $visual )
{
  $fileName = "core/paletas/" . $nPaleta . "/" . $nComp . ".php";
  $fp       = @fopen($fileName, 'wb');

  fwrite($fp, "<?php "                                   . NEWLINE );
  fwrite($fp, "  $".$nComp." = array("                   . NEWLINE );
  fwrite($fp, "    'versao'    => '1',"                  . NEWLINE );
  fwrite($fp, "    'container' => '" . $container . "'," . NEWLINE );
  fwrite($fp, "    'visual'    => '" . $visual    . "'"  . NEWLINE );
  fwrite($fp, "  );"                                     . NEWLINE );
  fwrite($fp, "?> "                                      . NEWLINE );

  @fclose($fp);
}

function createComp_old( $nComp, $arrComp )
{
  $fileName = "core/" . $nComp . ".comp.php";
  $fp       = @fopen($fileName, 'wb');
  
  fwrite($fp, "<?php "                         . NEWLINE );
  fwrite($fp, "  $".$nComp."_Conf = array("    . NEWLINE );
  fwrite($fp, "    'modelo',"                  . NEWLINE );
  fwrite($fp, "    'top',"                     . NEWLINE );
  fwrite($fp, "    'left',"                    . NEWLINE );
  fwrite($fp, "    'style',"                   . NEWLINE );
  fwrite($fp, "    'width',"                   . NEWLINE );
  fwrite($fp, "    'height'"                   . NEWLINE );
  fwrite($fp, "  );"                           . NEWLINE );
  fwrite($fp, " "                              . NEWLINE );
  fwrite($fp, "  $".$nComp."_modelo = array( " . NEWLINE );
  fwrite($fp, "    'system' "                  . NEWLINE );
  fwrite($fp, "  ); "                          . NEWLINE );
  fwrite($fp, " "                              . NEWLINE );
  fwrite($fp, "  $".$nComp."_top  = '300'; "   . NEWLINE );
  fwrite($fp, "  $".$nComp."_left = '150'; "   . NEWLINE );
  fwrite($fp, " "                              . NEWLINE );
  fwrite($fp, "  $".$nComp."_style = array( "  . NEWLINE );
  fwrite($fp, "    'none', "                   . NEWLINE );
  fwrite($fp, "    'win98', "                  . NEWLINE );
  fwrite($fp, "  ); "                          . NEWLINE );
  fwrite($fp, " "                              . NEWLINE );
  fwrite($fp, "  $".$nComp."_width = '200'; "  . NEWLINE );
  fwrite($fp, "  $".$nComp."_height = '25'; "  . NEWLINE );
  fwrite($fp, "?> "                            . NEWLINE );
  
  @fclose($fp);
}



function createConfig( $nComp, $nPaleta )
{
  $fileName = "core/paletas/" . $nPaleta . "/" . $nComp . ".config.php";
  $fp       = @fopen($fileName, 'wb');
  
  fwrite($fp, '<?php '                                                                              . NEWLINE );
  fwrite($fp, '  $'.$nComp.'X_Global = array('                                                      . NEWLINE );
  fwrite($fp, '    \'position\'      => \'absolute\','                                              . NEWLINE );
  fwrite($fp, '    \'top\'           => $'.$nComp.'X_Conf[\'top\'], '                        . NEWLINE );
  fwrite($fp, '    \'left\'          => $'.$nComp.'X_Conf[\'left\'],  '                      . NEWLINE );
  fwrite($fp, '    \'width\'         => $'.$nComp.'X_Conf[\'width\'],  '                       . NEWLINE );
  fwrite($fp, '    \'height\'        => $'.$nComp.'X_Conf[\'height\'],  '                       . NEWLINE );
  fwrite($fp, '    \'color\'         => $esquema[$'.$nComp.'X_Conf[\'modelo\']][\'MenuText\'],  '    . NEWLINE );
  fwrite($fp, '    \'bgcolor\'       => $esquema[$'.$nComp.'X_Conf[\'modelo\']][\'ActiveBorder\'], ' . NEWLINE );
  fwrite($fp, '    \'fontFamily\'    => $esquema[$'.$nComp.'X_Conf[\'modelo\']][\'FontFamily\'],  '  . NEWLINE );
  fwrite($fp, '    \'fontSize\'      => $esquema[$'.$nComp.'X_Conf[\'modelo\']][\'FontSize\'],  '    . NEWLINE );
  fwrite($fp, '    \'visibility\'    => \'visible\',  '                                             . NEWLINE );
  fwrite($fp, '  '                                                                                  . NEWLINE );
  fwrite($fp, '  );  '                                                                              . NEWLINE );
  fwrite($fp, '  '                                                                                  . NEWLINE );
  fwrite($fp, '  switch( $'.$nComp.'X_Conf[\'style\'] )  '                                          . NEWLINE );
  fwrite($fp, '  {  '                                                                               . NEWLINE );
  fwrite($fp, '    case \'win98\':  '                                                               . NEWLINE );
  fwrite($fp, '      $'.$nComp.'X_Style = array(  '                                                 . NEWLINE );
  fwrite($fp, '        \'borderTop\'    => \'1px solid  \'.$esquema[$'.$nComp.'X_Conf[\'modelo\']][\'ButtonHighlight\'],  ' . NEWLINE );
  fwrite($fp, '        \'borderBottom\' => \'1px outset \'.$esquema[$'.$nComp.'X_Conf[\'modelo\']][\'ButtonShadow\'],  '    . NEWLINE );
  fwrite($fp, '        \'borderLeft\'   => \'1px solid  \'.$esquema[$'.$nComp.'X_Conf[\'modelo\']][\'ButtonHighlight\'],  ' . NEWLINE );
  fwrite($fp, '        \'borderRight\'  => \'1px outset \'.$esquema[$'.$nComp.'X_Conf[\'modelo\']][\'ButtonShadow\']  '     . NEWLINE );
  fwrite($fp, '  '                                                                                                         . NEWLINE );
  fwrite($fp, '      );  '                                                                                                 . NEWLINE );
  fwrite($fp, '      break;  '                                                                                             . NEWLINE );
  fwrite($fp, '    default:  '                                                                                             . NEWLINE );
  fwrite($fp, '      $'.$nComp.'X_Style = array(  '                                                                        . NEWLINE );
  fwrite($fp, '        \'borderTop\'    => \'1px solid \'.$esquema[$'.$nComp.'X_Conf[\'modelo\']][\'ActiveBorder\'],  '     . NEWLINE );
  fwrite($fp, '        \'borderBottom\' => \'1px solid \'.$esquema[$'.$nComp.'X_Conf[\'modelo\']][\'ActiveBorder\'],  '     . NEWLINE );
  fwrite($fp, '        \'borderLeft\'   => \'1px solid \'.$esquema[$'.$nComp.'X_Conf[\'modelo\']][\'ActiveBorder\'],  '     . NEWLINE );
  fwrite($fp, '        \'borderRight\'  => \'1px solid \'.$esquema[$'.$nComp.'X_Conf[\'modelo\']][\'ActiveBorder\']  '      . NEWLINE );
  fwrite($fp, '      );  '                                                                                                 . NEWLINE );
  fwrite($fp, '  };  '                                                                                                     . NEWLINE );
  fwrite($fp, '?> '                                                                                                        . NEWLINE );
  
  @fclose($fp);
}

function createCss( $nComp, $nPaleta )
{
  $fileName = "core/paletas/" . $nPaleta . "/" . $nComp . ".css.php";
  $fp       = @fopen($fileName, 'wb');

  fwrite($fp, '<?php'                                            . NEWLINE );
  fwrite($fp, '  $baseName = "'.$nComp .'X";'                    . NEWLINE );
  fwrite($fp, '  $_Global  = $baseName . "_Global";'             . NEWLINE );
  fwrite($fp, '  $_Style   = $baseName . "_Style";'              . NEWLINE );
  fwrite($fp, '  $_Conf    = $baseName . "_Conf";'               . NEWLINE );
  fwrite($fp, '?>'                                               . NEWLINE );
  fwrite($fp, '<style type="text/css" midia="screen">'           . NEWLINE );
  fwrite($fp, '  <?php create_' . $nComp .'_css( $baseName,'     . NEWLINE );
  fwrite($fp, '                         $$_Global,'              . NEWLINE );
  fwrite($fp, '                         $$_Style,'               . NEWLINE );
  fwrite($fp, '                         $$_Conf,'                . NEWLINE );
  fwrite($fp, '                         $flag_' . $nComp . ' );' . NEWLINE );
  fwrite($fp, '  ?>'                                             . NEWLINE );
  fwrite($fp, '</style>'                                         . NEWLINE );
  
  @fclose($fp);
}

/**
 *  createTemplate()
 */
function createTemplate( $nComp, $nPaleta, $container )
{
  $fileName = "core/paletas/" . $nPaleta . "/" . $nComp . ".tpl.php";
  $fp       = @fopen($fileName, 'wb');

  fwrite($fp, '<?php'                                                   . NEWLINE );
  fwrite($fp, '  $baseName = "' . $nComp . 'X";'                        . NEWLINE );
  fwrite($fp, '  $_Conf    = $baseName . "_Conf";'                      . NEWLINE );
  fwrite($fp, '?>'                                                      . NEWLINE );
  fwrite($fp, '<div id="<?php echo($baseName);?>" objeto="'.$nComp.'">' . NEWLINE );
  fwrite($fp, '  <?php create_'.$nComp.'( $baseName,'                   . NEWLINE );
  fwrite($fp, '                      $$_Conf );'                        . NEWLINE );
  fwrite($fp, '  ?>'                                                    . NEWLINE );
  if ( $container == 'sim' )
  {
    fwrite($fp, '  <div id="<?php echo($baseName);?>_Frame">'               . NEWLINE );
    fwrite($fp, '<?php  '                                                   . NEWLINE );
    fwrite($fp, '/**  '                                                     . NEWLINE );
    fwrite($fp, ' *  Carrega os templates dos Componentes do Objeto  '      . NEWLINE );
    fwrite($fp, ' */  '                                                     . NEWLINE );
    fwrite($fp, '  $arr = getTemplates( $componentes_no_Prj, $baseName ); ' . NEWLINE );
    fwrite($fp, '  '                                                        . NEWLINE );
    fwrite($fp, '  foreach( $arr as $_i_ => $_n_)  '                        . NEWLINE );
    fwrite($fp, '  {  '                                                     . NEWLINE );
    fwrite($fp, '    include(INC . $_n_ . ".tpl.php");  '                   . NEWLINE );
    fwrite($fp, '  }//  '                                                   . NEWLINE );
    fwrite($fp, '?>  '                                                      . NEWLINE );
    fwrite($fp, '  </div end="<?php echo($baseName);?>_Frame">'             . NEWLINE );
  }// End if ( $container == 'sim' )
  fwrite($fp, '</div end="<?php echo($baseName);?>">'                   . NEWLINE );
  fwrite($fp, '<?php'                                                   . NEWLINE );
  fwrite($fp, '/**'                                                     . NEWLINE );
  fwrite($fp, ' *  Evento AfterLoad'                                    . NEWLINE );
  fwrite($fp, ' */'                                                     . NEWLINE );
  fwrite($fp, '  $fileName = INC . $baseName . "_afterLoad.js.php";'    . NEWLINE );
  fwrite($fp, '  if ( file_exists( $fileName ) )'                       . NEWLINE );
  fwrite($fp, '  {'                                                     . NEWLINE );
  fwrite($fp, '    include( $fileName );'                               . NEWLINE );
  fwrite($fp, '  }// End if()'                                          . NEWLINE );
  fwrite($fp, '/**'                                                     . NEWLINE );
  fwrite($fp, ' *  Eventos do Objeto'                                   . NEWLINE );
  fwrite($fp, ' */'                                                     . NEWLINE );
  fwrite($fp, '  $fileName = INC . $baseName . ".eventos.js.php";'      . NEWLINE );
  fwrite($fp, '  if ( file_exists( $fileName ) )'                       . NEWLINE );
  fwrite($fp, '  {'                                                     . NEWLINE );
  fwrite($fp, '    include( $fileName );'                               . NEWLINE );
  fwrite($fp, '  }// End if()'                                          . NEWLINE );
  fwrite($fp, '?>'                                                      . NEWLINE );

  @fclose($fp);
}





function createLibPHP( $nComp )
{
  $fileName = "core/" . $nComp . ".lib.php";
  $fp       = @fopen($fileName, 'wb');
  
  fwrite($fp, "<?php "                                                                                   . NEWLINE );
  fwrite($fp, "  function create_" . $nComp . "( $" . $nComp . ","                                       . NEWLINE );
  fwrite($fp, "                          $" . $nComp . "_Conf )"                                         . NEWLINE );
  fwrite($fp, "  {"                                                                                      . NEWLINE );
  fwrite($fp, "     writeTO( '<div id=\"' . $" . $nComp . " . '\" objeto=\"' . $". $nComp . ". '\">' );" . NEWLINE );
  fwrite($fp, "     writeTO( '  ' );"                                                                    . NEWLINE );
  fwrite($fp, "     writeTO( '</div end=\"' . $" . $nComp . " . '\">' );"                                . NEWLINE );
  fwrite($fp, "  }// End create_" . $nComp . "() "                                       . NEWLINE );
  fwrite($fp, "  "                                                                       . NEWLINE );
  fwrite($fp, "  function create_" . $nComp . "_css( $" . $nComp . ","                   . NEWLINE );
  fwrite($fp, "                              $" . $nComp . "_Global,"                    . NEWLINE );
  fwrite($fp, "                              $" . $nComp . "_Style,"                     . NEWLINE );
  fwrite($fp, "                              $" . $nComp . "_Conf,"                      . NEWLINE );
  fwrite($fp, "                              \$flag_" . $nComp . " )"                    . NEWLINE );
  fwrite($fp, "  {"                                                                      . NEWLINE );
  fwrite($fp, "    global \$esquema;"                                                    . NEWLINE );
  fwrite($fp, "    "                                                                     . NEWLINE );
  fwrite($fp, "    writeTO( '  #' . $" . $nComp . " . '{ '                           );" . NEWLINE );
  fwrite($fp, "    writeTO( '    position:absolute; '                        );"         . NEWLINE );
  fwrite($fp, "    writeTO( '    top:' . $" . $nComp . "_Global['top'] . 'px;'       );" . NEWLINE );
  fwrite($fp, "    writeTO( '    left:' . $" . $nComp . "_Global['left'] . 'px;'     );" . NEWLINE );
  fwrite($fp, "    writeTO( '    '                                           );"         . NEWLINE );
  fwrite($fp, "    writeTO( '    z-index:10;'                                );"         . NEWLINE );
  fwrite($fp, "    writeTO( '    '                                           );"         . NEWLINE );
  fwrite($fp, "    writeTO( '    width:' . $" . $nComp . "_Global['width'] . 'px;'   );" . NEWLINE );
  fwrite($fp, "    writeTO( '    height:' . $" . $nComp . "_Global['height'] . 'px;' );" . NEWLINE );
  fwrite($fp, "    writeTO( '    '                                           );"         . NEWLINE );
  fwrite($fp, "    writeTO( '    }'                                          );"         . NEWLINE );
  fwrite($fp, "  }// End create_" . $nComp . "_css() "                                   . NEWLINE );
  fwrite($fp, "?> "                                                                      . NEWLINE );

  @fclose($fp);
} 

/**
 *  createLibJS()  
 */
function createLibJS( $nComp )
{
  $fileName = "core/" . $nComp . ".lib.js.php";
  $fp       = @fopen($fileName, 'wb');
  $arrEvento = array(
    '_mouseClick',
    '_mouseDown',
    '_mouseUp',
    '_mouseOver',
    '_mouseOut',
    '_mouseMove',
  );
  
  fwrite($fp, '<script language="javascript"> '                   . NEWLINE );
  foreach( $arrEvento as $i_ => $evt )
  {  
    fwrite($fp, '/**  '                                           . NEWLINE );
    fwrite($fp, ' *  '.$nComp.$evt.'()  '                         . NEWLINE );
    fwrite($fp, ' */  '                                           . NEWLINE );
    fwrite($fp, '  function '.$nComp.$evt.'( objID )  '           . NEWLINE );
    fwrite($fp, '  {  '                                           . NEWLINE );
    fwrite($fp, '    if( objID.indexOf(\''.$nComp.'\') != -1 )  ' . NEWLINE );
    fwrite($fp, '    {  '                                         . NEWLINE );
    fwrite($fp, '    '                                            . NEWLINE );
    fwrite($fp, '    }  '                                         . NEWLINE );
    fwrite($fp, '  }// End function()'                            . NEWLINE );
    fwrite($fp, '  '                                              . NEWLINE );
  }
  fwrite($fp, '</script> '                                        . NEWLINE );

  @fclose($fp);
} 

function createEventoOnClick( $nComp )
{
  $fileName = "include/" . 'onClick_' . $nComp . ".js.php";
  $fp       = @fopen($fileName, 'wb');
  fwrite($fp, $nComp . '_mouseClick( objectID ); '                    . NEWLINE );
  fwrite($fp, $nComp . '                         '                    . NEWLINE );
  fwrite($fp, $nComp . '/**                      '                    . NEWLINE );
  fwrite($fp, $nComp . ' *  Funções acrescentada pelo Desenvolvedor ' . NEWLINE );
  fwrite($fp, $nComp . ' */ '                                         . NEWLINE );

  @fclose($fp);
}

function createEventoOnDown( $nComp )
{
  $fileName = "include/" . 'onDown_' . $nComp . ".js.php";
  $fp       = @fopen($fileName, 'wb');
  fwrite($fp, $nComp . '_mouseDown( objectID );  '                    . NEWLINE );
  fwrite($fp, $nComp . '                         '                    . NEWLINE );
  fwrite($fp, $nComp . '/**                      '                    . NEWLINE );
  fwrite($fp, $nComp . ' *  Funções acrescentada pelo Desenvolvedor ' . NEWLINE );
  fwrite($fp, $nComp . ' */ '                                         . NEWLINE );

  @fclose($fp);
}

function createEventoOnUp( $nComp )
{
  $fileName = "include/" . 'onUp_' . $nComp . ".js.php";
  $fp       = @fopen($fileName, 'wb');
  fwrite($fp, $nComp . '_mouseUp( objectID );    '                    . NEWLINE );
  fwrite($fp, $nComp . '                         '                    . NEWLINE );
  fwrite($fp, $nComp . '/**                      '                    . NEWLINE );
  fwrite($fp, $nComp . ' *  Funções acrescentada pelo Desenvolvedor ' . NEWLINE );
  fwrite($fp, $nComp . ' */ '                                         . NEWLINE );

  @fclose($fp);
}

function createEventoOnOver( $nComp )
{
  $fileName = "include/" . 'onOver_' . $nComp . ".js.php";
  $fp       = @fopen($fileName, 'wb');
  fwrite($fp, $nComp . '_mouseOver( objectID );  '                    . NEWLINE );
  fwrite($fp, $nComp . '                         '                    . NEWLINE );
  fwrite($fp, $nComp . '/**                      '                    . NEWLINE );
  fwrite($fp, $nComp . ' *  Funções acrescentada pelo Desenvolvedor ' . NEWLINE );
  fwrite($fp, $nComp . ' */ '                                         . NEWLINE );

  @fclose($fp);
}

function createEventoOnOut( $nComp )
{
  $fileName = "include/" . 'onOut_' . $nComp . ".js.php";
  $fp       = @fopen($fileName, 'wb');
  fwrite($fp, $nComp . '_mouseOut( objectID );   '                    . NEWLINE );
  fwrite($fp, $nComp . '                         '                    . NEWLINE );
  fwrite($fp, $nComp . '/**                      '                    . NEWLINE );
  fwrite($fp, $nComp . ' *  Funções acrescentada pelo Desenvolvedor ' . NEWLINE );
  fwrite($fp, $nComp . ' */ '                                         . NEWLINE );

  @fclose($fp);
}

function createEventoOnMove( $nComp )
{
  $fileName = "include/" . 'onMove_' . $nComp . ".js.php";
  $fp       = @fopen($fileName, 'wb');
  fwrite($fp, $nComp . '_mouseMove( objectID );  '                    . NEWLINE );
  fwrite($fp, $nComp . '                         '                    . NEWLINE );
  fwrite($fp, $nComp . '/**                      '                    . NEWLINE );
  fwrite($fp, $nComp . ' *  Funções acrescentada pelo Desenvolvedor ' . NEWLINE );
  fwrite($fp, $nComp . ' */ '                                         . NEWLINE );

  @fclose($fp);
}

/**
 *  createOBJ()  
 */
function createOBJ( $nComp, $nPaleta )
{
  $fileName = "core/paletas/" . $nPaleta . "/" . $nComp . ".obj.php";
  $fp       = @fopen($fileName, 'wb');
  
  fwrite($fp, '<?php '                                                     . NEWLINE );
  fwrite($fp, '  /* chamadas aos Objetos ' . $nComp . '  */'               . NEWLINE );
  fwrite($fp, '  $flag_' . $nComp . ' = true;'                             . NEWLINE );
  fwrite($fp, '  foreach( $' . $nComp . ' as $_ind_ => $_val_)'            . NEWLINE );
  fwrite($fp, '  {'                                                        . NEWLINE );
  fwrite($fp, '    include( CFG . $_val_[\'nome\'] . ".config.def.php" );' . NEWLINE );
  fwrite($fp, '    include( CFG . $_val_[\'nome\'] . ".config.php" );'     . NEWLINE );
  fwrite($fp, '    include( CSS . $_val_[\'nome\'] . ".css.php");'         . NEWLINE );
  fwrite($fp, '    $flag_' . $nComp . ' = false; '                         . NEWLINE );
  fwrite($fp, '  }// End foreach()'                                        . NEWLINE );
  fwrite($fp, '?> '                                                        . NEWLINE );
  
  @fclose($fp);
} 












?>
