CSAir

.idea
    .name 13 B
    Assignment2.0.iml 295 B
    dictionaries
       lantay77.xml 357 B
    encodings.xml 171 B
    misc.xml 348 B
    modules.xml 289 B
    runConfigurations
       Server.xml 1008 B
       Unittests_in_Tests.xml 1 KB
    scopes
       scope_settings.xml 143 B
    vcs.xml 189 B
    workspace.xml 59 KB
CSAir.py 11 KB
CSAir_helpers.py 9 KB
CSAir_json.py 7 KB
CSAir_server.py 5 KB
Graph
    DiGraph.py 9 KB
    Edge.py 518 B
    Node.py 360 B
Location.py 1 KB
ManualTestPlan.odt 441 KB
ManualTestPlan.pdf 1029 KB
Query.py 2 KB
README 499 B
Server.py 8 KB
Tests
    expected
       brief_print_expected.txt 13 B
       continents_expected.txt 58 B
       expected.json 1 KB
       hubs_expected.txt 70 B
       list_expected.txt 28 B
       longest_expected.txt 36 B
       other_expected.txt 205 B
       print_expected.txt 130 B
       shortest_expected.txt 37 B
    invalid.json 15 KB
    out
       brief_print_test.txt 13 B
       continents_test.txt 58 B
       hubs_test.txt 70 B
       list_test.txt 28 B
       longest_test.txt 36 B
       other_test.txt 205 B
       out.json 1 KB
       print_test.txt 130 B
       shortest_test.txt 37 B
    testCSAir.py 3 KB
    testFunctionsForServer.py 1 KB
    testGraph.py 1 KB
    testLocation.py 938 B
    testServer.py 6 KB
    test_2.1.py 8 KB
    valid.json 871 B
    valid2.json 582 B
add_city_post.py 800 B
changes 633 B
cmi_hub.json 1 KB
map_data.json 15 KB
map_data_r2.json 15 KB
static
    bootstrap.js 59 KB
    css
       bootstrap-theme.css 20 KB
       bootstrap-theme.css.map 22 KB
       bootstrap-theme.min.css 18 KB
       bootstrap.css 129 KB
       bootstrap.css.map 215 KB
       bootstrap.min.css 106 KB
       starter-template.css 186 B
    fonts
       glyphicons-halflings-regular.eot 19 KB
       glyphicons-halflings-regular.svg 61 KB
       glyphicons-halflings-regular.ttf 40 KB
       glyphicons-halflings-regular.woff 22 KB
    js
       bootstrap.js 59 KB
       bootstrap.min.js 31 KB
templates
    city.html 13 KB
    routes.html 10 KB
uploads
city.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="Kate Fayra">
    <!-- <link rel="icon" href="../../favicon.ico">-->

    <title>CSAir</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="css/starter-template.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>

<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".navbar-collapse">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">CSAir</a>
        </div>
        <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="active"><a href="/">Cities</a></li>
                <li><a href="routes">Routes</a></li>
                <li><a href="save.json">Export</a></li>
                <li data-toggle="modal" data-target="#uploadModal"><a href="#">Import</a></li>
            </ul>
        </div><!--/.nav-collapse -->
    </div>
</div>

<div class="btn-group">
    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">Select City: <span class="caret"></span></button>
    <ul class="dropdown-menu scrollable-menu" role="menu">
        {{ city_menu }}
    </ul>
</div>

<div class="container">
    <div class="row">

        <div class="col-md-4">
            <div class="panel panel-default">
                <div class="panel-heading">
                    {% if code %}
                    <h3 class="panel-title">{{ code }} info:
                        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#addModal" onclick="editCopy()">Edit</button>
                        <button type="button" class="btn btn-warning" onclick="window.location.href='/?rm={{ code }}'">Remove</button>
                        {% if country == "US" or country == "USA" %}
                        <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#wxModal">Weather</button>
                        {% endif %}
                    </h3>
                    {% else %}
                    <h3 class="panel-title">City info:</h3>
                    {% endif %}
                </div>
                <div class="panel-body">
                    {{c_info if c_info != None }}
                </div>
            </div>
        </div>


        <div class="col-md-8">

            <img src="{{ map_url }}" alt="Map unable to be displayed since one or more city codes are invalid." id="map_image" class="map-image" width=720 height=360>
            <!--<div class="panel-heading">

            </div>-->
            <!--<h1>Bootstrap starter template</h1>
            <p class="lead">Use this document as a way to quickly start any new project.<br> All you get is this text and a mostly barebones HTML document.</p>-->

            <!--<div class="panel panel-default">
                <div class="panel-heading">
                Options
                    </div>
                </div>-->
            <br><br>
            <button type="button" class="btn btn-success" data-toggle="modal" data-target="#addModal" onclick="noEdit()">Add City</button>
            <!--<button type="button" class="btn btn-success" data-toggle="modal" data-target="#myModal">Add Route</button>-->
            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#hubModal">Hubs</button>
            <!--<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal">Continents</button>-->
            <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#contModal">Continents</button>
            <br><br>
        </div>
    </div>

