Subversion Repositories php-qbpwcf

Rev

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

Rev 176 Rev 226
Line 1... Line 1...
1
<?php
1
<?php
2
 
2
 
3
/*
3
/*
4
 
4
 
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
5
	QBPWCF, Quick Build PHP website Component base on Fedora Linux.
6
    Copyright (C) 2015~2024 Min-Jhin,Chen
6
    Copyright (C) 2014~2025 MIN ZHI, CHEN
7
 
7
 
8
    This file is part of QBPWCF.
8
    This file is part of QBPWCF.
9
 
9
 
10
    QBPWCF is free software: you can redistribute it and/or modify
10
    QBPWCF is free software: you can redistribute it and/or modify
11
    it under the terms of the GNU General Public License as published by
11
    it under the terms of the GNU General Public License as published by
Line 1375... Line 1375...
1375
				#將每個透過 POST 方式吃傳送過來的變數,轉存到變數裏面。
1375
				#將每個透過 POST 方式吃傳送過來的變數,轉存到變數裏面。
1376
				foreach($_POST as $elementKey => $elementValue){
1376
				foreach($_POST as $elementKey => $elementValue){
1377
 
1377
 
1378
					#如果 $conf["correctCharacter"]爲 "true"
1378
					#如果 $conf["correctCharacter"]爲 "true"
1379
					if($conf["correctCharacter"]==="true"){
1379
					if($conf["correctCharacter"]==="true"){
1380
			
1380
 
1381
						#檢查是否邀接收的變數名稱是否為要忽略的清單裡面
1381
						#檢查是否邀接收的變數名稱是否為要忽略的清單裡面
1382
						#回傳結果:
1382
						#回傳結果:
1383
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1383
						#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
1384
						#$result["function"],當前執行的函數
1384
						#$result["function"],當前執行的函數
1385
						#$result["error"],函式錯誤訊息,若爲""則表示沒有錯誤
1385
						#$result["error"],函式錯誤訊息,若爲""則表示沒有錯誤
Line 1408... Line 1408...
1408
						if($result_checkEquality["founded"][0]=="true"){
1408
						if($result_checkEquality["founded"][0]=="true"){
1409
 
1409
 
1410
							#略過這個變數的處理
1410
							#略過這個變數的處理
1411
							continue;
1411
							continue;
1412
 
1412
 
1413
							}#if end						
1413
							}#if end
1414
			
1414
 
1415
						#處理字串避免網頁出錯
1415
						#處理字串避免網頁出錯
1416
						#函式說明:
1416
						#函式說明:
1417
						#處理字串避免網頁出錯
1417
						#處理字串避免網頁出錯
1418
						#回傳結果:
1418
						#回傳結果:
1419
						#$result,爲處理好的字串。
1419
						#$result,爲處理好的字串。
Line 4599... Line 4599...
4599
 
4599
 
4600
			#套用css設定
4600
			#套用css設定
4601
			$conf["class"]=" class = \"".$conf["class"]."\"";
4601
			$conf["class"]=" class = \"".$conf["class"]."\"";
4602
 
4602
 
4603
			}#if end
4603
			}#if end
4604
		
4604
 
4605
		#反之
4605
		#反之
4606
		else{
4606
		else{
4607
			#設置為空字串
4607
			#設置為空字串
4608
			$conf["class"]="";
4608
			$conf["class"]="";
4609
			
4609
 
4610
			}#else end
4610
			}#else end
4611
			
4611
 
4612
		#如果有 $conf["classList"]
4612
		#如果有 $conf["classList"]
4613
		if(isset($conf["classList"])){
4613
		if(isset($conf["classList"])){
4614
		
4614
 
4615
			#傳接 class 開始
4615
			#傳接 class 開始
4616
			$conf["class"]=" class = \"";
4616
			$conf["class"]=" class = \"";
4617
			
4617
 
4618
			#針對 $conf["classList"] 的每個元素
4618
			#針對 $conf["classList"] 的每個元素
4619
			foreach($conf["classList"] as $index => $cssClassName){
4619
			foreach($conf["classList"] as $index => $cssClassName){
4620
			
4620
 
4621
				#串接 class 名稱
4621
				#串接 class 名稱
4622
				$conf["class"]=$conf["class"].$cssClassName;
4622
				$conf["class"]=$conf["class"].$cssClassName;
4623
			
4623
 
4624
				#若後面還有未串接的 class 名稱
4624
				#若後面還有未串接的 class 名稱
4625
				if(isset($conf["classList"][$index+1])){
4625
				if(isset($conf["classList"][$index+1])){
4626
				
4626
 
4627
					#串接空格
4627
					#串接空格
4628
					$conf["class"]=$conf["class"]." ";
4628
					$conf["class"]=$conf["class"]." ";
4629
				
4629
 
4630
					}#if end
4630
					}#if end
4631
			
4631
 
4632
				}#foreach end
4632
				}#foreach end
4633
			
4633
 
4634
			#串接 class 結束
4634
			#串接 class 結束
4635
			$conf["class"]=$conf["class"]."\"";
4635
			$conf["class"]=$conf["class"]."\"";
4636
		
4636
 
4637
			}#if end
4637
			}#if end
4638
 
4638
 
4639
		#如果 $conf["jsActivitor"] 與 $conf["jsAction"] 皆有設定
4639
		#如果 $conf["jsActivitor"] 與 $conf["jsAction"] 皆有設定
4640
		if( isset($conf["jsActivitor"]) && isset($conf["jsAction"]) ){
4640
		if( isset($conf["jsActivitor"]) && isset($conf["jsAction"]) ){
4641
 
4641
 
Line 4735... Line 4735...
4735
 
4735
 
4736
			}#else end
4736
			}#else end
4737
 
4737
 
4738
		#如果有設置 $conf["dataFormId"]
4738
		#如果有設置 $conf["dataFormId"]
4739
		if(isset($conf["dataFormId"])){
4739
		if(isset($conf["dataFormId"])){
4740
		
4740
 
4741
			#設置 data-id 屬性
4741
			#設置 data-id 屬性
4742
			$conf["dataFormId"]="data-form-id=\"".$conf["dataFormId"]."\"";
4742
			$conf["dataFormId"]="data-form-id=\"".$conf["dataFormId"]."\"";
4743
		
4743
 
4744
			}#if end
4744
			}#if end
4745
		
4745
 
4746
		#反之設置為空數值	
4746
		#反之設置為空數值
4747
		else{
4747
		else{
4748
		
4748
 
4749
			$conf["dataFormId"]="";
4749
			$conf["dataFormId"]="";
4750
		
4750
 
4751
			}#else end	
4751
			}#else end
4752
 
4752
 
4753
		#如果要 autocomplete
4753
		#如果要 autocomplete
4754
		if($conf["autocomplete"]==="on"){
4754
		if($conf["autocomplete"]==="on"){
4755
		
4755
 
4756
			#設置為 "autocomplete"
4756
			#設置為 "autocomplete"
4757
			$conf["autocomplete"]="autocomplete";
4757
			$conf["autocomplete"]="autocomplete";
4758
		
4758
 
4759
			}#if end
4759
			}#if end
4760
		
4760
 
4761
		#反之
4761
		#反之
4762
		else{
4762
		else{
4763
		
4763
 
4764
			#設置為空字串
4764
			#設置為空字串
4765
			$conf["autocomplete"]="";
4765
			$conf["autocomplete"]="";
4766
		
4766
 
4767
			}#else end
4767
			}#else end
4768
 
4768
 
4769
		#放置可以輸入文字的表單
4769
		#放置可以輸入文字的表單
4770
		$result["content"]=$result["content"]."<input ".$conf["id"]." type = \"text\" ".$conf["width"]." ".$conf["maxInputLength"]." name = ".$conf["name"]." id = ".$conf["name"]." ".$conf["value"]." ".$conf["readOnly"]." ".$conf["autoFocus"]." ".$conf["class"]." ".$conf["jsCustom"]." ".$conf["placeholder"]." ".$conf["autocomplete"]." ".$conf["required"]." ".$conf["dataFormId"]." >";
4770
		$result["content"]=$result["content"]."<input ".$conf["id"]." type = \"text\" ".$conf["width"]." ".$conf["maxInputLength"]." name = ".$conf["name"]." id = ".$conf["name"]." ".$conf["value"]." ".$conf["readOnly"]." ".$conf["autoFocus"]." ".$conf["class"]." ".$conf["jsCustom"]." ".$conf["placeholder"]." ".$conf["autocomplete"]." ".$conf["required"]." ".$conf["dataFormId"]." >";
4771
 
4771
 
Line 4824... Line 4824...
4824
 
4824
 
4825
		#回傳結果
4825
		#回傳結果
4826
		return $result;
4826
		return $result;
4827
 
4827
 
4828
		}#function inputText end
4828
		}#function inputText end
4829
	
4829
 
4830
	/*
4830
	/*
4831
	#函式說明:
4831
	#函式說明:
4832
	#可以輸入Email的輸入方框
4832
	#可以輸入Email的輸入方框
4833
	#回傳結果:
4833
	#回傳結果:
4834
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
4834
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 4903... Line 4903...
4903
	#https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/email
4903
	#https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/email
4904
	#備註:
4904
	#備註:
4905
	#無.
4905
	#無.
4906
	*/
