Test Failed
Push — release_2_1 ( ff55e9...bc6859 )
by Tomasz
14:08 queued 01:00
created

Wizard   A

Complexity

Total Complexity 15

Size/Duplication

Total Lines 136
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 15
eloc 95
c 2
b 0
f 0
dl 0
loc 136
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A displayHelp() 0 13 3
C setMessages() 0 105 11
1
<?php
2
/*
3
 * *****************************************************************************
4
 * Contributions to this work were made on behalf of the GÉANT project, a 
5
 * project that has received funding from the European Union’s Framework 
6
 * Programme 7 under Grant Agreements No. 238875 (GN3) and No. 605243 (GN3plus),
7
 * Horizon 2020 research and innovation programme under Grant Agreements No. 
8
 * 691567 (GN4-1) and No. 731122 (GN4-2).
9
 * On behalf of the aforementioned projects, GEANT Association is the sole owner
10
 * of the copyright in all material which was developed by a member of the GÉANT
11
 * project. GÉANT Vereniging (Association) is registered with the Chamber of 
12
 * Commerce in Amsterdam with registration number 40535155 and operates in the 
13
 * UK as a branch of GÉANT Vereniging.
14
 * 
15
 * Registered office: Hoekenrode 3, 1102BR Amsterdam, The Netherlands. 
16
 * UK branch address: City House, 126-130 Hills Road, Cambridge CB2 1PQ, UK
17
 *
18
 * License: see the web/copyright.inc.php file in the file structure or
19
 *          <base_url>/copyright.php after deploying the software
20
 */
21
22
namespace web\lib\admin;
23
24
/**
25
 * This class contains methods for displaing "wizard" help information for 
26
 * novice admins. During the first setup the messages are showm in-line.
27
 * Later only help icons are displayed and corresponding hints are displayed
28
 * in an overlay window
29
 * 
30
 * @author Tomasz Wolniewicz <[email protected]>
31
 * @author Stefan Winter <[email protected]>
32
 */
