@@ -420,8 +420,9 @@ discard block |
||
420 | 420 | $element=$this->_prep_element($element); |
421 | 421 | $value=$this->_prep_value($value); |
422 | 422 | $str="$({$element}).after({$value});"; |
423 | - if ($immediatly) |
|
424 | - $this->jquery_code_for_compile[]=$str; |
|
423 | + if ($immediatly) { |
|
424 | + $this->jquery_code_for_compile[]=$str; |
|
425 | + } |
|
425 | 426 | return $str; |
426 | 427 | } |
427 | 428 | |
@@ -437,10 +438,12 @@ discard block |
||
437 | 438 | if (isset($value)) { |
438 | 439 | $value=$this->_prep_value($value); |
439 | 440 | $str="$({$element}).attr(\"$attributeName\",{$value});"; |
440 | - } else |
|
441 | - $str="$({$element}).attr(\"$attributeName\");"; |
|
442 | - if ($immediatly) |
|
443 | - $this->jquery_code_for_compile[]=$str; |
|
441 | + } else { |
|
442 | + $str="$({$element}).attr(\"$attributeName\");"; |
|
443 | + } |
|
444 | + if ($immediatly) { |
|
445 | + $this->jquery_code_for_compile[]=$str; |
|
446 | + } |
|
444 | 447 | return $str; |
445 | 448 | } |
446 | 449 | |
@@ -456,10 +459,12 @@ discard block |
||
456 | 459 | if (isset($param)) { |
457 | 460 | $param=$this->_prep_value($param); |
458 | 461 | $str="$({$element}).{$jQueryCall}({$param});"; |
459 | - } else |
|
460 | - $str="$({$element}).{$jQueryCall}();"; |
|
461 | - if ($immediatly) |
|
462 | - $this->jquery_code_for_compile[]=$str; |
|
462 | + } else { |
|
463 | + $str="$({$element}).{$jQueryCall}();"; |
|
464 | + } |
|
465 | + if ($immediatly) { |
|
466 | + $this->jquery_code_for_compile[]=$str; |
|
467 | + } |
|
463 | 468 | return $str; |
464 | 469 | } |
465 | 470 | /** |
@@ -474,8 +479,9 @@ discard block |
||
474 | 479 | $to=$this->_prep_element($to); |
475 | 480 | $element=$this->_prep_element($element); |
476 | 481 | $str="$({$to}).{$jQueryCall}({$element});"; |
477 | - if ($immediatly) |
|
478 | - $this->jquery_code_for_compile[]=$str; |
|
482 | + if ($immediatly) { |
|
483 | + $this->jquery_code_for_compile[]=$str; |
|
484 | + } |
|
479 | 485 | return $str; |
480 | 486 | } |
481 | 487 | // -------------------------------------------------------------------- |
@@ -512,8 +518,9 @@ discard block |
||
512 | 518 | |
513 | 519 | $str="$({$element}).animate({\n$animations\n\t\t}".$speed.$extra.");"; |
514 | 520 | |
515 | - if ($immediatly) |
|
516 | - $this->jquery_code_for_compile[]=$str; |
|
521 | + if ($immediatly) { |
|
522 | + $this->jquery_code_for_compile[]=$str; |
|
523 | + } |
|
517 | 524 | return $str; |
518 | 525 | } |
519 | 526 | |
@@ -538,8 +545,9 @@ discard block |
||
538 | 545 | |
539 | 546 | $str="$({$element}).fadeIn({$speed}{$callback});"; |
540 | 547 | |
541 | - if ($immediatly) |
|
542 | - $this->jquery_code_for_compile[]=$str; |
|
548 | + if ($immediatly) { |
|
549 | + $this->jquery_code_for_compile[]=$str; |
|
550 | + } |
|
543 | 551 | return $str; |
544 | 552 | } |
545 | 553 | |
@@ -564,8 +572,9 @@ discard block |
||
564 | 572 | |
565 | 573 | $str="$({$element}).fadeOut({$speed}{$callback});"; |
566 | 574 | |
567 | - if ($immediatly) |
|
568 | - $this->jquery_code_for_compile[]=$str; |
|
575 | + if ($immediatly) { |
|
576 | + $this->jquery_code_for_compile[]=$str; |
|
577 | + } |
|
569 | 578 | return $str; |
570 | 579 | } |
571 | 580 | |
@@ -590,8 +599,9 @@ discard block |
||
590 | 599 | |
591 | 600 | $str="$({$element}).hide({$speed}{$callback});"; |
592 | 601 | |
593 | - if ($immediatly) |
|
594 | - $this->jquery_code_for_compile[]=$str; |
|
602 | + if ($immediatly) { |
|
603 | + $this->jquery_code_for_compile[]=$str; |
|
604 | + } |
|
595 | 605 | return $str; |
596 | 606 | } |
597 | 607 | |
@@ -618,8 +628,9 @@ discard block |
||
618 | 628 | |
619 | 629 | $str="$({$element}).slideUp({$speed}{$callback});"; |
620 | 630 | |
621 | - if ($immediatly) |
|
622 | - $this->jquery_code_for_compile[]=$str; |
|
631 | + if ($immediatly) { |
|
632 | + $this->jquery_code_for_compile[]=$str; |
|
633 | + } |
|
623 | 634 | return $str; |
624 | 635 | } |
625 | 636 | |
@@ -644,8 +655,9 @@ discard block |
||
644 | 655 | |
645 | 656 | $str="$({$element}).slideDown({$speed}{$callback});"; |
646 | 657 | |
647 | - if ($immediatly) |
|
648 | - $this->jquery_code_for_compile[]=$str; |
|
658 | + if ($immediatly) { |
|
659 | + $this->jquery_code_for_compile[]=$str; |
|
660 | + } |
|
649 | 661 | return $str; |
650 | 662 | } |
651 | 663 | |
@@ -670,8 +682,9 @@ discard block |
||
670 | 682 | |
671 | 683 | $str="$({$element}).slideToggle({$speed}{$callback});"; |
672 | 684 | |
673 | - if ($immediatly) |
|
674 | - $this->jquery_code_for_compile[]=$str; |
|
685 | + if ($immediatly) { |
|
686 | + $this->jquery_code_for_compile[]=$str; |
|
687 | + } |
|
675 | 688 | return $str; |
676 | 689 | } |
677 | 690 | |
@@ -688,8 +701,9 @@ discard block |
||
688 | 701 | $element=$this->_prep_element($element); |
689 | 702 | $str="$({$element}).toggle();"; |
690 | 703 | |
691 | - if ($immediatly) |
|
692 | - $this->jquery_code_for_compile[]=$str; |
|
704 | + if ($immediatly) { |
|
705 | + $this->jquery_code_for_compile[]=$str; |
|
706 | + } |
|
693 | 707 | return $str; |
694 | 708 | } |
695 | 709 | |
@@ -705,8 +719,9 @@ discard block |
||
705 | 719 | $element=$this->_prep_element($element); |
706 | 720 | $str="$({$element}).trigger(\"$event\");"; |
707 | 721 | |
708 | - if ($immediatly) |
|
709 | - $this->jquery_code_for_compile[]=$str; |
|
722 | + if ($immediatly) { |
|
723 | + $this->jquery_code_for_compile[]=$str; |
|
724 | + } |
|
710 | 725 | return $str; |
711 | 726 | } |
712 | 727 | |
@@ -731,8 +746,9 @@ discard block |
||
731 | 746 | |
732 | 747 | $str="$({$element}).show({$speed}{$callback});"; |
733 | 748 | |
734 | - if ($immediatly) |
|
735 | - $this->jquery_code_for_compile[]=$str; |
|
749 | + if ($immediatly) { |
|
750 | + $this->jquery_code_for_compile[]=$str; |
|
751 | + } |
|
736 | 752 | return $str; |
737 | 753 | } |
738 | 754 | |
@@ -750,8 +766,9 @@ discard block |
||
750 | 766 | $str.="else{".$jsCodeIfFalse."}"; |
751 | 767 | } |
752 | 768 | |
753 | - if ($immediatly) |
|
754 | - $this->jquery_code_for_compile[]=$str; |
|
769 | + if ($immediatly) { |
|
770 | + $this->jquery_code_for_compile[]=$str; |
|
771 | + } |
|
755 | 772 | return $str; |
756 | 773 | } |
757 | 774 | |
@@ -817,10 +834,11 @@ discard block |
||
817 | 834 | if ($stopPropagation===true) { |
818 | 835 | $js="event.stopPropagation();\n".$js; |
819 | 836 | } |
820 | - if (array_search($event, $this->jquery_events)===false) |
|
821 | - $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
822 | - else |
|
823 | - $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
837 | + if (array_search($event, $this->jquery_events)===false) { |
|
838 | + $event="\n\t$(".$this->_prep_element($element).").bind('{$event}',function(event){\n\t\t{$js}\n\t});\n"; |
|
839 | + } else { |
|
840 | + $event="\n\t$(".$this->_prep_element($element).").{$event}(function(event){\n\t\t{$js}\n\t});\n"; |
|
841 | + } |
|
824 | 842 | $this->jquery_code_for_compile[]=$event; |
825 | 843 | return $event; |
826 | 844 | } |
@@ -870,8 +888,9 @@ discard block |
||
870 | 888 | |
871 | 889 | $output=($script_tags===FALSE) ? $script : $this->inline($script); |
872 | 890 | |
873 | - if ($view!=NULL) |
|
874 | - $view->setVar($view_var, $output); |
|
891 | + if ($view!=NULL) { |
|
892 | + $view->setVar($view_var, $output); |
|
893 | + } |
|
875 | 894 | return $output; |
876 | 895 | } |
877 | 896 | |
@@ -994,8 +1013,9 @@ discard block |
||
994 | 1013 | } |
995 | 1014 | $retour.="$.".$method."(url,".$params.").done(function( data ) {\n"; |
996 | 1015 | $retour.=$this->_getOnAjaxDone($responseElement, $jsCallback)."});\n"; |
997 | - if ($immediatly) |
|
998 | - $this->jquery_code_for_compile[]=$retour; |
|
1016 | + if ($immediatly) { |
|
1017 | + $this->jquery_code_for_compile[]=$retour; |
|
1018 | + } |
|
999 | 1019 | return $retour; |
1000 | 1020 | } |
1001 | 1021 | |
@@ -1003,13 +1023,15 @@ discard block |
||
1003 | 1023 | $url=$this->_correctAjaxUrl($url); |
1004 | 1024 | $retour="url='".$url."';\n"; |
1005 | 1025 | $slash="/"; |
1006 | - if(PhalconUtils::endsWith($url, "/")) |
|
1007 | - $slash=""; |
|
1026 | + if(PhalconUtils::endsWith($url, "/")) { |
|
1027 | + $slash=""; |
|
1028 | + } |
|
1008 | 1029 | if(JString::isNotNull($attr)){ |
1009 | - if ($attr=="value") |
|
1010 | - $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
1011 | - else if($attr!=null && $attr!=="") |
|
1012 | - $retour.="url=url+'".$slash."'+$(this).attr('".$attr."');\n"; |
|
1030 | + if ($attr=="value") { |
|
1031 | + $retour.="url=url+'".$slash."'+$(this).val();\n"; |
|
1032 | + } else if($attr!=null && $attr!=="") { |
|
1033 | + $retour.="url=url+'".$slash."'+$(this).attr('".$attr."');\n"; |
|
1034 | + } |
|
1013 | 1035 | } |
1014 | 1036 | return $retour; |
1015 | 1037 | } |
@@ -1031,8 +1053,9 @@ discard block |
||
1031 | 1053 | } |
1032 | 1054 | |
1033 | 1055 | protected function _correctAjaxUrl($url) { |
1034 | - if (PhalconUtils::endsWith($url, "/")) |
|
1035 | - $url=substr($url, 0, strlen($url)-1); |
|
1056 | + if (PhalconUtils::endsWith($url, "/")) { |
|
1057 | + $url=substr($url, 0, strlen($url)-1); |
|
1058 | + } |
|
1036 | 1059 | if (strncmp($url, 'http://', 7)!=0&&strncmp($url, 'https://', 8)!=0) { |
1037 | 1060 | $url=$this->_di->get("url")->get($url); |
1038 | 1061 | } |
@@ -1054,8 +1077,9 @@ discard block |
||
1054 | 1077 | ."if($('#'+key,".$context.").length){ if($('#'+key,".$context.").is('[value]')) { $('#'+key,".$context.").val(data[key]);} else { $('#'+key,".$context.").html(data[key]); }}};\n"; |
1055 | 1078 | $retour.="\t".$jsCallback."\n |
1056 | 1079 | });\n"; |
1057 | - if ($immediatly) |
|
1058 | - $this->jquery_code_for_compile[]=$retour; |
|
1080 | + if ($immediatly) { |
|
1081 | + $this->jquery_code_for_compile[]=$retour; |
|
1082 | + } |
|
1059 | 1083 | return $retour; |
1060 | 1084 | } |
1061 | 1085 | |
@@ -1092,7 +1116,7 @@ discard block |
||
1092 | 1116 | if($context==null){ |
1093 | 1117 | $appendTo="\t\tnewElm.appendTo($('".$maskSelector."').parent());\n"; |
1094 | 1118 | $newElm = "$('#'+newId)"; |
1095 | - }else{ |
|
1119 | + } else{ |
|
1096 | 1120 | $appendTo="\t\tnewElm.appendTo(".$context.");\n"; |
1097 | 1121 | $newElm = $context.".find('#'+newId)"; |
1098 | 1122 | } |
@@ -1102,8 +1126,9 @@ discard block |
||
1102 | 1126 | $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"; |
1103 | 1127 | |
1104 | 1128 | $retour.="\t".$jsCallback."\n"."});\n"; |
1105 | - if ($immediatly) |
|
1106 | - $this->jquery_code_for_compile[]=$retour; |
|
1129 | + if ($immediatly) { |
|
1130 | + $this->jquery_code_for_compile[]=$retour; |
|
1131 | + } |
|
1107 | 1132 | return $retour; |
1108 | 1133 | } |
1109 | 1134 | /** |
@@ -1143,8 +1168,9 @@ discard block |
||
1143 | 1168 | }});\n"; |
1144 | 1169 | $retour.="$('#".$form."').submit();\n"; |
1145 | 1170 | } |
1146 | - if ($immediatly) |
|
1147 | - $this->jquery_code_for_compile[]=$retour; |
|
1171 | + if ($immediatly) { |
|
1172 | + $this->jquery_code_for_compile[]=$retour; |
|
1173 | + } |
|
1148 | 1174 | return $retour; |
1149 | 1175 | } |
1150 | 1176 | |
@@ -1220,11 +1246,13 @@ discard block |
||
1220 | 1246 | public function _doJQuery($element, $jqueryCall, $param="", $jsCallback="", $immediatly=false) { |
1221 | 1247 | $param=$this->_prep_value($param); |
1222 | 1248 | $callback=""; |
1223 | - if ($jsCallback!="") |
|
1224 | - $callback=", function(event){\n{$jsCallback}\n}"; |
|
1249 | + if ($jsCallback!="") { |
|
1250 | + $callback=", function(event){\n{$jsCallback}\n}"; |
|
1251 | + } |
|
1225 | 1252 | $script="$(".$this->_prep_element($element).").".$jqueryCall."(".$param.$callback.");\n"; |
1226 | - if ($immediatly) |
|
1227 | - $this->jquery_code_for_compile[]=$script; |
|
1253 | + if ($immediatly) { |
|
1254 | + $this->jquery_code_for_compile[]=$script; |
|
1255 | + } |
|
1228 | 1256 | return $script; |
1229 | 1257 | } |
1230 | 1258 | |
@@ -1252,8 +1280,9 @@ discard block |
||
1252 | 1280 | */ |
1253 | 1281 | public function _exec($js, $immediatly=false) { |
1254 | 1282 | $script=$js."\n"; |
1255 | - if ($immediatly) |
|
1256 | - $this->jquery_code_for_compile[]=$script; |
|
1283 | + if ($immediatly) { |
|
1284 | + $this->jquery_code_for_compile[]=$script; |
|
1285 | + } |
|
1257 | 1286 | return $script; |
1258 | 1287 | } |
1259 | 1288 |