Skip to content

Commit 19d1236

Browse files
committed
[update] version 3.3.0
1 parent dbac6d9 commit 19d1236

File tree

106 files changed

+1704
-909
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+1704
-909
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dhtmlxGantt v.3.2
1+
dhtmlxGantt v.3.3
22
=================
33

44
dhtmlxGantt is an open source JavaScript Gantt chart that helps you illustrate a project schedule in a nice-looking chart. It can show the dependencies between tasks as lines and allows you to set up different relationships between tasks (finish-to-start, start-to-start, end-to-end). dhtmlxGantt provides flexible API and a large number of event handles, which gives you the freedom to customize it for your needs.

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gantt",
3-
"version": "3.2.1",
3+
"version": "3.3.0",
44
"homepage": "http://dhtmlx.com/docs/products/dhtmlxGantt/",
55
"description": "An open source JavaScript Gantt chart that helps you illustrate a project schedule in a nice-looking chart.",
66
"main": [

codebase/connector/base_connector.php

+28-24
Original file line numberDiff line numberDiff line change
@@ -282,38 +282,38 @@ public function to_xml_end(){
282282
Can be used on its own to provide raw data.
283283
**/
284284
class Connector {
285+
286+
private $id_seed=0; //!< default value, used to generate auto-IDs
287+
private $db; //!< db connection resource
288+
285289
protected $config;//DataConfig instance
286290
protected $request;//DataRequestConfig instance
287291
protected $names;//!< hash of names for used classes
288292
protected $encoding="utf-8";//!< assigned encoding (UTF-8 by default)
289293
protected $editing=false;//!< flag of edit mode ( response for dataprocessor )
294+
protected $updating=false;//!< flag of update mode ( response for data-update )
295+
protected $dload;//!< flag of dyn. loading mode
296+
protected $data_separator = "\n";
297+
protected $live_update = false; // actions table name for autoupdating
298+
protected $live_update_data_type = "DataUpdate";
299+
protected $extra_output="";//!< extra info which need to be sent to client side
300+
protected $options=array();//!< hash of OptionsConnector
301+
protected $as_string = false; // render() returns string, don't send result in response
302+
protected $simple = false; // render only data without any other info
303+
protected $filters;
304+
protected $sorts;
305+
protected $mix;
306+
protected $order = false;
290307

291308
public static $filter_var="dhx_filter";
292309
public static $sort_var="dhx_sort";
293310
public static $kids_var="dhx_kids";
294311

295-
public $model=false;
296-
297-
private $updating=false;//!< flag of update mode ( response for data-update )
298-
private $db; //!< db connection resource
299-
protected $dload;//!< flag of dyn. loading mode
300-
public $access; //!< AccessMaster instance
301-
protected $data_separator = "\n";
302-
303-
public $sql; //DataWrapper instance
304-
public $event; //EventMaster instance
305-
public $limit=false;
306-
307-
private $id_seed=0; //!< default value, used to generate auto-IDs
308-
protected $live_update = false; // actions table name for autoupdating
309-
protected $extra_output="";//!< extra info which need to be sent to client side
310-
protected $options=array();//!< hash of OptionsConnector
311-
protected $as_string = false; // render() returns string, don't send result in response
312-
protected $simple = false; // render only data without any other info
313-
protected $filters;
314-
protected $sorts;
315-
protected $mix;
316-
protected $order = false;
312+
public $model=false;
313+
public $access; //!< AccessMaster instance
314+
public $sql; //DataWrapper instance
315+
public $event; //EventMaster instance
316+
public $limit=false;
317317

318318
/*! constructor
319319
@@ -419,7 +419,7 @@ public function configure($table,$id="",$fields=false,$extra=false,$relation_id=
419419
$id = $info["key"];
420420
}
421421
$this->config->init($id,$fields,$extra,$relation_id);
422-
if (strpos(trim($table), " ")!==false)
422+
if (is_string($table) && strpos(trim($table), " ")!==false)
423423
$this->request->parse_sql($table);
424424
else
425425
$this->request->set_source($table);
@@ -810,6 +810,10 @@ public function set_options($name,$options){
810810
$this->options[$name]=$options;
811811
}
812812

813+
public function get_options() {
814+
return $this->options;
815+
}
816+
813817

814818
public function insert($data) {
815819
$action = new DataAction('inserted', false, $data);
@@ -851,7 +855,7 @@ public function update($data) {
851855
url used for update notifications
852856
*/
853857
public function enable_live_update($table, $url=false){
854-
$this->live_update = new DataUpdate($this->sql, $this->config, $this->request, $table,$url);
858+
$this->live_update = new $this->live_update_data_type($this->sql, $this->config, $this->request, $table,$url, array("connector" => $this));
855859
$this->live_update->set_event($this->event,$this->names["item_class"]);
856860
$this->event->attach("beforeOutput", Array($this->live_update, "version_output"));
857861
$this->event->attach("beforeFiltering", Array($this->live_update, "get_updates"));

codebase/connector/combo_connector.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function select(){
2525
function to_xml_start(){
2626
if ($this->skip) return "";
2727

28-
return "<option ".($this->selected?"selected='true'":"")."value='".$this->xmlentities($this->get_id())."'><![CDATA[".$this->data[$this->config->text[0]["name"]]."]]>";
28+
return "<option ".($this->selected?"selected='true' ":"")."value='".$this->xmlentities($this->get_id())."'><![CDATA[".$this->data[$this->config->text[0]["name"]]."]]>";
2929
}
3030
/*! return self as XML string, ending part
3131
*/

codebase/connector/db_common.php

+12
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
/*! manager of data request
99
**/
1010
class DataRequestConfig{
11+
12+
private $action_mode = "";
1113
private $filters; //!< array of filtering rules
1214
private $relation=false; //!< ID or other element used for linking hierarchy
1315
private $sort_by; //!< sorting field
@@ -52,6 +54,7 @@ public function copy($proto){
5254
$this->relation =$proto->get_relation();
5355
$this->user = $proto->user;
5456
$this->version = $proto->version;
57+
$this->action_mode = $proto->action_mode;
5558
}
5659

5760
/*! convert self to string ( for logs )
@@ -69,6 +72,15 @@ public function __toString(){
6972
return $str;
7073
}
7174

75+
public function set_action_mode($action_mode) {
76+
$this->action_mode = $action_mode;
77+
return $this;
78+
}
79+
80+
public function get_action_mode() {
81+
return $this->action_mode;
82+
}
83+
7284
/*! returns set of filtering rules
7385
@return
7486
set of filtering rules

codebase/connector/db_phpcake.php

+70-69
Original file line numberDiff line numberDiff line change
@@ -11,75 +11,76 @@
1111
1212
if you plan to use it for Oracle - use Oracle connection type instead
1313
**/
14-
class PHPCakeDBDataWrapper extends ArrayDBDataWrapper{
15-
public function select($sql){
16-
$source = $sql->get_source();
17-
if (is_array($source)) //result of find
18-
$res = $source;
19-
else
20-
$res = $this->connection->find("all");
21-
22-
$temp = array();
23-
if (sizeof($res)){
24-
$name = get_class($this->connection);
25-
for ($i=sizeof($res)-1; $i>=0; $i--)
26-
$temp[]=&$res[$i][$name];
27-
}
28-
return new ArrayQueryWrapper($temp);
29-
}
30-
31-
protected function getErrorMessage(){
32-
$errors = $this->connection->invalidFields();
33-
$text = array();
34-
foreach ($errors as $key => $value){
35-
$text[] = $key." - ".$value[0];
36-
}
37-
return implode("\n", $text);
38-
}
39-
40-
public function insert($data,$source){
41-
$name = get_class($this->connection);
42-
$save = array();
43-
$temp_data = $data->get_data();
44-
unset($temp_data[$this->config->id['db_name']]);
45-
unset($temp_data["!nativeeditor_status"]);
46-
$save[$name] = $temp_data;
47-
48-
if ($this->connection->save($save)){
49-
$data->success($this->connection->getLastInsertID());
50-
} else {
51-
$data->set_response_attribute("details", $this->getErrorMessage());
52-
$data->invalid();
53-
}
54-
}
55-
public function delete($data,$source){
56-
$id = $data->get_id();
57-
$this->connection->delete($id);
58-
$data->success();
59-
}
60-
public function update($data,$source){
61-
$name = get_class($this->connection);
62-
$save = array();
63-
$save[$name] = &$data->get_data();
64-
65-
if ($this->connection->save($save)){
66-
$data->success();
67-
} else {
68-
$data->set_response_attribute("details", $this->getErrorMessage());
69-
$data->invalid();
70-
}
71-
}
72-
73-
74-
public function escape($str){
75-
throw new Exception("Not implemented");
76-
}
77-
public function query($str){
78-
throw new Exception("Not implemented");
79-
}
80-
public function get_new_id(){
81-
throw new Exception("Not implemented");
82-
}
14+
class PHPCakeDBDataWrapper extends ArrayDBDataWrapper {
15+
16+
public function select($source) {
17+
$sourceData = $source->get_source();
18+
if(is_array($sourceData)) //result of find
19+
$query = $sourceData;
20+
else
21+
$query = $sourceData->find("all");
22+
23+
$temp = array();
24+
foreach($query as $row)
25+
$temp[] = $row->toArray();
26+
27+
return new ArrayQueryWrapper($temp);
28+
}
29+
30+
protected function getErrorMessage() {
31+
$errors = $this->connection->invalidFields();
32+
$text = array();
33+
foreach ($errors as $key => $value){
34+
$text[] = $key." - ".$value[0];
35+
}
36+
return implode("\n", $text);
37+
}
38+
39+
public function insert($data, $source) {
40+
$sourceData = $source->get_source();
41+
$obj = $sourceData->newEntity();
42+
$obj = $this->fillModel($obj, $data);
43+
$savedResult = $source->get_source()->save($obj);
44+
$data->success($savedResult->get($this->config->id["db_name"]));
45+
}
46+
47+
public function delete($data, $source) {
48+
$sourceData = $source->get_source();
49+
$obj = $sourceData->get($data->get_id());
50+
$source->get_source()->delete($obj);
51+
}
52+
53+
public function update($data, $source) {
54+
$sourceData = $source->get_source();
55+
$obj = $sourceData->get($data->get_id());
56+
$obj = $this->fillModel($obj, $data);
57+
$sourceData->save($obj);
58+
}
59+
60+
private function fillModel($obj, $data) {
61+
//Map data to model object.
62+
for($i = 0; $i < count($this->config->text); $i++) {
63+
$step=$this->config->text[$i];
64+
$obj->set($step["name"], $data->get_value($step["name"]));
65+
}
66+
67+
if($relation = $this->config->relation_id["db_name"])
68+
$obj->set($relation, $data->get_value($relation));
69+
70+
return $obj;
71+
}
72+
73+
public function escape($str){
74+
throw new Exception("Not implemented");
75+
}
76+
77+
public function query($str){
78+
throw new Exception("Not implemented");
79+
}
80+
81+
public function get_new_id(){
82+
throw new Exception("Not implemented");
83+
}
8384
}
8485

8586
?>

codebase/connector/db_phpcake2.php

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
<?php
2+
/*
3+
@author dhtmlx.com
4+
@license GPL, see license.txt
5+
*/
6+
require_once("db_common.php");
7+
8+
//DataProcessor::$action_param ="dhx_editor_status";
9+
10+
/*! Implementation of DataWrapper for PDO
11+
12+
if you plan to use it for Oracle - use Oracle connection type instead
13+
**/
14+
class PHPCake2DBDataWrapper extends ArrayDBDataWrapper{
15+
public function select($sql){
16+
$source = $sql->get_source();
17+
if (is_array($source)) //result of find
18+
$res = $source;
19+
else
20+
$res = $this->connection->find("all");
21+
22+
$temp = array();
23+
if (sizeof($res)){
24+
$name = get_class($this->connection);
25+
for ($i=sizeof($res)-1; $i>=0; $i--)
26+
$temp[]=&$res[$i][$name];
27+
}
28+
return new ArrayQueryWrapper($temp);
29+
}
30+
31+
protected function getErrorMessage(){
32+
$errors = $this->connection->invalidFields();
33+
$text = array();
34+
foreach ($errors as $key => $value){
35+
$text[] = $key." - ".$value[0];
36+
}
37+
return implode("\n", $text);
38+
}
39+
40+
public function insert($data,$source){
41+
$name = get_class($this->connection);
42+
$save = array();
43+
$temp_data = $data->get_data();
44+
unset($temp_data[$this->config->id['db_name']]);
45+
unset($temp_data["!nativeeditor_status"]);
46+
$save[$name] = $temp_data;
47+
48+
if ($this->connection->save($save)){
49+
$data->success($this->connection->getLastInsertID());
50+
} else {
51+
$data->set_response_attribute("details", $this->getErrorMessage());
52+
$data->invalid();
53+
}
54+
}
55+
public function delete($data,$source){
56+
$id = $data->get_id();
57+
$this->connection->delete($id);
58+
$data->success();
59+
}
60+
public function update($data,$source){
61+
$name = get_class($this->connection);
62+
$save = array();
63+
$save[$name] = &$data->get_data();
64+
65+
if ($this->connection->save($save)){
66+
$data->success();
67+
} else {
68+
$data->set_response_attribute("details", $this->getErrorMessage());
69+
$data->invalid();
70+
}
71+
}
72+
73+
74+
public function escape($str){
75+
throw new Exception("Not implemented");
76+
}
77+
public function query($str){
78+
throw new Exception("Not implemented");
79+
}
80+
public function get_new_id(){
81+
throw new Exception("Not implemented");
82+
}
83+
}
84+
85+
?>

0 commit comments

Comments
 (0)