|
@@ -24,7 +24,7 @@ discard block |
|
|
block discarded – undo |
|
24
|
24
|
|
|
25
|
25
|
use Exception; |
|
26
|
26
|
|
|
27
|
|
-require_once dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"; |
|
|
27
|
+require_once dirname(dirname(dirname(dirname(__FILE__))))."/config/_config.php"; |
|
28
|
28
|
|
|
29
|
29
|
/** |
|
30
|
30
|
* We need to display previously set options in various forms. This class covers |
|
@@ -87,7 +87,7 @@ discard block |
|
|
block discarded – undo |
|
87
|
87
|
* @return string HTML code <table> |
|
88
|
88
|
*/ |
|
89
|
89
|
public function prefilledOptionTable(string $attributePrefix) { |
|
90
|
|
- $retval = "<table id='expandable_$attributePrefix" . "_options'>"; |
|
|
90
|
+ $retval = "<table id='expandable_$attributePrefix"."_options'>"; |
|
91
|
91
|
|
|
92
|
92
|
$prepopulate = []; |
|
93
|
93
|
foreach ($this->listOfOptions as $existingAttribute) { |
|
@@ -95,7 +95,7 @@ discard block |
|
|
block discarded – undo |
|
95
|
95
|
$prepopulate[] = $existingAttribute; |
|
96
|
96
|
} |
|
97
|
97
|
} |
|
98
|
|
- if (is_array($prepopulate) && ( count($prepopulate) > 0 || $attributePrefix == "device-specific" || $attributePrefix == "eap-specific" )) { // editing... fill with values |
|
|
98
|
+ if (is_array($prepopulate) && (count($prepopulate) > 0 || $attributePrefix == "device-specific" || $attributePrefix == "eap-specific")) { // editing... fill with values |
|
99
|
99
|
$retval .= $this->addOptionEdit($attributePrefix, $prepopulate); |
|
100
|
100
|
} else { |
|
101
|
101
|
$retval .= $this->addOptionNew($attributePrefix); |
|
@@ -127,7 +127,7 @@ discard block |
|
|
block discarded – undo |
|
127
|
127
|
$optiontypearray = $optioninfo->optionType($option['name']); |
|
128
|
128
|
$loggerInstance = new \core\common\Logging(); |
|
129
|
129
|
$loggerInstance->debug(5, "About to execute optiontext with PREFILL!\n"); |
|
130
|
|
- $retval .= $this->optiontext([$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-' . $option['level'] . '-' . $option['row'] : $option['value']), $option['lang']); |
|
|
130
|
+ $retval .= $this->optiontext([$option['name']], ($optiontypearray["type"] == "file" ? 'ROWID-'.$option['level'].'-'.$option['row'] : $option['value']), $option['lang']); |
|
131
|
131
|
} |
|
132
|
132
|
} |
|
133
|
133
|
return $retval; |
|
@@ -206,7 +206,7 @@ discard block |
|
|
block discarded – undo |
|
206
|
206
|
if (!isset($descriptions[$input])) { |
|
207
|
207
|
return ""; |
|
208
|
208
|
} |
|
209
|
|
- return "<span class='tooltip' id='S$rowid-tooltip-$input' style='display:" . ($isVisible ? "block" : "none") . "' onclick='alert(\"" . $descriptions[$input] . "\")'><img src='../resources/images/icons/question-mark-icon.png" . "'></span>"; |
|
|
209
|
+ return "<span class='tooltip' id='S$rowid-tooltip-$input' style='display:".($isVisible ? "block" : "none")."' onclick='alert(\"".$descriptions[$input]."\")'><img src='../resources/images/icons/question-mark-icon.png"."'></span>"; |
|
210
|
210
|
} |
|
211
|
211
|
|
|
212
|
212
|
/** |
|
@@ -219,18 +219,18 @@ discard block |
|
|
block discarded – undo |
|
219
|
219
|
*/ |
|
220
|
220
|
private function selectElement($rowid, $list) { |
|
221
|
221
|
$jsmagic = "onchange=' |
|
222
|
|
- if (/#ML#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) { |
|
|
222
|
+ if (/#ML#/.test(document.getElementById(\"option-S" . $rowid."-select\").value)) { |
|
223
|
223
|
document.getElementById(\"S$rowid-input-langselect\").style.display = \"block\"; |
|
224
|
224
|
} else { |
|
225
|
225
|
document.getElementById(\"S$rowid-input-langselect\").style.display = \"none\"; |
|
226
|
226
|
}"; |
|
227
|
227
|
foreach (array_keys(OptionDisplay::HTML_DATATYPE_TEXTS) as $key) { |
|
228
|
|
- $jsmagic .= "if (/#" . $key . "#/.test(document.getElementById(\"option-S" . $rowid . "-select\").value)) { |
|
229
|
|
- document.getElementById(\"S$rowid-input-file\").style.display = \"" . ($key == \core\Options::TYPECODE_FILE ? "block" : "none") . "\"; |
|
230
|
|
- document.getElementById(\"S$rowid-input-text\").style.display = \"" . ($key == \core\Options::TYPECODE_TEXT ? "block" : "none") . "\"; |
|
231
|
|
- document.getElementById(\"S$rowid-input-string\").style.display = \"" . ($key == \core\Options::TYPECODE_STRING ? "block" : "none") . "\"; |
|
232
|
|
- document.getElementById(\"S$rowid-input-boolean\").style.display = \"" . ($key == \core\Options::TYPECODE_BOOLEAN ? "block" : "none") . "\"; |
|
233
|
|
- document.getElementById(\"S$rowid-input-integer\").style.display = \"" . ($key == \core\Options::TYPECODE_INTEGER ? "block" : "none") . "\"; |
|
|
228
|
+ $jsmagic .= "if (/#".$key."#/.test(document.getElementById(\"option-S".$rowid."-select\").value)) { |
|
|
229
|
+ document.getElementById(\"S$rowid-input-file\").style.display = \"".($key == \core\Options::TYPECODE_FILE ? "block" : "none")."\"; |
|
|
230
|
+ document.getElementById(\"S$rowid-input-text\").style.display = \"".($key == \core\Options::TYPECODE_TEXT ? "block" : "none")."\"; |
|
|
231
|
+ document.getElementById(\"S$rowid-input-string\").style.display = \"".($key == \core\Options::TYPECODE_STRING ? "block" : "none")."\"; |
|
|
232
|
+ document.getElementById(\"S$rowid-input-boolean\").style.display = \"".($key == \core\Options::TYPECODE_BOOLEAN ? "block" : "none")."\"; |
|
|
233
|
+ document.getElementById(\"S$rowid-input-integer\").style.display = \"".($key == \core\Options::TYPECODE_INTEGER ? "block" : "none")."\"; |
|
234
|
234
|
} |
|
235
|
235
|
"; |
|
236
|
236
|
// hide all tooltips (each is a <span>, and there are no other <span>s) |
|
@@ -259,7 +259,7 @@ discard block |
|
|
block discarded – undo |
|
259
|
259
|
$activelisttype = []; |
|
260
|
260
|
foreach ($list as $value) { |
|
261
|
261
|
$listtype = $optioninfo->optionType($value); |
|
262
|
|
- $retval .= "<option id='option-S$rowid-v-$value' value='$value#" . $listtype["type"] . "#" . $listtype["flag"] . "#' "; |
|
|
262
|
+ $retval .= "<option id='option-S$rowid-v-$value' value='$value#".$listtype["type"]."#".$listtype["flag"]."#' "; |
|
263
|
263
|
if ($iterator == $this->optionIterator) { |
|
264
|
264
|
$retval .= "selected='selected'"; |
|
265
|
265
|
$activelisttype = $listtype; |
|
@@ -267,7 +267,7 @@ discard block |
|
|
block discarded – undo |
|
267
|
267
|
} else { |
|
268
|
268
|
$tooltips .= $this->tooltip($rowid, $value, FALSE); |
|
269
|
269
|
} |
|
270
|
|
- $retval .= ">" . $uiElements->displayName($value) . "</option>"; |
|
|
270
|
+ $retval .= ">".$uiElements->displayName($value)."</option>"; |
|
271
|
271
|
$iterator++; |
|
272
|
272
|
} |
|
273
|
273
|
if (count($activelisttype) == 0) { |
|
@@ -290,9 +290,9 @@ discard block |
|
|
block discarded – undo |
|
290
|
290
|
*/ |
|
291
|
291
|
private function selectLanguage($rowid, $makeVisible) { |
|
292
|
292
|
\core\common\Entity::intoThePotatoes(); |
|
293
|
|
- $retval = "<select style='display:" . ($makeVisible ? "block" : "none") . "' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect'> |
|
294
|
|
- <option value='' name='select_language' selected>" . _("select language") . "</option> |
|
295
|
|
- <option value='C' name='all_languages'>" . _("default/other languages") . "</option>"; |
|
|
293
|
+ $retval = "<select style='display:".($makeVisible ? "block" : "none")."' name='value[S$rowid-lang]' id='S".$rowid."-input-langselect'> |
|
|
294
|
+ <option value='' name='select_language' selected>" . _("select language")."</option> |
|
|
295
|
+ <option value='C' name='all_languages'>" . _("default/other languages")."</option>"; |
|
296
|
296
|
foreach (CONFIG['LANGUAGES'] as $langindex => $possibleLang) { |
|
297
|
297
|
$thislang = $possibleLang['display']; |
|
298
|
298
|
$retval .= "<option value='$langindex' name='$langindex'>$thislang</option>"; |
|
@@ -320,7 +320,7 @@ discard block |
|
|
block discarded – undo |
|
320
|
320
|
private function inputFields($rowid, $activetype) { |
|
321
|
321
|
$retval = ""; |
|
322
|
322
|
foreach (OptionDisplay::HTML_DATATYPE_TEXTS as $key => $type) { |
|
323
|
|
- $retval .= "<" . $type['html'] . " style='display:" . ($activetype['type'] == $key ? "block" : "none") . "' name='value[S$rowid-$key]' id='S" . $rowid . "-input-" . $key . "'" . $type['tail'] . ">"; |
|
|
323
|
+ $retval .= "<".$type['html']." style='display:".($activetype['type'] == $key ? "block" : "none")."' name='value[S$rowid-$key]' id='S".$rowid."-input-".$key."'".$type['tail'].">"; |
|
324
|
324
|
} |
|
325
|
325
|
return $retval; |
|
326
|
326
|
} |
|
@@ -335,11 +335,11 @@ discard block |
|
|
block discarded – undo |
|
335
|
335
|
private function noPrefillText(int $rowid, array $list) { |
|
336
|
336
|
// first column: the <select> element with the names of options and their field-toggling JS magic |
|
337
|
337
|
$selectorInfo = $this->selectElement($rowid, $list); |
|
338
|
|
- $retval = "<td>" . $selectorInfo["TEXT"] . "</td>"; |
|
|
338
|
+ $retval = "<td>".$selectorInfo["TEXT"]."</td>"; |
|
339
|
339
|
// second column: the <select> element for language selection - only visible if the active option is multi-lang |
|
340
|
|
- $retval .= "<td>" . $this->selectLanguage($rowid, $selectorInfo['ACTIVE']['flag'] == "ML") . "</td>"; |
|
|
340
|
+ $retval .= "<td>".$this->selectLanguage($rowid, $selectorInfo['ACTIVE']['flag'] == "ML")."</td>"; |
|
341
|
341
|
// third column: the actual input fields; the data type of the active option is visible, all others hidden |
|
342
|
|
- $retval .= "<td>" . $this->inputFields($rowid, $selectorInfo['ACTIVE']) . "</td>"; |
|
|
342
|
+ $retval .= "<td>".$this->inputFields($rowid, $selectorInfo['ACTIVE'])."</td>"; |
|
343
|
343
|
return $retval; |
|
344
|
344
|
} |
|
345
|
345
|
|
|
@@ -362,20 +362,20 @@ discard block |
|
|
block discarded – undo |
|
362
|
362
|
$retval .= "<td>"; |
|
363
|
363
|
$uiElements = new UIElements(); |
|
364
|
364
|
$listtype = $optioninfo->optionType($optionName); |
|
365
|
|
- $retval .= "<span style='display:flex;'>" . $uiElements->displayName($optionName); |
|
366
|
|
- $retval .= $this->tooltip($rowid, $optionName, TRUE) . "</span>"; |
|
367
|
|
- $retval .= "<input type='hidden' id='option-S$rowid-select' name='option[S$rowid]' value='$optionName#" . $listtype["type"] . "#" . $listtype["flag"] . "#' ></td>"; |
|
|
365
|
+ $retval .= "<span style='display:flex;'>".$uiElements->displayName($optionName); |
|
|
366
|
+ $retval .= $this->tooltip($rowid, $optionName, TRUE)."</span>"; |
|
|
367
|
+ $retval .= "<input type='hidden' id='option-S$rowid-select' name='option[S$rowid]' value='$optionName#".$listtype["type"]."#".$listtype["flag"]."#' ></td>"; |
|
368
|
368
|
|
|
369
|
369
|
// language tag if any |
|
370
|
370
|
$retval .= "<td>"; |
|
371
|
371
|
if ($listtype["flag"] == "ML") { |
|
372
|
372
|
|
|
373
|
|
- $language = "(" . strtoupper($optionLang) . ")"; |
|
|
373
|
+ $language = "(".strtoupper($optionLang).")"; |
|
374
|
374
|
if ($optionLang == 'C') { |
|
375
|
375
|
$language = _("(default/other languages)"); |
|
376
|
376
|
} |
|
377
|
377
|
$retval .= $language; |
|
378
|
|
- $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S" . $rowid . "-input-langselect' value='" . $optionLang . "' style='display:block'>"; |
|
|
378
|
+ $retval .= "<input type='hidden' name='value[S$rowid-lang]' id='S".$rowid."-input-langselect' value='".$optionLang."' style='display:block'>"; |
|
379
|
379
|
} |
|
380
|
380
|
$retval .= "</td>"; |
|
381
|
381
|
// attribute content |
|
@@ -385,12 +385,12 @@ discard block |
|
|
block discarded – undo |
|
385
|
385
|
case \core\Options::TYPECODE_COORDINATES: |
|
386
|
386
|
$this->allLocationCount = $this->allLocationCount + 1; |
|
387
|
387
|
// display of the locations varies by map provider |
|
388
|
|
- $classname = "\web\lib\admin\Map" . CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER']; |
|
|
388
|
+ $classname = "\web\lib\admin\Map".CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER']; |
|
389
|
389
|
$link = $classname::optionListDisplayCode($optionValue, $this->allLocationCount); |
|
390
|
|
- $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-" . \core\Options::TYPECODE_TEXT . "]' id='S$rowid-input-text' value='$optionValue'>$link"; |
|
|
390
|
+ $retval .= "<input readonly style='display:none' type='text' name='value[S$rowid-".\core\Options::TYPECODE_TEXT."]' id='S$rowid-input-text' value='$optionValue'>$link"; |
|
391
|
391
|
break; |
|
392
|
392
|
case \core\Options::TYPECODE_FILE: |
|
393
|
|
- $retval .= "<input readonly type='text' name='value[S$rowid-" . \core\Options::TYPECODE_STRING . "]' id='S" . $rowid . "-input-string' style='display:none' value='" . urlencode($optionValue) . "'>"; |
|
|
393
|
+ $retval .= "<input readonly type='text' name='value[S$rowid-".\core\Options::TYPECODE_STRING."]' id='S".$rowid."-input-string' style='display:none' value='".urlencode($optionValue)."'>"; |
|
394
|
394
|
$uiElements = new UIElements(); |
|
395
|
395
|
switch ($optionName) { |
|
396
|
396
|
case "eap:ca_file": |
|
@@ -420,7 +420,7 @@ discard block |
|
|
block discarded – undo |
|
420
|
420
|
if ($listtype['type'] == \core\Options::TYPECODE_BOOLEAN) {// only modify in this one case |
|
421
|
421
|
$displayedVariant = ($optionValue == "on" ? _("on") : _("off")); |
|
422
|
422
|
} |
|
423
|
|
- $retval .= "<strong>$displayedVariant</strong><input type='hidden' name='value[S$rowid-" . $listtype['type'] . "]' id='S" . $rowid . "-input-" . $listtype["type"] . "' value=\"" . htmlspecialchars($optionValue) . "\" style='display:block'>"; |
|
|
423
|
+ $retval .= "<strong>$displayedVariant</strong><input type='hidden' name='value[S$rowid-".$listtype['type']."]' id='S".$rowid."-input-".$listtype["type"]."' value=\"".htmlspecialchars($optionValue)."\" style='display:block'>"; |
|
424
|
424
|
break; |
|
425
|
425
|
default: |
|
426
|
426
|
// this should never happen! |
|
@@ -464,10 +464,10 @@ discard block |
|
|
block discarded – undo |
|
464
|
464
|
<td> |
|
465
|
465
|
<button type='button' class='delete' onclick='"; |
|
466
|
466
|
if ($prefillValue !== NULL && $item == "general:geo_coordinates") { |
|
467
|
|
- $funcname = "Map" . CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER'] . 'DeleteCoord'; |
|
468
|
|
- $retval .= 'if (typeof ' . $funcname . ' === "function") { ' . $funcname . '(' . $this->allLocationCount . '); } '; |
|
|
467
|
+ $funcname = "Map".CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER'].'DeleteCoord'; |
|
|
468
|
+ $retval .= 'if (typeof '.$funcname.' === "function") { '.$funcname.'('.$this->allLocationCount.'); } '; |
|
469
|
469
|
} |
|
470
|
|
- $retval .= 'deleteOption("option-S' . $rowid . '")'; |
|
|
470
|
+ $retval .= 'deleteOption("option-S'.$rowid.'")'; |
|
471
|
471
|
$retval .= "'>-</button> |
|
472
|
472
|
</td> |
|
473
|
473
|
</tr>"; |