language.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 BxDolStudioLanguage(oOptions) {
  9. this.sActionsUrl = oOptions.sActionUrl;
  10. this.sObjName = oOptions.sObjName == undefined ? 'oBxDolStudioLanguage' : oOptions.sObjName;
  11. this.sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
  12. this.iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  13. }
  14. BxDolStudioLanguage.prototype.activate = function(sLanguageName, oChecbox) {
  15. var $this = this;
  16. var oDate = new Date();
  17. $.get(
  18. this.sActionsUrl,
  19. {
  20. lang_action: 'activate',
  21. lang_value: sLanguageName,
  22. _t:oDate.getTime()
  23. },
  24. function(oData) {
  25. if(oData.code != 0) {
  26. alert(oData.message);
  27. $(oChecbox).attr('checked', 'checked').trigger('enable');
  28. return;
  29. }
  30. var oBg = $('.bx-std-page-bg');
  31. var oContent = $('#bx-std-page-columns');
  32. if(oData.content.length > 0) {
  33. oBg.removeClass('bx-std-page-bg-empty');
  34. oContent.html(oData.content).bx_anim('show', $this.sAnimationEffect, $this.iAnimationSpeed);
  35. }
  36. else
  37. oContent.bx_anim('hide', $this.sAnimationEffect, $this.iAnimationSpeed, function() {
  38. $(this).html(oData.content)
  39. oBg.addClass('bx-std-page-bg-empty');
  40. });
  41. },
  42. 'json'
  43. );
  44. return true;
  45. };
  46. /** @} */