From ac17f7c19958571eaef3ea6c9cc9a3401c426ab4 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Fri, 10 Dec 2021 21:38:55 +0300 Subject: [PATCH 1/3] MFE-issues-12: support target url for embedded Vanilla --- config/vanilla/config.php | 5 ++++- .../controllers/class.entrycontroller.php | 16 +++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/config/vanilla/config.php b/config/vanilla/config.php index 32a110e..34ee2b0 100644 --- a/config/vanilla/config.php +++ b/config/vanilla/config.php @@ -71,7 +71,10 @@ $Configuration['Garden']['ForceInputFormatter'] = false; $Configuration['Garden']['Version'] = 'Undefined'; $Configuration['Garden']['CanProcessImages'] = true; -$Configuration['Garden']['Theme'] = 'topcoder'; +// Default Topcoder Theme +//$Configuration['Garden']['Theme'] = 'topcoder'; +// MFE Topcoder Theme +$Configuration['Garden']['Theme'] = 'mfe-topcoder'; $Configuration['Garden']['MobileTheme'] = 'topcoder'; $Configuration['Garden']['Profile']['EditPhotos'] = false; $Configuration['Garden']['SystemUserID'] = '1'; diff --git a/vanilla/applications/dashboard/controllers/class.entrycontroller.php b/vanilla/applications/dashboard/controllers/class.entrycontroller.php index 2775aa0..e6000e0 100644 --- a/vanilla/applications/dashboard/controllers/class.entrycontroller.php +++ b/vanilla/applications/dashboard/controllers/class.entrycontroller.php @@ -372,7 +372,14 @@ protected function checkOverride($type, $target, $transientKey = null) { throw new Exception("Unknown entry type $type."); } - $url = str_ireplace('{target}', rawurlencode(url($target, true)), $url); + // FIX: micro-frontends-forums-app issues-12 + $isEmbedded = (bool) c('Garden.Embed.Allow',false); + $remoteUrl = c("Garden.Embed.RemoteUrl"); + $targetUrl = rawurlencode(url($target, true)); + if($isEmbedded && is_string( $remoteUrl)) { + $targetUrl = rawurlencode($remoteUrl.'/#'.url($target)); + } + $url = str_ireplace('{target}', $targetUrl, $url); if ($this->deliveryType() == DELIVERY_TYPE_ALL && strcasecmp($this->data('Method'), 'POST') != 0) { redirectTo(url($url, true), 302, false); @@ -1019,7 +1026,14 @@ public function signOut($transientKey = "", $override = "0") { $this->_setRedirect(); } + // FIX: micro-frontends-forums-app issues-12 + $isEmbedded = (bool) c('Garden.Embed.Allow',false); + $remoteUrl = c("Garden.Embed.RemoteUrl"); $target = url($this->target(), true); + if($isEmbedded && is_string( $remoteUrl)) { + $target = rawurlencode($remoteUrl.'/#'.url($target)); + } + if (!isTrustedDomain($target)) { $target = Gdn::router()->getDestination('DefaultController'); } From cd8b7ef6849661f3956c6b6208745e893a4a7c45 Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Fri, 10 Dec 2021 21:43:39 +0300 Subject: [PATCH 2/3] MFE-issues-12: support target url for embedded Vanilla --- .../dashboard/controllers/class.entrycontroller.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vanilla/applications/dashboard/controllers/class.entrycontroller.php b/vanilla/applications/dashboard/controllers/class.entrycontroller.php index e6000e0..32da3e8 100644 --- a/vanilla/applications/dashboard/controllers/class.entrycontroller.php +++ b/vanilla/applications/dashboard/controllers/class.entrycontroller.php @@ -375,10 +375,12 @@ protected function checkOverride($type, $target, $transientKey = null) { // FIX: micro-frontends-forums-app issues-12 $isEmbedded = (bool) c('Garden.Embed.Allow',false); $remoteUrl = c("Garden.Embed.RemoteUrl"); - $targetUrl = rawurlencode(url($target, true)); if($isEmbedded && is_string( $remoteUrl)) { $targetUrl = rawurlencode($remoteUrl.'/#'.url($target)); + } else { + $targetUrl = rawurlencode(url($target, true)); } + $url = str_ireplace('{target}', $targetUrl, $url); if ($this->deliveryType() == DELIVERY_TYPE_ALL && strcasecmp($this->data('Method'), 'POST') != 0) { @@ -1029,9 +1031,11 @@ public function signOut($transientKey = "", $override = "0") { // FIX: micro-frontends-forums-app issues-12 $isEmbedded = (bool) c('Garden.Embed.Allow',false); $remoteUrl = c("Garden.Embed.RemoteUrl"); - $target = url($this->target(), true); + if($isEmbedded && is_string( $remoteUrl)) { - $target = rawurlencode($remoteUrl.'/#'.url($target)); + $target = rawurlencode($remoteUrl.'/#'.url($this->target())); + } else { + $target = url($this->target(), true); } if (!isTrustedDomain($target)) { From 4a1e1688a4350f40f7603d6fc0adc06d4bf9522b Mon Sep 17 00:00:00 2001 From: Bogdanova Olga Date: Fri, 10 Dec 2021 22:10:10 +0300 Subject: [PATCH 3/3] MFE-issues-11: hide guest block, change welcome text --- .../dashboard/views/modules/guest.php | 44 ++++++++++++------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/vanilla/applications/dashboard/views/modules/guest.php b/vanilla/applications/dashboard/views/modules/guest.php index 6947b62..22af5d7 100644 --- a/vanilla/applications/dashboard/views/modules/guest.php +++ b/vanilla/applications/dashboard/views/modules/guest.php @@ -1,30 +1,40 @@ - +

-

MessageCode, $this->MessageDefault); ?>

+

fireEvent('BeforeSignInButton'); ?>

_Sender->SelfUrl); - if ($signInUrl) { - echo '
'; - echo anchor(t('Login'), signInUrl($this->_Sender->SelfUrl), 'Button Primary SignIn BigButton'.(signInPopup() ? ' SignInPopup' : ''), ['rel' => 'nofollow']); - echo '
'; - } + if(!$isEmbedded) { + if ($signInUrl) { + echo '
'; + echo anchor(t('Login'), signInUrl($this->_Sender->SelfUrl), 'Button Primary SignIn BigButton'.(signInPopup() ? ' SignInPopup' : ''), ['rel' => 'nofollow']); + echo '
'; + } - $Url = registerUrl($this->_Sender->SelfUrl); - if (!empty($Url)) { - ?> -

- Don't have an account? - 'nofollow']); - ?> -

- _Sender->SelfUrl); + if (!empty($Url)) { + ?> +

+ Don't have an account? + 'nofollow']); + ?> +

+