Org.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. MWF.xDesktop.requireApp("process.Xform", "Org", null, false);
  2. MWF.xApplication.cms.Xform.Org = MWF.CMSOrg = new Class({
  3. Extends: MWF.APPOrg,
  4. _getOrgOptions: function(){
  5. this.selectTypeList = typeOf( this.json.selectType ) == "array" ? this.json.selectType : [this.json.selectType];
  6. if( this.selectTypeList.contains( "identity" ) ) {
  7. this.identityOptions = new MWF.CMSOrg.IdentityOptions(this.form, this.json);
  8. }
  9. if( this.selectTypeList.contains( "unit" ) ) {
  10. this.unitOptions = new MWF.CMSOrg.UnitOptions(this.form, this.json);
  11. }
  12. if( this.selectTypeList.contains( "group" ) ){
  13. this.groupOptions = new MWF.APPOrg.GroupOptions( this.form, this.json );
  14. }
  15. }
  16. });
  17. MWF.CMSOrg.IdentityOptions = new Class({
  18. Extends: MWF.APPOrg.IdentityOptions,
  19. _getSelectRange : function(){
  20. if (this.json.identityRange==="unit"){
  21. return this.getScriptSelectUnit();
  22. }
  23. if (this.json.identityRange==="draftUnit"){
  24. var dn = this.form.businessData.document.creatorIdentity;
  25. if (!dn){
  26. if ( layout.session.user.identityList && layout.session.user.identityList.length){
  27. var ids = [];
  28. layout.session.user.identityList.each(function(id){ ids.push(id.id); });
  29. return this.getNextSelectUnit(ids);
  30. }else{
  31. return [];
  32. }
  33. }else{
  34. return this.getNextSelectUnit(dn);
  35. }
  36. }
  37. if (this.json.identityRange==="currentUnit"){
  38. if ( layout.session.user.identityList && layout.session.user.identityList.length){
  39. var ids = [];
  40. layout.session.user.identityList.each(function(id){ ids.push(id.id); });
  41. return this.getNextSelectUnit(ids);
  42. }else{
  43. return [];
  44. }
  45. }
  46. return [];
  47. }
  48. });
  49. MWF.CMSOrg.UnitOptions = new Class({
  50. Extends: MWF.APPOrg.UnitOptions,
  51. _getSelectRange : function(){
  52. if (this.json.unitRange==="unit"){
  53. return this.getScriptSelectUnit();
  54. }
  55. if (this.json.unitRange==="draftUnit"){
  56. var dn = this.form.businessData.document.creatorIdentity;
  57. if (!dn){
  58. if ( layout.session.user.identityList && layout.session.user.identityList.length){
  59. var ids = [];
  60. layout.session.user.identityList.each(function(id){ ids.push(id.id); });
  61. return this.getNextSelectUnit(ids);
  62. }else{
  63. return [];
  64. }
  65. }else{
  66. return this.getNextSelectUnit(dn);
  67. }
  68. }
  69. if (this.json.unitRange==="currentUnit"){
  70. if ( layout.session.user.identityList && layout.session.user.identityList.length){
  71. var ids = [];
  72. layout.session.user.identityList.each(function(id){ ids.push(id.id); });
  73. return this.getNextSelectUnit(ids);
  74. }else{
  75. return [];
  76. }
  77. }
  78. return [];
  79. }
  80. });