aboutsummaryrefslogtreecommitdiff
path: root/h-source
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-03-03 16:48:20 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-03-03 16:48:20 +0000
commitd6fc4f494bf9ceb326fc37679f16224b91a0fc26 (patch)
treec95bbce02e5b7af62690c54cf3c5d0a36ba73c50 /h-source
parentfdd5ccda63a6c6825035f99c3e6b6df93814cebe (diff)
improved the vendor selection
Diffstat (limited to 'h-source')
-rw-r--r--h-source/Application/Controllers/BluetoothController.php6
-rw-r--r--h-source/Application/Controllers/GenericController.php24
-rw-r--r--h-source/Application/Include/hardware.php2
-rw-r--r--h-source/Application/Include/languages.php1
-rw-r--r--h-source/Application/Include/vendors.php19
-rw-r--r--h-source/Application/Views/Bluetooth/form.php2
-rw-r--r--h-source/Application/Views/Help/index.php4
-rw-r--r--h-source/Application/Views/Help/index_es.php2
-rw-r--r--h-source/Application/Views/Help/index_fr.php2
-rw-r--r--h-source/Application/Views/Help/index_it.php2
-rw-r--r--h-source/Application/Views/Printers/form.php2
-rw-r--r--h-source/Application/Views/Scanners/form.php2
-rw-r--r--h-source/Application/Views/Soundcards/form.php2
-rw-r--r--h-source/Application/Views/Threegcards/form.php2
-rw-r--r--h-source/Application/Views/Videocards/form.php2
-rw-r--r--h-source/Application/Views/Webcams/form.php2
-rw-r--r--h-source/Application/Views/Wifi/form.php2
17 files changed, 44 insertions, 34 deletions
diff --git a/h-source/Application/Controllers/BluetoothController.php b/h-source/Application/Controllers/BluetoothController.php
index 4730081..58269bf 100644
--- a/h-source/Application/Controllers/BluetoothController.php
+++ b/h-source/Application/Controllers/BluetoothController.php
@@ -45,6 +45,7 @@ class BluetoothController extends GenericController
$this->m['HardwareModel']->strongConditions['update'] = array(
"checkNotEmpty" => "model|you have to fill the <i>model name</i> entry",
"checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry",
+ "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}",
"checkLength|99" => "model",
"+checkLength|299" => "distribution",
"++checkIsStrings|".Wifi::$commYear => "comm_year",
@@ -55,6 +56,7 @@ class BluetoothController extends GenericController
$this->m['HardwareModel']->strongConditions['insert'] = array(
"checkNotEmpty" => "model|you have to fill the <i>model name</i> entry",
"checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the <i>model name</i> entry",
+ "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}",
"checkLength|99" => "model",
"+checkLength|299" => "distribution",
"++checkIsStrings|".Wifi::$commYear => "comm_year",
@@ -67,7 +69,6 @@ class BluetoothController extends GenericController
"checkLength|20000" => "description",
"+checkLength|49" => "kernel",
"++checkLength|49" => "driver",
- "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}",
"++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]",
);
@@ -76,7 +77,6 @@ class BluetoothController extends GenericController
"checkLength|20000" => "description",
"+checkLength|49" => "kernel",
"++checkLength|49" => "driver",
- "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|<i>VendorID:ProductID</i> has to have the following format: [a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}",
"++checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\/\,\:\;\(\)\[\]]+$/" => "driver|only the following characters are allowed for the <i>driver</i> entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]",
);
@@ -94,7 +94,7 @@ class BluetoothController extends GenericController
$this->setArgKeys($argKeys);
- $data['title'] = 'Soundcard';
+ $data['title'] = 'Bluetooth';
$this->append($data);
}
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php
index f58fa24..0bc3705 100644
--- a/h-source/Application/Controllers/GenericController.php
+++ b/h-source/Application/Controllers/GenericController.php
@@ -79,13 +79,14 @@ class GenericController extends BaseController
{
if ($this->checkDist())
{
- if ($this->checkVendorId())
+ $pci_id = $this->request->post('pci_id','','sanitizeAll');
+ $interface = $this->request->post('interface','not-defined','sanitizeAll');
+
+ if ($this->checkVendorId($interface))
{
- $pci_id = $this->request->post('pci_id','','sanitizeAll');
-
if (strcmp($this->m['HardwareModel']->type,'notebook') !== 0)
{
- $this->m['HardwareModel']->values['vendor'] = sanitizeAll(Vendors::getName($pci_id));
+ $this->m['HardwareModel']->values['vendor'] = sanitizeAll(Vendors::getName($pci_id,$interface));
$this->m['HardwareModel']->databaseConditions['insert']['+checkUnique'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database';
}
@@ -222,13 +223,14 @@ class GenericController extends BaseController
{
if ($this->checkDist())
{
- if ($this->checkVendorId())
+ $pci_id = $this->request->post('pci_id','','sanitizeAll');
+ $interface = $this->request->post('interface','not-defined','sanitizeAll');
+
+ if ($this->checkVendorId($interface))
{
- $pci_id = $this->request->post('pci_id','','sanitizeAll');
-
if (strcmp($this->m['HardwareModel']->type,'notebook') !== 0)
{
- $this->m['HardwareModel']->values['vendor'] = sanitizeAll(Vendors::getName($pci_id));
+ $this->m['HardwareModel']->values['vendor'] = sanitizeAll(Vendors::getName($pci_id,$interface));
$this->m['HardwareModel']->databaseConditions['update']['+checkUniqueCompl'] = 'pci_id|<i>VendorID:ProductID</i> is already present in the database. This means that the device you are trying to insert is already in the database';
}
@@ -273,7 +275,7 @@ class GenericController extends BaseController
}
}
- protected function checkVendorId()
+ protected function checkVendorId($interface)
{
if (strcmp($this->m['HardwareModel']->type,'notebook') === 0) return true;
@@ -283,14 +285,14 @@ class GenericController extends BaseController
{
if (preg_match('/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/',$_POST['pci_id']))
{
- if (Vendors::check($_POST['pci_id']))
+ if (Vendors::check($_POST['pci_id'],$interface))
{
return true;
}
else
{
$this->m['HardwareModel']->result = false;
- $this->m['HardwareModel']->notice = "<div class='alert'>Vendorid code non present in the list, please open an issue <a href='".$this->baseUrl."/issues/viewall/".Lang::$current."'>here</a> in order to ask the insertion of your vendor</div>\n";
+ $this->m['HardwareModel']->notice = "<div class='alert'>Vendorid code non present in the list, please open an issue <a href='".$this->baseUrl."/issues/viewall/".Lang::$current."'>here</a> in order to ask the insertion of your vendor. NB: if it is a USB device, please choose the right interface. If it is not a USB device, and you are not sure about the right interface, choose not-defined, and it should work fine</div>\n";
return false;
}
}
diff --git a/h-source/Application/Include/hardware.php b/h-source/Application/Include/hardware.php
index cae6b74..cd5fcab 100644
--- a/h-source/Application/Include/hardware.php
+++ b/h-source/Application/Include/hardware.php
@@ -492,7 +492,7 @@ class Bluetooth extends Hardware
public static $select = 'yes,no';
- public static $interface = "not-specified,USB";
+ public static $interface = "not-specified,USB,PCI,PCI-E,mini-PCI,mini-PCI-E,ExpressCard,PC-Card";
public static function vendorsList()
{
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php
index 8ce107c..ffcef4e 100644
--- a/h-source/Application/Include/languages.php
+++ b/h-source/Application/Include/languages.php
@@ -213,6 +213,7 @@ class Lang
"special pages" => "pagine speciali",
"Watch all the actions carried out by administrators" => "Guarda tutte le azioni compiute dagli amministratori",
"No bluetooth devices found" => "Non è stato trovato alcun dispositivo bluetooth",
+ "learn how to find it" => "scopri come individuarlo",
),
'es' => array
(
diff --git a/h-source/Application/Include/vendors.php b/h-source/Application/Include/vendors.php
index 79fcefb..8dcc312 100644
--- a/h-source/Application/Include/vendors.php
+++ b/h-source/Application/Include/vendors.php
@@ -3,24 +3,28 @@
class Vendors
{
- public static function getName($id)
+ public static function getName($id,$interface)
{
- if (self::check($id))
+ if (self::check($id,$interface))
{
+ $idArray = strcmp($interface,'USB') === 0 ? self::$usbId : self::$pciId;
+
$temp = explode(':',$id);
$vendorId = $temp[0];
- return self::$id[$vendorId];
+ return $idArray[$vendorId];
}
return 'not-known';
}
- public static function check($id)
+ public static function check($id,$interface = 'USB')
{
if (preg_match('/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/',$id))
{
+ $idArray = strcmp($interface,'USB') === 0 ? self::$usbId : self::$pciId;
+
$temp = explode(':',$id);
$vendorId = $temp[0];
- if (array_key_exists($vendorId,self::$id))
+ if (array_key_exists($vendorId,$idArray))
{
return true;
}
@@ -28,7 +32,7 @@ class Vendors
return false;
}
- public static $id = array(
+ public static $pciId = array(
'0010' => 'Allied-Telesis-Inc',
'001a' => 'Ascend-Communications-Inc.',
'001c' => 'PEAK-System-Technik-GmbH',
@@ -1802,6 +1806,9 @@ class Vendors
'feda' => 'Broadcom',
'fede' => 'Fedetec-Inc.',
'fffd' => 'XenSource-Inc.',
+ );
+
+ public static $usbId = array(
'0001' => 'Frys-Electronics',
'0002' => 'Ingram',
'0003' => 'Club-Mac',
diff --git a/h-source/Application/Views/Bluetooth/form.php b/h-source/Application/Views/Bluetooth/form.php
index a03597a..f6ba115 100644
--- a/h-source/Application/Views/Bluetooth/form.php
+++ b/h-source/Application/Views/Bluetooth/form.php
@@ -45,7 +45,7 @@
</div>
<div class="form_entry">
- <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>:</div>
+ <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>: <b>*</b><br /><a target="blank" href="<?php echo $this->baseUrl."/help/index/$lang#vendoridproductid";?>"><?php echo gtext("learn how to find it");?></a></div>
<?php echo Html_Form::input('pci_id',$values['pci_id'],'input_entry');?>
</div>
diff --git a/h-source/Application/Views/Help/index.php b/h-source/Application/Views/Help/index.php
index 7929cbe..ad9f31b 100644
--- a/h-source/Application/Views/Help/index.php
+++ b/h-source/Application/Views/Help/index.php
@@ -304,8 +304,8 @@
<pre>
lspci | grep "VGA"
</pre>
-
- <h3>How to discover the VendorID and the ProductID of your device (VendorID:ProductID code)</h3>
+
+ <a name="vendoridproductid"><h3>How to discover the VendorID and the ProductID of your device (VendorID:ProductID code)</h3>
<div>
(Thanks <a href="http://trisquel.info/en/forum/h-nodecom-new-website-hardware-database#comment-5839">Michał Masłowski</a> and <a href="http://trisquel.info/en/forum/h-nodecom-new-website-hardware-database#comment-5837">Julius22</a>)
diff --git a/h-source/Application/Views/Help/index_es.php b/h-source/Application/Views/Help/index_es.php
index bf19b5b..df4f09f 100644
--- a/h-source/Application/Views/Help/index_es.php
+++ b/h-source/Application/Views/Help/index_es.php
@@ -306,7 +306,7 @@
lspci | grep "VGA"
</pre>
- <h3>Como descubrir el ID del vendedor y el ID del producto de su dispositivo (código VendorID:ProductID)</h3>
+ <a name="vendoridproductid"><h3>Como descubrir el ID del vendedor y el ID del producto de su dispositivo (código VendorID:ProductID)</h3>
<div>
(Gracias <a href="http://trisquel.info/en/forum/h-nodecom-new-website-hardware-database#comment-5839">Michał Masłowski</a> y <a href="http://trisquel.info/en/forum/h-nodecom-new-website-hardware-database#comment-5837">Julius22</a>)
diff --git a/h-source/Application/Views/Help/index_fr.php b/h-source/Application/Views/Help/index_fr.php
index d98d13b..4a51221 100644
--- a/h-source/Application/Views/Help/index_fr.php
+++ b/h-source/Application/Views/Help/index_fr.php
@@ -297,7 +297,7 @@
lspci | grep "VGA"
</pre>
- <h3>Comment connaitre le VendorID ou le ProductID (VendorID:ProductID code)</h3>
+ <a name="vendoridproductid"><h3>Comment connaitre le VendorID ou le ProductID (VendorID:ProductID code)</h3>
<div>
(Merci à <a href="http://trisquel.info/en/forum/h-nodecom-new-website-hardware-database#comment-5839">Michał Masłowski</a> et <a href="http://trisquel.info/en/forum/h-nodecom-new-website-hardware-database#comment-5837">Julius22</a>)
diff --git a/h-source/Application/Views/Help/index_it.php b/h-source/Application/Views/Help/index_it.php
index d4f6f7d..7d8fbe4 100644
--- a/h-source/Application/Views/Help/index_it.php
+++ b/h-source/Application/Views/Help/index_it.php
@@ -318,7 +318,7 @@
lspci | grep "VGA"
</pre>
- <h3>Come scoprire il VendorID e il ProductID del tuo dispositivo (VendorID:ProductID code)</h3>
+ <a name="vendoridproductid"><h3>Come scoprire il VendorID e il ProductID del tuo dispositivo (VendorID:ProductID code)</h3>
<div>
(Grazie <a href="http://trisquel.info/en/forum/h-nodecom-new-website-hardware-database#comment-5839">Michał Masłowski</a> e <a href="http://trisquel.info/en/forum/h-nodecom-new-website-hardware-database#comment-5837">Julius22</a>)
diff --git a/h-source/Application/Views/Printers/form.php b/h-source/Application/Views/Printers/form.php
index 2ccfb38..dd7be91 100644
--- a/h-source/Application/Views/Printers/form.php
+++ b/h-source/Application/Views/Printers/form.php
@@ -50,7 +50,7 @@
</div>
<div class="form_entry">
- <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>:</div>
+ <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>: <b>*</b><br /><a target="blank" href="<?php echo $this->baseUrl."/help/index/$lang#vendoridproductid";?>"><?php echo gtext("learn how to find it");?></a></div>
<?php echo Html_Form::input('pci_id',$values['pci_id'],'input_entry');?>
</div>
diff --git a/h-source/Application/Views/Scanners/form.php b/h-source/Application/Views/Scanners/form.php
index c9085d9..d666514 100644
--- a/h-source/Application/Views/Scanners/form.php
+++ b/h-source/Application/Views/Scanners/form.php
@@ -45,7 +45,7 @@
</div>
<div class="form_entry">
- <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>:</div>
+ <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>: <b>*</b> <br /><a target="blank" href="<?php echo $this->baseUrl."/help/index/$lang#vendoridproductid";?>"><?php echo gtext("learn how to find it");?></a></div>
<?php echo Html_Form::input('pci_id',$values['pci_id'],'input_entry');?>
</div>
diff --git a/h-source/Application/Views/Soundcards/form.php b/h-source/Application/Views/Soundcards/form.php
index 4e754dd..965ecfc 100644
--- a/h-source/Application/Views/Soundcards/form.php
+++ b/h-source/Application/Views/Soundcards/form.php
@@ -45,7 +45,7 @@
</div>
<div class="form_entry">
- <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>:</div>
+ <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>: <b>*</b><br /><a target="blank" href="<?php echo $this->baseUrl."/help/index/$lang#vendoridproductid";?>"><?php echo gtext("learn how to find it");?></a></div>
<?php echo Html_Form::input('pci_id',$values['pci_id'],'input_entry');?>
</div>
diff --git a/h-source/Application/Views/Threegcards/form.php b/h-source/Application/Views/Threegcards/form.php
index 55a4402..075333e 100644
--- a/h-source/Application/Views/Threegcards/form.php
+++ b/h-source/Application/Views/Threegcards/form.php
@@ -45,7 +45,7 @@
</div>
<div class="form_entry">
- <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>:</div>
+ <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>: <b>*</b><br /><a target="blank" href="<?php echo $this->baseUrl."/help/index/$lang#vendoridproductid";?>"><?php echo gtext("learn how to find it");?></a></div>
<?php echo Html_Form::input('pci_id',$values['pci_id'],'input_entry');?>
</div>
diff --git a/h-source/Application/Views/Videocards/form.php b/h-source/Application/Views/Videocards/form.php
index bdbeaa9..6faab56 100644
--- a/h-source/Application/Views/Videocards/form.php
+++ b/h-source/Application/Views/Videocards/form.php
@@ -45,7 +45,7 @@
</div>
<div class="form_entry">
- <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>:</div>
+ <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>: <b>*</b><br /><a target="blank" href="<?php echo $this->baseUrl."/help/index/$lang#vendoridproductid";?>"><?php echo gtext("learn how to find it");?></a></div>
<?php echo Html_Form::input('pci_id',$values['pci_id'],'input_entry');?>
</div>
diff --git a/h-source/Application/Views/Webcams/form.php b/h-source/Application/Views/Webcams/form.php
index 24fe218..e1b819c 100644
--- a/h-source/Application/Views/Webcams/form.php
+++ b/h-source/Application/Views/Webcams/form.php
@@ -45,7 +45,7 @@
</div>
<div class="form_entry">
- <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>:</div>
+ <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>: <b>*</b><br /><a target="blank" href="<?php echo $this->baseUrl."/help/index/$lang#vendoridproductid";?>"><?php echo gtext("learn how to find it");?></a></div>
<?php echo Html_Form::input('pci_id',$values['pci_id'],'input_entry');?>
</div>
diff --git a/h-source/Application/Views/Wifi/form.php b/h-source/Application/Views/Wifi/form.php
index fc26f70..016f90a 100644
--- a/h-source/Application/Views/Wifi/form.php
+++ b/h-source/Application/Views/Wifi/form.php
@@ -45,7 +45,7 @@
</div>
<div class="form_entry">
- <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>:</div>
+ <div class="entry_label"><?php echo gtext("VendorID:ProductID code of the device");?>: <b>*</b><br /><a target="blank" href="<?php echo $this->baseUrl."/help/index/$lang#vendoridproductid";?>"><?php echo gtext("learn how to find it");?></a></div>
<?php echo Html_Form::input('pci_id',$values['pci_id'],'input_entry');?>
</div>