Main.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. MWF.xDesktop.requireApp("TeamWork", "Common", null, false);
  2. MWF.xApplication.TeamWork.options = {
  3. multitask: false,
  4. executable: true
  5. };
  6. MWF.xApplication.TeamWork.Main = new Class({
  7. Extends: MWF.xApplication.Common.Main,
  8. Implements: [Options, Events],
  9. options: {
  10. "style": "default",
  11. "name": "TeamWork",
  12. "icon": "appicon.png",
  13. // "width": "1270",
  14. // "height": "700",
  15. // "isResize": false,
  16. // "isMax": true,
  17. "title": MWF.xApplication.TeamWork.LP.title
  18. },
  19. onQueryLoad: function(){
  20. this.lp = MWF.xApplication.TeamWork.LP;
  21. },
  22. loadApplication: function(callback){
  23. this.user = layout.desktop.session.user.name;
  24. this.distinguishedName = layout.desktop.session.user.distinguishedName;
  25. this.userGender = layout.desktop.session.user.genderType;
  26. this.department="";
  27. this.restActions = MWF.Actions.get("x_teamwork_assemble_control");
  28. this.orgActions = MWF.Actions.get("x_organization_assemble_express");
  29. MWF.xDesktop.requireApp("TeamWork", "ProjectList", function(){
  30. this.pl = new MWF.xApplication.TeamWork.ProjectList(this.content,this,this.restActions,{
  31. });
  32. this.pl.load();
  33. }.bind(this))
  34. this.addEvent("resize", function(){
  35. this.resize();
  36. }.bind(this));
  37. },
  38. showTips:function(target,data,opt){
  39. var opt = Object.merge( {nodeStyles:this.css.tips.nodeStyles}, opt );
  40. // if(this.stTimer){
  41. // clearTimeout(this.stTimer);
  42. // }
  43. // this.stTimer = window.setTimeout(function(){
  44. // var tt = new MWF.xApplication.TeamWork.Common.Tips(this.content, target, this.app, data, opt);
  45. // tt.load();
  46. // }.bind(this),100)
  47. this.st = new MWF.xApplication.TeamWork.Common.Tips(this.content, target, this.app, data, opt);
  48. this.st.load();
  49. },
  50. selectCalendar : function( target, container, options, callback ){
  51. var type = options.type;
  52. var calendarOptions = {
  53. "style" : "xform",
  54. "isTime": type == "time" || type.toLowerCase() == "datetime",
  55. "timeOnly": type == "time",
  56. "target": container,
  57. "onQueryComplate" : function( dateString ,date ){
  58. var json={
  59. "action":"ok",
  60. "dateString":dateString,
  61. "date":date
  62. };
  63. if( callback )callback( json );
  64. }.bind(this),
  65. "onClear":function(){
  66. var json={
  67. "action":"clear"
  68. };
  69. if(callback) callback(json);
  70. //if(this.calendar) delete this.calendar;
  71. }.bind(this),
  72. "onHide":function(){
  73. }.bind(this)
  74. };
  75. if( options.calendarOptions ){
  76. calendarOptions = Object.merge( calendarOptions, options.calendarOptions )
  77. }
  78. MWF.require("MWF.widget.Calendar", function(){
  79. this.calendar = new MWF.widget.Calendar( target, calendarOptions);
  80. this.calendar.show();
  81. }.bind(this));
  82. },
  83. setScrollBar: function(node, view, style, offset, callback){
  84. if (!style) style = "default";
  85. if (!offset){
  86. offset = {
  87. "V": {"x": 0, "y": 0},
  88. "H": {"x": 0, "y": 0}
  89. };
  90. }
  91. MWF.require("MWF.widget.ScrollBar", function(){
  92. if(this.scrollbar && this.scrollbar.scrollVAreaNode){
  93. this.scrollbar.scrollVAreaNode.destroy();
  94. delete this.scrollbar;
  95. }
  96. this.scrollbar = new MWF.widget.ScrollBar(node, {
  97. "style": style,
  98. "offset": offset,
  99. "where": "before",
  100. "indent": false,
  101. "distance": 100,
  102. "friction": 4,
  103. "onScroll": function (y) {
  104. var scrollSize = node.getScrollSize();
  105. var clientSize = node.getSize();
  106. var scrollHeight = scrollSize.y - clientSize.y;
  107. if (y + 200 > scrollHeight && view && view.loadElementList) {
  108. if (! view.isItemsLoaded) view.loadElementList()
  109. }
  110. }.bind(this)
  111. });
  112. if (callback) callback();
  113. }.bind(this));
  114. return false;
  115. },
  116. setLoading:function(container){
  117. var _height = container.getHeight();
  118. var _width = container.getWidth();
  119. var loading = new Element("img",{styles:this.css.loading,"src":"/x_component_TeamWork/$Main/default/icon/loading.gif"}).inject(container);
  120. loading.setStyles({
  121. "margin-left":(_width-loading.getWidth())/2+"px"
  122. })
  123. },
  124. showErrorMessage:function(xhr,text,error){
  125. var errorText = error;
  126. var errorMessage;
  127. if (xhr) errorMessage = xhr.responseText;
  128. if(errorMessage!=""){
  129. var e = JSON.parse(errorMessage);
  130. if(e.message){
  131. this.notice( e.message,"error");
  132. }else{
  133. this.notice( errorText,"error");
  134. }
  135. }else{
  136. this.notice(errorText,"error");
  137. }
  138. },
  139. resize:function(){
  140. //alert("resize")
  141. //Project
  142. if(this.content.getElements(".taskGroupItemContainer").length>0){
  143. this.content.getElements(".taskGroupItemContainer").each(function(d){
  144. var pe = d.getParent();
  145. var pr_w = pe.getElement(".taskGroupItemTitleContainer").getHeight().toInt();
  146. var _h = pe.getHeight().toInt() - pr_w -10-10;
  147. d.setStyles({"height":_h+"px"})
  148. });
  149. }
  150. //Task
  151. if(this.content.getElement(".taskInforContainer")){
  152. var _h = this.content.getElement(".taskInforContainer").getHeight().toInt();
  153. if(this.content.getElement(".taskInforContent")){
  154. this.content.getElement(".taskInforContent").setStyle("height",(_h+70)+"px")
  155. }
  156. }
  157. //taskGroupItemContainer
  158. //taskGroupLayout,taskGroupItemContainer 自定义高度
  159. },
  160. });