text:
/==========================================================================================================/

	/*
	 * APP CONFIGURATION (HTML/AJAX/PHP Versions ONLY)
	 * Description: Enable / disable certain theme features here
	 */

	// Impacts the responce rate of some of the responsive elements (lower value affects CPU but improves speed)
	$.throttle_delay = 350;

	// The rate at which the menu expands revealing child elements on click
	$.menu_speed = 235;

	// Your left nav in your app will no longer fire ajax calls, set it to false for HTML version
	$.navAsAjax = true;

	// Turn on JarvisWidget functionality
	// dependency: js/jarviswidget/jarvis.widget.min.js
	$.enableJarvisWidgets = true;

	// Warning: Enabling mobile widgets could potentially crash your webApp if you have too many
	// widgets running at once (must have $.enableJarvisWidgets = true)
	$.enableMobileWidgets = false;

	// Turn on fast click for mobile devices?
	// Enable this to activate fastclick plugin
	// dependency: js/plugin/fastclick/fastclick.js
	$.fastClick = false;

/==========================================================================================================/

	// Calculate nav height
	$.calc_navbar_height = function() {
		var height = null;

		if ($('#header').length)
			height = $('#header').height();

		if (height === null)
			height = $('

').height();

		if (height === null)
			return 49;
		// default
		return height;
	};

	$.navbar_height = $.calc_navbar_height();

	/*
	 * APP DOM REFERENCES
	 * Description: Obj DOM reference, please try to avoid changing these
	 */
	$.root_ = $('body');
	$.left_panel = $('#left-panel');
	$.shortcut_dropdown = $('#shortcut');
	$.bread_crumb = $('#ribbon ol.breadcrumb');

	// interval array (to be used with jarviswidget in ajax and angular mode) to clear auto fetch interval
	$.intervalArr = new Array();

	// Top menu on/off
	var $topmenu = false;

    // desktop or mobile
    $.device = null;

	/*
	 * DETECT MOBILE DEVICES
	 * Description: Detects mobile device - if any of the listed device is detected
	 * a class is inserted to $.root_ and the variable $.device is decleard.
	 */

	/* so far this is covering most hand held devices */
	var ismobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));

	if (!ismobile) {
		// Desktop
		$.root_.addClass("desktop-detected");
		$.device = "desktop";
	} else {
		// Mobile
		$.root_.addClass("mobile-detected");
		$.device = "mobile";

		if ($.fastClick) {
			// Removes the tap delay in idevices
			// dependency: js/plugin/fastclick/fastclick.js
			$.root_.addClass("needsclick");
			FastClick.attach(document.body);
		}

	}

	/*
	 * CHECK FOR MENU POSITION
	 */

 	if ($('body').hasClass("menu-on-top") || localStorage.getItem('sm-setmenu')=='top' ) {
 		$topmenu = true;
 		$('body').addClass("menu-on-top");
 	}

/* ~ END: CHECK MOBILE DEVICE */

/*
 * DOCUMENT LOADED EVENT
 * Description: Fire when DOM is ready
 */

jQuery(document).ready(function() {

	/*
	 * SMART ACTIONS
	 */
	var smartActions = {

	    // LOGOUT MSG
	    userLogout: function($this){

			// ask verification
			$.SmartMessageBox({
				title : " Logout " + $('#show-shortcut').text() + " ?",
				content : $this.data('logout-msg') || "You can improve your security further after logging out by closing this opened browser",
				buttons : '[No][Yes]'

			}, function(ButtonPressed) {
				if (ButtonPressed == "Yes") {
					$.root_.addClass('animated fadeOutUp');
					setTimeout(logout, 1000);
				}
			});
			function logout() {
				window.location = $this.attr('href');
			}

		},

		// RESET WIDGETS
	    resetWidgets: function($this){
			$.widresetMSG = $this.data('reset-msg');

			$.SmartMessageBox({
				title : " Clear Local Storage",
				content : $.widresetMSG || "Would you like to RESET all your saved widgets and clear LocalStorage?",
				buttons : '[No][Yes]'
			}, function(ButtonPressed) {
				if (ButtonPressed == "Yes" && localStorage) {
					localStorage.clear();
					location.reload();
				}

			});
	    },

	    // LAUNCH FULLSCREEN
	    launchFullscreen: function(element){

			if (!$.root_.hasClass("full-screen")) {

				$.root_.addClass("full-screen");

				if (element.requestFullscreen) {
					element.requestFullscreen();
				} else if (element.mozRequestFullScreen) {
					element.mozRequestFullScreen();
				} else if (element.webkitRequestFullscreen) {
					element.webkitRequestFullscreen();
				} else if (element.msRequestFullscreen) {
					element.msRequestFullscreen();
				}

			} else {

				$.root_.removeClass("full-screen");

				if (document.exitFullscreen) {
					document.exitFullscreen();
				} else if (document.mozCancelFullScreen) {
					document.mozCancelFullScreen();
				} else if (document.webkitExitFullscreen) {
					document.webkitExitFullscreen();
				}

			}

	   },

	   // MINIFY MENU
	    minifyMenu: function(){
	    	if (!$.root_.hasClass("menu-on-top")){
				$.root_.toggleClass("minified");
				$.root_.removeClass("hidden-menu");
				$('html').removeClass("hidden-menu-mobile-lock");
				$this.effect("highlight", {}, 500);
			}
	    },

	    // TOGGLE MENU
	    toggleMenu: function(){
	    	if (!$.root_.hasClass("menu-on-top")){
				$('html').toggleClass("hidden-menu-mobile-lock");
				$.root_.toggleClass("hidden-menu");
				$.root_.removeClass("minified");
	    	} else if ( $.root_.hasClass("menu-on-top") && $.root_.hasClass("mobile-view-activated") ) {
	    		$('html').toggleClass("hidden-menu-mobile-lock");
				$.root_.toggleClass("hidden-menu");
				$.root_.removeClass("minified");
	    	}
	    },

	    // TOGGLE SHORTCUT
	    toggleShortcut: function(){

			if ($.shortcut_dropdown.is(":visible")) {
				shortcut_buttons_hide();
			} else {
				shortcut_buttons_show();
			}

			// SHORT CUT (buttons that appear when clicked on user name)
			$.shortcut_dropdown.find('a').click(function(e) {
				e.preventDefault();
				window.location = $(this).attr('href');
				setTimeout(shortcut_buttons_hide, 300);

			});

			// SHORTCUT buttons goes away if mouse is clicked outside of the area
			$(document).mouseup(function(e) {
				if (!$.shortcut_dropdown.is(e.target) && $.shortcut_dropdown.has(e.target).length === 0) {
					shortcut_buttons_hide();
				}
			});

			// SHORTCUT ANIMATE HIDE
			function shortcut_buttons_hide() {
				$.shortcut_dropdown.animate({
					height : "hide"
				}, 300, "easeOutCirc");
				$.root_.removeClass('shortcut-on');

			}

			// SHORTCUT ANIMATE SHOW
			function shortcut_buttons_show() {
				$.shortcut_dropdown.animate({
					height : "show"
				}, 200, "easeOutCirc");
				$.root_.addClass('shortcut-on');
			}

	    }

	};

	$.root_.on('click', '[data-action="userLogout"]', function(e) {
		var $this = $(this);
		smartActions.userLogout($this);
		e.preventDefault();
	});

	$.root_.on('click', '[data-action="resetWidgets"]', function(e) {
		var $this = $(this);
		smartActions.resetWidgets($this);
		e.preventDefault();
	});

	$.root_.on('click', '[data-action="launchFullscreen"]', function(e) {
		smartActions.launchFullscreen(document.documentElement);
		e.preventDefault();
	});

	$.root_.on('click', '[data-action="minifyMenu"]', function(e) {
		var $this = $(this);
		smartActions.minifyMenu($this);
		e.preventDefault();
	});

	$.root_.on('click', '[data-action="toggleMenu"]', function(e) {
		smartActions.toggleMenu();
		e.preventDefault();
	});

	$.root_.on('click', '[data-action="toggleShortcut"]', function(e) {
		smartActions.toggleShortcut();
		e.preventDefault();
	});

	/*
	 * FIRE TOOLTIPS
	 */
	if ($("[rel=tooltip]").length) {
		$("[rel=tooltip]").tooltip();
	}

	// INITIALIZE LEFT NAV
	if (!$topmenu) {
		if (!null) {
			$('nav ul').jarvismenu({
				accordion : true,
				speed : $.menu_speed,
				closedSign : '',
				openedSign : ''
			});
		} else {
			alert("Error - menu anchor does not exist");
		}
	}

	// SHOW & HIDE MOBILE SEARCH FIELD
	$('#search-mobile').click(function() {
		$.root_.addClass('search-mobile');
	});

	$('#cancel-search-js').click(function() {
		$.root_.removeClass('search-mobile');
	});

	// ACTIVITY
	// ajax drop
	$('#activity').click(function(e) {
		var $this = $(this);

		if ($this.find('.badge').hasClass('bg-color-red')) {
			$this.find('.badge').removeClassPrefix('bg-color-');
			$this.find('.badge').text("0");
			// console.log("Ajax call for activity")
		}

		if (!$this.next('.ajax-dropdown').is(':visible')) {
			$this.next('.ajax-dropdown').fadeIn(150);
			$this.addClass('active');
		} else {
			$this.next('.ajax-dropdown').fadeOut(150);
			$this.removeClass('active');
		}

		var mytest = $this.next('.ajax-dropdown').find('.btn-group > .active > input').attr('id');
		//console.log(mytest)

		e.preventDefault();
	});

	$('input[name="activity"]').change(function() {
		//alert($(this).val())
		var $this = $(this);

		url = $this.attr('id');
		container = $('.ajax-notifications');

		loadURL(url, container);

	});

	$(document).mouseup(function(e) {
		if (!$('.ajax-dropdown').is(e.target) && $('.ajax-dropdown').has(e.target).length === 0) {
			$('.ajax-dropdown').fadeOut(150);
			$('.ajax-dropdown').prev().removeClass("active");
		}
	});

	$('button[data-btn-loading]').on('click', function() {
		var btn = $(this);
		btn.button('loading');
		setTimeout(function() {
			btn.button('reset');
		}, 3000);
	});

	// NOTIFICATION IS PRESENT

	function notification_check() {
		$this = $('#activity > .badge');

		if (parseInt($this.text()) > 0) {
			$this.addClass("bg-color-red bounceIn animated");
		}
	}

	notification_check();

});

/*
 * RESIZER WITH THROTTLE
 * Source: http://benalman.com/code/projects/jquery-resize/examples/resize/
 */

(function ($, window, undefined) {

    var elems = $([]),
        jq_resize = $.resize = $.extend($.resize, {}),
        timeout_id, str_setTimeout = 'setTimeout',
        str_resize = 'resize',
        str_data = str_resize + '-special-event',
        str_delay = 'delay',
        str_throttle = 'throttleWindow';

    jq_resize[str_delay] = $.throttle_delay;

    jq_resize[str_throttle] = true;

    $.event.special[str_resize] = {

        setup: function () {
            if (!jq_resize[str_throttle] && this[str_setTimeout]) {
                return false;
            }

            var elem = $(this);
            elems = elems.add(elem);
            try {
                $.data(this, str_data, {
                    w: elem.width(),
                    h: elem.height()
                });
            } catch (e) {
                $.data(this, str_data, {
                    w: elem.width, // elem.width();
                    h: elem.height // elem.height();
                });
            }

            if (elems.length === 1) {
                loopy();
            }
        },
        teardown: function () {
            if (!jq_resize[str_throttle] && this[str_setTimeout]) {
                return false;
            }

            var elem = $(this);
            elems = elems.not(elem);
            elem.removeData(str_data);
            if (!elems.length) {
                clearTimeout(timeout_id);
            }
        },

        add: function (handleObj) {
            if (!jq_resize[str_throttle] && this[str_setTimeout]) {
                return false;
            }
            var old_handler;

            function new_handler(e, w, h) {
                var elem = $(this),
                    data = $.data(this, str_data);
                data.w = w !== undefined ? w : elem.width();
                data.h = h !== undefined ? h : elem.height();

                old_handler.apply(this, arguments);
            }
            if ($.isFunction(handleObj)) {
                old_handler = handleObj;
                return new_handler;
            } else {
                old_handler = handleObj.handler;
                handleObj.handler = new_handler;
            }
        }
    };

    function loopy() {
        timeout_id = window[str_setTimeout](function () {
            elems.each(function () {
                var width;
                var height;

                var elem = $(this),
                    data = $.data(this, str_data); //width = elem.width(), height = elem.height();

                // Highcharts fix
                try {
                    width = elem.width();
                } catch (e) {
                    width = elem.width;
                }

                try {
                    height = elem.height();
                } catch (e) {
                    height = elem.height;
                }
                //fixed bug

                if (width !== data.w || height !== data.h) {
                    elem.trigger(str_resize, [data.w = width, data.h = height]);
                }

            });
            loopy();

        }, jq_resize[str_delay]);

    }

})(jQuery, this);

