function CommonInputControlsClass() { } CommonInputControlsClass.prototype.createInputMenu = function(replaceElement, inputId, inputClass, width, placeHolder, value, selectList, scrollParent, selectmenuTopCorrection) { scrollParent = (typeof scrollParent != 'undefined') ? scrollParent : 'NOPARENTGIVEN'; selectmenuTopCorrection = (typeof selectmenuTopCorrection != 'undefined') ? selectmenuTopCorrection : 0; var visibleList = []; var widthString = (width != 0) ? ' width: ' + width + 'px;' : ' width: 100%'; if(selectList.length<2) $('#' + inputId + '-menu').css('display', 'none'); var inputMenu = ''; inputMenu += ''; function __switchInputList(_show){ if (!_show) { $('#' + inputId + '-menu').find('i').removeClass('fa-chevron-up').addClass('fa-chevron-down'); $('.lzm-menu-select').css('display', 'none'); $('.lzm-menu-select').data('visible', false); } else { $('#' + inputId + '-menu').find('i').removeClass('fa-chevron-down').addClass('fa-chevron-up'); setTimeout(function() { $('.lzm-menu-select').css('display', 'none'); $('.lzm-menu-select').data('visible', false); $('#' + inputId + '-select').css('display', 'block'); $('#' + inputId + '-select').data('visible', true); }, 10); var scrollX = ($('#' + scrollParent).length > 0) ? $('#' + scrollParent)[0].scrollLeft : 0; //var scrollY = 0;//($('#' + scrollParent).length > 0) ? $('#' + scrollParent)[0].scrollTop : 0; var eltPos = $('#' + inputId + '-box').position(); var eltWidth = $('#' + inputId + '-box').width()+20; $('#' + inputId + '-select').css({ left: Math.floor(eltPos.left - scrollX) + 'px', //top: Math.floor(eltPos.top + eltHeight + 12 + selectmenuTopCorrection + scrollY) + 'px' width: Math.floor(eltWidth) + 'px' }); } } function updateInputList(_matchText){ var i,kIndex = parseInt($('#' + inputId).data('key-index')); if(kIndex > visibleList.length-1) kIndex = 0; if(kIndex < 0) kIndex = visibleList.length-1; var listElements = '', hlClass; var addedCount = 0; visibleList = []; for (i=0; i' + listValue + ''; addedCount++; visibleList.push(selectList[i]); } if(addedCount==20) break; } $('#' + inputId + '-select').html(listElements); $('#tr-intro-selectoption-' + kIndex.toString()).addClass('bg-blue').addClass('text-white'); $('.' + inputId + '-selectoption').click(function(e) { $('#' + inputId).val($(this).html().replace(//, '')); //$('#' + inputId + '-select').css('display', 'none'); __switchInputList(false); }); $('#' + inputId).data('key-index',kIndex); return listElements.length > 0; } $('#' + replaceElement).html(inputMenu).trigger('create'); updateInputList(null); var show;//eltPos = $('#' + inputId + '-box').position(); //var eltHeight = $('#' + inputId + '-box').height(); $('#' + inputId + '-select').css({ /* left: Math.floor(eltPos.left + 2) + 'px', top: Math.floor(eltPos.top + eltHeight + 8 + selectmenuTopCorrection) + 'px',*/ }); $('#' + replaceElement).css({'line-height': 2.5, 'white-space': 'nowrap'}); $('#' + inputId + '-menu').click(function(e) { if(selectList.length>0) show = $('#' + inputId + '-select').css('display') != 'block'; else show = false; __switchInputList(show); }); if ($('#' + scrollParent).length > 0) { $('#' + scrollParent).scroll(function() { //$('#' + inputId + '-select').css({display: 'none'}); __switchInputList(false); }); } $('#' + inputId).data('key-index',0); $('#' + inputId).keyup(function(e) { if(e.keyCode == 40) $('#' + inputId).data('key-index',parseInt($('#' + inputId).data('key-index'))+1); else if(e.keyCode == 38) $('#' + inputId).data('key-index',parseInt($('#' + inputId).data('key-index'))-1); else if(e.keyCode == 13) $('#' + inputId+'-selectoption-'+ $('#' + inputId).data('key-index')).click(); if(e.keyCode == 13 || e.keyCode == 9 || e.keyCode == 27) $('#' + inputId + '-select').css('display', 'none'); else __switchInputList(updateInputList($('#' + inputId).val())); }); $('#' + inputId).keydown(function(e) { if(e.keyCode == 9) $('#' + inputId + '-select').css('display', 'none'); }); $('body').click(function() { if ($('#' + inputId + '-select').css('display') == 'block') { $('#' + inputId + '-select').css('display', 'none'); } }); }; CommonInputControlsClass.prototype.createInput = function(myId, myClass, myText, myLabel, myIcon, myType, myLayoutType, myData, myRightText, myLeftText) { myLayoutType = (typeof myLayoutType != 'undefined') ? myLayoutType : 'a'; myType = (typeof myType != 'undefined' && myType != '') ? myType : 'text'; myData = (typeof myData != 'undefined' && myData != '') ? ' ' + myData : ''; myRightText = (typeof myRightText != 'undefined' && myRightText != '') ? ' ' + myRightText +'' : ''; myLeftText = (typeof myLeftText != 'undefined' && myLeftText != '') ? '' + myLeftText +' ' : ''; myClass = (myClass != '') ? myClass + ' lzm-input-container-' + myLayoutType : 'lzm-input-container-' + myLayoutType; var iconWidth = (myIcon != '') ? 10 : 0; var textLeft = (myLayoutType == 'a') ? ' style="left: ' + (iconWidth + 21) + 'px;right:0px;"' : ''; var inputMarginTop = (myType == 'file') ? ' style="margin-top: 4px;padding-left:10px;"' : ''; var redWidth = (myLeftText.length && myType != 'number') ? 'max-width:80%;' : ''; var inputHtml = ''; if(myLayoutType == '') { inputHtml = '
'; if(myLabel.length) inputHtml += ''; inputHtml+= '
'+myLeftText+''+myRightText+'
'; } else { inputHtml = '
'; if(myLabel.length) inputHtml += ''; inputHtml += '
' + myIcon + '
' + '
' + '' + '
' + '
'; } return inputHtml }; CommonInputControlsClass.prototype.createFileSelect = function(myId,myClass,myLabel){ myClass = (myClass != '') ? ' ' + myClass : ''; return ''; }; CommonInputControlsClass.prototype.createColor = function(myId, myClass, myText, myLabel, myIcon) { var myLayoutType = 'a'; myClass = (myClass != '') ? myClass + ' lzm-input-container-a' : 'lzm-input-container-a'; var iconWidth = 15; var textLeft = ' style="left: ' + (iconWidth + 20) + 'px;right:0px;"'; var color = ''; if(myText.length > 0 && lzm_commonTools.isHEXColor(myText)) color = 'background:' + myText+ ';'; var inputHtml = '
'; if(myLabel.length) inputHtml += ''; inputHtml+= '
' + myIcon + '
' + '
' + '' + '
' + '
'; return inputHtml; }; CommonInputControlsClass.prototype.createPosition = function(myId, value) { var inputHtml = '' + '' + '' + '' + '' + '' + '' + '' + '' + '
'; return inputHtml; } CommonInputControlsClass.prototype.createSelect = function(myId, myClass, myAction, myText, myIcon, myCss, myTitle, myOptionList, mySelectedOption, myLayoutType, data, mySize, myLeftText) { myLayoutType = (typeof myLayoutType != 'undefined') ? myLayoutType : 'a'; myId = (typeof myId != 'undefined' && myId != '') ? myId : md5('' + Math.random()); var mySelectId = (typeof myId != 'undefined' && myId != '') ? ' id="' + myId + '"' : ''; var myOuterId = (typeof myId != 'undefined' && myId != '') ? ' id="' + myId + '-outer"' : ''; myClass = (typeof myClass != 'undefined' && myClass != '') ? ' class="lzm-select- '+ myClass + '"' : ' class="lzm-select-' + myLayoutType + '"'; myCss = (typeof myCss != 'undefined') ? myCss : {}; myText = (typeof myText != 'undefined') ? myText : true; myLeftText = (typeof myLeftText != 'undefined' && myLeftText != '') ? '' + myLeftText +' ' : ''; var sizeAttr = (typeof mySize != 'undefined' && mySize != null) ? ' size="'+mySize+'"' : ''; var label = (typeof myText != 'undefined' && myText != '') ? '' : ''; myOptionList = (typeof myOptionList != 'undefined') ? myOptionList : []; mySelectedOption = (typeof mySelectedOption != 'undefined') ? mySelectedOption : 0; var mySelectedOptionIndex, i; for (i=0; i 0) selectCss += 'height:' + (19+(mySize*19)) + 'px;'; selectCss += '\''; var selectData = ''; if (typeof data != 'undefined' && data != null) for (var dataTag in data) if (data.hasOwnProperty(dataTag)) selectData += ' data-' + dataTag + '=' + data[dataTag]; var selectHtml = ''+label+myLeftText+''; for (i=0; i' + myOptionList[i].text + ''; } selectHtml += ''; return selectHtml; }; CommonInputControlsClass.prototype.createSelectChangeHandler = function(myId, myOptions) { $('#' + myId).change(function() { for (var i=0; i'; }; CommonInputControlsClass.prototype.createCheckbox = function(myId, myLabel, myValue, myClass, divCss) { var check = (myValue) ? ' checked': ''; slider = (typeof slider != 'undefined') ? slider : false; myClass = (typeof myClass != 'undefined') ? myClass : ''; divCss = (d(divCss) && divCss != '') ? ' style="'+divCss+'"' : ''; return '' + ''; }; CommonInputControlsClass.prototype.createImageBox = function(myId) { return '
'; }; CommonInputControlsClass.prototype.createButton = function(myId, myClass, myAction, myText, myIcon, myType, myCss, myTitle, myTextLength, myLayoutType, textWidth) { var myTextId = (typeof myId != 'undefined' && myId != '') ? myId : ''; myId = (typeof myId != 'undefined' && myId != '') ? ' id="' + myId + '"' : ''; myClass = (typeof myClass != 'undefined') ? myClass : ''; myAction = (typeof myAction != 'undefined' && myAction != '') ? ' onclick="' + myAction + '"' : ''; myText = (typeof myText != 'undefined') ? myText : ''; myIcon = (typeof myIcon != 'undefined') ? myIcon : ''; myType = (typeof myType != 'undefined') ? myType : ''; myCss = (typeof myCss != 'undefined') ? myCss : {}; textWidth = (d(textWidth)) ? textWidth : 500; myTitle = (typeof myTitle != 'undefined') ? ' title="' + myTitle + '"' : ''; myTextLength = (typeof myTextLength != 'undefined') ? myTextLength : 30; if(typeof IFManager != 'undefined' && (IFManager.IsMobileOS || IFManager.IsTabletOS)) if (myTextLength > 4) { myText = (myText.length > myTextLength) ? myText.substr(0, myTextLength - 3) + '...' : myText; } myLayoutType = (typeof myLayoutType != 'undefined' && myLayoutType != '') ? myLayoutType : 'b'; var showNoText = ($(window).width() < textWidth && myType != "force-text"); var buttonCss = ' style="%LEFTPADDING%%RIGHTPADDING%'; for (var cssTag in myCss) { if (myCss.hasOwnProperty(cssTag)) { var myCssTag = ''; if ((cssTag == 'padding-left' || cssTag == 'padding-right' ) && myText != '' && showNoText) myCssTag = (parseInt(myCss[cssTag]) + 0)+'px'; else myCssTag = myCss[cssTag]; buttonCss += ' ' + cssTag + ': ' + myCssTag + ';'; } } buttonCss += '"'; switch (myType) { case 'l': myClass = myClass + ' lzm-button-' + myLayoutType + ' lzm-button-left-' + myLayoutType; break; case 'r': myClass = myClass + ' lzm-button-' + myLayoutType + ' lzm-button-right-' + myLayoutType; break; case 'm': myClass = myClass + ' lzm-button-' + myLayoutType + ''; break; default: myClass = myClass + ' lzm-button-' + myLayoutType + ' lzm-button-left-' + myLayoutType + ' lzm-button-right-' + myLayoutType; break; } myClass += ' lzm-unselectable'; myClass = (myClass.replace(/^ */, '') != '') ? ' class="' + myClass.replace(/^ */, '') + '"' : ''; var iconPadding = '', buttonTextCss = ''; if (myIcon != '' && (myText == '' || showNoText)) { var padLeft = (typeof myCss['padding-left'] == 'undefined' && typeof myCss['padding'] == 'undefined') ? ' padding-left: 12px;' : ''; var padRight = (typeof myCss['padding-right'] == 'undefined' && typeof myCss['padding'] == 'undefined') ? ' padding-right: 12px;' : ''; buttonCss = buttonCss.replace(/%LEFTPADDING%/g,padLeft).replace(/%RIGHTPADDING%/g,padRight); buttonTextCss = ' display: none;'; } else if (myIcon != '' && (myText != '' && !showNoText)) { buttonCss = buttonCss.replace(/%LEFTPADDING%/g,'').replace(/%RIGHTPADDING%/g,''); buttonTextCss = 'display: inline; padding-left: 5px;'; } else { buttonCss = buttonCss.replace(/%LEFTPADDING%/g,'').replace(/%RIGHTPADDING%/g,''); buttonTextCss = 'display: inline;'; } var buttonHtml = '' + myIcon + '' + myText + '' + '
'; return buttonHtml }; CommonInputControlsClass.prototype.createArea = function(myId, myText, myClass, myLabel, myCSS, myAttributes) { var areaHtml = ''; myCSS = (d(myCSS)) ? myCSS : ''; myAttributes = (typeof myAttributes != 'undefined') ? myAttributes+' ' : ''; if(typeof myLabel != 'undefined' && myLabel.length) areaHtml += ''; return areaHtml + ''; }; CommonInputControlsClass.prototype.createPriorityList = function(id,cssClass,value,max,label) { var priorityList = [], lhtml =''; for(var i=1;i' + label + ''; return lhtml + this.createSelect(id,cssClass,'','','','','',priorityList,value,''); }; CommonInputControlsClass.prototype.CreateOperatorList = function(tableid,groups,priorities,checkList,_bots) { groups = (d(groups)) ? groups : true; priorities = (d(priorities)) ? priorities : true; checkList = (d(checkList)) ? checkList : null; _bots = (d(_bots)) ? _bots : false; var olHtml = ''; if(groups) olHtml += ''; if(priorities) olHtml += ''; olHtml += ''; var operators = DataEngine.operators.getOperatorList('','',true,_bots); for(var key in operators) { var op = operators[key]; var groupList = []; for(var i in op.groups) { var groupObj = DataEngine.groups.getGroup(op.groups[i]); if(groupObj != null && groupObj.external == 1) groupList.push({text:op.groups[i],value:op.groups[i]}); } var checkit = false; if(checkList != null) for(var rkey in checkList) if(checkList[rkey].rec == op.id) checkit = true; olHtml += ''; olHtml += ''; if(groups && groupList.length) olHtml += ''; else if(groups) olHtml+=''; if(priorities) olHtml += ''; olHtml += ''; } return olHtml + '
'+tid('operator')+''+tid('group')+''+tid('priority')+'
' + this.createCheckbox(tableid + '-cb-' + op.id,'',checkit,tableid + '-cb' + ((groupList.length || !groups) ? '' : ' ui-disabled'),'') + '' + lzm_commonTools.SubStr(op.userid,20,true) + '' + this.createSelect(tableid + '-groups-' + op.id,'','','','','','',groupList,0,'') + ''+tid('none')+'' + this.createPriorityList(tableid + '-priority-' + op.id,((groupList.length) ? '' : 'ui-disabled'),1,10) + '
'; }; CommonInputControlsClass.prototype.createTabControl = function(replaceElement, tabList, selectedTab, placeHolderWidth, layoutType) { var displayType = 'inline-block'; var mySelectedTab = (typeof selectedTab != 'undefined' && selectedTab > -1 && selectedTab < tabList.length) ? Math.max(selectedTab, 0) : 0; selectedTab = (typeof selectedTab != 'undefined') ? selectedTab : 0; var allTabsWidth = 0, closedTabColor = '#E0E0E0'; $('body').append('
').trigger('create'); var tabRowHtml = ''; var tabRowArray = []; var contentRowHtml = ''; var tabsAreTooWide = false, tabsAreStillTooWide = false; var thisTabHtml = '', thisTabWidth = [], firstVisibleTab, lastVisibleTab = 0; var leftTabHtml = ''; var rightTabHtml = ' '; $('#test-tab-width-container').html(rightTabHtml).trigger('create'); $('#test-tab-width-container').html(leftTabHtml).trigger('create'); for (var i=0; i' + tabName + ''; $('#test-tab-width-container').html(thisTabHtml).trigger('create'); thisTabWidth[i] = $('#' + replaceElement + '-tab-' + i).width() + 22; if (tabsAreTooWide) { thisTabHtml = thisTabHtml.replace(/%DISPLAY%/, 'none'); if (tabsAreStillTooWide) { var lastTabNo = tabRowArray.length -1; if(d(tabRowArray[lastTabNo])) tabRowArray[lastTabNo] = tabRowArray[lastTabNo].replace(displayType, 'none'); } } else { thisTabHtml = thisTabHtml.replace(/%DISPLAY%/, displayType); allTabsWidth += thisTabWidth[i]; lastVisibleTab = i; } tabRowArray.push(thisTabHtml); tabRowHtml += thisTabHtml; var displayString = (i == mySelectedTab) ? 'block' : 'none'; contentRowHtml += '
' + tabList[i].content + '
'; } tabRowHtml = tabRowArray.join(''); if(tabsAreTooWide) { tabRowHtml = leftTabHtml + tabRowHtml + rightTabHtml; } if (tabsAreStillTooWide) lastVisibleTab -= 1; var tabString = '
' + tabRowHtml + '
' + contentRowHtml; $('#test-tab-width-container').remove(); $('#' + replaceElement).html(tabString).trigger('create'); this.addTabControlEventHandler(replaceElement, tabList); var moveRightCounter = Math.max(Math.min(selectedTab - lastVisibleTab, 10), 0); for (var j=0; j i) ? selectedTab - 1 : 0; } } if (!tabWasRemoved) { newTabList.push({name: existingTabsArray[i].html, hash: existingTabsArray[i].hash, content: null}); } } for (i=0; i').trigger('create'); var placeHolderWidth = $('#' + replaceElement).parent().width(); var thisTabHtml = '', tabsAreTooWide = false, allTabsWidth = 0, lastVisibleTab = 0, tabRowHtml = '', thisTabWidth = [], firstVisibleTab = 0, visibleTabsWidth = 0, closedTabColor = '#E0E0E0'; var leftTabHtml = ''; var rightTabHtml = ' ... '; $('#test-tab-width-container').html(leftTabHtml.replace(/-tab-more-left/, '-test-tab-more-left')).trigger('create'); var leftTabWidth = $('#' + replaceElement + '-test-tab-more-left').width() + 22; $('#test-tab-width-container').html(rightTabHtml.replace(/-tab-more-left/, '-test-tab-more-left')).trigger('create'); var rightTabWidth = $('#' + replaceElement + '-test-tab-more-right').width() + 22; for (i=0; i' + tabName + ''; $('#test-tab-width-container').html(thisTabHtml).trigger('create'); thisTabWidth[i] = $('#' + replaceElement + '-tab-' + i).width() + 22; if (allTabsWidth + thisTabWidth[i] > placeHolderWidth) { tabsAreTooWide = true; } if (tabsAreTooWide) { thisTabHtml = thisTabHtml.replace(/%DISPLAY%/, 'none'); } else { thisTabHtml = thisTabHtml.replace(/%DISPLAY%/, displayType); allTabsWidth += thisTabWidth[i]; lastVisibleTab = i; } tabRowHtml += thisTabHtml; } $('#test-tab-width-container').remove(); if(tabsAreTooWide) { tabRowHtml = leftTabHtml + tabRowHtml + rightTabHtml; } $('#' + replaceElement + '-tabs-row').html(tabRowHtml).trigger('create'); //$('#' + replaceElement + '-tabs-row').attr('class', 'lzm-tabs-row'); $('.' + replaceElement + '-content').css('display', 'none'); for (i=0; i