Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • fsini-informatik/fsfahrttool
  • kleemeis/fsfahrttool
2 results
Show changes
Showing
with 238 additions and 228 deletions
File added
File added
File added
File added
File added
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="ui.css" rel="stylesheet" />
<script src="jslib/d3.min.js" type="text/javascript"></script>
<script src="jslib/priority-queue.min.js" type="text/javascript"></script>
<script src="jslib/checkLineIntersection.js" type="text/javascript"></script>
<script src="../../js/api.js" type="text/javascript"></script>
<script src="js/events.js" type="text/javascript"></script>
<script src="js/achievements.js" type="text/javascript"></script>
<script src="js/svgUtils.js" type="text/javascript"></script>
<script src="js/pathFinder.js" type="text/javascript"></script>
<script src="js/vector.js" type="text/javascript"></script>
<script src="js/character.js" type="text/javascript"></script>
<script src="js/camera.js" type="text/javascript"></script>
<script src="js/game.js" type="text/javascript"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="ui.css" rel="stylesheet"/>
<script src="../../js/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="../../js/jquery-ui.min.js" type="text/javascript"></script>
<script src="jslib/d3.min.js" type="text/javascript"></script>
<script src="jslib/priority-queue.min.js" type="text/javascript"></script>
<script src="jslib/checkLineIntersection.js" type="text/javascript"></script>
<script src="../../js/api.js" type="text/javascript"></script>
<script src="js/events.js" type="text/javascript"></script>
<script src="js/achievements.js" type="text/javascript"></script>
<script src="js/svgUtils.js" type="text/javascript"></script>
<script src="js/pathFinder.js" type="text/javascript"></script>
<script src="js/vector.js" type="text/javascript"></script>
<script src="js/character.js" type="text/javascript"></script>
<script src="js/camera.js" type="text/javascript"></script>
<script src="js/environment.js" type="text/javascript"></script>
<script src="js/story.js" type="text/javascript"></script>
<script src="js/game.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript">
var env_possible_dates = ["22.10.2015", "23.10.2015", "24.10.2015"];
</script>
<div id="game-root-container">
<div id="game-sidebar">
<div class="sidebar-section">
<div class="sidebar-section-head">Game log</div>
<div class="sidebar-log"><div>
<ul id="game-log">
<li>Find the students union room</li>
<li>Found the castle entrance</li>
<li>Go inside the castle!</li>
<li>Find the students union room</li>
<li>Found the castle entrance</li>
<li>Go inside the castle!</li>
</ul>
</div></div>
</div>
<div class="sidebar-section">
<div class="sidebar-section-head">Achievements</div>
<div class="status-bar" id="achievement-progress" style="margin-bottom: 0.5em"><span style="width:25%" class="status-bar-bar"></span> <div class="status-bar-text">5/43</div> </div>
<div class="sidebar-log"><div>
<ul id="achievement-log"></ul>
</div></div>
</div>
</div>
<div id="game-sidebar" class="bordered-box">
<div class="sidebar-section">
<div class="sidebar-section-head">Game log</div>
<div class="sidebar-log">
<div>
<ul id="game-log">
<li>Gehe in das Schloss!</li>
<li>Bestes Anmeldesystem aller Zeiten gestartet!</li>
</ul>
</div>
</div>
</div>
<div class="sidebar-section">
<div class="sidebar-section-head">Achievements</div>
<div class="status-bar" id="achievement-progress" style="margin-bottom: 0.5em"><span style="width:25%"
class="status-bar-bar"></span>
<div class="status-bar-text">5/43</div>
</div>
<div class="sidebar-log">
<div>
<ul id="achievement-log"></ul>
</div>
</div>
</div>
</div>
<div id="game-game">
<div id="gameCanvas" style="overflow:hidden;position:relative">
<div id="gameRoot" style="position:relative"></div>
</div>
</div>
<div id="game-game">
<div id="gameCanvas" style="overflow:hidden;position:relative">
<div id="gameRoot" style="position:relative"></div>
<div id="game-overlay" class="loading"></div>
<div id="gameDialogue" class="bordered-box"></div>
</div>
</div>
</div>
<script>
g_smallValue = 0.000001; // fun with floats
var FAPI = new FAPI();
FAPI.methodBasepath = '';
g_smallValue = 0.000001; // fun with floats
Environment.fapi.methodBasepath = '';
var game = new Game({
startMap: 'map_landing.svg',
showEventLayers: UrlComponents.isSet('showEL'),
pathFindingGridSize: 5,
usePathFinding: true,
size: [800, 600]
});
game.run();
var maps = ['map_landing', 'castle_entrance', 'castle_fs', 'dorf', 'shop', 'ufer'];
var game = new Game({
startMap: maps[UrlComponents.getValueOf('map') || 0],
showEventLayers: UrlComponents.getValueOf('showEventLayers') === 'true',
pathFindingGridSize: UrlComponents.isSet('verbosePF') ? 5 : 5,
verbosePathFinder: UrlComponents.isSet('verbosePF'),
usePathFinding: true,
moonWalk: false,
size: [800, 600]
});
game.run();
</script>
</body>
......
......@@ -15,13 +15,37 @@
width: 800px;
height: 600px;
}
#gameCanvas {
overflow:hidden;
position:relative;
height: 600px;
width: 800px;
}
#game-sidebar {
position: absolute;
top: 0;
right: 0;
bottom: 0;
width: 189px;
}
#game-overlay {
position: absolute;
top: 0;
left: 0;
width: 800px;
height: 600px;
background-color: #000;
display: none;
color: white;
}
#game-overlay.loading {
background: #000 url('graphics/loader.gif') no-repeat 300px 200px !important;
display: block !important;
}
.bordered-box {
font-family: Lucida Console, Monaco, monospace;
color: white;
background-color: #323232;
......@@ -29,6 +53,58 @@
outline: 3px solid #2E2E2E;
margin: 3px 2px 3px 3px;
}
#gameDialogue {
font-size: 11pt;
height: 4em;
position: absolute;
bottom: 20px;
left: 20px;
right: 20px;
padding: 0.5em 1em;
display: none;
}
#gameDialogue ul {
margin: 0;
padding: 0 0 0 0.5em;
list-style: none;
}
#gameDialogue ul li {
padding: 0.1em;
}
#gameDialogue ul li:hover {
background-color: #474c46;
cursor: pointer;
}
#gameDialogue ul li:before {
content: '⇢';
font-size: 15pt;
line-height: 11pt;
margin-right: 0.3em;
}
#gameDialogue ul li:hover:before {
content: '↠';
}
#gameDialogue input, #gameDialogue button {
border: 1px dotted black;
background: transparent;
color: white;
margin: 5pt 2em 0 0;
font-size: 12pt;
width: 50%;
padding: 0.3em 0.5em;
}
#gameDialogue input:hover, #gameDialogue input:focus, #gameDialogue button:hover {
background: #474c46;
}
#gameDialogue button:active {
background: #272c26;
}
#gameDialogue button:disabled {
color: red;
}
/*
#2E2E2E dark
#4E8260 green
......@@ -120,4 +196,44 @@
font-size: 5pt;
text-align: center;
color: black;
}
.starWars {
position: absolute;
width: 600px;
height: 50em;
bottom: 0;
left: 50%;
margin-left: -300px;
font-size: 350%;
font-weight: bold;
text-align: center;
overflow: hidden;
transform-origin: 50% 100%;
transform: perspective(300px) rotateX(25deg);
color: #ff0;
font-family: sans-serif;
}
.starWars:after {
position: absolute;
content: ' ';
left: 0;
right: 0;
top: 0;
bottom: 60%;
background-image: linear-gradient(top, rgba(0,0,0,1) 0%, transparent 100%);
pointer-events: none;
}
.starWars div {
position: absolute;
top: 100%;
animation: starWars-scroll 80s linear 0s infinite;
}
.starWars div p {
margin-bottom: 1em;
}
@keyframes starWars-scroll {
0% { top: 100%; }
100% { top: -170%; }
}
\ No newline at end of file
<?php
require_once "abstract_signup_class.php";
require_once 'abstract_signup_class.php';
class SignupMethods {
......@@ -8,6 +8,8 @@ class SignupMethods {
private $signup_methods = [];
private $fallback_method = 'form';
private $environment;
public static function getInstance() {
if(self::$__instance == NULL) self::$__instance = new SignupMethods();
return self::$__instance;
......@@ -15,6 +17,7 @@ class SignupMethods {
protected function __construct() {
$this->signup_methods = $this->loadSignupMethods();
$this->environment = Environment::getEnv();
}
public function getSignupMethods() {
......@@ -27,12 +30,19 @@ class SignupMethods {
public function getSignupMethodsBaseInfo() {
$tmp = [];
foreach($this->signup_methods as $method) {
array_push($tmp, [
"id" => $method["id"],
"name" => $method["class"]::getName(),
"description" => $method["class"]::getAltText(),
"meta" => $method["class"]::getMetaInfo()
]);
$tmp[$method['id']] = [
'id' => $method['id'],
'name' => $method['class']::getName(),
'description' => $method['class']::getAltText(),
'meta' => $method['class']::getMetaInfo(),
'logo' => $method['class']::getLogo(),
'score' => function($stats) use ($method) {
return $method['class']::getScore($stats);
},
'badgeDetails' => function($stats) use ($method) {
return $method['class']::getBadgeDetails($stats);
}
];
}
return $tmp;
}
......@@ -57,7 +67,7 @@ class SignupMethods {
/**
* @return class (instantiated) of the active signup method
* @throws ErrorException when $_GET["method"] is missing or not available in the list
* @throws ErrorException when $_GET['method'] is missing or not available in the list
*/
public function getActiveMethod() {
$method = $this->getActiveMethodObj();
......@@ -66,7 +76,7 @@ class SignupMethods {
/**
* @return id of the class (and with that the folder)
* @throws ErrorException when $_GET["method"] is missing or not available in the list
* @throws ErrorException when $_GET['method'] is missing or not available in the list
*/
public function getActiveMethodId() {
$method = $this->getActiveMethodObj();
......@@ -75,16 +85,16 @@ class SignupMethods {
/**
* @return array
* @throws ErrorException when $_GET["method"] is missing or not available in the list
* @throws ErrorException when $_GET['method'] is missing or not available in the list
*/
private function getActiveMethodObj() {
if(!isset($_REQUEST["method"])) throw new ErrorException("No signup-method selected!");
return $this->getMethodObj($_REQUEST["method"]);
if(!isset($_REQUEST['method'])) throw new ErrorException('No signup-method selected!');
return $this->getMethodObj($_REQUEST['method']);
}
private function getMethodObj($mode) {
if(Environment::getEnv()->formDataReceived()) $mode = $this->fallback_method;
if(!isset($this->signup_methods[$mode])) throw new ErrorException("Signup-method does not exist!");
if(!isset($this->signup_methods[$mode])) throw new ErrorException('Signup-method does not exist!');
return [ 'id' => $mode, 'class' => $this->signup_methods[$mode]['class']];
}
......@@ -125,153 +135,4 @@ class SignupMethods {
return $tmp_methods;
}
/**
* This function takes submitted form data from $_REQUEST and validates the input.
*
* returns assoc array looking like this:
* [
* "valid" => true|false,
* "message" => 'a message',
* "errors" => ['array of', 'errors'],
* "data" => [<validated data as assoc array>]
* ]
*
* @return array (see above)
*/
public function validateSubmission() {
$environment = Environment::getEnv();
$errors = [];
$data = [];
$fid = $environment->getSelectedTripId();
$data['fahrt_id'] = $fid;
if($environment->getRegistrationState() > 1){
$errors = ["Ungültige Fahrt!"];
} else {
$possible_dates = comm_get_possible_dates($environment->database, $fid);
$this->validateField('forname', $environment->config['invalidChars'], $data, $errors, "Fehlerhafter oder fehlender Vorname!");
$this->validateField('sirname', $environment->config['invalidChars'], $data, $errors, "Fehlerhafter oder fehlender Nachname!");
$this->validateField('pseudo', $environment->config['invalidChars'], $data, $errors, "Fehlerhafter oder fehlender Anzeigename!");
$this->validateField('mehl', 'mail', $data, $errors, "Fehlerhafte oder fehlende E-Mail-Adresse!");
$this->validateField('anday', array_slice($possible_dates,0, -1), $data, $errors, 'Hilfe beim Ausfüllen: <a href="https://www.hu-berlin.de/studium/bewerbung/imma/exma">hier klicken!</a>');
$this->validateField('antyp', $environment->config['reisearten'], $data, $errors, 'Trolle hier lang: <a href="https://www.hu-berlin.de/studium/bewerbung/imma/exma">hier klicken!</a>');
$this->validateField('abday', array_slice($possible_dates,1), $data, $errors, 'Ruth hat mitgedacht: <a href="https://www.hu-berlin.de/studium/bewerbung/imma/exma">hier klicken!</a>');
$this->validateField('abtyp', $environment->config['reisearten'], $data, $errors, 'Entwickler Bier geben und: <a href="https://www.hu-berlin.de/studium/bewerbung/imma/exma">hier klicken!</a>');
$this->validateField('essen', $environment->config['essen'], $data, $errors, 'Hat das wirklich nicht gereicht??'); // ggf trollable machen mit /^[a-zA-Z]{2,50}$/
$this->validateField('studityp', $environment->config['studitypen'], $data, $errors, 'Neue Chance, diesmal FS-Ini wählen!');
$this->validateField('public', 'public', $data, $errors, 'Trollololol');
$this->validateField('virgin', array("Ja","Nein"), $data, $errors, 'Bitte Altersbereich wählen!');
$this->validateField('comment', 'comment', $data, $errors, 'Trollololol');
$this->validateField('captcha', 'captcha', $data, $errors, 'Captcha falsch eingegeben.');
if($data['anday'] == $data['abday'])
array_push($errors, "Anreisetag = Abreisetag -> Bitte prüfen!");
}
if(count($errors)>0){
return [
"valid" => false,
"errors" => $errors,
"message" => "Fehlerhafte Angaben!",
"data" => $data
];
} else {
return [
"valid" => true,
"errors" => null,
"message" => "Angaben gültig!",
"data" => $data
];
}
}
/**
* checks for correctness of a given field ($index) by trying $check.
* pushes $errmess into $errarr, if $check fails
* pushes empty data on fail or correct data on success into $data
*
* check can be regex or array or special (public, mail, comment).
* if array, than check only succeeds if sent data is inside that array
*
* @param $index
* @param $check
* @param $datarr
* @param $errarr
* @param $errmess
*/
function validateField($index, $check, &$datarr, &$errarr, $errmess){
$pushdat = "";
comm_verbose(3,"checking ".$index);
// check that first because if unchecked it doesnt exist
if($check == "public"){
if(isset($_REQUEST[$index])) $datarr[$index] = 0;
else $datarr[$index] = 1;
}
// if index is missing -> error!
elseif(!isset($_REQUEST[$index])){
array_push($errarr, $errmess);
// set it in every case so corrections are possible
$datarr[$index] = "";
}
// index is there -> check if value is allowed
else {
$tmp = trim($_REQUEST[$index]);
// do specific check if a set of variables is allowed
if(is_array($check)){
if(!in_array($tmp,$check))
array_push($errarr, $errmess);
else
$datarr[$index] = $tmp;
}
// check captcha
elseif($check == "captcha"){
if(isset($_SESSION['captcha']) && strtolower($tmp) == strtolower($_SESSION['captcha'])){
unset($_SESSION['captcha']);
} else{
array_push($errarr, $errmess);
$datarr[$index] = "";
}
}
// check mail address
elseif($check == "mail"){
if(!filter_var($tmp, FILTER_VALIDATE_EMAIL))
array_push($errarr, $errmess);
// set it in every case so corrections are possible
$datarr[$index] = $tmp;
}
// check comment field
elseif($check == "comment"){
$datarr[$index] = htmlspecialchars($tmp, ENT_QUOTES);
}
// check virgin field
elseif($index == "virgin"){
if($_REQUEST[$index]=="Ja") $datarr[$index] = 0; // NOTE: for consistency: virgin = 0 means > 18
else $datarr[$index] = 1;
}
//everything else
else {
// check with regex
if(!(preg_match($check, $tmp)==1))
array_push($errarr, $errmess);
// set it in every case so corrections are possible
$datarr[$index] = $tmp;
}
}
}
}
\ No newline at end of file
}
registration-system/view/signups/story/graphics/age.png

82.5 KiB

File suppressed by a .gitattributes entry or the file's encoding is unsupported.
registration-system/view/signups/story/graphics/begin.png

86.3 KiB

File suppressed by a .gitattributes entry or the file's encoding is unsupported.
registration-system/view/signups/story/graphics/eat.png

133 KiB

File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
registration-system/view/signups/story/graphics/travelBegin.png

164 KiB

File suppressed by a .gitattributes entry or the file's encoding is unsupported.
registration-system/view/signups/story/graphics/travelEnd.png

152 KiB

File suppressed by a .gitattributes entry or the file's encoding is unsupported.
<?php
class StorySignupMethod extends SignupMethod {
public static function getName() {
return "Story Mode";
}
......@@ -11,14 +12,34 @@ class StorySignupMethod extends SignupMethod {
public static function getMetaInfo() {
return [
"version" => '1.1',
"date" => '20.09.2014',
"version" => '1.1',
"date" => '20.09.2014',
"contributors" => ['Manuel Herrmann <fsfahrt@icetruck.de>']
];
}
public static function getLogo() {
return 'graphics/hej.svg';
}
public static function getScore($stats) {
$allowedAchievements = ['test','stein','elch2','bagger','ball','ohh','star','park'];
if (isset($stats['achievements'])) {
$cnt = 0;
foreach($stats['achievements'] as $a){
if (in_array($a, $allowedAchievements)) $cnt++;
}
return round($cnt/count($allowedAchievements)*100);
}
return 0;
}
public static function getBadgeDetails($stats) {
return 'superspecial <br /> Detials';
}
public function getJSDependencies() {
return ['story.js'];
return ['story.js','../game1/jslib/d3.min.js'];
}
public function getCSSDependencies() {
......@@ -30,12 +51,10 @@ class StorySignupMethod extends SignupMethod {
}
public function showInlineHTML() {
global $config_reisearten_o, $config_essen_o;
$environment = Environment::getEnv();
$dates = $this->environment->getTrip()->getPossibleDates();
$dates = comm_get_possible_dates($environment->database, $environment->getSelectedTripId());
foreach($dates as &$date)
$date = '"'.$date.'"';
foreach ($dates as &$date)
$date = '"' . $date . '"';
echo '
<div id="storyhead"></div>
......@@ -50,10 +69,10 @@ class StorySignupMethod extends SignupMethod {
return [];
}
function config_get_travel_types() {
return ' . $this->putTypesInObject($config_reisearten_o) . ';
return ' . $this->putTypesInObject($this->environment->oconfig['reisearten']) . ';
}
function config_get_food_types() {
return ' . $this->putTypesInObject($config_essen_o) . ';
return ' . $this->putTypesInObject($this->environment->oconfig['essen']) . ';
}
</script>
</div>';
......@@ -67,7 +86,7 @@ class StorySignupMethod extends SignupMethod {
$first = false;
else
$text .= ', ';
$text .= '"'.$key.'":"'.$value.'"';
$text .= '"' . $key . '":"' . $value . '"';
}
$text .= ' }';
return $text;
......