Advertisement
paulCodes

userTool.js

May 23rd, 2013
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.06 KB | None | 0 0
  1. $(function() {
  2.  
  3.     function loadSingleUser(userId, userType) {
  4.         var url = (userType == "fp") ? "/mona/focusPersonTool/getFocusPerson" : "/mona/user-tool/get-user";
  5.        
  6.         $.ajax({
  7.             datatype : "html",
  8.             type : "POST",
  9.             url : url,
  10.             data : "userId=" + userId
  11.         }).done(function(data) {
  12.             $("#userFormDiv").load("/mona/user-tool/user-form", function() {
  13.                 $('#userFormTabs').tabs();
  14.                 $('#userCredentials').multiSelect();
  15.                 $('button').button();              
  16.             });
  17.         }).fail(function(e) {
  18.             alert('Error: ' + e);
  19.         });
  20.     }
  21.  
  22.     // jsTree STuff
  23.     $(function() {
  24.         $("#userWidget").jstree({
  25.             "themes" : {
  26.                 "theme" : "classic",
  27.                 "dots" : false,
  28.                 "icons" : false
  29.             },
  30.             "xml_data" : {
  31.                 "ajax" : {
  32.                     "url" : "/mona/user-tool/get-users-XML"
  33.                 },
  34.                 "xsl" : "nest"
  35.             },
  36.             "plugins" : [ "themes", "xml_data", "ui" ]
  37.         }).bind(
  38.                 "select_node.jstree",
  39.                 function(event, data) {
  40.                     // `data.rslt.obj` is the jquery extended node that was
  41.                     loadSingleUser(data.rslt.obj.attr("id"), data.rslt.obj.attr("type"));
  42.                 });
  43.     });
  44.  
  45. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement