settings.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /**
  2. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  3. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  4. *
  5. * @defgroup TridentStudio Trident Studio
  6. * @{
  7. */
  8. function BxDolStudioSettings(oOptions) {
  9. this.sActionsUrl = oOptions.sActionUrl;
  10. this.sObjName = oOptions.sObjName == undefined ? 'oBxDolStudioSettings' : oOptions.sObjName;
  11. this.sType = oOptions.sType == undefined ? '' : oOptions.sType;
  12. this.sCategory = oOptions.sCategory == undefined ? '' : oOptions.sCategory;
  13. this.sMix = oOptions.sMix == undefined ? '' : oOptions.sMix;
  14. this.sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
  15. this.iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  16. }
  17. BxDolStudioSettings.prototype.mixSelect = function(oSelect) {
  18. var $this = this;
  19. var oDate = new Date();
  20. $.post(
  21. sUrlStudio + 'settings.php',
  22. {
  23. page: this.sType,
  24. category: this.sCategory,
  25. stg_action: 'select-mix',
  26. stg_value: $(oSelect).val(),
  27. _t:oDate.getTime()
  28. },
  29. function (oData) {
  30. $this.processResult(oData);
  31. },
  32. 'json'
  33. );
  34. };
  35. BxDolStudioSettings.prototype.onMixSelect = function(oData) {
  36. document.location.href = document.location.href;
  37. };
  38. BxDolStudioSettings.prototype.mixCreate = function(oButton) {
  39. var $this = this;
  40. var oDate = new Date();
  41. $('.bx-popup-applied:visible').dolPopupHide();
  42. $.post(
  43. sUrlStudio + 'settings.php',
  44. {
  45. page: this.sType,
  46. category: this.sCategory,
  47. stg_action: 'create-mix',
  48. _t:oDate.getTime()
  49. },
  50. function (oData) {
  51. $this.processResult(oData);
  52. },
  53. 'json'
  54. );
  55. };
  56. BxDolStudioSettings.prototype.onMixCreate = function(oData) {
  57. document.location.href = document.location.href;
  58. };
  59. BxDolStudioSettings.prototype.mixDelete = function(oButton, iId) {
  60. var $this = this;
  61. var oDate = new Date();
  62. $.post(
  63. sUrlStudio + 'settings.php',
  64. {
  65. page: this.sType,
  66. category: this.sCategory,
  67. stg_action: 'delete-mix',
  68. stg_value: iId,
  69. _t:oDate.getTime()
  70. },
  71. function (oData) {
  72. $this.processResult(oData);
  73. },
  74. 'json'
  75. );
  76. };
  77. BxDolStudioSettings.prototype.onMixDelete = function(oData) {
  78. document.location.href = document.location.href;
  79. };
  80. /**
  81. * Is needed if AJAX is used to change (reload) pages.
  82. */
  83. BxDolStudioSettings.prototype.changePage = function(sType) {
  84. var oDate = new Date();
  85. var $this = this;
  86. $.get(
  87. this.sActionsUrl,
  88. {
  89. stg_action: 'get-page-by-type',
  90. stg_value: sType,
  91. _t:oDate.getTime()
  92. },
  93. function(oData) {
  94. if(oData.code != 0) {
  95. alert(oData.message);
  96. return;
  97. }
  98. $('#bx-std-pc-menu > .bx-std-pmi-active').removeClass('bx-std-pmi-active');
  99. $('#bx-std-pmi-' + sType).addClass('bx-std-pmi-active');
  100. $('#bx-std-pc-content').bx_anim('hide', $this.sAnimationEffect, $this.iAnimationSpeed, function() {
  101. $(this).html(oData.content).bx_anim('show', $this.sAnimationEffect, $this.iAnimationSpeed);
  102. });
  103. },
  104. 'json'
  105. );
  106. return true;
  107. };
  108. BxDolStudioSettings.prototype.processResult = function(oData) {
  109. var $this = this;
  110. if(oData && oData.message != undefined && oData.message.length != 0)
  111. alert(oData.message);
  112. if(oData && oData.reload != undefined && parseInt(oData.reload) == 1)
  113. document.location = document.location;
  114. if(oData && oData.popup != undefined) {
  115. var oPopup = $(oData.popup).hide();
  116. $('#' + oPopup.attr('id')).remove();
  117. oPopup.prependTo('body').dolPopup({
  118. fog: {
  119. color: '#fff',
  120. opacity: .7
  121. },
  122. closeOnOuterClick: false
  123. });
  124. }
  125. if (oData && oData.eval != undefined)
  126. eval(oData.eval);
  127. };
  128. /** @} */