Group.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. MWF.xApplication.TeamWork = MWF.xApplication.TeamWork || {};
  2. MWF.xApplication.TeamWork.Group = new Class({
  3. Extends: MWF.xApplication.TeamWork.Common.ToolTips,
  4. options : {
  5. // displayDelay : 300,
  6. hasArrow:false,
  7. event:"click"
  8. },
  9. _loadCustom : function( callback ){
  10. this.topBar = new Element("div.topBar",{styles:this.css.tooltip.group.topBar}).inject(this.contentNode);
  11. var tt = this.lp.group.topText;
  12. if(this.data.do == "edit"){
  13. tt = this.lp.group.topTextEdit;
  14. }
  15. this.topBarText = new Element("div.topBarText",{styles:this.css.tooltip.group.topBarText,text:tt}).inject(this.topBar);
  16. this.topBarClose = new Element("div.topBarClose",{styles:this.css.tooltip.group.topBarClose}).inject(this.topBar);
  17. this.topBarClose.addEvents({
  18. click:function(){this.hide()}.bind(this)
  19. });
  20. this.groupInContainer = new Element("div.groupInContainer",{styles:this.css.tooltip.group.groupInContainer}).inject(this.contentNode);
  21. this.groupIn = new Element("input.groupIn",{styles:this.css.tooltip.group.groupIn,type:"text",placeholder:this.lp.group.groupIn}).inject(this.groupInContainer);
  22. if(this.data.do == "edit"){
  23. if(this.data.name) this.groupIn.set("value",this.data.name);
  24. }
  25. this.groupIn.addEvents({
  26. keyup:function(){
  27. var v = this.groupIn.get("value");
  28. if(v.trim()==""){
  29. this.groupAdd.setStyles({
  30. "cursor":"",
  31. "background-color":"#F0F0F0",
  32. "color":"#666666"
  33. });
  34. }else{
  35. this.groupAdd.setStyles({
  36. "cursor":"pointer",
  37. "background-color":"#4A90E2",
  38. "color":"#FFFFFF"
  39. });
  40. }
  41. }.bind(this),
  42. focus:function(){
  43. this.groupInContainer.setStyles({"border":"1px solid #4A90E2"});
  44. }.bind(this),
  45. blur:function(){
  46. this.groupInContainer.setStyles({"border":"1px solid #A6A6A6"});
  47. }.bind(this)
  48. });
  49. this.groupAdd = new Element("div.groupAdd",{styles:this.css.tooltip.group.groupAdd,text:this.lp.group.groupAdd}).inject(this.contentNode);
  50. if(this.data.do == "edit"){
  51. this.groupAdd.setStyles({
  52. "cursor":"pointer",
  53. "background-color":"#4A90E2",
  54. "color":"#FFFFFF"
  55. })
  56. }
  57. this.groupAdd.addEvents({
  58. click:function(){
  59. if(this.groupIn.get("value").trim()=="") return;
  60. //var json = {
  61. // "do":this.data.do,
  62. // "title": this.groupIn.get("value").trim()
  63. //};
  64. var data = {
  65. "name":this.groupIn.get("value").trim()
  66. };
  67. if(this.data.do == "edit"){
  68. if(this.data.id){
  69. data.id = this.data.id;
  70. }
  71. }
  72. this.rootActions.ProjectGroupAction.save(data,function(json){
  73. this.close(json.data);
  74. }.bind(this),function(){
  75. //alert("err")
  76. }.bind(this));
  77. //this.hide();
  78. }.bind(this)
  79. });
  80. if(callback)callback();
  81. }
  82. });