From: Pascal Corpet Date: Sun, 15 Jun 2008 22:01:57 +0000 (+0200) Subject: networking: adds a filter number for ICQ, adds a gpg icon X-Git-Tag: xorg/1.0.0~332^2~564 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=92446a5367704d3859ae85f0618b4b26be9c4606;p=platal.git networking: adds a filter number for ICQ, adds a gpg icon --- diff --git a/htdocs/images/networking/gpg.png b/htdocs/images/networking/gpg.png new file mode 100644 index 0000000..97a6498 Binary files /dev/null and b/htdocs/images/networking/gpg.png differ diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 066eac6..5aa0f4b 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -112,12 +112,14 @@ class ProfileNetworking implements ProfileSetting private $email; private $pub; private $web; + private $number; public function __construct() { $this->email = new ProfileEmail(); $this->pub = new ProfilePub(); $this->web = new ProfileWeb(); + $this->number = new ProfileNumber(); } public function value(ProfilePage &$page, $field, $value, &$success) @@ -154,6 +156,8 @@ class ProfileNetworking implements ProfileSetting $network['address'] = $this->web->value($page, 'address', $network['address'], $s); } elseif ($filters[$network['type']] == 'email') { $network['address'] = $this->email->value($page, 'address', $network['address'], $s); + } elseif ($filters[$network['type']] == 'number') { + $network['address'] = $this->number->value($page, 'address', $network['address'], $s); } if (!$s) { $success = false; diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index 139178e..4b4df1d 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -79,6 +79,23 @@ class ProfileEmail extends ProfileNoSave } } +class ProfileNumber extends ProfileNoSave +{ + public function value(ProfilePage &$page, $field, $value, &$success) + { + if (is_null($value)) { + return isset($page->values[$field]) ? $page->values[$field] : S::v($field); + } + $value = trim($value); + $success = empty($value) || is_numeric($value); + if (!$success) { + global $page; + $page->trigError('Numéro invalide'); + } + return $value; + } +} + class ProfileTel extends ProfileNoSave { diff --git a/upgrade/fusionax-0.0.1/02_networking.sql b/upgrade/fusionax-0.0.1/02_networking.sql index 0da8e66..a266038 100644 --- a/upgrade/fusionax-0.0.1/02_networking.sql +++ b/upgrade/fusionax-0.0.1/02_networking.sql @@ -2,7 +2,7 @@ CREATE TABLE IF NOT EXISTS `profile_networking_enum` ( `network_type` tinyint unsigned NOT NULL, `name` varchar(30) NOT NULL, `icon` varchar(50) NOT NULL COMMENT 'icon filename', - `filter` enum('email','web','none') NOT NULL DEFAULT 'none' COMMENT 'filter type for addresses', + `filter` enum('email','web','number','none') NOT NULL DEFAULT 'none' COMMENT 'filter type for addresses', PRIMARY KEY (`network_type`) ) CHARSET=utf8 COMMENT='types of networking addresses';