Skip to content

Commit 55151c2

Browse files
Merge pull request #18726 from MoonE/remove-obsolete-gis-editor-code
Remove obsolete code for stand-alone gis editor
2 parents 01334ff + 790234d commit 55151c2

21 files changed

Lines changed: 499 additions & 583 deletions

‎js/src/gis_data_editor.ts‎

Lines changed: 352 additions & 233 deletions
Large diffs are not rendered by default.

‎js/src/table/change.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ function verificationsAfterFieldChange (urlField, multiEdit, theType) {
478478
AJAX.registerTeardown('table/change.js', function () {
479479
$(document).off('click', 'span.open_gis_editor');
480480
$(document).off('click', 'input[name^=\'insert_ignore_\']');
481-
$(document).off('click', 'input[name=\'gis_data[save]\']');
481+
$(document).off('click', 'button.gis-copy-data');
482482
$(document).off('click', 'input.checkbox_null');
483483
$('select[name="submit_type"]').off('change');
484484
$(document).off('change', '#insert_rows');
@@ -602,7 +602,7 @@ AJAX.registerOnload('table/change.js', function () {
602602
/**
603603
* Uncheck the null checkbox as geometry data is placed on the input field
604604
*/
605-
$(document).on('click', 'input[name=\'gis_data[save]\']', function () {
605+
$(document).on('click', 'button.gis-copy-data', function () {
606606
var inputName = $('form#gis_data_editor_form').find('input[name=\'input_name\']').val();
607607
var currentRow = $('input[name=\'' + inputName + '\']').parents('tr');
608608
var $nullCheckbox = currentRow.find('.checkbox_null');

‎phpstan-baseline.neon‎

Lines changed: 20 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3470,16 +3470,6 @@ parameters:
34703470
count: 1
34713471
path: src/Controllers/Export/Template/UpdateController.php
34723472

3473-
-
3474-
message: "#^Cannot access offset 'add_geom' on mixed\\.$#"
3475-
count: 1
3476-
path: src/Controllers/GisDataEditorController.php
3477-
3478-
-
3479-
message: "#^Cannot access offset 'geom_count' on mixed\\.$#"
3480-
count: 2
3481-
path: src/Controllers/GisDataEditorController.php
3482-
34833473
-
34843474
message: "#^Cannot cast mixed to int\\.$#"
34853475
count: 1
@@ -3495,11 +3485,6 @@ parameters:
34953485
count: 1
34963486
path: src/Controllers/GisDataEditorController.php
34973487

3498-
-
3499-
message: "#^Parameter \\#1 \\$value of function intval expects array\\|bool\\|float\\|int\\|resource\\|string\\|null, mixed given\\.$#"
3500-
count: 1
3501-
path: src/Controllers/GisDataEditorController.php
3502-
35033488
-
35043489
message: "#^Parameter \\#1 \\$showGitRevision of class PhpMyAdmin\\\\Git constructor expects bool, mixed given\\.$#"
35053490
count: 1
@@ -10796,7 +10781,7 @@ parameters:
1079610781
path: src/Gis/GisGeometry.php
1079710782

1079810783
-
10799-
message: "#^Cannot access offset 'geom_count' on mixed\\.$#"
10784+
message: "#^Cannot access offset 'data_length' on mixed\\.$#"
1080010785
count: 1
1080110786
path: src/Gis/GisGeometryCollection.php
1080210787

@@ -10816,7 +10801,7 @@ parameters:
1081610801
path: src/Gis/GisLineString.php
1081710802

1081810803
-
10819-
message: "#^Cannot access offset 'no_of_points' on mixed\\.$#"
10804+
message: "#^Cannot access offset 'data_length' on mixed\\.$#"
1082010805
count: 1
1082110806
path: src/Gis/GisLineString.php
1082210807

@@ -10861,13 +10846,8 @@ parameters:
1086110846
path: src/Gis/GisMultiLineString.php
1086210847

1086310848
-
10864-
message: "#^Cannot access offset 'no_of_lines' on mixed\\.$#"
10865-
count: 1
10866-
path: src/Gis/GisMultiLineString.php
10867-
10868-
-
10869-
message: "#^Cannot access offset 'no_of_points' on mixed\\.$#"
10870-
count: 1
10849+
message: "#^Cannot access offset 'data_length' on mixed\\.$#"
10850+
count: 2
1087110851
path: src/Gis/GisMultiLineString.php
1087210852

1087310853
-
@@ -10891,7 +10871,7 @@ parameters:
1089110871
path: src/Gis/GisMultiLineString.php
1089210872

1089310873
-
10894-
message: "#^Cannot access offset int\\<0, max\\> on non\\-empty\\-array\\<'no_of_points'\\|int\\<0, max\\>, array\\{x\\: float, y\\: float\\}\\|int\\<0, max\\>\\>\\|int\\<1, max\\>\\.$#"
10874+
message: "#^Cannot access offset int\\<0, max\\> on non\\-empty\\-array\\<'data_length'\\|int\\<0, max\\>, array\\{x\\: float, y\\: float\\}\\|int\\<0, max\\>\\>\\|int\\<1, max\\>\\.$#"
1089510875
count: 1
1089610876
path: src/Gis/GisMultiLineString.php
1089710877

@@ -10916,7 +10896,7 @@ parameters:
1091610896
path: src/Gis/GisMultiPoint.php
1091710897

1091810898
-
10919-
message: "#^Cannot access offset 'no_of_points' on mixed\\.$#"
10899+
message: "#^Cannot access offset 'data_length' on mixed\\.$#"
1092010900
count: 1
1092110901
path: src/Gis/GisMultiPoint.php
1092210902

@@ -10966,28 +10946,18 @@ parameters:
1096610946
path: src/Gis/GisMultiPolygon.php
1096710947

1096810948
-
10969-
message: "#^Cannot access offset 'inner' on mixed\\.$#"
10970-
count: 5
10949+
message: "#^Cannot access offset 'data_length' on mixed\\.$#"
10950+
count: 3
1097110951
path: src/Gis/GisMultiPolygon.php
1097210952

1097310953
-
10974-
message: "#^Cannot access offset 'isOuter' on mixed\\.$#"
10954+
message: "#^Cannot access offset 'inner' on mixed\\.$#"
1097510955
count: 5
1097610956
path: src/Gis/GisMultiPolygon.php
1097710957

1097810958
-
10979-
message: "#^Cannot access offset 'no_of_lines' on mixed\\.$#"
10980-
count: 1
10981-
path: src/Gis/GisMultiPolygon.php
10982-
10983-
-
10984-
message: "#^Cannot access offset 'no_of_points' on mixed\\.$#"
10985-
count: 1
10986-
path: src/Gis/GisMultiPolygon.php
10987-
10988-
-
10989-
message: "#^Cannot access offset 'no_of_polygons' on mixed\\.$#"
10990-
count: 1
10959+
message: "#^Cannot access offset 'isOuter' on mixed\\.$#"
10960+
count: 5
1099110961
path: src/Gis/GisMultiPolygon.php
1099210962

1099310963
-
@@ -11011,7 +10981,7 @@ parameters:
1101110981
path: src/Gis/GisMultiPolygon.php
1101210982

1101310983
-
11014-
message: "#^Cannot access offset int on non\\-empty\\-array\\<'no_of_lines'\\|int, array\\{no_of_points\\: int\\<0, max\\>, 0\\?\\: array\\{x\\: float, y\\: float\\}\\}\\|int\\<1, max\\>\\>\\|int\\<1, max\\>\\.$#"
10984+
message: "#^Cannot access offset int on non\\-empty\\-array\\<'data_length'\\|int, array\\{data_length\\: int\\<0, max\\>, 0\\?\\: array\\{x\\: float, y\\: float\\}\\}\\|int\\<1, max\\>\\>\\|int\\<1, max\\>\\.$#"
1101510985
count: 1
1101610986
path: src/Gis/GisMultiPolygon.php
1101710987

@@ -11021,7 +10991,7 @@ parameters:
1102110991
path: src/Gis/GisMultiPolygon.php
1102210992

1102310993
-
11024-
message: "#^Cannot access offset int\\<0, max\\> on non\\-empty\\-array\\<'no_of_points'\\|int\\<0, max\\>, array\\{x\\: float, y\\: float\\}\\|int\\<0, max\\>\\>\\|int\\<1, max\\>\\.$#"
10994+
message: "#^Cannot access offset int\\<0, max\\> on non\\-empty\\-array\\<'data_length'\\|int\\<0, max\\>, array\\{x\\: float, y\\: float\\}\\|int\\<0, max\\>\\>\\|int\\<1, max\\>\\.$#"
1102510995
count: 1
1102610996
path: src/Gis/GisMultiPolygon.php
1102710997

@@ -11096,13 +11066,8 @@ parameters:
1109611066
path: src/Gis/GisPolygon.php
1109711067

1109811068
-
11099-
message: "#^Cannot access offset 'no_of_lines' on mixed\\.$#"
11100-
count: 1
11101-
path: src/Gis/GisPolygon.php
11102-
11103-
-
11104-
message: "#^Cannot access offset 'no_of_points' on mixed\\.$#"
11105-
count: 1
11069+
message: "#^Cannot access offset 'data_length' on mixed\\.$#"
11070+
count: 2
1110611071
path: src/Gis/GisPolygon.php
1110711072

1110811073
-
@@ -11121,7 +11086,7 @@ parameters:
1112111086
path: src/Gis/GisPolygon.php
1112211087

1112311088
-
11124-
message: "#^Cannot access offset int\\<0, max\\> on non\\-empty\\-array\\<'no_of_points'\\|int\\<0, max\\>, array\\{x\\: float, y\\: float\\}\\|int\\<0, max\\>\\>\\|int\\<1, max\\>\\.$#"
11089+
message: "#^Cannot access offset int\\<0, max\\> on non\\-empty\\-array\\<'data_length'\\|int\\<0, max\\>, array\\{x\\: float, y\\: float\\}\\|int\\<0, max\\>\\>\\|int\\<1, max\\>\\.$#"
1112511090
count: 1
1112611091
path: src/Gis/GisPolygon.php
1112711092

@@ -20606,7 +20571,7 @@ parameters:
2060620571
path: test/classes/FooterTest.php
2060720572

2060820573
-
20609-
message: "#^Cannot access offset 'no_of_points' on mixed\\.$#"
20574+
message: "#^Cannot access offset 'data_length' on mixed\\.$#"
2061020575
count: 2
2061120576
path: test/classes/Gis/Ds/PolygonTest.php
2061220577

@@ -20616,13 +20581,8 @@ parameters:
2061620581
path: test/classes/Gis/Ds/PolygonTest.php
2061720582

2061820583
-
20619-
message: "#^Cannot access offset 'no_of_lines' on mixed\\.$#"
20620-
count: 1
20621-
path: test/classes/Gis/GisMultiPolygonTest.php
20622-
20623-
-
20624-
message: "#^Cannot access offset 'no_of_points' on mixed\\.$#"
20625-
count: 1
20584+
message: "#^Cannot access offset 'data_length' on mixed\\.$#"
20585+
count: 2
2062620586
path: test/classes/Gis/GisMultiPolygonTest.php
2062720587

2062820588
-
@@ -20631,7 +20591,7 @@ parameters:
2063120591
path: test/classes/Gis/GisMultiPolygonTest.php
2063220592

2063320593
-
20634-
message: "#^Cannot access offset 'no_of_points' on mixed\\.$#"
20594+
message: "#^Cannot access offset 'data_length' on mixed\\.$#"
2063520595
count: 1
2063620596
path: test/classes/Gis/GisPolygonTest.php
2063720597

‎psalm-baseline.xml‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6365,7 +6365,7 @@
63656365
<code>$tempPoint[1]</code>
63666366
</MixedArgument>
63676367
<MixedArrayAccess>
6368-
<code><![CDATA[$gisData[$index]['LINESTRING']['no_of_points']]]></code>
6368+
<code><![CDATA[$gisData[$index]['LINESTRING']['data_length']]]></code>
63696369
<code>$tempPoint[0]</code>
63706370
<code>$tempPoint[0]</code>
63716371
<code>$tempPoint[1]</code>
@@ -6399,8 +6399,8 @@
63996399
</MixedArgument>
64006400
<MixedArrayAccess>
64016401
<code>$dataRow[$i]</code>
6402-
<code><![CDATA[$dataRow[$i]['no_of_points']]]></code>
6403-
<code><![CDATA[$dataRow['no_of_lines']]]></code>
6402+
<code><![CDATA[$dataRow[$i]['data_length']]]></code>
6403+
<code><![CDATA[$dataRow['data_length']]]></code>
64046404
<code><![CDATA[$point['x']]]></code>
64056405
<code><![CDATA[$point['y']]]></code>
64066406
<code><![CDATA[$rowData['parts'][$i]]]></code>
@@ -6432,16 +6432,16 @@
64326432
</PossiblyFalseArgument>
64336433
<PossiblyNullArrayAccess>
64346434
<code>$dataRow[$i]</code>
6435-
<code><![CDATA[$dataRow[$i]['no_of_points']]]></code>
6436-
<code><![CDATA[$dataRow['no_of_lines']]]></code>
6435+
<code><![CDATA[$dataRow[$i]['data_length']]]></code>
6436+
<code><![CDATA[$dataRow['data_length']]]></code>
64376437
</PossiblyNullArrayAccess>
64386438
<RedundantPropertyInitializationCheck>
64396439
<code>isset(self::$instance)</code>
64406440
</RedundantPropertyInitializationCheck>
64416441
</file>
64426442
<file src="src/Gis/GisMultiPoint.php">
64436443
<MixedArrayAccess>
6444-
<code><![CDATA[$gisData[$index]['MULTIPOINT']['no_of_points']]]></code>
6444+
<code><![CDATA[$gisData[$index]['MULTIPOINT']['data_length']]]></code>
64456445
<code><![CDATA[$rowData['points'][$i]]]></code>
64466446
<code><![CDATA[$rowData['points'][$i]]]></code>
64476447
<code><![CDATA[$rowData['points'][$i]['x']]]></code>
@@ -6483,9 +6483,9 @@
64836483
<code>$dataRow[$k]</code>
64846484
<code>$dataRow[$k]</code>
64856485
<code>$dataRow[$k][$i]</code>
6486-
<code><![CDATA[$dataRow[$k][$i]['no_of_points']]]></code>
6487-
<code><![CDATA[$dataRow[$k]['no_of_lines']]]></code>
6488-
<code><![CDATA[$dataRow['no_of_polygons']]]></code>
6486+
<code><![CDATA[$dataRow[$k][$i]['data_length']]]></code>
6487+
<code><![CDATA[$dataRow[$k]['data_length']]]></code>
6488+
<code><![CDATA[$dataRow['data_length']]]></code>
64896489
<code><![CDATA[$innerPoint['x']]]></code>
64906490
<code><![CDATA[$innerPoint['y']]]></code>
64916491
<code>$labelPoint[0]</code>
@@ -6563,9 +6563,9 @@
65636563
<code>$dataRow[$k]</code>
65646564
<code>$dataRow[$k]</code>
65656565
<code>$dataRow[$k][$i]</code>
6566-
<code><![CDATA[$dataRow[$k][$i]['no_of_points']]]></code>
6567-
<code><![CDATA[$dataRow[$k]['no_of_lines']]]></code>
6568-
<code><![CDATA[$dataRow['no_of_polygons']]]></code>
6566+
<code><![CDATA[$dataRow[$k][$i]['data_length']]]></code>
6567+
<code><![CDATA[$dataRow[$k]['data_length']]]></code>
6568+
<code><![CDATA[$dataRow['data_length']]]></code>
65696569
</PossiblyNullArrayAccess>
65706570
<RedundantPropertyInitializationCheck>
65716571
<code>isset(self::$instance)</code>
@@ -6603,8 +6603,8 @@
66036603
<MixedArrayAccess>
66046604
<code><![CDATA[$gisData[$index]['POLYGON']]]></code>
66056605
<code><![CDATA[$gisData[$index]['POLYGON'][$i]]]></code>
6606-
<code><![CDATA[$gisData[$index]['POLYGON'][$i]['no_of_points']]]></code>
6607-
<code><![CDATA[$gisData[$index]['POLYGON']['no_of_lines']]]></code>
6606+
<code><![CDATA[$gisData[$index]['POLYGON'][$i]['data_length']]]></code>
6607+
<code><![CDATA[$gisData[$index]['POLYGON']['data_length']]]></code>
66086608
</MixedArrayAccess>
66096609
<MixedAssignment>
66106610
<code>$noOfLines</code>
@@ -14672,8 +14672,8 @@
1467214672
<code><![CDATA[$temp['POLYGON'][1]]]></code>
1467314673
</MixedArgument>
1467414674
<MixedArrayAccess>
14675-
<code><![CDATA[$temp['POLYGON'][0]['no_of_points']]]></code>
14676-
<code><![CDATA[$temp['POLYGON'][1]['no_of_points']]]></code>
14675+
<code><![CDATA[$temp['POLYGON'][0]['data_length']]]></code>
14676+
<code><![CDATA[$temp['POLYGON'][1]['data_length']]]></code>
1467714677
</MixedArrayAccess>
1467814678
<PossiblyUnusedMethod>
1467914679
<code>providerForIsOuterRing</code>

‎public/themes/bootstrap/scss/_gis.scss‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* GIS data editor styles
33
*/
4-
a.close_gis_editor {
4+
.close_gis_editor {
55
float: right;
66
}
77

@@ -18,6 +18,12 @@ a.close_gis_editor {
1818
overflow-x: hidden;
1919
}
2020

21+
.gis-coordinates-list {
22+
padding-left: 10px;
23+
border-left: 2px solid grey;
24+
margin-bottom: 10px;
25+
}
26+
2127
#gis_data {
2228
min-height: 230px;
2329
}

‎src/Controllers/GisDataEditorController.php‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
use function array_merge;
1515
use function in_array;
16-
use function intval;
1716
use function is_array;
1817
use function mb_strtoupper;
1918
use function preg_match;
@@ -88,15 +87,6 @@ public function __invoke(ServerRequest $request): void
8887
return;
8988
}
9089

91-
$geomCount = 1;
92-
if ($geomType === 'GEOMETRYCOLLECTION') {
93-
$geomCount = isset($gisData[$geomType]['geom_count'])
94-
? intval($gisData[$geomType]['geom_count']) : 1;
95-
if (isset($gisData[$geomType]['add_geom'])) {
96-
$geomCount++;
97-
}
98-
}
99-
10090
$templateOutput = $this->template->render('gis_data_editor_form', [
10191
'width' => $visualization->getWidth(),
10292
'height' => $visualization->getHeight(),
@@ -108,7 +98,6 @@ public function __invoke(ServerRequest $request): void
10898
'column_type' => mb_strtoupper($type),
10999
'gis_types' => self::GIS_TYPES,
110100
'geom_type' => $geomType,
111-
'geom_count' => $geomCount,
112101
'gis_data' => $gisData,
113102
'result' => $result,
114103
]);

‎src/Controllers/JavaScriptMessagesController.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,14 +489,16 @@ private function getMessages(): array
489489
'strX' => __('X'),
490490
'strY' => __('Y'),
491491
'strPoint' => __('Point'),
492-
'strPointN' => __('Point %d'),
493492
'strLineString' => __('Linestring'),
494493
'strPolygon' => __('Polygon'),
495494
'strGeometry' => __('Geometry'),
496495
'strInnerRing' => __('Inner ring'),
497496
'strOuterRing' => __('Outer ring'),
498497
'strAddPoint' => __('Add a point'),
498+
'strAddLineString' => __('Add a linestring'),
499499
'strAddInnerRing' => __('Add an inner ring'),
500+
'strAddPolygon' => __('Add a polygon'),
501+
'strAddGeometry' => __('Add geometry'),
500502
'strYes' => __('Yes'),
501503
'strCopyEncryptionKey' => __('Do you want to copy encryption key?'),
502504
'strEncryptionKey' => __('Encryption key'),

‎src/Gis/GisGeometryCollection.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private function explodeGeomCol(string $geomCol): array
237237
*/
238238
public function generateWkt(array $gisData, int $index, string|null $empty = ''): string
239239
{
240-
$geomCount = $gisData['GEOMETRYCOLLECTION']['geom_count'] ?? 1;
240+
$geomCount = $gisData['GEOMETRYCOLLECTION']['data_length'] ?? 1;
241241
$wkt = 'GEOMETRYCOLLECTION(';
242242
/** @infection-ignore-all */
243243
for ($i = 0; $i < $geomCount; $i++) {
@@ -283,7 +283,7 @@ public function generateParams(string $value): array
283283
// Trim to remove leading 'GEOMETRYCOLLECTION(' and trailing ')'
284284
$geomCol = mb_substr($wkt, 19, -1);
285285
$wktGeometries = $this->explodeGeomCol($geomCol);
286-
$params = ['srid' => $data['srid'], 'GEOMETRYCOLLECTION' => ['geom_count' => count($wktGeometries)]];
286+
$params = ['srid' => $data['srid'], 'GEOMETRYCOLLECTION' => ['data_length' => count($wktGeometries)]];
287287

288288
foreach ($wktGeometries as $wktGeometry) {
289289
$gisObj = GisFactory::fromWkt($wktGeometry);

0 commit comments

Comments
 (0)