function act(action, actionParams, c, callback, callbackParams) { if ( c != undefined && c != "" ) { ctrl.confirm(act,[action,actionParams,null,callback,callbackParams],c); return; } if ( action == "-1" ) return; $.post( "http://www.glicorisa.com.gr/action/"+action, actionParams, function (data) { //alert(data); if ( data != undefined ) { if ( data.success == 1 ) { var message; if ( data.success_message != undefined ) message = data.success_message; else message = "Η ενέργεια ολοκληρώθηκε επιτυχώς"; var timeout = 10; $.achtung({ timeout: timeout, message: message, className: 'ui-state-default', icon: 'ui-icon-check' }); } else { for ( var i in data.errors ) { var tmp = data.errors[i]; if ( tmp.message != undefined && tmp.message.length > 0 ) $.achtung({ timeout: 10, message: tmp.message, className: 'ui-state-error', icon: 'ui-icon-alert' }); } } if ( data.messages != undefined ) { for ( var i in data.messages ) { var tmp = data.messages[i]; if ( tmp.message != undefined && tmp.message.length > 0 ) $.achtung({ timeout: 10, message: tmp.message, className: 'ui-state-default', icon: 'ui-icon-bullet' }); } } if ( data.run != undefined && data.run != "" ) eval(data.run); } if ( callback != undefined ) { var p = {}; if ( callbackParams != undefined ) p = callbackParams; p.data = data; callback(p); } }, "json" ); } // vim:syntax=javascript