diff --git a/codepot/src/codepot/controllers/graph.php b/codepot/src/codepot/controllers/graph.php index 5ef91409..65f714a2 100644 --- a/codepot/src/codepot/controllers/graph.php +++ b/codepot/src/codepot/controllers/graph.php @@ -34,7 +34,7 @@ class Graph extends CI_Controller $this->load->model ('ProjectModel', 'projects'); $this->load->model ('SubversionModel', 'subversion'); - $login = $this->login->getUser (); + $login = $this->login->getUser(); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') redirect (CODEPOT_SIGNIN_REDIR_PATH . $this->converter->AsciiTohex(current_url())); $data['login'] = $login; @@ -73,7 +73,7 @@ class Graph extends CI_Controller { $this->load->model ('ProjectModel', 'projects'); - $login = $this->login->getUser (); + $login = $this->login->getUser(); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') { header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); @@ -116,7 +116,7 @@ class Graph extends CI_Controller { $this->load->model ('ProjectModel', 'projects'); - $login = $this->login->getUser (); + $login = $this->login->getUser(); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') { header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); @@ -144,7 +144,7 @@ class Graph extends CI_Controller { $this->load->model ('ProjectModel', 'projects'); - $login = $this->login->getUser (); + $login = $this->login->getUser(); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') { header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); @@ -172,7 +172,7 @@ class Graph extends CI_Controller { $this->load->model ('ProjectModel', 'projects'); - $login = $this->login->getUser (); + $login = $this->login->getUser(); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') { header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); @@ -200,7 +200,7 @@ class Graph extends CI_Controller { $this->load->model ('ProjectModel', 'projects'); - $login = $this->login->getUser (); + $login = $this->login->getUser(); if (CODEPOT_SIGNIN_COMPULSORY && $login['id'] == '') { header($_SERVER['SERVER_PROTOCOL'].' 404 Not Found'); diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index 159bce36..91c7cf6c 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -1596,10 +1596,9 @@ class SubversionModel extends CodeRepoModel if ($info === FALSE || $info === NULL || count($info) != 1) continue; } - if ($info[0]['kind'] == SVN_NODE_FILE) return FALSE; - $info0 = &$info[0]; + if ($info[0]['kind'] == SVN_NODE_FILE) continue; - $list = @svn_ls ($workurl, $rev, FALSE, TRUE); + $list = @svn_ls($workurl, $rev, FALSE, TRUE); if ($list === FALSE) return FALSE; foreach ($list as $key => $value) @@ -1609,21 +1608,26 @@ class SubversionModel extends CodeRepoModel { $obj = new stdClass(); //$obj->name = $key; - $obj->name = $full_path; + //$obj->name = $full_path; + $obj->name = substr($full_path, strlen($path) + 1); // relative path - $text = @svn_cat ("{$orgurl}/{$key}{$trailer}", $rev); - if ($text === FALSE) $obj->size = 0; + $text = @svn_cat("{$orgurl}/{$key}{$trailer}", $rev); + if ($text === FALSE) + { + $obj->lines = 0; + $obj->bytes = 0; + } else { $text_len = strlen($text); - $obj->size = substr_count($text, "\n"); - if ($text_len > 0 && $text[$text_len - 1] != "\n") $obj->size++; + $obj->lines = substr_count($text, "\n"); + if ($text_len > 0 && $text[$text_len - 1] != "\n") $obj->lines++; + $obj->bytes = $text_len; } $obj->language = substr(strrchr($key, '.'), 1); // file extension if ($obj->language === FALSE) $obj->language = ''; - array_push ($current_cloc->children, $obj); } else @@ -1634,11 +1638,11 @@ class SubversionModel extends CodeRepoModel // other same base name in a different directory. // let's use a full path. it's anyway clearer. //$obj->name = $key; - $obj->name = $full_path; + //$obj->name = $full_path; + $obj->name = substr($full_path, strlen($path) + 1); // relativte path $obj->children = array(); array_push ($current_cloc->children, $obj); - array_push ($stack, $full_path); array_push ($stack, $obj); } diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index 5398c635..3244983a 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -102,9 +102,7 @@ - - - + @@ -404,6 +402,10 @@ var GraphApp = (function () self.resizeGraph (); }); + this.graph_container.on ("dialogclose", function (evt, ui) { + self.closeGraph (); + }); + this.graph_button.button().click (function () { open_graph.call (self); @@ -441,6 +443,11 @@ var GraphApp = (function () /* SHOULD BE IMPLEMENTED BY INHERITER */ } + App.prototype.closeGraph = function () + { + /* SHOULD BE IMPLEMENTED BY INHERITER */ + } + return App; })(); @@ -558,15 +565,18 @@ var LocGraphApp = (function () function App (top_container, graph_container, graph_msgdiv, graph_canvas, graph_button, graph_spin, graph_url, graph_title) { GraphApp.call (this, top_container, graph_container, graph_msgdiv, graph_canvas, graph_button, graph_spin, graph_url, graph_title); + this.chart = null; this.plot_dataset = null; this.plot_options = null; return this; } + App.prototype = Object.create(GraphApp.prototype); App.prototype.constructor = App; + App.prototype.renderGraph = function (data) { - if (!data.hasOwnProperty('SUM')) + if (!("SUM" in data)) { this.showMessage ('No data to show'); return; @@ -579,36 +589,38 @@ var LocGraphApp = (function () this.clearMessage (); - // files, blank, comment, code - // files is always 1. - this.plot_dataset = [ - { label: "lang->line('Blank')?>", data: data.SUM[1] }, - { label: "lang->line('Comment')?>", data: data.SUM[2] }, - { label: "lang->line('Code')?>", data: data.SUM[3] } + var labels = [ + "lang->line('Blank')?>", + "lang->line('Comment')?>", + "lang->line('Code')?>" ]; - this.plot_options = - { - series: { - shadowSize: 0, - pie: { - show: true, - innerRadius: 0.1, - label: { - show: true, - radius: 0.9, - formatter: function labelFormatter(label, series) - { - return "