~fabiocbalbuquerque/sahana-agasti/web-services

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
$(document).ready(function() {
  var $dialog = $('<div id="modalContent"></div>')
    .dialog({
      autoOpen: false,
      resizable: false,
      width: 'auto',
      height: 'auto',
      draggable: false,
      modal: true
      });

  $('.modalTrigger').live('click', function() {
    $dialog.dialog("option", "title", $(this).attr('title'));
    $dialog.load($(this).attr('href'), function() {$dialog.dialog('open')});

    return false;
  });
});


$(document).ready(function() {
  $('.modalSubmit').live('click',function(){
    var ble = $(this).parent().attr('name') + ' :input';
    var blere = '#' + $(this).parent().attr('id') + ' :input';
    $.ajax({
     url: $(this).parent().attr('action'),
     type: "POST",
     data: $('#' + $(this).parent().attr('id') + ' :input'),
     complete:
       function(data) {
         var boo = data.responseText;
         $('#modalContent').append('<h2 class="overlay">Status Changed</h2>');
         $('.overlay').fadeIn(1200, function() {
           $('.overlay').fadeOut(1200, function() {
             $('.overlay').remove();
//             pattern = /event\/[a-zA-Z_0-9\+\%\-]*\/facilitygroups/;
             pattern = /event\/[a-zA-Z_0-9\+\%\-]*\/facilityresource\/[a-zA-Z_0-9\+\%\-]*/;
             var theer = pattern.exec(data.responseText);
             if(data.responseText == pattern.exec(data.responseText)) {
               var $fgroupDialog = $('<div id="#modalFgroup"></div>')
                 .dialog({
                   autoOpen: false,
                   resizable: false,
                   width: 'auto',
                   height: 'auto',
                   draggable: false,
                   modal: true
               });
               $fgroupDialog.dialog("option", "title", "yeah");
//               Get the name in there somehow.
               $.post('facilityresource/FF11EC', function(data) {
                 $fgroupDialog.html(data);
                 $fgroupDialog.dialog('open');
               });
             }
             $('#modalContent').load($(this).parent().attr('action'));
           })
         })
       }
    });

    return false;
  });
   $('#modalContent').bind('dialogclose', function() {
     $('#tableContainer').load(window.location.pathname + ' .singleTable');
   });
});