Commit 670079e7abd50b3eac9d2eeba14cfc0ae17c05fa

Authored by Edmar Moretti
1 parent 0f0bfc09

Inclusão do editor de textos no sistema de administração

Showing 2 changed files with 24 additions and 5 deletions   Show diff stats
admin/php/editortexto.php
@@ -12,7 +12,17 @@ @@ -12,7 +12,17 @@
12 </style> 12 </style>
13 </head> 13 </head>
14 <body> 14 <body>
  15 +<a href="http://mapserver.org/mapfile/index.html#mapfile" target="_new" >Documentação do Mapserver</a><br><br>
  16 +<form action="editortexto.php?mapfile=<?php echo $_GET["mapfile"];?>" method=post >
  17 +
  18 +<input type=submit value="Salvar"/><input type=button value="Testar" onclick="testar()" /> (Salve antes de testar)<br><br>
  19 +Edite:<br>
15 <?php 20 <?php
  21 +//evita erros removendo caracteres PHP
  22 +if(isset($_POST["texto"])){
  23 + $gravarTexto = $_POST["texto"];
  24 + $_POST["texto"] = "";
  25 +}
16 include_once("admin.php"); 26 include_once("admin.php");
17 error_reporting(0); 27 error_reporting(0);
18 if(verificaEditores($editores) == "nao") 28 if(verificaEditores($editores) == "nao")
@@ -21,10 +31,19 @@ $mapfile = &quot;../../temas/&quot;.$_GET[&quot;mapfile&quot;].&quot;.map&quot;; @@ -21,10 +31,19 @@ $mapfile = &quot;../../temas/&quot;.$_GET[&quot;mapfile&quot;].&quot;.map&quot;;
21 if(!file_exists($mapfile)) 31 if(!file_exists($mapfile))
22 {echo "Arquivo $mapfile não existe.";exit;} 32 {echo "Arquivo $mapfile não existe.";exit;}
23 if($_POST["tipo"] == "gravar"){ 33 if($_POST["tipo"] == "gravar"){
24 -  
25 -exit; 34 + $fp = fopen($mapfile,"w");
  35 + fwrite($fp,$gravarTexto);
  36 + fclose($fp);
26 } 37 }
  38 +
27 echo "<TEXTAREA name=texto cols=100 rows=20 >"; 39 echo "<TEXTAREA name=texto cols=100 rows=20 >";
28 echo file_get_contents($mapfile); 40 echo file_get_contents($mapfile);
29 echo "</TEXTAREA>"; 41 echo "</TEXTAREA>";
30 -?>  
31 \ No newline at end of file 42 \ No newline at end of file
  43 +echo "<input type=hidden name=tipo value=gravar />";
  44 +?>
  45 +</form>
  46 +<script>
  47 +function testar(){
  48 + window.open("../../testamapfile.php?map=<?php echo $_GET["mapfile"]; ?>");
  49 +}
  50 +</script>
32 \ No newline at end of file 51 \ No newline at end of file
temas/biomashp.map
@@ -80,7 +80,7 @@ MAP @@ -80,7 +80,7 @@ MAP
80 END 80 END
81 END 81 END
82 CLASS 82 CLASS
83 - NAME "AMAZONIA" 83 + NAME "AMAZÔNIA"
84 EXPRESSION ('[ID]'eq'1.00') 84 EXPRESSION ('[ID]'eq'1.00')
85 STYLE 85 STYLE
86 ANGLE 360 86 ANGLE 360
@@ -90,7 +90,7 @@ MAP @@ -90,7 +90,7 @@ MAP
90 END 90 END
91 END 91 END
92 CLASS 92 CLASS
93 - NAME "MATA ATLANTICA" 93 + NAME "MATA ATLÂNTICA"
94 EXPRESSION ('[ID]'eq'4.00') 94 EXPRESSION ('[ID]'eq'4.00')
95 STYLE 95 STYLE
96 ANGLE 360 96 ANGLE 360