Skip to content

Commit e9d0e20

Browse files
committed
[update] version 3.0
1 parent b458d3c commit e9d0e20

File tree

126 files changed

+3294
-2757
lines changed

Some content is hidden

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

126 files changed

+3294
-2757
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dhtmlxGantt v.2.1
1+
dhtmlxGantt v.3.0
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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
22
"name": "gantt",
3-
"version": "2.1.1",
3+
"version": "3.0.0",
44
"homepage": "http://dhtmlx.com/docs/products/dhtmlxGantt/",
55
"description": "JavaScript event calendar. Allows to manage events and appointments in different views",
6-
"main": "codebase/dhtmlxgantt.js",
6+
"main": [
7+
"codebase/dhtmlxgantt.js",
8+
"skins/dhtmlxgantt_terrace.css"
9+
],
710
"keywords": [
811
"calendar",
912
"scheduler",

codebase/connector/base_connector.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ class Connector {
290290

291291
public static $filter_var="dhx_filter";
292292
public static $sort_var="dhx_sort";
293+
public static $kids_var="dhx_kids";
293294

294295
public $model=false;
295296

codebase/connector/crosslink_connector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public function get_only_related($filters){
9797
public function afterProcessing($action){
9898
$status = $action->get_status();
9999

100-
$master_key = $action->get_value($this->master_name);
100+
$master_key = $action->get_id();//value($this->master_name);
101101
$link_key = $action->get_value($this->link_name);
102102
$link_key = explode(',', $link_key);
103103

codebase/connector/data_connector.php

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,16 @@ function to_xml(){
277277
for ($i=0; $i<sizeof($this->config->text); $i++){
278278
$extra = $this->config->text[$i]["name"];
279279
$data[$extra]=$this->data[$extra];
280+
if (is_null($data[$extra]))
281+
$data[$extra] = "";
280282
}
281283

282284
if ($this->userdata !== false)
283-
foreach ($this->userdata as $key => $value)
285+
foreach ($this->userdata as $key => $value){
286+
if ($value === null)
287+
$data[$key]="";
284288
$data[$key]=$value;
289+
}
285290

286291
return $data;
287292
}
@@ -346,7 +351,7 @@ function to_xml_start(){
346351
$str.=" ".$key."='".$this->xmlentities($value)."'";
347352

348353
if ($this->kids === true)
349-
$str .=" dhx_kids='1'";
354+
$str .=" ".Connector::$kids_var."='1'";
350355

351356
return $str.">";
352357
}
@@ -363,6 +368,7 @@ function set_kids($value){
363368

364369
class TreeDataConnector extends DataConnector{
365370
protected $parent_name = 'parent';
371+
public $rootId = "0";
366372

367373
/*! constructor
368374
@@ -392,15 +398,18 @@ protected function parse_request(){
392398
if (isset($_GET[$this->parent_name]))
393399
$this->request->set_relation($_GET[$this->parent_name]);
394400
else
395-
$this->request->set_relation("0");
401+
$this->request->set_relation($this->rootId);
396402

397403
$this->request->set_limit(0,0); //netralize default reaction on dyn. loading mode
398404
}
399405

400406
/*! renders self as xml, starting part
401407
*/
402408
protected function xml_start(){
403-
$attributes = " parent='".$this->request->get_relation()."' ";
409+
$attributes = " ";
410+
if (!$this->rootId || $this->rootId != $this->request->get_relation())
411+
$attributes = " parent='".$this->request->get_relation()."' ";
412+
404413
foreach($this->attributes as $k=>$v)
405414
$attributes .= " ".$k."='".$v."'";
406415

@@ -423,7 +432,9 @@ protected function output_as_xml($res){
423432
if ($this->simple) return $result;
424433

425434
$data = array();
426-
$data["parent"] = $this->request->get_relation();
435+
if (!$this->rootId || $this->rootId != $this->request->get_relation())
436+
$data["parent"] = $this->request->get_relation();
437+
427438
$data["data"] = $result;
428439

429440
$this->fill_collections();
@@ -503,7 +514,7 @@ function to_xml_start(){
503514
$data[$key]=$value;
504515

505516
if ($this->kids === true)
506-
$data["dhx_kids"] = 1;
517+
$data[Connector::$kids_var] = 1;
507518

508519
return $data;
509520
}
@@ -514,4 +525,4 @@ function to_xml_end(){
514525
}
515526

516527

517-
?>
528+
?>

codebase/connector/dataprocessor.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,11 +488,23 @@ function success($id=false){
488488
function to_xml(){
489489
$str="<action type='{$this->status}' sid='{$this->id}' tid='{$this->nid}' ";
490490
foreach ($this->attrs as $k => $v) {
491-
$str.=$k."='".$v."' ";
491+
$str.=$k."='".$this->xmlentities($v)."' ";
492492
}
493493
$str.=">{$this->output}</action>";
494494
return $str;
495495
}
496+
497+
/*! replace xml unsafe characters
498+
499+
@param string
500+
string to be escaped
501+
@return
502+
escaped string
503+
*/
504+
public function xmlentities($string) {
505+
return str_replace( array( '&', '"', "'", '<', '>', '' ), array( '&amp;' , '&quot;', '&apos;' , '&lt;' , '&gt;', '&apos;' ), $string);
506+
}
507+
496508
/*! convert self to string ( for logs )
497509
498510
@return

codebase/connector/db_common.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ abstract class DataWrapper{
523523
@param config
524524
DataConfig instance
525525
*/
526-
public function __construct($connection,$config){
526+
public function __construct($connection = false,$config = false){
527527
$this->config=$config;
528528
$this->connection=$connection;
529529
}
@@ -800,8 +800,14 @@ protected function build_where($rules,$relation=false){
800800
else
801801
array_push($sql,$this->escape_name($rules[$i]["name"])." ".$rules[$i]["operation"]." '".$this->escape($rules[$i]["value"])."'");
802802
}
803-
if ($relation !== false && $relation !== "")
804-
array_push($sql,$this->escape_name($this->config->relation_id["db_name"])." = '".$this->escape($relation)."'");
803+
804+
if ($relation !== false && $relation !== ""){
805+
$relsql = $this->escape_name($this->config->relation_id["db_name"])." = '".$this->escape($relation)."'";
806+
if ($relation == "0")
807+
$relsql = "( ".$relsql." OR ".$this->escape_name($this->config->relation_id["db_name"])." IS NULL )";
808+
809+
array_push($sql,$relsql);
810+
}
805811
return implode(" AND ",$sql);
806812
}
807813
/*! convert sorting rules to sql string

codebase/connector/db_oracle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public function query($sql){
2323

2424

2525
$mode = ($this->is_record_transaction() || $this->is_global_transaction())?OCI_DEFAULT:OCI_COMMIT_ON_SUCCESS;
26-
$res=oci_execute($stm,$mode);
27-
if ($res===false) throw new Exception("Oracle - sql execution failed\n".oci_error($this->connection));
26+
$res = @oci_execute($stm,$mode);
27+
if ($res===false) throw new Exception(oci_error($this->connection));
2828

2929
$this->last_id=$out[0];
3030

codebase/connector/db_pdo.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,31 @@ protected function select_query($select,$from,$where,$sort,$start,$count){
3939
return $sql;
4040
}
4141

42+
public function tables_list() {
43+
$result = $this->query("SHOW TABLES");
44+
if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection));
45+
46+
$tables = array();
47+
while ($table = $result->next()) {
48+
$tables[] = $table[0];
49+
}
50+
return $tables;
51+
}
52+
53+
public function fields_list($table) {
54+
$result = $this->query("SHOW COLUMNS FROM `".$table."`");
55+
if ($result===false) throw new Exception("MySQL operation failed\n".mysql_error($this->connection));
56+
57+
$fields = array();
58+
$id = "";
59+
while ($field = $result->next()) {
60+
if ($field['Key'] == "PRI")
61+
$id = $field["Field"];
62+
else
63+
$fields[] = $field["Field"];
64+
}
65+
return array("fields" => $fields, "key" => $id );
66+
}
4267

4368
public function get_next($res){
4469
$data = $res->next();

codebase/connector/grid_connector.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,20 +87,27 @@ function set_row_attribute($attr,$value){
8787
public function to_xml_start(){
8888
if ($this->skip) return "";
8989

90-
$str="<row id='".$this->get_id()."'";
90+
$str="<row id='".$this->xmlentities($this->get_id())."'";
9191
foreach ($this->row_attrs as $k=>$v)
9292
$str.=" ".$k."='".$v."'";
9393
$str.=">";
9494
for ($i=0; $i < sizeof($this->config->text); $i++){
9595
$str.="<cell";
9696
$name=$this->config->text[$i]["name"];
97+
$xmlcontent = false;
9798
if (isset($this->cell_attrs[$name])){
9899
$cattrs=$this->cell_attrs[$name];
99-
foreach ($cattrs as $k => $v)
100+
foreach ($cattrs as $k => $v){
100101
$str.=" ".$k."='".$this->xmlentities($v)."'";
102+
if ($k == "xmlcontent")
103+
$xmlcontent = true;
104+
}
101105
}
102106
$value = isset($this->data[$name]) ? $this->data[$name] : '';
103-
$str.="><![CDATA[".$value."]]></cell>";
107+
if (!$xmlcontent)
108+
$str.="><![CDATA[".$value."]]></cell>";
109+
else
110+
$str.=">".$value."</cell>";
104111
}
105112
if ($this->userdata !== false)
106113
foreach ($this->userdata as $key => $value)

0 commit comments

Comments
 (0)