Proyecto

General

Perfil

« Anterior | Siguiente » 

Revisión 104

Gestion de servidores

Ver diferencias:

controlies/trunk/MainLoop.py
#h.wakeup()
return json.dumps(response)
elif request.args['action'][0] == "getThinclientGroups":
h = Hosts (l,"","","","","")
response = h.getThinclientGroups ()
return json.dumps({"response" : response})
elif request.args['action'][0] == "getLTSPServers":
h = Hosts (l,"","","","","")
response = h.getLTSPServers ()
return json.dumps({"response" : response})
elif request.args['action'][0] == "getLTSPStatus":
f = open('/tmp/controlIES.ltpsSevers', 'r')
computers = f.read().split(" ")
......
return json.dumps({ "computers":computers, "teachers":teachers })
elif request.args['action'][0] == "getLTSPClients":
elif request.args['action'][0] == "getClassroomDetails":
import xmlrpclib
s = xmlrpclib.Server("http://" + request.args['classroom'][0] + ":8900");
h = Hosts (l,"","","","","")
response = h.getLTSPServers ()
clients = []
for server in response:
s = xmlrpclib.Server("http://"+server+":8900")
print "connect: "+server
try:
clients[server] = s.Hosts()
except:
pass
return json.dumps({ "clients":clients })
return json.dumps({ "students" : s.Hosts() })
else:
if request.args ['type'][0] == 'thinclient':
ip = ""
controlies/trunk/Server.py
# Start up the web service.
Root = MainLoop.ControlIESProtocol() #Resource object
Root.PageDir='/home/manu/proyectos/controlies/www/'
Root.PageDir='/home/manu/proyectos/controlies/trunk/www/'
#Root.PageDir='/home/chisco/Proyectos/controlies/www'
site = server.Site(Root)
controlies/trunk/Utils/Configs.py
LOG_FILENAME= '/var/log/controlies.log'
LOG_FILENAME= '/tmp/controlies.log'
controlies/trunk/www/main.html
<!-- / END -->
<br><br><br>
<div id="module" class="centerGrid"></div>
<div id="module" class="centerMain"></div>
<div id="dialogAlert" title="Atenci&oacute;n">
<p>
<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 7px 0;"></span>
<span id="dialogAlertMessage"></span>
</p>
</div>
</body>
</html>
controlies/trunk/www/css/helper.css
* html ul.dropdown ul { background-image: url(images/dropdown_pane_8bit.png); }
.centerAuth{ position:absolute; left:50%; margin-left:-150px; }
.centerGrid{ position:absolute; left:50%; margin-left:-450px; }
.centerMain{ position:absolute; left:50%; margin-left:-600px; }
.centerGrid{ position:absolute; left:50%; margin-left:140px; }
form p{ margin-bottom:10px; font-weight:bold;}
form input{ border:1px solid #DDD; }
controlies/trunk/www/classroomServers/index.html
#selectable { list-style-type: none; margin: 0; padding: 0; }
#selectable li { margin: 3px 3px 3px 0; padding: 1px; float: left; width: 80px; height: 95px; font-size: 1px; text-align: center; cursor:pointer; }
</style>
<script src="js/utils.js" type="text/javascript"></script>
<script>
$(function() {
$( "#selectable" ).selectable();
$("#tabsActions").tabs().css("font-size","13px");
$("#tabsServers").tabs().css("font-size","13px");
$( "#selectAll" )
.css("font-size","11px")
.button({ icons: { primary: "ui-icon-circle-plus"}})
.click(function(){ selectAll() });
$( "#selectNone" )
.css("font-size","11px")
.button({ icons: { primary: "ui-icon-circle-minus"}})
.click(function(){ selectNone() });
$( "#turnOn" )
.css("font-size","11px")
.button({ icons: { primary: "ui-icon-power"}})
.click(function(){ alert("En desarrollo");/*sendOrderSelected("wakeup","","cambiaconfig");*/ });
$( "#turnOff" )
.css("font-size","11px")
.button({ icons: { primary: "ui-icon-circle-close"}})
.click(function(){ alert("En desarrollo");/*sendOrderSelected("sleep","","cambiaconfig");*/ });
$( "#classroomDetails" )
.css("font-size","11px")
.button({ icons: { primary: "ui-icon-circle-close"}})
.click(function(){ getClassroomDetails(); });
$( "#selectable" ).selectable();
getLTSPServers();
});
......
var result = $.parseJSON(data);
$.each(result.response, function(i, l){
$('#selectable').append('<li class="ui-state-default" id="selectable-'+l+'"><div id="pcName" style="font-size:11px;">'+l+'</div><img class="thumb-image" src="img/turnOff.png"/><div id="userName" style="font-size:11px;"></div></li>');
$('#selectable').append('<li class="ui-state-default" id="selectable-'+l+'"><div id="pcName" style="font-size:11px;">'+l+'</div><img class="thumb-image" src="img/turnOff.png"/><div id="userName" style="font-size:11px;"></div></li>');
});
getLTSPStatus();
......
$('#selectable li #userName').html('');
$.each(result.computers, function(i, l){
$('#selectable #selectable-'+l+' .thumb-image').attr('src','img/turnOn.png');
$('#selectable #selectable-'+l+' .thumb-image').attr('src','img/turnOn.png');
});
$.each(result.teachers, function(i, l){
......
});
}
function getLTSPClients(){
$.post('hosts','action=getLTSPClients', function(data) {
var result = $.parseJSON(data);
function getClassroomDetails(){
var selected = computersSelected();
if(selected.length==0 || selected.length>1){
modalAlert("Únicamente hay que seleccionar un equipo");
return false;
}else{
/* x = ($(window).width()-300)/2;
y = ($(window).height()-500)/2;
$("#messageLoading").hide();
$("#dialog-form").dialog({
resizable: false,
position: top,
modal: true,
width: 300,
title: "Detalles del aula"
}).dialog('option', 'position', [x, y]);*/
setTimeout("getLTSPClients()",25000);
});
$.post('hosts','action=getClassroomDetails&classroom='+selected[0], function(data) {
var result = $.parseJSON(data);
alert(result);
});
}
}
</script>
<ol id="selectable" style="width:900px;"></ol>
<table width="100" cellspacing="12">
<tr>
<td style="vertical-align:top;">
<div id="tabsActions">
<ul>
<li><a href="#tabs-1"><span id="actions">Acciones</span></a></li>
</ul>
<div id="tabs-1" style="padding:3px;">
<table width="100%">
<tr>
<td style="text-align:center;"><button id="selectAll" style="width:123px;">Selecc. Todo</button></td>
<td style="text-align:center;"><button id="selectNone" style="width:123px;">Selecc. Ninguno</button></td>
</tr>
<tr>
<td style="text-align:center;"><button id="turnOn" style="width:123px;">Encender</button></td>
<td style="text-align:center;"><button id="turnOff" style="width:123px;">Apagar</button></td>
</tr>
<tr>
<td style="text-align:center;"><button id="classroomDetails" style="width:123px;">Mostrar Aula</button></td>
<td style="text-align:center;"></td>
</tr>
</table>
</div>
</div>
</td>
<td>
<div id="tabsServers">
<ul>
<li><a href="#tabs-1"><span id="actions">Servidores</span></a></li>
</ul>
<div id="tabs-1" style="padding:3px;">
<table>
<tr>
<td id="tableSelectable">
<ol id="selectable" style="width:870px;"></ol>
</td>
</tr>
</table>
</div>
</div>
</td>
</tr>
</table>
<div id="dialog-details"></div>
controlies/trunk/www/js/utils.js
/* #########################################################################
# Project: ControlIES
# Module: utils.js
# Purpose: Util functions
# Language: javascript
# Copyright: 2009-2010 - Manuel Mora Gordillo <manuito @nospam@ gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################################## */
function selectAll(){
$("#tabsClassroom").tabs("select","tabsClassroom-1");
$("#selectable li").addClass("ui-selected");
}
function selectNone(){
$("#tabsClassroom").tabs("select","tabsClassroom-1");
$("#selectable li").removeClass("ui-selected");
}
function computersSelected(){
var selected = Array();
var j=0;
$("#selectable li").each(function(i, item){
if($("#"+item.id).hasClass('ui-selected')==true){
selected[j] = $("#"+item.id + ":eq(0) > #pcName").html();
j++;
}
});
return selected;
}
function sendOrderSelected(url,args,action){
var selected = computersSelected(url);
if(selected.length==0){
modalAlert("Para realizar la acci&oacute;n debe seleccionar al menos un equipo");
return;
}
var classroom = {
"pclist" : selected,
"args" : args
}
var dataString = $.JSON.encode(classroom)
connection(url,dataString,action);
}
function sendOrder(url,args,action){
var classroom = {
"args" : args
}
var dataString = $.JSON.encode(classroom);
connection(url,dataString,action);
}
function modalAlert(message){
$("#dialogAlertMessage").html(message);
$("#dialogAlert")
.dialog({
modal: true,
width: 350,
resizable: false,
hide: "explode",
buttons: {
Ok: function() { $( this ).dialog( "close" ); }
}
})
.dialog('open');
return true;
}
function modalConfirm(message, funct){
$("#dialogAlertMessage").html(message);
$("#dialogAlert")
.dialog({
modal: true,
width: 350,
resizable: false,
buttons: {
"Si": function() { eval(funct); },
"No": function() { $( this ).dialog( "close" ); }
}
})
.dialog('open');
return true;
}
controlies/trunk/www/cover/index.html
});
</script>
<div id="fancyClock"></div>
<div id="fancyClock" style="margin-left:190px;"></div>
controlies/trunk/www/groups/index.html
}
</script>
<div id="tabla_clientes">
<div id="tabla_clientes" class="centerGrid">
<table width="100%">
<tr>
<td style="width:2%"></td>
controlies/trunk/www/users/index.html
}
</script>
<div id="tabla_clientes">
<table width="100%">
<tr>
<td style="width:2%"></td>
<td><table id="list" width="100%"></table></td>
<td style="width:2%"></td>
</tr>
</table>
<div id="pager" style=""></div>
<div id="filter" style="margin-left:30%;display:none">Search Invoices</div>
<div id="tabla_clientes" class="centerGrid">
<table width="100%" align="center">
<tr>
<td style="width:2%"></td>
<td style="text-align:center;"><table id="list" width="100%"></table></td>
<td style="width:2%"></td>
</tr>
</table>
<div id="pager" style=""></div>
<div id="filter" style="margin-left:30%;display:none">Search Invoices</div>
</div>
<div id="dialog-form"></div>
controlies/trunk/www/ltsp/index.html
}
</script>
<div id="tabla_clientes">
<div id="tabla_clientes" class="centerGrid">
<table width="100%">
<tr>
<td style="width:2%"></td>
controlies/trunk/www/workstation/index.html
</script>
<div id="tabla_clientes">
<div id="tabla_clientes" class="centerGrid">
<table width="100%">
<tr>
<td style="width:2%"></td>

Exportar a: Unified diff