Skip to content

Commit 30d7766

Browse files
committed
updated cookie migrate script, so it works for broader appliances
1 parent 6051531 commit 30d7766

1 file changed

Lines changed: 42 additions & 36 deletions

File tree

src/main/resources/migration_redirect.php

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@
77
*/
88

99
// base location of new webCAT installation
10-
define("WEBCAT_LOCATION", "https://localhost/");
10+
define("WEBCAT_LOCATION", "https://cat.bio.informatik.uni-rostock.de/");
1111
// location to redirect to, with trailing slash and history endpoint path
12-
define("REDIRECT_LOCATION", WEBCAT_LOCATION . "/rest/history/");
13-
// Show information page first and not directly redirect via HTTP header
14-
define("SHOW_INFO_PAGE", true);
12+
define("REDIRECT_LOCATION", WEBCAT_LOCATION . "rest/history/");
1513

1614
// path of the current workspace
1715
define("COOKIE_PATH", "combinearchiveweba");
@@ -22,8 +20,8 @@
2220

2321
// ----------------------------------------------------------------------------
2422

25-
$success = false;
26-
$redirect_url = WEBCAT_LOCATION;
23+
$migrate_url = WEBCAT_LOCATION;
24+
$redirect_url = WEBCAT_LOCATION . substr($_SERVER['REQUEST_URI'], 1);
2725

2826
if( isset($_COOKIE[COOKIE_HISTORY]) and $_COOKIE[COOKIE_HISTORY] != "" ) {
2927
// history cookie is set -> decode it
@@ -45,12 +43,12 @@
4543
}
4644
}
4745

48-
$redirect_url = REDIRECT_LOCATION . implode(",", $result);
49-
$success = true;
50-
if( !SHOW_INFO_PAGE ) {
51-
header("Location", $redirect_url);
52-
exit();
53-
}
46+
$migrate_url = REDIRECT_LOCATION . implode(",", $result);
47+
}
48+
else {
49+
// redirect directly to new page, using the proper endpoint, since no cookie was set.
50+
header("Location", $redirect_url);
51+
exit();
5452
}
5553
?><!DOCTYPE html>
5654
<html lang="en-us">
@@ -62,50 +60,58 @@
6260
html, body { margin: 0; padding: 0; width: 100%; height: 100%; background-color: #CCC; color: black; font: 1em normal "Verdana","Arial","Georgia",sans-serif; text-align: center;}
6361
a { text-decoration: underline; color: #A00; }
6462
a:hover { text-decoration: none !important; }
65-
.frame { width: 570px; height: 100%; margin: 0 auto; padding: 2em 5px; text-align: left; background-color: #EEE; border: 1px solid #AAA; border-style: none solid none solid; }
63+
.frame { width: 570px; height: 100%; margin: 0 auto; padding: 0 5px; text-align: left; background-color: #EEE; border: 1px solid #AAA; border-style: none solid none solid; }
6664
.content { }
67-
h1 { width: 100%; font 1.5em bold; line-height: 1.05em; margin-bottom: 2em; }
68-
p, div.ws-list { margin-bottom: 3em; padding: 0 5px; text-align: justify; }
69-
p.button { text-align: center; }
70-
a.button { display: box; padding: 0.5em 1em; color: #FFF; background-color: #0D0; text-align: center; vertical-align: center; font: 1.3em bold; text-decoration: none; font-weight: bold; }
71-
a.button:hover { background-color: #090 !important; }
65+
div.header { padding-top: 2em !important; }
66+
div.header > h1 { width: 100%; font 1.5em bold; line-height: 1.05em; margin: 0; }
67+
p, div.text { margin-bottom: 3em; padding: 0 5px; text-align: justify; }
68+
iframe { width: 100%; height: 3em; border: 1px solid #AAA }
69+
div.button { margin-bottom: 3em; padding: 0 5px; text-align: center; }
70+
a.button { display: box; padding: 0.5em 1em; color: #FFF; text-align: center; vertical-align: center; font: 1.3em bold; text-decoration: none; font-weight: bold; }
71+
a.ok { background-color: #0D0; }
72+
a.ok:hover { background-color: #090 !important; }
73+
a.warn { background-color: #c68523 }
74+
a.warn:hover { background-color: #915f15 !important; }
7275
</style>
7376
</head>
7477

7578
<body>
7679
<div class="frame">
7780
<div class="content">
78-
<h1>This webCAT instance moved!</h1>
79-
81+
<div class="text header">
82+
<h1>This webCAT instance moved!</h1>
83+
</div>
8084
<p class="explain">
81-
This <a href="http://sems.uni-rostock.de/cat" target="_blank">webCAT</a> instance move to a new domain.
82-
<?php if( $success ) { ?>
83-
To ensure you can still access your pressures workspaces and archives
84-
you can migrate the history cookie, which contains all the workspace IDs. To do so please click on the button down below.
85-
<?php } else { ?>
86-
It does not seem, that you do not had any workspaces stored at this place. So you can just click at the button below to
87-
access webCAT at the new domain.
88-
<?php } ?>
89-
85+
This <a href="http://sems.uni-rostock.de/cat" target="_blank">webCAT</a> instance move to <a href="<?php echo(WEBCAT_LOCATION); ?>" target="_blank"><?php echo(parse_url(WEBCAT_LOCATION, PHP_URL_HOST)); ?></a>.
86+
To ensure you can still access your pressures workspaces and archives, we now try to migrate your workspace history.
9087
</p>
9188

92-
<p class="button">
93-
<a class="button" href="<?php echo($redirect_url); ?>"><?php echo($success ? "Migrate Workspaces" : "Go to new Instance"); ?></a>
94-
</p>
89+
<div class="button">
90+
<a class="button ok" href="<?php echo($redirect_url); ?>">Go to new Instance</a>
91+
</div>
92+
93+
<div class="text process">
94+
We now attempt to automatically migrate your history... <br />
95+
<iframe src="<?php echo($migrate_url); ?>"></iframe>
96+
<br />
97+
If frame above does not show a success message, please try to migrate your workspace history manually by clicking on the button below. This might be necessary, if your browser does not allow iframes.
98+
</div>
99+
100+
<div class="button">
101+
<a class="button warn" href="<?php echo($migrate_url); ?>">Migrate Workspaces Manually</a>
102+
</div>
95103

96-
<?php if($success) { ?>
97-
<div class="ws-list">
104+
<div class="text ws-list">
98105
Following workspaces were found:
99106
<ul>
100107
<?php foreach( $result as $entry ) { ?>
101108
<li>
102-
<?php echo($names[$entry]); ?><br />
109+
<b><?php echo($names[$entry]); ?></b><br />
103110
<code><?php echo($entry); ?></code>
104111
</li>
105112
<?php } ?>
106113
</ul>
107114
</div>
108-
<?php } ?>
109115
</div>
110116
</div>
111117
</body>

0 commit comments

Comments
 (0)