Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 136 lines (117 sloc) 6.55 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
<?xml version="1.0" encoding="UTF-8" ?>
<!--

Copyright (C) 2009 eXo Platform SAS.

This is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this software; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site: http://www.fsf.org.

-->
<Module>
    <ModulePrefs author="Jeremi Joslin - eXo Platform"
                 title="Sonar - Code overview"
                 directory_title="Sonar - Code overview"
                 title_url="http://www.exoplatform.com"
                 description="Sonar gadget."
                 author_email="jeremi23@gmail.com">

        <Require feature="dynamic-height" />
        <Require feature="setprefs"/>
        <Require feature="settitle"/>
    </ModulePrefs>
    <UserPref name="sonar_url" datatype="string" default_value="http://sonar.exoplatform.org/"/>
    <UserPref name="sonar_project" datatype="string"/>
    <UserPref name="is_configured" datatype="hidden" default_value="0"/>
    <Content type="html">
      <![CDATA[
<link href="http://exogadgets.appspot.com/static/sonar/style.css" media="all" rel="stylesheet" type="text/css" />
<!-- use the full URL because Jira does not rewrite them -->
<script type="text/javascript" src="http://exogadgets.appspot.com/static/sonar/jquery.js"></script>
<script type="text/javascript" src="http://exogadgets.appspot.com/static/sonar/sonar.js"></script>
<script type="text/javascript">
function update_metrics() {
sonar.GetMetrics("ncloc,lines,classes,packages,functions,accessors", function(res) {
var resource = res.data[0];
var prefs = new gadgets.Prefs();
var sonar_url = prefs.getString("sonar_url");
$("#resource_name").text(resource.name);
$("#resource_description").text(resource.description);
for (var i = 0; i < resource.msr.length; i++) {
var metric = resource.msr[i];
$("#m_" + metric.key).text(metric.frmt_val);
$("#l_" + metric.key).attr("href", sonar_url + "drilldown/measures/" + resource.id + "?metric=" + metric.key);
if (metric["var"]) {
$("#t_" + metric.key).attr("src", sonar_url + "images/tendency/" + metric["var"] + "-black-small.png");
$("#t_" + metric.key).show();
} else {
$("#t_" + metric.key).hide();
}
}
gadgets.window.adjustHeight($(document).height());
}, {includetrends: "true"});
}



$(function() {
$("#preferences").bind("finish_edit", function(){update_metrics();});

var prefs = new gadgets.Prefs();
$("#edit").click(sonar.EditPreferences);
if (prefs.getString("is_configured") === "0"){
sonar.EditPreferences();
} else {
update_metrics();
}
});
</script>
<div id="container">
<!-- our template of code -->
<div id="body">
<h1 id="resource_name"></h1>
<span id="resource_description"></span> <a href="#" id="edit">Edit</a>

<table width="100%" style="margin-top:10px">
<tr>
<td valign="top" width="48%" nowrap>
<div class="dashbox">
<h3>Lines of code</h3>
<p><span class="big">
<a href='' id='l_ncloc' target="_blank"><span id='m_ncloc' class=''></span></a><img src="" id="t_ncloc" style="display:none;"/></span></p>
<p><a href='' id='l_lines' target="_blank"><span id='m_lines' class=''></span> lines</a><img src="" id="t_lines" style="display:none;"/></p>

</div>
</td>
<td width="10"> </td>
<td valign="top">
<div class="dashbox">

<h3>Classes</h3>
<p><span class="big"><a href='' id='l_classes' target="_blank"><span id='m_classes' class=''></span></a><img src="" id="t_classes" style="display:none;"/></p>
<p><a href='' id='l_packages' target="_blank"><span id='m_packages' class=''></span> packages</a><img src="" id="t_packages" style="display:none;"/></p>

<p><a href='' id='l_functions' target="_blank"><span id='m_functions' class=''></span> methods</a><img src="" id="t_functions" style="display:none;"/></p>

<p><a href='' id='l_accessors' target="_blank">+<span id='m_accessors' class=''></span> accessors</a><img src="" id="t_accessors" style="display:none;"/></p>

</div>
</td>
</tr>
</table>
</div>

<!-- The template of preferences -->
<div id="preferences" style="display:none;">
<form>
<fieldset>
<label for="id_url">Sonar Server: </label>
<span class="help">e.g.: http://sonar.exoplatform.org/</span>
<input type="text" name="url" id="id_url" />

<label for="id_project" style="margin-top:10px">Project</label>
<div><select name="project" id="id_project"></select></div>
</fieldset>
<input type="submit" value="Save" />
</form>
<div id="footer">
<a href="http://www.exoplatform.com" style="float:left;" target="_blank"><img src="http://www.exoplatform.com/portal/favicon.ico" style="margin-right:5px;"/>eXo Platform</a>
</div>
</div>
</div>
]]>
   </Content>
</Module>
Something went wrong with that request. Please try again.