Changeset 11093

Show
Ignore:
Timestamp:
04/05/12 01:00:48 (14 months ago)
Author:
edent
Message:

move divs around and connect to webServer from local development

Location:
ossiedev/branches/jsnyder/trunk/tools/cornetApps
Files:
1 added
11 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/DomainMan/views.py

    r11092 r11093  
    5858@param password: The user's password 
    5959''' 
    60 def startNodebooter(request, ip, port, user, password): 
     60def startNodebooter(request, floor, num, user, password): 
     61    floor = int(floor) 
     62    num = int(num) 
     63    node = Node(floor, num) 
     64    ip = node.ip 
     65    port = node.port 
    6166    client = connect(ip, port, user, password) 
    6267    #stdin, stdout, stderr = client.exec_command('cd /sdr; nodeBooter -D -d dev/nodes/default_GPP_node/DeviceManager.dcd.xml') 
     
    8287@param password: The user's password 
    8388''' 
    84 def stopNodebooter(request, ip, port, user, password): 
     89def stopNodebooter(request, floor, num, user, password): 
     90    floor = int(floor) 
     91    num = int(num) 
     92    node = Node(floor, num) 
     93    ip = node.ip 
     94    port = node.port 
    8595    client = connect(ip, port, user, password) 
    8696    stdin, stdout, stderr = client.exec_command('killall nodeBooter && killall GPP') 
     
    106116    return render_to_response('DomainMan/console.html', locals(), context_instance=RequestContext(request)) 
    107117 
    108 """Connect to a nodebooter through a form 
     118""" 
     119Connect to a node through a form 
    109120""" 
    110121def connect_to_node(request): 
    111122    if 'floor' in request.POST and 'number' in request.POST and 'user' in request.POST and 'pass' in request.POST: 
    112         postFloor = int(request.POST['floor']) 
    113         postNum = int(request.POST['number']) 
     123        floor = int(request.POST['floor']) 
     124        num = int(request.POST['number']) 
    114125        user = str(request.POST['user']) 
    115126        password = str(request.POST['pass']) 
    116127         
    117         thisNode = Node(postFloor, postNum) 
    118         ip = thisNode.ip 
    119         port = thisNode.port 
    120         #thisNode.save() 
    121         #thisNode.setClient(user, password) 
    122         #node = Node.objects.get(floor=4, num=1) 
     128        node = Node(floor, num) 
     129        ip = node.ip 
     130        port = node.port 
    123131        client = connect(ip, port, user, password) 
    124         #stdin, stdout, stderr = client.exec_command('ls') 
    125         print 'calling runningNodebooter' 
    126132        runningNodebooter = nodeBooter_running(client) 
    127133    else: 
     
    130136    return render_to_response('DomainMan/runningNodebooter.html', locals(), context_instance=RequestContext(request)) 
    131137 
     138""" 
     139Raise exception if the inputs of the floor and node number are invalid 
     140""" 
     141def testValidInputs(floor, num): 
     142    if floor < 1 or floor > 4: 
     143        raise Exception("Floor must be between 1 and 4") 
     144    if num < 1 or num > 12: 
     145        raise Exception("Node must be between 1 and 12") 
     146 
    132147#@login_required 
    133148def loadNode(request, floor_num, node_num): 
    134149    floor = int(floor_num) 
    135150    num = int(node_num) 
    136     if floor < 1 or floor > 4: 
    137         raise Exception("Floor must be between 1 and 4") 
    138     if num < 1 or num > 12: 
    139         raise Exception("Node must be between 1 and 12") 
     151    testValidInputs(floor, num) 
    140152    node = Node(floor, num) 
    141153    ip = node.ip 
    142154    port = node.port 
    143     index2(request, ip) 
     155    address = str(ip)+":"+str(port) 
     156    index2(request, address) 
    144157    return render_to_response("DomainMan/nodes.html", locals(), context_instance=RequestContext(request)) 
    145158 
    146 """Returns connection form 
    147159""" 
    148 def connect_to_node_view(request): 
     160Returns connection form 
     161""" 
     162def connect_to_node_view(request, selectFloor, selectNum): 
    149163    number_of_floors = range(1,5) 
    150164    number_of_nodes = range(1,13) 
     165    selectedFloor=int(selectFloor) 
     166    selectedNum=int(selectNum) 
     167    testValidInputs(selectedFloor, selectedNum) 
    151168    return render_to_response('DomainMan/connect.html', locals(), RequestContext(request)) 
    152169 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/HtmlPages/static/frames.js

    r11092 r11093  
    1111 
    1212$("#left_bottom").ready(function(){ 
    13         $("#apps").load("/~webdemo/django/WebDash/running/"); 
     13        loadHrefToDiv("#apps","/~webdemo/django/WebDash/running/"); 
    1414        $("a.ajax").click(function(){ 
    15                 $("#apps").load("/~webdemo/django/WebDash/running/"); 
     15                loadHrefToDiv("#apps","/~webdemo/django/WebDash/running/"); 
    1616        }); 
    1717        $('#apps a').click(function(e){ 
     
    5353}); 
    5454 
     55$("#console").ready(function(){ 
     56        loadHrefToDiv("#console",$("#currentView").attr("value")); 
     57}); 
     58 
    5559function install(waveform){ 
    56         $("#apps").load("/~webdemo/django/WebDash/install/"+waveform+"/", function(){ 
     60        $("#apps").load("/~webdem/django/WebDash/install/"+waveform+"/", function(){ 
    5761                $("a").click($(this).attr("onclick")); 
    5862        }); 
     
    7882} 
    7983 
    80 function reloadNode(link){ 
    81         $("#workspace").load(link); 
    82 } 
    83  
    8484function display(instance){ 
    8585        $("#workspace").load("/~webdemo/django/WebDash/"+instance+"/display/"); 
    8686        //$("#workspace").load("/WebDash/"+instance+"/display/"); 
     87} 
     88 
     89function openWindow(href){ 
     90        window.open(href, href, "status=1,height=300,width=400"); 
    8791} 
    8892 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/README

    r11092 r11093  
    1 TODO: installation and setup and howto develop instructions for someone whos never used it 
     1TODO: installation and setup and howto develop instructions for someone whos never used itinstallation paragraph for local server 
    22explain ./manage  
    33define what functionality is in which files 
     
    55add refresh status of nodes 
    66remove passwords from url -> put in SESSION variable 
    7 add ip and which node is running 
    87choose which node to start domain manager on 
    98pick the nodeBooter from dev/nodes/ 
    10 installation paragraph for local server 
     9load connect to node in console view 
    1110############# 
    1211Django setup 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/static/frames.js

    r11092 r11093  
    7474} 
    7575 
    76 function loadHrefToDiv(div){ 
    77         $(div).load($(this).attr("href")); 
     76function loadHrefToDiv(div,href){ 
     77        $(div).load(href); 
    7878} 
    7979 
     
    8787} 
    8888 
     89function openWindow(href){ 
     90        window.open(href, "status=1,height=300,width=400"); 
     91} 
     92 
    8993/** 
    9094 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/DomainMan/connect.html

    r11091 r11093  
    22<body> 
    33<form action="{{MEDIA_URL}}/connect_to_node/" method="post">{% csrf_token %} 
    4         <p>Floor:  
     4        <p>floor:  
    55                <select name = "floor"> 
    66                        {% for floor in number_of_floors %} 
    7                                 <option value="{{floor}}">Floor {{floor}}</option> 
     7                                {% ifequal floor selectedFloor %} 
     8                                        <option selected value="{{floor}}">Floor {{floor}}</option> 
     9                                {% else %} 
     10                                        <option value="{{floor}}">Floor {{floor}}</option> 
     11                                {% endifequal %} 
    812                        {% endfor %} 
    913                </select> 
    1014        </p> 
    11         <p>Number:  
     15        <p>number:  
    1216                <select name="number"> 
    1317                        {% for node in number_of_nodes %} 
    14                                 <option value="{{node}}">Node {{node}}</option> 
     18                                {% ifequal node selectedNum %} 
     19                                        <option selected value="{{node}}">Node {{node}}</option> 
     20                                {% else %} 
     21                                        <option value="{{node}}">Node {{node}}</option> 
     22                                {% endifequal %} 
    1523                        {% endfor %} 
    1624                </select> 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/DomainMan/nodes.html

    r11092 r11093  
    1 <p>Node:  {{node}} IP: {{ip}} Port: {{port}}</p> 
     1<p>{{node}}<p> <p>IP: {{ip}} Port: {{port}}</p> 
     2<a href='javascript:openWindow("{{MEDIA_URL}}/connect/{{floor}}/{{num}}");'>Check Nodebooter</a> 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/DomainMan/runningNodebooter.html

    r11087 r11093  
     1<p>{{node}}</p> 
     2<p>IP address: {{ip}}</p> 
     3<p>Port: {{port}}</p> 
     4 
    15<p>The naming service is:  
    26{% if runningNodebooter %} 
    3         <span style="color: green;">running</span> 
    4         <a href='{{MEDIA_URL}}/stopNodeBooter/{{ip}}/{{port}}/{{user}}/{{password}}'>Stop Nodebooter</a> 
     7        <span style="color: green;">running</span></p> 
     8        <p><a href='{{MEDIA_URL}}/stopNodeBooter/{{floor}}/{{num}}/{{user}}/{{password}}'>Stop Nodebooter</a></p> 
    59{% endif %} 
    610{% if not runningNodebooter %} 
    7         <span style="color: red;">not running</span> 
    8         <a href='{{MEDIA_URL}}/startNodeBooter/{{ip}}/{{port}}/{{user}}/{{password}}'>Start Nodebooter</a> 
     11        <span style="color: red;">not running</span></p> 
     12        <p><a href='{{MEDIA_URL}}/startNodeBooter/{{floor}}/{{num}}/{{user}}/{{password}}'>Start Nodebooter</a></p> 
    913{% endif %} 
    10 </p> 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/HtmlPages/ossie.html

    r11092 r11093  
    99 <div id="column_left"> 
    1010  <div id="left_top"> 
    11     <p> 
    12                 <a href="{{MEDIA_URL}}"><img src="{{STATIC_URL}}pics/home.png" title="Home"/></a>  
    13                 <a href="{{MEDIA_URL}}/logout/"><img src="{{STATIC_URL}}pics/logout.png" title="Logout"/></a> 
    14         </p> 
    15         <div id="directory">    </div>{#end menu div#} 
     11         <a href="{{MEDIA_URL}}"><img src="{{STATIC_URL}}pics/home.png" title="Home"/></a>  
     12         <a href="{{MEDIA_URL}}/logout/"><img src="{{STATIC_URL}}pics/logout.png" title="Logout"/></a> 
     13          
     14         &nbsp;&nbsp;&nbsp;&nbsp; 
     15          
     16         Select view: <select name="view_type" onchange='javascript:loadHrefToDiv("#console",this.value);'> 
     17        <option id="currentView" value="{{MEDIA_URL}}/grid/">Grid View</option> 
     18        <option value="{{MEDIA_URL}}/map/1/">Floor 1 View</option> 
     19        <option value="{{MEDIA_URL}}/map/2/">Floor 2 View</option> 
     20        <option value="{{MEDIA_URL}}/map/3/">Floor 3 View</option> 
     21        <option value="{{MEDIA_URL}}/map/4/">Floor 4 View</option> 
     22     </select> 
     23     <div id="console"> 
     24        </div>   
     25     {#end menu div#} 
    1626  </div><!--end #left_top--> 
    1727  <div id="left_bottom"> 
     
    2232 <div id="column_right"> 
    2333 <div id="right_top"> 
    24         <ul class="tabs"> 
    25                 <li class="current"><a href="../grid/">Grid View</a></li> 
    26                 <li><a href="{{MEDIA_URL}}/map/1/">Floor 1</a></li> 
    27                 <li><a href="{{MEDIA_URL}}/map/2/">Floor 2</a></li> 
    28                 <li><a href="{{MEDIA_URL}}/map/3/">Floor 3</a></li> 
    29                 <li><a href="{{MEDIA_URL}}/map/4/">Floor 4</a></li> 
    30         <li id="task manager"><a href="../tasks/">Task Manager</a></li>         
    31     </ul> 
    32     <br/> 
    33     <p><img id="loader" src="{{STATIC_URL}}loading.gif" style="position:absolute;"/></p> 
    34         <div id="console"></div> 
    35   </div><!--end #right_top--> 
     34  <div id="directory">  </div> 
     35 </div><!--end #right_top--> 
    3636  <div id="right_bottom"> 
    3737        <div id="workspace" class="tabs-container">Work space </div> 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/templates/HtmlPages/running.html

    r10817 r11093  
    66                <td>    <a href='/WebDash/{{ instance.getName }}/display/'>{{ instance.getName }}</a>&nbsp;</td> 
    77                <!--<td>        <button onClick="window.location='/WebDash/{{ instance.getName }}/uninstall/'">Uninstall </button></td>--> 
    8                 <td><button onClick="javascript:uninstall('{{ instance.getName }}');">Uninstall</button></td> 
     8                <td><button onClick= 
     9                        'javascript:loadHrefToDiv("#apps","{{MEDIA_URL}}/WebDash/uninstall/{{ instance.getName }}/"); 
     10                                                loadHrefToDiv("#apps","{{MEDIA_URL}}/WebDash/running/");'> 
     11                        Uninstall</button></td> 
    912                </tr> 
    1013        {% endfor %} 
  • ossiedev/branches/jsnyder/trunk/tools/cornetApps/urls.py

    r11092 r11093  
    3737    url(r'^domain_login/$', 'DomainMan.views.cornet_login'), 
    3838    url(r'^checkNodeBooter/(?P<ip>.*)/(?P<port>\d+)/(?P<user>.*)/(?P<password>.*)/$', 'DomainMan.views.nodeBooter_page'), 
    39     url(r'^startNodeBooter/(?P<ip>.*)/(?P<port>\d+)/(?P<user>.*)/(?P<password>.*)/$', 'DomainMan.views.startNodebooter'), 
    40     url(r'^stopNodeBooter/(?P<ip>.*)/(?P<port>\d+)/(?P<user>.*)/(?P<password>.*)/$', 'DomainMan.views.stopNodebooter'), 
    41     url(r'^connect/$', 'DomainMan.views.connect_to_node_view'), 
     39    url(r'^startNodeBooter/(?P<floor>\d{1})/(?P<num>\d+)/(?P<user>.*)/(?P<password>.*)/$', 'DomainMan.views.startNodebooter'), 
     40    url(r'^stopNodeBooter/(?P<floor>\d{1})/(?P<num>\d+)/(?P<user>.*)/(?P<password>.*)/$', 'DomainMan.views.stopNodebooter'), 
     41    url(r'^connect/(\d{1})/(\d+)/$', 'DomainMan.views.connect_to_node_view'), 
    4242    url(r'^connect_to_node/$', 'DomainMan.views.connect_to_node'), 
    4343    url(r'^xhr_test/$', 'DomainMan.views.xhr_test'),