From bd2f4275434bb99880e6659a1a528bd8eec380f4 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Thu, 23 Dec 2010 23:14:42 +0000 Subject: added sound cards - part 1 --- .../Controllers/SoundcardsController.php | 160 +++++++++++++++++++++ h-source/Application/Include/hardware.php | 43 +++++- h-source/Application/Include/languages.php | 20 ++- h-source/Application/Include/myFunctions.php | 26 ++++ h-source/Application/Models/BaseModel.php | 1 + h-source/Application/Models/SoundcardsModel.php | 74 ++++++++++ h-source/Application/Views/Hardware/left.php | 4 + .../Application/Views/Soundcards/catalogue.php | 82 +++++++++++ h-source/Application/Views/Soundcards/form.php | 106 ++++++++++++++ h-source/Application/Views/Soundcards/page.php | 94 ++++++++++++ 10 files changed, 608 insertions(+), 2 deletions(-) create mode 100644 h-source/Application/Controllers/SoundcardsController.php create mode 100644 h-source/Application/Models/SoundcardsModel.php create mode 100644 h-source/Application/Views/Soundcards/catalogue.php create mode 100644 h-source/Application/Views/Soundcards/form.php create mode 100644 h-source/Application/Views/Soundcards/page.php (limited to 'h-source/Application') diff --git a/h-source/Application/Controllers/SoundcardsController.php b/h-source/Application/Controllers/SoundcardsController.php new file mode 100644 index 0000000..9952afd --- /dev/null +++ b/h-source/Application/Controllers/SoundcardsController.php @@ -0,0 +1,160 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class SoundcardsController 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('SoundcardsModel'); + $this->model('TalkModel'); + + $this->mod = $this->m['SoundcardsModel']; + + $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user']; + $this->m['HardwareModel']->type = 'soundcard'; + + //hardware conditions + $this->m['HardwareModel']->strongConditions['update'] = array( + "checkIsStrings|".Soundcards::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|".Soundcards::$audioSelect => "sound_card_works", + "++++checkIsStrings|".Soundcards::$interface => "interface", + ); + + $this->m['HardwareModel']->strongConditions['insert'] = array( + "checkIsStrings|".Soundcards::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|".Soundcards::$audioSelect => "sound_card_works", + "++++checkIsStrings|".Soundcards::$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,sound_card_works,pci_id,interface,driver','sanitizeAll'); + + $argKeys = array( + 'page:forceNat' => 1, + 'history_page:forceNat' => 1, + 'vendor:sanitizeString' => 'undef', + 'comm_year:sanitizeString' => 'undef', + 'sound_card_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'], + 'sound_card_works' => $this->viewArgs['sound_card_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/Include/hardware.php b/h-source/Application/Include/hardware.php index 852cd62..e0919a9 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'); //used by UsersController::login() + public static $controllers = array('notebooks','wifi','videocards','printers','scanners','threegcards','soundcards'); //used by UsersController::login() public static $commYear = 'not-specified,2010,2009,2008,2007,2006,2005,2004,2003,2002,2001,2000,1999,1998,1997,1996,1995,1994,1993,1992'; @@ -286,6 +286,47 @@ class ThreeGcards extends Wifi public static $select = 'yes,no'; + public static function vendorsList() + { + return implode(',',array_values(self::$vendors)); + } +} + +class Soundcards extends Hardware +{ + public static $vendors = array( + "ALi Corporation" => "ALi-Corporation", + "Advanced Micro Devices (AMD)" => "Advanced-Micro-Devices", + "Analog Devices" => "Analog-Devices", + "ATI Technologies Inc" => "ATI-Technologies-Inc", + "Aureal Semiconductor" => "Aureal-Semiconductor", + "Avance Logic Inc (ALI)" => "Avance-Logic-Inc", + "Aztech System Ltd" => "Aztech-System-Ltd", + "Brooktree Corporation" => "Brooktree-Corporation", + "C-Media Electronics Inc" => "C-Media-Electronics-Inc", + "Cirrus Logic" => "Cirrus-Logic", + "Creative Labs" => "Creative-Labs", + "Ensoniq" => "Ensoniq", + "ESS Technology" => "ESS-Technology", + "ForteMedia Inc" => "ForteMedia-Inc", + "Intel Corporation" => "Intel-Corporation", + "Motorola" => "Motorola", + "National Semiconductor Corporation" => "National-Semiconductor-Corporation", + "Neomagic Corp" => "Neomagic-Corp", + "nVidia Corporation" => "nVidia-Corporation", + "RME" => "RME", + "S3 Inc" => "S3-Inc", + "Silicon Integrated Systems (SiS)" => "Silicon-Integrated-Systems", + "Trident Microsystems" => "Trident-Microsystems", + "VIA Technologies Inc" => "VIA-Technologies-Inc", + "Xilinx Corporation" => "Xilinx-Corporation", + "Yamaha Corporation" => "Yamaha-Corporation", + ); + + public static $audioSelect = 'yes,no'; + + public static $interface = "not-specified,PCI,ISA,USB,Firewire,Parallel,PCI-E,PCMCIA"; + 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 2d1514b..44c9020 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -139,6 +139,7 @@ class Lang "My description" => "La mia descrizione", "contributions" => "contributi", "contributions of" => "contributi di", + "No sound cards found" => "Non รจ stata trovata alcuna scheda audio", ), 'es' => array ( @@ -318,6 +319,10 @@ class MyStrings 'threegcards' => array( 'element' => '3G-card', ), + + 'soundcards' => array( + 'element' => 'sound card', + ), ), 'fr' => array( @@ -345,6 +350,10 @@ class MyStrings 'threegcards' => array( 'element' => '3G-card', ), + + 'soundcards' => array( + 'element' => 'sound card', + ), ), 'it' => array( @@ -372,6 +381,10 @@ class MyStrings 'threegcards' => array( 'element' => '3G-card', ), + + 'soundcards' => array( + 'element' => 'sound card', + ), ), 'es' => array( @@ -399,6 +412,10 @@ class MyStrings 'threegcards' => array( 'element' => '3G-card', ), + + 'soundcards' => array( + 'element' => 'sound card', + ), ), ); @@ -409,7 +426,8 @@ class MyStrings 'videocard' => 'videocards', 'printer' => 'printers', 'scanner' => 'scanners', - '3G-card' => 'threegcards' + '3G-card' => 'threegcards', + 'soundcard' => 'soundcards', ); public static function getTypes() diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index e182690..0aa5aca 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -318,6 +318,32 @@ function betterVendor($string) "Franklin-Wireless-Corporation" => "Franklin Wireless Corporation", "Novatel-Wireless" => "Novatel Wireless", "Sierra-Wireless" => "Sierra Wireless", + "ALi-Corporation" => "ALi Corporation", + "Advanced-Micro-Devices" => "Advanced Micro Devices (AMD)", + "Analog-Devices" => "Analog Devices", + "ATI-Technologies-Inc" => "ATI Technologies Inc", + "Aureal-Semiconductor" => "Aureal Semiconductor", + "Avance-Logic-Inc" => "Avance Logic Inc (ALI)", + "Aztech-System-Ltd" => "Aztech System Ltd", + "Brooktree-Corporation" => "Brooktree Corporation", + "C-Media-Electronics-Inc" => "C-Media Electronics Inc", + "Cirrus-Logic" => "Cirrus Logic", + "Creative-Labs" => "Creative Labs", + "Ensoniq" => "Ensoniq", + "ESS-Technology" => "ESS Technology", + "ForteMedia-Inc" => "ForteMedia Inc", + "Intel-Corporation" => "Intel Corporation", + "Motorola" => "Motorola", + "National-Semiconductor-Corporation" => "National Semiconductor Corporation", + "Neomagic-Corp" => "Neomagic Corp", + "nVidia-Corporation" => "nVidia Corporation", + "RME" => "RME", + "S3 Inc" => "S3-Inc", + "Silicon-Integrated-Systems" => "Silicon Integrated Systems (SiS)", + "Trident-Microsystems" => "Trident Microsystems", + "VIA-Technologies-Inc" => "VIA Technologies Inc", + "Xilinx-Corporation" => "Xilinx Corporation", + "Yamaha-Corporation" => "Yamaha Corporation", ); return (array_key_exists($string,$names)) ? $names[$string] : $string; diff --git a/h-source/Application/Models/BaseModel.php b/h-source/Application/Models/BaseModel.php index 5a06db4..ce613c5 100644 --- a/h-source/Application/Models/BaseModel.php +++ b/h-source/Application/Models/BaseModel.php @@ -24,6 +24,7 @@ class BaseModel extends Model_Tree { public $type = ''; //device type public $diffFields = array(); + public $fieldsWithBreaks = array(); public function __construct() { $this->_tables = 'hardware'; diff --git a/h-source/Application/Models/SoundcardsModel.php b/h-source/Application/Models/SoundcardsModel.php new file mode 100644 index 0000000..cea12be --- /dev/null +++ b/h-source/Application/Models/SoundcardsModel.php @@ -0,0 +1,74 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class SoundcardsModel extends BaseModel +{ + + public $type = 'soundcard'; //device type + + public function __construct() + { + + $this->_popupItemNames = array( + 'vendor' => 'vendor', + 'comm_year' => 'comm_year', + 'sound_card_works' => 'sound_card_works', + 'interface' => 'interface', + ); + + $this->_popupLabels = array( + 'vendor' => gtext("vendor"), + 'comm_year' => gtext("year"), + 'sound_card_works' => gtext("does it work?"), + 'interface' => gtext("interface"), + ); + + $this->_popupFunctions = array( + 'vendor' => 'betterVendor', + ); + + $this->_popupWhere = array( + 'vendor' => 'type="soundcard" and deleted="no"', + 'comm_year' => 'type="soundcard" and deleted="no"', + 'sound_card_works' => 'type="soundcard" and deleted="no"', + 'interface' => 'type="soundcard" 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'), + 'sound_card_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/Hardware/left.php b/h-source/Application/Views/Hardware/left.php index 020719c..084838a 100644 --- a/h-source/Application/Views/Hardware/left.php +++ b/h-source/Application/Views/Hardware/left.php @@ -50,4 +50,8 @@ 3G cards +
+ Sound cards +
+ \ No newline at end of file diff --git a/h-source/Application/Views/Soundcards/catalogue.php b/h-source/Application/Views/Soundcards/catalogue.php new file mode 100644 index 0000000..61875c6 --- /dev/null +++ b/h-source/Application/Views/Soundcards/catalogue.php @@ -0,0 +1,82 @@ + + +. +?> + +
+
+ +
+
+
viewArgs['vendor'])?>
+
viewArgs['comm_year']?>
+
viewArgs['sound_card_works']?>
+
viewArgs['interface']?>
+
viewArgs['sort-by']?>
+
+
+ + + +
+ .. +
+ + + + +
+ +
+ "> : +
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
+
+
+ + + +
+ + + +
+ : +
+ \ No newline at end of file diff --git a/h-source/Application/Views/Soundcards/form.php b/h-source/Application/Views/Soundcards/form.php new file mode 100644 index 0000000..ca57502 --- /dev/null +++ b/h-source/Application/Views/Soundcards/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/Soundcards/page.php b/h-source/Application/Views/Soundcards/page.php new file mode 100644 index 0000000..a0ec548 --- /dev/null +++ b/h-source/Application/Views/Soundcards/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 -- cgit v1.2.3