Do you want to delete this record?
\");
$( '#DEL_dialog_confirm' ).dialog({
resizable: false,
height:180,
modal: true,
close: function(ev, ui) { $(this).remove(); },
buttons: {
'Delete item': function() {
$.post('" . basename($_SERVER['SCRIPT_NAME']) . "', { mode: 'Delete', id: '" . $_REQUEST[id] . "' },
function(data) {
if(data==1){
$( this ).remove();
window.location='" . basename($_SERVER["SCRIPT_NAME"]) . LIB_removeGETinput(array("mode", "id")) . "';
}
});
},
Cancel: function() {
$( this ).dialog( 'close' );
}
}
});//end dialog
});// end Delete
";
}
function showSave($validateScript) {
echo "
$('#YCC_Update,#YCC_Save').click(function(){
" . $validateScript . "
var mode = $(this).attr('name').substr(4);// save or update button
var YCC_Msg = new Array();
YCC_Msg['Update'] = '" . $AdminSection . " Record Updated';
YCC_Msg['Save'] = '" . $AdminSection . " Record Added';
YCC_Msg['Duplicate'] = 'Record exsited, please re-enter!';
YCC_Msg['InvalidToken'] = 'Invalid Token!';
var form_data = $('#UT_InputForm').serialize()+'&mode='+ mode;
$.post('" . basename($_SERVER['SCRIPT_NAME']) . "', form_data,
function(json){
if (json.status == 1) { // Save Rec Success Result
$('#YCC_msg_hidden_area').append(\"\"+ YCC_Msg[mode] +\"
\");
$( '#UPDATE_dialog_message' ).dialog({
resizable: true,
modal: true,
close: function(ev, ui) { $(this).remove(); },";
if($updatedToLocal) {
echo "
buttons: {
Ok: function(){
$( this ).dialog( 'close' );
//location.reload();
}}";
} else {
echo "
buttons: {
'Back to list': function() {
$( this ).dialog( 'close' );
window.location='" . basename($_SERVER["SCRIPT_NAME"]) . LIB_removeGETinput(array("mode", "id")) . "';
},
'Continue': function() {
$( this ).dialog( 'close' );
window.location='" . basename($_SERVER["SCRIPT_NAME"]) . LIB_removeGETinput(array("mode", "id")) . "mode=View&id=' + json.id;
}
}";
}
echo "
});//end dialog
}
else if(json.status == -2) { // Update Rec Fail Result Duplicate Key
$('#YCC_msg_hidden_area').append(\" \" + json.duplicateLabel + YCC_Msg['Duplicate'] +\"
\");
$( '#DUPLICATE_dialog_message' ).dialog({
close: function(ev, ui) { $(this).remove(); },
modal: true, buttons: {
Ok: function(){
$( this ).dialog( 'close' );
$('#' + json.duplicateDBFiled).select();
}}
});
}//end -2
else if(json.status == 0) { // Save Rec Fail Result
$('#UPDATE_dialog_message').append(\" Can not insert sql=\" + json.sql +\"
\");
$( '#SQL_dialog_message' ).dialog({modal: true, buttons: {
Ok: function(){
$( this ).dialog( 'close' );
}}
});
}//end 0
else if(json.status == '-1') { // Session Key not the same
alert(YCC_Msg['InvalidToken']);
}else{
alert(json);
}
}, 'json')
.error(function() {
if (" . (DEBUG?1:0) . ") { // Post Failure Catch Error
alert('Post failure: " . $_SERVER['HTTP_REFERER'] . "' + form_data);
} else {
alert('Post failure: Please contact Unitech - +852-3720-1801' + form_data);
}
})
});// end update
";
}
?>