/*
* ADD CLASS WHEN BELOW CERTAIN WIDTH (MOBILE MENU)
* Description: changes the page min-width of #CONTENT and NAV when navigation is resized.
* This is to counter bugs for min page width on many desktop and mobile devices.
* Note: This script uses JSthrottle technique so don't worry about memory/CPU usage
*/

$('#main').resize(function() {
	check_if_mobile_width();
});

function check_if_mobile_width() {
	if ($(window).width() < 979) {
		$.root_.addClass('mobile-view-activated');
		$.root_.removeClass('minified');
	} else if ($.root_.hasClass('mobile-view-activated')) {
		$.root_.removeClass('mobile-view-activated');
	}
}

/* ~ END: NAV OR #LEFT-BAR RESIZE DETECT */

/*
 * DETECT IE VERSION
 * Description: A short snippet for detecting versions of IE in JavaScript
 * without resorting to user-agent sniffing
 * RETURNS:
 * If you're not in IE (or IE version is less than 5) then:
 * //ie === undefined
 *
 * If you're in IE (>=5) then you can determine which version:
 * // ie === 7; // IE7
 *
 * Thus, to detect IE:
 * // if (ie) {}
 *
 * And to detect the version:
 * ie === 6 // IE6
 * ie > 7 // IE8, IE9 ...
 * ie < 9 // Anything less than IE9
 */

// TODO: delete this function later on - no longer needed (?)
var ie = ( function() {

		var undef, v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i');

		while (div.innerHTML = '', all[0]);

		return v > 4 ? v : undef;

	}()); // do we need this?

/* ~ END: DETECT IE VERSION */

/*
 * CUSTOM MENU PLUGIN
 */

$.fn.extend({

	//pass the options variable to the function
	jarvismenu : function(options) {

		var defaults = {
			accordion : 'true',
			speed : 200,
			closedSign : '[+]',
			openedSign : '[-]'
		};

		// Extend our default options with those provided.
		var opts = $.extend(defaults, options);
		//Assign current element to variable, in this case is UL element
		var $this = $(this);

		//add a mark [+] to a multilevel menu
		$this.find("li").each(function() {
			if ($(this).find("ul").size() !== 0) {
				//add the multilevel sign next to the link
				$(this).find("a:first").append("" + opts.closedSign + "");

				//avoid jumping to the top of the page when the href is an #
				if ($(this).find("a:first").attr('href') == "#") {
					$(this).find("a:first").click(function() {
						return false;
					});
				}
			}
		});

		//open active level
		$this.find("li.active").each(function() {
			$(this).parents("ul").slideDown(opts.speed);
			$(this).parents("ul").parent("li").find("b:first").html(opts.openedSign);
			$(this).parents("ul").parent("li").addClass("open");
		});

		$this.find("li a").click(function() {

			if ($(this).parent().find("ul").size() !== 0) {

				if (opts.accordion) {
					//Do nothing when the list is open
					if (!$(this).parent().find("ul").is(':visible')) {
						parents = $(this).parent().parents("ul");
						visible = $this.find("ul:visible");
						visible.each(function(visibleIndex) {
							var close = true;
							parents.each(function(parentIndex) {
								if (parents[parentIndex] == visible[visibleIndex]) {
									close = false;
									return false;
								}
							});
							if (close) {
								if ($(this).parent().find("ul") != visible[visibleIndex]) {
									$(visible[visibleIndex]).slideUp(opts.speed, function() {
										$(this).parent("li").find("b:first").html(opts.closedSign);
										$(this).parent("li").removeClass("open");
									});

								}
							}
						});
					}
				}// end if
				if ($(this).parent().find("ul:first").is(":visible") && !$(this).parent().find("ul:first").hasClass("active")) {
					$(this).parent().find("ul:first").slideUp(opts.speed, function() {
						$(this).parent("li").removeClass("open");
						$(this).parent("li").find("b:first").delay(opts.speed).html(opts.closedSign);
					});

				} else {
					$(this).parent().find("ul:first").slideDown(opts.speed, function() {
						/*$(this).effect("highlight", {color : '#616161'}, 500); - disabled due to CPU clocking on phones*/
						$(this).parent("li").addClass("open");
						$(this).parent("li").find("b:first").delay(opts.speed).html(opts.openedSign);
					});
				} // end else
			} // end if
		});
	} // end function
});

/* ~ END: CUSTOM MENU PLUGIN */

/*
 * ELEMENT EXIST OR NOT
 * Description: returns true or false
 * Usage: $('#myDiv').doesExist();
 */

jQuery.fn.doesExist = function() {
	return jQuery(this).length > 0;
};

/* ~ END: ELEMENT EXIST OR NOT */

/*
 * INITIALIZE FORMS
 * Description: Select2, Masking, Datepicker, Autocomplete
 */

function runAllForms() {

	/*
	 * BOOTSTRAP SLIDER PLUGIN
	 * Usage:
	 * Dependency: js/plugin/bootstrap-slider
	 */
	if ($.fn.slider) {
		$('.slider').slider();
	}

	/*
	 * SELECT2 PLUGIN
	 * Usage:
	 * Dependency: js/plugin/select2/
	 */
	if ($.fn.select2) {
		$('.select2').each(function() {
			var $this = $(this);
			var width = $this.attr('data-select-width') || '100%';
			//, _showSearchInput = $this.attr('data-select-search') === 'true';
			$this.select2({
				//showSearchInput : _showSearchInput,
				allowClear : true,
				width : width
			});
		});
	}

	/*
	 * MASKING
	 * Dependency: js/plugin/masked-input/
	 */
	if ($.fn.mask) {
		$('[data-mask]').each(function() {

			var $this = $(this);
			var mask = $this.attr('data-mask') || 'error...', mask_placeholder = $this.attr('data-mask-placeholder') || 'X';

			$this.mask(mask, {
				placeholder : mask_placeholder
			});
		});
	}

	/*
	 * AUTOCOMPLETE
	 * Dependency: js/jqui
	 */
	if ($.fn.autocomplete) {
		$('[data-autocomplete]').each(function() {

			var $this = $(this);
			var availableTags = $this.data('autocomplete') || ["The", "Quick", "Brown", "Fox", "Jumps", "Over", "Three", "Lazy", "Dogs"];

			$this.autocomplete({
				source : availableTags
			});
		});
	}

	/*
	 * JQUERY UI DATE
	 * Dependency: js/libs/jquery-ui-1.10.3.min.js
	 * Usage: <input class="datepicker" />
	 */
	if ($.fn.datepicker) {
		$('.datepicker').each(function() {

			var $this = $(this);
			var dataDateFormat = $this.attr('data-dateformat') || 'dd.mm.yy';

			$this.datepicker({
				dateFormat : dataDateFormat,
				prevText : '',
				nextText : '',
			});
		});
	}

	/*
	 * AJAX BUTTON LOADING TEXT
	 * Usage: <button type="button" data-loading-text="Loading..." class="btn btn-xs btn-default ajax-refresh"> .. </button>
	 */
	$('button[data-loading-text]').on('click', function() {
		var btn = $(this);
		btn.button('loading');
		setTimeout(function() {
			btn.button('reset');
		}, 3000);
	});

}

/* ~ END: INITIALIZE FORMS */

/*
 * INITIALIZE CHARTS
 * Description: Sparklines, PieCharts
 */

