Subversion Repositories php-qbpwcf

Rev

Rev 226 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 226 Rev 232
Line 8430... Line 8430...
8430
		/*
8430
		/*
8431
		設置 window.qbpwcf.ajaxP 函數
8431
		設置 window.qbpwcf.ajaxP 函數
8432
		說明:
8432
		說明:
8433
		傳送ajax,指定傳送前要做什麼事情,然後回傳一個Promise.
8433
		傳送ajax,指定傳送前要做什麼事情,然後回傳一個Promise.
8434
		await完成後的回傳結果為一物件(res).
8434
		await完成後的回傳結果為一物件(res).
-
 
8435
		res.status,'true' means run smoothly;'false' means failed occur.
8435
		res.dom,content of html which can be directly access.
8436
		res.dom,content of html which can be directly access.
8436
		res.json,json string
8437
		res.json,json string
8437
		res.compliantJson,true代表合法的json;false代表不合法的.
8438
		res.compliantJson,true代表合法的json;false代表不合法的.
8438
		res.text,plain test
8439
		res.text,plain test
8439
		參數:
8440
		參數:
Line 8513... Line 8514...
8513
					// code for IE6, IE5
8514
					// code for IE6, IE5
8514
					var xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
8515
					var xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
8515
 
8516
 
8516
					}// else end
8517
					}// else end
8517
 
8518
 
8518
				//如果服務端有回傳完稱的狀態
8519
				//如果服務端有回傳完成的狀態
8519
				xmlhttp.onreadystatechange=function(){
8520
				xmlhttp.onreadystatechange=function(){
8520
 
8521
 
8521
					//debug
8522
					//debug
8522
					//console.log(xmlhttp);
8523
					//console.log(xmlhttp);
8523
 
8524
 
Line 8551... Line 8552...
8551
							try{
8552
							try{
8552
 
8553
 
8553
								//記錄json格式的內容
8554
								//記錄json格式的內容
8554
								res.json=JSON.parse(res.text);
8555
								res.json=JSON.parse(res.text);
8555
 
8556
 
8556
								}
8557
								}//try end
8557
 
8558
 
8558
							//抓取例外
8559
							//抓取例外
8559
							catch(exception){
8560
							catch(exception){
8560
 
8561
 
8561
								//記錄錯誤訊息
8562
								//記錄錯誤訊息
8562
								res.json=exception;
8563
								res.json=exception;
8563
 
8564
 
8564
								}
8565
								}//catch end
8565
 
8566
 
8566
							//設置回應內容為合規的json
8567
							//設置回應內容為合規的json
8567
							res.compliantJson=true;
8568
							res.compliantJson=true;
8568
 
8569
 
8569
							//如果json的回應有name屬性
8570
							//如果json的回應有name屬性
Line 8577... Line 8578...
8577
 
8578
 
8578
									}//if end
8579
									}//if end
8579
 
8580
 
8580
								}//if end
8581
								}//if end
8581
 
8582
 
-
 
8583
							//設置執行正常
-
 
8584
							res.status='true';
-
 
8585
 
8582
							//receive
8586
							//receive
8583
							resolve(res);
8587
							resolve(res);
8584
 
8588
 
8585
							}//if end
8589
							}//if end
8586
 
8590
 
Line 8640... Line 8644...
8640
					//如果data不為空物件
8644
					//如果data不為空物件
8641
					if(params.data.toString()!=='[object Object]'){
8645
					if(params.data.toString()!=='[object Object]'){
8642
 
8646
 
8643
						//傳送要求
8647
						//傳送要求
8644
						xmlhttp.send(params.data);
8648
						xmlhttp.send(params.data);
8645
 
8649
						
8646
						}//if end
8650
						}//if end
8647
 
8651
 
8648
					//反之data存在資料
8652
					//反之data存在資料
8649
					else{
8653
					else{
8650
						//傳送要求,POST為空
8654
						//傳送要求,POST為空
Line 8659... Line 8663...
8659
 
8663
 
8660
					//直接傳送要求
8664
					//直接傳送要求
8661
					xmlhttp.send();
8665
					xmlhttp.send();
8662
 
8666
 
8663
					}//else end
8667
					}//else end
-
 
8668
					
-
 
8669
				//其他不認得的 method
-
 
8670
				else{
-
 
8671
				
-
 
8672
					//初始化儲存結果的物件
-
 
8673
					var res={};
-
 
8674
				
-
 
8675
					//設置錯誤訊息
-
 
8676
					res.error='unknow method:'+params.method;
-
 
8677
					
-
 
8678
					//設置執行異常
-
 
8679
					res.status='false';
-
 
8680
					
-
 
8681
					//receive
-
 
8682
					resolve(res);
-
 
8683
				
-
 
8684
					}//else end
8664
 
8685
 
8665
				});//Promise end
8686
				});//Promise end
8666
 
8687
 
8667
			}//function window.qbpwcf.ajaxP end
8688
			}//function window.qbpwcf.ajaxP end
8668
		";
8689
		";
Line 16829... Line 16850...
16829
			#取得存在字形的根目錄
16850
			#取得存在字形的根目錄
16830
			$fontsPath=pathinfo(__FILE__)["dirname"]."/fonts/".$conf["fontPath"];
16851
			$fontsPath=pathinfo(__FILE__)["dirname"]."/fonts/".$conf["fontPath"];
16831
 
16852
 
16832
			}#else end
16853
			}#else end
16833
 
16854
 
-
 
16855
		#debug
-
 
16856
		#var_dump(__FILE__,__LINE__,$fontsPath);
-
 
16857
 
16834
		#取得font檔案內容
16858
		#取得font檔案內容
16835
		#函式說明:
16859
		#函式說明:
16836
		#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
16860
		#依據行號分隔抓取檔案的內容,結果會回傳一個陣列
16837
		#回傳的變數說明:
16861
		#回傳的變數說明:
16838
		#$result["status"],執行是否成功,"true"代表成功;"fasle"代表失敗.
16862
		#$result["status"],執行是否成功,"true"代表成功;"fasle"代表失敗.
Line 16881... Line 16905...
16881
			#回傳結果
16905
			#回傳結果
16882
			return $result;
16906
			return $result;
16883
 
16907
 
16884
			}#if end
16908
			}#if end
16885
 
16909
 
-
 
16910
		#debug
-
 
16911
		#var_dump(__FILE__,__LINE__,$getFileContent);
-
 
16912
 
16886
		#set custom font path
16913
		#set custom font path
16887
		$setFontPart=
16914
		$setFontPart=
16888
		"
16915
		"
16889
			//store font file in base64 encode string
16916
			//store font file in base64 encode string
16890
			window.qbpwcf.fonts.base64='".$getFileContent["base64dataOnly"]."';
16917
			window.qbpwcf.fonts.base64='".$getFileContent["base64dataOnly"]."';