PHP Classes

File: js/repdesigner.js

Recommend this page to a friend!
  Classes of Leonid   PHP Report Designer   js/repdesigner.js   Download  
File: js/repdesigner.js
Role: Auxiliary data
Content type: text/plain
Description: js script
Class: PHP Report Designer
Display interactive report data from arrays
Author: By
Last change:
Date: 9 years ago
Size: 5,679 bytes
 

Contents

Class file image Download
// ReportDesigner Backend Javascript v1.0 Leonid Martynov 2014(c) $( document ).ready(function() { $('.repd_vcell').mousedown(function() { var clone = $("<div>"+$(this).html()+"</div>"); clone.addClass('repd_vcell'); clone.css('position','absolute'); clone.attr('repd_move','true'); clone.attr('repd_fname',$(this).attr('repd_fname')); $(this).append(clone); event.preventDefault(); }); $('.repd_hcell').mousedown(function() { var clone = $("<div>"+$(this).html()+"</div>"); clone.addClass('repd_hcell'); clone.css('position','absolute'); clone.attr('repd_move','true'); clone.attr('repd_fname',$(this).attr('repd_fname')); $(this).append(clone); event.preventDefault(); }); $('.repd_vcell').mousemove(function( event ) { var mv = $('div[repd_move="true"]'); if(mv.length ) { $(this).css('border-style','dashed'); $(this).css('border-bottom','red thick dashed'); $(this).fadeTo(0,0.5); mv.attr('repd_exfield',$(this).attr('repd_fname')); } }); $('.repd_hcell').mousemove(function( event ) { var mv = $('div[repd_move="true"]'); if(mv.length ) { $(this).css('border-style','dashed'); $(this).css('border-right','red thick dashed'); $(this).fadeTo(0,0.5); mv.attr('repd_exfield',$(this).attr('repd_fname')); } }); $('.repd_vcell').mouseout(function( event ) { $(this).css('border-style','solid'); $(this).css('border-bottom','none'); $(this).fadeTo(0,1); $('div[repd_move="true"]').attr('repd_exfield',''); }); $('.repd_hcell').mouseout(function( event ) { $(this).css('border-style','solid'); $(this).fadeTo(0,1); $('div[repd_move="true"]').attr('repd_exfield',''); $(this).css('border-right','none'); }); $( '.repd_div' ).mousemove(function( event ) { var elem = $('div[repd_move="true"]'); if(elem .length ) { elem.css({top: event.pageY+20, left:event.pageX+20}); event.preventDefault(); } }); $( '.repd_div' ).mouseup(function( event ) { var elem = $('div[repd_move="true"]'); if(elem .length ) { elem.attr('repd_move','false'); event.preventDefault(); $( '#repd_action' ).val('settings'); $( '#repd_field_from').val(''); $( '#repd_field_to').val(elem.attr('repd_fname')); $( '#repd_form' ).submit(); }}); $('.repd_vcell').mouseup(function() { var elem = $('div[repd_move="true"]'); event.preventDefault(); $( '#repd_action' ).val('settings'); $( '#repd_field_from').val(elem.attr('repd_exfield')); $( '#repd_field_to').val(elem.attr('repd_fname')); elem.attr('repd_move','false'); $( '#repd_form' ).submit(); }); $('.repd_hcell').mouseup(function() { var elem = $('div[repd_move="true"]'); event.preventDefault(); $( '#repd_action' ).val('settings'); $( '#repd_field_from').val(elem.attr('repd_exfield')); $( '#repd_field_to').val(elem.attr('repd_fname')); elem.attr('repd_move','false'); $( '#repd_form' ).submit(); }); $('#repd_form').on('submit', function(e){ $( '.repd_div' ).fadeOut("slow",function (){ $( '.repd_div' ).fadeIn("slow"); }); }); var repd_progress = $('.repd_progress'); if(repd_progress.length) { repd_progress.each(function() { var per = Math.round($(this).parent().width()/100 * $(this).attr("repd_percent")) - 10; $(this).animate({width: per+"px"}, 500); //$(this).height($(this).parent().height()); }); } var repd_graph = $('div[repd_graph="true"]'); repd_graph.mouseout(function( event ) { $(this).css('border-style','solid'); $(this).fadeTo(0,1); $(this).css('border-top',''); }); repd_graph.mousemove(function( event ) { var mv = $('div[repd_move="true"]'); if(mv.length ) { $(this).css('border-style','dashed'); $(this).css('border-top','red thick dashed'); $(this).fadeTo(0,0.5); mv.attr('repd_exfield',$(this).attr('repd_fname')); } }); $('div[repd_graph="true"]').mouseup(function() { var elem = $('div[repd_move="true"]'); event.preventDefault(); $( '#repd_action' ).val('settings'); $( '#repd_field_from').val(elem.attr('repd_fname')); $( '#repd_field_to').val(elem.attr('repd_fname')); elem.attr('repd_move','false'); $( '#repd_form' ).submit(); }); if(repd_graph.length) { repd_graph.each(function() { var items = $.parseJSON($(this).attr('repd_gr_data')); var sums = $.parseJSON($(this).attr('repd_gr_max')); for (key in items) { var lines = ''; for (key2 in sums) { var per = Math.round(items[key][key2] / sums[key2] * 100); var w = per * 3; lines = lines + '<br><span style="width:100px;display:inline-block">'+key2+'</span><span style="text-align:center;padding:4px;color:white;margin:4px;background: #feccb1;background: -moz-linear-gradient(top, #feccb1 0%, #f17432 50%, #ea5507 51%, #fb955e 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#feccb1), color-stop(50%,#f17432), color-stop(51%,#ea5507), color-stop(100%,#fb955e)); background: -webkit-linear-gradient(top, #feccb1 0%,#f17432 50%,#ea5507 51%,#fb955e 100%);background: -o-linear-gradient(top, #feccb1 0%,#f17432 50%,#ea5507 51%,#fb955e 100%);background: -ms-linear-gradient(top, #feccb1 0%,#f17432 50%,#ea5507 51%,#fb955e 100%);background: linear-gradient(to bottom, #feccb1 0%,#f17432 50%,#ea5507 51%,#fb955e 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr=\'#feccb1\', endColorstr=\'#fb955e\',GradientType=0 );display:inline-block;height:20px;width:'+(per-10)+'%">&nbsp;'+per+'%</span>'; } $(this).append('<div><span style="width:200px;display:inline-block"><h3>'+key+'</h3></span>'+lines+'</div>'); } }); } }); // Function Lib