From 4641de870cfa9c5d4c41a94328a8fb1f4adfdc78 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 24 Oct 2010 19:30:13 +0000 Subject: added 3G cards --- .../Application/Controllers/DownloadController.php | 20 ++- .../Application/Controllers/GenericController.php | 2 +- .../Application/Controllers/SearchController.php | 4 +- .../Controllers/ThreegcardsController.php | 154 +++++++++++++++++++++ h-source/Application/Include/hardware.php | 29 +++- h-source/Application/Include/languages.php | 60 +++----- h-source/Application/Include/myFunctions.php | 15 +- h-source/Application/Models/ThreegcardsModel.php | 71 ++++++++++ h-source/Application/Views/Download/index.php | 4 + h-source/Application/Views/Download/index_es.php | 4 + h-source/Application/Views/Download/index_fr.php | 72 ++++++++++ h-source/Application/Views/Download/index_it.php | 4 + h-source/Application/Views/Hardware/left.php | 4 + .../Application/Views/Threegcards/catalogue.php | 80 +++++++++++ h-source/Application/Views/Threegcards/form.php | 100 +++++++++++++ h-source/Application/Views/Threegcards/page.php | 87 ++++++++++++ 16 files changed, 664 insertions(+), 46 deletions(-) create mode 100644 h-source/Application/Controllers/ThreegcardsController.php create mode 100644 h-source/Application/Models/ThreegcardsModel.php create mode 100644 h-source/Application/Views/Download/index_fr.php create mode 100644 h-source/Application/Views/Threegcards/catalogue.php create mode 100644 h-source/Application/Views/Threegcards/form.php create mode 100644 h-source/Application/Views/Threegcards/page.php (limited to 'h-source/Application') diff --git a/h-source/Application/Controllers/DownloadController.php b/h-source/Application/Controllers/DownloadController.php index 4952456..d37cf36 100644 --- a/h-source/Application/Controllers/DownloadController.php +++ b/h-source/Application/Controllers/DownloadController.php @@ -93,11 +93,16 @@ class DownloadController extends BaseController $xml .= "\t\t".$row['hardware']['video_card_type']."\n"; } - if ($type === 'notebook' or $type === 'wifi') + if ($type === 'notebook') { $xml .= "\t\t".$row['hardware']['wifi_works']."\n"; } + if ($type === '3G-card' or $type === 'wifi') + { + $xml .= "\t\t".$row['hardware']['wifi_works']."\n"; + } + if ($type === 'notebook' or $type === 'videocard') { $xml .= "\t\t".$row['hardware']['video_card_works']."\n"; @@ -196,4 +201,17 @@ class DownloadController extends BaseController $this->clean(); $this->load('xml'); } + + public function threegcards($lang = 'en') + { + header ("Content-Type:text/xml"); + + $res = $this->m['HardwareModel']->clear()->select()->where(array('type'=>'3G-card','-deleted'=>'no'))->orderBy("type,hardware.id_hard")->send(); + + $data['xml'] = $this->getXml($res); + + $this->append($data); + $this->clean(); + $this->load('xml'); + } } \ No newline at end of file diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php index 1b9e64a..de2a470 100644 --- a/h-source/Application/Controllers/GenericController.php +++ b/h-source/Application/Controllers/GenericController.php @@ -352,7 +352,7 @@ class GenericController extends BaseController $data['name'] = null; $data['tree'] = null; $data['isDeleted'] = 'no'; - + if ($this->mod->checkType($clean['id_hard'])) { $this->mod->setWhereQueryClause(array("id_hard" => $clean['id_hard'])); diff --git a/h-source/Application/Controllers/SearchController.php b/h-source/Application/Controllers/SearchController.php index 2d8a1a8..fe7a5bd 100644 --- a/h-source/Application/Controllers/SearchController.php +++ b/h-source/Application/Controllers/SearchController.php @@ -47,7 +47,7 @@ class SearchController extends BaseController $argKeys = array( 'page:forceNat' => 1, 'action:sanitizeAlphanum' => 'search', - 'type:sanitizeAlphanum' => 'notebook', + 'type:sanitizeString' => 'notebook', 'model:sanitizeString' => 'undef', ); @@ -65,6 +65,8 @@ class SearchController extends BaseController '-deleted' => "no", ); +// echo $this->viewArgs['type']; + $recordNumber = $this->m['HardwareModel']->clear()->where($whereClause)->orderBy("id_hard desc")->rowNumber(); $data['recordNumber'] = $recordNumber; diff --git a/h-source/Application/Controllers/ThreegcardsController.php b/h-source/Application/Controllers/ThreegcardsController.php new file mode 100644 index 0000000..7d76023 --- /dev/null +++ b/h-source/Application/Controllers/ThreegcardsController.php @@ -0,0 +1,154 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class ThreegcardsController 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('ThreegcardsModel'); + $this->model('TalkModel'); + + $this->mod = $this->m['ThreegcardsModel']; + + $this->m['HardwareModel']->id_user = $this->s['registered']->status['id_user']; + $this->m['HardwareModel']->type = '3G-card'; + + //hardware conditions + $this->m['HardwareModel']->strongConditions['update'] = array( + "checkIsStrings|".ThreeGcards::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|".ThreeGcards::$commYear => "comm_year", + "+++checkIsStrings|".ThreeGcards::$select => "wifi_works", + "++++checkIsStrings|".ThreeGcards::$interface => "interface", + ); + + $this->m['HardwareModel']->strongConditions['insert'] = array( + "checkIsStrings|".ThreeGcards::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|".ThreeGcards::$commYear => "comm_year", + "+++checkIsStrings|".ThreeGcards::$select => "wifi_works", + "++++checkIsStrings|".ThreeGcards::$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", + "+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}", + ); + + $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", + "+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}", + ); + + $this->m['HardwareModel']->setFields('vendor,model,kernel,description,distribution,comm_year,wifi_works,pci_id,interface','sanitizeAll'); + + $argKeys = array( + 'page:forceNat' => 1, + 'history_page:forceNat' => 1, + 'vendor:sanitizeString' => 'undef', + 'comm_year:sanitizeString' => 'undef', + 'wifi_works:sanitizeString' => 'undef', + 'interface:sanitizeString' => 'undef', + 'sort-by:sanitizeString' => 'undef' + ); + + $this->setArgKeys($argKeys); + + $data['title'] = '3G card'; + $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'], + 'wifi_works' => $this->viewArgs['wifi_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 67df1f6..828585f 100644 --- a/h-source/Application/Include/hardware.php +++ b/h-source/Application/Include/hardware.php @@ -22,7 +22,7 @@ if (!defined('EG')) die('Direct access not allowed!'); class Hardware { - public static $controllers = array('notebooks','wifi','videocards','printers','scanners'); //used by UsersController::login() + public static $controllers = array('notebooks','wifi','videocards','printers','scanners','threegcards'); //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'; @@ -216,4 +216,31 @@ class Notebooks extends Hardware return implode(',',array_values(self::$compatibility)); } +} + +class ThreeGcards extends hardware +{ + public static $vendors = array( + "AT&T" => "AT-T", + "BandRich" => "BandRich", + "Franklin Wireless Corporation" => "Franklin-Wireless-Corporation", + "Huawei" => "Huawei", + "Novatel Wireless" => "Novatel-Wireless", + "Option" => "Option", + "Sierra Wireless" => "Sierra-Wireless", + "T-Mobile" => "T-Mobile", + "UTStarcom" => "UTStarcom", + "verizon" => "verizon", + "Vodafone" => "Vodafone", + "ZTE" => "ZTE", + ); + + public static $interface = "not-specified,USB,PCI,PCI-E,mini-PCI,mini-PCI-E,ExpressCard,PC-Card"; + + public static $select = 'yes,no'; + + public static function vendorsList() + { + return implode(',',array_values(self::$vendors)); + } } \ No newline at end of file diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 8351a88..e442c33 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -94,6 +94,8 @@ class Lang "No wifi cards found" => "Non è stata trovata alcuna scheda wifi", "does it work with free software?" => "funziona con il software libero?", "differences in the entry" => "differenze nel campo", + "No 3G cards found" => "Non è stata trovata alcuna scheda 3G", + "Please specify in the below description entry the Internet Service Provider (ISP) and the country where the service is provided" => "Per favore specifica nel sottostante campo descrizione l'Internet Service Provider (ISP) e il Paese dove il servizio viene fornito", ), 'es' => array ( @@ -173,134 +175,109 @@ class MyStrings public static $view = array( 'en' => array( - 'notebooks' => array( - 'element' => 'notebook' - ), 'wifi' => array( - 'element' => 'wifi card' - ), 'videocards'=> array( - 'element' => 'video card' - ), 'printers'=> array( - 'element' => 'printer' - ), 'scanners'=> array( - 'element' => 'scanner' - + ), + + 'threegcards' => array( + 'element' => '3G-card', ), ), 'fr' => array( 'notebooks' => array( - 'element' => 'notebook' - ), 'wifi' => array( - 'element' => 'wifi card' - ), 'videocards'=> array( - 'element' => 'video card' - ), 'printers'=> array( - 'element' => 'printer' - ), 'scanners'=> array( - 'element' => 'scanner' - + ), + + 'threegcards' => array( + 'element' => '3G-card', ), ), 'it' => array( 'notebooks' => array( - 'element' => 'notebook' - ), 'wifi' => array( - 'element' => 'wifi card' - ), 'videocards'=> array( - 'element' => 'video card' - ), 'printers'=> array( - 'element' => 'printer' - ), 'scanners'=> array( - 'element' => 'scanner' - + ), + + 'threegcards' => array( + 'element' => '3G-card', ), ), 'es' => array( 'notebooks' => array( - 'element' => 'notebook' - ), 'wifi' => array( - 'element' => 'wifi card' - ), 'videocards'=> array( - 'element' => 'video card' - ), 'printers'=> array( - 'element' => 'printer' - ), 'scanners'=> array( - 'element' => 'scanner' - + ), + + 'threegcards' => array( + 'element' => '3G-card', ), ), ); @@ -312,6 +289,7 @@ class MyStrings 'videocard' => 'videocards', 'printer' => 'printers', 'scanner' => 'scanners', + '3G-card' => 'threegcards' ); public static function getTypes() diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index a5e3934..b72be6c 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -327,4 +327,17 @@ function gtext($string) return Lang::$i18n[Lang::$current][$string]; } return $string; -} \ No newline at end of file +} + +//rewrite the vendor name +function betterVendor($string) +{ + $names = array( + "AT-T" => "AT&T", + "Franklin-Wireless-Corporation" => "Franklin Wireless Corporation", + "Novatel-Wireless" => "Novatel Wireless", + "Sierra-Wireless" => "Sierra Wireless", + ); + + return (array_key_exists($string,$names)) ? $names[$string] : $string; +} diff --git a/h-source/Application/Models/ThreegcardsModel.php b/h-source/Application/Models/ThreegcardsModel.php new file mode 100644 index 0000000..764587d --- /dev/null +++ b/h-source/Application/Models/ThreegcardsModel.php @@ -0,0 +1,71 @@ +. + +if (!defined('EG')) die('Direct access not allowed!'); + +class ThreegcardsModel extends BaseModel +{ + + public $type = '3G-card'; //device type + + public function __construct() + { + + $this->_popupItemNames = array( + 'vendor' => 'vendor', + 'comm_year' => 'comm_year', + 'wifi_works' => 'wifi_works', + 'interface' => 'interface', + ); + + $this->_popupLabels = array( + 'vendor' => gtext("vendor"), + 'comm_year' => gtext("year"), + 'wifi_works' => gtext("does it work?"), + 'interface' => gtext("interface"), + ); + + $this->_popupFunctions = array( + 'vendor' => 'betterVendor', + ); + + $this->_popupWhere = array( + 'vendor' => 'type="3G-card" and deleted="no"', + 'comm_year' => 'type="3G-card" and deleted="no"', + 'wifi_works' => 'type="3G-card" and deleted="no"', + 'interface' => 'type="3G-card" 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'), + 'wifi_works' => gtext("does it work with free software?"), + 'description' => gtext('Description'), + ); + + $this->fieldsWithBreaks = array(gtext('Description')); + + parent::__construct(); + } + +} \ No newline at end of file diff --git a/h-source/Application/Views/Download/index.php b/h-source/Application/Views/Download/index.php index e296711..403d7ed 100644 --- a/h-source/Application/Views/Download/index.php +++ b/h-source/Application/Views/Download/index.php @@ -59,6 +59,10 @@ Download the xml file of all the scanners in the database "> + + Download the xml file of all the 3G cards in the database + "> + diff --git a/h-source/Application/Views/Download/index_es.php b/h-source/Application/Views/Download/index_es.php index b181b23..4d66a28 100644 --- a/h-source/Application/Views/Download/index_es.php +++ b/h-source/Application/Views/Download/index_es.php @@ -59,6 +59,10 @@ Download the xml file of all the scanners in the database "> + + Download the xml file of all the 3G cards in the database + "> + diff --git a/h-source/Application/Views/Download/index_fr.php b/h-source/Application/Views/Download/index_fr.php new file mode 100644 index 0000000..0db4c49 --- /dev/null +++ b/h-source/Application/Views/Download/index_fr.php @@ -0,0 +1,72 @@ + + +. +?> + +
+ +
+ ">Home » download +
+ +
+ +
+ Télécharger la base de donnée h-node au format XML: +
+ +
+ Vous pouvez télécharger toute la base de donnée de h-node dans un unique fichier xml afin de gérer son contenus avec des scripts (Par exemple un script python perl ou php) + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Télécharger toute la base de donnée au format XML">
Télécharger la base de donnée de notebooks au format XML">
Télécharger la base de donnée de cartes wifi au format XML">
Télécharger la base de donnée de cartes graphique au format XML">
Télécharger la base de donnée d’imprimantes au format XML">
Télécharger la base de donnée de scanners au format XML">
Download the xml file of all the 3G cards in the database">
+
+
+ +
+ +
diff --git a/h-source/Application/Views/Download/index_it.php b/h-source/Application/Views/Download/index_it.php index 16fb40a..1d34619 100644 --- a/h-source/Application/Views/Download/index_it.php +++ b/h-source/Application/Views/Download/index_it.php @@ -59,6 +59,10 @@ Scarica il file xml di tutti gli scanner del database "> + + Scarica il file xml di tutte le schede 3G cards del database + "> + diff --git a/h-source/Application/Views/Hardware/left.php b/h-source/Application/Views/Hardware/left.php index 974340d..3a6d8c2 100644 --- a/h-source/Application/Views/Hardware/left.php +++ b/h-source/Application/Views/Hardware/left.php @@ -44,4 +44,8 @@ Scanners +
+ 3G cards +
+ \ No newline at end of file diff --git a/h-source/Application/Views/Threegcards/catalogue.php b/h-source/Application/Views/Threegcards/catalogue.php new file mode 100644 index 0000000..765a36f --- /dev/null +++ b/h-source/Application/Views/Threegcards/catalogue.php @@ -0,0 +1,80 @@ + + +. +?> + +
+
+ +
+
+
viewArgs['vendor']);?>
+
viewArgs['comm_year']?>
+
viewArgs['wifi_works']?>
+
viewArgs['interface']?>
+
viewArgs['sort-by']?>
+
+
+ + + +
+ .. +
+ + + + +
+ +
+ "> : +
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
:
+
+
+ +
+
+
+
+ + + +
+ + + +
+ : +
+ \ No newline at end of file diff --git a/h-source/Application/Views/Threegcards/form.php b/h-source/Application/Views/Threegcards/form.php new file mode 100644 index 0000000..fdaf477 --- /dev/null +++ b/h-source/Application/Views/Threegcards/form.php @@ -0,0 +1,100 @@ + + +. +?> + + + + + +
+
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/Threegcards/page.php b/h-source/Application/Views/Threegcards/page.php new file mode 100644 index 0000000..bfc974f --- /dev/null +++ b/h-source/Application/Views/Threegcards/page.php @@ -0,0 +1,87 @@ + + +. +?> + + + + 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