function runAllCharts() {
	/*
	 * SPARKLINES
	 * DEPENDENCY: js/plugins/sparkline/jquery.sparkline.min.js
	 * See usage example below...
	 */

	/* Usage:
	 *

	 *			5,6,7,9,9,5,9,6,5,6,6,7,7,6,7,8,9,7
	 *

	 */

	if ($.fn.sparkline) {

		// variable declearations:

		var barColor,
		    sparklineHeight,
		    sparklineBarWidth,
		    sparklineBarSpacing,
		    sparklineNegBarColor,
		    sparklineStackedColor,
		    thisLineColor,
		    thisLineWidth,
		    thisFill,
		    thisSpotColor,
		    thisMinSpotColor,
		    thisMaxSpotColor,
		    thishighlightSpotColor,
		    thisHighlightLineColor,
		    thisSpotRadius,
			pieColors,
		    pieWidthHeight,
		    pieBorderColor,
		    pieOffset,
		 	thisBoxWidth,
		    thisBoxHeight,
		    thisBoxRaw,
		    thisBoxTarget,
		    thisBoxMin,
		    thisBoxMax,
		    thisShowOutlier,
		    thisIQR,
		    thisBoxSpotRadius,
		    thisBoxLineColor,
		    thisBoxFillColor,
		    thisBoxWhisColor,
		    thisBoxOutlineColor,
		    thisBoxOutlineFill,
		    thisBoxMedianColor,
		    thisBoxTargetColor,
			thisBulletHeight,
		    thisBulletWidth,
		    thisBulletColor,
		    thisBulletPerformanceColor,
		    thisBulletRangeColors,
			thisDiscreteHeight,
		    thisDiscreteWidth,
		    thisDiscreteLineColor,
		    thisDiscreteLineHeight,
		    thisDiscreteThrushold,
		    thisDiscreteThrusholdColor,
			thisTristateHeight,
		    thisTristatePosBarColor,
		    thisTristateNegBarColor,
		    thisTristateZeroBarColor,
		    thisTristateBarWidth,
		    thisTristateBarSpacing,
		    thisZeroAxis,
		    thisBarColor,
		    sparklineWidth,
		    sparklineValue,
		    sparklineValueSpots1,
		    sparklineValueSpots2,
		    thisLineWidth1,
		    thisLineWidth2,
		    thisLineColor1,
		    thisLineColor2,
		    thisSpotRadius1,
		    thisSpotRadius2,
		    thisMinSpotColor1,
		    thisMaxSpotColor1,
		    thisMinSpotColor2,
		    thisMaxSpotColor2,
		    thishighlightSpotColor1,
		    thisHighlightLineColor1,
		    thishighlightSpotColor2,
		    thisFillColor1,
		    thisFillColor2;

		$('.sparkline').each(function() {
			var $this = $(this);
			var sparklineType = $this.data('sparkline-type') || 'bar';

			// BAR CHART
			if (sparklineType == 'bar') {

					barColor = $this.data('sparkline-bar-color') || $this.css('color') || '#0000f0';
				    sparklineHeight = $this.data('sparkline-height') || '26px';
				    sparklineBarWidth = $this.data('sparkline-barwidth') || 5;
				    sparklineBarSpacing = $this.data('sparkline-barspacing') || 2;
				    sparklineNegBarColor = $this.data('sparkline-negbar-color') || '#A90329';
				    sparklineStackedColor = $this.data('sparkline-barstacked-color') || ["#A90329", "#0099c6", "#98AA56", "#da532c", "#4490B1", "#6E9461", "#990099", "#B4CAD3"];

				$this.sparkline('html', {
					barColor : barColor,
					type : sparklineType,
					height : sparklineHeight,
					barWidth : sparklineBarWidth,
					barSpacing : sparklineBarSpacing,
					stackedBarColor : sparklineStackedColor,
					negBarColor : sparklineNegBarColor,
					zeroAxis : 'false'
				});

			}

			// LINE CHART
			if (sparklineType == 'line') {

					sparklineHeight = $this.data('sparkline-height') || '20px';
				    sparklineWidth = $this.data('sparkline-width') || '90px';
				    thisLineColor = $this.data('sparkline-line-color') || $this.css('color') || '#0000f0';
				    thisLineWidth = $this.data('sparkline-line-width') || 1;
				    thisFill = $this.data('fill-color') || '#c0d0f0';
				    thisSpotColor = $this.data('sparkline-spot-color') || '#f08000';
				    thisMinSpotColor = $this.data('sparkline-minspot-color') || '#ed1c24';
				    thisMaxSpotColor = $this.data('sparkline-maxspot-color') || '#f08000';
				    thishighlightSpotColor = $this.data('sparkline-highlightspot-color') || '#50f050';
				    thisHighlightLineColor = $this.data('sparkline-highlightline-color') || 'f02020';
				    thisSpotRadius = $this.data('sparkline-spotradius') || 1.5;
					thisChartMinYRange = $this.data('sparkline-min-y') || 'undefined';
					thisChartMaxYRange = $this.data('sparkline-max-y') || 'undefined';
					thisChartMinXRange = $this.data('sparkline-min-x') || 'undefined';
					thisChartMaxXRange = $this.data('sparkline-max-x') || 'undefined';
					thisMinNormValue = $this.data('min-val') || 'undefined';
					thisMaxNormValue = $this.data('max-val') || 'undefined';
					thisNormColor =  $this.data('norm-color') || '#c0c0c0';
					thisDrawNormalOnTop = $this.data('draw-normal') || false;

				$this.sparkline('html', {
					type : 'line',
					width : sparklineWidth,
					height : sparklineHeight,
					lineWidth : thisLineWidth,
					lineColor : thisLineColor,
					fillColor : thisFill,
					spotColor : thisSpotColor,
					minSpotColor : thisMinSpotColor,
					maxSpotColor : thisMaxSpotColor,
					highlightSpotColor : thishighlightSpotColor,
					highlightLineColor : thisHighlightLineColor,
					spotRadius : thisSpotRadius,
					chartRangeMin : thisChartMinYRange,
					chartRangeMax : thisChartMaxYRange,
					chartRangeMinX : thisChartMinXRange,
					chartRangeMaxX : thisChartMaxXRange,
					normalRangeMin : thisMinNormValue,
					normalRangeMax : thisMaxNormValue,
					normalRangeColor : thisNormColor,
					drawNormalOnTop : thisDrawNormalOnTop

				});

			}

			// PIE CHART
			if (sparklineType == 'pie') {

					pieColors = $this.data('sparkline-piecolor') || ["#B4CAD3", "#4490B1", "#98AA56", "#da532c","#6E9461", "#0099c6", "#990099", "#717D8A"];
				    pieWidthHeight = $this.data('sparkline-piesize') || 90;
				    pieBorderColor = $this.data('border-color') || '#45494C';
				    pieOffset = $this.data('sparkline-offset') || 0;

				$this.sparkline('html', {
					type : 'pie',
					width : pieWidthHeight,
					height : pieWidthHeight,
					tooltipFormat : '● ({{percent.1}}%)',
					sliceColors : pieColors,
					borderWidth : 1,
					offset : pieOffset,
					borderColor : pieBorderColor
				});

			}

			// BOX PLOT
			if (sparklineType == 'box') {

					thisBoxWidth = $this.data('sparkline-width') || 'auto';
				    thisBoxHeight = $this.data('sparkline-height') || 'auto';
				    thisBoxRaw = $this.data('sparkline-boxraw') || false;
				    thisBoxTarget = $this.data('sparkline-targetval') || 'undefined';
				    thisBoxMin = $this.data('sparkline-min') || 'undefined';
				    thisBoxMax = $this.data('sparkline-max') || 'undefined';
				    thisShowOutlier = $this.data('sparkline-showoutlier') || true;
				    thisIQR = $this.data('sparkline-outlier-iqr') || 1.5;
				    thisBoxSpotRadius = $this.data('sparkline-spotradius') || 1.5;
				    thisBoxLineColor = $this.css('color') || '#000000';
				    thisBoxFillColor = $this.data('fill-color') || '#c0d0f0';
				    thisBoxWhisColor = $this.data('sparkline-whis-color') || '#000000';
				    thisBoxOutlineColor = $this.data('sparkline-outline-color') || '#303030';
				    thisBoxOutlineFill = $this.data('sparkline-outlinefill-color') || '#f0f0f0';
				    thisBoxMedianColor = $this.data('sparkline-outlinemedian-color') || '#f00000';
				    thisBoxTargetColor = $this.data('sparkline-outlinetarget-color') || '#40a020';

				$this.sparkline('html', {
					type : 'box',
					width : thisBoxWidth,
					height : thisBoxHeight,
					raw : thisBoxRaw,
					target : thisBoxTarget,
					minValue : thisBoxMin,
					maxValue : thisBoxMax,
					showOutliers : thisShowOutlier,
					outlierIQR : thisIQR,
					spotRadius : thisBoxSpotRadius,
					boxLineColor : thisBoxLineColor,
					boxFillColor : thisBoxFillColor,
					whiskerColor : thisBoxWhisColor,
					outlierLineColor : thisBoxOutlineColor,
					outlierFillColor : thisBoxOutlineFill,
					medianColor : thisBoxMedianColor,
					targetColor : thisBoxTargetColor

				});

			}

			// BULLET
			if (sparklineType == 'bullet') {

				var thisBulletHeight = $this.data('sparkline-height') || 'auto';
				    thisBulletWidth = $this.data('sparkline-width') || 2;
				    thisBulletColor = $this.data('sparkline-bullet-color') || '#ed1c24';
				    thisBulletPerformanceColor = $this.data('sparkline-performance-color') || '#3030f0';
				    thisBulletRangeColors = $this.data('sparkline-bulletrange-color') || ["#d3dafe", "#a8b6ff", "#7f94ff"];

				$this.sparkline('html', {

					type : 'bullet',
					height : thisBulletHeight,
					targetWidth : thisBulletWidth,
					targetColor : thisBulletColor,
					performanceColor : thisBulletPerformanceColor,
					rangeColors : thisBulletRangeColors

				});

			}

			// DISCRETE
			if (sparklineType == 'discrete') {

				 	thisDiscreteHeight = $this.data('sparkline-height') || 26;
				    thisDiscreteWidth = $this.data('sparkline-width') || 50;
				    thisDiscreteLineColor = $this.css('color');
				    thisDiscreteLineHeight = $this.data('sparkline-line-height') || 5;
				    thisDiscreteThrushold = $this.data('sparkline-threshold') || 'undefined';
				    thisDiscreteThrusholdColor = $this.data('sparkline-threshold-color') || '#ed1c24';

				$this.sparkline('html', {

					type : 'discrete',
					width : thisDiscreteWidth,
					height : thisDiscreteHeight,
					lineColor : thisDiscreteLineColor,
					lineHeight : thisDiscreteLineHeight,
					thresholdValue : thisDiscreteThrushold,
					thresholdColor : thisDiscreteThrusholdColor

				});

			}

			// TRISTATE
			if (sparklineType == 'tristate') {

				 	thisTristateHeight = $this.data('sparkline-height') || 26;
				    thisTristatePosBarColor = $this.data('sparkline-posbar-color') || '#60f060';
				    thisTristateNegBarColor = $this.data('sparkline-negbar-color') || '#f04040';
				    thisTristateZeroBarColor = $this.data('sparkline-zerobar-color') || '#909090';
				    thisTristateBarWidth = $this.data('sparkline-barwidth') || 5;
				    thisTristateBarSpacing = $this.data('sparkline-barspacing') || 2;
				    thisZeroAxis = $this.data('sparkline-zeroaxis') || false;

				$this.sparkline('html', {

					type : 'tristate',
					height : thisTristateHeight,
					posBarColor : thisBarColor,
					negBarColor : thisTristateNegBarColor,
					zeroBarColor : thisTristateZeroBarColor,
					barWidth : thisTristateBarWidth,
					barSpacing : thisTristateBarSpacing,
					zeroAxis : thisZeroAxis

				});

			}

			//COMPOSITE: BAR
			if (sparklineType == 'compositebar') {

				 	sparklineHeight = $this.data('sparkline-height') || '20px';
				    sparklineWidth = $this.data('sparkline-width') || '100%';
				    sparklineBarWidth = $this.data('sparkline-barwidth') || 3;
				    thisLineWidth = $this.data('sparkline-line-width') || 1;
				    thisLineColor = $this.data('sparkline-color-top') || '#ed1c24';
				    thisBarColor = $this.data('sparkline-color-bottom') || '#333333';

				$this.sparkline($this.data('sparkline-bar-val'), {

					type : 'bar',
					width : sparklineWidth,
					height : sparklineHeight,
					barColor : thisBarColor,
					barWidth : sparklineBarWidth
					//barSpacing: 5

				});

				$this.sparkline($this.data('sparkline-line-val'), {

					width : sparklineWidth,
					height : sparklineHeight,
					lineColor : thisLineColor,
					lineWidth : thisLineWidth,
					composite : true,
					fillColor : false

				});

			}

			//COMPOSITE: LINE
			if (sparklineType == 'compositeline') {

					sparklineHeight = $this.data('sparkline-height') || '20px';
				    sparklineWidth = $this.data('sparkline-width') || '90px';
				    sparklineValue = $this.data('sparkline-bar-val');
				    sparklineValueSpots1 = $this.data('sparkline-bar-val-spots-top') || null;
				    sparklineValueSpots2 = $this.data('sparkline-bar-val-spots-bottom') || null;
				    thisLineWidth1 = $this.data('sparkline-line-width-top') || 1;
				    thisLineWidth2 = $this.data('sparkline-line-width-bottom') || 1;
				    thisLineColor1 = $this.data('sparkline-color-top') || '#333333';
				    thisLineColor2 = $this.data('sparkline-color-bottom') || '#ed1c24';
				    thisSpotRadius1 = $this.data('sparkline-spotradius-top') || 1.5;
				    thisSpotRadius2 = $this.data('sparkline-spotradius-bottom') || thisSpotRadius1;
				    thisSpotColor = $this.data('sparkline-spot-color') || '#f08000';
				    thisMinSpotColor1 = $this.data('sparkline-minspot-color-top') || '#ed1c24';
				    thisMaxSpotColor1 = $this.data('sparkline-maxspot-color-top') || '#f08000';
				    thisMinSpotColor2 = $this.data('sparkline-minspot-color-bottom') || thisMinSpotColor1;
				    thisMaxSpotColor2 = $this.data('sparkline-maxspot-color-bottom') || thisMaxSpotColor1;
				    thishighlightSpotColor1 = $this.data('sparkline-highlightspot-color-top') || '#50f050';
				    thisHighlightLineColor1 = $this.data('sparkline-highlightline-color-top') || '#f02020';
				    thishighlightSpotColor2 = $this.data('sparkline-highlightspot-color-bottom') ||
				        thishighlightSpotColor1;
				    thisHighlightLineColor2 = $this.data('sparkline-highlightline-color-bottom') ||
				        thisHighlightLineColor1;
				    thisFillColor1 = $this.data('sparkline-fillcolor-top') || 'transparent';
				    thisFillColor2 = $this.data('sparkline-fillcolor-bottom') || 'transparent';

				$this.sparkline(sparklineValue, {

					type : 'line',
					spotRadius : thisSpotRadius1,

					spotColor : thisSpotColor,
					minSpotColor : thisMinSpotColor1,
					maxSpotColor : thisMaxSpotColor1,
					highlightSpotColor : thishighlightSpotColor1,
					highlightLineColor : thisHighlightLineColor1,

					valueSpots : sparklineValueSpots1,

					lineWidth : thisLineWidth1,
					width : sparklineWidth,
					height : sparklineHeight,
					lineColor : thisLineColor1,
					fillColor : thisFillColor1

				});

				$this.sparkline($this.data('sparkline-line-val'), {

					type : 'line',
					spotRadius : thisSpotRadius2,

					spotColor : thisSpotColor,
					minSpotColor : thisMinSpotColor2,
					maxSpotColor : thisMaxSpotColor2,
					highlightSpotColor : thishighlightSpotColor2,
					highlightLineColor : thisHighlightLineColor2,

					valueSpots : sparklineValueSpots2,

					lineWidth : thisLineWidth2,
					width : sparklineWidth,
					height : sparklineHeight,
					lineColor : thisLineColor2,
					composite : true,
					fillColor : thisFillColor2

				});

			}

		});

	}// end if

	/*
	 * EASY PIE CHARTS
	 * DEPENDENCY: js/plugins/easy-pie-chart/jquery.easy-pie-chart.min.js
	 * Usage:

	 *			35
	 *

	 */

	if ($.fn.easyPieChart) {

		$('.easy-pie-chart').each(function() {
			var $this = $(this);
			var barColor = $this.css('color') || $this.data('pie-color'),
			    trackColor = $this.data('pie-track-color') || '#eeeeee',
			    size = parseInt($this.data('pie-size')) || 25;

			$this.easyPieChart({

				barColor : barColor,
				trackColor : trackColor,
				scaleColor : false,
				lineCap : 'butt',
				lineWidth : parseInt(size / 8.5),
				animate : 1500,
				rotate : -90,
				size : size,
				onStep : function(value) {
					this.$el.find('span').text(~~value);
				}

			});
		});

	} // end if

}