33
34
class Wizard extends UIElements {
35
    private $helpMessage;
36
    public $wizardStyle;
37
    
38
    /**
39
     * Prepare the messages for the current language and set the wizasrStyle
40
     * true means we display inline, false - show icons to call help.
41
     * 
42
     * @param boolean $wizardStyle
43
     */
44
    public function __construct($wizardStyle) {
45
        $this->wizardStyle = $wizardStyle;
46
        $this->setMessages(); 
47
    }
48
    
49
    public function displayHelp($subject) {
50
        if (!isset($this->helpMessage[$subject])) {
51
            return '';
52
        }
53
        if ($this->wizardStyle) {
54
            $wizardClass = "wizard_visible";
55
            $content = "<div>";
56
        } else {
57
            $wizardClass = "wizard_hidden";
58
            $content = "<div style='min-height:28px'><img src='../resources/images/icons/Tabler/info-square-rounded-filled-blue.svg' class='wizard_icon'>";            
59
        }
60
        $content .= "<div class='$wizardClass'>".$this->helpMessage[$subject]."</div></div>";
61
        return $content;
62
    }
63
    
64
    
65
    private function setMessages() {
66
        // SUPPORT
67
        $h = "<p>" . _("This section can be used to upload specific Terms of Use for your users and to display details of how your users can reach your local helpdesk.") . "</p>";
68
        if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_RADIUS'] == "LOCAL") {
69
            $h .= "<p>" .
70
            sprintf(_("Do you provide helpdesk services for your users? If so, it would be nice if you would tell us the pointers to this helpdesk."), $this->nomenclatureParticipant) . "</p>" .
71
            "<p>" .
72
            _("If you enter a value here, it will be added to the installers for all your users, and will be displayed on the download page. If you operate separate helpdesks for different user groups (we call this 'profiles') specify per-profile helpdesk information later in this wizard. If you operate no help desk at all, just leave these fields empty.") . "</p>";
73
            if (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL") {
74
                $h .= "<p>" . sprintf(_("For %s deployments, providing at least a local e-mail contact is required."), \config\ConfAssistant::SILVERBULLET['product_name']) . " " . _("This is the contact point for your organisation. It may be displayed publicly.") . "</p>";
75
            }
76
        } elseif (\config\Master::FUNCTIONALITY_LOCATIONS['CONFASSISTANT_SILVERBULLET'] == "LOCAL") {
77
            $h .= "<p>" . _("Providing at least a local support e-mail contact is required.") . " " . _("This is the contact point for your end users' level 1 support.") . "</p>";
78
        }
79
        $this->helpMessage['support'] = $h;
80
81
        // MEDIA
82
        $h = "<p>" .
83
            sprintf(_("In this section, you define on which media %s should be configured on user devices."), \config\ConfAssistant::CONSORTIUM['display_name']) . "</p><ul>";
84
        $h .= "<li>";
85
        $h .= "<strong>" . ( count(\config\ConfAssistant::CONSORTIUM['ssid']) > 0 ? _("Additional SSIDs:") : _("SSIDs:")) . " </strong>";
86
        if (count(\config\ConfAssistant::CONSORTIUM['ssid']) > 0) {
87
            $ssidlist = "";
88
            foreach (\config\ConfAssistant::CONSORTIUM['ssid'] as $ssid) {
89
                $ssidlist .= ", '<strong>" . $ssid . "</strong>'";
90
            }
91
            $ssidlist = substr($ssidlist, 2);
92
             $h .= sprintf(ngettext("We will always configure this SSID for WPA2/AES: %s.", "We will always configure these SSIDs for WPA2/AES: %s.", count(\config\ConfAssistant::CONSORTIUM['ssid'])), $ssidlist);
93
             $h .= "<br/>" . sprintf(_("It is also possible to define custom additional SSIDs with the option '%s' below."), $this->displayName("media:SSID"));
94
        } else {
95
             $h .=  _("Please configure which SSIDs should be configured in the installers.");
96
        }
97
         $h .= " " . _("By default, we will only configure the SSIDs with WPA2/AES encryption. By using the '(with WPA/TKIP)' option you can specify that we should include legacy support for WPA/TKIP where possible.");
98
         $h .= "</li>";
99
100
        $h .= "<li>";
101
        $h .= "<strong>" . ( count(\config\ConfAssistant::CONSORTIUM['ssid']) > 0 ? _("Additional Hotspot 2.0 / Passpoint Consortia:") : _("Hotspot 2.0 / Passpoint Consortia:")) . " </strong>";
102
        if (count(\config\ConfAssistant::CONSORTIUM['interworking-consortium-oi']) > 0) {
103
            $consortiumlist = "";
104
            foreach (\config\ConfAssistant::CONSORTIUM['interworking-consortium-oi'] as $oi) {
105
                $consortiumlist .= ", '<strong>" . $oi . "</strong>'";
106
            }
107
            $consortiumlist = substr($consortiumlist, 2);
108
            $h .= sprintf(ngettext("We will always configure this Consortium OI: %s.", "We will always configure these Consortium OIs: %s.", count(\config\ConfAssistant::CONSORTIUM['interworking-consortium-oi'])), $consortiumlist);
109
110
            $h .= "<br/>" . sprintf(_("It is also possible to define custom additional OIs with the option '%s' below."), $this->displayName("media:consortium_OI"));
111
        } else {
112
            $h .= _("Please configure which Consortium OIs should be configured in the installers.");
113
        }
114
        $h .= "</li>";
115
        $h .= "<li><strong>" . _("Support for wired IEEE 802.1X:") . " </strong>"
116
        . _("If you want to configure your users' devices with IEEE 802.1X support for wired ethernet, please check the corresponding box. Note that this makes the installation process a bit more difficult on some platforms (Windows: needs administrator privileges; Apple: attempting to install a profile with wired support on a device without an active wired ethernet card will fail).") .
117
        "</li>";
118
        $h .= "<li><strong>" . _("Removal of bootstrap/onboarding SSIDs:") . " </strong>"
119
        . _("If you use a captive portal to distribute configurations, you may want to unconfigure/disable that SSID after the bootstrap process. With this option, the SSID will either be removed, or be defined as 'Only connect manually'.")
120
        . "</li>";
121
        $h .= "</ul>";
122
        $this->helpMessage['media'] = $h;
123
        
124
        // IDP GENERAL
125
        $h = "<p>" .
126
        _("Some properties are valid across all deployment profiles. This is the place where you can describe those properties in a fine-grained way. The solicited information is used as follows:") . "</p>".
127
            "<ul>".
128
                "<li>"._("<strong>Logo</strong>: When you submit a logo, we will embed this logo into all installers where a custom logo is possible. We accept any image format, but for best results, we suggest SVG. If you don't upload a logo, we will use the generic logo instead (see top-right corner of this page).") . "</li>".
129
                "<li>".sprintf(_("<strong>Name</strong>: The %s may have names in multiple languages. It is recommended to always populate at least the 'default/other' language, as it is used as a fallback if the system does not have a name in the exact language the user requests a download in."), $this->nomenclatureParticipant) . "</li>".
130
            "</ul>";
131
        $this->helpMessage['idp_general'] = $h;
132
        
133
        // PROFILE GENERAL
134
        $h = "<p>" . _("First of all we need a name for the profile. This will be displayed to end users, so you may want to choose a descriptive name like 'Professors', 'Students of the Faculty of Bioscience', etc.") . "</p>".
135
            "<p>" . _("Optionally, you can provide a longer descriptive text about who this profile is for. If you specify it, it will be displayed on the download page after the user has selected the profile name in the list.") . "</p>".
136
            "<p>" . _("You can also tell us your RADIUS realm. ");
137
            if (\config\Master::FUNCTIONALITY_LOCATIONS['DIAGNOSTICS'] !== NULL) {
138
               $h .= sprintf(_("This is useful if you want to use the sanity check module later, which tests reachability of your realm in the %s infrastructure. "), \config\ConfAssistant::CONSORTIUM['display_name']);
139
            }
140
        $h .= _("It is required to enter the realm name if you want to support anonymous outer identities (see below).") . "</p>";
141
        $this->helpMessage['profile'] = $h;
142
        
143
        // REALM
144
        $h = "<p>".sprintf(_("Some installers support a feature called 'Anonymous outer identity'. If you don't know what this is, please read <a href='%s'>this article</a>."), "https://confluence.terena.org/display/H2eduroam/eap-types")."</p>".
145
          "<p>"._("On some platforms, the installers can suggest username endings and/or verify the user input to contain the realm suffix.")."</p>".
146
          "<p>"._("The realm check feature needs to know an outer ID which actually gets a chance to authenticate. If your RADIUS server lets only select usernames pass, it is useful to supply the information which of those (outer ID) username we can use for testing.")."</p>";
147
        $this->helpMessage['realm'] = $h;
148
        
149
        // REDIRECT
150
         $h ="<p>"._("The CAT has a download area for end users. There, they will, for example, learn about the support pointers you entered earlier. The CAT can also immediately offer the installers for the profile for download. If you don't want that, you can instead enter a web site location where you want your users to be redirected to. You, as the administrator, can still download the profiles to place them on that page (see the 'Compatibility Matrix' button on the dashboard).") . "</p>";
151
        $this->helpMessage['redirect'] = $h;
152
        
153
        // EAP
154
        $h = "<p>"._("Now, we need to know which EAP types your IdP supports. If you support multiple EAP types, you can assign every type a priority (1=highest). This tool will always generate an automatic installer for the EAP type with the highest priority; only if the user's device can't use that EAP type, we will use an EAP type further down in the list.") . "</p>";
155
        $this->helpMessage['eap_support'] = $h;
156
        
157
        // LOCATIOM
158
        $h = "<p>" .
159
                    _("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.") .
160
                    "</p>
161
                     <ul>" .
162
                    _("<li>Drag the marker in the map to your place, or</li>
163
<li>enter your street address in the field below for lookup, or</li>
164
<li>use the 'Locate Me!' button</li>") .
165
                    "</ul>
166
                     <strong>" .
167
                    _("We will use the coordinates as indicated by the marker for geolocation.") .
168
                    "</strong>";
169
        $this->helpMessage['location'] = $h;
170
    }
171
}
172
173