def formRelationSchemas(numberOfTries, numberOfSteps, relationString, fdsString, fds, relations): html = """<form class="form" action="quiz.py" method="POST"> """ html = html + "<p>Du hast die kanonische Überdeckung gefunden:</p>" html = html + "<pre><h4 style=\"display:inline;\">" + views.fdsToHtmlString( fds) + "</h4></pre><br/>" html = html + "<p>Daraus entstehen diese Relationen:</p>" html = html + "<pre><h4 style=\"display:inline;\">" + views.schemaToString( relations) + "</h4></pre>" html = html + """<input type="hidden" value=" """ + relationString + """" name="relation"></input> <input type="hidden" value=" """ + fdsString + """" name="fds"></input> <input type="hidden" value=" """ + views.fdsToString(fds) + """" name="currentfds"></input> <input type="hidden" value=" """ + str(numberOfTries) + """" name="numberOfTries"></input> <input type="hidden" value=" """ + str(numberOfSteps) + """" name="numberOfSteps"></input> <div class="row"> <div class="col-xs-2 pull-right"> <br/> <button id="step" name="step" type="submit" class="btn btn-primary" value="5">Weiter</button> </div> </div> </form> """ return views.getJumbotron("Glückwunsch.", html)
def formResultSyntheseAlgorithm(numberOfTries, numberOfSteps, relationString, fdsString, fds, relations, keysAndFDs, primarykeys): html = """<form class="form" action="quiz.py" method="POST"> """ html = html + "<p>Folgende Relationen sind entstanden:</p>" html = html + "<pre><h4 style=\"display:inline;\">" + views.schemaToString( relations, keysAndFDs, primarykeys) + "</h4></pre>" html = html + """<input type="hidden" value=" """ + relationString + """" name="relation"></input> <input type="hidden" value=" """ + fdsString + """" name="fds"></input> <input type="hidden" value=" """ + views.fdsToString(fds) + """" name="currentfds"></input> <input type="hidden" value=" """ + str(numberOfTries) + """" name="numberOfTries"></input> <input type="hidden" value=" """ + str(numberOfSteps) + """" name="numberOfSteps"></input> <div class="row"> <div class="col-xs-2 pull-right"> <br/> <button id="step" name="step" type="submit" class="btn btn-primary" value="9">Weiter</button> </div> </div> </form> """ return views.getJumbotron( "Glückwunsch.", "<p>Du hast die ursprüngliche Relation in die 3NF überführt.</p><p>" + html + "</p>")
def formResultDecompositionAlgorithm(numberOfTries, numberOfSteps, relationString, fdsString, mvds, relations, relationnumbers, keysAndFDsMVDs, primarykeys, targetnf = "BCNF"): if targetnf == "BCNF" and mvds: #decomposition algorithm 4NF nextstep = "9" else: #end of quiz nextstep = "11" html = """<form class="form" action="quiz.py" method="POST"> """ html = html + "<p>Folgende Relationen sind entstanden:</p>" html = html + "<pre><h4 style=\"display:inline;\">"+views.schemaToString(relations, keysAndFDsMVDs, primarykeys)+"</h4></pre>" html = html + """<input type="hidden" value=" """+relationString+"""" name="relation"></input> <input type="hidden" value=" """+fdsString+"""" name="fds"></input> <input type="hidden" value="4NF" name="targetnf"></input> <input type="hidden" value=" """+str(numberOfTries)+"""" name="numberOfTries"></input> <input type="hidden" value=" """+str(numberOfSteps)+"""" name="numberOfSteps"></input> <div class="row"> <div class="col-xs-2 pull-right"> <br/> <button id="step" name="step" type="submit" class="btn btn-primary" value=" """+nextstep+"""">Weiter</button> </div> </div> </form> """ return views.getJumbotron("Glückwunsch.", "<p>Du hast die ursprüngliche Relation in die "+targetnf+" überführt.</p><p>" + html +"</p>")
def formRelationSchemas(numberOfTries, numberOfSteps, relationString, fdsString, fds, relations): html = """<form class="form" action="quiz.py" method="POST"> """ html = html + "<p>Du hast die kanonische Überdeckung gefunden:</p>" html = html + "<pre><h4 style=\"display:inline;\">"+views.fdsToHtmlString(fds)+"</h4></pre><br/>" html = html + "<p>Daraus entstehen diese Relationen:</p>" html = html + "<pre><h4 style=\"display:inline;\">"+views.schemaToString(relations)+"</h4></pre>" html = html + """<input type="hidden" value=" """+relationString+"""" name="relation"></input> <input type="hidden" value=" """+fdsString+"""" name="fds"></input> <input type="hidden" value=" """+views.fdsToString(fds)+"""" name="currentfds"></input> <input type="hidden" value=" """+str(numberOfTries)+"""" name="numberOfTries"></input> <input type="hidden" value=" """+str(numberOfSteps)+"""" name="numberOfSteps"></input> <div class="row"> <div class="col-xs-2 pull-right"> <br/> <button id="step" name="step" type="submit" class="btn btn-primary" value="5">Weiter</button> </div> </div> </form> """ return views.getJumbotron("Glückwunsch.", html )
def addKeyRelation(numberOfTries, numberOfSteps, relationString, fdsString, fds, relations): html = """<form class="form" action="quiz.py" method="POST">""" html = html + "<pre><h4 style=\"display:inline;\">" + views.schemaToString( relations) + "</h4></pre>" html = html + """<div class="row"> <div class="col-sm-12">""" html = html + "<div class=\"checkbox\"><label><h4 style=\"display:inline;\"><input type=\"checkbox\" id=\"addkeyrelation\" name=\"addkeyrelation\" value=\"true\">neue Relation hinzufügen</h4></label></div>" html = html + "<input type=\"text\" class=\"form-control input-lg\" id=\"newrelation\" name=\"newrelation\">" html = html + """</div> </div><input type="hidden" value=" """ + relationString + """" name="relation"></input> <input type="hidden" value=" """ + fdsString + """" name="fds"></input> <input type="hidden" value=" """ + views.fdsToString(fds) + """" name="currentfds"></input> <input type="hidden" value=" """ + str(numberOfTries) + """" name="numberOfTries"></input> <input type="hidden" value=" """ + str(numberOfSteps) + """" name="numberOfSteps"></input> <div class="row"> <div class="col-xs-2 pull-right"> <br/> <button id="step" name="step" type="submit" class="btn btn-primary" value="6">Weiter</button> </div> </div> </form> <script> $('#addkeyrelation').on('change', function(){ if($(this).prop('checked')){ $('#newrelation').prop('disabled', false); } else{ $('#newrelation').prop('disabled', true); } }).change(); </script> """ return views.getJumbotron( "Synthesealgorithmus. Relation hinzufügen.", "<p>Möglicherweise musst du eine neue Relation hinzufügen." + views.getHintPopover( "Wenn du eine neue Relation hinzufügen möchtest, markiere die Checkbox und gib die Attribute der neuen Relation in das Textfeld ein. Um z.B. die Relation R<sub>x</sub>:={ABCDE} hinzuzufügen, gib ein:<br/><br/><pre>ABCDE</pre>" ) + "</p><p>" + html + "</p>")
def formResultDecompositionAlgorithm(numberOfTries, numberOfSteps, relationString, fdsString, mvds, relations, relationnumbers, keysAndFDsMVDs, primarykeys, targetnf="BCNF"): if targetnf == "BCNF" and mvds: #decomposition algorithm 4NF nextstep = "9" else: #end of quiz nextstep = "11" html = """<form class="form" action="quiz.py" method="POST"> """ html = html + "<p>Folgende Relationen sind entstanden:</p>" html = html + "<pre><h4 style=\"display:inline;\">" + views.schemaToString( relations, keysAndFDsMVDs, primarykeys) + "</h4></pre>" html = html + """<input type="hidden" value=" """ + relationString + """" name="relation"></input> <input type="hidden" value=" """ + fdsString + """" name="fds"></input> <input type="hidden" value="4NF" name="targetnf"></input> <input type="hidden" value=" """ + str(numberOfTries) + """" name="numberOfTries"></input> <input type="hidden" value=" """ + str(numberOfSteps) + """" name="numberOfSteps"></input> <div class="row"> <div class="col-xs-2 pull-right"> <br/> <button id="step" name="step" type="submit" class="btn btn-primary" value=" """ + nextstep + """">Weiter</button> </div> </div> </form> """ return views.getJumbotron( "Glückwunsch.", "<p>Du hast die ursprüngliche Relation in die " + targetnf + " überführt.</p><p>" + html + "</p>")
def addKeyRelation(numberOfTries, numberOfSteps, relationString, fdsString, fds, relations): html = """<form class="form" action="quiz.py" method="POST">""" html = html + "<pre><h4 style=\"display:inline;\">"+views.schemaToString(relations)+"</h4></pre>" html = html + """<div class="row"> <div class="col-sm-12">""" html = html + "<div class=\"checkbox\"><label><h4 style=\"display:inline;\"><input type=\"checkbox\" id=\"addkeyrelation\" name=\"addkeyrelation\" value=\"true\">neue Relation hinzufügen</h4></label></div>" html = html + "<input type=\"text\" class=\"form-control input-lg\" id=\"newrelation\" name=\"newrelation\">" html = html + """</div> </div><input type="hidden" value=" """+relationString+"""" name="relation"></input> <input type="hidden" value=" """+fdsString+"""" name="fds"></input> <input type="hidden" value=" """+views.fdsToString(fds)+"""" name="currentfds"></input> <input type="hidden" value=" """+str(numberOfTries)+"""" name="numberOfTries"></input> <input type="hidden" value=" """+str(numberOfSteps)+"""" name="numberOfSteps"></input> <div class="row"> <div class="col-xs-2 pull-right"> <br/> <button id="step" name="step" type="submit" class="btn btn-primary" value="6">Weiter</button> </div> </div> </form> <script> $('#addkeyrelation').on('change', function(){ if($(this).prop('checked')){ $('#newrelation').prop('disabled', false); } else{ $('#newrelation').prop('disabled', true); } }).change(); </script> """ return views.getJumbotron("Synthesealgorithmus. Relation hinzufügen.", "<p>Möglicherweise musst du eine neue Relation hinzufügen."+views.getHintPopover("Wenn du eine neue Relation hinzufügen möchtest, markiere die Checkbox und gib die Attribute der neuen Relation in das Textfeld ein. Um z.B. die Relation R<sub>x</sub>:={ABCDE} hinzuzufügen, gib ein:<br/><br/><pre>ABCDE</pre>")+"</p><p>" + html +"</p>")
def formResultSyntheseAlgorithm(numberOfTries, numberOfSteps, relationString, fdsString, fds, relations, keysAndFDs, primarykeys): html = """<form class="form" action="quiz.py" method="POST"> """ html = html + "<p>Folgende Relationen sind entstanden:</p>" html = html + "<pre><h4 style=\"display:inline;\">"+views.schemaToString(relations, keysAndFDs, primarykeys)+"</h4></pre>" html = html + """<input type="hidden" value=" """+relationString+"""" name="relation"></input> <input type="hidden" value=" """+fdsString+"""" name="fds"></input> <input type="hidden" value=" """+views.fdsToString(fds)+"""" name="currentfds"></input> <input type="hidden" value=" """+str(numberOfTries)+"""" name="numberOfTries"></input> <input type="hidden" value=" """+str(numberOfSteps)+"""" name="numberOfSteps"></input> <div class="row"> <div class="col-xs-2 pull-right"> <br/> <button id="step" name="step" type="submit" class="btn btn-primary" value="9">Weiter</button> </div> </div> </form> """ return views.getJumbotron("Glückwunsch.", "<p>Du hast die ursprüngliche Relation in die 3NF überführt.</p><p>" + html +"</p>")