wip javascript

This commit is contained in:
John Woodlock
2012-07-03 11:18:14 +10:00
parent 342ee17b75
commit 4aa9fccca6
3 changed files with 119 additions and 7 deletions
+11 -2
View File
@@ -13,6 +13,9 @@
<link rel="stylesheet" type="text/css" href="resources/libs/jquery-ui-1.8.16.custom/css/smoothness/jquery-ui-1.8.16.custom.css" />
<link rel="stylesheet" type="text/css" href="resources/excel/excel-2007.css" />
<link rel="stylesheet" type="text/css" href="resources/stretchyreporting/stretchyreporting.css">
<script type="text/javascript" src="resources/libs/jquery-1.7.min.js"></script>
<script type="text/javascript" src="resources/libs/jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="resources/libs/DataTables-1.8.2/media/js/jquery.dataTables.min.js"></script>
@@ -26,6 +29,9 @@
<script type="text/javascript" src="resources/libs/globalize/globalize.js"></script>
<script type="text/javascript" src="resources/stretchydata-0.95.js"></script>
<script type="text/javascript" src="resources/stretchyreporting/stretchyreporting-0.987.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
</head>
<body>
@@ -871,6 +877,9 @@
display: none;
}
#toptable {
display: none;
}
</style>
<div id="logonDiv"></div>
@@ -882,10 +891,10 @@
</div>
<div id="navwrapper">
<ul id="nav" class="floatleft">
<li><a href="unknown.html" onclick="showILClientListing(baseApiUrl);return false ;">Clients</a></li>
<li><a href="unknown.html" onclick="showILClientListing(baseApiUrl);return false;">Clients</a></li>
<li><a href="org/admin/user">User Administration</a></li>
<li><a href="org/admin">Organisation Administration</a></li>
<li><a href="reporting/flexireport">Reports</a></li>
<li><a href="unknown.html" onclick="showILReporting();return false;">Reports</a></li>
</ul>
<ul id="nav" class="floatright">
<li class="dmenu"><a href="#">Theme</a>
+99
View File
@@ -81,6 +81,7 @@ function setBasicAuthKey(apiUrl, logonDivName, username, password)
function setClientListingContent(divName) {
var htmlVar = '<button id="addclient" style="clear: both;">Add a new client</button>';
htmlVar += '<div id="tabs"><ul><li><a href="#searchtab" title="searchtab">Search</a></li></ul><div id="searchtab"></div></div>';
@@ -103,6 +104,48 @@ function setAddLoanContent(divName) {
}
function setReportingContent(divName) {
var htmlVar = '<table id=toptable>';
htmlVar += '<tr>';
htmlVar += ' <td valign="top"><div id=myListOfReports></div></td>';
htmlVar += ' <td valign="bottom"><div id=myInputParameters></div></td>';
htmlVar += ' <td valign="top"><div id=myRunReportButton></div></td>';
htmlVar += ' <td valign="top"><div id=myClearReportButton></div></td>';
htmlVar += ' <td valign="bottom">';
htmlVar += ' <select id=decimalsChoice onChange="selectNewDecimals(options[selectedIndex].value)" >';
htmlVar += ' <option value="" selected="selected">Decimals</option>';
htmlVar += ' <option value="4">4</option>';
htmlVar += ' <option value="3">3</option>';
htmlVar += ' <option value="2">2</option>';
htmlVar += ' <option value="1">1</option>';
htmlVar += ' <option value="0">0</option>';
htmlVar += ' <option value="-1">-1</option>';
htmlVar += ' <option value="-2">-2</option>';
htmlVar += ' <option value="-3">-3</option>';
htmlVar += ' </select>';
htmlVar += ' </td>';
htmlVar += ' <td valign="bottom">';
htmlVar += ' <select id=decimalsThousandsSep onChange="selectNewThousandsSep(options[selectedIndex].value)" >';
htmlVar += ' <option value="" selected="selected">Format</option>';
htmlVar += ' <option value=",.">1,234,567.89</option>';
htmlVar += ' <option value=".,">1.234.567,89</option>';
htmlVar += ' <option value=" ,">1 234 567,89</option>';
htmlVar += ' <option value=" .">1 234 567.89</option>';
htmlVar += ' <option value=".' + "'" + '">1.234.567' + "'" + '89</option>';
htmlVar += ' <option value="' + "'" + ',">1'+ "'" + '234' + "'" + '567,89</option>';
htmlVar += ' <option value="INDIAN">Indian 12,34,567.89</option>';
htmlVar += ' <option value="NONE">None 1234567.89</option>';
htmlVar += ' </select>';
htmlVar += ' </td>';
htmlVar += ' </tr>';
htmlVar += '</table>';
htmlVar += '<div id=myOutput></div>';
$("#" + divName).html(htmlVar);
}
@@ -1041,3 +1084,59 @@ function loadILLoan(baseApiUrl, loanId) {
}
/* reports code */
function showILReporting() {
setReportingContent("content");
var reportingParams = {
RESTUrl: baseApiUrl + "reports",
basicAuthKey: base64,
pentahoUrl: baseApiUrl + "pentahoreport",
bundleDir: "resources/stretchyreporting/mifosngbundle/",
reportsListDiv: "myListOfReports",
runReportDiv: "myRunReportButton",
clearReportDiv: "myClearReportButton",
inputParametersDiv: "myInputParameters",
reportOutputDiv: "myOutput",
indianFormat: false,
highlightMissingXlations: "N",
loadingImg: "resources/stretchyreporting/dots64.gif",
resValue: "resources/libs/"
};
jQuery.stretchyReporting.initialise(reportingParams);
$("#toptable").slideToggle("slow");
}
function selectNewDecimals(selectedVal) {
if (!(selectedVal == "")) jQuery.stretchyReporting.changeDecimals(selectedVal);
}
function selectNewThousandsSep(selectedVal) {
if (!(selectedVal == ""))
{
switch(selectedVal )
{
case "INDIAN":
jQuery.stretchyReporting.changeSeparator(",", ".", true);
break;
case "NONE":
jQuery.stretchyReporting.changeSeparator("", ".", false);
break;
default:
jQuery.stretchyReporting.changeSeparator(selectedVal.substr(0,1), selectedVal.substr(1,1), false);
}
}
}
@@ -3,6 +3,7 @@
$.stretchyReporting = {};
$.stretchyReporting.initialise = function(params) {
initialiseReporting(params)
};
@@ -60,7 +61,6 @@ function initialiseReporting(params) {
bundleDir = 'bundle/';
if (params.bundleDir) bundleDir = params.bundleDir;
highlightMissingXlations = "Y";
if (params.highlightMissingXlations) highlightMissingXlations = params.highlightMissingXlations;
@@ -139,10 +139,7 @@ function initialiseReporting(params) {
showMsg("OAuth params were not passed");
}
// google charts
google.load("visualization", "1", {packages:["corechart"]});
// google.load('visualization', '1', {packages:['table']});
googleLoaded = false;
reportListing = [];
listOfParameters = [];
@@ -765,6 +762,13 @@ return 'var selectSuccess = function(data, textStatus,jqXHR){' +
function createChart(theData) {
if (googleLoaded == false)
{
google.load("visualization", "1", {packages:["corechart"]});
googleLoaded = true;
}
RData = new google.visualization.DataTable();
RData.addColumn('string', dataTableDef.aoColumns[0].sTitle);
RData.addColumn('number', dataTableDef.aoColumns[1].sTitle);