AnonSec Team
Server IP : 127.0.0.1  /  Your IP : 127.0.0.1
Web Server : Apache/2.4.10 (Win32) OpenSSL/1.0.1i PHP/5.6.3
System : Windows NT WIN-R7LTCC7BPLI 6.3 build 9200 (Windows Server 2012 R2 Datacenter Edition) i586
User : GerbangSIPAD ( 0)
PHP Version : 5.6.3
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF
Directory (0777) :  C:/xampp5/htdocs/bhumie/assets/a693d473/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : C:/xampp5/htdocs/bhumie/assets/a693d473/eUpdateDialog.js
function updateDialog( url, act )
{
  var action = '';
  var form = $( '#update-dialog div.update-dialog-content form' );
  var csrfToken = null;
  if( jQuery.cookie )
    var csrfToken = '&YII_CSRF_TOKEN=' + $.cookie( 'YII_CSRF_TOKEN' );
  if( url == false )
  {
    action = '&action=' + act;
    url = form.attr( 'action' );
  }
  $.ajax({
    'url': url,
    'data': form.serialize() + action + csrfToken,
    'type': 'post',
    'dataType': 'json',
    'success': function( data ){
      if( data.status == 'failure' )
      {
        $( '#update-dialog div.update-dialog-content' ).html( data.content );
        $( '#update-dialog div.update-dialog-content form input[type=submit]' )
          .die() // Stop from re-binding event handlers
          .live( 'click', function( e ){ // Send clicked button value
            e.preventDefault();
            updateDialog( false, $( this ).attr( 'name' ) );
        });
      }
      else
      {
        $( '#update-dialog div.update-dialog-content' ).html( data.content );
        if( data.status == 'success' ) // Update all grid views on success
        {
          $( 'div.grid-view' ).each( function(){
            $.fn.yiiGridView.update( $( this ).attr( 'id' ) );
          });
        }
        setTimeout( "$( '#update-dialog' ).dialog( 'close' ).children( ':eq(0)' ).empty();", 1000 );
      }
    },
    'cache': false
  });
}

function updateDialogDelete( e ){
  e.preventDefault();
  updateDialogActionBase( $( this ).attr( 'href' ), 'Konfirmasi Hapus' );
}

function updateDialogUpdate( e ){
  e.preventDefault();
  updateDialogActionBase( $( this ).attr( 'href' ), 'Ubah' );
}
  
function updateDialogCreate( e ){
  e.preventDefault();
  updateDialogActionBase( $( this ).attr( 'href' ), 'Tambah' );
}

function updateDialogActionBase( url, dialogTitle )
{
  $( '#update-dialog' ).children( ':eq(0)' ).empty();
  updateDialog( url );
  $( '#update-dialog' )
    .dialog( { title: dialogTitle } )
    .dialog( 'open' );
}

jQuery( function($){
  $( 'a.update-dialog-create' ).bind( 'click', updateDialogCreate );
});

AnonSec - 2021