/* ~ END: INITIALIZE CHARTS */

/*
 * INITIALIZE JARVIS WIDGETS
 */

// Setup Desktop Widgets
function setup_widgets_desktop() {

	if ($.fn.jarvisWidgets && $.enableJarvisWidgets) {

		$('#widget-grid').jarvisWidgets({

			grid : 'article',
			widgets : '.jarviswidget',
			localStorage : true,
			deleteSettingsKey : '#deletesettingskey-options',
			settingsKeyLabel : 'Reset settings?',
			deletePositionKey : '#deletepositionkey-options',
			positionKeyLabel : 'Reset position?',
			sortable : true,
			buttonsHidden : false,
			// toggle button
			toggleButton : true,
			toggleClass : 'fa fa-minus | fa fa-plus',
			toggleSpeed : 200,
			onToggle : function() {
			},
			// delete btn
			deleteButton : true,
			deleteClass : 'fa fa-times',
			deleteSpeed : 200,
			onDelete : function() {
			},
			// edit btn
			editButton : true,
			editPlaceholder : '.jarviswidget-editbox',
			editClass : 'fa fa-cog | fa fa-save',
			editSpeed : 200,
			onEdit : function() {
			},
			// color button
			colorButton : true,
			// full screen
			fullscreenButton : true,
			fullscreenClass : 'fa fa-expand | fa fa-compress',
			fullscreenDiff : 3,
			onFullscreen : function() {
			},
			// custom btn
			customButton : false,
			customClass : 'folder-10 | next-10',
			customStart : function() {
				alert('Hello you, this is a custom button...');
			},
			customEnd : function() {
				alert('bye, till next time...');
			},
			// order
			buttonOrder : '%refresh% %custom% %edit% %toggle% %fullscreen% %delete%',
			opacity : 1.0,
			dragHandle : '> header',
			placeholderClass : 'jarviswidget-placeholder',
			indicator : true,
			indicatorTime : 600,
			ajax : true,
			timestampPlaceholder : '.jarviswidget-timestamp',
			timestampFormat : 'Last update: %m%/%d%/%y% %h%:%i%:%s%',
			refreshButton : true,
			refreshButtonClass : 'fa fa-refresh',
			labelError : 'Sorry but there was a error:',
			labelUpdated : 'Last Update:',
			labelRefresh : 'Refresh',
			labelDelete : 'Delete widget:',
			afterLoad : function() {
			},
			rtl : false, // best not to toggle this!
			onChange : function() {

			},
			onSave : function() {

			},
			ajaxnav : $.navAsAjax // declears how the localstorage should be saved (HTML or AJAX page)

		});

	}

}

// Setup Desktop Widgets
function setup_widgets_mobile() {

	if ($.enableMobileWidgets && $.enableJarvisWidgets) {
		setup_widgets_desktop();
	}

}

/* ~ END: INITIALIZE JARVIS WIDGETS */

/*
 * GOOGLE MAPS
 * description: Append google maps to head dynamically (only execute for ajax version)
 * Loads at the begining for ajax pages
 */

