Skip to content

Commit 9e563a9

Browse files
committed
Add JString::doubleBackSlashes
1 parent 731c7de commit 9e563a9

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

Ajax/semantic/widgets/datatable/DataTable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Ajax\semantic\html\collections\table\traits\TableTrait;
1414
use Ajax\semantic\html\collections\HtmlMessage;
1515
use Ajax\semantic\html\base\traits\BaseTrait;
16-
use Ubiquity\utils\base\UString;
16+
use Ajax\service\JString;
1717

1818
/**
1919
* DataTable widget for displaying list of objects
@@ -220,13 +220,13 @@ protected function _generatePagination($table){
220220

221221
protected function _associatePaginationBehavior(JsUtils $js=NULL,$offset=null){
222222
if(isset($this->_urls["refresh"])){
223-
$this->_pagination->getMenu()->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page'),'_model':'".UString::doubleBackSlashes($this->_model)."'}",$this->getRefreshSelector(),["preventDefault"=>false,"jqueryDone"=>"replaceWith","hasLoader"=>false,"jsCallback"=>'$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");']);
223+
$this->_pagination->getMenu()->postOnClick($this->_urls["refresh"],"{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}",$this->getRefreshSelector(),["preventDefault"=>false,"jqueryDone"=>"replaceWith","hasLoader"=>false,"jsCallback"=>'$("#'.$this->identifier.'").trigger("pageChange");$("#'.$this->identifier.'").trigger("activeRowChange");']);
224224
}
225225
}
226226

227227
protected function _compileSearchFieldBehavior(JsUtils $js=NULL){
228228
if(isset($this->_searchField) && isset($js) && isset($this->_urls["refresh"])){
229-
$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(self).val(),'_model':'".UString::doubleBackSlashes($this->_model)."'}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith","hasLoader"=>"internal","jsCallback"=>'$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);']);
229+
$this->_searchField->postOn("change", $this->_urls["refresh"],"{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}","#".$this->identifier." tbody",["preventDefault"=>false,"jqueryDone"=>"replaceWith","hasLoader"=>"internal","jsCallback"=>'$("#'.$this->identifier.'").trigger("searchTerminate",[$(self).val()]);']);
230230
}
231231
}
232232
protected function _associateSearchFieldBehavior(JsUtils $js=NULL,$offset=null){

Ajax/semantic/widgets/datatable/JsonDataTable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Ajax\common\html\BaseHtml;
77
use Ajax\service\AjaxCall;
88
use Ajax\JsUtils;
9-
use Ubiquity\utils\base\UString;
9+
use Ajax\service\JString;
1010

1111
/**
1212
* @author jc
@@ -59,7 +59,7 @@ protected function _associatePaginationBehavior(JsUtils $js=NULL,$offset=null){
5959
$callback.=$js->trigger("#".$id." [name='selection[]']","change",false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js));
6060
$callback.=$this->_generatePaginationScript($id);
6161
if(isset($this->_urls["refresh"])){
62-
$js->jsonArrayOn("click", "#".$menu->getIdentifier()." a","#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"],"post",["params"=>"{'p':$(this).attr('data-page'),'_model':'".UString::doubleBackSlashes($this->_model)."'}","jsCallback"=>$callback]);
62+
$js->jsonArrayOn("click", "#".$menu->getIdentifier()." a","#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"],"post",["params"=>"{'p':$(this).attr('data-page'),'_model':'".JString::doubleBackSlashes($this->_model)."'}","jsCallback"=>$callback]);
6363
}
6464
}
6565

@@ -94,7 +94,7 @@ protected function _associateSearchFieldBehavior(JsUtils $js=NULL,$offset=null){
9494
$callback=$js->getScript($offset).$this->getHtmlComponent()->getInnerScript();
9595
$callback.=$js->trigger("#".$id." [name='selection[]']","change",false)."$('#".$id." tbody .ui.checkbox').checkbox();".$js->execOn("change", "#".$id." [name='selection[]']", $this->_getCheckedChange($js));
9696
$callback.="$('#pagination-{$id}').hide();$('#".$this->identifier."').trigger('searchTerminate',[$(self).val()]);";
97-
$js->jsonArrayOn("change", "#".$this->_searchField->getDataField()->getIdentifier(),"#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"],"post",["params"=>"{'s':$(self).val(),'_model':'".UString::doubleBackSlashes($this->_model)."'}","jsCallback"=>$callback]);
97+
$js->jsonArrayOn("change", "#".$this->_searchField->getDataField()->getIdentifier(),"#".$this->_identifier." tr.".$this->_modelClass, $this->_urls["refresh"],"post",["params"=>"{'s':$(self).val(),'_model':'".JString::doubleBackSlashes($this->_model)."'}","jsCallback"=>$callback]);
9898
}
9999
}
100100

Ajax/service/JString.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ public static function getValueBetween(&$str,$before="{{",$after="}}"){
6262
}
6363
return $result;
6464
}
65+
66+
public static function doubleBackSlashes($value){
67+
if(is_string($value))
68+
return str_replace("\\", "\\\\", $value);
69+
return $value;
70+
}
6571

6672
public static function cleanIdentifier($id) {
6773
return preg_replace('/[^a-zA-Z0-9\-]/s', '', $id);

0 commit comments

Comments
 (0)