Commit fd809fe85ec99c70763aee2cb0189c38969b7d9f

Authored by Edmar Moretti
1 parent 1649d82c

Inclusão de codemirror no editor de mapfiles

admin/php/editortexto.php
  1 +<?php
  2 +//XODO incluir combo para escolher o estilo
  3 +//XODO incluir ajuda de comandos de teclado
  4 +//XODO relace de sintaxe para mapfile
  5 +?>
1 6 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 7 <html>
3 8 <head>
4 9 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
5 10 <title>Editor texto</title>
  11 +
  12 +<script src="../../pacotes/codemirror/lib/codemirror.js"></script>
  13 +<script src=../../pacotes/codemirror/mode/htmlmixed/htmlmixed.js></script>
  14 +<link rel=stylesheet href="../../pacotes/codemirror/doc/docs.css">
  15 +<link rel="stylesheet" href="../../pacotes/codemirror/lib/codemirror.css">
  16 +<link rel="stylesheet" href="../../pacotes/codemirror/theme/ambiance.css">
  17 +<link rel="stylesheet" href="../../pacotes/codemirror/theme/cobalt.css">
  18 +<link rel="stylesheet" href="../../pacotes/codemirror/theme/night.css">
  19 +<link rel="stylesheet" href="../../pacotes/codemirror/theme/neo.css">
  20 +<link rel="stylesheet" href="../../pacotes/codemirror/theme/elegant.css">
  21 +<link rel="stylesheet" type="text/css" href="../html/admin.css">