4906
	*/
4907
	public static function inputEmail(&$conf){
4907
	public static function inputEmail(&$conf){
4908
	
4908
 
4909
		#初始化要回傳的內容
4909
		#初始化要回傳的內容
4910
		$result=array();
4910
		$result=array();
4911
 
4911
 
4912
		#設置當前執行的函數
4912
		#設置當前執行的函數
4913
		$result["function"]=__FUNCTION__;
4913
		$result["function"]=__FUNCTION__;
Line 5286... Line 5286...
5286
 
5286
 
5287
			#套用css設定
5287
			#套用css設定
5288
			$conf["class"]=" class = \"".$conf["class"]."\"";
5288
			$conf["class"]=" class = \"".$conf["class"]."\"";
5289
 
5289
 
5290
			}#if end
5290
			}#if end
5291
		
5291
 
5292
		#反之
5292
		#反之
5293
		else{
5293
		else{
5294
			#設置為空字串
5294
			#設置為空字串
5295
			$conf["class"]="";
5295
			$conf["class"]="";
5296
			
5296
 
5297
			}#else end
5297
			}#else end
5298
			
5298
 
5299
		#如果有 $conf["classList"]
5299
		#如果有 $conf["classList"]
5300
		if(isset($conf["classList"])){
5300
		if(isset($conf["classList"])){
5301
		
5301
 
5302
			#傳接 class 開始
5302
			#傳接 class 開始
5303
			$conf["class"]=" class = \"";
5303
			$conf["class"]=" class = \"";
5304
			
5304
 
5305
			#針對 $conf["classList"] 的每個元素
5305
			#針對 $conf["classList"] 的每個元素
5306
			foreach($conf["classList"] as $index => $cssClassName){
5306
			foreach($conf["classList"] as $index => $cssClassName){
5307
			
5307
 
5308
				#串接 class 名稱
5308
				#串接 class 名稱
5309
				$conf["class"]=$conf["class"].$cssClassName;
5309
				$conf["class"]=$conf["class"].$cssClassName;
5310
			
5310
 
5311
				#若後面還有未串接的 class 名稱
5311
				#若後面還有未串接的 class 名稱
5312
				if(isset($conf["classList"][$index+1])){
5312
				if(isset($conf["classList"][$index+1])){
5313
				
5313
 
5314
					#串接空格
5314
					#串接空格
5315
					$conf["class"]=$conf["class"]." ";
5315
					$conf["class"]=$conf["class"]." ";
5316
				
5316
 
5317
					}#if end
5317
					}#if end
5318
			
5318
 
5319
				}#foreach end
5319
				}#foreach end
5320
			
5320
 
5321
			#串接 class 結束
5321
			#串接 class 結束
5322
			$conf["class"]=$conf["class"]."\"";
5322
			$conf["class"]=$conf["class"]."\"";
5323
		
5323
 
5324
			}#if end
5324
			}#if end
5325
 
5325
 
5326
		#如果 $conf["jsActivitor"] 與 $conf["jsAction"] 皆有設定
5326
		#如果 $conf["jsActivitor"] 與 $conf["jsAction"] 皆有設定
5327
		if( isset($conf["jsActivitor"]) && isset($conf["jsAction"]) ){
5327
		if( isset($conf["jsActivitor"]) && isset($conf["jsAction"]) ){
5328
 
5328
 
Line 5422... Line 5422...
5422
 
5422
 
5423
			}#else end
5423
			}#else end
5424
 
5424
 
5425
		#如果有設置 $conf["dataFormId"]
5425
		#如果有設置 $conf["dataFormId"]
5426
		if(isset($conf["dataFormId"])){
5426
		if(isset($conf["dataFormId"])){
5427
		
5427
 
5428
			#設置 data-id 屬性
5428
			#設置 data-id 屬性
5429
			$conf["dataFormId"]="data-form-id=\"".$conf["dataFormId"]."\"";
5429
			$conf["dataFormId"]="data-form-id=\"".$conf["dataFormId"]."\"";
5430
		
5430
 
5431
			}#if end
5431
			}#if end
5432
		
5432
 
5433
		#反之設置為空數值	
5433
		#反之設置為空數值
5434
		else{
5434
		else{
5435
		
5435
 
5436
			$conf["dataFormId"]="";
5436
			$conf["dataFormId"]="";
5437
		
5437
 
5438
			}#else end	
5438
			}#else end
5439
 
5439
 
5440
		#如果要 autocomplete
5440
		#如果要 autocomplete
5441
		if($conf["autocomplete"]==="on"){
5441
		if($conf["autocomplete"]==="on"){
5442
		
5442
 
5443
			#設置為 "autocomplete"
5443
			#設置為 "autocomplete"
5444
			$conf["autocomplete"]="autocomplete";
5444
			$conf["autocomplete"]="autocomplete";
5445
		
5445
 
5446
		}#if end
5446
		}#if end
5447
		
5447
 
5448
		#反之
5448
		#反之
5449
		else{
5449
		else{
5450
			#設置為空字串
5450
			#設置為空字串
5451
			$conf["autocomplete"]="";
5451
			$conf["autocomplete"]="";
5452
		
5452
 
5453
		}#else end
5453
		}#else end
5454
 
5454
 
5455
		#放置可以輸入email的表單
5455
		#放置可以輸入email的表單
5456
		$result["content"]=$result["content"]."<input ".$conf["id"]." type = \"email\" ".$conf["width"]." ".$conf["maxInputLength"]." name = ".$conf["name"]." id = ".$conf["name"]." ".$conf["value"]." ".$conf["readOnly"]." ".$conf["autoFocus"]." ".$conf["class"]." ".$conf["jsCustom"]." ".$conf["placeholder"]." ".$conf["autocomplete"]." ".$conf["required"]." ".$conf["dataFormId"]." >";
5456
		$result["content"]=$result["content"]."<input ".$conf["id"]." type = \"email\" ".$conf["width"]." ".$conf["maxInputLength"]." name = ".$conf["name"]." id = ".$conf["name"]." ".$conf["value"]." ".$conf["readOnly"]." ".$conf["autoFocus"]." ".$conf["class"]." ".$conf["jsCustom"]." ".$conf["placeholder"]." ".$conf["autocomplete"]." ".$conf["required"]." ".$conf["dataFormId"]." >";
