# HG changeset patch # User Matti Hamalainen # Date 1351076280 -10800 # Node ID 85068c8513b41b6bce5f5933f1e425595a258068 # Parent c553ad61e9c26879d2a3cb87cbe9dc333c55748e Add back mobile mode. diff -r c553ad61e9c2 -r 85068c8513b4 index.php --- 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 = - "

".join("; ", $classInfo["general"])."

\n". - "
".lukMsg("viikossa", $classInfo["totalHours"])."
\n". - "". - " \n \n"; - $cellWidth = 100 / $classInfo["maxDays"]; - if ($cellWidth > 25) $cellWidth = 25; - for ($day = 0; $day < $classInfo["maxDays"]; $day++) + if ($mini) + { + $out = + "
". + " \n ". + " \n \n"; + + $startDay = $currDay; + $lastDay = $currDay + 1; + } + else { - $out .= " \n"; + $out = + "

".join("; ", $classInfo["general"])."

\n". + "
".lukMsg("viikossa", $classInfo["totalHours"])."
\n". + "
".lukGetDayName($currDay)."
".lukGetDayName($day)."
". + " \n \n"; + $cellWidth = 100 / $classInfo["maxDays"]; + if ($cellWidth > 25) $cellWidth = 25; + + for ($day = 0; $day < $classInfo["maxDays"]; $day++) + { + $out .= " \n"; + } + $out .= " \n"; + $startDay = 0; + $lastDay = $classInfo["maxDays"]; } - $out .= " \n"; + for ($hour = $classInfo["firstHour"]; $hour < $classInfo["lastHour"]; $hour++) { $out .= " \n". " \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 @@ " - +"; - + + +"; +} - +echo " +
".lukGetDayName($day)."
".lukGetHourStr($hour)." ".lukMsg("Original")."". +if (!$mobileMode) +{ +echo " + ". ($nextPeriod ? lukMsg("Current period") : lukMsg("Next period"))."".lukMsg("Original")."XMLXML\"Mobile\"
@@ -464,7 +504,7 @@ if ($haveData) { - echo lukNormalTimeTable(); + echo lukPrintTimeTable($mobileMode); } echo diff -r c553ad61e9c2 -r 85068c8513b4 luk.css --- 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; } - diff -r c553ad61e9c2 -r 85068c8513b4 luk1.css --- 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); } diff -r c553ad61e9c2 -r 85068c8513b4 luk2.css --- 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; } diff -r c553ad61e9c2 -r 85068c8513b4 luk3.css --- 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); } diff -r c553ad61e9c2 -r 85068c8513b4 luk4.css --- 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);