diff --git a/codepot/src/codepot/models/subversionmodel.php b/codepot/src/codepot/models/subversionmodel.php index 2e589034..78f9b8f4 100644 --- a/codepot/src/codepot/models/subversionmodel.php +++ b/codepot/src/codepot/models/subversionmodel.php @@ -1123,10 +1123,8 @@ class SubversionModel extends Model ) */ - $fileinfo['fullpath'] = substr ( - $info1[0]['url'], strlen($info1[0]['repos'])); - $fileinfo['against']['fullpath'] = substr ( - $info2[0]['url'], strlen($info2[0]['repos'])); + $fileinfo['fullpath'] = substr ($info1[0]['url'], strlen($info1[0]['repos'])); + $fileinfo['against']['fullpath'] = substr ($info2[0]['url'], strlen($info2[0]['repos'])); fclose($errors); diff --git a/codepot/src/codepot/views/code_file.php b/codepot/src/codepot/views/code_file.php index 90a17d72..71c0b8c6 100644 --- a/codepot/src/codepot/views/code_file.php +++ b/codepot/src/codepot/views/code_file.php @@ -83,6 +83,8 @@ + + +var revision_network = null; + +function show_revision_graph (response) +{ + var data = $.parseJSON(response); + if (data == null) + { + show_alert ('Invalid data received', "lang->line('Error')?>"); + } + else if (data.nodes.length <= 0) + { + show_alert ('No data to show', "lang->line('Info')?>"); + } + else + { + var options = { + autoResize: false, + height: '500px', + width: '100%', + clickToUse: true, + layout: { + hierarchical: { + enabled: true, + //levelSeparation: 150, + //nodeSpacing: 200, + //treeSpacing: 300, + direction: 'LR', //'LR' 'UD', 'DU', 'RL' + sortMethod: 'directed' // 'hubsize' + } + }, + edges: { + smooth: { + type: 'cubicBezier', + forceDirection: 'horizontal', // 'vertical', + roundness: 0.4 + } + }, + physics: { + enabled: true + } + }; + + var i, j; + + j = data.nodes.length; + for (i = 0; i < j; i++) + { + data.nodes[i].shape = 'box'; + } + + j = data.edges.length; + for (i = 0; i < j; i++) + { + data.edges[i].length = 60; + data.edges[i].width = 1; + data.edges[i].arrows = 'to'; + data.edges[i].font = { color: 'red' }; + } + + if (revision_network === null) + { + revision_network = new vis.Network(document.getElementById('code_file_result_revision_graph'), data, options); + $('#code_file_result_revision_graph').resizable({ + create: function (event, ui) { + revision_network.setSize (ui.size.width - 10, ui.size.height - 10); + revision_network.redraw(); + }, + resize: function (event, ui) { + revision_network.setSize (ui.size.width - 10, ui.size.height - 10); + revision_network.redraw(); + } + }); + } + else + { + revision_network.setData (data); + } + } + + $("#code_file_revision_graph_button").button("enable"); + $("#code_file_revision_graph_spin" ).removeClass ("fa-cog fa-spin"); +} $(function () { @@ -241,7 +325,7 @@ $(function () { $("#code_file_loc_info").hide(); - btn = $("#code_file_mainarea_loc_button").button().click (function () { + btn = $("#code_file_loc_button").button().click (function () { if ($("#code_file_loc_info").is(":visible")) { $("#code_file_loc_info").hide("blind",{},200); @@ -255,9 +339,28 @@ $(function () { }); - $("#code_file_mainarea_edit_button").button(); + $("#code_file_edit_button").button(); + $("#code_file_revision_graph_button").button().click (function () { + $("#code_file_revision_graph_button").button("disable"); + $("#code_file_revision_graph_spin").addClass ("fa-cog fa-spin"); + var ajax_req = $.ajax ({ + url: codepot_merge_path ( + "", + "/graph/enjson_revision_graph/id; ?>/"), + context: document.body, + success: show_revision_graph, + error: function (xhr, ajaxOptions, thrownError) { + show_alert (xhr.status + ' ' + thrownError, "lang->line('Error')?>"); + $("#code_file_revision_graph_button").button("enable"); + $("#code_file_revision_graph_spin" ).removeClass ("fa-cog fa-spin"); + } + }); + + return false; + }); + $("#code_file_headrev_button").button().click (function() { $(location).attr ('href', codepot_merge_path("", 'id}/${hex_headpath}"; ?>')); @@ -474,9 +577,9 @@ $this->load->view ( if ((isset($login['id']) && $login['id'] != '') ) { print ' '; - print anchor ("code/edit/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Edit'), 'id="code_file_mainarea_edit_button"'); + print anchor ("code/edit/{$project->id}/{$hex_headpath}{$revreq}", $this->lang->line('Edit'), 'id="code_file_edit_button"'); } - print anchor ("#", "LOC", "id=code_file_mainarea_loc_button"); + print anchor ("#", "LOC", "id=code_file_loc_button"); } ?> @@ -514,6 +617,12 @@ $this->load->view ( //print anchor ('', $download_anchor_text, 'id="code_file_download_button"'); print anchor ("code/fetch/{$project->id}/${hex_headpath}{$revreq}", $download_anchor_text, 'id="code_file_download_button"'); if (!$is_special_stream) print anchor ('#', $this->lang->line('Enstyle'), 'id="code_file_style_button"'); + + print ''; + print ''; + print $this->lang->line('CODE_REVISION_GRAPH'); + print ''; + print ''; print '
'; @@ -550,6 +659,10 @@ $this->load->view (
+
+
+
+
 
diff --git a/codepot/src/codepot/views/code_folder.php b/codepot/src/codepot/views/code_folder.php index 79ca35bd..47a82308 100644 --- a/codepot/src/codepot/views/code_folder.php +++ b/codepot/src/codepot/views/code_folder.php @@ -201,6 +201,8 @@ function show_loc_by_file_graph (response) $("#code_folder_loc_by_file_spin" ).removeClass ("fa-cog fa-spin"); } +var revision_network = null; + function show_revision_graph (response) { var data = $.parseJSON(response); @@ -215,15 +217,16 @@ function show_revision_graph (response) else { var options = { - autoResize: true, + autoResize: false, height: '500px', width: '100%', + clickToUse: true, layout: { hierarchical: { enabled: true, - levelSeparation: 150, - nodeSpacing: 200, - treeSpacing: 400, + //levelSeparation: 150, + //nodeSpacing: 200, + //treeSpacing: 300, direction: 'LR', //'LR' 'UD', 'DU', 'RL' sortMethod: 'directed' // 'hubsize' } @@ -235,7 +238,9 @@ function show_revision_graph (response) roundness: 0.4 } }, - physics: true + physics: { + enabled: true + } }; var i, j; @@ -255,7 +260,24 @@ function show_revision_graph (response) data.edges[i].font = { color: 'red' }; } - var network = new vis.Network(document.getElementById('code_folder_result_revision_graph'), data, options); + if (revision_network === null) + { + revision_network = new vis.Network(document.getElementById('code_folder_result_revision_graph'), data, options); + $('#code_folder_result_revision_graph').resizable({ + create: function (event, ui) { + revision_network.setSize (ui.size.width - 10, ui.size.height - 10); + revision_network.redraw(); + }, + resize: function (event, ui) { + revision_network.setSize (ui.size.width - 10, ui.size.height - 10); + revision_network.redraw(); + } + }); + } + else + { + revision_network.setData (data); + } } $("#code_folder_revision_graph_button").button("enable");