From: Florent Bruneau Date: Fri, 25 Feb 2011 18:35:34 +0000 (+0100) Subject: Upgrade jQuery to 1.5.1 X-Git-Tag: xorg/1.1.0~138 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=e6a2c4d5def68dda8e88816acbcdb1955dae1b56;p=platal.git Upgrade jQuery to 1.5.1 Signed-off-by: Florent Bruneau --- diff --git a/Makefile b/Makefile index e65111c..13b07fe 100644 --- a/Makefile +++ b/Makefile @@ -182,7 +182,7 @@ $(MEDAL_THUMBNAILS): $(subst /medals/thumb/,/medals/,$(@F)) ## ## jquery ## -JQUERY_VERSION=1.5 +JQUERY_VERSION=1.5.1 JQUERY_PLUGINS=color form JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS))) diff --git a/include/userset.inc.php b/include/userset.inc.php index bafddd3..e6e636e 100644 --- a/include/userset.inc.php +++ b/include/userset.inc.php @@ -355,5 +355,30 @@ class AddressesView implements PlView } } +class JSonView implements PlView +{ + private $set; + + public function __construct(PlSet $set, array $params) + { + $this->set = $set; + } + + public function apply(PlPage $page) + { + $export = array(); + $profiles = $this->set->get(new PlLimit()); + while ($profile = $profiles->next()) { + $export[] = $profile->export(); + } + $page->jsonAssign('profiles', $export); + } + + public function args() + { + return $this->set->args(); + } +} + // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?> diff --git a/modules/api.php b/modules/api.php index 1fa485f..5caedbf 100644 --- a/modules/api.php +++ b/modules/api.php @@ -26,13 +26,14 @@ class ApiModule extends PlModule return array( // TODO(vzanotti): Extend the plat/al engine to support placeholders // in handler urls, for instance "api/1/user/%forlife/isRegistered". - 'api/1/user' => $this->make_api_hook('user', AUTH_COOKIE, 'api_user_readonly'), + 'api/1/user' => $this->make_api_hook('user', AUTH_COOKIE, 'api_user_readonly'), + 'api/1/search' => $this->make_api_hook('search', AUTH_COOKIE), ); } // This handler supports the following URL patterns: // /api/1/user/{forlife}/isRegistered - function handler_user(PlPage& $page, PlUser& $authUser, $payload, $user = null, $selector = null) + function handler_user(PlPage $page, PlUser $authUser, $payload, $user = null, $selector = null) { // Retrieve the PlUser referenced in the request. Note that this is the // target user, not the authenticated user. @@ -48,6 +49,26 @@ class ApiModule extends PlModule return PL_NOT_FOUND; } } + + function handler_search(PlPage $page, PlUser $authUser, $payload, $mode = 'quick') + { + if (!isset($payload['quick'])) { + $page->trigError('Malformed search query'); + return PL_BAD_REQUEST; + } + Env::set('quick', $payload['quick']); + foreach (array('with_soundex', 'exact') as $key) { + if (isset($payload[$key])) { + Env::set($key, $payload[$key]); + } + } + + require_once 'userset.inc.php'; + $view = new QuickSearchSet(); + $view->addMod('json', 'JSon', true, array('with_score' => true, 'starts_with' => $byletter)); + $view->apply('api/1/search', $page, 'json'); + return PL_JSON; + } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/templates/events/index.tpl b/templates/events/index.tpl index 563f0d0..c151e9e 100644 --- a/templates/events/index.tpl +++ b/templates/events/index.tpl @@ -208,6 +208,19 @@ Bienvenue {$smarty.session.user->displayName()}{if t($birthday)}

+ Blah + + + {icon name=page_edit}  Proposer une information événementielle • Proposer un article pour la Lettre mensuelle