edit.ui.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. function loadLibModules()
  2. {
  3. const libID = $('#lib').zui('picker').$.value;
  4. const link = $.createLink('tree', 'ajaxGetOptionMenu', 'libID=' + libID + '&viewtype=caselib&branch=0&rootModuleID=0&returnType=items&fieldID=');
  5. $.get(link, function(data)
  6. {
  7. if(data)
  8. {
  9. data = JSON.parse(data);
  10. const $modulePicker = $('#module').zui('picker');
  11. $modulePicker.render({items: data});
  12. $modulePicker.$.changeState({value: ''});
  13. }
  14. });
  15. }
  16. function loadProductRelated(event)
  17. {
  18. const productID = $(event.target).val();
  19. loadProductBranches(productID);
  20. loadProductModules(productID);
  21. loadScenes(productID);
  22. loadProductStories(productID);
  23. }
  24. function loadBranchRelated()
  25. {
  26. const productID = $('[name=product]').val();
  27. loadProductModules(productID);
  28. loadScenes(productID);
  29. loadProductStories(productID);
  30. }
  31. function loadModuleRelated()
  32. {
  33. const productID = $('[name=product]').val();
  34. if(productID === undefined) return false;
  35. loadScenes(productID);
  36. if($('#story').length) loadProductStories(productID);
  37. }
  38. function checkScript()
  39. {
  40. $('.autoScript').toggleClass('hidden', !$('#auto').prop('checked'));
  41. }
  42. window.readScriptContent = function(object)
  43. {
  44. if(object.file == undefined) return false;
  45. $uploadBtnLabel = $('[name=scriptFile]').siblings().first();
  46. $uploadBtnLabel.toggle($('[name=scriptFile]').siblings().first().parents('td').find('.file-list').length < 1);
  47. $uploadBtnLabel.hide();
  48. var reader = new FileReader();
  49. reader.readAsText(object.file, 'UTF-8');
  50. reader.onload = function(evt){$('#script').val(evt.target.result);}
  51. }
  52. window.showUploadScriptBtn = function()
  53. {
  54. $('[name=scriptFile]').siblings().first().show();
  55. $('#script').val('');
  56. }