forms.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. /*
  9. * Functions for "Form View Image Uploader" fields.
  10. */
  11. function fviuDelete(sName, oLink) {
  12. var $this = this;
  13. var oDate = new Date();
  14. /*
  15. $.post(
  16. this.sActionsUrl,
  17. {
  18. dsg_action: 'delete_logo',
  19. _t: oDate.getTime()
  20. },
  21. function(oData) {
  22. if(oData.code != 0 && oData.message.length > 0) {
  23. alert(oData.message);
  24. return;
  25. }
  26. document.location.href = document.location.href;
  27. },
  28. 'json'
  29. );
  30. */
  31. }
  32. /*
  33. * Functions for "Form View Translatable" fields.
  34. */
  35. function fvtTogglePopup(sName, oLink) {
  36. var oPopup = $('#bx-form-field-translator-popup-' + sName);
  37. if(oPopup.filter(':visible').length > 0) {
  38. oPopup.dolPopupHide();
  39. return;
  40. }
  41. oPopup.dolPopup({
  42. moveToDocRoot: false,
  43. pointer:{
  44. el:$(oLink)
  45. }
  46. });
  47. };
  48. function fvtSelectLanguage(sName, sLangName, oLink) {
  49. //--- Update popup languages
  50. var sId = '#bx-form-language-' + sName + '-' + sLangName;
  51. $(oLink).parent().siblings('.active:visible').hide().siblings('.not-active:hidden').show().siblings(sId + '-pas:visible').hide().siblings(sId + '-act:hidden').show();
  52. //--- Update current language
  53. var sIdElement = '#bx-form-element-' + sName;
  54. $(sIdElement).find('.bx-form-input-language-current').css('background-image', $(oLink).parent('.bx-form-input-language').css('background-image')).find('a').html($(oLink).html());
  55. //--- Update inputs
  56. var sIdInput = '#bx-form-input-' + sName + '-' + sLangName;
  57. $(sIdElement).find('.bx-form-input-text:visible, .bx-form-input-textarea:visible').hide().siblings(sIdInput + ':hidden').show();
  58. //--- Close selector
  59. $('#bx-form-field-translator-popup-' + sName).dolPopupHide();
  60. };
  61. /** @} */