<commit_before>/**
 * jquery plugin which displays data in tabular format (datagrid)
 * Requires jquery, jquery-ui, jquery-ui themes
 * It uses jui_dropdown and jui_pagination plugin
 * Copyright 2012 <NAME> http://pontikis.net
 * Project page https://github.com/pontikis/jui_datagrid
 * UPCOMING Release: 1.00 (?? Nov 2012)
 * License MIT
 * Minified using Online YUI Compressor http://www.refresh-sf.com/yui/
 */
"use strict";(function(n){var c="jui_datagrid",p="jui_datagrid_status";var A={init:function(C){var D=this;return this.each(function(){var S=D.data(c);if(typeof(S)==="undefined"){var L=D.jui_datagrid("getDefaults");S=n.extend({},L,C)}else{S=n.extend({},S,C)}D.data(c,S);if(typeof D.data(p)==="undefined"){D.data(p,{});D.data(p)["a_selected_ids"]=[];D.data(p)["count_selected_ids"]=0;if(n.browser.mozilla||(n.browser.msie&&parseInt(n.browser.version)>=10)){D.data(p)["fix_border_collapse_td_width"]=0}else{D.data(p)["fix_border_collapse_td_width"]=S.fix_border_collapse_td_width}}if(S.rowSelectionMode=="single"||S.rowSelectionMode==false){D.data(p)["a_selected_ids"]=[];D.data(p)["count_selected_ids"]=0}var R=D.attr("id");D.unbind("onCellClick").bind("onCellClick",S.onCellClick);D.unbind("onRowClick").bind("onRowClick",S.onRowClick);D.unbind("onDelete").bind("onDelete",S.onDelete);D.unbind("onDisplay").bind("onDisplay",S.onDisplay);var V=u(S.caption_id_prefix,R),Q=u(S.datagrid_header_id_prefix,R),K=u(S.datagrid_id_prefix,R),H=u(S.tools_id_prefix,R),F=u(S.pagination_id_prefix,R),J=u(S.pref_dialog_id_prefix,R),O=u(S.sort_dialog_id_prefix,R),U;if(!D.data(p)["initialize"]){U='<div id="'+V+'">'+S.caption+"</div>";U+='<div id="'+Q+'"></div>';U+='<div id="'+K+'"></div>';U+='<div id="'+H+'"></div>';U+='<div id="'+F+'"></div>';U+='<div id="'+J+'"></div>';U+='<div id="'+O+'"></div>';D.html(U);D.data(p)["initialize"]=true}var P=n("#"+V),G=n("#"+Q),M=n("#"+K),E=n("#"+H),N=n("#"+F),I=n("#"+J),T=n("#"+O);D.removeClass().addClass(S.containerClass);if(typeof S.caption==="undefined"){P.hide()}else{P.show().text(S.caption).removeClass().addClass(S.captionClass)}G.removeClass().addClass(S.datagridHeaderClass);M.removeClass().addClass(S.datagridClass);E.removeClass().addClass(S.toolsClass);N.removeClass().addClass(S.paginationClass);I.removeClass().addClass(S.dlgPrefClass);T.removeClass().addClass(S.dlgSortClass);n.ajax({type:"POST",url:S.ajaxFetchDataURL,data:{page_num:S.pageNum,rows_per_page:S.rowsPerPage,sorting:S.sorting},success:function(at){var ae=n.parseJSON(at);var ag=ae.row_primary_key;var ac=ae.total_rows;var al=ae.page_data;if(ac==0){z(R);i(R,ac)}else{a(R,ac,al,ag);r(R);q(R,ag);i(R,ac,ag);e(R,ac)}var an,ab,af,ah;if(ac>0){var ai=u(D.jui_datagrid("getOption","table_id_prefix"),R),Z=n("#"+ai),ak,aj;ah=(ai+"_tr_").length;an="tbody tr td";Z.off("click",an).on("click",an,function(){ak=n(this).index()+1;aj=n(this).parent("tr").index()+1;D.triggerHandler("onCellClick",{col:ak,row:aj})});an="tbody tr";Z.off("click",an).on("click",an,function(){if(ag){var aw=parseInt(n(this).attr("id").substr(ah)),av;if(S.rowSelectionMode===false){l(R);av="clicked"}else{if(S.rowSelectionMode=="single"){l(R);av="selected"}var au=n.inArray(aw,D.data(p)["a_selected_ids"]);if(au>-1){x(R,aw,au);av="deselected"}else{B(R,aw);av="selected"}}h(R)}D.triggerHandler("onRowClick",{row_id:aw,row_status:av})})}if(S.showPrefButton){an="#"+u(S.tools_id_prefix,R)+"_pref";D.off("click",an).on("click",an,function(){j(R,J);var aC=u(S.pref_tabs_id_prefix,R);n("#"+aC).tabs({create:function(){n("#"+aC+" li a").blur()},activate:function(){n("#"+aC+" li a").blur()}});var az=u(D.jui_datagrid("getOption","col_order_list_id_prefix"),R),ay=n("#"+az),au=D.jui_datagrid("getOption","sortableListLiDisabledClass"),aA,aB,av,aw,ax;ay.sortable({cancel:au,start:function(aD,aE){aA=aE.item.index()},stop:function(aD,aE){aB=aE.item.index();if(aB!==aA){av=D.jui_datagrid("getOption","columns");aw=[];if(aB>aA){for(ao in av){if(ao<aA||ao>aB){aw[ao]=av[ao]}if(ao>=aA&&ao<aB){aw[ao]=av[parseInt(ao)+1]}if(ao==aB){aw[ao]=av[aA]}}}if(aB<aA){for(ao in av){if(ao>aA||ao<aB){aw[ao]=av[ao]}if(ao<=aA&&ao>aB){aw[ao]=av[parseInt(ao)-1]}if(ao==aB){aw[ao]=av[aA]}}}D.jui_datagrid({columns:aw})}}}).disableSelection();an="input[type=checkbox]";ay.off("click",an).on("click",an,function(){ax=parseInt(n(this).index("#"+az+" "+an));n("#"+az+" li").eq(ax).toggleClass(au);aw=D.jui_datagrid("getOption","columns");aw[ax]["visible"]=n(this).is(":checked")?"yes":"no";D.jui_datagrid({columns:aw})})});var ap,X,ao;ap=["_row_numbers","_sort_indicator"];X=["showRowNumbers","showSortingIndicator"];for(ao in ap){m(D,I,"#"+J+ap[ao],X[ao])}ap=["_btn_select","_btn_refresh","_btn_delete","_btn_print","_btn_export","_btn_sorting","_btn_filters"];X=["showSelectButtons","showRefreshButton","showDeleteButton","showPrintButton","showExportButton","showSortingButton","showFiltersButton"];for(ao in ap){m(D,I,"#"+J+ap[ao],X[ao])}ap=["_slider","_goto_page","_rows_per_page","_rows_info","_nav_buttons"];X=["useSlider","showGoToPage","showRowsPerPage","showRowsInfo","showNavButtons"];for(ao in ap){g(D,I,"#"+J+ap[ao],X[ao])}}if(S.showSelectButtons&&S.rowSelectionMode=="multiple"&&ag){ah=(ai+"_tr_").length;var Y=n("#"+ai+" tbody tr");ab=u(D.jui_datagrid("getOption","tools_id_prefix"),R);af=ab+"_drop_select";var aa={all_in_page:1,none_in_page:2,inv_in_page:3,none:4};n("#"+af).jui_dropdown({onSelect:function(av,aw){var au=aw.index;switch(au){case aa.all_in_page:case aa.none_in_page:case aa.inv_in_page:Y.each(function(){var ay=parseInt(n(this).attr("id").substr(ah));var ax=n.inArray(ay,D.data(p)["a_selected_ids"]);if(au==aa.all_in_page){if(ax>-1){}else{B(R,ay)}}else{if(au==aa.none_in_page){if(ax>-1){x(R,ay,ax)}}else{if(au==aa.inv_in_page){if(ax>-1){x(R,ay,ax)}else{B(R,ay)}}}}});break;case aa.none:l(R);break}h(R)}})}if(S.showRefreshButton){an="#"+u(S.tools_id_prefix,R)+"_refresh";D.off("click",an).on("click",an,function(){n("#"+R).jui_datagrid("refresh")})}if(S.showDeleteButton&&ag){an="#"+u(S.tools_id_prefix,R)+"_delete";D.off("click",an).on("click",an,function(){D.triggerHandler("onDelete")})}if(S.showSortingButton){an="#"+u(S.tools_id_prefix,R)+"_sorting";D.off("click",an).on("click",an,function(){d(R,O);var aD=u(D.jui_datagrid("getOption","sorting_list_id_prefix"),R),aF=n("#"+aD),au=D.jui_datagrid("getOption","sortableListLiDisabledClass"),aB,aC,az,aA;aF.sortable({cancel:au,start:function(aG,aH){aB=aH.item.index()},stop:function(aG,aH){aC=aH.item.index();if(aC!==aB){az=D.jui_datagrid("getOption","sorting");aA=[];if(aC>aB){for(ao in az){if(ao<aB||ao>aC){aA[ao]=az[ao]}if(ao>=aB&&ao<aC){aA[ao]=az[parseInt(ao)+1]}if(ao==aC){aA[ao]=az[aB]}}}if(aC<aB){for(ao in az){if(ao>aB||ao<aC){aA[ao]=az[ao]}if(ao<=aB&&ao>aC){aA[ao]=az[parseInt(ao)-1]}if(ao==aC){aA[ao]=az[aB]}}}D.jui_datagrid({sorting:aA})}}}).disableSelection();an="input[type=radio]";var aw,aE,av,ax,ay;aF.off("click",an).on("click",an,function(){aw=parseInt(n(this).index("#"+aD+" "+an));aE=Math.floor(aw/3);av=aw%3;ay=n("#"+aD+" li");switch(av){case 0:ax="ascending";ay.eq(aE).removeClass(au);break;case 1:ax="descending";ay.eq(aE).removeClass(au);break;case 2:ax="none";ay.eq(aE).addClass(au);break}aA=D.jui_datagrid("getOption","sorting");aA[aE]["order"]=ax;D.jui_datagrid({sorting:aA})})})}if(ac>0){var am=S.pageNum,ad=S.rowsPerPage,W=S.maxRowsPerPage,ar=n("#"+F),aq=D.jui_datagrid("getPaginationOption","showRowsInfo");ar.jui_pagination({onSetRowsPerPage:function(au,av){if(isNaN(av)||av<=0){D.jui_datagrid("refresh")}else{W=parseInt(W);if(W>0){if(av>W){av=W}}D.jui_datagrid({pageNum:1,rowsPerPage:av})}},onChangePage:function(av,au){D.jui_datagrid({pageNum:au})},onDisplay:function(){if(aq){var au=((am-1)*ad)+1,av=Math.min(au+ad-1,ac),aw=au+"-"+av+" "+rsc_jui_dg.rows_info_of+" "+ac+" "+rsc_jui_dg.rows_info_records;n(this).jui_pagination("setRowsInfo",aw)}}})}D.triggerHandler("onDisplay")}})})},getDefaults:function(){return{columns:[{field:"",visible:"no",header:"",headerClass:"",dataClass:""}],sorting:[{sortingName:"",field:"",order:"none"}],filters:[{filterName:"",filterType:"",field:"",operator:"",value:"",value_range:{lower:"",upper:""},value_array:[],foreignKey:{ref_table:"",ref_pk:"",ref_col:"",condition:""},ajax_autocomplete_url:""}],pageNum:1,rowsPerPage:10,maxRowsPerPage:100,rowSelectionMode:"multiple",autoSetColumnsWidth:true,showRowNumbers:false,showSortingIndicator:true,showPrefButton:true,showSelectButtons:true,showRefreshButton:true,showDeleteButton:true,showPrintButton:true,showExportButton:true,showSortingButton:true,showFiltersButton:true,showPrefButtonText:false,showRefreshButtonText:false,showDeleteButtonText:false,showPrintButtonText:false,showExportButtonText:false,showSortingButtonText:false,showFiltersButtonText:false,dropdownSelectOptions:{menuClass:"dropdown_select_menu",launcherClass:"dropdown_select_launcher"},usePagination:true,paginationOptions:{visiblePageLinks:5,useSlider:true,showGoToPage:false,showRowsPerPage:true,showRowsInfo:true,showPreferences:false,disableSelectionNavPane:true},containerClass:"grid_container ui-state-default ui-corner-all",captionClass:"grid_caption ui-widget-header ui-corner-top",datagridHeaderClass:"grid_header ui-state-default",datagridClass:"grid_data ui-widget-content",toolsClass:"grid_tools ui-state-default ui-corner-all",paginationClass:"grid_pagination",headerTableClass:"grid_header_table",dataTableClass:"grid_data_table",trHoverTrClass:"",trHoverTdClass:"ui-state-hover",thClass:"grid_th_common ui-state-default",tdClass:"grid_td_common ui-widget-content",thRowNumberClass:"grid_th_common grid_th_row_number ui-state-default",tdRowNumberClass:"grid_td_common grid_td_row_number ui-widget-content",rowIndexHeaderClass:"",rowIndexClass:"",selectedTrTrClass:"",selectedTrTdClass:"ui-state-highlight",tbButtonContainer:"tbBtnContainer",tbPrefIconClass:"ui-icon-gear",tbRefreshIconClass:"ui-icon-refresh",tbDeleteIconClass:"ui-icon-trash",tbPrintIconClass:"ui-icon-print",tbExportIconClass:"ui-icon-extlink",tbSortingIconClass:"ui-icon ui-icon-carat-2-n-s",tbFiltersIconClass:"ui-icon-search",sortableListClass:"grid_sortable_list",sortableListLiClass:"ui-state-default grid_sortable_list_li",sortableListLiDisabledClass:"ui-state-disabled",sortableListLiIconClass:"ui-icon ui-icon-arrowthick-2-n-s grid_sortable_list_li_icon",commonListClass:"grid_common_list",dlgPrefClass:"dlg_pref",dlgPrefButtonClass:"dlg_pref_button",dlgSortClass:"dlg_sort",dlgSortButtonClass:"dlg_sort_button",caption_id_prefix:"caption_",datagrid_header_id_prefix:"dgh_",datagrid_id_prefix:"dg_",table_id_prefix:"tbl_",header_table_id_prefix:"tblh_",tools_id_prefix:"tools_",pagination_id_prefix:"pag_",pref_dialog_id_prefix:"pref_dlg_",pref_tabs_id_prefix:"pref_tabs_",col_order_list_id_prefix:"col_order_",col_visible_chk_id_prefix:"col_visible_",sort_dialog_id_prefix:"sort_dlg_",sorting_list_id_prefix:"sort_criteria_",sort_radio_name_prefix:"sort_order_",sort_asc_radio_id_prefix:"sort_asc_",sort_desc_radio_id_prefix:"sort_desc_",sort_none_radio_id_prefix:"sort_none_",fix_border_collapse_td_width:1,onCellClick:function(){},onRowClick:function(){},onDelete:function(){},onDisplay:function(){}}},getOption:function(C){var D=this;return D.data(c)[C]},getAllOptions:function(){var C=this;return C.data(c)},setOption:function(C,F,E){var D=this;D.data(c)[C]=F;if(E){D.jui_datagrid("init")}},refresh:function(){var C=this;C.jui_datagrid()},destroy:function(){return n(this).each(function(){var E=n(this),D=E.attr("id"),C=E.jui_datagrid("getOption","pagination_id_prefix")+D;n("#"+C).removeData();E.removeData()})},getSelectedIDs:function(){var C=this;return C.data(p)["a_selected_ids"]},getGridElemTableID:function(){var C=this;return u(C.jui_datagrid("getOption","table_id_prefix"),C.attr("id"))},getGridElemHeaderTableID:function(){var C=this;return u(C.jui_datagrid("getOption","header_table_id_prefix"),C.attr("id"))},setPageColClass:function(H,F,J,C){var G=this,I=G.attr("id"),E="#"+u(G.jui_datagrid("getOption","header_table_id_prefix"),I),D="#"+u(G.jui_datagrid("getOption","table_id_prefix"),I);if(F!==""){n(E+" th").eq(H).addClass(F)}if(J!==""){n(D+" tr").each(function(){n(this).find("td").eq(H).addClass(J)})}if(C){w(I)}},removePageColClass:function(H,F,J,C){var G=this,I=G.attr("id"),E="#"+u(G.jui_datagrid("getOption","header_table_id_prefix"),I),D="#"+u(G.jui_datagrid("getOption","table_id_prefix"),I);n(E+" th").eq(H).removeClass(F);n(D+" tr").each(function(){n(this).find("td").eq(H).removeClass(J)});if(C){w(I)}},getPaginationOption:function(E){var D=this.attr("id"),C=n("#"+D).jui_datagrid("getOption","pagination_id_prefix")+D;return n("#"+C).jui_pagination("getOption",E)},getAllPaginationOptions:function(){var D=this.attr("id"),C=n("#"+D).jui_datagrid("getOption","pagination_id_prefix")+D;return n("#"+C).jui_pagination("getAllOptions")}};var u=function(D,C){return D+C};var b=function(C){return(n("#"+C).length===0?false:true)};var v=function(C,F,E,D){C.button({label:F,text:E,icons:{primary:D}})};var t=function(C,D){if(!b(C)){return false}else{return(typeof n("#"+C).data(D)==="object"?true:false)}};var g=function(E,D,C,F){D.off("click",C).on("click",C,function(){var G={};G[F]=n(this).is(":checked");E.jui_datagrid({paginationOptions:G})})};var m=function(E,D,C,F){D.off("click",C).on("click",C,function(){var G={};G[F]=n(this).is(":checked");E.jui_datagrid(G)})};var s=function(C,D){var E;E="<li>";E+='<input type="checkbox" id="'+C+'" /><label for="'+C+'">'+D+"</label>";E+="</li>";return E};var f=function(E,F){var D="";for(var C in E){if(E[C].field==F){if(E[C].order=="ascending"){D="&nbsp;&uarr;"}else{if(E[C].order=="descending"){D="&nbsp;&darr;"}}break}}return D};var o=function(F){var U=n("#"+F),I=U.jui_datagrid("getOption","pref_dialog_id_prefix"),K=u(I,F),N=U.jui_datagrid("getOption","pref_tabs_id_prefix"),E=u(N,F),W=U.jui_datagrid("getOption","commonListClass"),D=U.jui_datagrid("getOption","columns"),M=U.jui_datagrid("getOption","sortableListClass"),H=U.jui_datagrid("getOption","sortableListLiClass"),V=U.jui_datagrid("getOption","sortableListLiDisabledClass"),G=U.jui_datagrid("getOption","sortableListLiIconClass"),T=u(U.jui_datagrid("getOption","col_order_list_id_prefix"),F),O=u(U.jui_datagrid("getOption","col_visible_chk_id_prefix"),F)+"_",L,P,J,R,S="",Q,C;S+='<div id="'+E+'">';S+="<ul>";S+='<li><a href="#'+E+'_grid">'+rsc_jui_dg.pref_tab_grid+"</a></li>";S+='<li><a href="#'+E+'_tools">'+rsc_jui_dg.pref_tab_tools+"</a></li>";S+='<li><a href="#'+E+'_nav">'+rsc_jui_dg.pref_tab_nav+"</a></li>";S+="</ul>";S+='<div id="'+E+'_grid">';S+='<ul class="'+W+'" style="margin-bottom: 20px;">';S+=s(K+"_row_numbers",rsc_jui_dg.pref_show_row_numbers);S+=s(K+"_sort_indicator",rsc_jui_dg.pref_show_sorting_indicator);S+="</ul>";S+="<p>"+rsc_jui_dg.pref_col_order_visibility+"</p>";S+='<ul id="'+T+'" class="'+M+'">';for(R in D){J=D[R]["visible"]=="no"?" "+V:"";P=D[R]["visible"]=="no"?"":' checked="checked"';L=O+R;S+='<li class="'+H+J+'"><span class="'+G+'"></span><input type="checkbox" id="'+L+'"'+P+'><label for="'+L+'">'+D[R].header+"</label></li>"}S+="</ul>";S+="</div>";S+='<div id="'+E+'_tools">';S+='<ul style="list-style-type: none;">';S+=s(K+"_btn_select",rsc_jui_dg.pref_show_select);S+=s(K+"_btn_refresh",rsc_jui_dg.pref_show_refresh);S+=s(K+"_btn_delete",rsc_jui_dg.pref_show_delete);S+=s(K+"_btn_print",rsc_jui_dg.pref_show_print);S+=s(K+"_btn_export",rsc_jui_dg.pref_show_export);S+=s(K+"_btn_sorting",rsc_jui_dg.pref_show_sorting);S+=s(K+"_btn_filters",rsc_jui_dg.pref_show_filters);S+="</ul>";S+="</div>";S+='<div id="'+E+'_nav">';S+='<ul style="list-style-type: none;">';S+=s(K+"_slider",rsc_jui_pag.pref_show_slider);S+=s(K+"_goto_page",rsc_jui_pag.pref_show_goto_page);S+=s(K+"_rows_per_page",rsc_jui_pag.pref_show_rows_per_page);S+=s(K+"_rows_info",rsc_jui_pag.pref_show_rows_info);S+=s(K+"_nav_buttons",rsc_jui_pag.pref_show_nav_buttons);S+="</ul>";S+="</div>";S+="</div>";n("#"+K).html(S);Q=["_row_numbers","_sort_indicator"];C=["showRowNumbers","showSortingIndicator"];for(R in Q){n("#"+K+Q[R]).attr("checked",U.jui_datagrid("getOption",C[R]))}Q=["_btn_select","_btn_refresh","_btn_delete","_btn_print","_btn_export","_btn_sorting","_btn_filters"];C=["showSelectButtons","showRefreshButton","showDeleteButton","showPrintButton","showExportButton","showSortingButton","showFiltersButton"];for(R in Q){n("#"+K+Q[R]).attr("checked",U.jui_datagrid("getOption",C[R]))}Q=["_slider","_goto_page","_rows_per_page","_rows_info","_nav_buttons"];C=["useSlider","showGoToPage","showRowsPerPage","showRowsInfo","showNavButtons"];for(R in Q){n("#"+K+Q[R]).attr("checked",U.jui_datagrid("getPaginationOption",C[R]))}};var j=function(D,E){var G=n("#"+D),F=n("#"+E),C=G.jui_datagrid("getOption","dlgPrefButtonClass");if(t(E,"dialog")){F.dialog("destroy")}F.dialog({autoOpen:true,width:400,height:"auto",position:{my:"top",at:"top",of:"#"+D},title:rsc_jui_dg.preferences,buttons:[{text:rsc_jui_dg.preferences_close,click:function(){n(this).dialog("close");n(this).dialog("destroy")}}],open:o(D),create:function(){n(this).closest(".ui-dialog").find(".ui-button").addClass(C)}})};var k=function(E){var Z=n("#"+E),F=Z.jui_datagrid("getOption","sort_dialog_id_prefix"),P=u(F,E),ab=Z.jui_datagrid("getOption","commonListClass"),D=Z.jui_datagrid("getOption","sorting"),S=Z.jui_datagrid("getOption","sortableListClass"),J=Z.jui_datagrid("getOption","sortableListLiClass"),aa=Z.jui_datagrid("getOption","sortableListLiDisabledClass"),G=Z.jui_datagrid("getOption","sortableListLiIconClass"),ac=u(Z.jui_datagrid("getOption","sorting_list_id_prefix"),E),N=u(Z.jui_datagrid("getOption","sort_radio_name_prefix"),E)+"_",C,H=u(Z.jui_datagrid("getOption","sort_asc_radio_id_prefix"),E)+"_",K=u(Z.jui_datagrid("getOption","sort_desc_radio_id_prefix"),E)+"_",I=u(Z.jui_datagrid("getOption","sort_none_radio_id_prefix"),E)+"_",O,M,X,Y,R,L,Q,U,W,V,T="";T+='<div style="margin: 5px; padding: 5px;">';T+="<p>"+rsc_jui_dg.sorting_criteria+"</p>";T+='<ul id="'+ac+'" class="'+S+'">';for(V in D){W=D[V]["order"]=="none"?" "+aa:"";C=N+V;O=H+V;M=K+V;X=I+V;Y=D[V]["order"]=="ascending"?' checked="checked"':"";R=D[V]["order"]=="descending"?' checked="checked"':"";L=D[V]["order"]=="none"?' checked="checked"':"";T+='<li class="'+J+W+'"><span class="'+G+'"></span>'+D[V].sortingName+'<span style="float: right; vertical-align: middle;"><input type="radio" name="'+C+'" id="'+O+'"'+Y+'><label for="'+O+'">'+rsc_jui_dg.sort_ascending+'</label><input type="radio" name="'+C+'" id="'+M+'"'+R+'><label for="'+M+'">'+rsc_jui_dg.sort_descending+'</label><input type="radio" name="'+C+'" id="'+X+'"'+L+'><label for="'+X+'">'+rsc_jui_dg.sort_none+"</label></span></li>"}T+="</ul>";T+="</div>";n("#"+P).html(T)};var d=function(C,D){var F=n("#"+C),G=n("#"+D),E=F.jui_datagrid("getOption","dlgSortButtonClass");if(t(D,"dialog")){G.dialog("destroy")}G.dialog({autoOpen:true,width:500,height:"auto",position:{my:"top",at:"top",of:"#"+C},title:rsc_jui_dg.sorting,buttons:[{text:rsc_jui_dg.sorting_close,click:function(){n(this).dialog("close");n(this).dialog("destroy")}}],open:function(){k(C)},create:function(){n(this).closest(".ui-dialog").find(".ui-button").addClass(E).focus()}})};var a=function(Y,J,T,N){var Z=n("#"+Y),E=Z.jui_datagrid("getOption","columns"),F=Z.jui_datagrid("getOption","sorting"),aa=parseInt(Z.jui_datagrid("getOption","pageNum")),M=parseInt(Z.jui_datagrid("getOption","rowsPerPage")),W=Z.jui_datagrid("getOption","showRowNumbers"),D=T.length,U=u(Z.jui_datagrid("getOption","datagrid_header_id_prefix"),Y),L=u(Z.jui_datagrid("getOption","datagrid_id_prefix"),Y),C=n("#"+U),R=n("#"+L),O=u(Z.jui_datagrid("getOption","header_table_id_prefix"),Y),Q=u(Z.jui_datagrid("getOption","table_id_prefix"),Y),V=Z.jui_datagrid("getOption","showSortingIndicator"),H,ab,X,I,S,K,P,G;G=((aa-1)*M);S="";S+='<table id="'+O+'">';S+="<thead>";ab=(N?' id="'+O+'_tr_0"':"");S+="<tr"+ab+">";if(W){S+="<th>"+rsc_jui_dg.row_index_header+"</th>"}for(X in E){if(E[X].visible=="yes"){H="";if(V){H=f(F,E[X].field)}S+="<th>"+E[X].header+H+"</th>"}}S+="</tr>";S+="</thead>";S+="</table>";C.html(S);K="";K+='<table id="'+Q+'">';K+="<tbody>";for(I in T){ab=(N?' id="'+Q+"_tr_"+T[I][N]+'"':"");K+="<tr"+ab+">";if(W){P=G+parseInt(I)+1;K+="<td>"+P+"</td>"}for(X in E){if(E[X].visible=="yes"){K+="<td>"+T[I][E[X].field]+"</td>"}}K+="</tr>"}K+="<tbody>";K+="</table>";R.html(K)};var r=function(P){var S=n("#"+P),G="#"+u(S.jui_datagrid("getOption","header_table_id_prefix"),P),U="#"+u(S.jui_datagrid("getOption","table_id_prefix"),P),R=n(G),Q=n(U),V=S.jui_datagrid("getOption","headerTableClass"),M=S.jui_datagrid("getOption","dataTableClass"),T=S.jui_datagrid("getOption","trHoverTrClass"),F=S.jui_datagrid("getOption","trHoverTdClass"),C=S.jui_datagrid("getOption","thClass"),L=S.jui_datagrid("getOption","tdClass"),D=S.jui_datagrid("getOption","thRowNumberClass"),J=S.jui_datagrid("getOption","tdRowNumberClass"),E=S.jui_datagrid("getOption","columns"),N=S.jui_datagrid("getOption","showRowNumbers"),I,H,O,K=N?1:0;R.removeClass(V).addClass(V);R.find("th").removeClass(C).addClass(C);Q.removeClass(M).addClass(M);Q.find("td").removeClass(L).addClass(L);if(N){R.find("th:first").removeClass(D).addClass(D);Q.find("tr").find("td:first").removeClass(J).addClass(J)}if(T!=""){Q.on("mouseover mouseout","tbody tr",function(W){n(this).toggleClass(T,W.type=="mouseover")})}if(F!=""){Q.on("mouseover mouseout","tbody tr",function(W){n(this).children().toggleClass(F,W.type=="mouseover")})}for(O in E){if(E[O].visible=="yes"){I=E[O]["headerClass"];H=E[O]["dataClass"];S.jui_datagrid("setPageColClass",K,I,H,false);K++}}w(P)};var q=function(I,K){if(K){var D=n("#"+I),H=D.jui_datagrid("getOption","rowSelectionMode"),J=D.jui_datagrid("getOption","selectedTrTrClass"),F=D.jui_datagrid("getOption","selectedTrTdClass"),G=u(D.jui_datagrid("getOption","table_id_prefix"),I),C=(G+"_tr_").length;if(H=="multiple"){var E="#"+G+" tbody tr";n(E).each(function(){var M=parseInt(n(this).attr("id").substr(C));var L=n.inArray(M,D.data(p)["a_selected_ids"]);if(L>-1){y(n(this),true,J,F)}})}else{l(I)}}else{l(I)}};var i=function(af,Q,Z){var au=n("#"+af),aA=u(au.jui_datagrid("getOption","tools_id_prefix"),af),an=au.jui_datagrid("getOption","toolsClass"),ao=au.jui_datagrid("getOption","rowSelectionMode"),ab=au.jui_datagrid("getOption","tbButtonContainer"),ap=au.jui_datagrid("getOption","showPrefButton"),ae=au.jui_datagrid("getOption","showPrefButtonText"),I=au.jui_datagrid("getOption","tbPrefIconClass"),aq=au.jui_datagrid("getOption","showSelectButtons"),ad=au.jui_datagrid("getOption","showRefreshButton"),at=au.jui_datagrid("getOption","showRefreshButtonText"),H=au.jui_datagrid("getOption","tbRefreshIconClass"),av=au.jui_datagrid("getOption","showDeleteButton"),V=au.jui_datagrid("getOption","showDeleteButtonText"),ag=au.jui_datagrid("getOption","tbDeleteIconClass"),K=au.jui_datagrid("getOption","showPrintButton"),aw=au.jui_datagrid("getOption","showPrintButtonText"),O=au.jui_datagrid("getOption","tbPrintIconClass"),al=au.jui_datagrid("getOption","showExportButton"),T=au.jui_datagrid("getOption","showExportButtonText"),X=au.jui_datagrid("getOption","tbExportIconClass"),ai=au.jui_datagrid("getOption","showSortingButton"),am=au.jui_datagrid("getOption","showSortingButtonText"),F=au.jui_datagrid("getOption","tbSortingIconClass"),N=au.jui_datagrid("getOption","showFiltersButton"),aj=au.jui_datagrid("getOption","showFiltersButtonText"),ak=au.jui_datagrid("getOption","tbFiltersIconClass");var M="";if(ap){M+='<div class="'+ab+'">';var D=aA+"_pref";M+='<button id="'+D+'">'+rsc_jui_dg.preferences+"</button>";M+="</div>"}if(Q>0){if(aq&&ao=="multiple"&&Z){var ar=aA+"_drop_select";var J=au.data(p)["count_selected_ids"];M+='<div class="'+ab+'">';M+='<div id="'+ar+'">';M+='<div id="'+ar+'_launcher_container">';M+='<button id="'+ar+'_launcher">'+rsc_jui_dg.tb_selected_label+": "+J+"</button>";M+="</div>";M+='<ul id="'+ar+'_menu">';M+='<li id="'+ar+'_all_in_page"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_all_in_page+"</a></li>";M+='<li id="'+ar+'_none_in_page"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_none_in_page+"</a></li>";M+='<li id="'+ar+'_inv_in_page"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_inverse_in_page+"</a></li>";M+="<hr>";M+='<li id="'+ar+'_none"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_none+"</a></li>";M+="</ul>";M+="</div>";M+="</div>"}}if(ad){M+='<div class="'+ab+'">';var aB=aA+"_refresh";M+='<button id="'+aB+'">'+rsc_jui_dg.tb_refresh+"</button>";M+="</div>"}if(Q>0){if(av&&Z){M+='<div class="'+ab+'">';var P=aA+"_delete";M+='<button id="'+P+'">'+rsc_jui_dg.tb_delete+"</button>";M+="</div>"}}if(Q>0){if(K||al){M+='<div class="'+ab+'">'}if(K){var U=aA+"_print";M+='<button id="'+U+'">'+rsc_jui_dg.tb_print+"</button>"}if(al){var G=aA+"_export";M+='<button id="'+G+'">'+rsc_jui_dg.tb_export+"</button>"}if(K||al){M+="</div>"}}if(ai){M+='<div class="'+ab+'">';var S=aA+"_sorting";M+='<button id="'+S+'">'+rsc_jui_dg.tb_sorting+"</button>";M+="</div>"}if(N){M+='<div class="'+ab+'">';var aa=aA+"_filters";M+='<button id="'+aa+'">'+rsc_jui_dg.tb_filters+"</button>";M+="</div>"}n("#"+aA).html(M);if(ap){v(n("#"+D),rsc_jui_dg.preferences,ae,I)}if(Q>0){if(aq&&ao=="multiple"&&Z){var E=n("#"+ar),ac=ar+"_launcher",R=ar+"_launcher_container",C=ar+"_menu",L=au.jui_datagrid("getOption","dropdownSelectOptions"),Y=["launcher_id","launcher_container_id","menu_id","onSelect"];for(var ax in Y){if(typeof(L[Y[ax]])!="undefined"){delete L[Y[ax]]}}var ah=E.data("jui_dropdown");if(typeof(ah)==="undefined"){var W=au.jui_datagrid("getDefaults");var az=W.dropdownSelectOptions;ah=n.extend({},az,L)}else{ah=n.extend({},ah,L)}var ay={launcher_id:ac,launcher_container_id:R,menu_id:C};ah=n.extend({},ah,ay);E.jui_dropdown(ah)}}if(ad){v(n("#"+aB),rsc_jui_dg.tb_refresh,at,H)}if(Q>0){if(av){v(n("#"+P),rsc_jui_dg.tb_delete,V,ag)}}if(Q>0){if(K){v(n("#"+U),rsc_jui_dg.tb_print,aw,O)}if(al){v(n("#"+G),rsc_jui_dg.tb_export,T,X)}}if(ai){v(n("#"+S),rsc_jui_dg.tb_sorting,am,F)}if(N){v(n("#"+aa),rsc_jui_dg.tb_filters,aj,ak)}};var e=function(K,H){var G=n("#"+K),O=G.jui_datagrid("getOption","pageNum"),D=G.jui_datagrid("getOption","rowsPerPage"),I=G.jui_datagrid("getOption","maxRowsPerPage"),R=Math.ceil(H/D),C=G.jui_datagrid("getOption","paginationClass"),N=u(G.jui_datagrid("getOption","pagination_id_prefix"),K),F=n("#"+N),J=G.jui_datagrid("getOption","paginationOptions"),S=["currentPage","rowsPerPage","totalPages","containerClass","onSetRowsPerPage","onChangePage","onDisplay"];for(var M in S){if(typeof(J[S[M]])!="undefined"){delete J[S[M]]}}var P=F.data("jui_pagination");if(typeof(P)==="undefined"){var L=G.jui_datagrid("getDefaults");var Q=L.paginationOptions;P=n.extend({},Q,J)}else{P=n.extend({},P,J)}var E={currentPage:O,rowsPerPage:D,totalPages:R,containerClass:C};P=n.extend({},P,E);F.jui_pagination(P)};var z=function(F){var E=n("#"+F),D=E.jui_datagrid("getOption","datagrid_id_prefix")+F,C=E.jui_datagrid("getOption","pagination_id_prefix")+F;n("#"+D).html(rsc_jui_dg.no_records_found);n("#"+C).hide()};var y=function(E,D,F,C){if(D==true){if(F){E.addClass(F)}if(C){E.children("td").addClass(C)}}else{if(F){E.removeClass(F)}if(C){E.children("td").removeClass(C)}}};var B=function(E,F){var I=n("#"+E),D=I.jui_datagrid("getOption","table_id_prefix"),J=u(D,E),H=n("#"+J+"_tr_"+F),C=I.jui_datagrid("getOption","selectedTrTrClass"),G=I.jui_datagrid("getOption","selectedTrTdClass");I.data(p)["a_selected_ids"].push(F);I.data(p)["count_selected_ids"]+=1;y(H,true,C,G)};var x=function(J,D,F){var E=n("#"+J),G=E.jui_datagrid("getOption","table_id_prefix"),I=u(G,J),C=n("#"+I+"_tr_"+D),K=E.jui_datagrid("getOption","selectedTrTrClass"),H=E.jui_datagrid("getOption","selectedTrTdClass");E.data(p)["a_selected_ids"].splice(F,1);E.data(p)["count_selected_ids"]-=1;y(C,false,K,H)};var l=function(E){var H=n("#"+E),D=H.jui_datagrid("getOption","table_id_prefix"),I=u(D,E),G=n("#"+I),C=H.jui_datagrid("getOption","selectedTrTrClass"),F=H.jui_datagrid("getOption","selectedTrTdClass");H.data(p)["a_selected_ids"]=[];H.data(p)["count_selected_ids"]=0;G.find("tr").removeClass(C);G.find("td").removeClass(F)};var h=function(C){var E=n("#"+C),F=E.data(p)["count_selected_ids"],D=u(E.jui_datagrid("getOption","tools_id_prefix"),C),G=D+"_drop_select";n("#"+G+"_launcher").button({label:rsc_jui_dg.tb_selected_label+": "+F})};var w=function(H){var E=n("#"+H),C="#"+u(E.jui_datagrid("getOption","header_table_id_prefix"),H),F="#"+u(E.jui_datagrid("getOption","table_id_prefix"),H),Q=n(C+" th").length,N=Q-1,I,J,D,R=false,G,L,K,P,O=[],M=parseInt(E.data(p)["fix_border_collapse_td_width"]);for(I=0;I<N;I++){J=n(C+" th").eq(I).width();D=n(F).find("tr").eq(0).find("td").eq(I).width();if(J!==D){R=true;break}}if(R){n(C).addClass("shrink");for(I=0;I<Q;I++){K=n(C).find("tr").eq(0).find("th").eq(I);L=K.width();P=n(F).find("tr").eq(0).find("td").eq(I);P.css("min-width",L+"px")}n(C).removeClass("shrink");n(C).width(n(F).width());for(I=0;I<Q;I++){var S=n(F).find("tr").eq(0).find("td").eq(I);G=S.width()+M;O.push(G);n(C+" th").eq(I).width(G)}}};n.fn.jui_datagrid=function(D){if(this.size()!=1){var C="You must use this plugin ("+c+") with a unique element (at once)";this.html('<span style="color: red;">ERROR: '+C+"</span>");n.error(C)}if(A[D]){return A[D].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof D==="object"||!D){return A.init.apply(this,arguments)}else{n.error("Method "+D+" does not exist on jQuery."+c)}}}})(jQuery);<commit_msg>minor changes<commit_after>/**
 * @fileOverview jquery plugin which displays database data in tabular format (datagrid)
 *               <p>License MIT
 *               <br />Copyright 2012 <NAME> <a href="http://pontikis.net">http://pontikis.net</a>
 *               <br />Project page <a href="https://github.com/pontikis/jui_datagrid">https://github.com/pontikis/jui_datagrid</a>
 *               <br />Minified using Online YUI Compressor http://www.refresh-sf.com/yui/
 * @version 1.00 (UPCOMING Release: 1.00 (?? Dec 2012))
 * @author <NAME> http://pontikis.net
 * @requires jquery, jquery-ui, jquery-ui themes, jui_pagination plugin, jui_filter_rules, jui_dropdown plugins
 */
