Changeset f35c98c
- Timestamp:
- Nov 7, 2025, 4:05:15 PM (4 weeks ago)
- Branches:
- main
- Children:
- 9996219, e200df2
- Parents:
- 0d5f1b3
- Location:
- admin
- Files:
-
- 1 added
- 2 edited
-
modules/salva_config_sito.php (added)
-
modules/setup_sito.php (modified) (6 diffs)
-
principale.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
admin/modules/setup_sito.php
r0d5f1b3 rf35c98c 8 8 $EMAIL_ADMIN = $row[0]['adminmail']; 9 9 $MAP_PROVIDER = $row[0]['googlemaps']==='1' ? 'google' : 'openstreetmap' ; 10 $MULTICOMUNE = $row[0]['multicomune'] ==='1' ? 'si' : 'no';10 $MULTICOMUNE = $row[0]['multicomune']; #==='1' ? 'si' : 'no'; 11 11 $gru = [ 12 'google_api_key' => "'".$row[0]['gkey']."'"12 'google_api_key' => $row[0]['gkey'] 13 13 ]; 14 14 #$MAP_PROVIDER = isset($gru['googlemaps']) && in_array($gru['googlemaps'], ['google', 'openstreetmap']) ? $gru['googlemaps'] : 'openstreetmap'; 15 15 $GOOGLE_API_KEY = !empty($gru['google_api_key']) ? htmlspecialchars($gru['google_api_key']) : ''; 16 16 $GOOGLE_API_KEY = $row[0]['gkey']; 17 17 $SITE_ISTAT=$row[0]['siteistat']; 18 18 $row=elenco_comuni(); 19 19 foreach($row as $key=>$val){ 20 $comuni_disponibili[]=$val['descrizione']; 20 if(!isset($DEFAULT_COMUNE)) {$DEFAULT_COMUNE=$val['descrizione']; $SITE_ISTAT_TMP=$val['id_comune'];} 21 $comuni_disponibili[]=[$val['descrizione'],$val['id_comune']]; 21 22 if($val['id_comune']==$SITE_ISTAT) $DEFAULT_COMUNE=$val['descrizione']; 22 23 } … … 35 36 </div> 36 37 <div class="card-body"> 37 <form >38 <form id="configSitoForm" onsubmit="aggiornaDati(event)"> 38 39 <!-- LOGO + ANTEPRIMA --> 39 40 <div class="mb-3 d-flex align-items-center"> … … 95 96 <label for="multicomune" class="form-label">Gestione multicomune?</label> 96 97 <select class="form-select" name="multicomune" id="multicomune" onchange="toggleComuneDefault()"> 97 <option value=" si" <?= $MULTICOMUNE === 'si' ? 'selected' : '' ?>>Si</option>98 <option value=" no" <?= $MULTICOMUNE === 'no' ? 'selected' : '' ?>>No</option>98 <option value="1" <?= $MULTICOMUNE === '1' ? 'selected' : '' ?>>Si</option> 99 <option value="0" <?= $MULTICOMUNE === '0' ? 'selected' : '' ?>>No</option> 99 100 </select> 100 101 </div> 101 102 102 103 <!-- COMUNE DI DEFAULT --> 103 <div class="mb-3" id="defaultComuneRow" style="<?= $MULTICOMUNE === ' si' ? '' : 'display:none;' ?>">104 <div class="mb-3" id="defaultComuneRow" style="<?= $MULTICOMUNE === '1' ? '' : 'display:none;' ?>"> 104 105 <label for="defaultComune" class="form-label">Comune visualizzato per default</label> 105 106 <select class="form-select" name="default_comune" id="defaultComune"> 106 107 <?php foreach ($comuni_disponibili as $comune): ?> 107 <option value="<?= htmlspecialchars($comune) ?>" <?= $DEFAULT_COMUNE === $comune? 'selected' : '' ?>>108 <?= htmlspecialchars($comune ) ?>108 <option value="<?= $comune[1] ?>" <?= $SITE_ISTAT === $comune[1] ? 'selected' : '' ?>> 109 <?= htmlspecialchars($comune[0]) ?> 109 110 </option> 110 111 <?php endforeach; ?> … … 129 130 <button type="submit" class="btn btn-primary">Salva</button> 130 131 </div> 132 <div class="d-flex justify-content-end" id="risultato"> 133 134 </div> 131 135 </form> 132 136 </div> … … 136 140 137 141 <script> 142 function aggiornaDati(e) { 143 e.preventDefault(); 144 const siteName = document.getElementById('siteName').value; 145 const siteUrl = document.getElementById('siteUrl').value; 146 const emailAdmin = document.getElementById('emailAdmin').value; 147 const mapsProvider = document.getElementById('maps_provider').value; 148 const googleApiKey = document.getElementById('googleApiKey').value; 149 const multicomune = document.getElementById('multicomune').value; 150 const defaultComune = document.getElementById('defaultComune').value; 151 152 // Salvataggio nel DB (commentato) 153 var xmlhttp = new XMLHttpRequest(); 154 xmlhttp.onreadystatechange = function() { 155 if (this.readyState == 4 && this.status == 200) { 156 document.getElementById("risultato").innerHTML = this.responseText; 157 document.getElementById("bottoneStato").focus(); 158 } 159 } 160 xmlhttp.open("GET","../principale.php?funzione=salvaConfigSito&siteName="+siteName+"&siteUrl="+siteUrl+"&emailAdmin="+emailAdmin+"&mapsProvider="+mapsProvider+"&googleApiKey="+googleApiKey+"&multicomune="+multicomune+"&defaultComune="+defaultComune,true); 161 xmlhttp.send(); 162 } 163 138 164 // Tooltip Bootstrap 5 init 139 165 document.addEventListener('DOMContentLoaded', function () { … … 172 198 function toggleComuneDefault() { 173 199 const multicomune = document.getElementById('multicomune').value; 174 document.getElementById('defaultComuneRow').style.display = (multicomune === 'si') ? '' : 'none'; 175 } 200 document.getElementById('defaultComuneRow').style.display = (multicomune === '1') ? '' : 'none'; 201 } 202 203 function nascondiElemento() { 204 const elemento = document.getElementById('risultato'); 205 if (elemento) { 206 // Imposta la proprietà CSS display su 'none' 207 elemento.style.display = 'none'; 208 } 209 } 176 210 </script> -
admin/principale.php
r0d5f1b3 rf35c98c 93 93 include("modules/salva_orario_affluenza.php"); 94 94 break; 95 case 'salvaConfigSito': 96 include("modules/salva_config_sito.php"); 97 break; 95 98 case 101: 96 99 include("ws/funzioni/salvaModifiche.php");
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/eleonline4/chrome/common/trac_banner.png)