Find file
Fetching contributors…
Cannot retrieve contributors at this time
136 lines (117 sloc) 6.4 KB
<?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
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:
<ModulePrefs author="Jeremi Joslin - eXo Platform"
title="Sonar - Code overview"
directory_title="Sonar - Code overview"
description="Sonar gadget."
<Require feature="dynamic-height" />
<Require feature="setprefs"/>
<Require feature="settitle"/>
<UserPref name="sonar_url" datatype="string" default_value=""/>
<UserPref name="sonar_project" datatype="string"/>
<UserPref name="is_configured" datatype="hidden" default_value="0"/>
<Content type="html">
<link href="" media="all" rel="stylesheet" type="text/css" />
<!-- use the full URL because Jira does not rewrite them -->
<script type="text/javascript" src=""></script>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
function update_metrics() {
sonar.GetMetrics("ncloc,lines,classes,packages,functions,accessors", function(res) {
var resource =[0];
var prefs = new gadgets.Prefs();
var sonar_url = prefs.getString("sonar_url");
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/" + + "?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();
}, {includetrends: "true"});
$(function() {
$("#preferences").bind("finish_edit", function(){update_metrics();});
var prefs = new gadgets.Prefs();
if (prefs.getString("is_configured") === "0"){
} else {
<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">
<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>
<td width="10"> </td>
<td valign="top">
<div class="dashbox">
<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>
<!-- The template of preferences -->
<div id="preferences" style="display:none;">
<label for="id_url">Sonar Server: </label>
<span class="help">e.g.:</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>
<input type="submit" value="Save" />
<div id="footer">
<a href="" style="float:left;" target="_blank"><img src="" style="margin-right:5px;"/>eXo Platform</a>