diff --git a/registration-system/config.inc.php b/registration-system/config.inc.php index a8c14d49c482d34ed86a8552c899b7b5317f0e89..2b60471e4fbaf258388e0d5e4381cda00a1c3c83 100644 --- a/registration-system/config.inc.php +++ b/registration-system/config.inc.php @@ -31,15 +31,16 @@ $config_studitypen_o = array( ); $config_studitypen = array_values($config_studitypen_o); -$config_essen = array( - "Alles", - "Vegetarisch", - "Vegan" +$config_essen_o = array( + "ALLES" => "Alles", + "VEGE" => "Vegetarisch", + "VEGA" => "Vegan" //,"Frutarisch", //"Grießbrei", //"Carnivore", //"Extrawurst" ); +$config_essen = array_values($config_essen_o); $config_reisearten_o = array( "BUSBAHN"=>"gemeinsam mit Bus/Bahn", @@ -84,4 +85,4 @@ function getCFID(){ if(is_numeric($tmp)) return $tmp; return 1; -} \ No newline at end of file +} diff --git a/registration-system/index.php b/registration-system/index.php index 03207b7d6e962c2f656b7f7263dc504e06db2de9..8e0507ee02b7a07e69f60dd2bc761cc56c770bf2 100644 --- a/registration-system/index.php +++ b/registration-system/index.php @@ -1,6 +1,6 @@ <?php session_start(); -error_reporting(E_ALL | E_STRICT); +// error_reporting(E_ALL | E_STRICT); require 'config.inc.php'; require 'frameworks/medoo.php'; @@ -272,6 +272,22 @@ function index_show_formular($fid, $bid = NULL, $bachelor = NULL){ </div>'; if ($withStoryMode) { + function putTypesInObject($obj) + { + $text = '{ '; + $first = true; + foreach($obj as $key => $value) + { + if ($first) + $first = false; + else + $text .= ', '; + $text .= '"'.$key.'":"'.$value.'"'; + } + $text .= ' }'; + return $text; + } + echo '</noscript>'; echo '<h2>Anmeldeformular</h2>'; echo<<<END @@ -283,6 +299,17 @@ function index_show_formular($fid, $bid = NULL, $bachelor = NULL){ function comm_get_possible_dates() { return [ +END; + $dates = comm_get_possible_dates($index_db, $fid); + foreach($dates as &$date) + $date = '"'.$date.'"'; + echo implode(', ', $dates); + echo<<<END + ]; + } + function comm_get_food_types() + { + return [ END; $dates = comm_get_possible_dates($index_db, $fid); foreach($dates as &$date) @@ -293,20 +320,21 @@ END; } function config_get_travel_types() { - return { + return END; - $first = true; global $config_reisearten_o; - foreach($config_reisearten_o as $key => $value) - { - if ($first) - $first = false; - else - echo ', '; - echo '"'.$key.'":"'.$value.'"'; - } + echo putTypesInObject($config_reisearten_o); + echo<<<END +; + } + function config_get_food_types() + { + return +END; + global $config_essen_o; + echo putTypesInObject($config_essen_o); echo<<<END - }; +; } </script> </div> diff --git a/registration-system/view/captcha.php b/registration-system/view/captcha.php index 87afa3f65be1ef2c1f7f1c434d1fb0939b190b51..b29c598e01beae620e1fb848aa739c7a6a01883c 100644 --- a/registration-system/view/captcha.php +++ b/registration-system/view/captcha.php @@ -36,7 +36,7 @@ function captchaForCode($code) imagedestroy($img); } function generateRandomString($length = 4) { - $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; // abcdefghijklmnopqrstuvwxyz + $characters = '123456789ABCDEFHJKLMNOPQRSTUVWXYZ'; // abcdefghijklmnopqrstuvwxyz $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, strlen($characters) - 1)]; diff --git a/registration-system/view/js/story.js b/registration-system/view/js/story.js index 0c49084fab91f5ad92421870c4a9d974d38a1eba..3dd077363def70c64c76b771133a9d3f058e28a5 100644 --- a/registration-system/view/js/story.js +++ b/registration-system/view/js/story.js @@ -134,6 +134,8 @@ Story.prototype.next = function(bGoBack) break; case 5: this.initSummary(); + this.storycanvas.stop(true, true).animate({height:bGoBack?'500px':'680px'}, 1000); + this.storybox.stop(true, true).animate({height:bGoBack?'500px':'680px'}, 1000); this.summary.animate({left:bGoBack?'-900px':'0px'}, 1000); this.travelEnd.animate({left:bGoBack?'0px':'900px'}, 1000); break; @@ -201,7 +203,10 @@ Story.prototype.initSummary = function() var rowTitle = rows[rowName]; this.summaryTable.append('<tr><td>' + rowTitle + '</td><td id="story_summary_' + rowName + '"></td></tr>'); } + this.summaryTable.append('<tr><td>Du bist</td><td><select id="story_summary_studityp" name="studityp"><option>Ersti</option><option>Hoersti</option><option>Tutor</option></select></td></tr>'); this.summaryTable.append('<tr><td>Anmeldung verstecken</td><td><input id="story_summary_public" type="checkbox" name="public" value="public"/></td></tr>'); + this.summaryTable.append('<tr><td>Captcha eingeben</td><td><input id="story_summary_captcha" type="text" name="captcha"/></td></tr>'); + this.summaryTable.append('<tr><td align="center" colspan="2"><img src="view/captcha.php" alt=""/></td></tr>'); this.summaryTable.append('<tr><td colspan="2">Anmerkung</td></tr>'); this.summaryTable.append('<tr><td colspan="2"><textarea id="story_summary_comment" name="comment" style="width: 450px; height: 120px;"></textarea></td></tr>'); this.summaryTable.append('<tr><td colspan="2">Daten Ok? Dann <button onclick="storySubmit()">anmelden</button>.</td></tr>'); @@ -412,8 +417,8 @@ Story.prototype.initTravelEnd = function() } // warnings created at the end -> on top - this.travelEndTypeWarning = this.toolTippedStoryWarning(this.travelEndTicket, 32, 95, null, "Auf der linken Seite den<br/>Anreise Typ anklicken"); - this.travelEndDateWarning = this.toolTippedStoryWarning(this.travelEndTicket, 32, 70, null, "Anreise Datum wählen"); + this.travelEndTypeWarning = this.toolTippedStoryWarning(this.travelEndTicket, 32, 95, null, "Auf der linken Seite den<br/>Abreise Typ anklicken"); + this.travelEndDateWarning = this.toolTippedStoryWarning(this.travelEndTicket, 32, 70, null, "Abreise Datum wählen"); } Story.prototype.initEat = function() { @@ -672,34 +677,38 @@ Story.prototype.toolTippedStoryWarning = function(page, x, y, field, toolTipText return warning; } -$(function() +Story.prototype.test = function() { - Story.eatMap = { - cow: - "Alles", - cheese: - "Vegetarisch", - wheat: - "Vegan" - }; - Story.ageMap = { - eighteenplus: - "Nein", - below: - "Ja" - }; - Story.travelMapPhp = config_get_travel_types(); - Story.travelMap = { - car: - "AUTO", - oeffi: - "BUSBAHN", - bike: - "RAD", - camel: - "INDIVIDUELL" - }; -}); + function cI(objPhp, obj, error, label) + { + var i = 0; + objPhpLoop: + for (var n in objPhp) + { + ++i; + for (var j in obj) + { + if (obj[j] == n) + continue objPhpLoop; + } + error.push(n + " is missing in " + label); + } + for (var n in obj) + --i; + if (i != 0) + error.push(label + " item count differs by " + i); + } + + var error = []; + + cI(Story.eatMapPhp, Story.eatMap, error, "eatMap"); + cI(Story.travelMapPhp, Story.travelMap, error, "travelMap"); + + if (error.length > 0) + { + alert("Der Story Modus ist nicht aktuell.\r\nBitte ohne Story-Modus fortsetzen.\r\nDazu 'Seite funktioniert nicht' anklicken.\r\n\r\n"+error.join("\r\n")); + } +} function storySubmit() { var formWrapper = $('<div style="display:none"/>'); @@ -716,9 +725,9 @@ function storySubmit() formAppendText('sirname', story.form_variables.name); formAppendText('pseudo', story.form_variables.anzeig); formAppendText('mehl', story.form_variables.mehl); - formAppendText('studityp', 'Ersti'); // ? - formAppendText('virgin', Story.ageMap[story.form_variables.age] || ''); - formAppendText('essen', Story.eatMap[story.form_variables.eat] || ''); + formAppendText('studityp', $('#story_summary_studityp').val()); + formAppendText('virgin', Story.ageMap[story.form_variables.age]); + formAppendText('essen', Story.eatMapPhp[Story.eatMap[story.form_variables.eat]]); formAppendText('anday', story.form_variables.travelStartDate); formAppendText('antyp', Story.travelMapPhp[Story.travelMap[story.form_variables.travelStartType]]); formAppendText('abday', story.form_variables.travelEndDate); @@ -726,6 +735,7 @@ function storySubmit() formAppendText('comment', $('#story_summary_comment').val()); if ($('#story_summary_public').is(':checked')) formAppendText('public', 'public'); + formAppendText('captcha', $('#story_summary_captcha').val()); formAppendText('storySubmit', 'storySubmit'); form.submit(); @@ -737,7 +747,35 @@ $(function() var storybox = $('#storybox'); if (storybox) { + Story.eatMapPhp = config_get_food_types(); + Story.eatMap = { + cow: + "ALLES", + cheese: + "VEGE", + wheat: + "VEGA" + }; + Story.ageMap = { + eighteenplus: + "Nein", + below: + "Ja" + }; + Story.travelMapPhp = config_get_travel_types(); + Story.travelMap = { + car: + "AUTO", + oeffi: + "BUSBAHN", + bike: + "RAD", + camel: + "INDIVIDUELL" + }; + story = new Story($('#storyhead'), $('#storycanvas'), storybox); + story.test(); story.begin(); } }); diff --git a/registration-system/view/style.css b/registration-system/view/style.css index d88c82565c894dff6d9ad3b63bedf4ab0dd60d77..4de6a3d2c8802d5b1cedbf2e4f0ab84b0f97acae 100644 --- a/registration-system/view/style.css +++ b/registration-system/view/style.css @@ -146,7 +146,8 @@ div.storyToolTip { border: 1px solid #000; } table.story_summary td { - padding-right: 20px; + padding-left: 5px; + padding-right: 10px; } div#headerbox h2 {