Changeset 145
- Timestamp:
- 05/23/06 10:38:18 (3 years ago)
- Files:
-
- trunk/webmin/lrs-inventory/agent/transfertNG.php (modified) (2 diffs)
- trunk/webmin/lrs-inventory/classes/Drivers/Sql/SqlDriver.php (modified) (2 diffs)
- trunk/webmin/lrs-inventory/classes/Drivers/Xml/Maps/OcsNGMap.xml (modified) (1 diff)
- trunk/webmin/lrs-inventory/classes/Drivers/Xml/XmlDriver.php (modified) (4 diffs)
- trunk/webmin/lrs-inventory/config (modified) (1 diff)
- trunk/webmin/lrs-inventory/config.info (modified) (1 diff)
- trunk/webmin/lrs-inventory/config.info.fr (modified) (1 diff)
- trunk/webmin/lrs-inventory/debian/changelog (modified) (1 diff)
- trunk/webmin/lrs-inventory/functions.php (modified) (2 diffs)
- trunk/webmin/lrs-inventory/general.cgi (modified) (1 diff)
- trunk/webmin/lrs-inventory/lang/en (modified) (1 diff)
- trunk/webmin/lrs-inventory/lang/fr (modified) (1 diff)
- trunk/webmin/lrs-inventory/module.info (modified) (1 diff)
- trunk/webmin/lrs-inventory/sql/create-db.sh (modified) (1 diff)
- trunk/webmin/lrs-inventory/status.cgi (modified) (2 diffs)
- trunk/webmin/lrs-inventory/tmpl/en/Monitor.tpl (modified) (2 diffs)
- trunk/webmin/lrs-inventory/tmpl/en/Status.tpl (modified) (3 diffs)
- trunk/webmin/lrs-inventory/tmpl/en/System.tpl (modified) (1 diff)
- trunk/webmin/lrs-inventory/tmpl/fr/Modem.tpl (modified) (1 diff)
- trunk/webmin/lrs-inventory/tmpl/fr/Monitor.tpl (modified) (2 diffs)
- trunk/webmin/lrs-inventory/tmpl/fr/Status.tpl (modified) (3 diffs)
- trunk/webmin/lrs-inventory/tmpl/fr/System.tpl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/webmin/lrs-inventory/agent/transfertNG.php
r135 r145 37 37 fclose($stdin); 38 38 // Uncompress it 39 $DATA = gzuncompress($data); 40 41 system("rm /tmp/${_SERVER[REMOTE_ADDR]}.tmp -f"); 39 // Write it in a temporary file (proc_open is only for php >=4.3) 40 $tname = tempnam("/tmp", "OCS"); 41 $fh = fopen($tname, 'w'); 42 fwrite($fh,$data); 43 fclose($fh); 44 exec("perl uncompress.pl $tname",$DATA); 45 $DATA = join('',$DATA); 46 unlink($tname); 42 47 43 48 // Retrieve query and sender … … 55 60 $resp = '<?xml version="1.0" encoding="utf-8" ?><REPLY><RESPONSE>SEND</RESPONSE></REPLY>'; 56 61 } 62 if ( $QUERY=='UPDATE' ) { 63 // Always send the inventory 64 $resp = '<?xml version="1.0" encoding="utf-8" ?><REPLY><RESPONSE>no_update</RESPONSE></REPLY>'; 65 } 57 66 else if ( $QUERY=='INVENTORY' ) 58 67 { 59 68 // Extract inventory data 60 69 ereg('<CONTENT>(.+)<\/CONTENT>', $DATA, $matches); 61 $INVENTORY = '<?xml version="1.0" encoding="utf-8" ?><Inventory>'. $matches[1] .'</Inventory>'; 70 eregi(' encoding="([^"]+)"', $DATA, $matches2); 71 $enc = $matches2[1]; 72 73 $INVENTORY = '<?xml version="1.0" encoding="'.$enc.'" ?><Inventory>'. $matches[1] .'</Inventory>'; 62 74 $resp = '<?xml version="1.0" encoding="utf-8" ?><REPLY><RESPONSE>no_account_update</RESPONSE></REPLY>'; 63 75 trunk/webmin/lrs-inventory/classes/Drivers/Sql/SqlDriver.php
r135 r145 1026 1026 $hastbl = "hasBootGeneral"; 1027 1027 if ($type == "") $hastbl = "hasHardware"; 1028 $sql = "SELECT m.Name, TO_DAYS(NOW()) - TO_DAYS(MAX(i.Date)) as maxi 1028 $sql = "SELECT m.Name, TO_DAYS(NOW()) - TO_DAYS(MAX(i.Date)) as maxi, i.Date, i.Time 1029 1029 FROM Machine m, $hastbl h, Inventory i WHERE 1030 1030 h.Machine=m.Id AND h.Inventory=i.Id GROUP BY m.Name;"; … … 1034 1034 while ( $connection->next_record() ) { 1035 1035 if ($date <=0 || ($date > 0 && $connection->Record['maxi'] >= $date)) 1036 $ret[] = $connection->Record['Name']; 1036 $ret[] = array ( $connection->Record['Name'], 1037 $connection->Record['Date'], 1038 $connection->Record['Time'] 1039 ); 1037 1040 1038 1041 } trunk/webmin/lrs-inventory/classes/Drivers/Xml/Maps/OcsNGMap.xml
r135 r145 75 75 <MappedField from="MANUFACTURER" to="Manuf" /> 76 76 <MappedField from="TYPE" to="Type" /> 77 <MappedField from="SERIAL" to="Serial" /> 77 78 78 79 </MappedObject> trunk/webmin/lrs-inventory/classes/Drivers/Xml/XmlDriver.php
r135 r145 14 14 var $m_MappedFields; 15 15 var $m_DataPath; 16 var $m_UTF8 = false; 16 17 17 18 function XmlDriver($source, $parameters) … … 196 197 197 198 $parser = & $this->createParser($machine); 198 199 200 if (eregi(" encoding=.utf-8.", $content)) { 201 $this->m_UTF8 = true; 202 } 203 199 204 xml_parse($parser, $content); 200 205 … … 262 267 { 263 268 global $datasource; 264 $datasource->loadComponentClass($class);269 @$datasource->loadComponentClass($class); 265 270 } 266 271 … … 323 328 $object = & $GLOBALS['CURRENTOBJECT']; 324 329 325 $object->setProperty($GLOBALS['CURRENTFIELD'], utf8_decode($data)); 330 if ($this->m_UTF8) { $data = utf8_decode($data); } 331 $object->setProperty($GLOBALS['CURRENTFIELD'], $data); 326 332 327 333 $machine = & $GLOBALS['CURRENTMACHINE']; trunk/webmin/lrs-inventory/config
r133 r145 3 3 adresse_mail=ocsinventory 4 4 showempty=1 5 genfromocs=0 trunk/webmin/lrs-inventory/config.info
r133 r145 3 3 adresse_mail=Email,0 4 4 showempty=Show hosts with no inventory,1,1-Yes,0-No 5 genfromocs=Show general information using:,1,1-OCS Inventory,0-PXE Boot Inventory trunk/webmin/lrs-inventory/config.info.fr
r133 r145 3 3 adresse_mail=Adresse mail,0 4 4 showempty=Afficher les clients sans inventaire,1,1-Oui,0-Non 5 genfromocs=Afficher les informations générales en utilisant:,1,1-L'inventaire OCS,0-L'inventaire au boot PXE trunk/webmin/lrs-inventory/debian/changelog
r135 r145 1 webmin-lrs-inventory (2. 0.9) stable; urgency=low1 webmin-lrs-inventory (2.1.0) stable; urgency=low 2 2 3 3 * First package. Replaces webmin-lbs-inventory trunk/webmin/lrs-inventory/functions.php
r133 r145 588 588 } 589 589 590 /** 591 * 592 */ 590 593 function getMacForMachine(&$machine) 591 594 { … … 605 608 } 606 609 607 608 610 /** 611 * Reverse a date (should be in lbs_common ?) 612 * 613 * @param data string containing a date like DD/MM/YYYY 614 * @return returns YYYY-MM-DD. 615 */ 616 function dateReverseToSQL($data) 617 { 618 global $reversedate; 619 if (!$reversedate) return $data; 620 621 $ret = ereg_replace("([0-9]{1,2})/([0-9]{1,2})/([0-9]{4})", "\\3-\\2-\\1", $data); 622 return $ret; 623 } 624 625 /** 626 * Reverse a date (should be in lbs_common ?) 627 * 628 * @param data string containing a date like YYYY-MM-DD 629 * @return returns DD/MM/YYYY. 630 */ 631 function dateReverseFromSQL($data) 632 { 633 global $reversedate; 634 if (!$reversedate) return $data; 635 636 $ret = ereg_replace("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})", "\\3/\\2/\\1", $data); 637 return $ret; 638 } 639 609 640 ?> trunk/webmin/lrs-inventory/general.cgi
r133 r145 29 29 print perl_exec("./lbs_header.cgi", array("lrs-inventory general", $text{'title_gen'}, "general")); 30 30 31 renderTable('BootGeneral', 'System.tpl', array(), null, 'FilterSplitPipe'); 31 if ($config['genfromocs'] == "1") { 32 renderTable('Bios', 'SystemOCS.tpl'); 33 } else { 34 renderTable('BootGeneral', 'System.tpl', array(), null, 'FilterSplitPipe'); 35 } 36 32 37 renderTable('Hardware', 'OS.tpl' ); 33 38 trunk/webmin/lrs-inventory/lang/en
r133 r145 70 70 71 71 no=No 72 73 received=received at trunk/webmin/lrs-inventory/lang/fr
r133 r145 57 57 58 58 no=Non 59 60 received=reçu le trunk/webmin/lrs-inventory/module.info
r135 r145 3 3 desc_fr=LRS : Inventaire 4 4 depends=1.030 lbs_common 5 version=2. 0.95 version=2.1.0 trunk/webmin/lrs-inventory/sql/create-db.sh
r135 r145 42 42 echo "Create the database" 43 43 create 44 VER=1 44 45 upgrade 45 46 else trunk/webmin/lrs-inventory/status.cgi
r133 r145 23 23 sort($hosts); 24 24 foreach ($hosts as $id => $val) { 25 $template->set_var("HOST", "$val"); 25 $template->set_var("HOST", "$val[0]"); 26 if ($val[1]) { 27 $template->set_var("DATE", " ".$text[received]." ".dateReverseFromSQL($val[1])." $val[2]"); 28 } 26 29 $template->parse('rows', 'row', true); 27 30 } … … 35 38 sort($hosts); 36 39 foreach ($hosts as $id => $val) { 37 $template->set_var("HOST", "$val"); 40 $template->set_var("HOST", "$val[0]"); 41 if ($val[1]) { 42 $template->set_var("DATE", " ".$text[received]." ".dateReverseFromSQL($val[1])." $val[2]"); 43 } 38 44 $template->parse('rowsboot', 'rowboot', true); 39 45 } trunk/webmin/lrs-inventory/tmpl/en/Monitor.tpl
r135 r145 19 19 <th>Type {SORT_TYPE}</th> 20 20 <th>Category {SORT_STAMP}</th> 21 <th>Serial {SORT_SERIAL}</th> 21 22 <th>Appearance {SORT_FIRSTAPPARITION}</th> 22 23 </tr> … … 30 31 <td class="{TYPE_CLASS}">{TYPE}</td> 31 32 <td class="{STAMP_CLASS}">{STAMP}</td> 33 <td class="{SERIAL_CLASS}">{SERIAL}</td> 32 34 <td class="{FIRSTAPPARITION_CLASS}">{FIRSTAPPARITION}</td> 33 35 </tr> trunk/webmin/lrs-inventory/tmpl/en/Status.tpl
r133 r145 4 4 <form> 5 5 Clients without inventory since: 6 <input type="checkbox" name="cb" on Select="since.value=0" checked /> always or more than6 <input type="checkbox" name="cb" onClick="since.value=0" checked /> always or more than 7 7 <input type="text" name="since" onKeyDown="cb.checked=0" value="{SINCE}" size=3 /> days. 8 8 </from> … … 13 13 <ul> 14 14 <!-- BEGIN row --> 15 <li><a href="general.cgi?host={HOST}">{HOST}</a> </li>15 <li><a href="general.cgi?host={HOST}">{HOST}</a> {DATE}</li> 16 16 <!-- END row --> 17 17 </ul> … … 21 21 <ul> 22 22 <!-- BEGIN rowboot --> 23 <li><a href="general.cgi?host={HOST}">{HOST}</a> </li>23 <li><a href="general.cgi?host={HOST}">{HOST}</a> {DATE}</li> 24 24 <!-- END rowboot --> 25 25 </ul> trunk/webmin/lrs-inventory/tmpl/en/System.tpl
r133 r145 9 9 </div> 10 10 11 <h3>General information s</h3>11 <h3>General information</h3> 12 12 13 13 <table> trunk/webmin/lrs-inventory/tmpl/fr/Modem.tpl
r135 r145 19 19 <th>Description {SORT_EXPANDEDDESCRIPTION}</th> 20 20 <th>Type {SORT_TYPE}</th> 21 <th>App earance{SORT_FIRSTAPPARITION}</th>21 <th>Apparition {SORT_FIRSTAPPARITION}</th> 22 22 </tr> 23 23 trunk/webmin/lrs-inventory/tmpl/fr/Monitor.tpl
r135 r145 19 19 <th>Type {SORT_TYPE}</th> 20 20 <th>Categorie {SORT_STAMP}</th> 21 <th>No série {SORT_SERIAL}</th> 21 22 <th>Apparition {SORT_FIRSTAPPARITION}</th> 22 23 </tr> … … 30 31 <td class="{TYPE_CLASS}">{TYPE}</td> 31 32 <td class="{STAMP_CLASS}">{STAMP}</td> 33 <td class="{SERIAL_CLASS}">{SERIAL}</td> 32 34 <td class="{FIRSTAPPARITION_CLASS}">{FIRSTAPPARITION}</td> 33 35 </tr> trunk/webmin/lrs-inventory/tmpl/fr/Status.tpl
r133 r145 4 4 <form> 5 5 Clients sans inventaire depuis: 6 <input type="checkbox" name="cb" on Select="since.value=0" checked /> toujours ou plus de6 <input type="checkbox" name="cb" onClick="since.value=0" checked /> toujours ou plus de 7 7 <input type="text" name="since" onKeyDown="cb.checked=0" value="{SINCE}" size=3 /> jours. 8 8 </from> … … 13 13 <ul> 14 14 <!-- BEGIN row --> 15 <li><a href="general.cgi?host={HOST}">{HOST}</a> </li>15 <li><a href="general.cgi?host={HOST}">{HOST}</a> {DATE}</li> 16 16 <!-- END row --> 17 17 </ul> … … 21 21 <ul> 22 22 <!-- BEGIN rowboot --> 23 <li><a href="general.cgi?host={HOST}">{HOST}</a> </li>23 <li><a href="general.cgi?host={HOST}">{HOST}</a> {DATE}</li> 24 24 <!-- END rowboot --> 25 25 </ul> trunk/webmin/lrs-inventory/tmpl/fr/System.tpl
r133 r145 18 18 <th>Modèle {SORT_SYSTEM1}</th> 19 19 <th>Version {SORT_SYSTEM2}</th> 20 <th>S erie {SORT_SYSTEM3}</th>20 <th>Série {SORT_SYSTEM3}</th> 21 21 <th>UUID {SORT_SYSTEM4}</th> 22 22 <th>Type {SORT_CHASSIS1}</th>
