Merge remote branch 'origin/xorg/maint' into xorg/master
[platal.git] / htdocs / javascript / jobtermstree.js
index f3a42eb..46266fc 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
  * @param clickFunc name of a javascript function that will be called when a
  * term is clicked. The three params of this function will be : treeid, the
  * id of the job term clicked, and the full name of the job term clicked.
+ * @param text_filter a string that is tokenized to filter jobtermss shown
+ * in the tree: only terms that contain all the tokens are shown with their
+ * parents.
  */
-function createJobTermsTree(domElement, platalpage, treeid, clickFunc)
+function createJobTermsTree(domElement, platalpage, treeid, clickFunc, text_filter)
 {
     $(domElement).jstree({
         "core" : {"strings":{"loading":"Chargement ..."}},
         "plugins" : ["themes","json_data"],
-        "themes" : { "url" : platal_baseurl + "css/jstree.css" },
+        "themes" : { "url" : $.plURL("css/jstree.css") },
         "json_data" : { "ajax" : {
-            "url" : platal_baseurl + platalpage,
+            "url" : $.plURL(platalpage),
             "data" : function(nod) {
                 var jtid = 0;
                 if (nod != -1) {
                     jtid = nod.attr("id").replace(/^.*_([0-9]+)$/, "$1");
                 }
-                return { "jtid" : jtid, "treeid" : treeid, "attrfunc" : clickFunc }
+                return { "jtid" : jtid, "treeid" : treeid, "attrfunc" : clickFunc, "text_filter": text_filter }
             }
         }} });
 }