Completed
Push — master ( d6d0c3...7ff1b8 )
by Jean-Christophe
03:01
created
Ajax/common/traits/JqueryAjaxTrait.php 1 patch
Braces   +26 added lines, -19 removed lines patch added patch discarded remove patch
@@ -46,8 +46,9 @@  discard block
 block discarded – undo
46 46
 		}
47 47
 		$retour.="$.".$method."(url,".$params.").done(function( data ) {\n";
48 48
 		$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$jsCallback)."});\n";
49
-		if ($immediatly)
50
-			$this->jquery_code_for_compile[]=$retour;
49
+		if ($immediatly) {
50
+					$this->jquery_code_for_compile[]=$retour;
51
+		}
51 52
 			return $retour;
52 53
 	}
53 54
 
@@ -55,15 +56,17 @@  discard block
 block discarded – undo
55 56
 		$url=$this->_correctAjaxUrl($url);
56 57
 		$retour="url='".$url."';\n";
57 58
 		$slash="/";
58
-		if(JString::endswith($url, "/")===true)
59
-			$slash="";
59
+		if(JString::endswith($url, "/")===true) {
60
+					$slash="";
61
+		}
60 62
 		if(JString::isNotNull($attr)){
61
-			if ($attr==="value")
62
-				$retour.="url=url+'".$slash."'+$(this).val();\n";
63
-			elseif ($attr==="html")
64
-			$retour.="url=url+'".$slash."'+$(this).html();\n";
65
-			elseif($attr!=null && $attr!=="")
66
-					$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
63
+			if ($attr==="value") {
64
+							$retour.="url=url+'".$slash."'+$(this).val();\n";
65
+			} elseif ($attr==="html") {
66
+						$retour.="url=url+'".$slash."'+$(this).html();\n";
67
+			} elseif($attr!=null && $attr!=="") {
68
+								$retour.="url=url+'".$slash."'+($(this).attr('".$attr."')||'');\n";
69
+			}
67 70
 		}
68 71
 		return $retour;
69 72
 	}
@@ -85,8 +88,9 @@  discard block
 block discarded – undo
85 88
 	}
86 89
 
87 90
 	protected function _correctAjaxUrl($url) {
88
-		if ($url!=="/" && JString::endsWith($url, "/")===true)
89
-			$url=substr($url, 0, strlen($url)-1);
91
+		if ($url!=="/" && JString::endsWith($url, "/")===true) {
92
+					$url=substr($url, 0, strlen($url)-1);
93
+		}
90 94
 		if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) {
91 95
 			$url=$this->jsUtils->getUrl($url);
92 96
 		}
@@ -110,8 +114,9 @@  discard block
 block discarded – undo
110 114
 				$retour.="\t".$jsCallback."\n".
111 115
 						"\t$(document).trigger('jsonReady',[data]);\n".
112 116
 						"});\n";
113
-				if ($immediatly)
114
-					$this->jquery_code_for_compile[]=$retour;
117
+				if ($immediatly) {
118
+									$this->jquery_code_for_compile[]=$retour;
119
+				}
115 120
 					return $retour;
116 121
 	}
117 122
 
@@ -150,7 +155,7 @@  discard block
 block discarded – undo
150 155
 		if($context===null){
151 156
 			$appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n";
152 157
 			$newElm = "$('#'+newId)";
153
-		}else{
158
+		} else{
154 159
 			$appendTo="\t\tnewElm.appendTo(".$context.");\n";
155 160
 			$newElm = $context.".find('#'+newId)";
156 161
 		}
@@ -160,8 +165,9 @@  discard block
 block discarded – undo
160 165
 		$retour.="\t}\n"."\tfor(var key in value){\n"."\t\t\tvar html = $('<div />').append($(newElm).clone()).html();\n"."\t\t\tif(html.indexOf('[['+key+']]')>-1){\n"."\t\t\t\tcontent=$(html.split('[['+key+']]').join(value[key]));\n"."\t\t\t\t$(newElm).replaceWith(content);newElm=content;\n"."\t\t\t}\n"."\t\tvar sel='[data-id=\"'+key+'\"]';if($(sel,newElm).length){\n"."\t\t\tvar selElm=$(sel,newElm);\n"."\t\t\t if(selElm.is('[value]')) { selElm.attr('value',value[key]);selElm.val(value[key]);} else { selElm.html(value[key]); }\n"."\t\t}\n"."}\n"."\t$(newElm).show(true);"."\n"."\t$(newElm).removeClass('hide');"."});\n";
161 166
 		$retour.="\t$(document).trigger('jsonReady',[data]);\n";
162 167
 		$retour.="\t".$jsCallback."\n"."});\n";
163
-		if ($immediatly)
164
-			$this->jquery_code_for_compile[]=$retour;
168
+		if ($immediatly) {
169
+					$this->jquery_code_for_compile[]=$retour;
170
+		}
165 171
 			return $retour;
166 172
 	}
167 173
 	/**
@@ -202,8 +208,9 @@  discard block
 block discarded – undo
202 208
 			}});\n";
203 209
 			$retour.="$('#".$form."').submit();\n";
204 210
 		}
205
-		if ($immediatly)
206
-			$this->jquery_code_for_compile[]=$retour;
211
+		if ($immediatly) {
212
+					$this->jquery_code_for_compile[]=$retour;
213
+		}
207 214
 			return $retour;
208 215
 	}
209 216
 
Please login to merge, or discard this patch.
Ajax/semantic/widgets/datatable/DataTable.php 1 patch
Braces   +7 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,8 +66,9 @@  discard block
 block discarded – undo
66 66
 
67 67
 		$table->setRowCount(0, \sizeof($captions));
68 68
 		$table->setHeaderValues($captions);
69
-		if(isset($this->_compileParts))
70
-			$table->setCompileParts($this->_compileParts);
69
+		if(isset($this->_compileParts)) {
70
+					$table->setCompileParts($this->_compileParts);
71
+		}
71 72
 		if(isset($this->_searchField) && isset($js)){
72 73
 			$this->_searchField->postOn("change", $this->_urls,"{'s':$(this).val()}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith"]);
73 74
 		}
@@ -158,7 +159,7 @@  discard block
 block discarded – undo
158 159
 		$hasPart=$table->hasPart($part);
159 160
 		if($hasPart){
160 161
 			$row=$table->getPart($part)->addRow(\sizeof($captions));
161
-		}else{
162
+		} else{
162 163
 			$row=$table->getPart($part)->getRow(0);
163 164
 		}
164 165
 		$row->mergeCol();
@@ -282,8 +283,9 @@  discard block
 block discarded – undo
282 283
 	private function getDefaultButton($icon,$class=null){
283 284
 		$bt=$this->getFieldButton("");
284 285
 		$bt->asIcon($icon);
285
-		if(isset($class))
286
-			$bt->addToProperty("class", $class);
286
+		if(isset($class)) {
287
+					$bt->addToProperty("class", $class);
288
+		}
287 289
 		return $bt;
288 290
 	}
289 291
 
Please login to merge, or discard this patch.