5457
 
5457
 
Line 5508... Line 5508...
5508
		#執行到這邊代表執行成功
5508
		#執行到這邊代表執行成功
5509
		$result["status"]="true";
5509
		$result["status"]="true";
5510
 
5510
 
5511
		#回傳結果
5511
		#回傳結果
5512
		return $result;
5512
		return $result;
5513
		
5513
 
5514
		}#function inputEmail end
5514
		}#function inputEmail end
5515
	
5515
 
5516
	/*
5516
	/*
5517
	#函式說明:
5517
	#函式說明:
5518
	#可以輸入文字的區塊
5518
	#可以輸入文字的區塊
5519
	#回傳結果:
5519
	#回傳結果:
5520
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
5520
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 5984... Line 5984...
5984
 
5984
 
5985
			}#else end
5985
			}#else end
5986
 
5986
 
5987
		#如果有設置 $conf["dataFormId"]
5987
		#如果有設置 $conf["dataFormId"]
5988
		if(isset($conf["dataFormId"])){
5988
		if(isset($conf["dataFormId"])){
5989
		
5989
 
5990
			#設置 data-id 屬性
5990
			#設置 data-id 屬性
5991
			$conf["dataFormId"]="data-form-id=\"".$conf["dataFormId"]."\"";
5991
			$conf["dataFormId"]="data-form-id=\"".$conf["dataFormId"]."\"";
5992
		
5992
 
5993
			}#if end
5993
			}#if end
5994
		
5994
 
5995
		#反之設置為空數值	
5995
		#反之設置為空數值
5996
		else{
5996
		else{
5997
		
5997
 
5998
			$conf["dataFormId"]="";
5998
			$conf["dataFormId"]="";
5999
		
5999
 
6000
			}#else end
6000
			}#else end
6001
 
6001
 
6002
		#放置可以文字的區塊
6002
		#放置可以文字的區塊
6003
		$result["content"]=$result["content"]."<textarea ".$conf["width"]." ".$conf["cols"]." ".$conf["rows"]." ".$conf["maxInputLength"]." name=".$conf["name"]." ".$conf["readOnly"]." ".$conf["class"]." ".$conf["jsCustom"]." ".$conf["placeholder"]." ".$conf["required"]."  ".$conf["id"]." ".$conf["dataFormId"]." >".$conf["defaultText"]."</textarea>";
6003
		$result["content"]=$result["content"]."<textarea ".$conf["width"]." ".$conf["cols"]." ".$conf["rows"]." ".$conf["maxInputLength"]." name=".$conf["name"]." ".$conf["readOnly"]." ".$conf["class"]." ".$conf["jsCustom"]." ".$conf["placeholder"]." ".$conf["required"]."  ".$conf["id"]." ".$conf["dataFormId"]." >".$conf["defaultText"]."</textarea>";
6004
 
6004
 
Line 6468... Line 6468...
6468
 
6468
 
6469
			}#else end
6469
			}#else end
6470
 
6470
 
6471
		#如果有設置 $conf["dataFormId"]
6471
		#如果有設置 $conf["dataFormId"]
6472
		if(isset($conf["dataFormId"])){
6472
		if(isset($conf["dataFormId"])){
6473
		
6473
 
6474
			#設置 data-id 屬性
6474
			#設置 data-id 屬性
6475
			$conf["dataFormId"]="data-form-id=\"".$conf["dataFormId"]."\"";
6475
			$conf["dataFormId"]="data-form-id=\"".$conf["dataFormId"]."\"";
6476
		
6476
 
6477
			}#if end
6477
			}#if end
6478
		
6478
 
6479
		#反之設置為空數值	
6479
		#反之設置為空數值
6480
		else{
6480
		else{
6481
		
6481
 
6482
			$conf["dataFormId"]="";
6482
			$conf["dataFormId"]="";
6483
		
6483
 
6484
			}#else end
6484
			}#else end
6485
	
6485
 
6486
		#放置可以輸入密碼的表單
6486
		#放置可以輸入密碼的表單
6487
		$result["content"]=$result["content"]."<input type = password ".$conf["autoFocus"]." ".$conf["width"]." ".$conf["maxInputLength"]." name = ".$conf["name"]." id = ".$conf["name"]." ".$conf["defaultValue"]." ".$conf["class"]." ".$conf["jsCustom"]." ".$conf["placeholder"]." ".$conf["required"]." autocomplete=".$conf["autocomplete"]." ".$conf["dataFormId"].">";
6487
		$result["content"]=$result["content"]."<input type = password ".$conf["autoFocus"]." ".$conf["width"]." ".$conf["maxInputLength"]." name = ".$conf["name"]." id = ".$conf["name"]." ".$conf["defaultValue"]." ".$conf["class"]." ".$conf["jsCustom"]." ".$conf["placeholder"]." ".$conf["required"]." autocomplete=".$conf["autocomplete"]." ".$conf["dataFormId"].">";
6488
 
6488
 
6489
		#如果 $conf["formEnd"] 等於 "true"
6489
		#如果 $conf["formEnd"] 等於 "true"
6490
		if($conf["formEnd"]=="true"){
6490
		if($conf["formEnd"]=="true"){
Line 7087... Line 7087...
7087
			#回傳結果:
7087
			#回傳結果:
7088
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
7088
			#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
7089
			#$result["function"],當前執行的函數.
7089
			#$result["function"],當前執行的函數.
7090
			#$result["content"],爲處理好的字串.
7090
			#$result["content"],爲處理好的字串.
7091
			#$result["error"],錯誤訊息陣列.
7091
			#$result["error"],錯誤訊息陣列.
7092
			#$result["argu"],使用的參數. 
7092
			#$result["argu"],使用的參數.
7093
			#必填參數:
7093
			#必填參數:
7094
			$conf["stringProcess::correctCharacter"]["stringIn"]=$conf["jsAction"];#爲要處理的字串
7094
			$conf["stringProcess::correctCharacter"]["stringIn"]=$conf["jsAction"];#爲要處理的字串
7095
			#可省略的參數:
7095
			#可省略的參數:
7096
			$conf["stringProcess::correctCharacter"]["selectedCharacter"]=array(" ");#爲被選擇要處理的字串/字元,須爲陣列值。
7096
			$conf["stringProcess::correctCharacter"]["selectedCharacter"]=array(" ");#爲被選擇要處理的字串/字元,須爲陣列值。
7097
				#若不設定則預設爲要將這些字串作替換 ("<",">","=","//","'","$","%","&","|","/*","*","#","\"").
7097
				#若不設定則預設爲要將這些字串作替換 ("<",">","=","//","'","$","%","&","|","/*","*","#","\"").
Line 7110... Line 7110...
7110
				$result["error"]=$correctCharacter;
7110
				$result["error"]=$correctCharacter;
7111
 
7111
 
7112
				#回傳結果
7112
				#回傳結果
7113
				return $result;
7113
				return $result;
7114
 
7114
 
7115
				}#if end	
7115
				}#if end
7116
 
7116
 
7117
			#get new jsAction
7117
			#get new jsAction
7118
			$conf["jsAction"]=$correctCharacter["content"];#爲該表單的名稱
7118
			$conf["jsAction"]=$correctCharacter["content"];#爲該表單的名稱
7119
 
7119
 
7120
			#則將設定值組合
7120
			#則將設定值組合
Line 7200... Line 7200...
7200
		#串接css樣式
7200
		#串接css樣式
7201
		$result["content"]=$result["content"].$css["content"];
7201
		$result["content"]=$result["content"].$css["content"];
7202
 
7202
 
7203
		#如果有設置 $conf["dataFormId"]
7203
		#如果有設置 $conf["dataFormId"]
7204
		if(isset($conf["dataFormId"])){
7204
		if(isset($conf["dataFormId"])){
7205
		
7205
 
7206
			#設置 data-id 屬性
7206
			#設置 data-id 屬性
7207
			$conf["dataFormId"]="data-form-id=\"".$conf["dataFormId"]."\"";
7207
			$conf["dataFormId"]="data-form-id=\"".$conf["dataFormId"]."\"";
7208
		
7208
 
7209
			}#if end
7209
			}#if end
7210
		
7210
 
7211
		#反之設置為空數值	
7211
		#反之設置為空數值
7212
		else{
7212
		else{
7213
		
7213
 
7214
			$conf["dataFormId"]="";
7214
			$conf["dataFormId"]="";
7215
		
7215
 
7216
			}#else end
7216
			}#else end
7217
 
7217
 
7218
		#下拉式表單的名稱
7218
		#下拉式表單的名稱
7219
		$result["content"]=$result["content"]." <label class=\"__commentDefaultCssStyle\" for=\"".$conf["name"]."\">".$conf["comment"]."</label><select  id=\"".$conf["name"]."\" name = \"".$conf["name"]."\" ".$conf["viewCount"]." ".$conf["class"]." ".$conf["jsCustom"]." ".$conf["readOnly"]." ".$conf["dataFormId"].">";
7219
		$result["content"]=$result["content"]." <label class=\"__commentDefaultCssStyle\" for=\"".$conf["name"]."\">".$conf["comment"]."</label><select  id=\"".$conf["name"]."\" name = \"".$conf["name"]."\" ".$conf["viewCount"]." ".$conf["class"]." ".$conf["jsCustom"]." ".$conf["readOnly"]." ".$conf["dataFormId"].">";
7220
 
7220
 
Line 7585... Line 7585...
7585
		#$conf["trStart"]="true";#爲是否要以<tr>開頭,"true"表示"是"。也可以看作新的一列開始。
7585
		#$conf["trStart"]="true";#爲是否要以<tr>開頭,"true"表示"是"。也可以看作新的一列開始。
7586
		#$conf["tdStart"]="true";#爲是否要以<td>開頭,"true"表示"是"。也可以看成列裏面的元素開始
7586
		#$conf["tdStart"]="true";#爲是否要以<td>開頭,"true"表示"是"。也可以看成列裏面的元素開始
7587
		#$conf["tdEnd"]="true";#爲是否要以</td>結尾,"true"表示"是"。也可以看成列裏面的元素結束
7587
		#$conf["tdEnd"]="true";#爲是否要以</td>結尾,"true"表示"是"。也可以看成列裏面的元素結束
7588
		#$conf["trEnd"]="true";#爲是否要以</tr>結尾,"true"表示"是"。也可以看作該列結束。
7588
		#$conf["trEnd"]="true";#爲是否要以</tr>結尾,"true"表示"是"。也可以看作該列結束。
7589
		#$conf["tableEnd"]="true";#爲是否要以</table>結尾,"true"表示"是"。也可以看作表格結束。
7589
		#$conf["tableEnd"]="true";#爲是否要以</table>結尾,"true"表示"是"。也可以看作表格結束。
7590
		
7590
 
7591
		#如果有設置 $conf["dataFormId"]
7591
		#如果有設置 $conf["dataFormId"]
7592
		if(isset($conf["dataFormId"])){
7592
		if(isset($conf["dataFormId"])){
7593
		
7593
 
7594
			#設置 data-id 屬性
7594
			#設置 data-id 屬性
7595
			$conf["dataFormId"]=$conf["dataFormId"];
7595
			$conf["dataFormId"]=$conf["dataFormId"];
7596
		
7596
 
7597
			}#if end
7597
			}#if end
7598
		
7598
 
7599
		#備註:
7599
		#備註:
7600
		#$_SERVER["PHP_SELF"]為php檔案自己
7600
		#$_SERVER["PHP_SELF"]為php檔案自己
7601
		#參考資料來源:
7601
		#參考資料來源:
7602
		#http://stackoverflow.com/questions/833032/submit-is-not-a-function-in-javascript => form的id重複會導致"document.testForm.submit()"的javaScript語法出錯。
7602
		#http://stackoverflow.com/questions/833032/submit-is-not-a-function-in-javascript => form的id重複會導致"document.testForm.submit()"的javaScript語法出錯。
7603
		#http://stackoverflow.com/questions/14622124/all-of-commands-for-submit-in-onchange-select-not-work => documents.forms.formName.submit() 才會將正確的表單送出。
7603
		#http://stackoverflow.com/questions/14622124/all-of-commands-for-submit-in-onchange-select-not-work => documents.forms.formName.submit() 才會將正確的表單送出。
Line 7605... Line 7605...
7605
		#tableStart & tableEnd 要補上
7605
		#tableStart & tableEnd 要補上
7606
		$inputSelect=form::inputSelect($conf);
7606
		$inputSelect=form::inputSelect($conf);
7607
 
7607
 
7608
		#如果建立失敗
7608
		#如果建立失敗
7609
		if($inputSelect["content"]==="false"){
7609
		if($inputSelect["content"]==="false"){
7610
		
7610
 
7611
			#設置執行失敗
7611
			#設置執行失敗
7612
			$result["status"]="false";
7612
			$result["status"]="false";
7613
		
7613
 
7614
			#設置錯誤訊息
7614
			#設置錯誤訊息
7615
			$result["error"]=$inputSelect;
7615
			$result["error"]=$inputSelect;
7616
			
7616
 
7617
			#回傳結果
7617
			#回傳結果
7618
			return $result;
7618
			return $result;
7619
		
7619
 
7620
			}#if end
7620
			}#if end
7621
 
7621
 
7622
		#將$conf["name"]進行處理,避免js錯誤
7622
		#將$conf["name"]進行處理,避免js錯誤
7623
		#函式說明:
7623
		#函式說明:
7624
		#處理字串避免網頁出錯
7624
		#處理字串避免網頁出錯
Line 7637... Line 7637...
7637
		$correctCharacter=stringProcess::correctCharacter($conf["stringProcess::correctCharacter"]);
7637
		$correctCharacter=stringProcess::correctCharacter($conf["stringProcess::correctCharacter"]);
7638
		unset($conf["stringProcess::correctCharacter"]);
7638
		unset($conf["stringProcess::correctCharacter"]);
7639
 
7639
 
7640
		#如果處理失敗
7640
		#如果處理失敗
7641
		if($correctCharacter["status"]==="false"){
7641
		if($correctCharacter["status"]==="false"){
7642
		
7642
 
7643
			#設置執行失敗
7643
			#設置執行失敗
7644
			$result["status"]="false";
7644
			$result["status"]="false";
7645
		
7645
 
7646
			#設置錯誤訊息
7646
			#設置錯誤訊息
7647
			$result["error"]=$correctCharacter;
7647
			$result["error"]=$correctCharacter;
7648
			
7648
 
7649
			#回傳結果
7649
			#回傳結果
7650
			return $result;
7650
			return $result;
7651
		
7651
 
7652
			}#if end
7652
			}#if end
7653
 
7653
 
7654
		#比對名稱是否符合規則
7654
		#比對名稱是否符合規則
7655
		if($conf["name"]!==$correctCharacter["content"]){
7655
		if($conf["name"]!==$correctCharacter["content"]){
7656
		
7656
 
7657
			#設置執行失敗
7657
			#設置執行失敗
7658
			$result["status"]="false";
7658
			$result["status"]="false";
7659
		
7659
 
7660
			#設置錯誤訊息
7660
			#設置錯誤訊息
7661
			$result["error"]=$correctCharacter;
7661
			$result["error"]=$correctCharacter;
7662
			
7662
 
7663
			#設置額外錯誤訊息
7663
			#設置額外錯誤訊息
7664
			$result["error"][]=$conf["name"]." 不是合法的參數";
7664
			$result["error"][]=$conf["name"]." 不是合法的參數";
7665
			
7665
 
7666
			#回傳結果
7666
			#回傳結果
7667
			return $result;
7667
			return $result;
7668
		
7668
 
7669
			}#if end
7669
			}#if end
7670
 
7670
 
7671
		#另存表單的名稱
7671
		#另存表單的名稱
7672
		$name=$conf["name"];
7672
		$name=$conf["name"];
7673
 
7673
 
Line 8546... Line 8546...
8546
				#$conf["oneScreenSize"]="false";
8546
				#$conf["oneScreenSize"]="false";
8547
				#$conf["textAlignCenter"],字串,div區塊是否要置中,預設為$conf["oneScreenSize"]的值,"false"為不置中,"true"代表要置中.
8547
				#$conf["textAlignCenter"],字串,div區塊是否要置中,預設為$conf["oneScreenSize"]的值,"false"為不置中,"true"代表要置中.
8548
				#$conf["textAlignCenter"]="";
8548
				#$conf["textAlignCenter"]="";
8549
				#$conf["css::divSection"["data"],字串陣列,每個要設置的屬性data內容,例如array("option1"=>"A","option2"=>"B"),預設不使用.
8549
				#$conf["css::divSection"["data"],字串陣列,每個要設置的屬性data內容,例如array("option1"=>"A","option2"=>"B"),預設不使用.
8550
				$conf["css::divSection"]["data"]=array($fakeScrollingListDataVar=>base64_encode(json_encode(array("outputValue"=>$conf["outputValue"],"sendValue"=>$conf["sendValue"],"defaultValue"=>$conf["defaultValue"],"defaultShowVal"=>$defaultShowVal))));
8550
				$conf["css::divSection"]["data"]=array($fakeScrollingListDataVar=>base64_encode(json_encode(array("outputValue"=>$conf["outputValue"],"sendValue"=>$conf["sendValue"],"defaultValue"=>$conf["defaultValue"],"defaultShowVal"=>$defaultShowVal))));
8551
					
8551
 
8552
				#如果有設置 $conf["dataFormId"]
8552
				#如果有設置 $conf["dataFormId"]
8553
				if(isset($conf["dataFormId"])){
8553
				if(isset($conf["dataFormId"])){
8554
				
8554
 
8555
					#設置 data-form-id 屬性
8555
					#設置 data-form-id 屬性
8556
					$conf["css::divSection"]["data"]["form-id"]=$conf["dataFormId"];
8556
					$conf["css::divSection"]["data"]["form-id"]=$conf["dataFormId"];
8557
				
8557
 
8558
					}#if end
8558
					}#if end
8559
				
8559
 
8560
				$divSection=css::divSection($conf["css::divSection"]);
8560
				$divSection=css::divSection($conf["css::divSection"]);
8561
				unset($conf["css::divSection"]);
8561
				unset($conf["css::divSection"]);
8562
 
8562
 
8563
				#如果建立div區段失敗
8563
				#如果建立div區段失敗
8564
				if($divSection["status"]==="false"){
8564
				if($divSection["status"]==="false"){
Line 8599... Line 8599...
8599
				$conf["css::spanSection"]["class"]=$conf["class"];
8599
				$conf["css::spanSection"]["class"]=$conf["class"];
8600
				#$conf["title"],陣列,滑鼠移到上面時要顯示的內容,每個元素代表一列內容
8600
				#$conf["title"],陣列,滑鼠移到上面時要顯示的內容,每個元素代表一列內容
8601
				#$conf["title"]=array();
8601
				#$conf["title"]=array();
8602
				#$conf["css::spanSection"]["data"],字串陣列,每個data屬性名稱為數值內容,例如array("a"=>"A","b"=>"B")
8602
				#$conf["css::spanSection"]["data"],字串陣列,每個data屬性名稱為數值內容,例如array("a"=>"A","b"=>"B")
8603
				$conf["css::spanSection"]["data"]=array($fakeScrollingListDataVar=>base64_encode(json_encode(array("outputValue"=>$conf["outputValue"],"sendValue"=>$conf["sendValue"],"defaultValue"=>$conf["defaultValue"],"defaultShowVal"=>$defaultShowVal))));
8603
				$conf["css::spanSection"]["data"]=array($fakeScrollingListDataVar=>base64_encode(json_encode(array("outputValue"=>$conf["outputValue"],"sendValue"=>$conf["sendValue"],"defaultValue"=>$conf["defaultValue"],"defaultShowVal"=>$defaultShowVal))));
8604
					
8604
 
8605
				#如果有設置 $conf["dataFormId"]
8605
				#如果有設置 $conf["dataFormId"]
8606
				if(isset($conf["dataFormId"])){
8606
				if(isset($conf["dataFormId"])){
8607
				
8607
 
8608
					#設置 data-form-id 屬性
8608
					#設置 data-form-id 屬性
8609
					$conf["css::spanSection"]["data"]["form-id"]=$conf["dataFormId"];
8609
					$conf["css::spanSection"]["data"]["form-id"]=$conf["dataFormId"];
8610
				
8610
 
8611
					}#if end
8611
					}#if end
8612
				
8612
 
8613
				$spanSection=css::spanSection($conf["css::spanSection"]);
8613
				$spanSection=css::spanSection($conf["css::spanSection"]);
8614
				unset($conf["css::spanSection"]);
8614
				unset($conf["css::spanSection"]);
8615
 
8615
 
8616
				#如果建立span區段失敗
8616
				#如果建立span區段失敗
8617
				if($spanSection["status"]==="false"){
8617
				if($spanSection["status"]==="false"){
Line 8702... Line 8702...
8702
			#取得表單的名稱
8702
			#取得表單的名稱
8703
			$name=$conf["name"];
8703
			$name=$conf["name"];
8704
 
8704
 
8705
			#如果 readOnly
8705
			#如果 readOnly
8706
			if($conf["readOnly"]==="true"){
8706
			if($conf["readOnly"]==="true"){
8707
			
8707
 
8708
				#設置執行正常
8708
				#設置執行正常
8709
				$result["status"]="true";
8709
				$result["status"]="true";
8710
 
8710
 
8711
				#回傳結果
8711
				#回傳結果
8712
				return $result;
8712
				return $result;
8713
			
8713
 
8714
				}#if end
8714
				}#if end
8715
 
8715
 
8716
			#函式說明:
8716
			#函式說明:
8717
			#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
8717
			#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
8718
			#回傳結果:
8718
			#回傳結果:
Line 8807... Line 8807...
8807
					//設置選項div的數值內容
8807
					//設置選項div的數值內容
8808
					opDiv.setAttribute('data-val',opVal);
8808
					opDiv.setAttribute('data-val',opVal);
8809
 
8809
 
8810
					//設置選項div的編號(從0開始)
8810
					//設置選項div的編號(從0開始)
8811
					opDiv.setAttribute('data-no',i);
8811
					opDiv.setAttribute('data-no',i);
8812
					
8812
 
8813
					//設置裡面的文字要換行的時候改用...表示
8813
					//設置裡面的文字要換行的時候改用...表示
8814
					opDiv.style.whiteSpace='nowrap';
8814
					opDiv.style.whiteSpace='nowrap';
8815
					opDiv.style.width='100%';
8815
					opDiv.style.width='100%';
8816
					opDiv.style.overflow='hidden';
8816
					opDiv.style.overflow='hidden';
8817
					opDiv.style.textOverflow='ellipsis';
8817
					opDiv.style.textOverflow='ellipsis';
8818
					
8818
 
8819
					//偶數欄位
8819
					//偶數欄位
8820
					if(i%2===0)
8820
					if(i%2===0)
8821
					{
8821
					{
8822
						//設置選項div底色為藍色
8822
						//設置選項div底色為藍色
8823
						opDiv.style.backgroundColor='CCCCFF';
8823
						opDiv.style.backgroundColor='CCCCFF';
Line 9099... Line 9099...
9099
						console.log(res);
9099
						console.log(res);
9100
						console.log('url:'+res.URL);
9100
						console.log('url:'+res.URL);
9101
						console.log('title:'+res.title);
9101
						console.log('title:'+res.title);
9102
 
9102
 
9103
						//將回應刷新到當前頁面
9103
						//將回應刷新到當前頁面
9104
						
9104
 
9105
						//no use?
9105
						//no use?
9106
						stateObj={};
9106
						stateObj={};
9107
						
9107
 
9108
						//取得新 title
9108
						//取得新 title
9109
						title=res.title;
9109
						title=res.title;
9110
						
9110
 
9111
						//取得新 url
9111
						//取得新 url
9112
						newUrl=res.URL;
9112
						newUrl=res.URL;
9113
						
9113
 
9114
						//更新網頁標題與網址
9114
						//更新網頁標題與網址
9115
						//參考資料:https://developer.mozilla.org/en-US/docs/Web/API/History_API
9115
						//參考資料:https://developer.mozilla.org/en-US/docs/Web/API/History_API
9116
						history.pushState(stateObj, title, newUrl);
9116
						history.pushState(stateObj, title, newUrl);
9117
 
9117
 
9118
						//開新文件
9118
						//開新文件
Line 14629... Line 14629...
14629
			#備註:
14629
			#備註:
14630
			#不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.
14630
			#不是所有指令都能用apache的身份執行,目前已知java,javac指令無法執行,使用root身份可能會被selinux阻擋.
14631
			#若使用的 command、argu 參數,含有 ~ 則會被視為字串,若有需要其於 shell 中代表的家目錄位置,可用 fileAccess::tildeToPath 來進行轉換.
14631
			#若使用的 command、argu 參數,含有 ~ 則會被視為字串,若有需要其於 shell 中代表的家目錄位置,可用 fileAccess::tildeToPath 來進行轉換.
14632
			$changePermission=external::callShell($conf["external"]["callShell"]);
14632
			$changePermission=external::callShell($conf["external"]["callShell"]);
14633
			unset($conf["external"]["callShell"]);
14633
			unset($conf["external"]["callShell"]);
14634
	
14634
 
14635
			#如果 $changePermission["status"] 等於 "false"
14635
			#如果 $changePermission["status"] 等於 "false"
14636
			if($changePermission["status"]=="false"){
14636
			if($changePermission["status"]=="false"){
14637
 
14637
 
14638
				#設置錯誤識別
14638
				#設置錯誤識別
14639
				$result["status"]="false";
14639
				$result["status"]="false";
Line 16327... Line 16327...
16327
 
16327
 
16328
		#回傳結果
16328
		#回傳結果
16329
		return $result;
16329
		return $result;
16330
 
16330
 
16331
		}#function is_ajax end
16331
		}#function is_ajax end
16332
		
16332
 
16333
	/*
16333
	/*
16334
	#函式說明:
16334
	#函式說明:
16335
	#水平拉霸
16335
	#水平拉霸
16336
	#回傳結果:
16336
	#回傳結果:
16337
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
16337
	#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
Line 16350... Line 16350...
16350
	#無.
16350
	#無.
16351
	#備註:
16351
	#備註:
16352
	#會產生 window.qbpwcf.form.bar 物件.若要印出拉霸則可呼叫函式 window.qbpwcf.form.bar.print() 方法.若要存取變更拉霸的設定可呼叫 window.qbpwcf.form.bar.content 取得dom.
16352
	#會產生 window.qbpwcf.form.bar 物件.若要印出拉霸則可呼叫函式 window.qbpwcf.form.bar.print() 方法.若要存取變更拉霸的設定可呼叫 window.qbpwcf.form.bar.content 取得dom.
16353
	*/