"use strict";(function(n){var c="jui_datagrid",p="jui_datagrid_status";var A={init:function(C){var D=this;return this.each(function(){var S=D.data(c);if(typeof(S)==="undefined"){var L=D.jui_datagrid("getDefaults");S=n.extend({},L,C)}else{S=n.extend({},S,C)}D.data(c,S);if(typeof D.data(p)==="undefined"){D.data(p,{});D.data(p)["a_selected_ids"]=[];D.data(p)["count_selected_ids"]=0;if(n.browser.mozilla||(n.browser.msie&&parseInt(n.browser.version)>=10)){D.data(p)["fix_border_collapse_td_width"]=0}else{D.data(p)["fix_border_collapse_td_width"]=S.fix_border_collapse_td_width}}if(S.rowSelectionMode=="single"||S.rowSelectionMode==false){D.data(p)["a_selected_ids"]=[];D.data(p)["count_selected_ids"]=0}var R=D.attr("id");D.unbind("onCellClick").bind("onCellClick",S.onCellClick);D.unbind("onRowClick").bind("onRowClick",S.onRowClick);D.unbind("onDelete").bind("onDelete",S.onDelete);D.unbind("onDisplay").bind("onDisplay",S.onDisplay);var V=u(S.caption_id_prefix,R),Q=u(S.datagrid_header_id_prefix,R),K=u(S.datagrid_id_prefix,R),H=u(S.tools_id_prefix,R),F=u(S.pagination_id_prefix,R),J=u(S.pref_dialog_id_prefix,R),O=u(S.sort_dialog_id_prefix,R),U;if(!D.data(p)["initialize"]){U='<div id="'+V+'">'+S.caption+"</div>";U+='<div id="'+Q+'"></div>';U+='<div id="'+K+'"></div>';U+='<div id="'+H+'"></div>';U+='<div id="'+F+'"></div>';U+='<div id="'+J+'"></div>';U+='<div id="'+O+'"></div>';D.html(U);D.data(p)["initialize"]=true}var P=n("#"+V),G=n("#"+Q),M=n("#"+K),E=n("#"+H),N=n("#"+F),I=n("#"+J),T=n("#"+O);D.removeClass().addClass(S.containerClass);if(typeof S.caption==="undefined"){P.hide()}else{P.show().text(S.caption).removeClass().addClass(S.captionClass)}G.removeClass().addClass(S.datagridHeaderClass);M.removeClass().addClass(S.datagridClass);E.removeClass().addClass(S.toolsClass);N.removeClass().addClass(S.paginationClass);I.removeClass().addClass(S.dlgPrefClass);T.removeClass().addClass(S.dlgSortClass);n.ajax({type:"POST",url:S.ajaxFetchDataURL,data:{page_num:S.pageNum,rows_per_page:S.rowsPerPage,sorting:S.sorting},success:function(at){var ae=n.parseJSON(at);var ag=ae.row_primary_key;var ac=ae.total_rows;var al=ae.page_data;if(ac==0){z(R);i(R,ac)}else{a(R,ac,al,ag);r(R);q(R,ag);i(R,ac,ag);e(R,ac)}var an,ab,af,ah;if(ac>0){var ai=u(D.jui_datagrid("getOption","table_id_prefix"),R),Z=n("#"+ai),ak,aj;ah=(ai+"_tr_").length;an="tbody tr td";Z.off("click",an).on("click",an,function(){ak=n(this).index()+1;aj=n(this).parent("tr").index()+1;D.triggerHandler("onCellClick",{col:ak,row:aj})});an="tbody tr";Z.off("click",an).on("click",an,function(){if(ag){var aw=parseInt(n(this).attr("id").substr(ah)),av;if(S.rowSelectionMode===false){l(R);av="clicked"}else{if(S.rowSelectionMode=="single"){l(R);av="selected"}var au=n.inArray(aw,D.data(p)["a_selected_ids"]);if(au>-1){x(R,aw,au);av="deselected"}else{B(R,aw);av="selected"}}h(R)}D.triggerHandler("onRowClick",{row_id:aw,row_status:av})})}if(S.showPrefButton){an="#"+u(S.tools_id_prefix,R)+"_pref";D.off("click",an).on("click",an,function(){j(R,J);var aC=u(S.pref_tabs_id_prefix,R);n("#"+aC).tabs({create:function(){n("#"+aC+" li a").blur()},activate:function(){n("#"+aC+" li a").blur()}});var az=u(D.jui_datagrid("getOption","col_order_list_id_prefix"),R),ay=n("#"+az),au=D.jui_datagrid("getOption","sortableListLiDisabledClass"),aA,aB,av,aw,ax;ay.sortable({cancel:au,start:function(aD,aE){aA=aE.item.index()},stop:function(aD,aE){aB=aE.item.index();if(aB!==aA){av=D.jui_datagrid("getOption","columns");aw=[];if(aB>aA){for(ao in av){if(ao<aA||ao>aB){aw[ao]=av[ao]}if(ao>=aA&&ao<aB){aw[ao]=av[parseInt(ao)+1]}if(ao==aB){aw[ao]=av[aA]}}}if(aB<aA){for(ao in av){if(ao>aA||ao<aB){aw[ao]=av[ao]}if(ao<=aA&&ao>aB){aw[ao]=av[parseInt(ao)-1]}if(ao==aB){aw[ao]=av[aA]}}}D.jui_datagrid({columns:aw})}}}).disableSelection();an="input[type=checkbox]";ay.off("click",an).on("click",an,function(){ax=parseInt(n(this).index("#"+az+" "+an));n("#"+az+" li").eq(ax).toggleClass(au);aw=D.jui_datagrid("getOption","columns");aw[ax]["visible"]=n(this).is(":checked")?"yes":"no";D.jui_datagrid({columns:aw})})});var ap,X,ao;ap=["_row_numbers","_sort_indicator"];X=["showRowNumbers","showSortingIndicator"];for(ao in ap){m(D,I,"#"+J+ap[ao],X[ao])}ap=["_btn_select","_btn_refresh","_btn_delete","_btn_print","_btn_export","_btn_sorting","_btn_filters"];X=["showSelectButtons","showRefreshButton","showDeleteButton","showPrintButton","showExportButton","showSortingButton","showFiltersButton"];for(ao in ap){m(D,I,"#"+J+ap[ao],X[ao])}ap=["_slider","_goto_page","_rows_per_page","_rows_info","_nav_buttons"];X=["useSlider","showGoToPage","showRowsPerPage","showRowsInfo","showNavButtons"];for(ao in ap){g(D,I,"#"+J+ap[ao],X[ao])}}if(S.showSelectButtons&&S.rowSelectionMode=="multiple"&&ag){ah=(ai+"_tr_").length;var Y=n("#"+ai+" tbody tr");ab=u(D.jui_datagrid("getOption","tools_id_prefix"),R);af=ab+"_drop_select";var aa={all_in_page:1,none_in_page:2,inv_in_page:3,none:4};n("#"+af).jui_dropdown({onSelect:function(av,aw){var au=aw.index;switch(au){case aa.all_in_page:case aa.none_in_page:case aa.inv_in_page:Y.each(function(){var ay=parseInt(n(this).attr("id").substr(ah));var ax=n.inArray(ay,D.data(p)["a_selected_ids"]);if(au==aa.all_in_page){if(ax>-1){}else{B(R,ay)}}else{if(au==aa.none_in_page){if(ax>-1){x(R,ay,ax)}}else{if(au==aa.inv_in_page){if(ax>-1){x(R,ay,ax)}else{B(R,ay)}}}}});break;case aa.none:l(R);break}h(R)}})}if(S.showRefreshButton){an="#"+u(S.tools_id_prefix,R)+"_refresh";D.off("click",an).on("click",an,function(){n("#"+R).jui_datagrid("refresh")})}if(S.showDeleteButton&&ag){an="#"+u(S.tools_id_prefix,R)+"_delete";D.off("click",an).on("click",an,function(){D.triggerHandler("onDelete")})}if(S.showSortingButton){an="#"+u(S.tools_id_prefix,R)+"_sorting";D.off("click",an).on("click",an,function(){d(R,O);var aD=u(D.jui_datagrid("getOption","sorting_list_id_prefix"),R),aF=n("#"+aD),au=D.jui_datagrid("getOption","sortableListLiDisabledClass"),aB,aC,az,aA;aF.sortable({cancel:au,start:function(aG,aH){aB=aH.item.index()},stop:function(aG,aH){aC=aH.item.index();if(aC!==aB){az=D.jui_datagrid("getOption","sorting");aA=[];if(aC>aB){for(ao in az){if(ao<aB||ao>aC){aA[ao]=az[ao]}if(ao>=aB&&ao<aC){aA[ao]=az[parseInt(ao)+1]}if(ao==aC){aA[ao]=az[aB]}}}if(aC<aB){for(ao in az){if(ao>aB||ao<aC){aA[ao]=az[ao]}if(ao<=aB&&ao>aC){aA[ao]=az[parseInt(ao)-1]}if(ao==aC){aA[ao]=az[aB]}}}D.jui_datagrid({sorting:aA})}}}).disableSelection();an="input[type=radio]";var aw,aE,av,ax,ay;aF.off("click",an).on("click",an,function(){aw=parseInt(n(this).index("#"+aD+" "+an));aE=Math.floor(aw/3);av=aw%3;ay=n("#"+aD+" li");switch(av){case 0:ax="ascending";ay.eq(aE).removeClass(au);break;case 1:ax="descending";ay.eq(aE).removeClass(au);break;case 2:ax="none";ay.eq(aE).addClass(au);break}aA=D.jui_datagrid("getOption","sorting");aA[aE]["order"]=ax;D.jui_datagrid({sorting:aA})})})}if(ac>0){var am=S.pageNum,ad=S.rowsPerPage,W=S.maxRowsPerPage,ar=n("#"+F),aq=D.jui_datagrid("getPaginationOption","showRowsInfo");ar.jui_pagination({onSetRowsPerPage:function(au,av){if(isNaN(av)||av<=0){D.jui_datagrid("refresh")}else{W=parseInt(W);if(W>0){if(av>W){av=W}}D.jui_datagrid({pageNum:1,rowsPerPage:av})}},onChangePage:function(av,au){D.jui_datagrid({pageNum:au})},onDisplay:function(){if(aq){var au=((am-1)*ad)+1,av=Math.min(au+ad-1,ac),aw=au+"-"+av+" "+rsc_jui_dg.rows_info_of+" "+ac+" "+rsc_jui_dg.rows_info_records;n(this).jui_pagination("setRowsInfo",aw)}}})}D.triggerHandler("onDisplay")}})})},getDefaults:function(){return{columns:[{field:"",visible:"no",header:"",headerClass:"",dataClass:""}],sorting:[{sortingName:"",field:"",order:"none"}],filters:[{filterName:"",filterType:"",field:"",operator:"",value:"",value_range:{lower:"",upper:""},value_array:[],foreignKey:{ref_table:"",ref_pk:"",ref_col:"",condition:""},ajax_autocomplete_url:""}],pageNum:1,rowsPerPage:10,maxRowsPerPage:100,rowSelectionMode:"multiple",autoSetColumnsWidth:true,showRowNumbers:false,showSortingIndicator:true,showPrefButton:true,showSelectButtons:true,showRefreshButton:true,showDeleteButton:true,showPrintButton:true,showExportButton:true,showSortingButton:true,showFiltersButton:true,showPrefButtonText:false,showRefreshButtonText:false,showDeleteButtonText:false,showPrintButtonText:false,showExportButtonText:false,showSortingButtonText:false,showFiltersButtonText:false,dropdownSelectOptions:{menuClass:"dropdown_select_menu",launcherClass:"dropdown_select_launcher"},usePagination:true,paginationOptions:{visiblePageLinks:5,useSlider:true,showGoToPage:false,showRowsPerPage:true,showRowsInfo:true,showPreferences:false,disableSelectionNavPane:true},containerClass:"grid_container ui-state-default ui-corner-all",captionClass:"grid_caption ui-widget-header ui-corner-top",datagridHeaderClass:"grid_header ui-state-default",datagridClass:"grid_data ui-widget-content",toolsClass:"grid_tools ui-state-default ui-corner-all",paginationClass:"grid_pagination",headerTableClass:"grid_header_table",dataTableClass:"grid_data_table",trHoverTrClass:"",trHoverTdClass:"ui-state-hover",thClass:"grid_th_common ui-state-default",tdClass:"grid_td_common ui-widget-content",thRowNumberClass:"grid_th_common grid_th_row_number ui-state-default",tdRowNumberClass:"grid_td_common grid_td_row_number ui-widget-content",rowIndexHeaderClass:"",rowIndexClass:"",selectedTrTrClass:"",selectedTrTdClass:"ui-state-highlight",tbButtonContainer:"tbBtnContainer",tbPrefIconClass:"ui-icon-gear",tbRefreshIconClass:"ui-icon-refresh",tbDeleteIconClass:"ui-icon-trash",tbPrintIconClass:"ui-icon-print",tbExportIconClass:"ui-icon-extlink",tbSortingIconClass:"ui-icon ui-icon-carat-2-n-s",tbFiltersIconClass:"ui-icon-search",sortableListClass:"grid_sortable_list",sortableListLiClass:"ui-state-default grid_sortable_list_li",sortableListLiDisabledClass:"ui-state-disabled",sortableListLiIconClass:"ui-icon ui-icon-arrowthick-2-n-s grid_sortable_list_li_icon",commonListClass:"grid_common_list",dlgPrefClass:"dlg_pref",dlgPrefButtonClass:"dlg_pref_button",dlgSortClass:"dlg_sort",dlgSortButtonClass:"dlg_sort_button",caption_id_prefix:"caption_",datagrid_header_id_prefix:"dgh_",datagrid_id_prefix:"dg_",table_id_prefix:"tbl_",header_table_id_prefix:"tblh_",tools_id_prefix:"tools_",pagination_id_prefix:"pag_",pref_dialog_id_prefix:"pref_dlg_",pref_tabs_id_prefix:"pref_tabs_",col_order_list_id_prefix:"col_order_",col_visible_chk_id_prefix:"col_visible_",sort_dialog_id_prefix:"sort_dlg_",sorting_list_id_prefix:"sort_criteria_",sort_radio_name_prefix:"sort_order_",sort_asc_radio_id_prefix:"sort_asc_",sort_desc_radio_id_prefix:"sort_desc_",sort_none_radio_id_prefix:"sort_none_",fix_border_collapse_td_width:1,onCellClick:function(){},onRowClick:function(){},onDelete:function(){},onDisplay:function(){}}},getOption:function(C){var D=this;return D.data(c)[C]},getAllOptions:function(){var C=this;return C.data(c)},setOption:function(C,F,E){var D=this;D.data(c)[C]=F;if(E){D.jui_datagrid("init")}},refresh:function(){var C=this;C.jui_datagrid()},destroy:function(){return n(this).each(function(){var E=n(this),D=E.attr("id"),C=E.jui_datagrid("getOption","pagination_id_prefix")+D;n("#"+C).removeData();E.removeData()})},getSelectedIDs:function(){var C=this;return C.data(p)["a_selected_ids"]},getGridElemTableID:function(){var C=this;return u(C.jui_datagrid("getOption","table_id_prefix"),C.attr("id"))},getGridElemHeaderTableID:function(){var C=this;return u(C.jui_datagrid("getOption","header_table_id_prefix"),C.attr("id"))},setPageColClass:function(H,F,J,C){var G=this,I=G.attr("id"),E="#"+u(G.jui_datagrid("getOption","header_table_id_prefix"),I),D="#"+u(G.jui_datagrid("getOption","table_id_prefix"),I);if(F!==""){n(E+" th").eq(H).addClass(F)}if(J!==""){n(D+" tr").each(function(){n(this).find("td").eq(H).addClass(J)})}if(C){w(I)}},removePageColClass:function(H,F,J,C){var G=this,I=G.attr("id"),E="#"+u(G.jui_datagrid("getOption","header_table_id_prefix"),I),D="#"+u(G.jui_datagrid("getOption","table_id_prefix"),I);n(E+" th").eq(H).removeClass(F);n(D+" tr").each(function(){n(this).find("td").eq(H).removeClass(J)});if(C){w(I)}},getPaginationOption:function(E){var D=this.attr("id"),C=n("#"+D).jui_datagrid("getOption","pagination_id_prefix")+D;return n("#"+C).jui_pagination("getOption",E)},getAllPaginationOptions:function(){var D=this.attr("id"),C=n("#"+D).jui_datagrid("getOption","pagination_id_prefix")+D;return n("#"+C).jui_pagination("getAllOptions")}};var u=function(D,C){return D+C};var b=function(C){return(n("#"+C).length===0?false:true)};var v=function(C,F,E,D){C.button({label:F,text:E,icons:{primary:D}})};var t=function(C,D){if(!b(C)){return false}else{return(typeof n("#"+C).data(D)==="object"?true:false)}};var g=function(E,D,C,F){D.off("click",C).on("click",C,function(){var G={};G[F]=n(this).is(":checked");E.jui_datagrid({paginationOptions:G})})};var m=function(E,D,C,F){D.off("click",C).on("click",C,function(){var G={};G[F]=n(this).is(":checked");E.jui_datagrid(G)})};var s=function(C,D){var E;E="<li>";E+='<input type="checkbox" id="'+C+'" /><label for="'+C+'">'+D+"</label>";E+="</li>";return E};var f=function(E,F){var D="";for(var C in E){if(E[C].field==F){if(E[C].order=="ascending"){D="&nbsp;&uarr;"}else{if(E[C].order=="descending"){D="&nbsp;&darr;"}}break}}return D};var o=function(F){var U=n("#"+F),I=U.jui_datagrid("getOption","pref_dialog_id_prefix"),K=u(I,F),N=U.jui_datagrid("getOption","pref_tabs_id_prefix"),E=u(N,F),W=U.jui_datagrid("getOption","commonListClass"),D=U.jui_datagrid("getOption","columns"),M=U.jui_datagrid("getOption","sortableListClass"),H=U.jui_datagrid("getOption","sortableListLiClass"),V=U.jui_datagrid("getOption","sortableListLiDisabledClass"),G=U.jui_datagrid("getOption","sortableListLiIconClass"),T=u(U.jui_datagrid("getOption","col_order_list_id_prefix"),F),O=u(U.jui_datagrid("getOption","col_visible_chk_id_prefix"),F)+"_",L,P,J,R,S="",Q,C;S+='<div id="'+E+'">';S+="<ul>";S+='<li><a href="#'+E+'_grid">'+rsc_jui_dg.pref_tab_grid+"</a></li>";S+='<li><a href="#'+E+'_tools">'+rsc_jui_dg.pref_tab_tools+"</a></li>";S+='<li><a href="#'+E+'_nav">'+rsc_jui_dg.pref_tab_nav+"</a></li>";S+="</ul>";S+='<div id="'+E+'_grid">';S+='<ul class="'+W+'" style="margin-bottom: 20px;">';S+=s(K+"_row_numbers",rsc_jui_dg.pref_show_row_numbers);S+=s(K+"_sort_indicator",rsc_jui_dg.pref_show_sorting_indicator);S+="</ul>";S+="<p>"+rsc_jui_dg.pref_col_order_visibility+"</p>";S+='<ul id="'+T+'" class="'+M+'">';for(R in D){J=D[R]["visible"]=="no"?" "+V:"";P=D[R]["visible"]=="no"?"":' checked="checked"';L=O+R;S+='<li class="'+H+J+'"><span class="'+G+'"></span><input type="checkbox" id="'+L+'"'+P+'><label for="'+L+'">'+D[R].header+"</label></li>"}S+="</ul>";S+="</div>";S+='<div id="'+E+'_tools">';S+='<ul style="list-style-type: none;">';S+=s(K+"_btn_select",rsc_jui_dg.pref_show_select);S+=s(K+"_btn_refresh",rsc_jui_dg.pref_show_refresh);S+=s(K+"_btn_delete",rsc_jui_dg.pref_show_delete);S+=s(K+"_btn_print",rsc_jui_dg.pref_show_print);S+=s(K+"_btn_export",rsc_jui_dg.pref_show_export);S+=s(K+"_btn_sorting",rsc_jui_dg.pref_show_sorting);S+=s(K+"_btn_filters",rsc_jui_dg.pref_show_filters);S+="</ul>";S+="</div>";S+='<div id="'+E+'_nav">';S+='<ul style="list-style-type: none;">';S+=s(K+"_slider",rsc_jui_pag.pref_show_slider);S+=s(K+"_goto_page",rsc_jui_pag.pref_show_goto_page);S+=s(K+"_rows_per_page",rsc_jui_pag.pref_show_rows_per_page);S+=s(K+"_rows_info",rsc_jui_pag.pref_show_rows_info);S+=s(K+"_nav_buttons",rsc_jui_pag.pref_show_nav_buttons);S+="</ul>";S+="</div>";S+="</div>";n("#"+K).html(S);Q=["_row_numbers","_sort_indicator"];C=["showRowNumbers","showSortingIndicator"];for(R in Q){n("#"+K+Q[R]).attr("checked",U.jui_datagrid("getOption",C[R]))}Q=["_btn_select","_btn_refresh","_btn_delete","_btn_print","_btn_export","_btn_sorting","_btn_filters"];C=["showSelectButtons","showRefreshButton","showDeleteButton","showPrintButton","showExportButton","showSortingButton","showFiltersButton"];for(R in Q){n("#"+K+Q[R]).attr("checked",U.jui_datagrid("getOption",C[R]))}Q=["_slider","_goto_page","_rows_per_page","_rows_info","_nav_buttons"];C=["useSlider","showGoToPage","showRowsPerPage","showRowsInfo","showNavButtons"];for(R in Q){n("#"+K+Q[R]).attr("checked",U.jui_datagrid("getPaginationOption",C[R]))}};var j=function(D,E){var G=n("#"+D),F=n("#"+E),C=G.jui_datagrid("getOption","dlgPrefButtonClass");if(t(E,"dialog")){F.dialog("destroy")}F.dialog({autoOpen:true,width:400,height:"auto",position:{my:"top",at:"top",of:"#"+D},title:rsc_jui_dg.preferences,buttons:[{text:rsc_jui_dg.preferences_close,click:function(){n(this).dialog("close");n(this).dialog("destroy")}}],open:o(D),create:function(){n(this).closest(".ui-dialog").find(".ui-button").addClass(C)}})};var k=function(E){var Z=n("#"+E),F=Z.jui_datagrid("getOption","sort_dialog_id_prefix"),P=u(F,E),ab=Z.jui_datagrid("getOption","commonListClass"),D=Z.jui_datagrid("getOption","sorting"),S=Z.jui_datagrid("getOption","sortableListClass"),J=Z.jui_datagrid("getOption","sortableListLiClass"),aa=Z.jui_datagrid("getOption","sortableListLiDisabledClass"),G=Z.jui_datagrid("getOption","sortableListLiIconClass"),ac=u(Z.jui_datagrid("getOption","sorting_list_id_prefix"),E),N=u(Z.jui_datagrid("getOption","sort_radio_name_prefix"),E)+"_",C,H=u(Z.jui_datagrid("getOption","sort_asc_radio_id_prefix"),E)+"_",K=u(Z.jui_datagrid("getOption","sort_desc_radio_id_prefix"),E)+"_",I=u(Z.jui_datagrid("getOption","sort_none_radio_id_prefix"),E)+"_",O,M,X,Y,R,L,Q,U,W,V,T="";T+='<div style="margin: 5px; padding: 5px;">';T+="<p>"+rsc_jui_dg.sorting_criteria+"</p>";T+='<ul id="'+ac+'" class="'+S+'">';for(V in D){W=D[V]["order"]=="none"?" "+aa:"";C=N+V;O=H+V;M=K+V;X=I+V;Y=D[V]["order"]=="ascending"?' checked="checked"':"";R=D[V]["order"]=="descending"?' checked="checked"':"";L=D[V]["order"]=="none"?' checked="checked"':"";T+='<li class="'+J+W+'"><span class="'+G+'"></span>'+D[V].sortingName+'<span style="float: right; vertical-align: middle;"><input type="radio" name="'+C+'" id="'+O+'"'+Y+'><label for="'+O+'">'+rsc_jui_dg.sort_ascending+'</label><input type="radio" name="'+C+'" id="'+M+'"'+R+'><label for="'+M+'">'+rsc_jui_dg.sort_descending+'</label><input type="radio" name="'+C+'" id="'+X+'"'+L+'><label for="'+X+'">'+rsc_jui_dg.sort_none+"</label></span></li>"}T+="</ul>";T+="</div>";n("#"+P).html(T)};var d=function(C,D){var F=n("#"+C),G=n("#"+D),E=F.jui_datagrid("getOption","dlgSortButtonClass");if(t(D,"dialog")){G.dialog("destroy")}G.dialog({autoOpen:true,width:500,height:"auto",position:{my:"top",at:"top",of:"#"+C},title:rsc_jui_dg.sorting,buttons:[{text:rsc_jui_dg.sorting_close,click:function(){n(this).dialog("close");n(this).dialog("destroy")}}],open:function(){k(C)},create:function(){n(this).closest(".ui-dialog").find(".ui-button").addClass(E).focus()}})};var a=function(Y,J,T,N){var Z=n("#"+Y),E=Z.jui_datagrid("getOption","columns"),F=Z.jui_datagrid("getOption","sorting"),aa=parseInt(Z.jui_datagrid("getOption","pageNum")),M=parseInt(Z.jui_datagrid("getOption","rowsPerPage")),W=Z.jui_datagrid("getOption","showRowNumbers"),D=T.length,U=u(Z.jui_datagrid("getOption","datagrid_header_id_prefix"),Y),L=u(Z.jui_datagrid("getOption","datagrid_id_prefix"),Y),C=n("#"+U),R=n("#"+L),O=u(Z.jui_datagrid("getOption","header_table_id_prefix"),Y),Q=u(Z.jui_datagrid("getOption","table_id_prefix"),Y),V=Z.jui_datagrid("getOption","showSortingIndicator"),H,ab,X,I,S,K,P,G;G=((aa-1)*M);S="";S+='<table id="'+O+'">';S+="<thead>";ab=(N?' id="'+O+'_tr_0"':"");S+="<tr"+ab+">";if(W){S+="<th>"+rsc_jui_dg.row_index_header+"</th>"}for(X in E){if(E[X].visible=="yes"){H="";if(V){H=f(F,E[X].field)}S+="<th>"+E[X].header+H+"</th>"}}S+="</tr>";S+="</thead>";S+="</table>";C.html(S);K="";K+='<table id="'+Q+'">';K+="<tbody>";for(I in T){ab=(N?' id="'+Q+"_tr_"+T[I][N]+'"':"");K+="<tr"+ab+">";if(W){P=G+parseInt(I)+1;K+="<td>"+P+"</td>"}for(X in E){if(E[X].visible=="yes"){K+="<td>"+T[I][E[X].field]+"</td>"}}K+="</tr>"}K+="<tbody>";K+="</table>";R.html(K)};var r=function(P){var S=n("#"+P),G="#"+u(S.jui_datagrid("getOption","header_table_id_prefix"),P),U="#"+u(S.jui_datagrid("getOption","table_id_prefix"),P),R=n(G),Q=n(U),V=S.jui_datagrid("getOption","headerTableClass"),M=S.jui_datagrid("getOption","dataTableClass"),T=S.jui_datagrid("getOption","trHoverTrClass"),F=S.jui_datagrid("getOption","trHoverTdClass"),C=S.jui_datagrid("getOption","thClass"),L=S.jui_datagrid("getOption","tdClass"),D=S.jui_datagrid("getOption","thRowNumberClass"),J=S.jui_datagrid("getOption","tdRowNumberClass"),E=S.jui_datagrid("getOption","columns"),N=S.jui_datagrid("getOption","showRowNumbers"),I,H,O,K=N?1:0;R.removeClass(V).addClass(V);R.find("th").removeClass(C).addClass(C);Q.removeClass(M).addClass(M);Q.find("td").removeClass(L).addClass(L);if(N){R.find("th:first").removeClass(D).addClass(D);Q.find("tr").find("td:first").removeClass(J).addClass(J)}if(T!=""){Q.on("mouseover mouseout","tbody tr",function(W){n(this).toggleClass(T,W.type=="mouseover")})}if(F!=""){Q.on("mouseover mouseout","tbody tr",function(W){n(this).children().toggleClass(F,W.type=="mouseover")})}for(O in E){if(E[O].visible=="yes"){I=E[O]["headerClass"];H=E[O]["dataClass"];S.jui_datagrid("setPageColClass",K,I,H,false);K++}}w(P)};var q=function(I,K){if(K){var D=n("#"+I),H=D.jui_datagrid("getOption","rowSelectionMode"),J=D.jui_datagrid("getOption","selectedTrTrClass"),F=D.jui_datagrid("getOption","selectedTrTdClass"),G=u(D.jui_datagrid("getOption","table_id_prefix"),I),C=(G+"_tr_").length;if(H=="multiple"){var E="#"+G+" tbody tr";n(E).each(function(){var M=parseInt(n(this).attr("id").substr(C));var L=n.inArray(M,D.data(p)["a_selected_ids"]);if(L>-1){y(n(this),true,J,F)}})}else{l(I)}}else{l(I)}};var i=function(af,Q,Z){var au=n("#"+af),aA=u(au.jui_datagrid("getOption","tools_id_prefix"),af),an=au.jui_datagrid("getOption","toolsClass"),ao=au.jui_datagrid("getOption","rowSelectionMode"),ab=au.jui_datagrid("getOption","tbButtonContainer"),ap=au.jui_datagrid("getOption","showPrefButton"),ae=au.jui_datagrid("getOption","showPrefButtonText"),I=au.jui_datagrid("getOption","tbPrefIconClass"),aq=au.jui_datagrid("getOption","showSelectButtons"),ad=au.jui_datagrid("getOption","showRefreshButton"),at=au.jui_datagrid("getOption","showRefreshButtonText"),H=au.jui_datagrid("getOption","tbRefreshIconClass"),av=au.jui_datagrid("getOption","showDeleteButton"),V=au.jui_datagrid("getOption","showDeleteButtonText"),ag=au.jui_datagrid("getOption","tbDeleteIconClass"),K=au.jui_datagrid("getOption","showPrintButton"),aw=au.jui_datagrid("getOption","showPrintButtonText"),O=au.jui_datagrid("getOption","tbPrintIconClass"),al=au.jui_datagrid("getOption","showExportButton"),T=au.jui_datagrid("getOption","showExportButtonText"),X=au.jui_datagrid("getOption","tbExportIconClass"),ai=au.jui_datagrid("getOption","showSortingButton"),am=au.jui_datagrid("getOption","showSortingButtonText"),F=au.jui_datagrid("getOption","tbSortingIconClass"),N=au.jui_datagrid("getOption","showFiltersButton"),aj=au.jui_datagrid("getOption","showFiltersButtonText"),ak=au.jui_datagrid("getOption","tbFiltersIconClass");var M="";if(ap){M+='<div class="'+ab+'">';var D=aA+"_pref";M+='<button id="'+D+'">'+rsc_jui_dg.preferences+"</button>";M+="</div>"}if(Q>0){if(aq&&ao=="multiple"&&Z){var ar=aA+"_drop_select";var J=au.data(p)["count_selected_ids"];M+='<div class="'+ab+'">';M+='<div id="'+ar+'">';M+='<div id="'+ar+'_launcher_container">';M+='<button id="'+ar+'_launcher">'+rsc_jui_dg.tb_selected_label+": "+J+"</button>";M+="</div>";M+='<ul id="'+ar+'_menu">';M+='<li id="'+ar+'_all_in_page"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_all_in_page+"</a></li>";M+='<li id="'+ar+'_none_in_page"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_none_in_page+"</a></li>";M+='<li id="'+ar+'_inv_in_page"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_inverse_in_page+"</a></li>";M+="<hr>";M+='<li id="'+ar+'_none"><a href="javascript:void(0);">'+rsc_jui_dg.tb_select_none+"</a></li>";M+="</ul>";M+="</div>";M+="</div>"}}if(ad){M+='<div class="'+ab+'">';var aB=aA+"_refresh";M+='<button id="'+aB+'">'+rsc_jui_dg.tb_refresh+"</button>";M+="</div>"}if(Q>0){if(av&&Z){M+='<div class="'+ab+'">';var P=aA+"_delete";M+='<button id="'+P+'">'+rsc_jui_dg.tb_delete+"</button>";M+="</div>"}}if(Q>0){if(K||al){M+='<div class="'+ab+'">'}if(K){var U=aA+"_print";M+='<button id="'+U+'">'+rsc_jui_dg.tb_print+"</button>"}if(al){var G=aA+"_export";M+='<button id="'+G+'">'+rsc_jui_dg.tb_export+"</button>"}if(K||al){M+="</div>"}}if(ai){M+='<div class="'+ab+'">';var S=aA+"_sorting";M+='<button id="'+S+'">'+rsc_jui_dg.tb_sorting+"</button>";M+="</div>"}if(N){M+='<div class="'+ab+'">';var aa=aA+"_filters";M+='<button id="'+aa+'">'+rsc_jui_dg.tb_filters+"</button>";M+="</div>"}n("#"+aA).html(M);if(ap){v(n("#"+D),rsc_jui_dg.preferences,ae,I)}if(Q>0){if(aq&&ao=="multiple"&&Z){var E=n("#"+ar),ac=ar+"_launcher",R=ar+"_launcher_container",C=ar+"_menu",L=au.jui_datagrid("getOption","dropdownSelectOptions"),Y=["launcher_id","launcher_container_id","menu_id","onSelect"];for(var ax in Y){if(typeof(L[Y[ax]])!="undefined"){delete L[Y[ax]]}}var ah=E.data("jui_dropdown");if(typeof(ah)==="undefined"){var W=au.jui_datagrid("getDefaults");var az=W.dropdownSelectOptions;ah=n.extend({},az,L)}else{ah=n.extend({},ah,L)}var ay={launcher_id:ac,launcher_container_id:R,menu_id:C};ah=n.extend({},ah,ay);E.jui_dropdown(ah)}}if(ad){v(n("#"+aB),rsc_jui_dg.tb_refresh,at,H)}if(Q>0){if(av){v(n("#"+P),rsc_jui_dg.tb_delete,V,ag)}}if(Q>0){if(K){v(n("#"+U),rsc_jui_dg.tb_print,aw,O)}if(al){v(n("#"+G),rsc_jui_dg.tb_export,T,X)}}if(ai){v(n("#"+S),rsc_jui_dg.tb_sorting,am,F)}if(N){v(n("#"+aa),rsc_jui_dg.tb_filters,aj,ak)}};var e=function(K,H){var G=n("#"+K),O=G.jui_datagrid("getOption","pageNum"),D=G.jui_datagrid("getOption","rowsPerPage"),I=G.jui_datagrid("getOption","maxRowsPerPage"),R=Math.ceil(H/D),C=G.jui_datagrid("getOption","paginationClass"),N=u(G.jui_datagrid("getOption","pagination_id_prefix"),K),F=n("#"+N),J=G.jui_datagrid("getOption","paginationOptions"),S=["currentPage","rowsPerPage","totalPages","containerClass","onSetRowsPerPage","onChangePage","onDisplay"];for(var M in S){if(typeof(J[S[M]])!="undefined"){delete J[S[M]]}}var P=F.data("jui_pagination");if(typeof(P)==="undefined"){var L=G.jui_datagrid("getDefaults");var Q=L.paginationOptions;P=n.extend({},Q,J)}else{P=n.extend({},P,J)}var E={currentPage:O,rowsPerPage:D,totalPages:R,containerClass:C};P=n.extend({},P,E);F.jui_pagination(P)};var z=function(F){var E=n("#"+F),D=E.jui_datagrid("getOption","datagrid_id_prefix")+F,C=E.jui_datagrid("getOption","pagination_id_prefix")+F;n("#"+D).html(rsc_jui_dg.no_records_found);n("#"+C).hide()};var y=function(E,D,F,C){if(D==true){if(F){E.addClass(F)}if(C){E.children("td").addClass(C)}}else{if(F){E.removeClass(F)}if(C){E.children("td").removeClass(C)}}};var B=function(E,F){var I=n("#"+E),D=I.jui_datagrid("getOption","table_id_prefix"),J=u(D,E),H=n("#"+J+"_tr_"+F),C=I.jui_datagrid("getOption","selectedTrTrClass"),G=I.jui_datagrid("getOption","selectedTrTdClass");I.data(p)["a_selected_ids"].push(F);I.data(p)["count_selected_ids"]+=1;y(H,true,C,G)};var x=function(J,D,F){var E=n("#"+J),G=E.jui_datagrid("getOption","table_id_prefix"),I=u(G,J),C=n("#"+I+"_tr_"+D),K=E.jui_datagrid("getOption","selectedTrTrClass"),H=E.jui_datagrid("getOption","selectedTrTdClass");E.data(p)["a_selected_ids"].splice(F,1);E.data(p)["count_selected_ids"]-=1;y(C,false,K,H)};var l=function(E){var H=n("#"+E),D=H.jui_datagrid("getOption","table_id_prefix"),I=u(D,E),G=n("#"+I),C=H.jui_datagrid("getOption","selectedTrTrClass"),F=H.jui_datagrid("getOption","selectedTrTdClass");H.data(p)["a_selected_ids"]=[];H.data(p)["count_selected_ids"]=0;G.find("tr").removeClass(C);G.find("td").removeClass(F)};var h=function(C){var E=n("#"+C),F=E.data(p)["count_selected_ids"],D=u(E.jui_datagrid("getOption","tools_id_prefix"),C),G=D+"_drop_select";n("#"+G+"_launcher").button({label:rsc_jui_dg.tb_selected_label+": "+F})};var w=function(H){var E=n("#"+H),C="#"+u(E.jui_datagrid("getOption","header_table_id_prefix"),H),F="#"+u(E.jui_datagrid("getOption","table_id_prefix"),H),Q=n(C+" th").length,N=Q-1,I,J,D,R=false,G,L,K,P,O=[],M=parseInt(E.data(p)["fix_border_collapse_td_width"]);for(I=0;I<N;I++){J=n(C+" th").eq(I).width();D=n(F).find("tr").eq(0).find("td").eq(I).width();if(J!==D){R=true;break}}if(R){n(C).addClass("shrink");for(I=0;I<Q;I++){K=n(C).find("tr").eq(0).find("th").eq(I);L=K.width();P=n(F).find("tr").eq(0).find("td").eq(I);P.css("min-width",L+"px")}n(C).removeClass("shrink");n(C).width(n(F).width());for(I=0;I<Q;I++){var S=n(F).find("tr").eq(0).find("td").eq(I);G=S.width()+M;O.push(G);n(C+" th").eq(I).width(G)}}};n.fn.jui_datagrid=function(D){if(this.size()!=1){var C="You must use this plugin ("+c+") with a unique element (at once)";this.html('<span style="color: red;">ERROR: '+C+"</span>");n.error(C)}if(A[D]){return A[D].apply(this,Array.prototype.slice.call(arguments,1))}else{if(typeof D==="object"||!D){return A.init.apply(this,arguments)}else{n.error("Method "+D+" does not exist on jQuery."+c)}}}})(jQuery);
{'fraction_non_alphanumeric': 0.28622961369756295, 'fraction_numerical': 0.0032685826544955714, 'mean_word_length': 24.407917383820998, 'pattern_counts': {'":': 14, '<': 350, '<?xml version=': 0, '>': 374, 'https://': 3, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2197382', 'n_tokens_mistral': 25424, 'n_tokens_neox': 25230, 'n_words': 771}