modules.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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-std-widget-' + iId).bx_anim('hide', $this.sAnimationEffect, $this.iAnimationSpeed, function() {
  35. $(this).remove();
  36. });
  37. }
  38. },
  39. 'json'
  40. );
  41. };
  42. BxDolStudioModules.prototype.popup = function(sType, sValue) {
  43. var sId = 'bx-std-mod-popup-' + sType;
  44. $('#' + sId).remove();
  45. $('<div id="' + sId + '" style="display: none;"></div>').prependTo('body').html(sValue);
  46. $('#' + sId).dolPopup({});
  47. };
  48. /** @} */