|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* ****************************************************************************** |
|
5
|
|
|
* Copyright 2011-2017 DANTE Ltd. and GÉANT on behalf of the GN3, GN3+, GN4-1 |
|
6
|
|
|
* and GN4-2 consortia |
|
7
|
|
|
* |
|
8
|
|
|
* License: see the web/copyright.php file in the file structure |
|
9
|
|
|
* ****************************************************************************** |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace web\lib\admin; |
|
13
|
|
|
|
|
14
|
|
|
require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/config/_config.php"); |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* This class provides map display functionality |
|
18
|
|
|
* |
|
19
|
|
|
* @author Stefan Winter <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
abstract class AbstractMap { |
|
22
|
|
|
|
|
23
|
|
|
protected $instName; |
|
24
|
|
|
protected $fedName; |
|
25
|
|
|
protected $readOnly; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* loads the map, taking identifiers from the IdP in question |
|
29
|
|
|
* |
|
30
|
|
|
* @param \core\IdP $inst the IdP for which the map is displayed |
|
31
|
|
|
* @param boolean $readonly whether the HTML code should yield an editable field |
|
32
|
|
|
*/ |
|
33
|
|
|
protected function __construct($inst, $readonly) { |
|
34
|
|
|
$this->instName = $inst->name; |
|
35
|
|
|
$this->fedName = $inst->federation; |
|
36
|
|
|
$this->readOnly = $readonly; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* loads the configured map type |
|
41
|
|
|
* |
|
42
|
|
|
* @param \core\IdP $inst |
|
43
|
|
|
* @param boolean $readonly |
|
44
|
|
|
* @return \web\lib\admin\MapNone|\web\lib\admin\MapOpenstreepmap|\web\lib\admin\MapGoogle |
|
|
|
|
|
|
45
|
|
|
* @throws Exception |
|
46
|
|
|
*/ |
|
47
|
|
|
public static function instance($inst, $readonly) { |
|
48
|
|
|
switch (CONFIG_CONFASSISTANT['MAPPROVIDER']['PROVIDER']) { |
|
49
|
|
|
case "Google": |
|
50
|
|
|
return new MapGoogle($inst, $readonly); |
|
51
|
|
|
case "OpenStreetMaps": |
|
52
|
|
|
return new MapOpenStreepMaps($inst, $readonly); |
|
|
|
|
|
|
53
|
|
|
case "None": |
|
54
|
|
|
return new MapNone($inst, $readonly); |
|
55
|
|
|
default: |
|
56
|
|
|
throw new \Exception("Unknown map provider."); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* If the map needs to inject code into <head>, it is generated in this function. |
|
62
|
|
|
*/ |
|
63
|
|
|
abstract public function htmlHeadCode(); |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* If the map needs to inject code into <body> to enable a map (like |
|
67
|
|
|
* JavaScript code), it is generated in this function. The actual HTML |
|
68
|
|
|
* is in the *Field functions below. |
|
69
|
|
|
*/ |
|
70
|
|
|
abstract public function htmlBodyCode(); |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* If the map needs to modify the <body> tag itself (e.g. an onLoad() |
|
74
|
|
|
* function), it is generated in this function |
|
75
|
|
|
*/ |
|
76
|
|
|
abstract public function bodyTagCode(); |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Code to display the map and surrounding HTML to display the map. Providers |
|
80
|
|
|
* probably will want to return different pieces of code depending on whether |
|
81
|
|
|
* we're readonly or not |
|
82
|
|
|
*/ |
|
83
|
|
|
abstract public function htmlShowtime($wizard, $additional); |
|
84
|
|
|
|
|
85
|
|
|
/** |
|
86
|
|
|
* This HTML goes above the actual map, and is map provider independent. |
|
87
|
|
|
* |
|
88
|
|
|
* @param boolean $wizardMode are we in wizard mode? |
|
89
|
|
|
* @param boolean $additional is there more than one coordinate pair to display |
|
90
|
|
|
* @return string |
|
91
|
|
|
*/ |
|
92
|
|
|
protected function htmlPreEdit($wizardMode, $additional) { |
|
93
|
|
|
$retval = "<fieldset class='option_container'> |
|
94
|
|
|
<legend><strong>" . _("Location") . "</strong></legend>"; |
|
95
|
|
|
|
|
96
|
|
|
if ($wizardMode) { |
|
97
|
|
|
$retval .= "<p>" . |
|
98
|
|
|
_("The user download interface (see <a href='../'>here</a>), uses geolocation to suggest possibly matching IdPs to the user. The more precise you define the location here, the easier your users will find you.") . |
|
99
|
|
|
"</p> |
|
100
|
|
|
<ul>" . |
|
101
|
|
|
_("<li>Drag the marker in the map to your place, or</li> |
|
102
|
|
|
<li>enter your street address in the field below for lookup, or</li> |
|
103
|
|
|
<li>use the 'Locate Me!' button</li>") . |
|
104
|
|
|
"</ul> |
|
105
|
|
|
<strong>" . |
|
106
|
|
|
_("We will use the coordinates as indicated by the marker for geolocation.") . |
|
107
|
|
|
"</strong>"; |
|
108
|
|
|
} |
|
109
|
|
|
if ($additional) { |
|
110
|
|
|
$retval .= _("You can enter an <strong>additional</strong> location here. You can see the already defined locations in the 'General Information' field."); |
|
111
|
|
|
} |
|
112
|
|
|
return $retval; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* This HTML goes below the actual map, and is map provider independent. |
|
117
|
|
|
* |
|
118
|
|
|
* @param boolean $allowDirectInput should the input fields be editable? |
|
119
|
|
|
*/ |
|
120
|
|
|
protected function htmlPostEdit($allowDirectInput) { |
|
121
|
|
|
return "<br/>" . _("Latitude:") . " <input style='width:80px' name='geo_lat' id='geo_lat' " .($allowDirectInput ? "": "readonly"). ">" . _("Longitude:") . " <input name='geo_long' id='geo_long' style='width:80px' " .($allowDirectInput ? "": "readonly"). "></fieldset>"; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
} |
|
125
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths