From 75be1868c47b7b9455eef65a7b1e33e447e61ee5 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Thu, 3 Feb 2011 07:54:14 +0000 Subject: improved search --- h-source/Application/Include/hardware.php | 76 ++++++++++++++++++++++ h-source/Application/Include/languages.php | 19 ------ .../Application/Views/Search/lspci_results.php | 14 +++- h-source/Public/Css/website.css | 7 +- 4 files changed, 94 insertions(+), 22 deletions(-) (limited to 'h-source') diff --git a/h-source/Application/Include/hardware.php b/h-source/Application/Include/hardware.php index 9d6fadc..e4fc3e2 100644 --- a/h-source/Application/Include/hardware.php +++ b/h-source/Application/Include/hardware.php @@ -33,6 +33,82 @@ class Hardware '0300' => 'videocards', ); + public static $icons = array( + 'notebook' => 'H2O/computer-laptop_22.png', + 'wifi' => 'H2O/network-wireless_22.png', + 'videocard' => 'Crystal/1282042976_hardware.png', + 'printer' => 'H2O/printer_22.png', + 'scanner' => 'H2O/scanner_22.png', + '3G-card' => 'Crystal/usb_22.png', + 'soundcard' => 'H2O/audio-card_22.png', + ); + + public static $typeToController = array( + 'notebook' => 'notebooks', + 'wifi' => 'wifi', + 'videocard' => 'videocards', + 'printer' => 'printers', + 'scanner' => 'scanners', + '3G-card' => 'threegcards', + 'soundcard' => 'soundcards', + ); + + public static function getControllerFromType($type) + { + if (array_key_exists($type,self::$typeToController)) + { + return self::$typeToController[$type]; + } + return null; + } + + //get the type from the controller + public static function getTypeFromController($controller) + { + $temp = array_flip(self::$typeToController); + if (array_key_exists($controller,$temp)) + { + return $temp[$controller]; + } + return null; + } + + public static function getTypeFromClass($class) + { + if (array_key_exists($class,self::$deviceClasses)) + { + return self::getTypeFromController(self::$deviceClasses[$class]); + } + return null; + } + + public static function getIconFromType($type) + { + if (array_key_exists($type,self::$icons)) + { + return "http://".DOMAIN_NAME."/Public/Img/".self::$icons[$type]; + } + return null; + } + + public static function getIconFromController($controller) + { + if ($type = self::getTypeFromController($controller)) + { + return self::getIconFromType($type); + } + return null; + } + + public static function getIconFromClass($class) + { + if (array_key_exists($class,self::$deviceClasses)) + { + return self::getIconFromController(self::$deviceClasses[$class]); + } + return null; + } + public static $commYear = 'not-specified,2010,2009,2008,2007,2006,2005,2004,2003,2002,2001,2000,1999,1998,1997,1996,1995,1994,1993,1992'; } diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 810fac1..f09b809 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -488,25 +488,6 @@ class MyStrings 'soundcard' => 'soundcards', ); - public static $images = array( - 'notebook' => 'H2O/computer-laptop_22.png', - 'wifi' => 'H2O/network-wireless_22.png', - 'videocard' => 'Crystal/1282042976_hardware.png', - 'printer' => 'H2O/printer_22.png', - 'scanner' => 'H2O/scanner_22.png', - '3G-card' => 'Crystal/usb_22.png', - 'soundcard' => 'H2O/audio-card_22.png', - ); - - public static function getHardIcon($type) - { - if (array_key_exists($type,self::$images)) - { - return "http://".DOMAIN_NAME."/Public/Img/".self::$images[$type]; - } - return null; - } - public static function getTypes() { return implode(',',array_keys(self::$reverse)); diff --git a/h-source/Application/Views/Search/lspci_results.php b/h-source/Application/Views/Search/lspci_results.php index 57e728c..5d1dfa4 100644 --- a/h-source/Application/Views/Search/lspci_results.php +++ b/h-source/Application/Views/Search/lspci_results.php @@ -48,7 +48,7 @@
- ".$row['hardware']['type']." - ".$row['hardware']['model']."";?> + ".$row['hardware']['type']." - ".$row['hardware']['model']."";?>
- +
+
+ ".Hardware::getTypeFromClass($device['classId'])." - ".$device['deviceName'];?> +
+
    +
  • vendor name:
  • +
  • vendorid:productid code:
  • +
+
+
+
diff --git a/h-source/Public/Css/website.css b/h-source/Public/Css/website.css index 5609d12..03043ec 100755 --- a/h-source/Public/Css/website.css +++ b/h-source/Public/Css/website.css @@ -1566,7 +1566,7 @@ td.text_item_date /* border: 1px solid #CECECE; */ } -.lspci_item_found +.lspci_item_found, .lspci_item_not_found { margin:10px 5px; background: #C7DAEF; @@ -1585,4 +1585,9 @@ td.text_item_date .search_item_found { margin:5px; +} + +.lspci_item_not_found +{ + background: orange; } \ No newline at end of file -- cgit v1.2.3