polyglot.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 BxDolStudioPolyglot(oOptions) {
  9. this.sActionsUrl = oOptions.sActionUrl;
  10. this.sObjName = oOptions.sObjName == undefined ? 'oBxDolStudioPolyglot' : oOptions.sObjName;
  11. this.sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
  12. this.iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
  13. this.sPage = oOptions.sPage == undefined ? 'general' : oOptions.sPage;
  14. }
  15. /**
  16. * Is needed if AJAX is used to change (reload) pages.
  17. */
  18. BxDolStudioPolyglot.prototype.changePage = function(sType, iStart, iLength) {
  19. var oDate = new Date();
  20. var $this = this;
  21. var oParams = {
  22. pgt_action: 'get-page-by-type',
  23. pgt_value: sType,
  24. _t:oDate.getTime()
  25. };
  26. if(this.bShowWarning && !confirm(aDolLang['_adm_pgt_wrn_need_to_save']))
  27. return true;
  28. if(sType == 'keys') {
  29. oParams.pgt_category = $('#pgt-keys-category').val();
  30. oParams.pgt_language = $('#pgt-keys-language').val();
  31. oParams.pgt_keyword = $('#pgt-keys-keyword').val();
  32. if(iStart)
  33. oParams.pgt_start = iStart;
  34. if(iLength)
  35. oParams.pgt_length = iLength;
  36. }
  37. $.get(
  38. this.sActionsUrl,
  39. oParams,
  40. function(oData) {
  41. if(oData.code != 0) {
  42. alert(oData.message);
  43. return true;
  44. }
  45. $('#bx-std-pc-menu > .bx-std-pmi-active').removeClass('bx-std-pmi-active');
  46. $('#bx-std-pmi-' + sType).addClass('bx-std-pmi-active');
  47. $('#bx-std-pc-content').bx_anim('hide', $this.sAnimationEffect, $this.iAnimationSpeed, function() {
  48. $(this).html(oData.content).bx_anim('show', $this.sAnimationEffect, $this.iAnimationSpeed);
  49. });
  50. },
  51. 'json'
  52. );
  53. return true;
  54. };
  55. /** @} */