diff options
author | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2015-02-03 14:29:45 +0300 |
---|---|---|
committer | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2015-02-05 13:25:55 +0300 |
commit | f56a0475d90af025e92ec4716ff4e5121992b4fe (patch) | |
tree | c351eff2ed0b007eafed412a513bbec5fb4c5f91 /codebase/connector | |
parent | 32504c39dd0183ac30da815e4cf41ac8fa022b99 (diff) | |
download | scheduler-f56a0475d90af025e92ec4716ff4e5121992b4fe.zip scheduler-f56a0475d90af025e92ec4716ff4e5121992b4fe.tar.gz scheduler-f56a0475d90af025e92ec4716ff4e5121992b4fe.tar.bz2 |
[update] version 4.3.0v4.3.0
Diffstat (limited to 'codebase/connector')
-rw-r--r-- | codebase/connector/combo_connector.php | 2 | ||||
-rw-r--r-- | codebase/connector/crosslink_connector.php | 2 | ||||
-rw-r--r-- | codebase/connector/data_connector.php | 16 | ||||
-rw-r--r-- | codebase/connector/db_common.php | 2 | ||||
-rw-r--r-- | codebase/connector/db_pdo.php | 25 | ||||
-rw-r--r-- | codebase/connector/db_phpcake.php | 2 | ||||
-rw-r--r-- | codebase/connector/db_phpci.php | 6 | ||||
-rw-r--r-- | codebase/connector/db_phpyii.php | 2 | ||||
-rw-r--r-- | codebase/connector/gantt_connector.php | 10 | ||||
-rw-r--r-- | codebase/connector/grid_connector.php | 11 | ||||
-rw-r--r-- | codebase/connector/strategy.php | 4 | ||||
-rw-r--r-- | codebase/connector/tree_connector.php | 3 | ||||
-rw-r--r-- | codebase/connector/treedatamultitable_connector.php | 2 | ||||
-rw-r--r-- | codebase/connector/treegrid_connector.php | 3 | ||||
-rw-r--r-- | codebase/connector/treegridmultitable_connector.php | 1 | ||||
-rw-r--r-- | codebase/connector/treemultitable_connector.php | 2 |
16 files changed, 68 insertions, 25 deletions
diff --git a/codebase/connector/combo_connector.php b/codebase/connector/combo_connector.php index ad28017..8fb5416 100644 --- a/codebase/connector/combo_connector.php +++ b/codebase/connector/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/connector/crosslink_connector.php b/codebase/connector/crosslink_connector.php index 22ad83d..7d5c74c 100644 --- a/codebase/connector/crosslink_connector.php +++ b/codebase/connector/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/connector/data_connector.php b/codebase/connector/data_connector.php index 7c9251d..165cc0f 100644 --- a/codebase/connector/data_connector.php +++ b/codebase/connector/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/connector/db_common.php b/codebase/connector/db_common.php index e2f521e..effc291 100644 --- a/codebase/connector/db_common.php +++ b/codebase/connector/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; } diff --git a/codebase/connector/db_pdo.php b/codebase/connector/db_pdo.php index d1ad4d8..1417462 100644 --- a/codebase/connector/db_pdo.php +++ b/codebase/connector/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/connector/db_phpcake.php b/codebase/connector/db_phpcake.php index 97d94eb..4df0289 100644 --- a/codebase/connector/db_phpcake.php +++ b/codebase/connector/db_phpcake.php @@ -19,9 +19,9 @@ class PHPCakeDBDataWrapper extends ArrayDBDataWrapper{ else $res = $this->connection->find("all"); + $temp = array(); if (sizeof($res)){ $name = get_class($this->connection); - $temp = array(); for ($i=sizeof($res)-1; $i>=0; $i--) $temp[]=&$res[$i][$name]; } diff --git a/codebase/connector/db_phpci.php b/codebase/connector/db_phpci.php index b9a5879..e38d831 100644 --- a/codebase/connector/db_phpci.php +++ b/codebase/connector/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){ diff --git a/codebase/connector/db_phpyii.php b/codebase/connector/db_phpyii.php index f71d61a..616d7f3 100644 --- a/codebase/connector/db_phpyii.php +++ b/codebase/connector/db_phpyii.php @@ -13,8 +13,8 @@ class PHPYiiDBDataWrapper extends ArrayDBDataWrapper{ else $res = $this->connection->findAll(); + $temp = array(); if (sizeof($res)){ - $temp = array(); foreach ($res as $obj) $temp[]=$obj->getAttributes(); } diff --git a/codebase/connector/gantt_connector.php b/codebase/connector/gantt_connector.php index 74b8636..3577835 100644 --- a/codebase/connector/gantt_connector.php +++ b/codebase/connector/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/connector/grid_connector.php b/codebase/connector/grid_connector.php index 10a98bd..d9be16a 100644 --- a/codebase/connector/grid_connector.php +++ b/codebase/connector/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/connector/strategy.php b/codebase/connector/strategy.php index f9a106f..39c0188 100644 --- a/codebase/connector/strategy.php +++ b/codebase/connector/strategy.php @@ -245,7 +245,7 @@ class MultitableTreeRenderStrategy extends TreeRenderStrategy { private $level = 0; private $max_level = null; - protected $sep = "#"; + protected $sep = ","; 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/connector/tree_connector.php b/codebase/connector/tree_connector.php index 154f02a..814fb12 100644 --- a/codebase/connector/tree_connector.php +++ b/codebase/connector/tree_connector.php @@ -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/connector/treedatamultitable_connector.php b/codebase/connector/treedatamultitable_connector.php index 8dba8c6..104770e 100644 --- a/codebase/connector/treedatamultitable_connector.php +++ b/codebase/connector/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/connector/treegrid_connector.php b/codebase/connector/treegrid_connector.php index 0bb19ea..1f89137 100644 --- a/codebase/connector/treegrid_connector.php +++ b/codebase/connector/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/connector/treegridmultitable_connector.php b/codebase/connector/treegridmultitable_connector.php index 3f4bbd9..31217f9 100644 --- a/codebase/connector/treegridmultitable_connector.php +++ b/codebase/connector/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/connector/treemultitable_connector.php b/codebase/connector/treemultitable_connector.php index 09bb19b..b06164c 100644 --- a/codebase/connector/treemultitable_connector.php +++ b/codebase/connector/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'>"; } |