if ($.navAsAjax || $(".google_maps")){
	var gMapsLoaded = false;
	window.gMapsCallback = function() {
		gMapsLoaded = true;
		$(window).trigger('gMapsLoaded');
	};
	window.loadGoogleMaps = function() {
		if (gMapsLoaded)
			return window.gMapsCallback();
		var script_tag = document.createElement('script');
		script_tag.setAttribute("type", "text/javascript");
		script_tag.setAttribute("src", "http://maps.google.com/maps/api/js?sensor=false&callback=gMapsCallback");
		(document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
	};
}

/* ~ END: GOOGLE MAPS */

/*
 * LOAD SCRIPTS
 * Usage:
 * Define function = myPrettyCode ()...
 * loadScript("js/my_lovely_script.js", myPrettyCode);
 */

var jsArray = {};

function loadScript(scriptName, callback) {

	if (!jsArray[scriptName]) {
		jsArray[scriptName] = true;

		// adding the script tag to the head as suggested before
		var body = document.getElementsByTagName('body')[0];
		var script = document.createElement('script');
		script.type = 'text/javascript';
		script.src = scriptName;

		// then bind the event to the callback function
		// there are several events for cross browser compatibility
		//script.onreadystatechange = callback;
		script.onload = callback;

		// fire the loading
		body.appendChild(script);

	} else if (callback) {// changed else to else if(callback)
		//console.log("JS file already added!");
		//execute function
		callback();
	}

}

/* ~ END: LOAD SCRIPTS */

/*
* APP AJAX REQUEST SETUP
* Description: Executes and fetches all ajax requests also
* updates naivgation elements to active
*/
if($.navAsAjax)
{
    // fire this on page load if nav exists
    if ($('nav').length) {
	    checkURL();
    }

    $(document).on('click', 'nav a[href!="#"]', function(e) {
	    e.preventDefault();
	    var $this = $(e.currentTarget);

	    // if parent is not active then get hash, or else page is assumed to be loaded
		if (!$this.parent().hasClass("active") && !$this.attr('target')) {

		    // update window with hash
		    // you could also do here:  $.device === "mobile" - and save a little more memory

		    if ($.root_.hasClass('mobile-view-activated')) {
			    $.root_.removeClass('hidden-menu');
			    window.setTimeout(function() {
					if (window.location.search) {
						window.location.href =
							window.location.href.replace(window.location.search, '')
								.replace(window.location.hash, '') + '#' + $this.attr('href');
					} else {
						window.location.hash = $this.attr('href');
					}
			    }, 150);
			    // it may not need this delay...
		    } else {
				if (window.location.search) {
					window.location.href =
						window.location.href.replace(window.location.search, '')
							.replace(window.location.hash, '') + '#' + $this.attr('href');
				} else {
					window.location.hash = $this.attr('href');
				}
		    }
	    }

    });

    // fire links with targets on different window
    $(document).on('click', 'nav a[target="_blank"]', function(e) {
	    e.preventDefault();
	    var $this = $(e.currentTarget);

	    window.open($this.attr('href'));
    });

    // fire links with targets on same window
    $(document).on('click', 'nav a[target="_top"]', function(e) {
	    e.preventDefault();
	    var $this = $(e.currentTarget);

	    window.location = ($this.attr('href'));
    });

    // all links with hash tags are ignored
    $(document).on('click', 'nav a[href="#"]', function(e) {
	    e.preventDefault();
    });

    // DO on hash change
    $(window).on('hashchange', function() {
	    checkURL();
    });
}

// CHECK TO SEE IF URL EXISTS
function checkURL() {

	// bootstrap backdrop bug for ajax version
	if ($('.modal-backdrop')[0] && $.navAsAjax){
		$('.modal-backdrop').remove();
		//console.log("backdrop removed");
	}

	//get the url by removing the hash
	var url = location.hash.replace(/^#/, '');

	//BEGIN: IE11 Work Around
	if (!url) {

		try {
			var documentUrl = window.document.URL;
			if (documentUrl) {
				if (documentUrl.indexOf('#', 0) > 0 && documentUrl.indexOf('#', 0) < (documentUrl.length + 1)) {
					url = documentUrl.substring(documentUrl.indexOf('#', 0) + 1);

				}

			}

		} catch (err) {}
	}
	//END: IE11 Work Around

	container = $('#content');
	// Do this if url exists (for page refresh, etc...)
	if (url) {
		// remove all active class
		$('nav li.active').removeClass("active");
		// match the url and add the active class
		$('nav li:has(a[href="' + url + '"])').addClass("active");
		var title = ($('nav a[href="' + url + '"]').attr('title'));

		// change page title from global var
		document.title = (title || document.title);
		//console.log("page title: " + document.title);

		// parse url to jquery
		loadURL(url + location.search, container);
	} else {

		// grab the first URL from nav
		var $this = $('nav > ul > li:first-child > a[href!="#"]');

		//update hash
		window.location.hash = $this.attr('href');

	}

}

// LOAD AJAX PAGES
function loadURL(url, container) {
	//console.log(container)

	$.ajax({
		type : "GET",
		url : url,
		dataType : 'html',
		cache : true, // (warning: setting it to false will cause a timestamp and will call the request twice)
		beforeSend : function() {

			//IE11 bug fix for googlemaps
			//check if the page is ajax = true, has google map class and the container is #content
			if ($.navAsAjax && $(".google_maps")[0] && (container[0] == $("#content")[0])) {

				// target gmaps if any on page
				var collection = $(".google_maps"),
					i = 0;
				// run for each	map
				collection.each(function() {
				    i ++;
				    // get map id from class elements
				    var divDealerMap = document.getElementById(this.id);

				    if(i == collection.length + 1) {
					    // "callback"
					    //console.log("all maps destroyed");
					} else {
						// destroy every map found
						if (divDealerMap) divDealerMap.parentNode.removeChild(divDealerMap);
						//console.log(this.id + " destroying maps...");
					}
				});

				//console.log("google maps nuked!!!");

			}; //end fix

			// destroy all datatable instances
			if ( $.navAsAjax && $('.dataTables_wrapper')[0] && (container[0] == $("#content")[0])) {

				var tables = $.fn.dataTable.fnTables(true);
				$(tables).each(function () {
				    $(this).dataTable().fnDestroy();
				});
				//console.log("datatable nuked!!!");
			}
			// end destroy

			// pop intervals
			if ( $.navAsAjax && $.intervalArr.length > 0 && (container[0] == $("#content")[0])) {

				while($.intervalArr.length > 0)
        			clearInterval($.intervalArr.pop());
        			//console.log("all intervals cleared..")

			}
			// end pop intervals

			// place cog
			container.html('
 Loading...
');
			//console.log('cog replaced')

			// Only draw breadcrumb if it is main content material
			// TODO: see the framerate for the animation in touch devices

			if (container[0] == $("#content")[0]) {
				drawBreadCrumb();
				// scroll up
				$("html").animate({
					scrollTop : 0
				}, "fast");
			}

			// end if
		},
		success : function(data) {
			container.css({
				opacity : '0.0'
			}).html(data).delay(50).animate({
				opacity : '1.0'
			}, 300);
		},
		error : function(xhr, ajaxOptions, thrownError) {
			container.html('
 Error 404! Page not found.
');
		},
		async : true
	});

	//console.log("ajax request sent");
}

// UPDATE BREADCRUMB
function drawBreadCrumb() {
	var nav_elems = $('nav li.active > a'), count = nav_elems.length;

	//console.log("breadcrumb")
	$.bread_crumb.empty();
	$.bread_crumb.append($("
Home
"));
	nav_elems.each(function() {
		$.bread_crumb.append($("

").html($.trim($(this).clone().children(".badge").remove().end().text())));
		// update title when breadcrumb is finished...
		if (!--count) document.title = $.bread_crumb.find("li:last-child").text();
	});

}

/* ~ END: APP AJAX REQUEST SETUP */

/*
 * PAGE SETUP
 * Description: fire certain scripts that run through the page
 * to check for form elements, tooltip activation, popovers, etc...
 */
function pageSetUp() {

	if ($.device === "desktop"){
		// is desktop

		// activate tooltips
		$("[rel=tooltip]").tooltip();

		// activate popovers
		$("[rel=popover]").popover();

		// activate popovers with hover states
		$("[rel=popover-hover]").popover({
			trigger : "hover"
		});

		// setup widgets
		setup_widgets_desktop();

		// activate inline charts
		runAllCharts();

		// run form elements
		runAllForms();

	} else {

		// is mobile

		// activate popovers
		$("[rel=popover]").popover();

		// activate popovers with hover states
		$("[rel=popover-hover]").popover({
			trigger : "hover"
		});

		// activate inline charts
		runAllCharts();

		// setup widgets
		setup_widgets_mobile();

		// run form elements
		runAllForms();

	}

}

// Keep only 1 active popover per trigger - also check and hide active popover if user clicks on document
$('body').on('click', function(e) {
	$('[rel="popover"]').each(function() {
		//the 'is' for buttons that trigger popups
		//the 'has' for icons within a button that triggers a popup
		if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
			$(this).popover('hide');
		}
	});
});


text:
result: pass
---

[arraybuffer-loader] is an off-the-shelf loader that encodes imported files as Base64, then exports the decoded contents as an ArrayBuffer. This can also be achieved by chaining together `url-loader`'s `base64` option and a quick base64-to-arraybuffer implementation. Since that's basically what arraybuffer-loader does, we'll use the one that was already built.

[arraybuffer-loader]: https://github.com/pine/arraybuffer-loader

redpajama_set_name: RedPajamaGithub


text:
/* Define to prevent recursive inclusion ------------------------------------ */
#ifndef __91x_VIC_H
#define __91x_VIC_H

/* Includes ------------------------------------------------------------------*/
#include "91x_map.h"
#include "91x_it.h"

/* Exported types ------------------------------------------------------------*/
/* Type of interrupt */
typedef enum
{
 VIC_IRQ,
 VIC_FIQ
} VIC_ITLineMode;

/* Exported constants --------------------------------------------------------*/

/* VIC sources*/

#define WDG_ITLine        0
#define SW_ITLine         1
#define ARMRX_ITLine      2
#define ARMTX_ITLine      3
#define TIM0_ITLine       4
#define TIM1_ITLine       5
#define TIM2_ITLine       6
#define TIM3_ITLine       7
#define USBHP_ITLine      8
#define USBLP_ITLine      9
#define SCU_ITLine        10
#define ENET_ITLine      11
#define DMA_ITLine        12
#define CAN_ITLine        13
#define MC_ITLine         14
#define ADC_ITLine        15
#define UART0_ITLine      16
#define UART1_ITLine      17
#define UART2_ITLine      18
#define I2C0_ITLine       19
#define I2C1_ITLine       20
#define SSP0_ITLine       21
#define SSP1_ITLine       22
#define LVD_ITLine        23
#define RTC_ITLine        24
#define WIU_ITLine        25
#define EXTIT0_ITLine     26
#define EXTIT1_ITLine     27
#define EXTIT2_ITLine     28
#define EXTIT3_ITLine     29
#define USBWU_ITLine      30
#define PFQBC_ITLine      31

/* Module private variables --------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */

void VIC_DeInit(void);
FlagStatus VIC_GetIRQStatus(u16 VIC_Source);
FlagStatus VIC_GetFIQStatus(u16 VIC_Source);
FlagStatus VIC_GetSourceITStatus(u16 VIC_Source);
void VIC_ITCmd(u16 VIC_Source, FunctionalState VIC_NewState);
void VIC_SWITCmd(u16 VIC_Source, FunctionalState VIC_NewState);
void VIC_ProtectionCmd(FunctionalState VIC_NewState);
u32 VIC_GetCurrentISRAdd(VIC_TypeDef* VICx);
u32 VIC_GetISRVectAdd(u16 VIC_Source);
void VIC_Config(u16 VIC_Source, VIC_ITLineMode VIC_LineMode, u8 VIC_Priority);

#endif /* __91x_VIC_H */

/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/


text:
Rels
====

.. toctree::
   :maxdepth: 3
   :titlesonly:

Constants
---------

Files
-----

  * `lib/neo4j/active_node/rels.rb:2 <https://github.com/neo4jrb/neo4j/blob/master/lib/neo4j/active_node/rels.rb#L2>`_

Methods
-------

.. _`Neo4j/ActiveNode/Rels#_rels_delegator`:

**#_rels_delegator**

  .. code-block:: ruby

     def _rels_delegator
       fail "Can't access relationship on a non persisted node" unless _persisted_obj
       _persisted_obj
     end


text:
#pragma once
//------------------------------------------------------------------------------
/**
    @class IO::StreamWriter

    Stream writer classes provide a specialized write-interface for a stream.
    This is the abstract base class for all stream writers. It is possible
    to attach any number of readers and writers to the same stream.

*/
#include "core/refcounted.h"
#include "core/ptr.h"
#include "io/stream.h"

//------------------------------------------------------------------------------
namespace IO
{
class StreamWriter : public Core::RefCounted
{
    __DeclareClass(StreamWriter);
public:
    /// constructor
    StreamWriter();
    /// destructor
    virtual ~StreamWriter();
    /// set stream to write to
    void SetStream(const GPtr<Stream>& s);
    /// get currently set stream
    const GPtr<Stream>& GetStream() const;
    /// return true if a stream is set
    bool HasStream() const;
    /// begin reading from the stream
    virtual bool Open();
    /// end reading from the stream
    virtual void Close();
    /// return true if currently open
    bool IsOpen() const;

protected:
    GPtr<Stream> stream;
    bool isOpen;
    bool streamWasOpen;
};

//------------------------------------------------------------------------------
/**
*/
inline
bool
StreamWriter::IsOpen() const
{
    return this->isOpen;
}

} // namespace IO
//------------------------------------------------------------------------------


text:
/* globals define*/
define([
], function(
) {

    var EasyDAGZoom = function() {
        this._zoomValue = 1;

        // Add ctrl+scroll listeners
        this.$el.on('mousewheel', this._scrollWheelZoom.bind(this));
        this.$el.on('DOMMouseScroll', this._scrollWheelZoom.bind(this));
    };

    EasyDAGZoom.prototype.SCROLL_ZOOM_RATIO = 1/120*1/8;
    EasyDAGZoom.prototype.MIN_ZOOM = 1/120*1/8;
    EasyDAGZoom.prototype.MAX_ZOOM = 10;
    EasyDAGZoom.prototype.MIN_ZOOM = 0.10;

    EasyDAGZoom.prototype._scrollWheelZoom = function(event) {
        var org = (event || d3.event).originalEvent;

        if (org && (org.ctrlKey || org.metaKey || org.altKey)) {
            this.updateZoom(org.wheelDelta*this.SCROLL_ZOOM_RATIO);
            event.stopPropagation();
            event.preventDefault();
        }
    };

    EasyDAGZoom.prototype.updateZoom = function(delta) {
        this._zoomValue += delta;
        this._zoomValue = Math.min(this.MAX_ZOOM, this._zoomValue);
        this._zoomValue = Math.max(this.MIN_ZOOM, this._zoomValue);
        this.refreshUI();
    };

    return EasyDAGZoom;
});


text:
using System.Dynamic;

namespace GoldenHammer.Configuration
{
    public class AssetSource
    {
        public string Path { get; set; }
        public dynamic Configuration { get; set; }

        public AssetSource()
        {
            Configuration = new ExpandoObject();
        }
    }
}


text:
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
//$app->get('/', function () use ($app) {
  //  return $app->version();
//});

use Illuminate\Http\Request;

$app->get('/products/{id}', function ($id) {

	$products = json_decode(file_get_contents('../resources/products.json'));
  foreach ($products->products as $product) {
    if($id == $product->id) {
      return response()->json($product);
    }
  }
    // Return all products in JSON-format
	return "no movie with that id";
});

$app->get('/products', function () use ($app) {
    // Convert our products from json to object i PHP
	$products = json_decode(file_get_contents('../resources/products.json'));

    // Return all products in JSON-format
	return response()->json($products);
});

$app->post('/products', function(Request $request) {
  $id = $request->input("id");
  $title = $request->input("title");
  $price = $request->input("price");

  if($id == NULL or $title == NULL or $price == NULL) {
    return "Something is missing! Try again";
  }
  $products = json_decode(file_get_contents('../resources/products.json'), true);

  $product = [];
  $product["id"] = (int)$id;
  $product["title"] = $title;
  $product["price"] = (int)$price;

  $products["products"][] = $product;

  file_put_contents('../resources/products.json', json_encode($products));
});

$app->delete('/products/{id}', function($id){
  $products = json_decode(file_get_contents('../resources/products.json'));
  foreach ($products->products as $product) {

    if($id == $product->id) {
        $index = array_search($product,$products->products);
      if($index >= 0) {
        unset($products->products[$index]);
        file_put_contents('../resources/products.json', json_encode($products));
        echo "YOU DID IT!";
      }
    }
  }
	return "no products with that id";
});

$app->put('/products/{id}', function(Request $request, $id){

  $title = $request->input("title");
  $price = $request->input("price");

  if($id == NULL or $title == NULL or $price == NULL) {
    return "Something is missing! Try again";
  }
  $products = json_decode(file_get_contents('../resources/products.json'));

  foreach ($products->products as $product) {
    if($id == $product->id) {
        $index = array_search($product,$products->products);
      if($index >= 0) {
        unset($products->products[$index]);

        $product = new stdClass();
        $product->id = (int)$id;
        $product->title = $title;
        $product->price = (int)$price;
        $products->products[] = $product;

        file_put_contents('../resources/products.json', json_encode($products));
        echo "YOU DID IT!";
      }
    }
  }
  return "no product with that id";
});


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">

<title>Phing Guide - Project Components</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="Stylesheet" rev="Stylesheet"
	href="../../css/Documentation.css" type="text/css" media="All"
	charset="iso-8859-1" />

		Appendix E: Project Components

		This file will give you a quick introduction and a reference of the
		things that you may see in a build files besides tasks and types.

		Phing Projects

		Projects are the outermost container for everything in build files.
		The <project> tag also is the root tag in build files.
		It contains the name, the directory, a short description and a default
		target.

Project may contain task calls and targets (see below).

Example

<?xml version="1.0" ?>

<project name="TestProject" basedir="." default="main"
         description="This is a test project to show how to use projects ;-)">

  <!-- Everything else goes here -->

</project>

Attributes

				Name
				Type
				Description
				Default
				Required

				basedir
				String
				The base directory of the project, i.e. the directory all
					paths are relative to.
				n/a
				No

				default
				String
				The name of the target that is executed if none is
					explicitely specified when calling Phing
				all
				Yes

				description
				String
				A free text description of the project
				n/a
				No

				name
				String
				Name of the project
				n/a
				No

				phingVersion
				String
				The minimum Phing version required
				to execute the build file, in order to
				prevent compatibility issues.
				n/a
				No

		Targets

Example

<target if="lang" unless="lang.en" depends="foo1,foo2"
       name="main" description="This is an example target" >

  <!-- everything else goes here -->

</target>

		The target defined in the example above is only executed, if the
		property ${lang} is set and the property ${lang.en}
		is not set. Additionally, it depends on the targets foo1 and
		foo2. That means, the targets foo1 and foo2
		are executed before the target main is executed. The name of
		the target is main and it also has a description.

Attributes

				Name
				Type
				Description
				Default
				Required

				depends
				String
				One or more names of targets that have to be executed
					before this target can be executed.
				n/a
				No

				description
				String
				A free text description of the target.
				n/a
				No

				if
				String
				The name of the property that is to be set if the target is
					to be executed.
				n/a
				No

				name
				String
				The name of the target
				n/a
				Yes

				unless
				String
				The name of the property that is to be set if the target is
					not to be executed.
				n/a
				No

		Important: the if and unless attributes only enable or disable
		the target to which they are attached. They do not control whether or
		not targets that a conditional target depends upon get executed. In
		fact, they do not even get evaluated until the target is about to be
		executed, and all its predecessors have already run.


text:
tar xf DenyHosts-2.6.tar.gz
cd DenyHosts-2.6
python setup.py install
cp /usr/share/denyhosts/daemon-control-dist /usr/share/denyhosts/daemon-control
chown root  /usr/share/denyhosts/daemon-control
chmod 700  /usr/share/denyhosts/daemon-control
ln -s /usr/share/denyhosts/daemon-control /etc/init.d/denyhosts
chkconfig --add denyhosts
chkconfig denyhosts on


text:
'use strict';
/*this was the part added for the assignment */

function userController () {

	this.userinfo = function (req, res) {
		/*finds the ip address, os being used and the language and returns to client */
        var str1 = req.headers['user-agent'];
        var ind1 = str1.indexOf("(");
        var ind2 = str1.indexOf(")");
        var os = str1.substring(ind1+1,ind2);
        ind1 = req.headers['accept-language'].indexOf(',');
        var lang = req.headers['accept-language'].substring(0,ind1);
        res.writeHead(200,{"Content-Type":"text/plain"});
        res.end(JSON.stringify({"ipaddress":req.ip,"language":lang,"software":os}));
	};

}

module.exports = userController;


text:
using System.Collections.Generic;
using System.IO;
using Reinforced.Typings.Fluent;
using Xunit;

namespace Reinforced.Typings.Tests.SpecificCases
{
    public partial class SpecificTestCases
    {
        [Fact]
        public void ReferencesPart6ByDanielWest()
        {
            /**
             * Specific test case with equal folder names by Daniel West
             */

            const string file1 = @"
export namespace Reinforced.Typings.Tests.SpecificCases {
	export enum SomeEnum {
		One = 0,
		Two = 1
	}
}";
            const string file2 = @"
import * as Enum from '../../APIv2/Models/TimeAndAttendance/Enum';

export namespace Reinforced.Typings.Tests.SpecificCases {
	export class SomeViewModel
	{
		public Enum: Enum.Reinforced.Typings.Tests.SpecificCases.SomeEnum;
	}
}";

            AssertConfiguration(s =>
            {
                s.Global(a => a.DontWriteWarningComment().UseModules(discardNamespaces: false));

                s.ExportAsEnum<SomeEnum>().ExportTo("Areas/APIv2/Models/TimeAndAttendance/Enum.ts");
                s.ExportAsClass<SomeViewModel>().WithPublicProperties().ExportTo("Areas/Reporting/Models/Model.ts");
            }, new Dictionary<string, string>
            {
                { Path.Combine(TargetDir, "Areas/APIv2/Models/TimeAndAttendance/Enum.ts"), file1 },
                { Path.Combine(TargetDir, "Areas/Reporting/Models/Model.ts"), file2 }
            }, compareComments: true);
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Massaria polycarpa Füisting

### Remarks
null


text:
package org.efaps.esjp.accounting.report;

import java.io.File;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.efaps.admin.common.SystemConfiguration;
import org.efaps.admin.dbproperty.DBProperties;
import org.efaps.admin.event.Parameter;
import org.efaps.admin.event.Parameter.ParameterValues;
import org.efaps.admin.event.Return;
import org.efaps.admin.event.Return.ReturnValues;
import org.efaps.admin.program.esjp.EFapsApplication;
import org.efaps.admin.program.esjp.EFapsUUID;
import org.efaps.db.CachedPrintQuery;
import org.efaps.db.Instance;
import org.efaps.db.InstanceQuery;
import org.efaps.db.MultiPrintQuery;
import org.efaps.db.PrintQuery;
import org.efaps.db.QueryBuilder;
import org.efaps.db.SelectBuilder;
import org.efaps.esjp.accounting.Period;
import org.efaps.esjp.accounting.util.Accounting.ReportBalancePositionConfig;
import org.efaps.esjp.ci.CIAccounting;
import org.efaps.esjp.common.jasperreport.AbstractDynamicReport;
import org.efaps.esjp.erp.FilteredReport;
import org.efaps.esjp.erp.util.ERP;
import org.efaps.util.EFapsException;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.sf.dynamicreports.jasper.builder.JasperReportBuilder;
import net.sf.dynamicreports.report.base.expression.AbstractSimpleExpression;
import net.sf.dynamicreports.report.builder.DynamicReports;
import net.sf.dynamicreports.report.builder.column.TextColumnBuilder;
import net.sf.dynamicreports.report.builder.style.ConditionalStyleBuilder;
import net.sf.dynamicreports.report.builder.style.StyleBuilder;
import net.sf.dynamicreports.report.definition.ReportParameters;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;
/**
 * TODO comment!
 *
 * @author The eFaps Team
 * @version $Id: ReportBalanceReport_Base.java 14531 2014-11-27 16:52:11Z
 *          jan@moxter.net $
 */
@EFapsUUID("cbbcab6e-6c56-480d-baee-6ffbf4eb093c")
@EFapsApplication("eFapsApp-Accounting")
public abstract class ReportBalanceReport_Base
    extends FilteredReport
{

    /**
     * Logging instance used in this class.
     */
    protected static final Logger LOG = LoggerFactory.getLogger(ReportBalanceReport.class);

    /**
     * @param _parameter Parameter as passed by the eFasp API
     * @return Return containing html snipplet
     * @throws EFapsException on error
     */
    public Return generateReport(final Parameter _parameter)
        throws EFapsException
    {
        final Return ret = new Return();
        final AbstractDynamicReport dyRp = getReport(_parameter);
        final String html = dyRp.getHtmlSnipplet(_parameter);
        ret.put(ReturnValues.SNIPLETT, html);
        return ret;
    }

    /**
     * @param _parameter Parameter as passed by the eFasp API
     * @return Return containing the file
     * @throws EFapsException on error
     */
    public Return exportReport(final Parameter _parameter)
        throws EFapsException
    {
        final Return ret = new Return();
        final Map<?, ?> props = (Map<?, ?>) _parameter.get(ParameterValues.PROPERTIES);
        final String mime = (String) props.get("Mime");
        final AbstractDynamicReport dyRp = getReport(_parameter);
        dyRp.setFileName(DBProperties.getProperty(ReportBalanceReport.class.getName() + ".FileName"));

        File file = null;
        if ("xls".equalsIgnoreCase(mime)) {
            file = dyRp.getExcel(_parameter);
        } else if ("pdf".equalsIgnoreCase(mime)) {
            file = dyRp.getPDF(_parameter);
        }
        ret.put(ReturnValues.VALUES, file);
        ret.put(ReturnValues.TRUE, true);
        return ret;
    }

    @Override
    protected Object getDefaultValue(final Parameter _parameter,
                                     final String _field,
                                     final String _type,
                                     final String _default)
        throws EFapsException
    {
        Object ret = null;
        if ("DateTime".equalsIgnoreCase(_type) && "dateFrom".equals(_field)) {
            final Instance periodInst = new Period().evaluateCurrentPeriod(_parameter);
            final PrintQuery print = new CachedPrintQuery(periodInst, Period.CACHEKEY);
            print.addAttribute(CIAccounting.Period.FromDate, CIAccounting.Period.ToDate);
            print.execute();
            ret = print.<DateTime>getAttribute(CIAccounting.Period.FromDate);
        } else if ("DateTime".equalsIgnoreCase(_type) && "dateTo".equals(_field)) {
            final Instance periodInst = new Period().evaluateCurrentPeriod(_parameter);
            final PrintQuery print = new CachedPrintQuery(periodInst, Period.CACHEKEY);
            print.addAttribute(CIAccounting.Period.FromDate, CIAccounting.Period.ToDate);
            print.execute();
            ret = print.<DateTime>getAttribute(CIAccounting.Period.ToDate);
        } else {
            ret = super.getDefaultValue(_parameter, _field, _type, _default);
        }
        return ret;
    }

    /**
     * @param _parameter Parameter as passed by the eFasp API
     * @return the report class
     * @throws EFapsException on error
     */
    protected AbstractDynamicReport getReport(final Parameter _parameter)
        throws EFapsException
    {
        return new DynBalanceReport(this);
    }

    public static class DynBalanceReport
        extends AbstractDynamicReport
    {

        /**
         * variable to report.
         */
        private final ReportBalanceReport_Base filteredReport;

        /**
         * @param _report class used
         */
        public DynBalanceReport(final ReportBalanceReport_Base _report)
        {
            this.filteredReport = _report;
        }

        @Override
        protected JRDataSource createDataSource(final Parameter _parameter)
            throws EFapsException
        {
            final List<DataBean> datasource = new ArrayList<>();

            final List<DetailBean> assets = new ArrayList<>();
            final List<DetailBean> liabilties = new ArrayList<>();
            final Map<Instance, DetailBean> map = new HashMap<>();
            final QueryBuilder queryBldr = new QueryBuilder(CIAccounting.ReportBalancePositionAbstract);
            queryBldr.addWhereAttrEqValue(CIAccounting.ReportBalancePositionAbstract.ReportLink,
                            _parameter.getInstance());
            final MultiPrintQuery multi = queryBldr.getPrint();
            multi.addAttribute(CIAccounting.ReportBalancePositionAbstract.Label,
                            CIAccounting.ReportBalancePositionAbstract.Position,
                            CIAccounting.ReportBalancePositionAbstract.Config);
            multi.execute();
            while (multi.next()) {
                final DetailBean detail = new DetailBean()
                                .setInstance(multi.getCurrentInstance())
                                .setLabel(multi.<String>getAttribute(CIAccounting.ReportBalancePositionAbstract.Label))
                                .setPosition(multi
                                                .<Integer>getAttribute(CIAccounting.ReportBalancePositionAbstract.Position))
                                .setConfigs(multi.<List<ReportBalancePositionConfig>>getAttribute(
                                                CIAccounting.ReportBalancePositionAbstract.Config))
                                .setFilterMap(getFilteredReport().getFilterMap(_parameter));
                ;
                if (multi.getCurrentInstance().getType().isCIType(CIAccounting.ReportBalancePositionAsset)) {
                    assets.add(detail);
                } else {
                    liabilties.add(detail);
                }
                map.put(multi.getCurrentInstance(), detail);
            }
            Collections.sort(assets, new Comparator<DetailBean>()
            {

                @Override
                public int compare(final DetailBean _arg0,
                                   final DetailBean _arg1)
                {
                    return _arg0.getPosition().compareTo(_arg1.getPosition());
                }
            });

            Collections.sort(liabilties, new Comparator<DetailBean>()
            {

                @Override
                public int compare(final DetailBean _arg0,
                                   final DetailBean _arg1)
                {
                    return _arg0.getPosition().compareTo(_arg1.getPosition());
                }
            });

            final int size = liabilties.size() > assets.size() ? liabilties.size() : assets.size();

            final Iterator<DetailBean> assetsIter = assets.iterator();
            final Iterator<DetailBean> liabiltiesIter = liabilties.iterator();
            for (int i = 0; i < size; i++) {
                final DataBean data = new DataBean();
                if (assetsIter.hasNext()) {
                    final DetailBean detail = assetsIter.next();
                    data.setAsset(detail);
                    data.setAssetAmount(detail.getAmount(map));
                }
                if (liabiltiesIter.hasNext()) {
                    final DetailBean detail = liabiltiesIter.next();
                    data.setLiability(detail);
                    data.setLiabiltyAmount(detail.getAmount(map));
                }
                datasource.add(data);
            }
            return new JRBeanCollectionDataSource(datasource);
        }

        @Override
        protected void addColumnDefinition(final Parameter _parameter,
                                          final JasperReportBuilder _builder)
            throws EFapsException
        {
            final TextColumnBuilder<String> assetLabelColum = DynamicReports.col.column("assetLabel",
                            DynamicReports.type.stringType()).setWidth(250);

            final TextColumnBuilder<BigDecimal> assetAmountColumn = DynamicReports.col.column("assetAmount",
                            DynamicReports.type.bigDecimalType());
            final TextColumnBuilder<String> liabiltyLabelColum = DynamicReports.col.column("liabiltyLabel",
                            DynamicReports.type.stringType()).setWidth(250);

            final TextColumnBuilder<BigDecimal> liabiltyAmountColumn = DynamicReports.col.column("liabiltyAmount",
                            DynamicReports.type.bigDecimalType());

            final StyleBuilder assetStyle;
            final StyleBuilder liabilityStyle;
            switch (getExType()) {
                case PDF:
                    assetStyle = getColumnStyle4Pdf(_parameter);
                    liabilityStyle = getColumnStyle4Pdf(_parameter);
                    break;
                case EXCEL:
                    assetStyle = getColumnStyle4Excel(_parameter);
                    liabilityStyle = getColumnStyle4Excel(_parameter);
                    break;
                default:
                    assetStyle = getColumnStyle4Html(_parameter);
                    liabilityStyle = getColumnStyle4Html(_parameter);
                    break;
            };
            final ConditionalStyleBuilder assetTitleCondition = DynamicReports.stl.conditionalStyle(
                            new TitleConditionExpression("assetIsTitle")).bold();
            final ConditionalStyleBuilder assetTotalCondition = DynamicReports.stl.conditionalStyle(
                            new TitleConditionExpression("assetIsTotal")).boldItalic().underline();
            assetStyle.conditionalStyles(assetTitleCondition, assetTotalCondition);

            final ConditionalStyleBuilder liabilityTitleCondition = DynamicReports.stl.conditionalStyle(
                            new TitleConditionExpression("liabilityIsTitle")).bold();
            final ConditionalStyleBuilder liabilityTotalCondition = DynamicReports.stl.conditionalStyle(
                            new TitleConditionExpression("liabilityIsTotal")).boldItalic().underline();
            liabilityStyle.conditionalStyles(liabilityTitleCondition, liabilityTotalCondition);

            assetLabelColum.setStyle(assetStyle);
            assetAmountColumn.setStyle(assetStyle);
            liabiltyLabelColum.setStyle(liabilityStyle);
            liabiltyAmountColumn.setStyle(liabilityStyle);

            _builder.addField("assetIsTitle", Boolean.class);
            _builder.addField("liabilityIsTitle", Boolean.class);
            _builder.addField("assetIsTotal", Boolean.class);
            _builder.addField("liabilityIsTotal", Boolean.class);

            _builder.addColumn(assetLabelColum, assetAmountColumn, liabiltyLabelColum, liabiltyAmountColumn);
        }

        @Override
        protected StyleBuilder getColumnStyle4Pdf(final Parameter _parameter)
            throws EFapsException
        {
            return DynamicReports.stl.style().setPadding(DynamicReports.stl.padding(2));
        }

        /**
         * Getter method for the instance variable {@link #filteredReport}.
         *
         * @return value of instance variable {@link #filteredReport}
         */
        public ReportBalanceReport_Base getFilteredReport()
        {
            return this.filteredReport;
        }

        @Override
        protected void add2ReportParameter(final Parameter _parameter)
            throws EFapsException
        {
            super.add2ReportParameter(_parameter);
            final SystemConfiguration config = ERP.getSysConfig();
            if (config != null) {
                final String companyName = ERP.COMPANY_NAME.get();
                final String companyTaxNum = ERP.COMPANY_TAX.get();
                if (companyName != null && !companyName.isEmpty()) {
                    getParameters().put("CompanyName", companyName);
                }
                if (companyTaxNum != null && !companyTaxNum.isEmpty()) {
                    getParameters().put("CompanyTaxNum", companyTaxNum);
                }
            }
            final Map<String, Object> filtermap = getFilteredReport().getFilterMap(_parameter);
            if (filtermap.containsKey("dateFrom")) {
                final DateTime date = (DateTime) filtermap.get("dateFrom");
                getParameters().put("DateFrom", date);
            }
            if (filtermap.containsKey("dateTo")) {
                final DateTime date = (DateTime) filtermap.get("dateTo");
                getParameters().put("DateTo", date);
            }

            final PrintQuery print = new PrintQuery(_parameter.getInstance());
            print.addAttribute(CIAccounting.ReportAbstract.Name);
            final SelectBuilder sel = SelectBuilder.get().linkto(CIAccounting.ReportAbstract.PeriodLink)
                            .attribute(CIAccounting.Period.Name);
            print.addSelect(sel);
            print.execute();
            getParameters().put("ReportName", print.getAttribute(CIAccounting.ReportAbstract.Name));
            getParameters().put("PeriodName", print.getSelect(sel));
        }
    }

    public static class DetailBean
    {

        private Map<String, Object> filterMap;

        private Instance instance;

        private String label;

        private Integer position;

        private BigDecimal amount = null;

        private List<ReportBalancePositionConfig> configs;

        /**
         * Getter method for the instance variable {@link #label}.
         *
         * @return value of instance variable {@link #label}
         */
        public String getLabel()
        {
            return this.label;
        }

        /**
         * @return
         */
        public BigDecimal getAmount(final Map<Instance, DetailBean> _map)
            throws EFapsException
        {
            if (this.amount == null && !isTitleOnly()) {
                this.amount = BigDecimal.ZERO;
                final QueryBuilder attrQueryBldr = new QueryBuilder(CIAccounting.ReportBalancePosition2Account);
                attrQueryBldr.addWhereAttrEqValue(CIAccounting.ReportBalancePosition2Account.FromLink, getInstance());
                final QueryBuilder queryBldr = new QueryBuilder(CIAccounting.TransactionPositionAbstract);
                queryBldr.addWhereAttrInQuery(CIAccounting.TransactionPositionAbstract.AccountLink,
                                attrQueryBldr.getAttributeQuery(CIAccounting.ReportBalancePosition2Account.ToLink));
                add2QueryBldr(queryBldr);
                final MultiPrintQuery multi = queryBldr.getPrint();
                multi.addAttribute(CIAccounting.TransactionPositionAbstract.Amount);
                multi.execute();
                while (multi.next()) {
                    this.amount = this.amount.add(multi
                                    .<BigDecimal>getAttribute(CIAccounting.TransactionPositionAbstract.Amount));
                }

                final QueryBuilder attrQueryBldr2 = new QueryBuilder(CIAccounting.ReportBalancePosition2Position);
                attrQueryBldr2.addWhereAttrEqValue(CIAccounting.ReportBalancePosition2Position.FromLink, getInstance());

                final QueryBuilder queryBldr2 = new QueryBuilder(CIAccounting.ReportBalancePositionAbstract);
                queryBldr2.addWhereAttrInQuery(CIAccounting.ReportBalancePositionAbstract.ID,
                                attrQueryBldr2.getAttributeQuery(CIAccounting.ReportBalancePosition2Position.ToLink));
                final InstanceQuery query = queryBldr2.getQuery();
                query.execute();
                while (query.next()) {
                    final DetailBean bean = _map.get(query.getCurrentValue());
                    this.amount = this.amount.add(bean.getAmount(_map));
                }
            }
            return this.amount;
        }

        /**
         * @param _parameter Parameter as passed by the eFaps API
         * @param _queryBldr QueryBuilder to add to
         * @throws EFapsException on error
         */
        protected void add2QueryBldr(final QueryBuilder _queryBldr)
            throws EFapsException
        {
            final QueryBuilder attrQueryBldr = new QueryBuilder(CIAccounting.Transaction);
            if (getFilterMap().containsKey("dateFrom")) {
                final DateTime date = (DateTime) getFilterMap().get("dateFrom");
                attrQueryBldr.addWhereAttrGreaterValue(CIAccounting.Transaction.Date,
                                date.withTimeAtStartOfDay().minusSeconds(1));
            }
            if (getFilterMap().containsKey("dateTo")) {
                final DateTime date = (DateTime) getFilterMap().get("dateTo");
                attrQueryBldr.addWhereAttrLessValue(CIAccounting.Transaction.Date,
                                date.withTimeAtStartOfDay().plusDays(1));
            }
            _queryBldr.addWhereAttrInQuery(CIAccounting.TransactionPositionAbstract.TransactionLink,
                            attrQueryBldr.getAttributeQuery(CIAccounting.ReportBalancePosition2Account.ToLink));
        }

        public boolean isTitleOnly()
        {
            return getConfigs().contains(ReportBalancePositionConfig.TITLEONLY);
        }

        public boolean isTotal()
        {
            return getConfigs().contains(ReportBalancePositionConfig.TOTAL);
        }

        /**
         * Setter method for instance variable {@link #label}.
         *
         * @param _label value for instance variable {@link #label}
         */
        public DetailBean setLabel(final String _label)
        {
            this.label = _label;
            return this;
        }

        /**
         * Getter method for the instance variable {@link #position}.
         *
         * @return value of instance variable {@link #position}
         */
        public Integer getPosition()
        {
            return this.position;
        }

        /**
         * Setter method for instance variable {@link #position}.
         *
         * @param _position value for instance variable {@link #position}
         */
        public DetailBean setPosition(final Integer _position)
        {
            this.position = _position;
            return this;
        }

        /**
         * Getter method for the instance variable {@link #instance}.
         *
         * @return value of instance variable {@link #instance}
         */
        public Instance getInstance()
        {
            return this.instance;
        }

        /**
         * Setter method for instance variable {@link #instance}.
         *
         * @param _instance value for instance variable {@link #instance}
         */
        public DetailBean setInstance(final Instance _instance)
        {
            this.instance = _instance;
            return this;
        }

        /**
         * Getter method for the instance variable {@link #configs}.
         *
         * @return value of instance variable {@link #configs}
         */
        public List<ReportBalancePositionConfig> getConfigs()
        {
            List<ReportBalancePositionConfig> ret;
            if (this.configs == null) {
                ret = Collections.<ReportBalancePositionConfig>emptyList();
            } else {
                ret = this.configs;
            }
            return ret;
        }

        /**
         * Setter method for instance variable {@link #configs}.
         *
         * @param _configs value for instance variable {@link #configs}
         */
        public DetailBean setConfigs(final List<ReportBalancePositionConfig> _configs)
        {
            this.configs = _configs;
            return this;
        }

        /**
         * Getter method for the instance variable {@link #filterMap}.
         *
         * @return value of instance variable {@link #filterMap}
         */
        public Map<String, Object> getFilterMap()
        {
            return this.filterMap;
        }

        /**
         * Setter method for instance variable {@link #filterMap}.
         *
         * @param _filterMap value for instance variable {@link #filterMap}
         */
        public DetailBean setFilterMap(final Map<String, Object> _filterMap)
        {
            this.filterMap = _filterMap;
            return this;
        }
    }

    public static class DataBean
    {

        private DetailBean asset;

        private DetailBean liability;

        private BigDecimal assetAmount;

        private BigDecimal liabilityAmount;

        /**
         * Getter method for the instance variable {@link #assetLabel}.
         *
         * @return value of instance variable {@link #assetLabel}
         */
        public String getAssetLabel()
        {
            return getAsset() != null ? getAsset().getLabel() : null;
        }

        /**
         * Getter method for the instance variable {@link #assetAmount}.
         *
         * @return value of instance variable {@link #assetAmount}
         */
        public BigDecimal getAssetAmount()
        {
            return this.assetAmount;
        }

        /**
         * Setter method for instance variable {@link #assetAmount}.
         *
         * @param _assetAmount value for instance variable {@link #assetAmount}
         */
        public void setAssetAmount(final BigDecimal _assetAmount)
        {
            this.assetAmount = _assetAmount;
        }

        /**
         * Getter method for the instance variable {@link #liabiltyLabel}.
         *
         * @return value of instance variable {@link #liabiltyLabel}
         */
        public String getLiabiltyLabel()
        {
            return getLiability() != null ? getLiability().getLabel() : null;
        }

        /**
         * Getter method for the instance variable {@link #liabiltyAmount}.
         *
         * @return value of instance variable {@link #liabiltyAmount}
         */
        public BigDecimal getLiabiltyAmount()
        {
            return this.liabilityAmount;
        }

        /**
         * Setter method for instance variable {@link #liabiltyAmount}.
         *
         * @param _liabiltyAmount value for instance variable
         *            {@link #liabiltyAmount}
         */
        public void setLiabiltyAmount(final BigDecimal _liabiltyAmount)
        {
            this.liabilityAmount = _liabiltyAmount;
        }

        /**
         * Getter method for the instance variable {@link #asset}.
         *
         * @return value of instance variable {@link #asset}
         */
        public DetailBean getAsset()
        {
            return this.asset;
        }

        /**
         * Setter method for instance variable {@link #asset}.
         *
         * @param _asset value for instance variable {@link #asset}
         */
        public void setAsset(final DetailBean _asset)
        {
            this.asset = _asset;
        }

        /**
         * Getter method for the instance variable {@link #liability}.
         *
         * @return value of instance variable {@link #liability}
         */
        public DetailBean getLiability()
        {
            return this.liability;
        }

        /**
         * Setter method for instance variable {@link #liability}.
         *
         * @param _liability value for instance variable {@link #liability}
         */
        public void setLiability(final DetailBean _liability)
        {
            this.liability = _liability;
        }

        public boolean getAssetIsTitle()
        {
            return getAsset() != null ? getAsset().isTitleOnly() : false;
        }

        public boolean getLiabilityIsTitle()
        {
            return getLiability() != null ? getLiability().isTitleOnly() : false;
        }

        public boolean getAssetIsTotal()
        {
            return getAsset() != null ? getAsset().isTotal() : false;
        }

        public boolean getLiabilityIsTotal()
        {
            return getLiability() != null ? getLiability().isTotal() : false;
        }
    }

    public static class TitleConditionExpression
        extends AbstractSimpleExpression<Boolean>
    {

        private static final long serialVersionUID = 1L;
        private final String fieldName;

        /**
         * @param _string
         */
        public TitleConditionExpression(final String _fieldName)
        {
            this.fieldName = _fieldName;
        }

        @Override
        public Boolean evaluate(final ReportParameters reportParameters)
        {
            return reportParameters.getValue(this.fieldName);
        }
    }

    public static class TotalConditionExpression
        extends AbstractSimpleExpression<Boolean>
    {

        private static final long serialVersionUID = 1L;
        private final String fieldName;

        /**
         * @param _string
         */
        public TotalConditionExpression(final String _fieldName)
        {
            this.fieldName = _fieldName;
        }

        @Override
        public Boolean evaluate(final ReportParameters reportParameters)
        {
            return reportParameters.getValue(this.fieldName);
        }
    }

}


text:
package com.alipay.api.response;

import com.alipay.api.internal.mapping.ApiField;

import com.alipay.api.AlipayResponse;

/**
 * ALIPAY API: alipay.open.public.account.reset response.
 *
 * @author auto create
 * @since 1.0, 2016-12-08 12:01:32
 */
public class AlipayOpenPublicAccountResetResponse extends AlipayResponse {

	private static final long serialVersionUID = 4372226813634262853L;

	/**
	 * 重置后的协议号,商户会员在支付宝服务窗账号中的唯一标识
	 */
	@ApiField("agreement_id")
	private String agreementId;

	public void setAgreementId(String agreementId) {
		this.agreementId = agreementId;
	}
	public String getAgreementId( ) {
		return this.agreementId;
	}

}


text:
=head1 NAME

DBI::DBD::SqlEngine::HowTo - Guide to create DBI::DBD::SqlEngine based driver

=head1 SYNOPSIS

  perldoc DBI::DBD::SqlEngine::HowTo
  perldoc DBI
  perldoc DBI::DBD
  perldoc DBI::DBD::SqlEngine::Developers
  perldoc SQL::Eval
  perldoc DBI::DBD::SqlEngine
  perldoc DBI::DBD::SqlEngine::HowTo
  perldoc SQL::Statement::Embed

=head1 DESCRIPTION

This document provides a step-by-step guide, how to create a new
C<DBI::DBD::SqlEngine> based DBD. It expects that you carefully read the
L<DBI> documentation and that you're familiar with L<DBI::DBD> and had
read and understood L<DBD::ExampleP>.

This document addresses experienced developers who are really sure that
they need to invest time when writing a new DBI Driver. Writing a DBI
Driver is neither a weekend project nor an easy job for hobby coders
after work. Expect one or two man-month of time for the first start.

Those who are still reading, should be able to sing the rules of
L<DBI::DBD/CREATING A NEW DRIVER>.

=head1 CREATING DRIVER CLASSES

Do you have an entry in DBI's DBD registry? For this guide, a prefix of
C<foo_> is assumed.

=head2 Sample Skeleton

    package DBD::Foo;

    use strict;
    use warnings;
    use vars qw($VERSION);
    use base qw(DBI::DBD::SqlEngine);

    use DBI ();

    $VERSION = "0.001";

    package DBD::Foo::dr;

    use vars qw(@ISA $imp_data_size);

    @ISA = qw(DBI::DBD::SqlEngine::dr);
    $imp_data_size = 0;

    package DBD::Foo::db;

    use vars qw(@ISA $imp_data_size);

    @ISA = qw(DBI::DBD::SqlEngine::db);
    $imp_data_size = 0;

    package DBD::Foo::st;

    use vars qw(@ISA $imp_data_size);

    @ISA = qw(DBI::DBD::SqlEngine::st);
    $imp_data_size = 0;

    package DBD::Foo::Statement;

    use vars qw(@ISA);

    @ISA = qw(DBI::DBD::SqlEngine::Statement);

    package DBD::Foo::Table;

    use vars qw(@ISA);

    @ISA = qw(DBI::DBD::SqlEngine::Table);

    1;

Tiny, eh? And all you have now is a DBD named foo which will is able to
deal with temporary tables, as long as you use L<SQL::Statement>. In
L<DBI::SQL::Nano> environments, this DBD can do nothing.

=head2 Deal with own attributes

Before we start doing usable stuff with our DBI driver, we need to think
about what we want to do and how we want to do it.

Do we need tunable knobs accessible by users? Do we need status
information? All this is handled in attributes of the database handles (be
careful when your DBD is running "behind" a L<DBD::Gofer> proxy).

How come the attributes into the DBD and how are they fetchable by the
user? Good question, but you should know because you've read the L<DBI>
documentation.

C<DBI::DBD::SqlEngine::db::FETCH> and C<DBI::DBD::SqlEngine::db::STORE>
taking care for you - all they need to know is which attribute names
are valid and mutable or immutable. Tell them by adding
C<init_valid_attributes> to your db class:

    sub init_valid_attributes
    {
	my $dbh = $_[0];

	$dbh->SUPER::init_valid_attributes ();

	$dbh->{foo_valid_attrs} = {
	    foo_version 	=> 1,	# contains version of this driver
	    foo_valid_attrs	=> 1,	# contains the valid attributes of foo drivers
	    foo_readonly_attrs	=> 1,	# contains immutable attributes of foo drivers
	    foo_bar		=> 1,	# contains the bar attribute
	    foo_baz		=> 1,   # contains the baz attribute
	    foo_manager		=> 1,	# contains the manager of the driver instance
	    foo_manager_type	=> 1,	# contains the manager class of the driver instance
	};
	$dbh->{foo_readonly_attrs} = {
	    foo_version 	=> 1,	# ensure no-one modifies the driver version
	    foo_valid_attrs	=> 1,	# do not permit to add more valid attributes ...
	    foo_readonly_attrs	=> 1,	# ... or make the immutable mutable
	    foo_manager		=> 1,	# manager is set internally only
	};

	return $dbh;
    }

Woooho - but now the user cannot assign new managers? This is intended,
overwrite C<STORE> to handle it!

    sub STORE ($$$)
    {
	my ( $dbh, $attrib, $value ) = @_;

	$dbh->SUPER::STORE( $attrib, $value );

	# we're still alive, so no exception is thrown ...
	# by DBI::DBD::SqlEngine::db::STORE
	if ( $attrib eq "foo_manager_type" )
	{
	    $dbh->{foo_manager} = $dbh->{foo_manager_type}->new();
	    # ... probably correct some states based on the new
	    # foo_manager_type - see DBD::Sys for an example
	}
    }

But ... my driver runs without a manager until someone first assignes
a C<foo_manager_type>. Well, no - there're two places where you can
initialize defaults:

    sub init_default_attributes
    {
	my ($dbh, $phase) = @_;

	$dbh->SUPER::init_default_attributes($phase);

	if( 0 == $phase )
	{
	    # init all attributes which have no knowledge about
	    # user settings from DSN or the attribute hash
	    $dbh->{foo_manager_type} = "DBD::Foo::Manager";
	}
	elsif( 1 == $phase )
	{
	    # init phase with more knowledge from DSN or attribute
	    # hash
	    $dbh->{foo_manager} = $dbh->{foo_manager_type}->new();
	}

	return $dbh;
    }

So far we can prevent the users to use our database driver as data
storage for anything and everything. We care only about the real important
stuff for peace on earth and alike attributes. But in fact, the driver
still can't do anything. It can do less than nothing - meanwhile it's
not a stupid storage area anymore.

=head2 Dealing with Tables

Let's put some life into it - it's going to be time for it.

This is a good point where a quick side step to L<SQL::Statement::Embed>
will help to shorten the next paragraph. The documentation in
SQL::Statement::Embed regarding embedding in own DBD's works pretty
fine with SQL::Statement and DBI::SQL::Nano.

=head2 Testing

Now you should have your first own DBD. Was easy, wasn't it?  But does
it work well? Prove it by writing tests and remember to use
dbd_edit_mm_attribs from L<DBI::DBD> to ensure testing even rare cases.

=head1 AUTHOR

This guide is written by Jens Rehsack. DBI::DBD::SqlEngine is written by
Jens Rehsack using code from DBD::File originally written by Jochen
Wiedmann and Jeff Zucker.

The module DBI::DBD::SqlEngine is currently maintained by

H.Merijn Brand < h.m.brand at xs4all.nl > and
Jens Rehsack  < rehsack at googlemail.com >

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2010 by H.Merijn Brand & Jens Rehsack

All rights reserved.

You may freely distribute and/or modify this module under the terms of
either the GNU General Public License (GPL) or the Artistic License, as
specified in the Perl README file.

=cut