Skip to content

Commit ef9455d

Browse files
committed
postForm header bug fixed
1 parent ab06fe6 commit ef9455d

File tree

6 files changed

+44
-8
lines changed

6 files changed

+44
-8
lines changed

Ajax/common/traits/JsUtilsAjaxTrait.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ protected function _ajax($method,$url,$responseElement="",$parameters=[]) {
4343
$ajaxParameters["data"]=self::_correctParams($params);
4444
}
4545
if(isset($headers)){
46-
$ajaxParameters["headers"]=$this->_correctParams($headers);
46+
$ajaxParameters["headers"]=$headers;
4747
}
4848
$this->createAjaxParameters($ajaxParameters, $parameters);
4949
$retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data, textStatus, jqXHR ) {\n";
@@ -512,10 +512,12 @@ private function _postForm($url, $form, $responseElement, $parameters=[]) {
512512
if($hasLoader===true){
513513
$this->addLoading($retour, $responseElement);
514514
}
515-
$strHeaders="";
516-
if(isset($headers))
517-
$strHeaders=", 'headers: '".self::_correctParams($headers);
518-
$retour.="$.ajax({'url':url,'data':params,'method':'POST'".$strHeaders."}).done(function( data ) {\n";
515+
$ajaxParameters=["url"=>"url","method"=>"'POST'","data"=>"params"];
516+
if(isset($headers)){
517+
$ajaxParameters["headers"]=$headers;
518+
}
519+
$this->createAjaxParameters($ajaxParameters, $parameters);
520+
$retour.="$.ajax({".$this->implodeAjaxParameters($ajaxParameters)."}).done(function( data ) {\n";
519521
$retour.=$this->_getOnAjaxDone($responseElement, $jqueryDone,$ajaxTransition,$jsCallback)."});\n";
520522

521523
if ($validation) {

Ajax/semantic/html/collections/HtmlMessage.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ public function setHeader($header){
4949
public function setIcon($icon){
5050
$this->addToProperty("class", "icon");
5151
$this->wrapContent("<div class='content'>","</div>");
52-
$this->icon=new HtmlIcon("icon-".$this->identifier, $icon);
52+
if(\is_string($icon)){
53+
$this->icon=new HtmlIcon("icon-".$this->identifier, $icon);
54+
}else{
55+
$this->icon=$icon;
56+
}
5357
return $this;
5458
}
5559

Ajax/semantic/html/collections/form/HtmlFormDropdown.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,27 @@ public static function multipleDropdown($identifier,$items=array(), $label=NULL,
2222
return new HtmlFormDropdown($identifier,$items,$label,$value,true,$associative);
2323
}
2424

25+
/**
26+
* @return HtmlDropdown
27+
*/
2528
public function getDataField(){
2629
return $this->getField()->getInput();
2730
}
2831
public function asSelect($name=NULL,$multiple=false,$selection=true){
2932
$this->getField()->asSelect($name,$multiple,$selection);
3033
return $this;
3134
}
35+
36+
/**
37+
* @param boolean $floating
38+
* @return HtmlDropdown
39+
*/
40+
public function asButton($floating=false){
41+
$field=$this->content["field"];
42+
$label=$this->content["label"];
43+
$field->addContent($label);
44+
$this->content=["field"=>$field];
45+
$this->content["field"]->asButton($floating);
46+
return $this->content["field"];
47+
}
3248
}

Ajax/semantic/html/collections/form/traits/FieldsTrait.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ public function addButton($identifier,$value,$cssStyle=NULL,$onClick=NULL){
134134
return $this->addItem(new HtmlButton($identifier,$value,$cssStyle,$onClick));
135135
}
136136

137+
/**
138+
* @param string $identifier
139+
* @param string $label
140+
* @param string $value
141+
* @param string $type
142+
* @return HtmlFormCheckbox
143+
*/
137144
public function addCheckbox($identifier, $label=NULL,$value=NULL,$type=NULL){
138145
return $this->addItem(new HtmlFormCheckbox($identifier,$label,$value,$type));
139146
}

Ajax/semantic/html/elements/HtmlIconGroups.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,9 @@ public function toCorner($index=1) {
5151
$this->getItem($index)->toCorner();
5252
return $this;
5353
}
54+
55+
public static function corner($mainIcon,$cornerIcon,$size="huge"){
56+
$icons=new HtmlIconGroups("icons",[$mainIcon,$cornerIcon],$size);
57+
return $icons->toCorner(1);
58+
}
5459
}

Ajax/semantic/html/modules/HtmlTab.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
class HtmlTab extends HtmlSemCollection{
1818

19-
protected $params=array("debug"=>true);
19+
protected $params=[];
2020

2121
public function __construct( $identifier, $tabs=array()){
2222
parent::__construct( $identifier, "div", "");
@@ -41,7 +41,9 @@ protected function createItem($value){
4141
$menuItem=$this->content["menu"]->addItem($title);
4242
$menuItem->addToProperty("data-tab", $menuItem->getIdentifier());
4343
$menuItem->removeProperty("href");
44-
return $this->createSegment($count, $content, $menuItem->getIdentifier());
44+
$result=$this->createSegment($count, $content, $menuItem->getIdentifier());
45+
$result->menuTab=$menuItem;
46+
return $result;
4547
}
4648

4749
/**

0 commit comments

Comments
 (0)