modules.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * Copyright (c) UNA, Inc - https://una.io
  3. * MIT License - https://opensource.org/licenses/MIT
  4. *
  5. * @defgroup UnaStudio UNA Studio
  6. * @{
  7. */
  8. function BxDolStudioModules(oOptions) {
  9. this.sActionsUrl = oOptions.sActionUrl;
  10. this.sObjName = oOptions.sObjName == undefined ? 'oBxDolStudioModules' : oOptions.sObjName;
  11. this.sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
  12. this.iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  13. }
  14. BxDolStudioModules.prototype.uninstall = function(iId, sValue, iConfirm) {
  15. var $this = this;
  16. var oDate = new Date();
  17. var sAction = 'uninstall';
  18. if(!sValue)
  19. return false;
  20. $('.bx-popup-applied:visible').dolPopupHide();
  21. $.post(
  22. sUrlStudio + 'modules.php',
  23. {
  24. mod_action: sAction,
  25. mod_page_name: sValue,
  26. mod_widget_id: iId,
  27. mod_confirmed: parseInt(iConfirm),
  28. _t:oDate.getTime()
  29. },
  30. function (oData) {
  31. if(oData.message.length > 0)
  32. $this.popup(sAction, oData.message);
  33. if(oData.code == 0) {
  34. $('#bx-menu-item-' + sValue).bx_anim('hide', $this.sAnimationEffect, $this.iAnimationSpeed, function() {
  35. $(this).remove();
  36. });
  37. $('#bx-std-widget-' + iId).bx_anim('hide', $this.sAnimationEffect, $this.iAnimationSpeed, function() {
  38. $(this).remove();
  39. });
  40. }
  41. },
  42. 'json'
  43. );
  44. };
  45. BxDolStudioModules.prototype.popup = function(sType, sValue) {
  46. var sId = 'bx-std-mod-popup-' + sType;
  47. $('#' + sId).remove();
  48. $('<div id="' + sId + '" style="display: none;"></div>').prependTo('body').html(sValue);
  49. $('#' + sId).dolPopup({});
  50. };
  51. /** @} */