Skip to content

Commit

Permalink
Adding support for geteduroam special download screens via the eap-sp…
Browse files Browse the repository at this point in the history
…ecifinc option
  • Loading branch information
twoln committed Aug 21, 2023
1 parent 1cdeb97 commit 41a8153
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 10 deletions.
9 changes: 8 additions & 1 deletion core/AbstractProfile.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,7 @@ public function listDevices()
}
$eapCustomtext = 0;
$deviceCustomtext = 0;
$geteduroam = 0;
if ($redirectUrl === 0) {
if (isset($deviceProperties['options']) && isset($deviceProperties['options']['redirect']) && $deviceProperties['options']['redirect']) {
$devStatus = self::HIDDEN;
Expand Down Expand Up @@ -667,9 +668,15 @@ public function listDevices()
} else {
$devStatus = self::UNAVAILABLE;
}
$geteduroamOpts = $this->getAttributes("device-specific:geteduroam");
foreach ($geteduroamOpts as $dev) {
if ($dev['device'] == $deviceIndex) {
$geteduroam = $dev['value'] == 'on' ? 1 : 0;
}
}
}
}
$returnarray[] = ['id' => $deviceIndex, 'display' => $deviceProperties['display'], 'status' => $devStatus, 'redirect' => $redirectUrl, 'eap_customtext' => $eapCustomtext, 'device_customtext' => $deviceCustomtext, 'message' => $message, 'options' => $deviceProperties['options'], 'group' => $group];
$returnarray[] = ['id' => $deviceIndex, 'display' => $deviceProperties['display'], 'status' => $devStatus, 'redirect' => $redirectUrl, 'eap_customtext' => $eapCustomtext, 'device_customtext' => $deviceCustomtext, 'message' => $message, 'options' => $deviceProperties['options'], 'group' => $group, 'geteduroam' => $geteduroam];
}
return $returnarray;
}
Expand Down
41 changes: 36 additions & 5 deletions devices/Devices-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,16 @@ class Devices extends \core\common\Entity {
public static function listDevices($profile = 0, $orAlways = 0) {
\core\common\Entity::intoThePotatoes();
$lang = new \core\common\Language();
$skinObject = new \web\lib\user\Skinjob(\config\Master::APPEARANCE['skins'][0]);
/*
$googleIcon = $skinObject->findResourceUrl("IMAGES", "vendorlogo/google-play.png");
$huaweiIcon = $skinObject->findResourceUrl("IMAGES", "vendorlogo/appgallery.png");
$amazonIcon = $skinObject->findResourceUrl("IMAGES", "vendorlogo/amazon-appstore-badge-english-black.png");
/* Uncomment lines below if you have button images and want to use them
*
* $skinObject = new \web\lib\user\Skinjob(\config\Master::APPEARANCE['skins'][0]);
$googleDownload = "<img src='".$skinObject->findResourceUrl("IMAGES", "vendorlogo/google-play.png")."' alt='GooglePlay' class='applogos'>";
$huaweiDownload = "<img src='".$skinObject->findResourceUrl("IMAGES", "vendorlogo/appgallery.png")."' alt='Huawei AppGalery' class='applogos'>";
$amazonDownload = "<img src='".$skinObject->findResourceUrl("IMAGES", "vendorlogo/amazon-appstore-badge-english-black..png")."' alt='Amazon Appstore' class='applogos'>";
*/
$googleDownload = 'GooglePlay';
$huaweiDownload = 'Huawei AppGalery';
$amazonDownload = 'Amazon Appstore';
$retArray = [
'w10' => [
'group' => "microsoft",
Expand Down Expand Up @@ -416,9 +420,23 @@ public static function listDevices($profile = 0, $orAlways = 0) {
'options' => [
'mime' => 'application/eap-config',
'hs20' => 1,
'message_only' => 0,
'message' => sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from these sites: %s and will use the configuration file downloaded from CAT to create all necessary settings."),
"geteduroam",
"<a target='_blank' href='https://play.google.com/store/apps/details?id=app.eduroam.geteduroam'>Google Play</a>, <a target='_blank' href='geteduroam-stable.apk'>" . _("as local download") . "</a>"),

'geteduroam_text' => sprintf(_("Use our app, it will guide you through the setup process:%s"
."(or download it manually %s.)<p>"
. "After installation, open the app, select your home institution and the app will collect required information "
. "(this will require an internet connection)."
. "<p><span style='font-size:90%%'>If you want to save the configuration for later offline deployment, "
. "you can download it by %s.</span>"),
"<p><div>"
. "<a target='_blank' href='https://play.google.com/store/apps/details?id=app.eduroam.geteduroam'>$googleDownload</a> "
. "<a target='_blank' href='https://appgallery.huawei.com/app/C104231893'>$huaweiDownload</a>"
. "</div><p>",
"<a href='geteduroam-stable.apk' target='_blank'>"._("here")."</a>",
"<a href='user/API.php?action=downloadInstaller&lang=".$lang->getLang()."&profile=".$profile."&device=android_recent&generatedfor=user&openroaming=".$orAlways."'>"._("clicking here")."</a>"),
],
],

Expand All @@ -445,9 +463,22 @@ public static function listDevices($profile = 0, $orAlways = 0) {
'module' => 'Lollipop',
'options' => [
'mime' => 'application/eap-config',
'message_only' => 0,
'message' => sprintf(_("Before you proceed with installation on Android systems, please make sure that you have installed the %s application. This application is available from these sites: %s and will use the configuration file downloaded from CAT to create all necessary settings."),
"eduroamCAT",
"<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>Google Play</a>, <a target='_blank' href='https://www.amazon.com/dp/B01EACCX0S/'>Amazon Appstore</a>, <a target='_blank' href='eduroamCAT-stable.apk'>" . _("as local download") . "</a>"),
'geteduroam_text' => sprintf(_("Use our app, it will guide you through the setup process:%s"
."(or download it manually %s.)<p>"
. "After installation, open the app, select your home institution and the app will collect required information "
. "(this will require an internet connection)."
. "<p><span style='font-size:90%%'>If you want to save the configuration for later offline deployment, "
. "you can download it by %s.</span>"),
"<p><div>"
. "<a target='_blank' href='https://play.google.com/store/apps/details?id=uk.ac.swansea.eduroamcat'>$googleDownload</a> "
. "<a target='_blank' href='https://www.amazon.com/dp/B01EACCX0S/'>$amazonDownload</a>"
. "</div><p>",
"<a href='eduroamCAT-stable.apk' target='_blank'>"._("here")."</a>",
"<a href='user/API.php?action=downloadInstaller&lang=".$lang->getLang()."&profile=".$profile."&device=android_4_7&generatedfor=user&openroaming=0'>"._("clicking here")."</a>"),
],
],

Expand Down
4 changes: 2 additions & 2 deletions schema/2_0-2_1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ CREATE TABLE `deployment_option` (
`option_name` varchar(32) DEFAULT NULL,
`option_lang` varchar(8) DEFAULT NULL,
`option_value` longblob,
`row` int(11) NOT NULL AUTO_INCREMENT,
`row_id` int(11) NOT NULL AUTO_INCREMENT,
KEY `option_name` (`option_name`),
KEY `rowindex` (`row`),
KEY `rowindex` (`row_id`),
CONSTRAINT `deployment_option_ibfk_1` FOREIGN KEY (`option_name`) REFERENCES `profile_option_dict` (`name`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Expand Down
7 changes: 5 additions & 2 deletions web/skins/modern/user/js/cat_js.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,6 @@ function showProfile(prof) {
}
profileDevices = j.devices;
currentDevice=findDevice(recognisedOS);
console.log("recognisedOS:"+currentDevice);
// create the main download page section


Expand Down Expand Up @@ -389,7 +388,7 @@ function handlePreagreed() {
if (openroaming == 'ask') {
$("#or_text_1").show();
}
if (currentDevice.options.message_only != 1) {
if (currentDevice.options.message_only != 1 && currentDevice.geteduroam != 1) {
$("#openroaming_tou").show();
}
} else {
Expand Down Expand Up @@ -532,6 +531,10 @@ function deviceInfo(data) {
function handleGuessOs(recognisedDevice) {
if (recognisedDevice == null)
return 1;
if (recognisedDevice.geteduroam == 1) {
recognisedDevice.options.message_only = 1;
recognisedDevice.message = recognisedDevice.options.geteduroam_text;
}
if(recognisedDevice.options.message_only == 1) {
$("#guess_os").html("<div id='message_only'>"+recognisedDevice.message+"</div>");
return 1;
Expand Down

0 comments on commit 41a8153

Please sign in to comment.