Mercurial > hg > lukkari
changeset 83:85068c8513b4
Add back mobile mode.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 24 Oct 2012 13:58:00 +0300 |
parents | c553ad61e9c2 |
children | adaad33f929c |
files | index.php luk.css luk1.css luk2.css luk3.css luk4.css |
diffstat | 6 files changed, 67 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/index.php Wed Oct 24 12:24:48 2012 +0300 +++ b/index.php Wed Oct 24 13:58:00 2012 +0300 @@ -237,7 +237,23 @@ // Check given parameters -$mobileMode = isset($_GET["mobile"]) || isset($_COOKIE["lukmobile"]); +$mobileMode = FALSE; +if (isset($_GET["m"])) +{ + $mobileMode = intval($_GET["m"]); + setcookie("lukmobile", $mobileMode, time() + 365*24*60*60); // expire in a year +} +else +if (isset($_COOKIE["lukmobile"])) +{ + $mobileMode = $_COOKIE["lukmobile"]; +} + +if ($mobileMode) +{ + $pageCSSData["prefix"] = $baseURI."mluk"; +} + if (isset($_GET["luokka"])) { @@ -351,7 +367,7 @@ } -function lukNormalTimeTable() +function lukPrintTimeTable($mini) { global $classInfo, $classHourDefs, $classHourTimes; @@ -362,27 +378,43 @@ $nextStamp = $currStamp + 30 * 60; $nextTime = $nextStamp - mktime(0, 0, 0); - $nextDay = lukGetWeekdayFromTimestamp($nextStamp); // Create the timetable table - $out = - "<p>".join("; ", $classInfo["general"])."</p>\n". - "<div>".lukMsg("viikossa", $classInfo["totalHours"])."</div>\n". - "<table class=\"timetable\">". - " <tr>\n <th></th>\n"; - $cellWidth = 100 / $classInfo["maxDays"]; - if ($cellWidth > 25) $cellWidth = 25; - for ($day = 0; $day < $classInfo["maxDays"]; $day++) + if ($mini) + { + $out = + "<table class=\"timetable\">". + " <tr>\n <th></th>". + " <th class=\"days\">".lukGetDayName($currDay)."</th>\n </tr>\n"; + + $startDay = $currDay; + $lastDay = $currDay + 1; + } + else { - $out .= " <th style=\"width: ".$cellWidth."%;\" class=\"days\">".lukGetDayName($day)."</th>\n"; + $out = + "<p>".join("; ", $classInfo["general"])."</p>\n". + "<div>".lukMsg("viikossa", $classInfo["totalHours"])."</div>\n". + "<table class=\"timetable\">". + " <tr>\n <th></th>\n"; + $cellWidth = 100 / $classInfo["maxDays"]; + if ($cellWidth > 25) $cellWidth = 25; + + for ($day = 0; $day < $classInfo["maxDays"]; $day++) + { + $out .= " <th style=\"width: ".$cellWidth."%;\" class=\"days\">".lukGetDayName($day)."</th>\n"; + } + $out .= " </tr>\n"; + $startDay = 0; + $lastDay = $classInfo["maxDays"]; } - $out .= " </tr>\n"; + for ($hour = $classInfo["firstHour"]; $hour < $classInfo["lastHour"]; $hour++) { $out .= " <tr>\n". " <th class=\"hours\">".lukGetHourStr($hour)."</th>\n"; - for ($day = 0; $day < $classInfo["maxDays"]; $day++) + for ($day = $startDay; $day < $lastDay; $day++) { $id = lukFindClass($day, $hour); if ($id > 0) @@ -392,7 +424,7 @@ { $class["set"] = TRUE; - $nextActive = $day == $nextDay && + $nextActive = $day == $currDay && $nextTime >= $classHourTimes[$class["start"]]["start"] && $nextTime < $classHourTimes[$class["start"] + $class["hours"] - 1]["end"]; @@ -440,12 +472,20 @@ " </select> </th> <th><input class=\"submit\" type=\"submit\" value=\"".lukMsg("Switch")."\" /></th> - <th><a href=\"".$origBaseURI.$luokka.$origBaseExt."\">".lukMsg("Original")."</a></th> +"; - <th><a href=\"".$baseURI.($nextPeriod ? "" : "?next")."\">". +if (!$mobileMode) +{ +echo " + <th><a id=\"next\" class=\"textctrl\" href=\"".$baseURI.($nextPeriod ? "" : "?next")."\">". ($nextPeriod ? lukMsg("Current period") : lukMsg("Next period"))."</a></th> + <th><a id=\"orig\" class=\"textctrl\" href=\"".$origBaseURI.$luokka.$origBaseExt."\">".lukMsg("Original")."</a></th> + <th><a id=\"xml\" class=\"textctrl\" href=\"".$baseURI.$cachePath."/".$luokka.".xml\">XML</a></th> +"; +} - <th><a href=\"".$baseURI.($nextPeriod ? "cache-next" : "cache")."/".$luokka.".xml\">XML</a></th> +echo " + <th><a id=\"mobile\" class=\"imgctrl\" href=\"".$baseURI."?m=".($mobileMode ? 0 : 1)."\"><img src=\"img/mobile-white.png\" alt=\"Mobile\"></a></th> </tr> </table> </form> @@ -464,7 +504,7 @@ if ($haveData) { - echo lukNormalTimeTable(); + echo lukPrintTimeTable($mobileMode); } echo
--- a/luk.css Wed Oct 24 12:24:48 2012 +0300 +++ b/luk.css Wed Oct 24 13:58:00 2012 +0300 @@ -34,4 +34,3 @@ padding: 0px; margin: 0px; } -
--- a/luk1.css Wed Oct 24 12:24:48 2012 +0300 +++ b/luk1.css Wed Oct 24 13:58:00 2012 +0300 @@ -158,7 +158,7 @@ border: 1px solid gray; } -#controls a { +#controls a.textctrl { padding: 5pt; margin-bottom: 30pt; // border: 1px solid rgba(10,114,133,0.3); @@ -170,7 +170,7 @@ box-shadow: 0px 0px 6px rgba(0,0,0,0.7); } -#controls a:hover { +#controls a.textctrl:hover { color: white; background: rgba(255,255,255,0.5); }
--- a/luk2.css Wed Oct 24 12:24:48 2012 +0300 +++ b/luk2.css Wed Oct 24 13:58:00 2012 +0300 @@ -136,7 +136,7 @@ border: 1px solid gray; } -#controls a { +#controls a.textctrl { padding: 3pt; margin-bottom: 30pt; border: 1px solid white; @@ -147,7 +147,7 @@ background: #657; } -#controls a:hover { +#controls a.textctrl:hover { background: white; color: black; }
--- a/luk3.css Wed Oct 24 12:24:48 2012 +0300 +++ b/luk3.css Wed Oct 24 13:58:00 2012 +0300 @@ -157,7 +157,7 @@ border: 1px solid gray; } -#controls a { +#controls a.textctrl { padding: 5pt; margin-bottom: 30pt; // border: 1px solid rgba(10,114,133,0.3); @@ -169,7 +169,7 @@ box-shadow: 0px 0px 6px rgba(0,0,0,0.7); } -#controls a:hover { +#controls a.textctrl:hover { color: white; background: rgba(255,255,255,0.5); }
--- a/luk4.css Wed Oct 24 12:24:48 2012 +0300 +++ b/luk4.css Wed Oct 24 13:58:00 2012 +0300 @@ -158,7 +158,7 @@ border: 1px solid gray; } -#controls a { +#controls a.textctrl { padding: 5pt; margin-bottom: 30pt; -moz-border-radius: 8px; @@ -169,7 +169,7 @@ box-shadow: 0px 0px 4px rgba(255,255,255,0.9); } -#controls a:hover { +#controls a.textctrl:hover { color: white; background: #666; box-shadow: 0px 0px 4px rgba(255,255,255,0.9);