dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26613
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13162: context-menus for report module
------------------------------------------------------------
revno: 13162
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-12-06 14:03:52 +0100
message:
context-menus for report module
modified:
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDocumentForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewReportForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js 2013-07-24 17:28:39 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js 2013-12-06 13:03:52 +0000
@@ -1,26 +1,36 @@
-function removeDocument( id )
-{
- removeItem( id, "", i18n_confirm_remove_report, "removeDocument.action" );
+
+function removeDocument( context ) {
+ removeItem(context.id, context.name, i18n_confirm_remove_report, "removeDocument.action");
}
-function toggleExternal()
-{
- var external = getListValue( "external" );
+function toggleExternal() {
+ var external = getListValue("external");
- if ( external == "true" )
- {
- document.getElementById( "fileDiv" ).style.display = "none";
- document.getElementById( "urlDiv" ).style.display = "block";
- $( '#url' ).attr( 'class', '{validate:{required:true}}' );
- $( '#upload' ).attr( 'class', '' );
- } else
- {
- document.getElementById( "fileDiv" ).style.display = "block";
- document.getElementById( "urlDiv" ).style.display = "none";
- if ( byId( 'id' ).value == "" )
- {
- $( '#upload' ).attr( 'class', '{validate:{required:true}}' );
- $( '#url' ).attr( 'class', '' );
- }
+ if( external == "true" ) {
+ document.getElementById("fileDiv").style.display = "none";
+ document.getElementById("urlDiv").style.display = "block";
+ $('#url').attr('class', '{validate:{required:true}}');
+ $('#upload').attr('class', '');
+ } else {
+ document.getElementById("fileDiv").style.display = "block";
+ document.getElementById("urlDiv").style.display = "none";
+ if( byId('id').value == "" ) {
+ $('#upload').attr('class', '{validate:{required:true}}');
+ $('#url').attr('class', '');
}
+ }
+}
+
+function displayAddDocumentForm( context ) {
+ location.href = 'displayAddDocumentForm.action?id=' + context.id;
+}
+
+function runDocument( context ) {
+ console.log(context);
+
+ if( context.external ) {
+ location.href = context.url;
+ } else {
+ location.href = '../api/documents/' + context.uid + '/data';
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js 2013-07-24 17:28:39 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js 2013-12-06 13:03:52 +0000
@@ -1,65 +1,64 @@
-function addReport()
-{
- if ( $( "#reportForm #name" ).val().trim().length == 0 )
- {
- setHeaderDelayMessage( i18n_specify_name );
- return false;
- }
-
- if ( $( "#reportForm #id" ).val().trim().length == 0 && !hasText( "upload" ) )
- {
- setHeaderDelayMessage( i18n_please_specify_file );
- return false;
- }
-
- $( "#reportForm" ).submit();
-}
-
-function removeReport( id )
-{
- removeItem( id, "", i18n_confirm_remove_report, "removeReport.action" );
-}
-
-function setReportType()
-{
- var type = $( "#type :selected" ).val();
-
- if ( "jasperReportTable" == type )
- {
- $( ".jasperJdbcDataSource" ).hide();
- $( ".htmlDataSource" ).hide();
- $( ".jasperReportTableDataSource" ).show();
- }
- else if ( "jasperJdbc" == type )
- {
- $( ".jasperReportTableDataSource" ).hide();
- $( ".htmlDataSource" ).hide();
- $( ".jasperJdbcDataSource" ).show();
- }
- else if ( "html" == type )
- {
- $( ".jasperReportTableDataSource" ).hide();
- $( ".jasperJdbcDataSource" ).hide();
- $( ".htmlDataSource" ).show();
- }
+function addReport() {
+ if( $("#reportForm #name").val().trim().length == 0 ) {
+ setHeaderDelayMessage(i18n_specify_name);
+ return false;
+ }
+
+ if( $("#reportForm #id").val().trim().length == 0 && !hasText("upload") ) {
+ setHeaderDelayMessage(i18n_please_specify_file);
+ return false;
+ }
+
+ $("#reportForm").submit();
+}
+
+function setReportType() {
+ var type = $("#type :selected").val();
+
+ if( "jasperReportTable" == type ) {
+ $(".jasperJdbcDataSource").hide();
+ $(".htmlDataSource").hide();
+ $(".jasperReportTableDataSource").show();
+ }
+ else if( "jasperJdbc" == type ) {
+ $(".jasperReportTableDataSource").hide();
+ $(".htmlDataSource").hide();
+ $(".jasperJdbcDataSource").show();
+ }
+ else if( "html" == type ) {
+ $(".jasperReportTableDataSource").hide();
+ $(".jasperJdbcDataSource").hide();
+ $(".htmlDataSource").show();
+ }
}
// -----------------------------------------------------------------------------
// View details
// -----------------------------------------------------------------------------
-function showReportDetails( reportId )
-{
- jQuery.get( 'getReport.action', { "id": reportId }, function( json )
- {
- setInnerHTML( 'nameField', json.report.name );
-
- var reportTableName = json.report.reportTableName;
- setInnerHTML( 'reportTableNameField', reportTableName ? reportTableName : '[' + i18n_none + ']' );
-
- var orgGroupSets = json.report.orgGroupSets;
- setInnerHTML( 'orgGroupSetsField', orgGroupSets == 'true' ? i18n_yes : i18n_no );
-
- showDetails();
- });
-}
\ No newline at end of file
+function createReportParams( context ) {
+ location.href = 'getReportParams.action?uid=' + context.uid + '&mode=report&type=' + context['report-type'];
+}
+
+function displayAddReportForm( context ) {
+ location.href = 'displayAddReportForm.action?id=' + context.id;
+}
+
+function removeReport( context ) {
+ removeItem(context.id, context.name, i18n_confirm_remove_report, "removeReport.action");
+}
+
+function showReportDetails( context ) {
+ jQuery.get('getReport.action', { "id": context.id }, function( json ) {
+ setInnerHTML('nameField', json.report.name);
+
+ var reportTableName = json.report.reportTableName;
+ setInnerHTML('reportTableNameField', reportTableName ? reportTableName : '[' + i18n_none + ']');
+
+ var orgGroupSets = json.report.orgGroupSets;
+ setInnerHTML('orgGroupSetsField', orgGroupSets == 'true' ? i18n_yes : i18n_no);
+
+ showDetails();
+ });
+}
+
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2013-07-24 17:28:39 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2013-12-06 13:03:52 +0000
@@ -1,5 +1,7 @@
+function removeTable( context ) {
+ removeItem(context.id, context.name, i18n_confirm_delete, "removeTable.action");
+}
-function removeTable( tableId, tableName )
-{
- removeItem( tableId, tableName, i18n_confirm_delete, "removeTable.action" );
+function runReportTable( context ) {
+ location.href = 'getReportParams.action?uid=' + context.uid + '&mode=table';
}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDocumentForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDocumentForm.vm 2013-07-24 17:28:39 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewDocumentForm.vm 2013-12-06 13:03:52 +0000
@@ -4,89 +4,84 @@
<script type="text/javascript">
jQuery(document).ready(function(){
tableSorter( 'listTable' );
+
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive',
+ listItemProps: ['id', 'uid', 'name', 'type', 'document-url', 'document-external']
+ });
});
- var i18n_confirm_remove_report = '$encoder.jsEscape( $i18n.getString( "confirm_remove_report" ) , "'")';
- var i18n_confirm_add_to_dashboard = '$encoder.jsEscape( $i18n.getString( "confirm_add_to_dashboard" ) , "'")';
+ var i18n_confirm_remove_report = '$encoder.jsEscape( $i18n.getString( "confirm_remove_report" ) , "'")';
+ var i18n_confirm_add_to_dashboard = '$encoder.jsEscape( $i18n.getString( "confirm_add_to_dashboard" ) , "'")';
</script>
<h3>$i18n.getString( "resource" ) #openHelp( "resource" )</h3>
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="runDocument"><i class="fa fa-play"></i> $i18n.getString( "view_resource" )</a></li>
+ <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i> $i18n.getString( "sharing_settings" )</a></li>
+ <li data-enabled="canUpdate"><a data-target-fn="displayAddDocumentForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li data-enabled="canDelete"><a data-target-fn="removeDocument"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ </ul>
+</div>
+
<table class="mainPageTable">
<tr>
- <td style="vertical-align:top">
- <table width="100%">
+ <td style="vertical-align:top">
+ <table width="100%">
<tr>
<td>#filterDiv( "displayViewDocumentForm" )</td>
- <td style="text-align:right">
- <input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='displayAddDocumentForm.action'">
- </td>
- </tr>
+ <td style="text-align:right">
+ <input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='displayAddDocumentForm.action'">
+ </td>
+ </tr>
</table>
- <table class="listTable" id="listTable">
- <col>
- <col width="150px">
- <thead>
- <tr>
- <th>$i18n.getString( "name" )</th>
- <th class="{sorter: false}">$i18n.getString( "operations" )</th>
- </tr>
- </thead>
- <tbody id="list">
- #foreach ( $document in $documents )
- <tr id="tr${document.id}">
- <td>$encoder.htmlEncode( $document.name )</td>
- <td>
- #if ( $document.external )
- <a href="${document.url}" title="$i18n.getString( 'view_resource' )">
- #else
- <a href="../api/documents/${document.uid}/data" title="$i18n.getString( 'view_resource' )">
- #end
-
- <img src="../images/start_process.png" alt="$i18n.getString( 'view_report' )"></a>
-
- #if ( $security.canManage( $document ) )
- <a href="javascript:showSharingDialog('document', '$document.uid');" title="$i18n.getString( 'sharing_settings' )"><img src="../images/relationship.png" alt="$i18n.getString( 'sharing_settings' )"></a>
- #else
- <img src="../images/relationship-denied.png">
- #end
-
- #if( $security.canUpdate( $document ) )
- <a href="displayAddDocumentForm.action?id=$!document.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
- #else
- <img src="../images/edit-denied.png">
- #end
-
- #if( $auth.hasAccess( "dhis-web-reporting", "removeDocument" ) && $security.canDelete( $document ) )
- <a href="javascript:removeDocument( $document.id )" title="$i18n.getString( 'remove_report' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove_report' )"></a>
- #else
- <img src="../images/delete-denied.png">
- #end
- </td>
- </tr>
- #end
- </tbody>
- </table>
+
+ <table class="listTable" id="listTable">
+ <col>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach ( $document in $documents )
+ <tr id="tr${document.id}" data-id="$!document.id" data-uid="$!document.uid" data-type="Document" data-name="$encoder.htmlEncode( $!document.displayName )"
+ data-document-url="$document.url"
+ data-document-external="$document.external"
+ data-can-manage="$security.canManage( $document )"
+ data-can-update="$security.canUpdate( $document )"
+ data-can-delete="$security.canDelete( $document )">
+ <td>$encoder.htmlEncode( $!document.displayName )</td>
+ </tr>
+ #end
+ </tbody>
+ </table>
<p></p>
#parse( "/dhis-web-commons/paging/paging.vm" )
-
- </td>
- <td id="detailsData">
-
- <div id="detailsArea">
- <div id="hideDetailsArea">
- <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/hide.png" alt="$i18n.getString( "hide_details" )"></a>
- </div>
- <p><label>$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
- <p><label>$i18n.getString( "url" ):</label><br><span id="urlField"></span></p>
- </div>
-
- <div id="warningArea">
- <div id="hideDetailsArea">
- <a href="javascript:hideWarning()" title='$i18n.getString( 'hide_warning' )'><img src="../images/hide.png" alt=$i18n.getString( "hide_warning" )'></a>
- </div>
- <p><span id="warningField"></span></p>
+ </td>
+
+ <td id="detailsData">
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )">
+ <img src="../images/hide.png" alt="$i18n.getString( "hide_details" )">
+ </a>
+ </div>
+ <p><label>$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "url" ):</label><br><span id="urlField"></span></p>
+ </div>
+
+ <div id="warningArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideWarning()" title='$i18n.getString( 'hide_warning' )'>
+ <img src="../images/hide.png" alt=$i18n.getString( "hide_warning" )'>
+ </a>
+ </div>
+ <p><span id="warningField"></span></p>
</div>
- </td>
+ </td>
</tr>
</table>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewReportForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewReportForm.vm 2013-07-24 17:28:39 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewReportForm.vm 2013-12-06 13:03:52 +0000
@@ -4,87 +4,84 @@
<script type="text/javascript">
jQuery(document).ready(function(){
tableSorter( 'listTable' );
+
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive',
+ listItemProps: ['id', 'uid', 'name', 'type', 'report-type']
+ });
});
var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ) , "'")';
var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
- var i18n_confirm_remove_report = '$encoder.jsEscape( $i18n.getString( "confirm_remove_report" ) , "'")';
- var i18n_confirm_add_to_dashboard = '$encoder.jsEscape( $i18n.getString( "confirm_add_to_dashboard" ) , "'")';
+ var i18n_confirm_remove_report = '$encoder.jsEscape( $i18n.getString( "confirm_remove_report" ) , "'")';
+ var i18n_confirm_add_to_dashboard = '$encoder.jsEscape( $i18n.getString( "confirm_add_to_dashboard" ) , "'")';
</script>
<h3>$i18n.getString( "standard_report" ) #openHelp( "standard_reports" )</h3>
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="createReportParams"><i class="fa fa-play"></i> $i18n.getString( "create" )</a></li>
+ <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i> $i18n.getString( "sharing_settings" )</a></li>
+ <li data-enabled="canUpdate"><a data-target-fn="displayAddReportForm"><i class="fa fa-edit"></i> $i18n.getString( "edit_report" )</a></li>
+ <li data-enabled="canDelete"><a data-target-fn="removeReport"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showReportDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
<table class="mainPageTable">
<tr>
- <td style="vertical-align:top">
- <table width="100%">
- <tr>
- <td>#filterDiv( "displayViewReportForm" )</td>
- <td colspan="5" style="text-align:right">
- <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='displayAddReportForm.action'" />
- </td>
- </tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+ <tr>
+ <td>#filterDiv( "displayViewReportForm" )</td>
+ <td colspan="5" style="text-align:right">
+ <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='displayAddReportForm.action'" />
+ </td>
+ </tr>
</table>
- <table class="listTable" id="listTable">
- <col>
- <col width="150px">
- <thead>
- <tr>
- <th>$i18n.getString( "name" )</th>
- <th class="{sorter: false}">$i18n.getString( "operations" )</th>
- </tr>
- </thead>
- <tbody id="list">
- #foreach ( $report in $reports )
- <tr id="tr${report.id}">
- <td onclick="showReportDetails( $report.id )">$encoder.htmlEncode( $report.name )</td>
- <td style="text-align:right">
- <a href="getReportParams.action?uid=${report.uid}&mode=report&type=${report.type}" title="$i18n.getString( 'create' )">
- <img src="../images/start_process.png" alt="$i18n.getString( 'create' )"></a>
-
- #if ( $security.canManage( $report ) )
- <a href="javascript:showSharingDialog('report', '$report.uid');" title="$i18n.getString( 'sharing_settings' )"><img src="../images/relationship.png" alt="$i18n.getString( 'sharing_settings' )"></a>
- #else
- <img src="../images/relationship-denied.png">
- #end
-
- #if( $security.canUpdate( $report ) )
- <a href="displayAddReportForm.action?id=$report.id" title="$i18n.getString( 'edit_report' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit_report' )"></a>
- #else
- <img src="../images/edit-denied.png">
- #end
-
- #if( $auth.hasAccess( "dhis-web-reporting", "removeReport" ) && $security.canDelete( $report ))
- <a href="javascript:removeReport( $report.id )" title="$i18n.getString( 'remove_report' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove_report' )"></a>
- #else <img src="../images/delete-denied.png"> #end
- <a href="javascript:showReportDetails( $report.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
- </td>
- </tr>
- #end
- </tbody>
- </table>
- <p></p>
+ <table class="listTable" id="listTable">
+ <col>
+ <col width="150px">
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ </tr>
+ </thead>
+
+ <tbody id="list">
+ #foreach ( $report in $reports )
+ <tr id="tr${report.id}" data-id="$!report.id" data-uid="$!report.uid" data-type="Report" data-name="$encoder.htmlEncode( $!report.displayName )"
+ data-report-type="$report.type"
+ data-can-manage="$security.canManage( $report )"
+ data-can-update="$security.canUpdate( $report )"
+ data-can-delete="#if( $auth.hasAccess( "dhis-web-reporting", "removeReport" ) && $security.canDelete( $report ))true#{else}false#end">
+ <td>$encoder.htmlEncode( $!report.displayName )</td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ <p></p>
#parse( "/dhis-web-commons/paging/paging.vm" )
-
- </td>
- <td id="detailsData">
+ </td>
- <div id="detailsArea">
- <div id="hideDetailsArea">
- <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"/></a>
- </div>
- <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
- <p><label>$i18n.getString( "report_table" ):</label><br/><span id="reportTableNameField"></span></p>
- <p><label>$i18n.getString( "include_organisation_unit_group_sets" ):</label><br/><span id="orgGroupSetsField"></span></p>
- </div>
+ <td id="detailsData">
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"/></a>
+ </div>
+ <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "report_table" ):</label><br/><span id="reportTableNameField"></span></p>
+ <p><label>$i18n.getString( "include_organisation_unit_group_sets" ):</label><br/><span id="orgGroupSetsField"></span></p>
+ </div>
<div id="warningArea">
<div id="hideDetailsArea">
<a href="javascript:hideWarning()" title='$i18n.getString( 'hide_warning' )'><img src="../images/hide.png" alt=$i18n.getString( "hide_warning" )'></a>
</div>
<p><span id="warningField"></span></p>
</div>
-
- </td>
+ </td>
</tr>
</table>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm 2013-07-24 17:28:39 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/viewTableForm.vm 2013-12-06 13:03:52 +0000
@@ -4,17 +4,30 @@
<script type="text/javascript">
jQuery(document).ready(function(){
tableSorter( 'listTable' );
+
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive'
+ });
});
var i18n_generate_before_export = '$encoder.jsEscape( $i18n.getString( "generate_before_export" ) , "'")';
var i18n_confirm_add_report_table_to_dashboard = '$encoder.jsEscape( $i18n.getString( "confirm_add_report_table_to_dashboard" ) , "'")';
- var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_table" ) , "'")';
- var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
- var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_table" ) , "'")';
+ var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
+ var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
</script>
<h3>$i18n.getString( "report_table" ) #openHelp( "report_tables" )</h3>
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="runReportTable"><i class="fa fa-play"></i> $i18n.getString( "create" )</a></li>
+ <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i> $i18n.getString( "sharing_settings" )</a></li>
+ <li><a data-target-fn="removeTable"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ </ul>
+</div>
+
<p>Create report tables in <a href="../dhis-web-pivot/app/index.html">Pivot table module</a></p>
<table class="mainPageTable">
@@ -22,43 +35,30 @@
<td style="vertical-align:top">
<table class="listTable" id="listTable">
<col>
- <col width="90">
- <thead>
+ <thead>
<tr>
<th>$i18n.getString( "name" )</th>
- <th class="{sorter: false}">$i18n.getString( "operations" )</th>
</tr>
</thead>
<tbody id="list">
#foreach ( $table in $tables )
- <tr id="tr${table.id}">
- <td onclick="showTableDetails( $table.id )">$encoder.htmlEncode( $table.name )</td>
- <td style="text-align:right">
- <a href="getReportParams.action?uid=${table.uid}&mode=table" title="$i18n.getString( "create" )"><img src="../images/start_process.png" alt="$i18n.getString( "create" )"></a>
-
- #if ( $security.canManage( $table ) )
- <a href="javascript:showSharingDialog('reportTable', '$table.uid');" title="$i18n.getString( 'sharing_settings' )"><img src="../images/relationship.png" alt="$i18n.getString( 'sharing_settings' )"></a>
- #else
- <img src="../images/relationship-denied.png">
- #end
-
- #if( $auth.hasAccess( "dhis-web-reporting", "removeTable" ) && $security.canDelete( $table ))
- <a href="javascript:removeTable( $table.id, '$encoder.jsEncode( $table.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
- #else <img src="../images/delete-denied.png"> #end
- </td>
+ <tr id="tr${table.id}" data-id="$!table.id" data-uid="$!table.uid" data-type="ReportTable" data-name="$encoder.htmlEncode( $!table.displayName )"
+ data-can-manage="$security.canManage( $table )"
+ data-can-update="$security.canUpdate( $table )"
+ data-can-delete="#if( $auth.hasAccess( "dhis-web-reporting", "removeTable" ) && $security.canDelete( $table ))true#{else}false#end">
+ <td>$encoder.htmlEncode( $!table.displayName )</td>
</tr>
#end
</tbody>
</table>
<p></p>
#parse( "/dhis-web-commons/paging/paging.vm" )
-
</td>
+
<td id="detailsData">
-
- <div id="detailsArea">
- <div id="hideDetailsArea">
- <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/hide.png" alt="$i18n.getString( "hide_details" )"></a>
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
+ <a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/hide.png" alt="$i18n.getString( "hide_details" )"></a>
</div>
<p><label>$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
<p><label>$i18n.getString( "indicators" ):</label><br><span id="indicatorsField"></span></p>
@@ -75,7 +75,7 @@
</div>
<p><span id="warningField"></span></p>
</div>
-
</td>
+
</tr>
</table>