/*  */
function mode_cancel_detail(path, sval, mode, dform, ERI, SERI, rpstr, ldiv, mtype, stype, mutp) {
	// 20140926: 更新作業項狀態 
	if (stype == '1' || (ERI == '' && SERI == '')) loading_create('Y');
	$('#WEB_CURR_EDIT').val(0);$('#WEB_FOCS_NAME').val('');
	var djson = (fromid_output_json(dform,'name')).replace(/'/g, "''"),mdir = '',perm = '';
	var url = path+'core/cw5e_engine_detail.php?sid='+sval+'&parent='+EncodeURLutf8(path)+'&mode='+mode+'&act=cancel&verlen='+(djson.length).toString();
	var nmary = ['exec','qwe','sor','itms'];
	rpstr = rpstr.split(',');
	for (var i = 0; i < nmary.length; i++) {
		if ((rpstr[i]) && $('#'+rpstr[i]+mtype).length > 0) {
			if (perm != '') perm += '&';
			perm += nmary[i]+'='+EncodeURLutf8($('#'+rpstr[i]+mtype).val());
		}
	}
	$.ajax({
		url: url,
		type: 'POST',
		data: perm+'&htmljson='+EncodeURLutf8(djson),
		beforeSend: function(){
			// 開始前執行 
		},
		success: function(msg){
			// 成功後執行 
			//console.log(msg);
			var ret_msg = JSON.parse(msg);
			if (ret_msg[0].result == 'false') {
				alert(ret_msg[0].message);
				loading_close('');
				return false;
			} else {
				if (stype == '1') { // act=setupview
					switch (mutp) {
						case 'R': mdir = 'manage'; break;
						case 'B':
						default: mdir = 'modules'; break;
					}
					if (ERI.length > 0) {
						// 頁面刷新 (view)
						post_redirect(ldiv, perm, path+mdir+'/'+mode+'/detail.php?sid='+sval+'&parent='+EncodeURLutf8(path)+'&mode='+mode+'&mutp='+mutp+'&act=view&ERI='+ERI);
					} else {
						// 頁面刷新 (setupview)
						post_redirect(ldiv, perm, path+mdir+'/'+mode+'/detail.php?sid='+sval+'&parent='+EncodeURLutf8(path)+'&mode='+mode+'&mutp='+mutp+'&act=setupview&ERI=');
					}
				} else {
					if (ERI.length > 0 || SERI.length > 0) {
						// 頁面刷新 (view)
						var rnum = (ret_msg[0].rnum) ? (ret_msg[0].rnum).toString() : '0';
						eval('if (typeof get_detail_'+mtype+' == "function") get_detail_'+mtype+'(\'view\',\''+((ERI == '') ? SERI : ERI)+'\',\''+rnum+'\');');
					} else {
						// 回列表頁 (result)
						$('#colapi_search_'+mtype).collapsible('enable');
						eval('if (typeof search_submit_'+mtype+' == "function") search_submit_'+mtype+'();');
					}
				}
			}
		},
		error: function(msg){
			// 失敗後執行 
			alert(msg);
			console.log(msg);
			loading_close('');
		},
		complete: function(msg){
			// 完成後執行 
			// console.log(msg);
		}
	});
}