');
lastVisibleElement = replaceElement + '-content-' + i;
$('#' + lastVisibleElement).html(newTabList[i].content).css('display', 'none');
}
}
$('#' + replaceElement + '-content-' + mySelectedTab).css('display', 'block');
$('#' + replaceElement + '-tabs-row').data('selected-tab', selectedTab);
this.addTabControlEventHandler(replaceElement, newTabList, firstVisibleTab, lastVisibleTab, thisTabWidth, leftTabWidth,
rightTabWidth, visibleTabsWidth, placeHolderWidth, closedTabColor, layoutType);
};
CommonInputControlsClass.prototype.addTabControlEventHandler = function(replaceElement, tabList) {
var i,displayType = 'inline-block';
for (i=0; iB', '', 'lr',{'margin-left': '2px', 'padding-left': '12px', 'padding-right': '12px'}, '', -1,'e') +
lzm_inputControls.createButton('editor-italic-btn', _disabledClass, 'lzm_chatInputEditor.italic();', 'I', '', 'lr', {'margin-left': '-1px', 'padding-left': '12px', 'padding-right': '12px'}, '', -1,'e') +
lzm_inputControls.createButton('editor-underline-btn', _disabledClass, 'lzm_chatInputEditor.underline();', 'U', '', 'lr',{'margin-left': '-1px', 'padding-left': '12px', 'padding-right': '12px'}, '', -1,'e');
}
if (_mode == 'basic')
{
panelHtml += lzm_inputControls.createButton('editor-html-btn', '', 'lzm_chatInputEditor.showHTML();', 'HTML', '', 'lr',{'margin-left': '4px', 'padding-left': '12px', 'padding-right': '12px'}, '', -1,'e');
panelHtml += lzm_inputControls.createButton('editor-add-image-btn', '', 'lzm_chatInputEditor.addImage();', tid('image'), '', 'lr',{'margin-left': '-1px', 'padding-left': '12px', 'padding-right': '12px'}, '', -1,'e');
panelHtml += lzm_inputControls.createButton('editor-add-link-btn', '', 'lzm_chatInputEditor.addLink();', tid('link'), '', 'lr',{'margin-left': '-1px', 'padding-left': '12px', 'padding-right': '12px'}, '', -1,'e');
if(_placeHolders)
panelHtml += lzm_inputControls.createButton('editor-add-placeholder-btn', '', 'lzm_chatInputEditor.addPlaceholder();', tid('add_placeholder'), '', 'lr',{'margin-left': '-1px', 'padding-left': '12px', 'padding-right': '12px'}, '', -1,'e');
}
if (_mode != 'basic' && _mode != 'plain' && !isMobile)
panelHtml += lzm_inputControls.createButton('send-qrd', _disabledClass, 'KnowledgebaseUI.InsertIntoChat();', '', '', 'lr',{'margin-left': '4px'}, tid('knowledgebase'),-1,'e');
if(_customButtons)
panelHtml += _customButtons;
return panelHtml;
};
CommonInputControlsClass.prototype.createInfoField = function(icon, text, myClass) {
myClass = (d(myClass)) ? ' ' + myClass : '';
return '';
};
CommonInputControlsClass.prototype.createAvatarField = function(myClass, name, intid){
if(!LocalConfiguration.UIShowAvatars)
return '';
var url = getAvatarURL(name, intid);
myClass = (d(myClass)) ? ' ' + myClass : '';
return '';
};
function getAvatarURL(name, intid){
var getParam = '?' + ((d(intid) && intid.length > 0) ? 'operator=' + encodeURIComponent(intid) : (d(name) && name.length > 0) ? 'name=' + lz_global_base64_url_encode(name) : '');
return './../picture.php' + getParam;
}
CommonInputControlsClass.prototype.createSlider = function(_id){
};
CommonInputControlsClass.TagEditor = function(_id,_tagList,_allowAdd,_allowSelect,_allowRemove,_allowSearch, _dialogEditor, _singleSelect){
_singleSelect = d(_singleSelect) ? _singleSelect : null;
this.Id = _id;
this.TagList = [];
this.SelectedList = [];
this.NewList = [];
this.CountList = null;
this.AddTags(_tagList, false);
this.AllowAddTags = _allowAdd;
this.AllowRemoveTags = _allowRemove;
this.AllowSelectTags = _allowSelect;
this.AllowSearch = _allowSearch;
this.DialogEditor = _dialogEditor;
this.DialogEditorOK = null;
this.DialogEditorActive = false;
this.DialogTitle = '';
this.SingleSelect = _singleSelect;
this.OnChange = null;
this.Base = window;
this.BaseName = 'window';
this.CustomButtons = '';
this.PermissionsToAdd = null;
};
CommonInputControlsClass.TagEditor.prototype.AddTags = function(_tagList, _selected, _new){
var toAdd = [];
if (Array.isArray(_tagList))
toAdd = _tagList;
else if (typeof _tagList === 'string' || _tagList instanceof String)
{
if(_tagList.length)
{
_tagList = _tagList.replace(/ /g,',');
_tagList = _tagList.replace(/(?:\r\n|\r|\n)/g, ',');
_tagList = _tagList.replace(/,,/g,',');
_tagList = _tagList.replace(/,,/g,',');
}
if(_tagList.indexOf(',') != -1)
toAdd = _tagList.split(',');
else if(_tagList.length)
toAdd = [_tagList];
}
var toAddClean = [];
for(var key in toAdd)
{
if(toAdd[key].length)
toAddClean.push(toAdd[key]);
}
toAdd = toAddClean;
this.TagList = this.TagList.concat(toAdd);
this.TagList = lzm_commonTools.ArrayUnique(this.TagList);
this.TagList.sort();
if(_selected)
{
this.SelectedList = this.SelectedList.concat(toAdd);
this.SelectedList = lzm_commonTools.ArrayUnique(this.SelectedList);
this.SelectedList.sort();
}
if(_new)
{
this.NewList = this.NewList.concat(toAdd);
this.NewList = lzm_commonTools.ArrayUnique(this.NewList);
this.NewList.sort();
}
};
CommonInputControlsClass.TagEditor.prototype.SetCounts = function(_countList){
this.CountList = _countList;
};
CommonInputControlsClass.TagEditor.prototype.Clear = function(){
this.TagList = [];
this.SelectedList = [];
this.UpdateHTML();
};
CommonInputControlsClass.TagEditor.prototype.Remove = function(_tagId){
if(!this.AllowRemoveTags)
return;
var tagElem = $('#' + _tagId);
if(tagElem.hasClass('tag-available'))
{
var index = this.TagList.indexOf(lz_global_base64_decode(tagElem.data('value')));
if (index > -1)
this.TagList.splice(index, 1);
this.UpdateHTML();
}
else
{
tagElem.removeClass('tag-selected');
tagElem.addClass('tag-available');
}
};
CommonInputControlsClass.TagEditor.prototype.Select = function(_tagId){
if(!this.AllowSelectTags)
return;
if(this.DialogEditor && !this.DialogEditorActive)
{
this.Base.CommonInputControlsClass.TagEditor.ShowDialog(this.Id);
return;
}
var index,tagElem = $('#' + _tagId, this.Base.document);
if(tagElem.hasClass('tag-available'))
{
tagElem.addClass('tag-selected');
tagElem.removeClass('tag-available');
index = this.SelectedList.indexOf(lz_global_base64_decode(tagElem.data('value')));
if(this.NewList.indexOf(lz_global_base64_decode(tagElem.data('value'))) != -1)
tagElem.addClass('tag-new');
if (index == -1)
{
if(this.SingleSelect != null)
this.SelectedList = [];
this.SelectedList.push(lz_global_base64_decode(tagElem.data('value')));
}
}
else
{
tagElem.removeClass('tag-new');
tagElem.removeClass('tag-selected');
tagElem.addClass('tag-available');
index = this.SelectedList.indexOf(lz_global_base64_decode(tagElem.data('value')));
if (index != -1)
this.SelectedList.splice(index, 1);
}
this.SelectedList.sort();
this.UpdateHTML();
if(this.OnChange != null)
this.OnChange();
};
CommonInputControlsClass.TagEditor.prototype.Add = function(){
if(this.Id != 'gl_tags')
if(this.PermissionsToAdd != null && this.Base.PermissionEngine.permissions[this.PermissionsToAdd] != 1)
{
this.Base.showNoPermissionMessage();
return;
}
var that = this;
if(this.AllowAddTags)
{
this.AddTags($('#'+this.Id+'-search-field', this.Base.document).val(),that.AllowSelectTags,true);
$('#'+this.Id+'-search-field', this.Base.document).val('');
}
this.TagList.sort();
this.UpdateHTML();
};
CommonInputControlsClass.TagEditor.prototype.GetTagHTML = function(_text, _selected, _new, _count){
var html,id = md5(this.Id+_text);
var tclass = (!_selected) ? 'tag-available' : 'tag-selected';
if(_new && _selected)
tclass += ' tag-new';
if(this.AllowRemoveTags)
tclass += ' tag-removable';
if(this.AllowSelectTags)
tclass += ' lzm-clickable2';
html = '' + lzm_commonTools.htmlEntities(_text);
if(d(_count) && _count != null)
html += ' (' + this.GetCount(_text) + ')';
if(this.AllowRemoveTags)
html += '';
html += '
';
return html;
};
CommonInputControlsClass.TagEditor.prototype.GetCount = function(_tagText){
for(var key in this.CountList)
{
if(this.CountList[key][0] == _tagText)
return this.CountList[key][1];
}
return null;
};
CommonInputControlsClass.TagEditor.prototype.GetListString = function(_selected){
var string = '';
var list = _selected ? this.SelectedList : this.TagList;
for(var key in list)
{
if(string.length)
string += ',';
string += list[key];
}
return string;
};
CommonInputControlsClass.TagEditor.prototype.Search = function(){
$('#'+this.Id+'-search-field', this.Base.document).val($('#'+this.Id+'-search-field', this.Base.document).val().replace(/ /g,''));
this.UpdateHTML()
};
CommonInputControlsClass.TagEditor.prototype.GetHTML = function(_hspace, _maxRows){
var html = '';
var hspaceClass = (_hspace) ? ' hspaced' : '';
if(this.AllowSearch || this.DialogEditorActive)
{
var title = tid('search');
if(this.AllowAddTags)
title += ' / '+tid('add');
html += '
';
}
var style = '';
if(d(_maxRows) && _maxRows != null)
{
style = 'overflow:auto;height:' + (_maxRows * 42)+ 'px;';
}
if(this.DialogEditor && !this.DialogEditorActive)
{
style = 'padding-right: 40px';
html += '
';
}
html += '
';
html += this.GetTagsHTML();
if(!this.TagList.length)
html += '
'+tid('none')+'
';
html += '
';
if(!this.DialogEditor)
if(this.AllowAddTags || this.AllowRemoveTags || this.CustomButtons.length)
{
html += '
';
if(this.CustomButtons.length)
html += this.CustomButtons;
if(this.AllowRemoveTags)
html += lzm_inputControls.createButton(this.Id+'-button-clear', '','window[\''+this.Id+'\'].Clear()', tid('reset'), '', 'lr',{'margin-left': '4px'},'',30,'d');
html += '
';
}
html += '
';
return html;
};
CommonInputControlsClass.TagEditor.prototype.UpdateHTML = function(_ignoreBase){
var tagsHTML = this.GetTagsHTML();
if(!this.TagList.length)
tagsHTML += ''+tid('none')+'
';
if(!_ignoreBase)
$('#'+this.Id+'-available', this.Base.document).html(tagsHTML);
else
$('#'+this.Id+'-available').html(tagsHTML);
};
CommonInputControlsClass.TagEditor.prototype.GetTagsHTML = function(){
var val,key,search='',isSelected,isNew,canAdd=true,tagsHTML = '',seltagsHTML = '',addButtonDisplay='none';
if(this.AllowSearch || this.DialogEditorActive)
{
search = $('#'+this.Id+'-search-field', this.Base.document).val();
if(!d(search))
search = '';
}
for(key in this.TagList)
{
isSelected = this.SelectedList.indexOf(this.TagList[key]) != -1;
isNew = this.NewList.indexOf(this.TagList[key]) != -1;
val = this.TagList[key].toString();
if(search.length)
{
if(val.toLowerCase().indexOf(search.toLowerCase()) == -1 && !isSelected)
continue;
if(val.toLowerCase() == search.toLowerCase())
canAdd = false;
}
var count = null;
if(this.CountList != null && d(this.CountList[key]))
count = this.CountList[key];
if(isSelected)
seltagsHTML += this.GetTagHTML(val,true,isNew,count);
else if(!this.DialogEditor || this.DialogEditorActive)
tagsHTML += this.GetTagHTML(val,false,isNew,count);
}
if(search.length && canAdd && this.AllowAddTags)
addButtonDisplay = 'inline';
$('#' + this.Id+'-add', this.Base.document).css('display',addButtonDisplay);
return seltagsHTML + tagsHTML;
};
CommonInputControlsClass.TagEditor.prototype.ShowDialog = function(){
var ww = this.Base.lzm_chatDisplay.windowWidth;
var maxw = Math.min(ww*0.8,100);
var tagEditorHtml = '';
this.Base.lzm_commonDialog.createAlertDialog(tagEditorHtml, [{id: 'ok', name: tid('ok')}],true);
if(!this.Base.IFManager.IsMobileOS)
$('#'+this.Id+'-search-field', this.Base.document).focus();
};
CommonInputControlsClass.TagEditor.ShowDialog = function(_editorId){
window[_editorId].DialogEditorActive = true;
window[_editorId].ShowDialog();
if(window[_editorId].DialogEditorOK == null)
window[_editorId].DialogEditorOK = function(){
window[_editorId].DialogEditorActive = false;
window[_editorId].Base.lzm_commonDialog.removeAlertDialog();
window[_editorId].UpdateHTML(true);
};
$('#alert-btn-ok').click(window[_editorId].DialogEditorOK);
};
CommonInputControlsClass.SearchBox = function(){
var header = ''+tid('search')+'';
header += '';
header += lzm_inputControls.createButton('main-search-close', '', 'CommonInputControlsClass.SearchBox.ToggleSearchDialog(true,true);','', '', 'lr',{}, '', -1,'e');
header += '';
$('#main-search-headline').html(header);
};
CommonInputControlsClass.SearchBox.QueryList = {};
CommonInputControlsClass.SearchBox.LastQueryList = {};
CommonInputControlsClass.SearchBox.CurrentView = '';
CommonInputControlsClass.SearchBox.ShowTicket = false;
CommonInputControlsClass.SearchBox.ShowKB = false;
CommonInputControlsClass.SearchBox.ShowChatArchive = false;
CommonInputControlsClass.SearchBox.ShowInternal = false;
CommonInputControlsClass.SearchBox.SwitchWidth = 800;
CommonInputControlsClass.SearchBox.SetColor = function(){
$('#main-search-frame').css('background',(CommonInputControlsClass.SearchBox.GetQuery().length) ? '#ffffe1' : '#fff');
};
CommonInputControlsClass.SearchBox.Change = function(_e){
CommonInputControlsClass.SearchBox.SetColor();
var keyCode = d(_e) ? ((d(_e.which)) ? _e.which : ((d(_e.keyCode)) ? _e.keyCode : -1)) : -1;
if(!d(CommonInputControlsClass.SearchBox.QueryList[CommonInputControlsClass.SearchBox.CurrentView]))
CommonInputControlsClass.SearchBox.QueryList[CommonInputControlsClass.SearchBox.CurrentView] = '';
var val = $('#main-search-field').val();
CommonInputControlsClass.SearchBox.QueryList[CommonInputControlsClass.SearchBox.CurrentView] = val;
if(keyCode == 13)
CommonInputControlsClass.SearchBox.Search();
};
CommonInputControlsClass.SearchBox.GetQuery = function(_fromUI){
var view = CommonInputControlsClass.SearchBox.GetAreaIdentifier();
if(d(CommonInputControlsClass.SearchBox.QueryList[view]))
return CommonInputControlsClass.SearchBox.QueryList[view];
else if(_fromUI)
return $('#main-search-field').val();
else
return '';
};
CommonInputControlsClass.SearchBox.GetAreaIdentifier = function(){
if(KnowledgebaseUI.SelectionMode)
return 'sm_win_' + lzm_chatDisplay.selected_view;
else if(TaskBarManager.IsActiveChatWindow())
return 'win_' + lzm_chatDisplay.selected_view;
else
return lzm_chatDisplay.selected_view;
};
CommonInputControlsClass.SearchBox.SetQuery = function(_query){
$('#main-search-field').val(_query);
CommonInputControlsClass.SearchBox.SetColor();
};
CommonInputControlsClass.SearchBox.Focused = function(){
return $('#main-search-field').is(":focus");
};
CommonInputControlsClass.SearchBox.IsActiveSearch = function(){
var view = CommonInputControlsClass.SearchBox.GetAreaIdentifier();
if(d(CommonInputControlsClass.SearchBox.LastQueryList[view]))
if(CommonInputControlsClass.SearchBox.LastQueryList[view].length)
{
if(CommonInputControlsClass.SearchBox.LastQueryList[view] == 'tagsearch')
return true;
if(d(CommonInputControlsClass.SearchBox.QueryList[view]))
if(CommonInputControlsClass.SearchBox.QueryList[view].length)
return true;
}
return false;
};
CommonInputControlsClass.SearchBox.Search = function(){
var view = CommonInputControlsClass.SearchBox.GetAreaIdentifier();
var query = CommonInputControlsClass.SearchBox.GetQuery();
var tags = window['main-search-tags'].GetListString(true);
if(!query.length && !tags.length)
{
CommonInputControlsClass.SearchBox.Reset(true);
return;
}
if(query.length)
CommonInputControlsClass.SearchBox.LastQueryList[view] = query;
else
CommonInputControlsClass.SearchBox.LastQueryList[view] = 'tagsearch';
if(view == 'tickets')
ChatTicketClass.Search(query,tags);
else if(view.endsWith('qrd'))
KnowledgebaseUI.Search(query,tags);
else if(view == 'archive')
ChatArchiveClass.Search(query,tags);
else if(view == 'internal')
CommonUIClass.SearchOperators(query);
if(UIRenderer.windowWidth < CommonInputControlsClass.SearchBox.SwitchWidth)
CommonInputControlsClass.SearchBox.ToggleSearchDialog(true,true,true);
UIRenderer.resizeAll();
};
CommonInputControlsClass.SearchBox.Reset = function(_force){
var view = CommonInputControlsClass.SearchBox.GetAreaIdentifier();
if(CommonInputControlsClass.SearchBox.GetQuery(true).length || CommonInputControlsClass.SearchBox.LastQueryList[view] == 'tagsearch' || _force)
{
if(!_force)
CommonInputControlsClass.SearchBox.SetQuery('');
window['main-search-tags'].SelectedList = [];
window['main-search-tags'].UpdateHTML();
if(_force || (d(CommonInputControlsClass.SearchBox.LastQueryList[view]) && CommonInputControlsClass.SearchBox.LastQueryList[view].length))
{
if(view == 'tickets')
ChatTicketClass.Search('','');
else if(view.endsWith('qrd'))
KnowledgebaseUI.Search('','');
else if(view == 'archive')
ChatArchiveClass.Search('','');
else if(view == 'internal')
CommonUIClass.SearchOperators('');
if(IFManager.IsMobileOS && !KnowledgebaseUI.SelectionMode)
CommonInputControlsClass.SearchBox.ToggleSearchDialog(true,true);
}
CommonInputControlsClass.SearchBox.QueryList[view] = '';
CommonInputControlsClass.SearchBox.LastQueryList[view] = '';
}
CommonInputControlsClass.SearchBox.SetColor();
UIRenderer.resizeAll();
};
CommonInputControlsClass.SearchBox.ToggleSearchDialog = function(_switchArea,_hide,_noReset){
var showSearchBox = false, fullscreen = true;
if(UIRenderer.windowWidth < CommonInputControlsClass.SearchBox.SwitchWidth)
{
fullscreen = false;
_noReset = true;
}
_hide = (d(_hide)) ? _hide : false;
if(_hide && !d(_noReset) && CommonInputControlsClass.SearchBox.IsActiveSearch())
CommonInputControlsClass.SearchBox.Reset();
var view = CommonInputControlsClass.SearchBox.GetAreaIdentifier();
if(d(_switchArea))
{
if(view == 'tickets')
CommonInputControlsClass.SearchBox.ShowTicket = _hide ? false : !CommonInputControlsClass.SearchBox.ShowTicket;
else if(view.endsWith('qrd'))
CommonInputControlsClass.SearchBox.ShowKB = _hide ? false : !CommonInputControlsClass.SearchBox.ShowKB;
else if(view == 'archive')
CommonInputControlsClass.SearchBox.ShowChatArchive = _hide ? false : !CommonInputControlsClass.SearchBox.ShowChatArchive;
else if(view == 'internal')
CommonInputControlsClass.SearchBox.ShowInternal = _hide ? false : !CommonInputControlsClass.SearchBox.ShowInternal;
}
// tickets
if(view == 'tickets')
{
$('#ticket-list').css('display','block');
if(CommonInputControlsClass.SearchBox.ShowTicket)
{
showSearchBox = true;
$('#ticket-search').css('display','none');
if(!fullscreen)
$('#ticket-list').css('display','none');
}
else
{
$('#ticket-search').css('display','inline');
}
}
// knowledge base
if(view.endsWith('qrd'))
{
$('#qrd-tree').css('display','block');
if(CommonInputControlsClass.SearchBox.ShowKB)
{
showSearchBox = true;
$('#search-kb').css('display','none');
if(!fullscreen)
$('#qrd-tree').css('display','none');
}
else
{
$('#search-kb').css('display','inline');
}
}
// chat archive
if(view == 'archive')
{
$('#archive').css('display','block');
if(CommonInputControlsClass.SearchBox.ShowChatArchive)
{
showSearchBox = true;
$('#archive-search').css('display','none');
if(!fullscreen)
$('#archive').css('display','none');
}
else
{
$('#archive-search').css('display','inline');
}
}
// operators
if(view == 'internal')
{
$('#operator-list').css('display','block');
if(CommonInputControlsClass.SearchBox.ShowInternal)
{
showSearchBox = true;
$('#operator-search').css('display','none');
if(!fullscreen)
$('#operator-list').css('display','none');
}
else
{
$('#operator-search').css('display','inline');
}
}
var actwin = TaskBarManager.GetActiveWindow();
if(actwin != null)
{
showSearchBox = (actwin.TypeId.indexOf('qrd-') == 0);
}
if(!fullscreen)
{
$('#main-search-box').css({left:'8px',width:'auto',top:'44px'});
}
if(!showSearchBox)
{
$('#main-search-box').css('display','none');
$('#chat').css('right',0);
}
else
{
$('#main-search-box').css('display','block');
$('#chat').css('right','270px');
}
if(_hide || _switchArea)
UIRenderer.resizeAll();
};
CommonInputControlsClass.SearchBox.RenderSearchDialog = function(){
var view = CommonInputControlsClass.SearchBox.GetAreaIdentifier(),sshtml='';
sshtml += '';
if(view == 'tickets')
{
sshtml += lzm_inputControls.createCheckbox('ticket-ss-hash', tid('hash'),LocalConfiguration.TicketSearchSettings.split('')[2]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-name', tid('fullname'),LocalConfiguration.TicketSearchSettings.split('')[3]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-sid', tid('visitor_id'),LocalConfiguration.TicketSearchSettings.split('')[4]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-tid', tid('ticket_id'),LocalConfiguration.TicketSearchSettings.split('')[5]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-cf', tid('custom_field'),LocalConfiguration.TicketSearchSettings.split('')[6]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-text', tid('text'),LocalConfiguration.TicketSearchSettings.split('')[7]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-email', tid('email'),LocalConfiguration.TicketSearchSettings.split('')[8]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-company', tid('company'),LocalConfiguration.TicketSearchSettings.split('')[9]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-phone', tid('phone'),LocalConfiguration.TicketSearchSettings.split('')[10]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-subject', tid('subject'),LocalConfiguration.TicketSearchSettings.split('')[11]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-operator', tid('operator'),LocalConfiguration.TicketSearchSettings.split('')[12]=='1','ticket-ss-check');
sshtml += lzm_inputControls.createCheckbox('ticket-ss-comment', tid('comment'),LocalConfiguration.TicketSearchSettings.split('')[13]=='1','ticket-ss-check');
sshtml += '';
$('#main-search-settings').html(sshtml);
$('.ticket-ss-check').change(function(){
LocalConfiguration.TicketSearchSettings = '11';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-hash').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-name').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-sid').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-tid').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-cf').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-text').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-email').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-company').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-phone').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-subject').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-operator').prop('checked') ? '1' : '0';
LocalConfiguration.TicketSearchSettings += $('#ticket-ss-comment').prop('checked') ? '1' : '0';
LocalConfiguration.Save();
});
$('#ticket-ss-reset').click(function(){
$('.ticket-ss-check').prop('checked',true);
$('.ticket-ss-check').change();
});
}
else if(view.endsWith('qrd'))
{
sshtml += lzm_inputControls.createCheckbox('kb-ss-ti', tid('title'),LocalConfiguration.KBSearchSettings.split('')[0]=='1','kb-ss-check');
sshtml += lzm_inputControls.createCheckbox('kb-ss-text', tid('text'),LocalConfiguration.KBSearchSettings.split('')[1]=='1','kb-ss-check');
sshtml += lzm_inputControls.createCheckbox('kb-ss-t', tid('tags'),LocalConfiguration.KBSearchSettings.split('')[2]=='1','kb-ss-check');
sshtml += '';
$('#main-search-settings').html(sshtml);
$('.kb-ss-check').change(function(){
LocalConfiguration.KBSearchSettings = '';
LocalConfiguration.KBSearchSettings += $('#kb-ss-ti').prop('checked') ? '1' : '0';
LocalConfiguration.KBSearchSettings += $('#kb-ss-text').prop('checked') ? '1' : '0';
LocalConfiguration.KBSearchSettings += $('#kb-ss-t').prop('checked') ? '1' : '0';
LocalConfiguration.Save();
});
$('#kb-ss-reset').click(function(){
$('.kb-ss-check').prop('checked',true);
});
}
else
{
sshtml += ''+tid('none')+'
';
$('#main-search-settings').html(sshtml);
}
if(view == 'internal')
{
$('#main-search-tags').css('display','none');
}
else
{
$('#main-search-tags').css('display','block');
CommonInputControlsClass.SearchBox.UpdateTags();
}
if(KnowledgebaseUI.SelectionMode)
{
$('#main-search-close').css('display','none');
}
else
{
$('#main-search-close').css('display','inline');
}
var updateSearch = false;
var query,old = $('#main-search-field').val();
if(view != CommonInputControlsClass.SearchBox.CurrentView)
{
if(view.endsWith('qrd'))
updateSearch = true;
if(d(CommonInputControlsClass.SearchBox.QueryList[view]))
CommonInputControlsClass.SearchBox.SetQuery(query = CommonInputControlsClass.SearchBox.QueryList[view]);
else
CommonInputControlsClass.SearchBox.SetQuery(query = '');
if(updateSearch)
{
if(old != query)
CommonInputControlsClass.SearchBox.Search();
else if(query == '')
CommonInputControlsClass.SearchBox.Reset(true);
}
}
CommonInputControlsClass.SearchBox.CurrentView = view;
};
CommonInputControlsClass.SearchBox.UpdateTags = function(){
if(!(d(window['main-search-tags']) && d(window['main-search-tags'].GetListString) && DataEngine.getConfigValue('gl_tags',false) == window['main-search-tags'].GetListString(false)))
{
window['main-search-tags'] = new CommonInputControlsClass.TagEditor('main-search-tags',DataEngine.getConfigValue('gl_tags',false),false,true,false,true);
window['main-search-tags'].PermissionsToAdd = 'add_tags';
$('#main-search-tags').html('' + window['main-search-tags'].GetHTML(false));
}
};
CommonInputControlsClass.SearchBox.UpdateLanguages = function(){
/*
var alllangs = [];
if(!(d(window['main-search-languages']) && d(window['main-search-languages'].GetListString)))
{
window['main-search-languages'] = new CommonInputControlsClass.TagEditor('main-search-languages',alllangs,false,true,false,false);
$('#main-search-languages').html('' + window['main-search-languages'].GetHTML(false));
}
*/
};