tripal_cv.js.orig 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. //
  2. // Copyright 2009 Clemson University
  3. //
  4. if (Drupal.jsEnabled) {
  5. $(document).ready(function() {
  6. });
  7. function init_tree(){
  8. $("#browser").treeview({
  9. toggle: function() {
  10. },
  11. url: "tripal_cv_update_browser",
  12. // add some additional, dynamic data and request with POST
  13. ajax: {
  14. data: {
  15. "additional": function() {
  16. return "yeah: " + new Date;
  17. }
  18. },
  19. type: "post"
  20. }
  21. });
  22. }
  23. //------------------------------------------------------------
  24. // Update the cv tree based on the user selection
  25. function tripal_cv_init_browser(options){
  26. // Get the cv_id from DOM
  27. var index = options.selectedIndex;
  28. var cv_id = options[index].value;
  29. $.ajax({
  30. url: '/tripal_cv_init_browser/' + cv_id ,
  31. dataType: 'json',
  32. type: 'POST',
  33. success: function(data){
  34. $("#cv_browser").html(data.update);
  35. init_tree();
  36. }
  37. });
  38. return false;
  39. }
  40. //------------------------------------------------------------
  41. // Update the cv tree based on the user selection
  42. function tripal_cv_cvterm_info(cvterm_id){
  43. // Get the cv_id from DOM
  44. $.ajax({
  45. url: '/tripal_cv_cvterm_info/' + cvterm_id ,
  46. dataType: 'json',
  47. type: 'POST',
  48. success: function(data){
  49. $("#cvterm_info").html(data.update);
  50. init_tree();
  51. }
  52. });
  53. return false;
  54. }
  55. }