manage_tools.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Copyright (c) UNA, Inc - https://una.io
  3. * MIT License - https://opensource.org/licenses/MIT
  4. *
  5. * @defgroup BaseText Base classes for text modules
  6. * @ingroup UnaModules
  7. *
  8. * @{
  9. */
  10. function BxBaseModTextManageTools(oOptions) {
  11. this._iSearchTimeoutId = false;
  12. this._sActionsUrl = oOptions.sActionUrl;
  13. this._sObjNameGrid = oOptions.sObjNameGrid;
  14. this._sObjName = oOptions.sObjName == undefined ? 'oBxBaseModTextManageTools' : oOptions.sObjName;
  15. this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
  16. this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  17. this._sParamsDivider = oOptions.sParamsDivider == undefined ? '#-#' : oOptions.sParamsDivider;
  18. this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
  19. this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
  20. }
  21. BxBaseModTextManageTools.prototype.onChangeFilter = function(oFilter) {
  22. var $this = this;
  23. var oFilter1 = $('#bx-grid-filter1-' + this._sObjNameGrid);
  24. var sValueFilter1 = oFilter1.length > 0 ? oFilter1.val() : '';
  25. var oFilter2 = $('#bx-grid-filter2-' + this._sObjNameGrid);
  26. var sValueFilter2 = oFilter2.length > 0 ? oFilter2.val() : '';
  27. var oSearch = $('#bx-grid-search-' + this._sObjNameGrid);
  28. var sValueSearch = oSearch.length > 0 ? oSearch.val() : '';
  29. if(sValueSearch == _t('_sys_grid_search'))
  30. sValueSearch = '';
  31. clearTimeout($this._iSearchTimeoutId);
  32. $this._iSearchTimeoutId = setTimeout(function () {
  33. glGrids[$this._sObjNameGrid].setFilter(sValueFilter1 + $this._sParamsDivider + sValueFilter2 + $this._sParamsDivider + sValueSearch, true);
  34. }, 500);
  35. };
  36. BxBaseModTextManageTools.prototype.onClickSettings = function(sMenuObject, oButton) {
  37. if($(oButton).hasClass('bx-btn-disabled'))
  38. return false;
  39. bx_menu_popup(sMenuObject, oButton, {}, {
  40. content_id: $(oButton).attr('bx_grid_action_data')
  41. });
  42. };
  43. BxBaseModTextManageTools.prototype.onClickDelete = function(iContentId) {
  44. $('.bx-popup-applied:visible').dolPopupHide();
  45. glGrids[this._sObjNameGrid].actionWithId(iContentId, 'delete', {}, '', false, 1);
  46. };
  47. /** @} */