-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve replay directing page to have content
- Loading branch information
Showing
8 changed files
with
105 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package info.nanodesu.pages | ||
|
||
case class ReplayIdParam(id: String) extends PageParam { | ||
val paramName = ReplayPage.idParam | ||
val paramValue = id | ||
} | ||
|
||
object ReplayPage extends Page { | ||
val pageName = "replay" | ||
|
||
protected[pages] val idParam = "replayid" | ||
|
||
def makeLink(txt: String, id: ReplayIdParam) = makeLink0(txt, id) | ||
def makeLinkAttribute(id: ReplayIdParam) = makeLinkAttribute0(id) | ||
|
||
def getReplayId = getParam(idParam, x => x) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package info.nanodesu.snippet | ||
|
||
import net.liftweb.http.DispatchSnippet | ||
import net.liftweb.util.Props | ||
import scala.xml.Attribute | ||
import scala.xml.Text | ||
import scala.xml.Null | ||
import scala.xml.NodeSeq | ||
import scala.Array.canBuildFrom | ||
import net.liftweb.util.Helpers._ | ||
import info.nanodesu.pages.ReplayPage | ||
import info.nanodesu.model.ReportDataC | ||
import info.nanodesu.model.db.collectors.gameinfo.loader.GameIdFromIdentLoader | ||
import info.nanodesu.lib.db.CookieBox | ||
import net.liftweb.common.Empty | ||
import net.liftweb.common.Full | ||
import info.nanodesu.pages.GamePage | ||
import info.nanodesu.pages.GameIdParam | ||
|
||
object Replay extends DispatchSnippet{ | ||
val dispatch: DispatchIt = { | ||
case "relink" => relinkReplay | ||
} | ||
|
||
def relinkReplay = { | ||
val startPa = "startpa://replay=" | ||
val lobbyId = ReplayPage.getReplayId | ||
|
||
val gameIdBox = (CookieBox withSession {db => | ||
for (l <- lobbyId) yield { | ||
val loader = new Object with GameIdFromIdentLoader | ||
val gameId = loader.getIdForIdent(db, l) | ||
if (gameId.isDefined) Full(gameId.get) | ||
else Empty | ||
} | ||
}) | ||
|
||
val gameId = gameIdBox match { | ||
case Full(x) => x | ||
case _ => Empty | ||
} | ||
|
||
"#replayinfo *+" #> lobbyId & | ||
"#replayinfo [href]" #> lobbyId.map(startPa+_) & | ||
"#redirectmeta" #> lobbyId.map(x => (<meta data-lift="head" http-equiv="Refresh"></meta> % | ||
Attribute(None, "content", Text(s"0; url=$startPa$x"), Null))) & | ||
"#gameLink" #> gameId.map(x => GamePage.makeLink("Game #"+x, GameIdParam(x))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body data-lift-content-id="main"> | ||
<div id="main" data-lift="surround?with=default;at=content"> | ||
<div data-lift="Replay.relink"> | ||
<div id="redirectmeta"></div> | ||
<div id="replayheader">PA Replay <a id="gameLink"></a></div> | ||
This page is redirecting to a Planetary Annihilation replay. If you have registered the startpa:// protocol | ||
and you have the PA Stats UI mod your PA should now open and, after you logged in to ubernet, play the replay. | ||
<div>The plain startpa:// link is <a id="replayinfo">startpa://replay=</a></div> | ||
</div> | ||
<div>If this does not work for you, check this post | ||
<a href="https://forums.uberent.com/threads/rel-pa-stats-63180.50690/page-23#post-918834" target="_blank">in the PA forums</a> </div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,11 @@ | |
color: red; | ||
} | ||
|
||
#replayheader { | ||
font-size: 25px; | ||
margin-bottom: 5px; | ||
} | ||
|
||
a { | ||
color: #000; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters