designer.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 BxDolStudioDesigner(oOptions) {
  9. this.sActionsUrl = oOptions.sActionUrl;
  10. this.sObjName = oOptions.sObjName == undefined ? 'oBxDolStudioDesigner' : oOptions.sObjName;
  11. this.sParamPrefix = oOptions.sParamPrefix == undefined ? 'dsg' : oOptions.sParamPrefix;
  12. this.sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
  13. this.iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  14. }
  15. BxDolStudioDesigner.prototype.makeDefault = function(sUri) {
  16. var $this = this;
  17. var oDate = new Date();
  18. var aParams = {_t: oDate.getTime()};
  19. aParams[this.sParamPrefix + '_action'] = 'make_default';
  20. aParams[this.sParamPrefix + '_value'] = sUri;
  21. $.post(
  22. this.sActionsUrl,
  23. aParams,
  24. function(oData) {
  25. if(oData.code != 0 && oData.message.length > 0) {
  26. bx_alert(oData.message);
  27. return;
  28. }
  29. document.location.href = document.location.href;
  30. },
  31. 'json'
  32. );
  33. };
  34. BxDolStudioDesigner.prototype.deleteIcon = function(sName) {
  35. var $this = this;
  36. var oDate = new Date();
  37. var aParams = {_t: oDate.getTime()};
  38. aParams[this.sParamPrefix + '_action'] = 'delete_icon';
  39. aParams[this.sParamPrefix + '_value'] = sName;
  40. $.post(
  41. this.sActionsUrl,
  42. aParams,
  43. function(oData) {
  44. if(oData.code != 0 && oData.message.length > 0) {
  45. bx_alert(oData.message);
  46. return;
  47. }
  48. $('.adm-dsg-ip-' + sName).bx_anim('hide', $this.sAnimationEffect, $this.iAnimationSpeed, function() {
  49. $(this).remove();
  50. });
  51. },
  52. 'json'
  53. );
  54. };
  55. BxDolStudioDesigner.prototype.deleteCover = function(sType, iId) {
  56. var $this = this;
  57. var oDate = new Date();
  58. var aParams = {_t: oDate.getTime()};
  59. aParams[this.sParamPrefix + '_action'] = 'delete_cover';
  60. aParams[this.sParamPrefix + '_value'] = sType;
  61. $.post(
  62. this.sActionsUrl,
  63. aParams,
  64. function(oData) {
  65. if(oData.code != 0 && oData.message.length > 0) {
  66. bx_alert(oData.message);
  67. return;
  68. }
  69. $('#bx-dsg-cover-' + iId).bx_anim('hide', $this.sAnimationEffect, $this.iAnimationSpeed, function() {
  70. $(this).remove();
  71. });
  72. },
  73. 'json'
  74. );
  75. };
  76. /** @} */