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 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 6 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html> 7 <html>
3 <head> 8 <head>
4 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> 9 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
5 <title>Editor texto</title> 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 <style type="text/css"> 22 <style type="text/css">
7 body { 23 body {
8 margin: 20; 24 margin: 20;
9 padding: 20; 25 padding: 20;
10 font-size: 14px; 26 font-size: 14px;
11 } 27 }
  28 +.CodeMirror {
  29 + height:500px;
  30 + float: left;
  31 + width: 500px;
12 </style> 32 </style>
13 -<link rel="stylesheet" type="text/css" href="../html/admin.css">  
14 </head> 33 </head>
15 <body class=" yui-skin-sam "> 34 <body class=" yui-skin-sam ">
16 <div class="" id="divGeral" style="width: 100%;"> 35 <div class="" id="divGeral" style="width: 100%;">
@@ -21,7 +40,7 @@ body { @@ -21,7 +40,7 @@ body {
21 <br> <br> Mapfile em edi&ccedil;&atilde;o: 40 <br> <br> Mapfile em edi&ccedil;&atilde;o:
22 <div id="comboMapfiles" style="width: 100%; max-width: 450px">Aguarde...</div> 41 <div id="comboMapfiles" style="width: 100%; max-width: 450px">Aguarde...</div>
23 <br><br> 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 <input type=submit value="Salvar (tamb&eacute;m atualiza o mapa)" /> 44 <input type=submit value="Salvar (tamb&eacute;m atualiza o mapa)" />
26 <input type=button value="Testar" onclick="testar()" /> 45 <input type=button value="Testar" onclick="testar()" />
27 <input type=button value="Testar no i3Geo" onclick="abrirI3geo()" /> 46 <input type=button value="Testar no i3Geo" onclick="abrirI3geo()" />
@@ -60,13 +79,22 @@ body { @@ -60,13 +79,22 @@ body {
60 } 79 }
61 fclose($fp); 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 echo file_get_contents($mapfile); 93 echo file_get_contents($mapfile);
66 echo "</TEXTAREA>"; 94 echo "</TEXTAREA>";
67 $mapfile = str_replace("\\","/",$mapfile); 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 echo "</iframe></div>"; 98 echo "</iframe></div>";
71 echo "<input type=hidden name=tipo value=gravar />"; 99 echo "<input type=hidden name=tipo value=gravar />";
72 100
@@ -95,8 +123,9 @@ body { @@ -95,8 +123,9 @@ body {
95 <script> 123 <script>
96 i3GEO.configura = {locaplic: "../../"}; 124 i3GEO.configura = {locaplic: "../../"};
97 125
  126 +/*
98 ins = "<p><div id=filtroDeLetras ></div><br>"; 127 ins = "<p><div id=filtroDeLetras ></div><br>";
99 -//document.getElementById("letras").innerHTML = ins; 128 +document.getElementById("letras").innerHTML = ins;
100 core_listaDeLetras("filtroDeLetras","filtraLetra"); 129 core_listaDeLetras("filtroDeLetras","filtraLetra");
101 if(i3GEO.util.pegaCookie("I3GEOletraAdmin")) { 130 if(i3GEO.util.pegaCookie("I3GEOletraAdmin")) {
102 letraAtual = i3GEO.util.pegaCookie("I3GEOletraAdmin"); 131 letraAtual = i3GEO.util.pegaCookie("I3GEOletraAdmin");
@@ -104,6 +133,22 @@ if(i3GEO.util.pegaCookie(&quot;I3GEOletraAdmin&quot;)) { @@ -104,6 +133,22 @@ if(i3GEO.util.pegaCookie(&quot;I3GEOletraAdmin&quot;)) {
104 else{ 133 else{
105 letraAtual = ""; 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 function filtraLetra(letra) { 152 function filtraLetra(letra) {
108 letraAtual = letra; 153 letraAtual = letra;
109 if (letra == "Todos") { 154 if (letra == "Todos") {
@@ -125,7 +170,7 @@ function comboMapfiles(){ @@ -125,7 +170,7 @@ function comboMapfiles(){
125 $i("comboMapfiles").innerHTML = ins; 170 $i("comboMapfiles").innerHTML = ins;
126 $i("selectComboMapfile").value = "<?php echo $_GET["mapfile"];?>"; 171 $i("selectComboMapfile").value = "<?php echo $_GET["mapfile"];?>";
127 }; 172 };
128 -core_pegaMapfiles("comboMapfiles()",letraAtual,""); 173 +core_pegaMapfiles("comboMapfiles()","","");
129 function mudaMapfile(obj){ 174 function mudaMapfile(obj){
130 if(obj.value != ""){ 175 if(obj.value != ""){
131 window.location.href = "editortexto.php?mapfile="+obj.value; 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 +