primeros archivos de administración

git-svn-id: https://opengnsys.es/svn/trunk@452 a21b9725-9963-47de-94b9-378ad31fedc9
remotes/github/debian-pkg
alonso 2009-10-28 19:21:38 +00:00
parent 77196ffd80
commit ae0498794a
3 changed files with 12 additions and 20 deletions

View File

@ -1070,16 +1070,14 @@ int RecuperaItem(SOCKET s,char *parametros)
int actualiza_hardware(Database db, Table tbl,char* hrd,char* ip,char*ido)
{
int pci,idtipohardware;
int i,lon=0;
int i,lon=0,idcentro,widcentro;
char *tbHardware[MAXHARDWARE];
int tbidhardware[MAXHARDWARE];
char *dualHardware[2];
char ch[2]; // Carnter delimitador
char sqlstr[1000],ErrStr[200],descripcion[250],nombreordenador[250];
int idcentro;
RegistraLog(hrd,false);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// ACCESO atnico A TRAVEZ DE OBJETO MUTEX a este trozo de cnigo
pthread_mutex_lock(&guardia);
@ -1091,11 +1089,13 @@ int actualiza_hardware(Database db, Table tbl,char* hrd,char* ip,char*ido)
pthread_mutex_unlock(&guardia);
return(false);
}
if(!tbl.Get("idcentro",idcentro)){ // Toma dato
if(!tbl.Get("idcentro",widcentro)){ // Toma dato
tbl.GetErrorErrStr(ErrStr); // error al acceder al registro
pthread_mutex_unlock(&guardia);
return(false);
}
idcentro=widcentro+0; // Bug Mysql
if(!tbl.Get("nombreordenador",nombreordenador)){ // Toma dato
tbl.GetErrorErrStr(ErrStr); // error al acceder al registro
pthread_mutex_unlock(&guardia);
@ -1107,7 +1107,6 @@ int actualiza_hardware(Database db, Table tbl,char* hrd,char* ip,char*ido)
strcpy(ch,"\n");// caracter delimitador
lon=split_parametros(tbHardware,hrd,ch);
RegistraLog("<<>>",false);
// Trocea las cadenas de parametros de particin
for (i=0;i<lon;i++){
strcpy(ch,"=");// caracter delimitador "="
@ -1133,12 +1132,8 @@ int actualiza_hardware(Database db, Table tbl,char* hrd,char* ip,char*ido)
tbl.GetErrorErrStr(ErrStr); // error al acceder al registro
pthread_mutex_unlock(&guardia);
return(false);
}
if(!tbl.Get("pci",pci)){ // Toma dato si es hardware pci
tbl.GetErrorErrStr(ErrStr); // error al acceder al registro
pthread_mutex_unlock(&guardia);
return(false);
}
}
sprintf(sqlstr,"SELECT idhardware FROM hardwares WHERE idtipohardware=%d AND descripcion='%s'",idtipohardware,dualHardware[1]);
// EJecuta consulta
@ -1147,6 +1142,7 @@ int actualiza_hardware(Database db, Table tbl,char* hrd,char* ip,char*ido)
pthread_mutex_unlock(&guardia);
return(false);
}
if(tbl.ISEOF()){ // Hardware NO existente
sprintf(sqlstr,"INSERT hardwares (idtipohardware,descripcion,idcentro,grupoid) VALUES(%d,'%s',%d,0)",idtipohardware,dualHardware[1],idcentro);
if(!db.Execute(sqlstr,tbl)){ // Error al insertar

View File

@ -93,7 +93,7 @@ typedef char BYTE;
typedef int SOCKET;
// __________________________________________________________________________________________________________
char szPathFileLog[128],szPathFileCfg[128];
char szPathFileLog[128],szPathFileCfg[128],msglog[250];
FILE *FLog,*Fconfig;
char AulaUp[2];
int aulaup; // Switch para permitir que un ordenador se de de alta autom<6F>icamente en un aula existenta

View File

@ -177,7 +177,7 @@ function SubarbolXML_ComponentesHardwares($cmd,$idcentro,$grupoid){
global $LITAMBITO_COMPONENTESHARD;
$cadenaXML="";
$rs=new Recordset;
$cmd->texto="SELECT tipohardwares.pci,hardwares.idhardware,hardwares.descripcion,tipohardwares.urlimg,fabricantes.nombre as nombrefabricante,tipohardwares.pci FROM hardwares INNER JOIN tipohardwares ON hardwares.idtipohardware=tipohardwares.idtipohardware LEFT OUTER JOIN fabricantes ON fabricantes.codigo=hardwares.codigo1 WHERE idcentro=".$idcentro." AND grupoid=". $grupoid." order by tipohardwares.idtipohardware,hardwares.descripcion";
$cmd->texto="SELECT hardwares.idhardware,hardwares.descripcion,tipohardwares.urlimg FROM hardwares INNER JOIN tipohardwares ON hardwares.idtipohardware=tipohardwares.idtipohardware WHERE idcentro=".$idcentro." AND grupoid=". $grupoid." order by tipohardwares.idtipohardware,hardwares.descripcion";
$rs->Comando=&$cmd;
if (!$rs->Abrir()) return($cadenaXML); // Error al abrir recordset
$rs->Primero();
@ -188,13 +188,9 @@ function SubarbolXML_ComponentesHardwares($cmd,$idcentro,$grupoid){
$cadenaXML.=' imagenodo='.$rs->campos["urlimg"];
else
$cadenaXML.=' imagenodo="../images/iconos/confihard.gif"';
if ($rs->campos["pci"]>0)
$fabricante="(".trim($rs->campos["nombrefabricante"]).")";
else
$fabricante="";
$cadenaXML.=' infonodo="'.$fabricante.$rs->campos["descripcion"].'"';
$cadenaXML.=' infonodo="'.$rs->campos["descripcion"].'"';
$cadenaXML.=' nodoid='.$LITAMBITO_COMPONENTESHARD.'-'.$rs->campos["idhardware"];
$cadenaXML.=' clickcontextualnodo="menu_contextual(this,' ."'flo_".$LITAMBITO_COMPONENTESHARD."'" .')"';
$cadenaXML.='>';