6 22 <style type="text/css">
7 23 body {
8 24 margin: 20;
9 25 padding: 20;
10 26 font-size: 14px;
11 27 }
  28 +.CodeMirror {
  29 + height:500px;
  30 + float: left;
  31 + width: 500px;
12 32 </style>
13   -<link rel="stylesheet" type="text/css" href="../html/admin.css">
14 33 </head>
15 34 <body class=" yui-skin-sam ">
16 35 <div class="" id="divGeral" style="width: 100%;">
... ... @@ -21,7 +40,7 @@ body {
21 40 <br> <br> Mapfile em edi&ccedil;&atilde;o:
22 41 <div id="comboMapfiles" style="width: 100%; max-width: 450px">Aguarde...</div>
23 42 <br><br>
24   - <form style="width: 98%;" action="editortexto.php?mapfile=<?php echo $_GET["mapfile"];?>" method=post>
  43 + <form style="width: 98%;" onsubmit="atualizaTextArea()" action="editortexto.php?mapfile=<?php echo $_GET["mapfile"];?>" method=post>
25 44 <input type=submit value="Salvar (tamb&eacute;m atualiza o mapa)" />
26 45 <input type=button value="Testar" onclick="testar()" />
27 46 <input type=button value="Testar no i3Geo" onclick="abrirI3geo()" />
... ... @@ -60,13 +79,22 @@ body {
60 79 }
61 80 fclose($fp);
62 81 }
63   - echo 'Ajudante de cores RGB: <input type=text value="clique" size=10 id="corrgb" onclick="i3GEO.util.abreCor(\'\',\'corrgb\',\'rgbSep\')" /><br><br>';
64   - echo "<div style='width:2000px;' ><TEXTAREA name=texto cols=100 rows=20 style='width:500px;float:left;height:500px'>";
  82 + echo 'Ajudante de cores RGB: <input type=text value="clique" size=10 id="corrgb" onclick="i3GEO.util.abreCor(\'\',\'corrgb\',\'rgbSep\')" />';
  83 + ?>
  84 + Estilo: <select onchange="mudaEstilo(this.value)">
  85 + <option value=elegant >Elegant</option>
  86 + <option value=ambiance >Ambiance</option>
  87 + <option value=cobalt >Cobalt</option>
  88 + <option value=night >Night</option>
  89 + <option value=neo >Neo</option>
  90 + </select>
  91 + <?php
  92 + echo "<div style='width:2000px;' ><TEXTAREA id=editor name=texto cols=100 rows=20 style='width:500px;float:left;height:500px'>";
65 93 echo file_get_contents($mapfile);
66 94 echo "</TEXTAREA>";
67 95 $mapfile = str_replace("\\","/",$mapfile);
68 96  
69   - echo "<iframe id='mapaPreview' src='../../mashups/openlayers.php?nocache=sim&DESLIGACACHE=sim&controles=navigation,panzoombar,scaleline,mouseposition&botoes=identifica&largura=480&fundo=".$mapfile."&temas=".$mapfile."' cols=100 rows=20 style='position:relative;top:2px;overflow:hidden;width:500px;height:500px;border:1px solid gray;'>";
  97 + echo "<iframe id='mapaPreview' src='../../mashups/openlayers.php?nocache=sim&DESLIGACACHE=sim&controles=navigation,panzoombar,scaleline,mouseposition&botoes=identifica&largura=480&fundo=".$mapfile."&temas=".$mapfile."' cols=100 rows=20 style='left:10px;position:relative;top:2px;overflow:hidden;width:500px;height:500px;border:1px solid gray;'>";
70 98 echo "</iframe></div>";
71 99 echo "<input type=hidden name=tipo value=gravar />";
72 100  
... ... @@ -95,8 +123,9 @@ body {
95 123 <script>
96 124 i3GEO.configura = {locaplic: "../../"};
97 125  
  126 +/*
98 127 ins = "<p><div id=filtroDeLetras ></div><br>";
99   -//document.getElementById("letras").innerHTML = ins;
  128 +document.getElementById("letras").innerHTML = ins;
100 129 core_listaDeLetras("filtroDeLetras","filtraLetra");
101 130 if(i3GEO.util.pegaCookie("I3GEOletraAdmin")) {
102 131 letraAtual = i3GEO.util.pegaCookie("I3GEOletraAdmin");
... ... @@ -104,6 +133,22 @@ if(i3GEO.util.pegaCookie(&quot;I3GEOletraAdmin&quot;)) {
104 133 else{
105 134 letraAtual = "";
106 135 }
  136 +*/
  137 +
  138 +var editorCM = CodeMirror.fromTextArea(document.getElementById("editor"), {
  139 + mode: 'text',
  140 + tabMode: 'indent',
  141 + lineNumbers: true,
  142 + theme: "elegant"
  143 +});
  144 +
  145 +function mudaEstilo(novo){
  146 + editorCM.setOption('theme',novo)
  147 +}
  148 +
  149 +function atualizaTextArea(){
  150 + document.getElementById("editor").value = editorCM.getValue();
  151 +}
107 152 function filtraLetra(letra) {
108 153 letraAtual = letra;
109 154 if (letra == "Todos") {
... ... @@ -125,7 +170,7 @@ function comboMapfiles(){
125 170 $i("comboMapfiles").innerHTML = ins;
126 171 $i("selectComboMapfile").value = "<?php echo $_GET["mapfile"];?>";
127 172 };
128   -core_pegaMapfiles("comboMapfiles()",letraAtual,"");
  173 +core_pegaMapfiles("comboMapfiles()","","");
129 174 function mudaMapfile(obj){
130 175 if(obj.value != ""){
131 176 window.location.href = "editortexto.php?mapfile="+obj.value;
... ...
temas/_cursoaeroporto.map
1   -MAP
2   - FONTSET "../symbols/fontes.txt"
3   - SYMBOLSET "../symbols/simbolosv6.sym"
4   - LAYER
5   - DATA "/var/www/i3geo/aplicmap/dados/sc22/AEROPORTO_CAMPO_DE_POUSO.shp"
6   - METADATA
7   - "ltempoitemimagem" ""
8   - "ltempoitemdescricao" ""
9   - "CLASSE" "SIM"
10   - "ltempoiteminicio" ""
11   - "palletestep" ""
12   - "ltempoitemtip" ""
13   - "ltempoitemtitulo" ""
14   - "description_template" ""
15   - "ltempoitemlink" ""
16   - "palletefile" ""
17   - "ltempoformatodata" ""
18   - "ltempoitemicone" ""
19   - "PLUGINI3GEO" ""
20   - "itembuscarapida" ""
21   - "TEMA" "Aeroportos SC22"
22   - "ltempoconvencode" ""
23   - "editorsql" ""
24   - "ltempoitemfim" ""
25   - END # METADATA
26   - NAME "_cursoaeroporto"
27   - STATUS OFF
28   - TEMPLATE "none.htm"
29   - TILEITEM "location"
30   - TYPE POINT
31   - UNITS METERS
32   - CLASS
33   - NAME ""
34   - STYLE
35   - COLOR 255 0 0
36   - OUTLINECOLOR 0 0 0
37   - SIZE 15
38   - SYMBOL "ponto"
39   - END # STYLE
40   - END # CLASS
41   - END # LAYER
42   -
43   -END # MAP
44   -
  1 +MAP
  2 + FONTSET "../symbols/fontes.txt"
  3 + SYMBOLSET "../symbols/simbolosv6.sym"
  4 + LAYER
  5 + DATA "/var/www/i3geo/aplicmap/dados/sc22/AEROPORTO_CAMPO_DE_POUSO.shp"
  6 + METADATA
  7 + "ltempoitemimagem" ""
  8 + "ltempoitemdescricao" ""
  9 + "CLASSE" "SIM"
  10 + "ltempoiteminicio" ""
  11 + "palletestep" ""
  12 + "ltempoitemtip" ""
  13 + "ltempoitemtitulo" ""
  14 + "description_template" ""
  15 + "ltempoitemlink" ""
  16 + "palletefile" ""
  17 + "ltempoformatodata" ""
  18 + "ltempoitemicone" ""
  19 + "PLUGINI3GEO" ""
  20 + "itembuscarapida" ""
  21 + "TEMA" "Aeroportos SC22ç"
  22 + "ltempoconvencode" ""
  23 + "editorsql" ""
  24 + "ltempoitemfim" ""
  25 + END # METADATA
  26 + NAME "_cursoaeroporto"
  27 + STATUS OFF
  28 + TEMPLATE "none.htm"
  29 + TILEITEM "location"
  30 + TYPE POINT
  31 + UNITS METERS
  32 + CLASS
  33 + NAME ""
  34 + STYLE
  35 + COLOR 255 0 0
  36 + OUTLINECOLOR 0 0 0
  37 + SIZE 15
  38 + SYMBOL "ponto"
  39 + END # STYLE
  40 + END # CLASS
  41 + END # LAYER
  42 +
  43 +END # MAP
  44 +
... ...