var stateArray = new Array(0); var usersObj = null; var users = null; //setInterval(myToolbar, 100); function myToolbar(){ $( "[onclick_attribute]" ).each(function( index, element ) { var onclick_attribute = $(element).attr('onclick_attribute'); var tabid = $(element).parent('a').attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); try { // alert($(tab_frame)[0].contentDocument.title); var onclick_function = eval("$(tab_frame)[0].contentWindow."+onclick_attribute); var myToolbar_function = eval("$(tab_frame)[0].contentWindow.myToolbar"); if (onclick_function == null || onclick_function == undefined || myToolbar_function != undefined) { $(element).css('display','none'); } else { //alert(onclick_function); $(element).css('display',''); } } catch (ex) { $(element).css('display','none'); } }); // nazwy zakładek $( "[tabid]" ).each(function( index, element ) { var tabid = $(element).attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); // alert($(tab_frame).contents().find("title").html()); if($(tab_frame).contents().find("title").html() != undefined && $(tab_frame).contents().find("title").html() != 'Workflow'){ $(element).find('element').text(cutMe($(tab_frame).contents().find("title").html(),20)); $(element).find('element').attr('title', $(tab_frame).contents().find("title").html()); $(element).find('element').attr('alt', $(tab_frame).contents().find("title").html()); } }); } ///////////////////////////////// TOOLBAR ///////////////////////////////////////////////////// function open_add(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_add(); } catch(ex) { } } function open_save(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_save(); } catch(ex) { } } function open_delete(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_delete(); } catch(ex) { } } function open_print(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_print(); } catch(ex) { } } function open_email(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_email(); } catch(ex) { } } function open_search(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_search(); } catch(ex) { } } function open_preview(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_preview(); } catch(ex) { } } function open_copy(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].open_copy(); } catch(ex) { } } function open_paste(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_paste(); } catch(ex) { } } function open_cut(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_cut(); } catch(ex) { } } function open_add_user(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_add_user(); } catch(ex) { } } function open_set_master(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_set_master(); } catch(ex) { } } function open_ksiazka_podawcza(my_this){ try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_ksiazka_podawcza(); } catch(ex) { } } function open_consultation(my_this) { try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_consultation(); } catch(ex) { } } function expandCollapseHead(state) { // alert("HEAD state: 1-expand 0-collapse" + state); if(state) { Field('button_expand').parentNode.style.display=''; Field('button_collapse').parentNode.style.display='none'; } else { Field('button_expand').parentNode.style.display='none'; Field('button_collapse').parentNode.style.display=''; } } function open_expand(my_this) { // alert('HEAD -> PAGE open_expand'); try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_expand(); } catch(ex) { return; } $('#button_expand').css('display','none'); $('#button_collapse').css('display',''); } function open_collapse(my_this) { // alert('HEAD -> PAGE open_expand'); try { var tabid = $(my_this).parent().attr('tabid'); var tab_frame = $( tabid ).find( "iframe" ); $(tab_frame)[0].contentWindow.open_collapse(); } catch(ex) { return; } $('#button_expand').css('display',''); $('#button_collapse').css('display','none'); } function cutMe(text,length) { if (text.length > length) { text = text.slice(0, length) + '...'; } return text; } function clearFiltr(){ $('.checkbox_delay_ck').prop('checked', false); $('[check=".checkbox_delay_ck"]').addClass('icon_gray'); $('.checkbox_new_ck').prop('checked', true); $('[check=".checkbox_new_ck"]').removeClass('icon_gray'); $('#combobox_options option').each(function(){ $(this).prop("selected", false); }); $('#combobox_options :first').prop("selected", true); $('#combobox_options_filtr option').each(function(){ $(this).prop("selected", false); }); $('#combobox_options_filtr :first').prop("selected", true); $('.ToolElementSearch').val(''); // $('#filtr-form').submit(); } function bindDocsStr(){ var strResult = ""; if(localStorage.es_brangeGrid__selection != undefined){ // pobieramy doc_id a potem wysyłamy łączenie $.ajax({ type: "POST", url: "custom/ajax/ajax_task.php", data: { brangs: localStorage.es_brangeGrid__selection, aj_function: 'getDocIdFromBrangeId' }, success: function(msg) { strResult = String(jQuery.parseJSON(msg)); var from_tabid = window.parent.$('#addajaxtab').children('.selected').children('a').attr('from_tabid'); var tab_frame = window.parent.$( from_tabid ).find( "iframe" ); tab_frame[0].contentWindow.bindDocsStr(strResult); window.parent.closeTab(); }, complete: function() { }, error: function() { alert( "Wystąpił błąd w połączniu :("); window.parent.closeTab(); } }); } } function myDeleteBrangs(branges){ // usuwamy brangi dla taska $.ajax({ type: "POST", url: "custom/ajax/ajax_task.php", data: { brangs: branges, aj_function: 'myDeleteBrangs' }, success: function(msg) { $(".modal").modal('hide'); }, complete: function() { }, error: function() { alert( "Wystąpił błąd w połączniu :("); window.parent.closeTab(); } }); } function sessionExpire(){ $.ajax({ type: "POST", url: "custom/ajax/ajax_user.php", data: { aj_function: 'sessionExpireDate' }, success: function(msg) { console.log(msg); if(msg == 'FALSE'){ window.location = "./login.php?operation=logout"; } else { $('.session_expaired').html(msg); } }, complete: function() { }, error: function() { alert( "Wystąpił błąd w połączniu :("); window.parent.closeTab(); } }); } // nie wywołujemy ENTER jeżeli chociaż jeden modal jest otwarty /* $("html").bind("keypress", function (e) { if (e.keyCode == 13) { var retEnter = true; $( ".modal" ).each( function( index, element ){ if($('.filter-builder-textarea').is(":focus")){ // $( ".btn").unbind( "click" ); } else if($(element).hasClass('in')){ // retEnter = false; } }); return retEnter; } }); */ // nie wywołujemy ENTER, tymczasowo /* $("html").bind("keypress", function (e) { if (e.keyCode == 13) { return false; } }); */ function saveDefaultFilter(id_filter){ var tasktype_id = ''; var taskstage_id = ''; if($('#tasktype_id').val() != undefined){ tasktype_id = $('#tasktype_id').val(); } if($('#taskstage_id').val() != undefined){ taskstage_id = $('#taskstage_id').val(); } var val = {}; val[tasktype_id + '_' + taskstage_id] = id_filter; $.ajax({ type: "POST", url: "custom/ajax/ajax_user.php", async: false, data: { pref_id: 67, default_type: 0, value: JSON.stringify(val), istable: 1, preference_name: 'FiltersDefaultList', aj_function: 'SetPreference' }, success: function(msg) { $( ".combobox_options_filtr_ck" ).find('option').each(function(i, item){ $(item).attr('def','0'); }); $( ".combobox_options_filtr_ck" ).find(":selected").attr('def','1'); $("#def_img").attr("src", "components/assets/img/asterisk_yellow.png"); } }); } function showTabEditView(){ var allVals = []; $('input:checked').each(function() { allVals.push($(this).attr('id')); }); addNewTab_task($.base64.encode('./../commonlibs/component/viewer/index.php?ids_e='+JSON.stringify(allVals)), 'Edytor szablonów', true); }