diff options
Diffstat (limited to 'codebase')
-rw-r--r-- | codebase/combo_connector.php | 2 | ||||
-rw-r--r-- | codebase/crosslink_connector.php | 2 | ||||
-rw-r--r-- | codebase/data_connector.php | 16 | ||||
-rw-r--r-- | codebase/db_common.php | 22 | ||||
-rw-r--r-- | codebase/db_pdo.php | 25 | ||||
-rw-r--r-- | codebase/db_phpcake.php | 139 | ||||
-rw-r--r-- | codebase/db_phpcake2.php | 85 | ||||
-rw-r--r-- | codebase/db_phpci.php | 16 | ||||
-rw-r--r-- | codebase/db_phpci2.php | 65 | ||||
-rw-r--r-- | codebase/db_phpyii.php | 168 | ||||
-rw-r--r-- | codebase/db_phpyii1.php | 91 | ||||
-rw-r--r-- | codebase/gantt_connector.php | 10 | ||||
-rw-r--r-- | codebase/grid_connector.php | 11 | ||||
-rw-r--r-- | codebase/strategy.php | 4 | ||||
-rw-r--r-- | codebase/tree_connector.php | 5 | ||||
-rw-r--r-- | codebase/treedatamultitable_connector.php | 2 | ||||
-rw-r--r-- | codebase/treegrid_connector.php | 3 | ||||
-rw-r--r-- | codebase/treegridmultitable_connector.php | 1 | ||||
-rw-r--r-- | codebase/treemultitable_connector.php | 2 |
19 files changed, 489 insertions, 180 deletions
diff --git a/codebase/combo_connector.php b/codebase/combo_connector.php index ad28017..0e2fb85 100644 --- a/codebase/combo_connector.php +++ b/codebase/combo_connector.php @@ -25,7 +25,7 @@ class ComboDataItem extends DataItem{ function to_xml_start(){ if ($this->skip) return ""; - return "<option ".($this->selected?"selected='true' ":"")."value='".$this->get_id()."'><![CDATA[".$this->data[$this->config->text[0]["name"]]."]]>"; + return "<option ".($this->selected?"selected='true' ":"")."value='".$this->xmlentities($this->get_id())."'><![CDATA[".$this->data[$this->config->text[0]["name"]]."]]>"; } /*! return self as XML string, ending part */ diff --git a/codebase/crosslink_connector.php b/codebase/crosslink_connector.php index 22ad83d..7d5c74c 100644 --- a/codebase/crosslink_connector.php +++ b/codebase/crosslink_connector.php @@ -97,7 +97,7 @@ class CrossOptionsConnector extends Connector{ public function afterProcessing($action){ $status = $action->get_status(); - $master_key = $action->get_value($this->master_name); + $master_key = $action->get_id();//value($this->master_name); $link_key = $action->get_value($this->link_name); $link_key = explode(',', $link_key); diff --git a/codebase/data_connector.php b/codebase/data_connector.php index 7c9251d..165cc0f 100644 --- a/codebase/data_connector.php +++ b/codebase/data_connector.php @@ -277,6 +277,8 @@ class JSONCommonDataItem extends DataItem{ for ($i=0; $i<sizeof($this->config->text); $i++){ $extra = $this->config->text[$i]["name"]; $data[$extra]=$this->data[$extra]; + if (is_null($data[$extra])) + $data[$extra] = ""; } if ($this->userdata !== false) @@ -366,6 +368,7 @@ class TreeCommonDataItem extends CommonDataItem{ class TreeDataConnector extends DataConnector{ protected $parent_name = 'parent'; + public $rootId = "0"; /*! constructor @@ -395,7 +398,7 @@ class TreeDataConnector extends DataConnector{ if (isset($_GET[$this->parent_name])) $this->request->set_relation($_GET[$this->parent_name]); else - $this->request->set_relation("0"); + $this->request->set_relation($this->rootId); $this->request->set_limit(0,0); //netralize default reaction on dyn. loading mode } @@ -403,7 +406,10 @@ class TreeDataConnector extends DataConnector{ /*! renders self as xml, starting part */ protected function xml_start(){ - $attributes = " parent='".$this->request->get_relation()."' "; + $attributes = " "; + if (!$this->rootId || $this->rootId != $this->request->get_relation()) + $attributes = " parent='".$this->request->get_relation()."' "; + foreach($this->attributes as $k=>$v) $attributes .= " ".$k."='".$v."'"; @@ -426,7 +432,9 @@ class JSONTreeDataConnector extends TreeDataConnector{ if ($this->simple) return $result; $data = array(); - $data["parent"] = $this->request->get_relation(); + if (!$this->rootId || $this->rootId != $this->request->get_relation()) + $data["parent"] = $this->request->get_relation(); + $data["data"] = $result; $this->fill_collections(); @@ -517,4 +525,4 @@ class JSONTreeCommonDataItem extends TreeCommonDataItem{ } -?>
\ No newline at end of file +?> diff --git a/codebase/db_common.php b/codebase/db_common.php index e2f521e..f6391d2 100644 --- a/codebase/db_common.php +++ b/codebase/db_common.php @@ -523,7 +523,7 @@ abstract class DataWrapper{ @param config DataConfig instance */ - public function __construct($connection,$config){ + public function __construct($connection = false,$config = false){ $this->config=$config; $this->connection=$connection; } @@ -793,13 +793,20 @@ abstract class DBDataWrapper extends DataWrapper{ for ($i=0; $i < sizeof($rules); $i++) if (is_string($rules[$i])) array_push($sql,"(".$rules[$i].")"); - else - if ($rules[$i]["value"]!=""){ - if (!$rules[$i]["operation"]) - array_push($sql,$this->escape_name($rules[$i]["name"])." LIKE '%".$this->escape($rules[$i]["value"])."%'"); - else - array_push($sql,$this->escape_name($rules[$i]["name"])." ".$rules[$i]["operation"]." '".$this->escape($rules[$i]["value"])."'"); + else { + $filtervalue = $rules[$i]["value"]; + $filteroperation = $rules[$i]["operation"]; + if ($filtervalue!=""){ + if (!$filteroperation) + array_push($sql,$this->escape_name($rules[$i]["name"])." LIKE '%".$this->escape($filtervalue)."%'"); + else { + if ($filteroperation != "IN") + $filtervalue = "'".$this->escape($filtervalue)."'"; + + array_push($sql,$this->escape_name($rules[$i]["name"])." ".$filteroperation." ".$filtervalue); + } } + } if ($relation !== false && $relation !== ""){ $relsql = $this->escape_name($this->config->relation_id["db_name"])." = '".$this->escape($relation)."'"; @@ -1053,6 +1060,7 @@ class ArrayDBDataWrapper extends DBDataWrapper{ } $relation_id = $this->config->relation_id["db_name"]; + $result = array(); for ($i = 0; $i < count($this->connection); $i++) { $item = $this->connection[$i]; diff --git a/codebase/db_pdo.php b/codebase/db_pdo.php index d1ad4d8..1417462 100644 --- a/codebase/db_pdo.php +++ b/codebase/db_pdo.php @@ -39,6 +39,31 @@ class PDODBDataWrapper extends DBDataWrapper{ return $sql; } + public function tables_list() { + $result = $this->query("SHOW TABLES"); + if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection)); + + $tables = array(); + while ($table = $result->next()) { + $tables[] = $table[0]; + } + return $tables; + } + + public function fields_list($table) { + $result = $this->query("SHOW COLUMNS FROM `".$table."`"); + if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection)); + + $fields = array(); + $id = ""; + while ($field = $result->next()) { + if ($field['Key'] == "PRI") + $id = $field["Field"]; + else + $fields[] = $field["Field"]; + } + return array("fields" => $fields, "key" => $id ); + } public function get_next($res){ $data = $res->next(); diff --git a/codebase/db_phpcake.php b/codebase/db_phpcake.php index 97d94eb..92b5134 100644 --- a/codebase/db_phpcake.php +++ b/codebase/db_phpcake.php @@ -11,75 +11,76 @@ require_once("db_common.php"); if you plan to use it for Oracle - use Oracle connection type instead **/ -class PHPCakeDBDataWrapper extends ArrayDBDataWrapper{ - public function select($sql){ - $source = $sql->get_source(); - if (is_array($source)) //result of find - $res = $source; - else - $res = $this->connection->find("all"); - - if (sizeof($res)){ - $name = get_class($this->connection); - $temp = array(); - for ($i=sizeof($res)-1; $i>=0; $i--) - $temp[]=&$res[$i][$name]; - } - return new ArrayQueryWrapper($temp); - } - - protected function getErrorMessage(){ - $errors = $this->connection->invalidFields(); - $text = array(); - foreach ($errors as $key => $value){ - $text[] = $key." - ".$value[0]; - } - return implode("\n", $text); - } - - public function insert($data,$source){ - $name = get_class($this->connection); - $save = array(); - $temp_data = $data->get_data(); - unset($temp_data[$this->config->id['db_name']]); - unset($temp_data["!nativeeditor_status"]); - $save[$name] = $temp_data; - - if ($this->connection->save($save)){ - $data->success($this->connection->getLastInsertID()); - } else { - $data->set_response_attribute("details", $this->getErrorMessage()); - $data->invalid(); - } - } - public function delete($data,$source){ - $id = $data->get_id(); - $this->connection->delete($id); - $data->success(); - } - public function update($data,$source){ - $name = get_class($this->connection); - $save = array(); - $save[$name] = &$data->get_data(); - - if ($this->connection->save($save)){ - $data->success(); - } else { - $data->set_response_attribute("details", $this->getErrorMessage()); - $data->invalid(); - } - } - - - public function escape($str){ - throw new Exception("Not implemented"); - } - public function query($str){ - throw new Exception("Not implemented"); - } - public function get_new_id(){ - throw new Exception("Not implemented"); - } +class PHPCakeDBDataWrapper extends ArrayDBDataWrapper { + + public function select($source) { + $sourceData = $source->get_source(); + if(is_array($sourceData)) //result of find + $query = $sourceData; + else + $query = $sourceData->find("all"); + + $temp = array(); + foreach($query as $row) + $temp[] = $row->toArray(); + + return new ArrayQueryWrapper($temp); + } + + protected function getErrorMessage() { + $errors = $this->connection->invalidFields(); + $text = array(); + foreach ($errors as $key => $value){ + $text[] = $key." - ".$value[0]; + } + return implode("\n", $text); + } + + public function insert($data, $source) { + $sourceData = $source->get_source(); + $obj = $sourceData->newEntity(); + $obj = $this->fillModel($obj, $data); + $savedResult = $source->get_source()->save($obj); + $data->success($savedResult->get($this->config->id["db_name"])); + } + + public function delete($data, $source) { + $sourceData = $source->get_source(); + $obj = $sourceData->get($data->get_id()); + $source->get_source()->delete($obj); + } + + public function update($data, $source) { + $sourceData = $source->get_source(); + $obj = $sourceData->get($data->get_id()); + $obj = $this->fillModel($obj, $data); + $sourceData->save($obj); + } + + private function fillModel($obj, $data) { + //Map data to model object. + for($i = 0; $i < count($this->config->text); $i++) { + $step=$this->config->text[$i]; + $obj->set($step["name"], $data->get_value($step["name"])); + } + + if($relation = $this->config->relation_id["db_name"]) + $obj->set($relation, $data->get_value($relation)); + + return $obj; + } + + public function escape($str){ + throw new Exception("Not implemented"); + } + + public function query($str){ + throw new Exception("Not implemented"); + } + + public function get_new_id(){ + throw new Exception("Not implemented"); + } } ?>
\ No newline at end of file diff --git a/codebase/db_phpcake2.php b/codebase/db_phpcake2.php new file mode 100644 index 0000000..76a941d --- /dev/null +++ b/codebase/db_phpcake2.php @@ -0,0 +1,85 @@ +<?php +/* + @author dhtmlx.com + @license GPL, see license.txt +*/ +require_once("db_common.php"); + +//DataProcessor::$action_param ="dhx_editor_status"; + +/*! Implementation of DataWrapper for PDO + +if you plan to use it for Oracle - use Oracle connection type instead +**/ +class PHPCake2DBDataWrapper extends ArrayDBDataWrapper{ + public function select($sql){ + $source = $sql->get_source(); + if (is_array($source)) //result of find + $res = $source; + else + $res = $this->connection->find("all"); + + $temp = array(); + if (sizeof($res)){ + $name = get_class($this->connection); + for ($i=sizeof($res)-1; $i>=0; $i--) + $temp[]=&$res[$i][$name]; + } + return new ArrayQueryWrapper($temp); + } + + protected function getErrorMessage(){ + $errors = $this->connection->invalidFields(); + $text = array(); + foreach ($errors as $key => $value){ + $text[] = $key." - ".$value[0]; + } + return implode("\n", $text); + } + + public function insert($data,$source){ + $name = get_class($this->connection); + $save = array(); + $temp_data = $data->get_data(); + unset($temp_data[$this->config->id['db_name']]); + unset($temp_data["!nativeeditor_status"]); + $save[$name] = $temp_data; + + if ($this->connection->save($save)){ + $data->success($this->connection->getLastInsertID()); + } else { + $data->set_response_attribute("details", $this->getErrorMessage()); + $data->invalid(); + } + } + public function delete($data,$source){ + $id = $data->get_id(); + $this->connection->delete($id); + $data->success(); + } + public function update($data,$source){ + $name = get_class($this->connection); + $save = array(); + $save[$name] = &$data->get_data(); + + if ($this->connection->save($save)){ + $data->success(); + } else { + $data->set_response_attribute("details", $this->getErrorMessage()); + $data->invalid(); + } + } + + + public function escape($str){ + throw new Exception("Not implemented"); + } + public function query($str){ + throw new Exception("Not implemented"); + } + public function get_new_id(){ + throw new Exception("Not implemented"); + } +} + +?>
\ No newline at end of file diff --git a/codebase/db_phpci.php b/codebase/db_phpci.php index f5b317c..17fe8a0 100644 --- a/codebase/db_phpci.php +++ b/codebase/db_phpci.php @@ -19,8 +19,10 @@ class PHPCIDBDataWrapper extends DBDataWrapper{ if ($res===false) {
throw new Exception("CI - sql execution failed");
}
-
- return new PHPCIResultSet($res);
+
+ if (is_object($res))
+ return new PHPCIResultSet($res);
+ return new ArrayQueryWrapper(array());
}
public function get_next($res){
@@ -42,16 +44,24 @@ class PHPCIDBDataWrapper extends DBDataWrapper{ }
class PHPCIResultSet{
+ private $is_result_done = false;
private $res;
private $start;
private $count;
public function __construct($res){
+ if(is_bool($res)) {
+ $this->$is_result_done = true;
+ return $this;
+ }
$this->res = $res;
$this->start = $res->current_row;
- $this->count = $res->num_rows;
+ $this->count = $res->num_rows();
}
public function next(){
+ if($this->is_result_done)
+ return null;
+
if ($this->start != $this->count){
return $this->res->row($this->start++,'array');
} else {
diff --git a/codebase/db_phpci2.php b/codebase/db_phpci2.php new file mode 100644 index 0000000..9d10d99 --- /dev/null +++ b/codebase/db_phpci2.php @@ -0,0 +1,65 @@ +<?php
+/*
+ @author dhtmlx.com
+ @license GPL, see license.txt
+*/
+require_once("db_common.php");
+
+/*! Implementation of DataWrapper for PDO
+
+if you plan to use it for Oracle - use Oracle connection type instead
+**/
+class PHPCIDBDataWrapper extends DBDataWrapper{
+ private $last_result;//!< store result or last operation
+
+ public function query($sql){
+ LogMaster::log($sql);
+
+ $res=$this->connection->query($sql);
+ if ($res===false) {
+ throw new Exception("CI - sql execution failed");
+ }
+
+ if (is_object($res))
+ return new PHPCIResultSet($res);
+ return new ArrayQueryWrapper(array());
+ }
+
+ public function get_next($res){
+ $data = $res->next();
+ return $data;
+ }
+
+ public function get_new_id(){
+ return $this->connection->insert_id();
+ }
+
+ public function escape($str){
+ return $this->connection->escape_str($str);
+ }
+
+ public function escape_name($data){
+ return $this->connection->protect_identifiers($data);
+ }
+}
+
+class PHPCIResultSet{
+ private $res;
+ private $start;
+ private $count;
+
+ public function __construct($res){
+ $this->res = $res;
+ $this->start = $res->current_row;
+ $this->count = $res->num_rows;
+ }
+ public function next(){
+ if ($this->start != $this->count){
+ return $this->res->row($this->start++,'array');
+ } else {
+ $this->res->free_result();
+ return null;
+ }
+ }
+}
+?>
\ No newline at end of file diff --git a/codebase/db_phpyii.php b/codebase/db_phpyii.php index f71d61a..1d8d5d1 100644 --- a/codebase/db_phpyii.php +++ b/codebase/db_phpyii.php @@ -6,86 +6,94 @@ require_once("db_common.php"); -class PHPYiiDBDataWrapper extends ArrayDBDataWrapper{ - public function select($sql){ - if (is_array($this->connection)) //result of findAll - $res = $this->connection; - else - $res = $this->connection->findAll(); - - if (sizeof($res)){ - $temp = array(); - foreach ($res as $obj) - $temp[]=$obj->getAttributes(); - } - return new ArrayQueryWrapper($temp); - } - - protected function getErrorMessage(){ - $errors = $this->connection->invalidFields(); - $text = array(); - foreach ($errors as $key => $value){ - $text[] = $key." - ".$value[0]; - } - return implode("\n", $text); - } - public function insert($data,$source){ - $name = get_class($this->connection); - $obj = new $name(); - - $this->fill_model_and_save($obj, $data); - } - public function delete($data,$source){ - $obj = $this->connection->findByPk($data->get_id()); - if ($obj->delete()){ - $data->success(); - $data->set_new_id($obj->getPrimaryKey()); - } else { - $data->set_response_attribute("details", $this->errors_to_string($obj->getErrors())); - $data->invalid(); - } - } - public function update($data,$source){ - $obj = $this->connection->findByPk($data->get_id()); - $this->fill_model_and_save($obj, $data); - } - - protected function fill_model_and_save($obj, $data){ - $values = $data->get_data(); - - //map data to model object - for ($i=0; $i < sizeof($this->config->text); $i++){ - $step=$this->config->text[$i]; - $obj->setAttribute($step["name"], $data->get_value($step["name"])); - } - if ($relation = $this->config->relation_id["db_name"]) - $obj->setAttribute($relation, $data->get_value($relation)); - - //save model - if ($obj->save()){ - $data->success(); - $data->set_new_id($obj->getPrimaryKey()); - } else { - $data->set_response_attribute("details", $this->errors_to_string($obj->getErrors())); - $data->invalid(); - } - } - - protected function errors_to_string($errors){ - $text = array(); - foreach($errors as $value) - $text[]=implode("\n", $value); - return implode("\n",$text); - } - public function escape($str){ - throw new Exception("Not implemented"); - } - public function query($str){ - throw new Exception("Not implemented"); - } - public function get_new_id(){ - throw new Exception("Not implemented"); - } +class PHPYiiDBDataWrapper extends ArrayDBDataWrapper { + + public function select($source) { + $sourceData = $source->get_source(); + if(is_array($sourceData)) //result of find + $res = $sourceData; + else + $res = $sourceData->find()->all(); + + $temp = array(); + if(sizeof($res)) { + foreach($res as $obj) + $temp[] = $obj->getAttributes(); + } + return new ArrayQueryWrapper($temp); + } + + protected function getErrorMessage() { + $errors = $this->connection->getErrors(); + $text = array(); + foreach($errors as $key => $value) + $text[] = $key." - ".$value[0]; + + return implode("\n", $text); + } + public function insert($data, $source) { + $name = get_class($source->get_source()); + $obj = new $name(); + $this->fill_model_and_save($obj, $data); + } + + public function delete($data, $source) { + $obj = $source->get_source()->findOne($data->get_id()); + if($obj->delete()) { + $data->success(); + $data->set_new_id($obj->getPrimaryKey()); + } + else { + $data->set_response_attribute("details", $this->errors_to_string($obj->getErrors())); + $data->invalid(); + } + } + + public function update($data, $source) { + $obj = $source->get_source()->findOne($data->get_id()); + $this->fill_model_and_save($obj, $data); + } + + protected function fill_model_and_save($obj, $data) { + //Map data to model object. + for($i=0; $i < sizeof($this->config->text); $i++) { + $step=$this->config->text[$i]; + $obj->setAttribute($step["name"], $data->get_value($step["name"])); + } + + if($relation = $this->config->relation_id["db_name"]) + $obj->setAttribute($relation, $data->get_value($relation)); + + //Save model. + if($obj->save()) { + $data->success(); + $data->set_new_id($obj->getPrimaryKey()); + } + else { + $data->set_response_attribute("details", $this->errors_to_string($obj->getErrors())); + $data->invalid(); + } + } + + protected function errors_to_string($errors) { + $text = array(); + foreach($errors as $value) + $text[] = implode("\n", $value); + + return implode("\n",$text); + } + + public function escape($str) { + throw new Exception("Not implemented"); + } + + public function query($str) { + throw new Exception("Not implemented"); + } + + public function get_new_id() { + throw new Exception("Not implemented"); + } } ?>
\ No newline at end of file diff --git a/codebase/db_phpyii1.php b/codebase/db_phpyii1.php new file mode 100644 index 0000000..616d7f3 --- /dev/null +++ b/codebase/db_phpyii1.php @@ -0,0 +1,91 @@ +<?php +/* + @author dhtmlx.com + @license GPL, see license.txt +*/ + +require_once("db_common.php"); + +class PHPYiiDBDataWrapper extends ArrayDBDataWrapper{ + public function select($sql){ + if (is_array($this->connection)) //result of findAll + $res = $this->connection; + else + $res = $this->connection->findAll(); + + $temp = array(); + if (sizeof($res)){ + foreach ($res as $obj) + $temp[]=$obj->getAttributes(); + } + return new ArrayQueryWrapper($temp); + } + + protected function getErrorMessage(){ + $errors = $this->connection->invalidFields(); + $text = array(); + foreach ($errors as $key => $value){ + $text[] = $key." - ".$value[0]; + } + return implode("\n", $text); + } + public function insert($data,$source){ + $name = get_class($this->connection); + $obj = new $name(); + + $this->fill_model_and_save($obj, $data); + } + public function delete($data,$source){ + $obj = $this->connection->findByPk($data->get_id()); + if ($obj->delete()){ + $data->success(); + $data->set_new_id($obj->getPrimaryKey()); + } else { + $data->set_response_attribute("details", $this->errors_to_string($obj->getErrors())); + $data->invalid(); + } + } + public function update($data,$source){ + $obj = $this->connection->findByPk($data->get_id()); + $this->fill_model_and_save($obj, $data); + } + + protected function fill_model_and_save($obj, $data){ + $values = $data->get_data(); + + //map data to model object + for ($i=0; $i < sizeof($this->config->text); $i++){ + $step=$this->config->text[$i]; + $obj->setAttribute($step["name"], $data->get_value($step["name"])); + } + if ($relation = $this->config->relation_id["db_name"]) + $obj->setAttribute($relation, $data->get_value($relation)); + + //save model + if ($obj->save()){ + $data->success(); + $data->set_new_id($obj->getPrimaryKey()); + } else { + $data->set_response_attribute("details", $this->errors_to_string($obj->getErrors())); + $data->invalid(); + } + } + + protected function errors_to_string($errors){ + $text = array(); + foreach($errors as $value) + $text[]=implode("\n", $value); + return implode("\n",$text); + } + public function escape($str){ + throw new Exception("Not implemented"); + } + public function query($str){ + throw new Exception("Not implemented"); + } + public function get_new_id(){ + throw new Exception("Not implemented"); + } +} + +?>
\ No newline at end of file diff --git a/codebase/gantt_connector.php b/codebase/gantt_connector.php index 74b8636..3577835 100644 --- a/codebase/gantt_connector.php +++ b/codebase/gantt_connector.php @@ -131,15 +131,15 @@ class GanttConnector extends Connector{ class GanttDataProcessor extends DataProcessor{ function name_data($data){ if ($data=="start_date") - return $this->config->text[0]["db_name"]; + return $this->config->text[0]["name"]; if ($data=="id") - return $this->config->id["db_name"]; + return $this->config->id["name"]; if ($data=="duration" && $this->config->text[1]["name"] == "duration") - return $this->config->text[1]["db_name"]; + return $this->config->text[1]["name"]; if ($data=="end_date" && $this->config->text[1]["name"] == "end_date") - return $this->config->text[1]["db_name"]; + return $this->config->text[1]["name"]; if ($data=="text") - return $this->config->text[2]["db_name"]; + return $this->config->text[2]["name"]; return $data; } diff --git a/codebase/grid_connector.php b/codebase/grid_connector.php index 10a98bd..d9be16a 100644 --- a/codebase/grid_connector.php +++ b/codebase/grid_connector.php @@ -94,13 +94,20 @@ class GridDataItem extends DataItem{ for ($i=0; $i < sizeof($this->config->text); $i++){ $str.="<cell"; $name=$this->config->text[$i]["name"]; + $xmlcontent = false; if (isset($this->cell_attrs[$name])){ $cattrs=$this->cell_attrs[$name]; - foreach ($cattrs as $k => $v) + foreach ($cattrs as $k => $v){ $str.=" ".$k."='".$this->xmlentities($v)."'"; + if ($k == "xmlcontent") + $xmlcontent = true; + } } $value = isset($this->data[$name]) ? $this->data[$name] : ''; - $str.="><![CDATA[".$value."]]></cell>"; + if (!$xmlcontent) + $str.="><![CDATA[".$value."]]></cell>"; + else + $str.=">".$value."</cell>"; } if ($this->userdata !== false) foreach ($this->userdata as $key => $value) diff --git a/codebase/strategy.php b/codebase/strategy.php index f9a106f..344dcf2 100644 --- a/codebase/strategy.php +++ b/codebase/strategy.php @@ -245,7 +245,7 @@ class MultitableTreeRenderStrategy extends TreeRenderStrategy { private $level = 0; private $max_level = null; - protected $sep = "#"; + protected $sep = "-@level@-"; public function __construct($conn) { parent::__construct($conn); @@ -341,7 +341,7 @@ class MultitableTreeRenderStrategy extends TreeRenderStrategy { $this->max_level = $max_level; } public function parse_id($id, $set_level = true) { - $parts = explode('#', urldecode($id)); + $parts = explode($this->sep, $id, 2); if (count($parts) === 2) { $level = $parts[0] + 1; $id = $parts[1]; diff --git a/codebase/tree_connector.php b/codebase/tree_connector.php index f8985e2..63d4442 100644 --- a/codebase/tree_connector.php +++ b/codebase/tree_connector.php @@ -121,7 +121,7 @@ class TreeDataItem extends DataItem{ function to_xml_start(){
if ($this->skip) return "";
- $str1="<item id='".$this->get_id()."' text='".$this->xmlentities($this->data[$this->config->text[0]["name"]])."' ";
+ $str1="<item id='".$this->xmlentities($this->get_id())."' text='".$this->xmlentities($this->data[$this->config->text[0]["name"]])."' ";
if ($this->has_kids()==true) $str1.="child='".$this->has_kids()."' ";
if ($this->im0) $str1.="im0='".$this->im0."' ";
if ($this->im1) $str1.="im1='".$this->im1."' ";
@@ -151,6 +151,7 @@ require_once("filesystem_item.php"); **/
class TreeConnector extends Connector{
protected $parent_name = 'id';
+ public $rootId = "0";
/*! constructor
@@ -180,7 +181,7 @@ class TreeConnector extends Connector{ if (isset($_GET[$this->parent_name]))
$this->request->set_relation($_GET[$this->parent_name]);
else
- $this->request->set_relation("0");
+ $this->request->set_relation($this->rootId);
$this->request->set_limit(0,0); //netralize default reaction on dyn. loading mode
}
diff --git a/codebase/treedatamultitable_connector.php b/codebase/treedatamultitable_connector.php index 8dba8c6..104770e 100644 --- a/codebase/treedatamultitable_connector.php +++ b/codebase/treedatamultitable_connector.php @@ -28,7 +28,7 @@ class TreeDataMultitableConnector extends TreeDataConnector{ public function xml_start(){ if (isset($_GET[$this->parent_name])) { - return "<data parent='".$this->render->level_id($_GET[$this->parent_name], $this->render->get_level() - 1)."'>"; + return "<data parent='".$this->xmlentities($this->render->level_id($_GET[$this->parent_name], $this->render->get_level() - 1))."'>"; } else { return "<data parent='0'>"; } diff --git a/codebase/treegrid_connector.php b/codebase/treegrid_connector.php index 0bb19ea..1f89137 100644 --- a/codebase/treegrid_connector.php +++ b/codebase/treegrid_connector.php @@ -53,6 +53,7 @@ class TreeGridDataItem extends GridDataItem{ **/ class TreeGridConnector extends GridConnector{ protected $parent_name = 'id'; + protected $rootId = "0"; /*! constructor @@ -82,7 +83,7 @@ class TreeGridConnector extends GridConnector{ if (isset($_GET[$this->parent_name])) $this->request->set_relation($_GET[$this->parent_name]); else - $this->request->set_relation("0"); + $this->request->set_relation($this->rootId); $this->request->set_limit(0,0); //netralize default reaction on dyn. loading mode } diff --git a/codebase/treegridmultitable_connector.php b/codebase/treegridmultitable_connector.php index 3f4bbd9..31217f9 100644 --- a/codebase/treegridmultitable_connector.php +++ b/codebase/treegridmultitable_connector.php @@ -11,7 +11,6 @@ class TreeGridMultitableConnector extends TreeGridConnector{ $data_type="TreeGridMultitableDataProcessor"; if (!$render_type) $render_type="MultitableTreeRenderStrategy"; parent::__construct($res,$type,$item_type,$data_type,$render_type); - $this->render->set_separator("%23"); } public function render(){ diff --git a/codebase/treemultitable_connector.php b/codebase/treemultitable_connector.php index 09bb19b..b06164c 100644 --- a/codebase/treemultitable_connector.php +++ b/codebase/treemultitable_connector.php @@ -28,7 +28,7 @@ class TreeMultitableConnector extends TreeConnector{ public function xml_start(){ if (isset($_GET[$this->parent_name])) { - return "<tree id='".($this->render->level_id($_GET[$this->parent_name], $this->get_level() - 1))."'>"; + return "<tree id='".$this->xmlentities($this->render->level_id($_GET[$this->parent_name], $this->get_level() - 1))."'>"; } else { return "<tree id='0'>"; } |