1
0

manage_tools.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * Copyright (c) UNA, Inc - https://una.io
  3. * MIT License - https://opensource.org/licenses/MIT
  4. *
  5. * @defgroup Posts Posts
  6. * @ingroup UnaModules
  7. *
  8. * @{
  9. */
  10. function BxPostsManageTools(oOptions) {
  11. this._iSearchTimeoutId = false;
  12. this._sActionsUrl = oOptions.sActionUrl;
  13. this._sObjNameGrid = oOptions.sObjNameGrid;
  14. this._sObjName = oOptions.sObjName == undefined ? 'oBxPostsManageTools' : 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. BxPostsManageTools.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 oSearch = $('#bx-grid-search-' + this._sObjNameGrid);
  26. var sValueSearch = oSearch.length > 0 ? oSearch.val() : '';
  27. if(sValueSearch == _t('_sys_grid_search'))
  28. sValueSearch = '';
  29. clearTimeout($this._iSearchTimeoutId);
  30. $this._iSearchTimeoutId = setTimeout(function () {
  31. glGrids[$this._sObjNameGrid].setFilter(sValueFilter1 + $this._sParamsDivider + sValueSearch, true);
  32. }, 500);
  33. };
  34. BxPostsManageTools.prototype.onClickSettings = function(sMenuObject, oButton) {
  35. if($(oButton).hasClass('bx-btn-disabled'))
  36. return false;
  37. bx_menu_popup(sMenuObject, oButton, {}, {
  38. content_id: $(oButton).attr('bx_grid_action_data')
  39. });
  40. };
  41. BxPostsManageTools.prototype.onClickDelete = function(iContentId) {
  42. $('.bx-popup-applied:visible').dolPopupHide();
  43. glGrids[this._sObjNameGrid].actionWithId(iContentId, 'delete', {}, '', false, 1);
  44. };
  45. /** @} */