main.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. function BxNtfsMain(oOptions) {
  2. this._sActionsUri = oOptions.sActionUri;
  3. this._sActionsUrl = oOptions.sActionUrl;
  4. this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'slide' : oOptions.sAnimationEffect;
  5. this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  6. this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
  7. this._oRequestParams = oOptions.oRequestParams == undefined ? {} : oOptions.oRequestParams;
  8. }
  9. BxNtfsMain.prototype.onChangeType = function(oElement) {
  10. var $this = this;
  11. var oData = this._getDefaultData();
  12. jQuery.get(
  13. this._sActionsUrl + 'get_action/' + $(oElement).val(),
  14. oData,
  15. function(oData) {
  16. if(!oData || oData.code != 0)
  17. return;
  18. $('#' + $this._aHtmlIds['field_action']).html(oData.content).removeAttr('disabled');
  19. },
  20. 'json'
  21. );
  22. return false;
  23. };
  24. BxNtfsMain.prototype.loadingInButton = function(e, bShow) {
  25. if($(e).length)
  26. bx_loading_btn($(e), bShow);
  27. else
  28. bx_loading($('body'), bShow);
  29. };
  30. BxNtfsMain.prototype.loadingInItem = function(e, bShow) {
  31. var oParent = $(e).length ? $(e).parents('.bx-ntfs-item:first') : $('body');
  32. bx_loading(oParent, bShow);
  33. };
  34. BxNtfsMain.prototype.loadingInBlock = function(e, bShow) {
  35. var oParent = $(e).length ? $(e).parents('.bx-db-container:first') : $('body');
  36. bx_loading(oParent, bShow);
  37. };
  38. BxNtfsMain.prototype._loading = function(e, bShow) {
  39. var oParent = $(e).length ? $(e) : $('body');
  40. bx_loading(oParent, bShow);
  41. };
  42. BxNtfsMain.prototype._getDefaultData = function () {
  43. var oDate = new Date();
  44. return jQuery.extend({}, this._oRequestParams, {_t:oDate.getTime()});
  45. };