From 632f611689562bb79dfb18065b6d0851a5c2077e Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Tue, 1 Mar 2011 16:43:28 +0000 Subject: added bluetooth - part 1 --- .../Controllers/BluetoothController.php | 160 +++++++++++++++++++++ .../Application/Controllers/DownloadController.php | 2 +- h-source/Application/Include/hardware.php | 20 ++- h-source/Application/Include/languages.php | 20 ++- h-source/Application/Models/BluetoothModel.php | 74 ++++++++++ h-source/Application/Views/Bluetooth/catalogue.php | 82 +++++++++++ h-source/Application/Views/Bluetooth/form.php | 106 ++++++++++++++ h-source/Application/Views/Bluetooth/page.php | 94 ++++++++++++ h-source/Application/Views/Hardware/left.php | 4 + h-source/Config/Route.php | 9 ++ .../Img/H2O/preferences-system-bluetooth-22.png | Bin 0 -> 1046 bytes .../Img/H2O/preferences-system-bluetooth.png | Bin 0 -> 4558 bytes h-source/tables.sql | 4 +- 13 files changed, 571 insertions(+), 4 deletions(-) create mode 100644 h-source/Application/Controllers/BluetoothController.php create mode 100644 h-source/Application/Models/BluetoothModel.php create mode 100644 h-source/Application/Views/Bluetooth/catalogue.php create mode 100644 h-source/Application/Views/Bluetooth/form.php create mode 100644 h-source/Application/Views/Bluetooth/page.php create mode 100755 h-source/Public/Img/H2O/preferences-system-bluetooth-22.png create mode 100755 h-source/Public/Img/H2O/preferences-system-bluetooth.png (limited to 'h-source') diff --git a/h-source/Application/Controllers/BluetoothController.php b/h-source/Application/Controllers/BluetoothController.php new file mode 100644 index 0000000..c763aa6 --- /dev/null +++ b/h-source/Application/Controllers/BluetoothController.php @@ -0,0 +1,160 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class BluetoothController extends GenericController +{ + + public function __construct($model, $controller, $queryString) + { + + $this->_topMenuClasses['hardware'] = " class='currentitem'"; + + parent::__construct($model, $controller, $queryString); + + //load the model + $this->model('HardwareModel'); + $this->model('RevisionsModel'); + $this->model('BluetoothModel'); + $this->model('TalkModel'); + + $this->mod = $this->m['BluetoothModel']; + + $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user']; + $this->m['HardwareModel']->type = 'bluetooth'; + + //hardware conditions + $this->m['HardwareModel']->strongConditions['update'] = array( + "checkIsStrings|".Bluetooth::vendorsList() => "vendor", + "checkNotEmpty" => "model|you have to fill the model name entry", + "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the model name entry", + "checkLength|99" => "model", + "+checkLength|299" => "distribution", + "++checkIsStrings|".Wifi::$commYear => "comm_year", + "+++checkIsStrings|".Bluetooth::$select => "bluetooth_works", + "++++checkIsStrings|".Bluetooth::$interface => "interface", + ); + + $this->m['HardwareModel']->strongConditions['insert'] = array( + "checkIsStrings|".Bluetooth::vendorsList() => "vendor", + "checkNotEmpty" => "model|you have to fill the model name entry", + "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s\(\)\@\[\]\/]+$/" => "model|characters not allowed in the model name entry", + "checkLength|99" => "model", + "+checkLength|299" => "distribution", + "++checkIsStrings|".Wifi::$commYear => "comm_year", + "+++checkIsStrings|".Bluetooth::$select => "bluetooth_works", + "++++checkIsStrings|".Bluetooth::$interface => "interface", + ); + + $this->m['HardwareModel']->softConditions['update'] = array( + "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s]+$/" => "kernel|characters not allowed in the kernel entry", + "checkLength|20000" => "description", + "+checkLength|49" => "kernel", + "++checkLength|49" => "driver", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|VendorID:ProductID 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 driver entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", + ); + + $this->m['HardwareModel']->softConditions['insert'] = array( + "checkMatch|/^[a-zA-Z0-9\-\_\.\+\s]+$/" => "kernel|characters not allowed in the kernel entry", + "checkLength|20000" => "description", + "+checkLength|49" => "kernel", + "++checkLength|49" => "driver", + "+checkMatch|/^[a-zA-Z0-9]{4}(\:)[a-zA-Z0-9]{4}$/" => "pci_id|VendorID:ProductID 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 driver entry: a-z A-Z 0-9 - _ . + s / , : ; ( ) [ ]", + ); + + $this->m['HardwareModel']->setFields('vendor,model,kernel,description,distribution,comm_year,bluetooth_works,pci_id,interface,driver','sanitizeAll'); + + $argKeys = array( + 'page:forceNat' => 1, + 'history_page:forceNat' => 1, + 'vendor:sanitizeString' => 'undef', + 'comm_year:sanitizeString' => 'undef', + 'bluetooth_works:sanitizeString' => 'undef', + 'interface:sanitizeString' => 'undef', + 'sort-by:sanitizeString' => 'undef' + ); + + $this->setArgKeys($argKeys); + + $data['title'] = 'Soundcard'; + $this->append($data); + } + + public function catalogue($lang = 'en') + { + $this->shift(1); + + $whereArray = array( + 'type' => $this->mod->type, + 'vendor' => $this->viewArgs['vendor'], + 'comm_year' => $this->viewArgs['comm_year'], + 'bluetooth_works' => $this->viewArgs['bluetooth_works'], + 'interface' => $this->viewArgs['interface'], + ); + + $this->mod->setWhereQueryClause($whereArray); + + parent::catalogue($lang); + } + + public function view($lang = 'en', $id = 0, $name = null) + { + parent::view($lang, $id, $name); + } + + public function history($lang = 'en', $id = 0) + { + parent::history($lang, $id); + } + + public function revision($lang = 'en', $id_rev = 0) + { + parent::revision($lang, $id_rev); + } + + public function insert($lang = 'en', $token = '') + { + parent::insert($lang, $token); + } + + public function update($lang = 'en', $token = '') + { + parent::update($lang, $token); + } + + public function differences($lang = 'en', $id_hard = 0, $id_rev = 0) + { + parent::differences($lang, $id_hard, $id_rev); + } + + public function climb($lang = 'en', $id_rev = 0, $token = '') + { + parent::climb($lang, $id_rev, $token); + } + + public function talk($lang = 'en', $id_hard = 0, $token = '') + { + parent::talk($lang, $id_hard, $token); + } + +} \ No newline at end of file diff --git a/h-source/Application/Controllers/DownloadController.php b/h-source/Application/Controllers/DownloadController.php index 6ad04dc..72292f6 100644 --- a/h-source/Application/Controllers/DownloadController.php +++ b/h-source/Application/Controllers/DownloadController.php @@ -123,7 +123,7 @@ class DownloadController extends BaseController $xml .= "\t\t".$row['hardware']['video_card_works']."\n"; } - if ($type === 'printer' or $type === 'scanner' or $type === 'soundcard') + if ($type === 'printer' or $type === 'scanner' or $type === 'soundcard' or $type === 'webcam') { $xml .= "\t\t".$row['hardware']['driver']."\n"; } diff --git a/h-source/Application/Include/hardware.php b/h-source/Application/Include/hardware.php index f10993b..2ea5dd5 100644 --- a/h-source/Application/Include/hardware.php +++ b/h-source/Application/Include/hardware.php @@ -24,7 +24,7 @@ if (!defined('EG')) die('Direct access not allowed!'); class Hardware { - public static $controllers = array('notebooks','wifi','videocards','printers','scanners','threegcards','soundcards','webcams'); //used by UsersController::login() + public static $controllers = array('notebooks','wifi','videocards','printers','scanners','threegcards','soundcards','webcams','bluetooth'); //used by UsersController::login() //classId => controller public static $deviceClasses = array( @@ -42,6 +42,7 @@ class Hardware '3G-card' => 'Crystal/usb_22.png', 'soundcard' => 'H2O/audio-card_22.png', 'webcam' => 'H2O/camera-web_22.png', + 'bluetooth' => 'H2O/preferences-system-bluetooth-22.png', ); public static $typeToController = array( @@ -53,6 +54,7 @@ class Hardware '3G-card' => 'threegcards', 'soundcard' => 'soundcards', 'webcam' => 'webcams', + 'bluetooth' => 'bluetooth', ); public static function getControllerFromType($type) @@ -529,6 +531,22 @@ class Webcams extends Hardware public static $interface = "not-specified,USB,Firewire,Parallel,Wifi,Serial"; + public static function vendorsList() + { + return implode(',',array_values(self::$vendors)); + } +} + +class Bluetooth extends Hardware +{ + public static $vendors = array( + "Samsung" => "Samsung", + ); + + public static $select = 'yes,no'; + + public static $interface = "not-specified,USB"; + public static function vendorsList() { return implode(',',array_values(self::$vendors)); diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index ee4fdcc..8ce107c 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -211,7 +211,8 @@ class Lang "delete the wiki page" => "cancella la pagina", "list of blocked pages" => "lista delle pagine bloccate", "special pages" => "pagine speciali", - "Watch all the actions carried out by administrators" => "Guarda tutte le azioni compiute dagli amministratori" + "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", ), 'es' => array ( @@ -596,6 +597,10 @@ class MyStrings 'webcams' => array( 'element' => 'webcam', ), + + 'bluetooth' => array( + 'element' => 'bluetooth', + ), ), 'fr' => array( @@ -631,6 +636,10 @@ class MyStrings 'webcams' => array( 'element' => 'webcam', ), + + 'bluetooth' => array( + 'element' => 'bluetooth', + ), ), 'it' => array( @@ -666,6 +675,10 @@ class MyStrings 'webcams' => array( 'element' => 'webcam', ), + + 'bluetooth' => array( + 'element' => 'bluetooth', + ), ), 'es' => array( @@ -701,6 +714,10 @@ class MyStrings 'webcams' => array( 'element' => 'webcam', ), + + 'bluetooth' => array( + 'element' => 'bluetooth', + ), ), ); @@ -714,6 +731,7 @@ class MyStrings '3G-card' => 'threegcards', 'soundcard' => 'soundcards', 'webcam' => 'webcams', + 'bluetooth' => 'bluetooth', ); public static function getTypes() diff --git a/h-source/Application/Models/BluetoothModel.php b/h-source/Application/Models/BluetoothModel.php new file mode 100644 index 0000000..39445bf --- /dev/null +++ b/h-source/Application/Models/BluetoothModel.php @@ -0,0 +1,74 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class BluetoothModel extends GenericModel +{ + + public $type = 'bluetooth'; //device type + + public function __construct() + { + + $this->_popupItemNames = array( + 'vendor' => 'vendor', + 'comm_year' => 'comm_year', + 'bluetooth_works' => 'bluetooth_works', + 'interface' => 'interface', + ); + + $this->_popupLabels = array( + 'vendor' => gtext("vendor"), + 'comm_year' => gtext("year"), + 'bluetooth_works' => gtext("does it work?"), + 'interface' => gtext("interface"), + ); + + $this->_popupFunctions = array( + 'vendor' => 'betterVendor', + ); + + $this->_popupWhere = array( + 'vendor' => 'type="bluetooth" and deleted="no"', + 'comm_year' => 'type="bluetooth" and deleted="no"', + 'bluetooth_works' => 'type="bluetooth" and deleted="no"', + 'interface' => 'type="bluetooth" and deleted="no"', + ); + + $this->diffFields = array( + 'vendor' => gtext("vendor"), + 'model' => gtext('model name'), + 'pci_id' => gtext("VendorID:ProductID code of the device"), + 'comm_year' => gtext('year of commercialization'), + 'interface' => gtext("interface"), + 'distribution' => gtext('GNU/Linux distribution used for the test'), + 'kernel' => gtext('tested with the following kernel libre'), + 'bluetooth_works' => gtext("does it work with free software?"), + 'driver' => gtext("free driver used"), + 'description' => gtext('Description'), + ); + + $this->fieldsWithBreaks = array(gtext('Description')); + + parent::__construct(); + } + +} \ No newline at end of file diff --git a/h-source/Application/Views/Bluetooth/catalogue.php b/h-source/Application/Views/Bluetooth/catalogue.php new file mode 100644 index 0000000..0d5897d --- /dev/null +++ b/h-source/Application/Views/Bluetooth/catalogue.php @@ -0,0 +1,82 @@ + + +. +?> + +
+
+ +
+
+
viewArgs['vendor'])?>
+
viewArgs['comm_year']?>
+
viewArgs['bluetooth_works']?>
+
viewArgs['interface']?>
+
viewArgs['sort-by']?>
+
+
+ + + +
+ .. +
+ + + + +
+ +
+ : +
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
+
+
+ + + +
+ + + +
+ : +
+ \ No newline at end of file diff --git a/h-source/Application/Views/Bluetooth/form.php b/h-source/Application/Views/Bluetooth/form.php new file mode 100644 index 0000000..6de2ece --- /dev/null +++ b/h-source/Application/Views/Bluetooth/form.php @@ -0,0 +1,106 @@ + + +. +?> + + + + + +
+
controller."/".$this->action."/$lang/$token".$this->viewStatus;?>" method="POST"> + +
+ +
+ + + ">Vendor not present? +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + + + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + + +
+ * are mandatory");?> +
+ +
+ +
+
\ No newline at end of file diff --git a/h-source/Application/Views/Bluetooth/page.php b/h-source/Application/Views/Bluetooth/page.php new file mode 100644 index 0000000..87a0bf0 --- /dev/null +++ b/h-source/Application/Views/Bluetooth/page.php @@ -0,0 +1,94 @@ + + +. +?> + + + + action,'view') === 0) ? 'hardware' : 'revisions'; + ?> + + +
+ + + action,'revision') === 0) { ?> +
+ This is an old revision of this page, as edited by getUser($updated_by));?> at . It may differ significantly from the controller."/view/$lang/$id_hard/".$name.$this->viewStatus;?>">current revision. +
+ + +
+ : (: ) + action,'view') === 0) { ?> + ask for removal + +
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
+
+
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+ + + \ No newline at end of file diff --git a/h-source/Application/Views/Hardware/left.php b/h-source/Application/Views/Hardware/left.php index 133b581..fbd6585 100644 --- a/h-source/Application/Views/Hardware/left.php +++ b/h-source/Application/Views/Hardware/left.php @@ -57,5 +57,9 @@
Webcams
+ +
+ Bluetooth devices +
\ No newline at end of file diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php index 6f25cfa..48521b5 100644 --- a/h-source/Config/Route.php +++ b/h-source/Config/Route.php @@ -153,6 +153,15 @@ class Route 'wiki,pages', 'wiki,deleted', 'wiki,blocked', + 'bluetooth,catalogue', + 'bluetooth,view', + 'bluetooth,history', + 'bluetooth,revision', + 'bluetooth,insert', + 'bluetooth,update', + 'bluetooth,differences', + 'bluetooth,climb', + 'bluetooth,talk', ); //it can be 'yes' or 'no' diff --git a/h-source/Public/Img/H2O/preferences-system-bluetooth-22.png b/h-source/Public/Img/H2O/preferences-system-bluetooth-22.png new file mode 100755 index 0000000..c0b3f06 Binary files /dev/null and b/h-source/Public/Img/H2O/preferences-system-bluetooth-22.png differ diff --git a/h-source/Public/Img/H2O/preferences-system-bluetooth.png b/h-source/Public/Img/H2O/preferences-system-bluetooth.png new file mode 100755 index 0000000..f64ecb0 Binary files /dev/null and b/h-source/Public/Img/H2O/preferences-system-bluetooth.png differ diff --git a/h-source/tables.sql b/h-source/tables.sql index c04e4d3..e914867 100644 --- a/h-source/tables.sql +++ b/h-source/tables.sql @@ -95,7 +95,8 @@ create table hardware ( bios char(15) not null default 'not-specified', webcam_type varchar(100) CHARACTER SET utf8 not null, webcam_works varchar(30) CHARACTER SET utf8 not null default 'not-specified', - sound_card_works varchar(30) CHARACTER SET utf8 not null default 'not-specified' + sound_card_works varchar(30) CHARACTER SET utf8 not null default 'not-specified', + bluetooth_works varchar(30) CHARACTER SET utf8 not null default 'not-specified' )engine=innodb; create table revisions ( @@ -124,6 +125,7 @@ create table revisions ( webcam_type varchar(100) CHARACTER SET utf8 not null, webcam_works varchar(30) CHARACTER SET utf8 not null default 'not-specified', sound_card_works varchar(30) CHARACTER SET utf8 not null default 'not-specified', + bluetooth_works varchar(30) CHARACTER SET utf8 not null default 'not-specified', id_hard INT UNSIGNED NOT NULL )engine=innodb; -- cgit v1.2.3