16353
	*/
16354
	public static function bar(&$conf=array()){
16354
	public static function bar(&$conf=array()){
16355
	
16355
 
16356
		#初始化要回傳的結果
16356
		#初始化要回傳的結果
16357
		$result=array();
16357
		$result=array();
16358
 
16358
 
16359
		#取得當前執行的函數名稱
16359
		#取得當前執行的函數名稱
16360
		$result["function"]=__FUNCTION__;
16360
		$result["function"]=__FUNCTION__;
Line 16431... Line 16431...
16431
		#$conf["arrayCountEqualCheck"][]=array();
16431
		#$conf["arrayCountEqualCheck"][]=array();
16432
		#參考資料:
16432
		#參考資料:
16433
		#array_keys=>http://php.net/manual/en/function.array-keys.php
16433
		#array_keys=>http://php.net/manual/en/function.array-keys.php
16434
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
16434
		$checkArguments=variableCheck::checkArguments($conf["variableCheck::checkArguments"]);
16435
		unset($conf["variableCheck::checkArguments"]);
16435
		unset($conf["variableCheck::checkArguments"]);
16436
	
16436
 
16437
		#若檢查參數失敗
16437
		#若檢查參數失敗
16438
		if($checkArguments["status"]==="false"){
16438
		if($checkArguments["status"]==="false"){
16439
		
16439
 
16440
			#設置執行失敗
16440
			#設置執行失敗
16441
			$result["status"]="false";
16441
			$result["status"]="false";
16442
		
16442
 
16443
			#設置錯誤訊息
16443
			#設置錯誤訊息
16444
			$result["error"]=$checkArguments;
16444
			$result["error"]=$checkArguments;
16445
			
16445
 
16446
			#回傳結果
16446
			#回傳結果
16447
			return $result;
16447
			return $result;
16448
			
16448
 
16449
			}#if end
16449
			}#if end
16450
			
16450
 
16451
		#若檢查參數不通過
16451
		#若檢查參數不通過
16452
		if($checkArguments["passed"]==="false"){
16452
		if($checkArguments["passed"]==="false"){
16453
		
16453
 
16454
			#設置執行失敗
16454
			#設置執行失敗
16455
			$result["status"]="false";
16455
			$result["status"]="false";
16456
		
16456
 
16457
			#設置錯誤訊息
16457
			#設置錯誤訊息
16458
			$result["error"]=$checkArguments;
16458
			$result["error"]=$checkArguments;
16459
			
16459
 
16460
			#回傳結果
16460
			#回傳結果
16461
			return $result;
16461
			return $result;
16462
		
16462
 
16463
			}#if end
16463
			}#if end
16464
		
16464
 
16465
		#加入 js
16465
		#加入 js
16466
		#函式說明:
16466
		#函式說明:
16467
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
16467
		#將要執行的script語法透過該函式執行(會在程式外層用<script></script>包起來).
16468
		#回傳結果:
16468
		#回傳結果:
16469
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
16469
		#$result["status"],執行是否正常,"true"為正常,"false"為不正常.
Line 16472... Line 16472...
16472
		#$result["content"],要執行的javaScript語法
16472
		#$result["content"],要執行的javaScript語法
16473
		#必填參數:
16473
		#必填參數:
16474
		#$conf["script"],字串,要執行的javaScript語法.
16474
		#$conf["script"],字串,要執行的javaScript語法.
16475
		$conf["javaScript::toScript"]["script"]=
16475
		$conf["javaScript::toScript"]["script"]=
16476
		"
16476
		"
16477
				
16477
 
16478
		//確認變數存在 - start
16478
		//確認變數存在 - start
16479
		if(window.qbpwcf===undefined)
16479
		if(window.qbpwcf===undefined)
16480
		{
16480
		{
16481
			window.qbpwcf={};
16481
			window.qbpwcf={};
16482
		}
16482
		}
16483
		
16483
 
16484
		if(window.qbpwcf.form===undefined)
16484
		if(window.qbpwcf.form===undefined)
16485
		{
16485
		{
16486
			window.qbpwcf.form={};
16486
			window.qbpwcf.form={};
16487
		}
16487
		}
16488
		
16488
 
16489
		if(window.qbpwcf.form.bar===undefined)
16489
		if(window.qbpwcf.form.bar===undefined)
16490
		{
16490
		{
16491
			window.qbpwcf.form.bar={};
16491
			window.qbpwcf.form.bar={};
16492
		}
16492
		}
16493
		//確認變數 - end
16493
		//確認變數 - end
16494
		
16494
 
16495
		//建立 root div
16495
		//建立 root div
16496
		rootDiv=document.createElement('div');
16496
		rootDiv=document.createElement('div');
16497
		rootDiv.id='".$conf["name"]."rootDiv';
16497
		rootDiv.id='".$conf["name"]."rootDiv';
16498
				
16498
 
16499
		//建立 onoff div
16499
		//建立 onoff div
16500
		onoffDiv=document.createElement('div');
16500
		onoffDiv=document.createElement('div');
16501
		onoffDiv.id='".$conf["name"]."onoffDiv';
16501
		onoffDiv.id='".$conf["name"]."onoffDiv';
16502
		onoffDiv.style.width='200px';			
16502
		onoffDiv.style.width='200px';
16503
		
16503
 
16504
		//建立 off 的 div tag
16504
		//建立 off 的 div tag
16505
		offDiv=document.createElement('div');
16505
		offDiv=document.createElement('div');
16506
		offDiv.id='".$conf["name"]."off';
16506
		offDiv.id='".$conf["name"]."off';
16507
		offDiv.innerText='off ';
16507
		offDiv.innerText='off ';
16508
		offDiv.style.display='inline';
16508
		offDiv.style.display='inline';
16509
		offDiv.style.float='left';
16509
		offDiv.style.float='left';
16510
		
16510
 
16511
		//如果點擊了 off 字樣
16511
		//如果點擊了 off 字樣
16512
		offDiv.addEventListener('click',function(e){
16512
		offDiv.addEventListener('click',function(e){
16513
		
16513
 
16514
			//一百次迴圈
16514
			//一百次迴圈
16515
			for(i=0;i<100;i++){
16515
			for(i=0;i<100;i++){
16516
			
16516
 
16517
				//取得該bar part
16517
				//取得該bar part
16518
				thisBarPart=document.getElementById('".$conf["name"]."bar'+i);
16518
				thisBarPart=document.getElementById('".$conf["name"]."bar'+i);
16519
			
16519
 
16520
				//設置為灰色
16520
				//設置為灰色
16521
				thisBarPart.style.borderColor='".$conf["unSelectedColor"]."';	
16521
				thisBarPart.style.borderColor='".$conf["unSelectedColor"]."';
16522
			
16522
 
16523
				}//for end
16523
				}//for end
16524
		
16524
 
16525
			//取得 bar 數值
16525
			//取得 bar 數值
16526
			barVal=document.getElementById('".$conf["name"]."barVal');
16526
			barVal=document.getElementById('".$conf["name"]."barVal');
16527
		
16527
 
16528
			//設置為 '0%'
16528
			//設置為 '0%'
16529
			barVal.innerText='0%';
16529
			barVal.innerText='0%';
16530
			
16530
 
16531
			//設置實際數值為 '0'
16531
			//設置實際數值為 '0'
16532
			barVal.dataset.val='0';
16532
			barVal.dataset.val='0';
16533
		
16533
 
16534
			});
16534
			});
16535
		
16535
 
16536
		//放入off的文字
16536
		//放入off的文字
16537
		onoffDiv.appendChild(offDiv);
16537
		onoffDiv.appendChild(offDiv);
16538
		
16538
 
16539
		//建立 on 的 div tag
16539
		//建立 on 的 div tag
16540
		onDiv=document.createElement('div');
16540
		onDiv=document.createElement('div');
16541
		onDiv.id='".$conf["name"]."on';
16541
		onDiv.id='".$conf["name"]."on';
16542
		onDiv.innerText=' on';
16542
		onDiv.innerText=' on';
16543
		onDiv.style.display='inline';
16543
		onDiv.style.display='inline';
16544
		onDiv.style.float='right';
16544
		onDiv.style.float='right';
16545
		
16545
 
16546
		//如果點擊了 on 字樣
16546
		//如果點擊了 on 字樣
16547
		onDiv.addEventListener('click',function(e){
16547
		onDiv.addEventListener('click',function(e){
16548
		
16548
 
16549
			//一百次迴圈
16549
			//一百次迴圈
16550
			for(i=0;i<100;i++){
16550
			for(i=0;i<100;i++){
16551
			
16551
 
16552
				//取得該bar part
16552
				//取得該bar part
16553
				thisBarPart=document.getElementById('".$conf["name"]."bar'+i);
16553
				thisBarPart=document.getElementById('".$conf["name"]."bar'+i);
16554
			
16554
 
16555
				//設置為灰色
16555
				//設置為灰色
16556
				thisBarPart.style.borderColor='".$conf["unSelectedColor"]."';	
16556
				thisBarPart.style.borderColor='".$conf["unSelectedColor"]."';
16557
			
16557
 
16558
				}//for end
16558
				}//for end
16559
		
16559
 
16560
			//取得 bar 數值
16560
			//取得 bar 數值
16561
			barVal=document.getElementById('".$conf["name"]."barVal');
16561
			barVal=document.getElementById('".$conf["name"]."barVal');
16562
		
16562
 
16563
			//設置為 '0%'
16563
			//設置為 '0%'
16564
			barVal.innerText='on';
16564
			barVal.innerText='on';
16565
			
16565
 
16566
			//設置實際數值為 '0'
16566
			//設置實際數值為 '0'
16567
			barVal.dataset.value='?';
16567
			barVal.dataset.value='?';
16568
		
16568
 
16569
			});
16569
			});
16570
		
16570
 
16571
		//放入on的文字
16571
		//放入on的文字
16572
		onoffDiv.appendChild(onDiv);
16572
		onoffDiv.appendChild(onDiv);
16573
		
16573
 
16574
		//建立 on 的 div tag
16574
		//建立 on 的 div tag
16575
		div=document.createElement('div');
16575
		div=document.createElement('div');
16576
		
16576
 
16577
		//放入空div
16577
		//放入空div
16578
		rootDiv.appendChild(div);
16578
		rootDiv.appendChild(div);
16579
		
16579
 
16580
		//放入 on off div
16580
		//放入 on off div
16581
		rootDiv.appendChild(onoffDiv);
16581
		rootDiv.appendChild(onoffDiv);
16582
		
16582
 
16583
		//100次迴圈
16583
		//100次迴圈
16584
		for(i=0;i<100;i++){
16584
		for(i=0;i<100;i++){
16585
		
16585
 
16586
			//建立拉霸
16586
			//建立拉霸
16587
			line=document.createElement('div');
16587
			line=document.createElement('div');
16588
			
16588
 
16589
			//設置拉霸樣式
16589
			//設置拉霸樣式
16590
			line.id='".$conf["name"]."bar'+i;
16590
			line.id='".$conf["name"]."bar'+i;
16591
			line.dataset.val=i+1;
16591
			line.dataset.val=i+1;
16592
			line.style.borderStyle='solid';
16592
			line.style.borderStyle='solid';
16593
			line.style.borderColor='".$conf["unSelectedColor"]."';
16593
			line.style.borderColor='".$conf["unSelectedColor"]."';
16594
			line.style.borderWidth='1px';
16594
			line.style.borderWidth='1px';
16595
			line.style.borderRadius='1px';		
16595
			line.style.borderRadius='1px';
16596
			line.style.display='inline';
16596
			line.style.display='inline';
16597
 
16597
 
16598
			//放入拉霸part
16598
			//放入拉霸part
16599
			rootDiv.appendChild(line);
16599
			rootDiv.appendChild(line);
16600
		
16600
 
16601
			//點擊事件
16601
			//點擊事件
16602
			line.addEventListener('click',function(e){
16602
			line.addEventListener('click',function(e){
16603
			
16603
 
16604
				//一百次迴圈
16604
				//一百次迴圈
16605
				for(j=0;j<100;j++){
16605
				for(j=0;j<100;j++){
16606
				
16606
 
16607
					//取得該bar part
16607
					//取得該bar part
16608
					thisBarPart=document.getElementById('".$conf["name"]."bar'+j);
16608
					thisBarPart=document.getElementById('".$conf["name"]."bar'+j);
16609
				
16609
 
16610
					//設置為灰色
16610
					//設置為灰色
16611
					thisBarPart.style.borderColor='".$conf["unSelectedColor"]."';	
16611
					thisBarPart.style.borderColor='".$conf["unSelectedColor"]."';
16612
				
16612
 
16613
					}//for end
16613
					}//for end
16614
					
16614
 
16615
				//選取的點設置為橘色
16615
				//選取的點設置為橘色
16616
				e.target.style.borderColor='".$conf["selectedColor"]."';	
16616
				e.target.style.borderColor='".$conf["selectedColor"]."';
16617
				
16617
 
16618
				//設置當前顯示的%數
16618
				//設置當前顯示的%數
16619
				document.getElementById('".$conf["name"]."barVal').innerText=(e.target.dataset.val)+'%';
16619
				document.getElementById('".$conf["name"]."barVal').innerText=(e.target.dataset.val)+'%';
16620
				
16620
 
16621
				//設置當前顯示的%數值,不含單位
16621
				//設置當前顯示的%數值,不含單位
16622
				document.getElementById('".$conf["name"]."barVal').dataset.val=e.target.dataset.val;
16622
				document.getElementById('".$conf["name"]."barVal').dataset.val=e.target.dataset.val;
16623
			
16623
 
16624
				});//addEventListener end
16624
				});//addEventListener end
16625
		
16625
 
16626
			}//for end
16626
			}//for end
16627
		
16627
 
16628
		//建立 div tag,預設為 '?%'
16628
		//建立 div tag,預設為 '?%'
16629
		valDiv=document.createElement('div');
16629
		valDiv=document.createElement('div');
16630
		valDiv.id='".$conf["name"]."barVal';
16630
		valDiv.id='".$conf["name"]."barVal';
16631
		valDiv.innerText='?%';
16631
		valDiv.innerText='?%';
16632
		valDiv.dataset.val='?';
16632
		valDiv.dataset.val='?';
16633
		valDiv.style.display='inline';
16633
		valDiv.style.display='inline';
16634
		
16634
 
16635
		//放入數值顯示
16635
		//放入數值顯示
16636
		rootDiv.appendChild(valDiv);
16636
		rootDiv.appendChild(valDiv);
16637
		
16637
 
16638
		//取得 拉霸的名稱
16638
		//取得 拉霸的名稱
16639
		window.qbpwcf.form.bar.name='".$conf["name"]."';
16639
		window.qbpwcf.form.bar.name='".$conf["name"]."';
16640
		
16640
 
16641
		//取得 拉霸的語法
16641
		//取得 拉霸的語法
16642
		window.qbpwcf.form.bar.content=rootDiv;
16642
		window.qbpwcf.form.bar.content=rootDiv;
16643
		
16643
 
16644
		//設置印出 拉霸的語法
16644
		//設置印出 拉霸的語法
16645
		window.qbpwcf.form.bar.print=function(){
16645
		window.qbpwcf.form.bar.print=function(){
16646
		
16646
 
16647
			//放置root div
16647
			//放置root div
16648
			document.body.appendChild(window.qbpwcf.form.bar.content);
16648
			document.body.appendChild(window.qbpwcf.form.bar.content);
16649
		
16649
 
16650
			}//function end
16650
			}//function end
16651
				
16651
 
16652
		";
16652
		";
16653
		#可省略參數:
16653
		#可省略參數:
16654
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
16654
		#$conf["onReady"],字串,是否要在網頁完全載入後再執行,"false"為不等載入完就先執行,預設為"true"要等載入完再執行.
16655
		#$conf["onReady"]="true";
16655
		#$conf["onReady"]="true";
16656
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
16656
		#$conf["globalJs"],字串陣列,為要放入<script>標籤的js全域變數.
16657
		#$conf["globalJs"]=array();
16657
		#$conf["globalJs"]=array();
16658
		#$conf["jsFunciton"],字串陣列,為要放入<script>標籤的js函數.
16658
		#$conf["jsFunciton"],字串陣列,為要放入<script>標籤的js函數.
16659
		#$conf["jsFunciton"]=array();
16659
		#$conf["jsFunciton"]=array();
16660
		#參考資料:
16660
		#參考資料:
16661
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
16661
		#http://stackoverflow.com/questions/9899372/pure-javascript-equivalent-to-jquerys-ready-how-to-call-a-function-when-the
16662
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);		
16662
		$toScript=javaScript::toScript($conf["javaScript::toScript"]);
16663
		$result["scriptWithoutTag"]=$conf["javaScript::toScript"]["script"];		
16663
		$result["scriptWithoutTag"]=$conf["javaScript::toScript"]["script"];
16664
		unset($conf["javaScript::toScript"]);
16664
		unset($conf["javaScript::toScript"]);
16665
		
16665
 
16666
		#加入 js 失敗
16666
		#加入 js 失敗
16667
		if($toScript["status"]==="false"){
16667
		if($toScript["status"]==="false"){
16668
		
16668
 
16669
			#設置執行失敗
16669
			#設置執行失敗
16670
			$result["status"]="false";
16670
			$result["status"]="false";
16671
		
16671
 
16672
			#設置錯誤訊息
16672
			#設置錯誤訊息
16673
			$result["error"]=$toScript;
16673
			$result["error"]=$toScript;
16674
			
16674
 
16675
			#回傳結果
16675
			#回傳結果
16676
			return $result;
16676
			return $result;
16677
		
16677
 
16678
			}#if end
16678
			}#if end
16679
		
16679
 
16680
		#取得js語法
16680
		#取得js語法
16681
		$result["content"]=$toScript["content"];
16681
		$result["content"]=$toScript["content"];
16682
			
16682
 
16683
		#設置執行正常
16683
		#設置執行正常
16684
		$result["status"]="true";
16684
		$result["status"]="true";
16685
		
16685
 
16686
		#回傳結果
16686
		#回傳結果
16687
		return $result;
16687
		return $result;
16688
	
16688
 
16689
		}#function bar end
16689
		}#function bar end
16690
 
16690
 
16691
	}#class form end
16691
	}#class form end
16692
 
16692
 
16693
?>
16693
?>