</div><!-- /.container -->

<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">CSAir statistics:</h3>
        </div>
        <div class="panel-body">
            {{s_info if s_info != None }}
        </div>
    </div>
</div>

<div class="container">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">Log:</h3>
        </div>
        <div class="panel-body">
            {{log if log != None }}
        </div>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">Add City</h4>
            </div>
            <div class="modal-body">
                <form role="form" action="add_city" method="post">
                    <div class="form-group">
                        <input type="text" class="form-control" name="cityCode" id="cityCode" placeholder="City code">
                    </div>
                    <div class="form-group">
                        <button type="button" class="btn btn-success" onclick="addAPI()">Add from API</button>
                        <p class="help-block">Will add the city from Wunderground's API.</p>
                    </div>

                    <div class="form-group">
                        <input type="text" class="form-control" name="cityName" id="cityName" placeholder="Name">
                    </div>

                    <div class="form-group">
                        <input type="text" class="form-control" name="cityCountry" id="cityCountry" placeholder="Country">
                    </div>

                    <div class="form-group">
                        <input type="text" class="form-control" name="cityContinent" id="cityContinent" placeholder="Continent">
                    </div>


                    <div class="form-group">
                        <input type="text" class="form-control" name="cityTimezone" id="cityTimezone" placeholder="Timezone">
                    </div>

                    <div class="form-group">
                        <input type="text" class="form-control" name="cityLatitude" id="cityLatitude" placeholder="Latitude">
                    </div>

                    <div class="form-group">
                        <input type="text" class="form-control" name="cityLongitude" id="cityLongitude" placeholder="Longitude">
                    </div>

                    <div class="form-group">
                        <input type="text" class="form-control" name="cityPop" id="cityPop" placeholder="Population">
                    </div>

                    <div class="form-group">
                        <input type="text" class="form-control" name="cityRegion" id="cityRegion" placeholder="Region">
                    </div>
                    <!-- Form POST not add_city_post.py -->
                    <!--<button type="submit" class="btn btn-success">Submit</button>-->
                    <button type="button" class="btn btn-success" onclick="addCity()">Submit</button>
                </form>
            </div>
        </div>
    </div>
</div>


<!-- Modal -->
<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">Import Data</h4>
            </div>
            <div class="modal-body">
                Upload a .json file to merge with the current data.
                <form action="upload" method="post" enctype="multipart/form-data">
                    <input type="file" name="file"><br /><br />
                    <input type="submit" value="Upload and merge">
                </form>
            </div>
        </div>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="hubModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">Hub cities</h4>
            </div>
            <div class="modal-body">
                    {{hubs if hubs != None }}
            </div>
        </div>
    </div>
</div>

<!-- Modal -->
<div class="modal fade" id="contModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">Cities categorized by continents</h4>
            </div>
            <div class="modal-body">
                    {{conts if conts != None }}
            </div>
        </div>
    </div>
</div>


<!-- Modal -->
<div class="modal fade" id="wxModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width: 1000px">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title">Weather for {{code if code != None}}</h4>
            </div>
            <div class="modal-body">
                     <iframe src="{{WX_url if WX_url != None }}" style="height: 700px" frameborder="0" width="99.6%" height="250"></iframe>
            </div>
        </div>
    </div>
</div>


<script>
    var edit = false
    var old_code = "{{code}}"

    function addAPI() {
        window.location = "/add_city?api=true&cityCode=" + document.getElementById("cityCode").value
                + "&edit=" + edit
                + "&old_code=" + old_code
    }

    function addCity() {
        window.location = "/add_city?" + "cityCode=" + document.getElementById("cityCode").value
                + "&cityName=" + document.getElementById("cityName").value
                + "&cityCountry=" + document.getElementById("cityCountry").value
                + "&cityContinent=" + document.getElementById("cityContinent").value
                + "&cityTimezone=" + document.getElementById("cityTimezone").value
                + "&cityLatitude=" + document.getElementById("cityLatitude").value
                + "&cityLongitude=" + document.getElementById("cityLongitude").value
                + "&cityPop=" + document.getElementById("cityPop").value
                + "&cityRegion=" + document.getElementById("cityRegion").value
                + "&edit=" + edit
                + "&old_code=" + old_code

    }

    function editCopy() {

        document.getElementById("cityCode").value = "{{code}}"
        document.getElementById("cityName").value = "{{name}}"
        document.getElementById("cityCountry").value = "{{country}}"
        document.getElementById("cityContinent").value= "{{continent}}"
        document.getElementById("cityTimezone").value = "{{timezone}}"
        document.getElementById("cityLatitude").value = "{{latitude}}"
        document.getElementById("cityLongitude").value = "{{longitude}}"
        document.getElementById("cityPop").value = "{{pop}}"
        document.getElementById("cityRegion").value = "{{region}}"
        edit = true

    }

    function noEdit(){
        edit = false
    }
</script>



<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>