Fix login on X.net with only 'groups' perm.
[platal.git] / htdocs / javascript / search.js
index 52870ad..94dc9ab 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  Copyright (C) 2003-2011 Polytechnique.org                              *
+ *  Copyright (C) 2003-2014 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -86,8 +86,6 @@ function load_advanced_search(request)
         });
     });
 
-    $('#only_referent').change(function() { changeOnlyReferent(); });
-
     $('.delete_address_component').click(function() {
         var field_name = $(this).attr('href');
         var hide = false;
@@ -124,7 +122,10 @@ function display_list(field_name)
 // }}}
 // {{{ Regexps to wipe out from search queries
 
-var default_form_values = [ /&woman=0(&|$)/, /&subscriber=0(&|$)/, /&alive=0(&|$)/, /&egal[12]=[^&]*&promo[12]=(&|$)/g, /&networking_type=0(&|$)/, /&[^&=]+=(&|$)/g ];
+var default_form_values = [ /&woman=0(&|$)/, /&subscriber=0(&|$)/, /&alive=0(&|$)/, /&egal2=[^&]*&promo2=(&|$)/,
+                            /&egal1=[^&]*&promo1=&edu_type=(?:Ing[^n]+nieur|Master|Doctorat)(&|$)/, /&networking_type=0(&|$)/,
+                            /&origin_corps=0(&|$)/, /&current_corps=0(&|$)/,
+                            /corps_rank=0(&|$)/, /&has_email_redirect=0(&|$)/, /&[^&=]+=(&|$)/g ];
 
 /** Uses javascript to clean form from all empty fields */
 function cleanForm(f, targeturl)
@@ -140,7 +141,11 @@ function cleanForm(f, targeturl)
             } while (old_query != query);
         }
     }
-    query = query.replace(/^&*(.*)&*$/, '$1');
+    query = query.replace(/^(.*)&+$/, '$1');
+    query = query.replace(/^&+(.*)$/, '$1');
+
+    // Removes "(n camarades)" if any of them are remaining.
+    query = query.replace(/\+\(\d+\+camarade(?:s)?\)/, '');
     if (query == 'rechercher=Chercher') {
         alert("Aucun critère n'a été spécifié.");
         return false;
@@ -329,4 +334,4 @@ function addressesDump()
 }
 
 // }}}
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: